Loading core/java/android/content/res/Configuration.java +78 −22 Original line number Diff line number Diff line Loading @@ -295,6 +295,62 @@ public final class Configuration implements Parcelable, Comparable<Configuration return curLayout; } /** @hide */ public static String configurationDiffToString(int diff) { ArrayList<String> list = new ArrayList<>(); if ((diff & ActivityInfo.CONFIG_MCC) != 0) { list.add("CONFIG_MCC"); } if ((diff & ActivityInfo.CONFIG_MNC) != 0) { list.add("CONFIG_MNC"); } if ((diff & ActivityInfo.CONFIG_LOCALE) != 0) { list.add("CONFIG_LOCALE"); } if ((diff & ActivityInfo.CONFIG_TOUCHSCREEN) != 0) { list.add("CONFIG_TOUCHSCREEN"); } if ((diff & ActivityInfo.CONFIG_KEYBOARD) != 0) { list.add("CONFIG_KEYBOARD"); } if ((diff & ActivityInfo.CONFIG_KEYBOARD_HIDDEN) != 0) { list.add("CONFIG_KEYBOARD_HIDDEN"); } if ((diff & ActivityInfo.CONFIG_NAVIGATION) != 0) { list.add("CONFIG_NAVIGATION"); } if ((diff & ActivityInfo.CONFIG_ORIENTATION) != 0) { list.add("CONFIG_ORIENTATION"); } if ((diff & ActivityInfo.CONFIG_SCREEN_LAYOUT) != 0) { list.add("CONFIG_SCREEN_LAYOUT"); } if ((diff & ActivityInfo.CONFIG_UI_MODE) != 0) { list.add("CONFIG_UI_MODE"); } if ((diff & ActivityInfo.CONFIG_SCREEN_SIZE) != 0) { list.add("CONFIG_SCREEN_SIZE"); } if ((diff & ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) != 0) { list.add("CONFIG_SMALLEST_SCREEN_SIZE"); } if ((diff & ActivityInfo.CONFIG_LAYOUT_DIRECTION) != 0) { list.add("CONFIG_LAYOUT_DIRECTION"); } if ((diff & ActivityInfo.CONFIG_FONT_SCALE) != 0) { list.add("CONFIG_FONT_SCALE"); } StringBuilder builder = new StringBuilder("{"); for (int i = 0, n = list.size(); i < n; i++) { builder.append(list.get(i)); if (i != n - 1) { builder.append(", "); } } builder.append("}"); return builder.toString(); } /** * Check if the Configuration's current {@link #screenLayout} is at * least the given size. Loading services/core/java/com/android/server/am/ActivityManagerService.java +8 −6 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST; import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.FORCE_FOCUS; import static com.android.server.am.ActivityStackSupervisor.ON_TOP; import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS; import static com.android.server.am.TaskRecord.INVALID_TASK_ID; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE_PRIV; Loading Loading @@ -4626,7 +4627,7 @@ public final class ActivityManagerService extends ActivityManagerNative // is hosted by the process... then make sure all visible // activities are running, taking care of restarting this // process. mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } } Loading Loading @@ -8664,7 +8665,7 @@ public final class ActivityManagerService extends ActivityManagerNative } if (task.mResizeable != resizeable) { task.mResizeable = resizeable; mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mStackSupervisor.resumeTopActivitiesLocked(); } } Loading Loading @@ -9108,7 +9109,7 @@ public final class ActivityManagerService extends ActivityManagerNative long ident = Binder.clearCallingIdentity(); try { synchronized (this) { mStackSupervisor.resizeStackLocked(stackId, bounds); mStackSupervisor.resizeStackLocked(stackId, bounds, !PRESERVE_WINDOWS); } } finally { Binder.restoreCallingIdentity(ident); Loading Loading @@ -11188,7 +11189,7 @@ public final class ActivityManagerService extends ActivityManagerNative final boolean translucentChanged = r.changeWindowTranslucency(true); if (translucentChanged) { r.task.stack.releaseBackgroundResources(r); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } mWindowManager.setAppFullscreen(token, true); return translucentChanged; Loading Loading @@ -11216,7 +11217,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (translucentChanged) { r.task.stack.convertActivityToTranslucent(r); } mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mWindowManager.setAppFullscreen(token, false); return translucentChanged; } Loading Loading @@ -17699,7 +17700,8 @@ public final class ActivityManagerService extends ActivityManagerNative kept = mainStack.ensureActivityConfigurationLocked(starting, changes, false); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. mStackSupervisor.ensureActivitiesVisibleLocked(starting, changes); mStackSupervisor.ensureActivitiesVisibleLocked(starting, changes, !PRESERVE_WINDOWS); } } services/core/java/com/android/server/am/ActivityStack.java +11 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE; import static com.android.server.am.ActivityStackSupervisor.MOVING; import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS; import android.graphics.Rect; import android.util.ArraySet; Loading Loading @@ -815,7 +816,7 @@ final class ActivityStack { } void goToSleep() { ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); // Make sure any stopped but visible activities are now sleeping. // This ensures that the activity's onStop() is called. Loading Loading @@ -1379,7 +1380,8 @@ final class ActivityStack { * Make sure that all activities that need to be visible (that is, they * currently can be seen by the user) actually are. */ final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) { final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges, boolean preserveWindows) { ActivityRecord top = topRunningActivityLocked(null); if (top == null) { return; Loading Loading @@ -1428,7 +1430,7 @@ final class ActivityStack { // First: if this is not the current activity being started, make // sure it matches the current configuration. if (r != starting) { ensureActivityConfigurationLocked(r, 0, false); ensureActivityConfigurationLocked(r, 0, preserveWindows); } if (r.app == null || r.app.thread == null) { Loading Loading @@ -2342,7 +2344,7 @@ final class ActivityStack { // Don't do a starting window for mLaunchTaskBehind. More importantly make sure we // tell WindowManager that r is visible even though it is at the back of the stack. mWindowManager.setAppVisibility(r.appToken, true); ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } else if (SHOW_APP_STARTING_PREVIEW && doShow) { // Figure out if we are transitioning from another activity that is // "has the same starting icon" as the next one. This allows the Loading Loading @@ -4024,6 +4026,11 @@ final class ActivityStack { return true; } if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Configuration changes for " + r + " ; taskChanges=" + Configuration.configurationDiffToString(taskChanges) + ", allChanges=" + Configuration.configurationDiffToString(changes)); // If the activity isn't currently running, just leave the new // configuration and it will pick that up next time it starts. if (r.app == null || r.app.thread == null) { Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +21 −14 Original line number Diff line number Diff line Loading @@ -175,6 +175,9 @@ public final class ActivityStackSupervisor implements DisplayListener { // should be created if it doesn't exist already. private static final boolean CREATE_IF_NEEDED = true; // Used to indicate that windows of activities should be preserved during the resize. static final boolean PRESERVE_WINDOWS = true; // Used to indicate if an object (e.g. task) should be moved/created // at the top of its container (e.g. stack). static final boolean ON_TOP = true; Loading @@ -189,6 +192,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // Activity actions an app cannot start if it uses a permission which is not granted. private static final ArrayMap<String, String> ACTION_TO_RUNTIME_PERMISSION = new ArrayMap<>(); static { ACTION_TO_RUNTIME_PERMISSION.put(MediaStore.ACTION_IMAGE_CAPTURE, Manifest.permission.CAMERA); Loading Loading @@ -660,7 +664,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } if (!didSomething) { ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } return didSomething; } Loading Loading @@ -2629,7 +2633,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } mLaunchingActivity.release(); } ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } // Atomically retrieve all of the other things to do. Loading Loading @@ -2963,7 +2967,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } void resizeStackLocked(int stackId, Rect bounds) { void resizeStackLocked(int stackId, Rect bounds, boolean preserveWindows) { final ActivityStack stack = getStack(stackId); if (stack == null) { Slog.w(TAG, "resizeStack: stackId " + stackId + " not found."); Loading Loading @@ -3002,7 +3006,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // docked stack tasks to the fullscreen stack. for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) { if (i != DOCKED_STACK_ID) { resizeStackLocked(i, null); resizeStackLocked(i, null, preserveWindows); } } Loading Loading @@ -3033,20 +3037,22 @@ public final class ActivityStackSupervisor implements DisplayListener { tempRect.right -= leftChange; tempRect.top -= bottomChange; tempRect.bottom -= topChange; resizeStackLocked(i, tempRect); resizeStackLocked(i, tempRect, PRESERVE_WINDOWS); } } } } // Since we are resizing the stack, all other operations should strive to preserve // windows. preserveWindows = true; } stack.setBounds(bounds); if (r != null) { final boolean updated = stack.ensureActivityConfigurationLocked(r, 0, false); final boolean updated = stack.ensureActivityConfigurationLocked(r, 0, preserveWindows); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. ensureActivitiesVisibleLocked(r, 0); ensureActivitiesVisibleLocked(r, 0, preserveWindows); if (!updated) { resumeTopActivitiesLocked(stack, null, null); } Loading Loading @@ -3107,7 +3113,7 @@ public final class ActivityStackSupervisor implements DisplayListener { final boolean preserveWindow = resizedByUser && !changedStacks; kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow); // All other activities must be made visible with their correct configuration. ensureActivitiesVisibleLocked(r, 0); ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS); if (!kept) { resumeTopActivitiesLocked(stack, null, null); if (changedStacks && stackId == FULLSCREEN_WORKSPACE_STACK_ID) { Loading Loading @@ -3255,7 +3261,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // The task might have already been running and its visibility needs to be synchronized with // the visibility of the stack / windows. ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); resumeTopActivitiesLocked(); } Loading @@ -3275,7 +3281,7 @@ public final class ActivityStackSupervisor implements DisplayListener { stack.positionTask(task, position, stackChanged); // The task might have already been running and its visibility needs to be synchronized with // the visibility of the stack / windows. stack.ensureActivitiesVisibleLocked(null, 0); stack.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); resumeTopActivitiesLocked(); } Loading Loading @@ -3450,7 +3456,7 @@ public final class ActivityStackSupervisor implements DisplayListener { mService.updateUsageStats(r, true); } if (allResumedActivitiesComplete()) { ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mWindowManager.executeAppTransition(); return true; } Loading Loading @@ -3536,14 +3542,15 @@ public final class ActivityStackSupervisor implements DisplayListener { mHandler.obtainMessage(LAUNCH_TASK_BEHIND_COMPLETE, token).sendToTarget(); } void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) { void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges, boolean preserveWindows) { // First the front stacks. In case any are not fullscreen and are in front of home. for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) { final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks; final int topStackNdx = stacks.size() - 1; for (int stackNdx = topStackNdx; stackNdx >= 0; --stackNdx) { final ActivityStack stack = stacks.get(stackNdx); stack.ensureActivitiesVisibleLocked(starting, configChanges); stack.ensureActivitiesVisibleLocked(starting, configChanges, preserveWindows); } } } Loading services/core/java/com/android/server/am/CompatModePackages.java +2 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.am; import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS; import java.io.File; import java.io.FileInputStream; Loading Loading @@ -347,7 +348,7 @@ public final class CompatModePackages { stack.ensureActivityConfigurationLocked(starting, 0, false); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. stack.ensureActivitiesVisibleLocked(starting, 0); stack.ensureActivitiesVisibleLocked(starting, 0, !PRESERVE_WINDOWS); } } } Loading Loading
core/java/android/content/res/Configuration.java +78 −22 Original line number Diff line number Diff line Loading @@ -295,6 +295,62 @@ public final class Configuration implements Parcelable, Comparable<Configuration return curLayout; } /** @hide */ public static String configurationDiffToString(int diff) { ArrayList<String> list = new ArrayList<>(); if ((diff & ActivityInfo.CONFIG_MCC) != 0) { list.add("CONFIG_MCC"); } if ((diff & ActivityInfo.CONFIG_MNC) != 0) { list.add("CONFIG_MNC"); } if ((diff & ActivityInfo.CONFIG_LOCALE) != 0) { list.add("CONFIG_LOCALE"); } if ((diff & ActivityInfo.CONFIG_TOUCHSCREEN) != 0) { list.add("CONFIG_TOUCHSCREEN"); } if ((diff & ActivityInfo.CONFIG_KEYBOARD) != 0) { list.add("CONFIG_KEYBOARD"); } if ((diff & ActivityInfo.CONFIG_KEYBOARD_HIDDEN) != 0) { list.add("CONFIG_KEYBOARD_HIDDEN"); } if ((diff & ActivityInfo.CONFIG_NAVIGATION) != 0) { list.add("CONFIG_NAVIGATION"); } if ((diff & ActivityInfo.CONFIG_ORIENTATION) != 0) { list.add("CONFIG_ORIENTATION"); } if ((diff & ActivityInfo.CONFIG_SCREEN_LAYOUT) != 0) { list.add("CONFIG_SCREEN_LAYOUT"); } if ((diff & ActivityInfo.CONFIG_UI_MODE) != 0) { list.add("CONFIG_UI_MODE"); } if ((diff & ActivityInfo.CONFIG_SCREEN_SIZE) != 0) { list.add("CONFIG_SCREEN_SIZE"); } if ((diff & ActivityInfo.CONFIG_SMALLEST_SCREEN_SIZE) != 0) { list.add("CONFIG_SMALLEST_SCREEN_SIZE"); } if ((diff & ActivityInfo.CONFIG_LAYOUT_DIRECTION) != 0) { list.add("CONFIG_LAYOUT_DIRECTION"); } if ((diff & ActivityInfo.CONFIG_FONT_SCALE) != 0) { list.add("CONFIG_FONT_SCALE"); } StringBuilder builder = new StringBuilder("{"); for (int i = 0, n = list.size(); i < n; i++) { builder.append(list.get(i)); if (i != n - 1) { builder.append(", "); } } builder.append("}"); return builder.toString(); } /** * Check if the Configuration's current {@link #screenLayout} is at * least the given size. Loading
services/core/java/com/android/server/am/ActivityManagerService.java +8 −6 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import static com.android.server.Watchdog.NATIVE_STACKS_OF_INTEREST; import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.FORCE_FOCUS; import static com.android.server.am.ActivityStackSupervisor.ON_TOP; import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS; import static com.android.server.am.TaskRecord.INVALID_TASK_ID; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_DONT_LOCK; import static com.android.server.am.TaskRecord.LOCK_TASK_AUTH_LAUNCHABLE_PRIV; Loading Loading @@ -4626,7 +4627,7 @@ public final class ActivityManagerService extends ActivityManagerNative // is hosted by the process... then make sure all visible // activities are running, taking care of restarting this // process. mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } } Loading Loading @@ -8664,7 +8665,7 @@ public final class ActivityManagerService extends ActivityManagerNative } if (task.mResizeable != resizeable) { task.mResizeable = resizeable; mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mStackSupervisor.resumeTopActivitiesLocked(); } } Loading Loading @@ -9108,7 +9109,7 @@ public final class ActivityManagerService extends ActivityManagerNative long ident = Binder.clearCallingIdentity(); try { synchronized (this) { mStackSupervisor.resizeStackLocked(stackId, bounds); mStackSupervisor.resizeStackLocked(stackId, bounds, !PRESERVE_WINDOWS); } } finally { Binder.restoreCallingIdentity(ident); Loading Loading @@ -11188,7 +11189,7 @@ public final class ActivityManagerService extends ActivityManagerNative final boolean translucentChanged = r.changeWindowTranslucency(true); if (translucentChanged) { r.task.stack.releaseBackgroundResources(r); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } mWindowManager.setAppFullscreen(token, true); return translucentChanged; Loading Loading @@ -11216,7 +11217,7 @@ public final class ActivityManagerService extends ActivityManagerNative if (translucentChanged) { r.task.stack.convertActivityToTranslucent(r); } mStackSupervisor.ensureActivitiesVisibleLocked(null, 0); mStackSupervisor.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mWindowManager.setAppFullscreen(token, false); return translucentChanged; } Loading Loading @@ -17699,7 +17700,8 @@ public final class ActivityManagerService extends ActivityManagerNative kept = mainStack.ensureActivityConfigurationLocked(starting, changes, false); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. mStackSupervisor.ensureActivitiesVisibleLocked(starting, changes); mStackSupervisor.ensureActivitiesVisibleLocked(starting, changes, !PRESERVE_WINDOWS); } }
services/core/java/com/android/server/am/ActivityStack.java +11 −4 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import static com.android.server.am.ActivityRecord.HOME_ACTIVITY_TYPE; import static com.android.server.am.ActivityRecord.APPLICATION_ACTIVITY_TYPE; import static com.android.server.am.ActivityStackSupervisor.MOVING; import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS; import android.graphics.Rect; import android.util.ArraySet; Loading Loading @@ -815,7 +816,7 @@ final class ActivityStack { } void goToSleep() { ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); // Make sure any stopped but visible activities are now sleeping. // This ensures that the activity's onStop() is called. Loading Loading @@ -1379,7 +1380,8 @@ final class ActivityStack { * Make sure that all activities that need to be visible (that is, they * currently can be seen by the user) actually are. */ final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) { final void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges, boolean preserveWindows) { ActivityRecord top = topRunningActivityLocked(null); if (top == null) { return; Loading Loading @@ -1428,7 +1430,7 @@ final class ActivityStack { // First: if this is not the current activity being started, make // sure it matches the current configuration. if (r != starting) { ensureActivityConfigurationLocked(r, 0, false); ensureActivityConfigurationLocked(r, 0, preserveWindows); } if (r.app == null || r.app.thread == null) { Loading Loading @@ -2342,7 +2344,7 @@ final class ActivityStack { // Don't do a starting window for mLaunchTaskBehind. More importantly make sure we // tell WindowManager that r is visible even though it is at the back of the stack. mWindowManager.setAppVisibility(r.appToken, true); ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } else if (SHOW_APP_STARTING_PREVIEW && doShow) { // Figure out if we are transitioning from another activity that is // "has the same starting icon" as the next one. This allows the Loading Loading @@ -4024,6 +4026,11 @@ final class ActivityStack { return true; } if (DEBUG_SWITCH || DEBUG_CONFIGURATION) Slog.v(TAG_CONFIGURATION, "Configuration changes for " + r + " ; taskChanges=" + Configuration.configurationDiffToString(taskChanges) + ", allChanges=" + Configuration.configurationDiffToString(changes)); // If the activity isn't currently running, just leave the new // configuration and it will pick that up next time it starts. if (r.app == null || r.app.thread == null) { Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +21 −14 Original line number Diff line number Diff line Loading @@ -175,6 +175,9 @@ public final class ActivityStackSupervisor implements DisplayListener { // should be created if it doesn't exist already. private static final boolean CREATE_IF_NEEDED = true; // Used to indicate that windows of activities should be preserved during the resize. static final boolean PRESERVE_WINDOWS = true; // Used to indicate if an object (e.g. task) should be moved/created // at the top of its container (e.g. stack). static final boolean ON_TOP = true; Loading @@ -189,6 +192,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // Activity actions an app cannot start if it uses a permission which is not granted. private static final ArrayMap<String, String> ACTION_TO_RUNTIME_PERMISSION = new ArrayMap<>(); static { ACTION_TO_RUNTIME_PERMISSION.put(MediaStore.ACTION_IMAGE_CAPTURE, Manifest.permission.CAMERA); Loading Loading @@ -660,7 +664,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } if (!didSomething) { ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } return didSomething; } Loading Loading @@ -2629,7 +2633,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } mLaunchingActivity.release(); } ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); } // Atomically retrieve all of the other things to do. Loading Loading @@ -2963,7 +2967,7 @@ public final class ActivityStackSupervisor implements DisplayListener { } } void resizeStackLocked(int stackId, Rect bounds) { void resizeStackLocked(int stackId, Rect bounds, boolean preserveWindows) { final ActivityStack stack = getStack(stackId); if (stack == null) { Slog.w(TAG, "resizeStack: stackId " + stackId + " not found."); Loading Loading @@ -3002,7 +3006,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // docked stack tasks to the fullscreen stack. for (int i = FIRST_STATIC_STACK_ID; i <= LAST_STATIC_STACK_ID; i++) { if (i != DOCKED_STACK_ID) { resizeStackLocked(i, null); resizeStackLocked(i, null, preserveWindows); } } Loading Loading @@ -3033,20 +3037,22 @@ public final class ActivityStackSupervisor implements DisplayListener { tempRect.right -= leftChange; tempRect.top -= bottomChange; tempRect.bottom -= topChange; resizeStackLocked(i, tempRect); resizeStackLocked(i, tempRect, PRESERVE_WINDOWS); } } } } // Since we are resizing the stack, all other operations should strive to preserve // windows. preserveWindows = true; } stack.setBounds(bounds); if (r != null) { final boolean updated = stack.ensureActivityConfigurationLocked(r, 0, false); final boolean updated = stack.ensureActivityConfigurationLocked(r, 0, preserveWindows); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. ensureActivitiesVisibleLocked(r, 0); ensureActivitiesVisibleLocked(r, 0, preserveWindows); if (!updated) { resumeTopActivitiesLocked(stack, null, null); } Loading Loading @@ -3107,7 +3113,7 @@ public final class ActivityStackSupervisor implements DisplayListener { final boolean preserveWindow = resizedByUser && !changedStacks; kept = stack.ensureActivityConfigurationLocked(r, 0, preserveWindow); // All other activities must be made visible with their correct configuration. ensureActivitiesVisibleLocked(r, 0); ensureActivitiesVisibleLocked(r, 0, !PRESERVE_WINDOWS); if (!kept) { resumeTopActivitiesLocked(stack, null, null); if (changedStacks && stackId == FULLSCREEN_WORKSPACE_STACK_ID) { Loading Loading @@ -3255,7 +3261,7 @@ public final class ActivityStackSupervisor implements DisplayListener { // The task might have already been running and its visibility needs to be synchronized with // the visibility of the stack / windows. ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); resumeTopActivitiesLocked(); } Loading @@ -3275,7 +3281,7 @@ public final class ActivityStackSupervisor implements DisplayListener { stack.positionTask(task, position, stackChanged); // The task might have already been running and its visibility needs to be synchronized with // the visibility of the stack / windows. stack.ensureActivitiesVisibleLocked(null, 0); stack.ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); resumeTopActivitiesLocked(); } Loading Loading @@ -3450,7 +3456,7 @@ public final class ActivityStackSupervisor implements DisplayListener { mService.updateUsageStats(r, true); } if (allResumedActivitiesComplete()) { ensureActivitiesVisibleLocked(null, 0); ensureActivitiesVisibleLocked(null, 0, !PRESERVE_WINDOWS); mWindowManager.executeAppTransition(); return true; } Loading Loading @@ -3536,14 +3542,15 @@ public final class ActivityStackSupervisor implements DisplayListener { mHandler.obtainMessage(LAUNCH_TASK_BEHIND_COMPLETE, token).sendToTarget(); } void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges) { void ensureActivitiesVisibleLocked(ActivityRecord starting, int configChanges, boolean preserveWindows) { // First the front stacks. In case any are not fullscreen and are in front of home. for (int displayNdx = mActivityDisplays.size() - 1; displayNdx >= 0; --displayNdx) { final ArrayList<ActivityStack> stacks = mActivityDisplays.valueAt(displayNdx).mStacks; final int topStackNdx = stacks.size() - 1; for (int stackNdx = topStackNdx; stackNdx >= 0; --stackNdx) { final ActivityStack stack = stacks.get(stackNdx); stack.ensureActivitiesVisibleLocked(starting, configChanges); stack.ensureActivitiesVisibleLocked(starting, configChanges, preserveWindows); } } } Loading
services/core/java/com/android/server/am/CompatModePackages.java +2 −1 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.server.am; import static com.android.server.am.ActivityManagerDebugConfig.*; import static com.android.server.am.ActivityStackSupervisor.PRESERVE_WINDOWS; import java.io.File; import java.io.FileInputStream; Loading Loading @@ -347,7 +348,7 @@ public final class CompatModePackages { stack.ensureActivityConfigurationLocked(starting, 0, false); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. stack.ensureActivitiesVisibleLocked(starting, 0); stack.ensureActivitiesVisibleLocked(starting, 0, !PRESERVE_WINDOWS); } } } Loading