http://www.cnblogs.com/xiyuan2016/p/6740623.html
===================================================================================
frameworks/base/services/core/java/com/android/server/am/BroadcastQueue.java
final void processNextBroadcast(boolean fromMsg) {
在 boolean skip = false; 下边添加
final String action = r.intent.getAction(); final String clsName = info.activityInfo.name; if("android.intent.action.CONFIGURATION_CHANGED".equals(action) && "应用类名".equals(clsName)){ skip = true; }===================================================================================
去掉多用户后想让下拉单的多用户图标显示出来
/code2/lq80/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/QuickStatusBarHeader.java
protected void updateVisibilities() { updateAlarmVisibilities(); mEmergencyOnly.setVisibility(mExpanded && mShowEmergencyCallsOnly ? View.VISIBLE : View.INVISIBLE); mSettingsContainer.setVisibility(mExpanded ? View.VISIBLE : View.INVISIBLE); mSettingsContainer.findViewById(R.id.tuner_icon).setVisibility( TunerService.isTunerEnabled(mContext) ? View.VISIBLE : View.INVISIBLE); mMultiUserSwitch.setVisibility(mExpanded && mMultiUserSwitch.hasMultipleUsers() ? View.VISIBLE : View.INVISIBLE); }
mMultiUserSwitch.setVisibility(mExpanded && mMultiUserSwitch.hasMultipleUsers() ? View.VISIBLE : View.INVISIBLE);这句话就是控制那个多用户现实不显示的
不支持多用户后点击多用户按钮会进入添加联系人的界面
frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/MultiUserSwitch.java
的onClick方法里的else里将原来的intent替换为
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setType("vnd.android.cursor.dir/person");
intent.setType("vnd.android.cursor.dir/contact");
intent.setType("vnd.android.cursor.dir/raw_contact");
就可以了。
设置里边多去掉多用户的菜单
packages/apps/Settings/AndroidManifest.xml
android:name="Settings$UserSettingsActivity"
这个activity里注释掉
android:name="com.android.settings.category"
android:value="com.android.settings.category.device" />
就可以了。这个以后解释。
==============================================================================
播放声音
int max = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL); mAudioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, max, 0); mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 16, 0); setVolumeControlStream(AudioManager.STREAM_VOICE_CALL);//A: zhaopenglin for cannot play mp3 at once 20170607 if (mMediaPlayer != null) { mMediaPlayer.stop(); mMediaPlayer.release(); mMediaPlayer = null; } try { mMediaPlayer = new MediaPlayer(); AssetFileDescriptor assetFileDescriptor = this.getResources().openRawResourceFd(R.raw.testmusic); if (assetFileDescriptor == null) return; mMediaPlayer.setDataSource(assetFileDescriptor.getFileDescriptor(), assetFileDescriptor.getStartOffset(), assetFileDescriptor.getLength()); assetFileDescriptor.close(); mMediaPlayer.setAudioStreamType(AudioManager.STREAM_VOICE_CALL); mMediaPlayer.prepare(); } catch (IllegalStateException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } mMediaPlayer.setVolume(max, max); mMediaPlayer.start(); mMediaPlayer.setLooping(true);
==========================================================================================================================
可分屏应用调用不能分屏应用,分屏报错
frameworks/base/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@Override public boolean dockTopTask(int dragMode, int stackCreateMode, Rect initialBounds, int metricsDockAction) {…………………………
boolean screenPinningActive = ssp.isScreenPinningActive(); boolean isRunningTaskInHomeStack = runningTask != null && SystemServicesProxy.isHomeStack(runningTask.stackId); //add start if(runningTask != null && runningTask.topActivity.getPackageName().equals("不能分屏应用的包名")) { Toast.makeText(mContext, R.string.recents_incompatible_app_message, Toast.LENGTH_SHORT).show(); return false; } //add end
/code1/lq80/frameworks/base/packages/SystemUI/src/com/android/systemui/recents/views/RecentsViewTouchHandler.java
public final void onBusEvent(DragStartEvent event) {
……………………
if (!event.task.isDockable || event.task.getTopComponent().getPackageName().equals("不能分屏应用的包名")) { EventBus.getDefault().send(new ShowIncompatibleAppOverlayEvent()); } else {
public final void onBusEvent(DragEndEvent event) {
……………………
if (!mDragTask.isDockable || mDragTask.getTopComponent().getPackageName().equals("不能分屏应用包名")) { EventBus.getDefault().send(new HideIncompatibleAppOverlayEvent()); }
===========================================================================
8.0 USB窗口解锁白屏
frameworks/base/services/core/java/com/android/server/am/KeyguardController.java
mStackSupervisor.addStartingWindowsForVisibleActivities(false /* taskSwitch */);
================================================================================================
默认打开launcher3在设置里的通知
frameworks\base\services\core\java\com\android\server\notification\ManagedServices.java
private void rebuildRestoredPackages() { mRestoredPackages.clear(); String secureSettingName = restoredSettingName(mConfig.secureSettingName); String secondarySettingName = mConfig.secondarySettingName == null ? null : restoredSettingName(mConfig.secondarySettingName); //add by zhaopenglin start try { if ((Settings.System.getInt(mContext.getContentResolver(), "lalalaal", 0) == 0) && Settings.Secure.ENABLED_NOTIFICATION_LISTENERS.equals(mConfig.secureSettingName)) { Settings.Secure.putString(mContext.getContentResolver(), mConfig.secureSettingName, "com.android.launcher3/com.android.launcher3.notification.NotificationListener"); Settings.System.putInt(mContext.getContentResolver(), "lalalaal", 1); } }catch (Exception e){} //add by zhaopenglin end int[] userIds = mUserProfiles.getCurrentProfileIds(); final int N = userIds.length; for (int i = 0; i < N; ++i) { ArraySetnames = loadComponentNamesFromSetting(secureSettingName , userIds[i]); if (secondarySettingName != null) { names.addAll(loadComponentNamesFromSetting(secondarySettingName, userIds[i])); } for (ComponentName name : names) { mRestoredPackages.add(name.getPackageName()); } } }