Loading services/core/java/com/android/server/wm/ActivityRecord.java +32 −38 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_F import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_NONE; import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_WINDOWING_MODE_RESIZE; import static com.android.server.wm.ActivityTaskManagerService.getInputDispatchingTimeoutMillisLocked; import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.IdentifierProto.HASH_CODE; import static com.android.server.wm.IdentifierProto.TITLE; import static com.android.server.wm.IdentifierProto.USER_ID; Loading Loading @@ -949,7 +948,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private int mConfigurationSeq; /** * Temp configs used in {@link #ensureActivityConfiguration(int, boolean)} * Temp configs used in {@link #ensureActivityConfiguration()} */ private final Configuration mTmpConfig = new Configuration(); private final Rect mTmpBounds = new Rect(); Loading Loading @@ -1511,7 +1510,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A updatePictureInPictureMode(null, false); } else { mLastReportedMultiWindowMode = inMultiWindowMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS); ensureActivityConfiguration(); } } } Loading @@ -1530,8 +1529,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // precede the configuration change from the resize. mLastReportedPictureInPictureMode = inPictureInPictureMode; mLastReportedMultiWindowMode = inPictureInPictureMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, true /* ignoreVisibility */); ensureActivityConfiguration(true /* ignoreVisibility */); if (inPictureInPictureMode && findMainWindow() == null) { // Prevent malicious app entering PiP without valid WindowState, which can in turn // result a non-touchable PiP window since the InputConsumer for PiP requires it. Loading Loading @@ -3107,7 +3105,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // {@link #returningOptions} of the activity under this one can be applied in // {@link #handleAlreadyVisible()}. if (changed || !occludesParent) { mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } return changed; } Loading Loading @@ -3747,8 +3745,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } if (ensureVisibility) { mDisplayContent.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */, true /* notifyClients */); mDisplayContent.ensureActivitiesVisible(null /* starting */, true /* notifyClients */); } } Loading Loading @@ -4165,8 +4163,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (rootTask != null && rootTask.shouldSleepOrShutDownActivities()) { // Activity is always relaunched to either resumed or paused state. If it was // relaunched while hidden (by keyguard or smth else), it should be stopped. rootTask.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */); rootTask.ensureActivitiesVisible(null /* starting */); } } Loading Loading @@ -4681,14 +4678,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A void setShowWhenLocked(boolean showWhenLocked) { mShowWhenLocked = showWhenLocked; mAtmService.mRootWindowContainer.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */); mAtmService.mRootWindowContainer.ensureActivitiesVisible(); } void setInheritShowWhenLocked(boolean inheritShowWhenLocked) { mInheritShownWhenLocked = inheritShowWhenLocked; mAtmService.mRootWindowContainer.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */); mAtmService.mRootWindowContainer.ensureActivitiesVisible(); } /** Loading Loading @@ -6413,7 +6408,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } mDisplayContent.handleActivitySizeCompatModeIfNeeded(this); mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } /** Loading Loading @@ -7894,7 +7889,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A void applyFixedRotationTransform(DisplayInfo info, DisplayFrames displayFrames, Configuration config) { super.applyFixedRotationTransform(info, displayFrames, config); ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */); ensureActivityConfiguration(); } /** Loading Loading @@ -7989,7 +7984,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A startFreezingScreen(originalDisplayRotation); // This activity may relaunch or perform configuration change so once it has reported drawn, // the screen can be unfrozen. ensureActivityConfiguration(0 /* globalChanges */, !PRESERVE_WINDOWS); ensureActivityConfiguration(); if (mTransitionController.isCollecting(this)) { // In case the task was changed from PiP but still keeps old transform. task.resetSurfaceControlTransforms(); Loading Loading @@ -8017,7 +8012,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // the request is handled at task level with letterbox. if (!getMergedOverrideConfiguration().equals( mLastReportedConfiguration.getMergedConfiguration())) { ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */, ensureActivityConfiguration( false /* ignoreVisibility */, true /* isRequestedOrientationChanged */); if (mTransitionController.inPlayingTransition(this)) { mTransitionController.mValidateActivityCompat.add(this); Loading Loading @@ -9525,14 +9520,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return mLastReportedDisplayId != getDisplayId(); } boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow) { return ensureActivityConfiguration(globalChanges, preserveWindow, false /* ignoreVisibility */, false /* isRequestedOrientationChanged */); boolean ensureActivityConfiguration() { return ensureActivityConfiguration(false /* ignoreVisibility */); } boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility) { return ensureActivityConfiguration(globalChanges, preserveWindow, ignoreVisibility, boolean ensureActivityConfiguration(boolean ignoreVisibility) { return ensureActivityConfiguration(ignoreVisibility, false /* isRequestedOrientationChanged */); } Loading @@ -9540,9 +9533,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * Make sure the given activity matches the current configuration. Ensures the HistoryRecord * is updated with the correct configuration and all other bookkeeping is handled. * * @param globalChanges The changes to the global configuration. * @param preserveWindow If the activity window should be preserved on screen if the activity * is relaunched. * @param ignoreVisibility If we should try to relaunch the activity even if it is invisible * (stopped state). This is useful for the case where we know the * activity will be visible soon and we want to ensure its configuration Loading @@ -9552,8 +9542,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * @return False if the activity was relaunched and true if it wasn't relaunched because we * can't or the app handles the specific configuration that is changing. */ boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility, boolean isRequestedOrientationChanged) { boolean ensureActivityConfiguration(boolean ignoreVisibility, boolean isRequestedOrientationChanged) { final Task rootTask = getRootTask(); if (rootTask.mConfigWillChange) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Skipping config check " Loading Loading @@ -9667,10 +9657,21 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (shouldRelaunchLocked(changes, mTmpConfig)) { // Aha, the activity isn't handling the change, so DIE DIE DIE. configChangeFlags |= changes; startFreezingScreenLocked(globalChanges); if (mVisible && mAtmService.mTmpUpdateConfigurationResult.mIsUpdating && !mTransitionController.isShellTransitionsEnabled()) { startFreezingScreenLocked(mAtmService.mTmpUpdateConfigurationResult.changes); } final boolean displayMayChange = mTmpConfig.windowConfiguration.getDisplayRotation() != getWindowConfiguration().getDisplayRotation() || !mTmpConfig.windowConfiguration.getMaxBounds().equals( getWindowConfiguration().getMaxBounds()); final boolean isAppResizeOnly = !displayMayChange && (changes & ~(CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT)) == 0; // Do not preserve window if it is freezing screen because the original window won't be // able to update drawn state that causes freeze timeout. preserveWindow &= isResizeOnlyChange(changes) && !mFreezingScreen; // TODO(b/258618073): Always preserve if possible. final boolean preserveWindow = isAppResizeOnly && !mFreezingScreen; final boolean hasResizeChange = hasResizeChange(changes & ~info.getRealConfigChanged()); if (hasResizeChange) { final boolean isDragResizing = task.isDragResizing(); Loading Loading @@ -9834,11 +9835,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return changes; } private static boolean isResizeOnlyChange(int change) { return (change & ~(CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT)) == 0; } private static boolean hasResizeChange(int change) { return (change & (CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT)) != 0; Loading Loading @@ -9882,8 +9878,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A task.mTaskId, shortComponentName, Integer.toHexString(configChangeFlags)); } startFreezingScreenLocked(0); try { ProtoLog.i(WM_DEBUG_STATES, "Moving to %s Relaunching %s callers=%s" , (andResume ? "RESUMED" : "PAUSED"), this, Debug.getCallers(6)); Loading services/core/java/com/android/server/wm/ActivityStarter.java +2 −4 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLAS import static com.android.server.wm.ActivityTaskManagerService.ANIMATE; import static com.android.server.wm.ActivityTaskSupervisor.DEFER_RESUME; import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP; import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_DEFAULT; import static com.android.server.wm.BackgroundActivityStartController.BAL_BLOCK; import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.PHASE_BOUNDS; Loading Loading @@ -1860,8 +1859,7 @@ class ActivityStarter { // over is removed. // Passing {@code null} as the start parameter ensures all activities are made // visible. mTargetRootTask.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); mTargetRootTask.ensureActivitiesVisible(null /* starting */); // Go ahead and tell window manager to execute app transition for this activity // since the app transition will not be triggered through the resume channel. mTargetRootTask.mDisplayContent.executeAppTransition(); Loading Loading @@ -2868,7 +2866,7 @@ class ActivityStarter { mRootWindowContainer.resumeFocusedTasksTopActivities(mTargetRootTask, null, mOptions, mTransientLaunch); } else { mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } } else { ActivityOptions.abort(mOptions); Loading services/core/java/com/android/server/wm/ActivityTaskManagerService.java +10 −25 Original line number Diff line number Diff line Loading @@ -118,7 +118,6 @@ import static com.android.server.wm.ActivityTaskManagerService.H.REPORT_TIME_TRA import static com.android.server.wm.ActivityTaskManagerService.UiHandler.DISMISS_DIALOG_UI_MSG; import static com.android.server.wm.ActivityTaskSupervisor.DEFER_RESUME; import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP; import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS; import static com.android.server.wm.BackgroundActivityStartController.BalVerdict; import static com.android.server.wm.LockTaskController.LOCK_TASK_AUTH_DONT_LOCK; Loading Loading @@ -496,16 +495,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { final UpdateConfigurationResult mTmpUpdateConfigurationResult = new UpdateConfigurationResult(); // TODO(b/258618073): Remove this and make the related methods return whether config is changed. static final class UpdateConfigurationResult { // Configuration changes that were updated. int changes; // If the activity was relaunched to match the new configuration. boolean activityRelaunched; void reset() { changes = 0; activityRelaunched = false; } boolean mIsUpdating; } /** Current sequencing integer of the configuration, for skipping old configurations. */ Loading Loading @@ -3834,8 +3830,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { Settings.System.clearConfiguration(values); } updateConfigurationLocked(values, null, false, false /* persistent */, UserHandle.USER_NULL, false /* deferResume */, mTmpUpdateConfigurationResult); UserHandle.USER_NULL, false /* deferResume */); return mTmpUpdateConfigurationResult.changes != 0; } finally { Binder.restoreCallingIdentity(origId); Loading Loading @@ -4507,12 +4502,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } private boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean initLocale, boolean persistent, int userId, boolean deferResume) { return updateConfigurationLocked(values, starting, initLocale, persistent, userId, deferResume, null /* result */); } /** * Do either or both things: (1) change the current configuration, and (2) * make sure the given activity is running with the (now) current Loading @@ -4524,8 +4513,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { * for that particular user */ boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean initLocale, boolean persistent, int userId, boolean deferResume, ActivityTaskManagerService.UpdateConfigurationResult result) { boolean initLocale, boolean persistent, int userId, boolean deferResume) { int changes = 0; boolean kept = true; Loading @@ -4533,19 +4521,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { try { if (values != null) { changes = updateGlobalConfigurationLocked(values, initLocale, persistent, userId); mTmpUpdateConfigurationResult.changes = changes; mTmpUpdateConfigurationResult.mIsUpdating = true; } if (!deferResume) { kept = ensureConfigAndVisibilityAfterUpdate(starting, changes); } } finally { mTmpUpdateConfigurationResult.mIsUpdating = false; continueWindowLayout(); } if (result != null) { result.changes = changes; result.activityRelaunched = !kept; } mTmpUpdateConfigurationResult.activityRelaunched = !kept; return kept; } Loading Loading @@ -5325,12 +5312,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } if (starting != null) { kept = starting.ensureActivityConfiguration(changes, false /* preserveWindow */); kept = starting.ensureActivityConfiguration(); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. mRootWindowContainer.ensureActivitiesVisible(starting, changes, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(starting); } } Loading services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +5 −5 Original line number Diff line number Diff line Loading @@ -1462,7 +1462,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { } mLaunchingActivityWakeLock.release(); } mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } // Atomically retrieve all of the other things to do. Loading Loading @@ -1603,7 +1603,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { */ rootTask.cancelAnimation(); rootTask.setForceHidden(FLAG_FORCE_HIDDEN_FOR_PINNED_TASK, true /* set */); rootTask.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS); rootTask.ensureActivitiesVisible(null /* starting */); activityIdleInternal(null /* idleActivity */, false /* fromTimeout */, true /* processPausingActivities */, null /* configuration */); Loading @@ -1622,7 +1622,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { // Follow on the workaround: activities are kept force hidden till the new windowing // mode is set. rootTask.setForceHidden(FLAG_FORCE_HIDDEN_FOR_PINNED_TASK, false /* set */); mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); mRootWindowContainer.resumeFocusedTasksTopActivities(); } finally { mService.continueWindowLayout(); Loading Loading @@ -2026,7 +2026,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { final Task rootTask = r.getRootTask(); if (rootTask.getDisplayArea().allResumedActivitiesComplete()) { mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); // Make sure activity & window visibility should be identical // for all displays in this stage. mRootWindowContainer.executeAppTransitionForAllDisplay(); Loading @@ -2042,7 +2042,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { mRecentTasks.add(task); mService.getTaskChangeNotificationController().notifyTaskStackChanged(); rootTask.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); rootTask.ensureActivitiesVisible(null /* starting */); // When launching tasks behind, update the last active time of the top task after the new // task has been shown briefly Loading services/core/java/com/android/server/wm/BackNavigationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -1614,7 +1614,7 @@ class BackNavigationController { "Setting Activity.mLauncherTaskBehind to true. Activity=%s", activity); activity.mTaskSupervisor.mStoppingActivities.remove(activity); activity.getDisplayContent().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */, true); true /* notifyClients */); } private static void restoreLaunchBehind(@NonNull ActivityRecord activity) { Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +32 −38 Original line number Diff line number Diff line Loading @@ -223,7 +223,6 @@ import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_F import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_NONE; import static com.android.server.wm.ActivityTaskManagerService.RELAUNCH_REASON_WINDOWING_MODE_RESIZE; import static com.android.server.wm.ActivityTaskManagerService.getInputDispatchingTimeoutMillisLocked; import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.IdentifierProto.HASH_CODE; import static com.android.server.wm.IdentifierProto.TITLE; import static com.android.server.wm.IdentifierProto.USER_ID; Loading Loading @@ -949,7 +948,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A private int mConfigurationSeq; /** * Temp configs used in {@link #ensureActivityConfiguration(int, boolean)} * Temp configs used in {@link #ensureActivityConfiguration()} */ private final Configuration mTmpConfig = new Configuration(); private final Rect mTmpBounds = new Rect(); Loading Loading @@ -1511,7 +1510,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A updatePictureInPictureMode(null, false); } else { mLastReportedMultiWindowMode = inMultiWindowMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS); ensureActivityConfiguration(); } } } Loading @@ -1530,8 +1529,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // precede the configuration change from the resize. mLastReportedPictureInPictureMode = inPictureInPictureMode; mLastReportedMultiWindowMode = inPictureInPictureMode; ensureActivityConfiguration(0 /* globalChanges */, PRESERVE_WINDOWS, true /* ignoreVisibility */); ensureActivityConfiguration(true /* ignoreVisibility */); if (inPictureInPictureMode && findMainWindow() == null) { // Prevent malicious app entering PiP without valid WindowState, which can in turn // result a non-touchable PiP window since the InputConsumer for PiP requires it. Loading Loading @@ -3107,7 +3105,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // {@link #returningOptions} of the activity under this one can be applied in // {@link #handleAlreadyVisible()}. if (changed || !occludesParent) { mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } return changed; } Loading Loading @@ -3747,8 +3745,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } if (ensureVisibility) { mDisplayContent.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */, true /* notifyClients */); mDisplayContent.ensureActivitiesVisible(null /* starting */, true /* notifyClients */); } } Loading Loading @@ -4165,8 +4163,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (rootTask != null && rootTask.shouldSleepOrShutDownActivities()) { // Activity is always relaunched to either resumed or paused state. If it was // relaunched while hidden (by keyguard or smth else), it should be stopped. rootTask.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */); rootTask.ensureActivitiesVisible(null /* starting */); } } Loading Loading @@ -4681,14 +4678,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A void setShowWhenLocked(boolean showWhenLocked) { mShowWhenLocked = showWhenLocked; mAtmService.mRootWindowContainer.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */); mAtmService.mRootWindowContainer.ensureActivitiesVisible(); } void setInheritShowWhenLocked(boolean inheritShowWhenLocked) { mInheritShownWhenLocked = inheritShowWhenLocked; mAtmService.mRootWindowContainer.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */); mAtmService.mRootWindowContainer.ensureActivitiesVisible(); } /** Loading Loading @@ -6413,7 +6408,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } mDisplayContent.handleActivitySizeCompatModeIfNeeded(this); mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } /** Loading Loading @@ -7894,7 +7889,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A void applyFixedRotationTransform(DisplayInfo info, DisplayFrames displayFrames, Configuration config) { super.applyFixedRotationTransform(info, displayFrames, config); ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */); ensureActivityConfiguration(); } /** Loading Loading @@ -7989,7 +7984,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A startFreezingScreen(originalDisplayRotation); // This activity may relaunch or perform configuration change so once it has reported drawn, // the screen can be unfrozen. ensureActivityConfiguration(0 /* globalChanges */, !PRESERVE_WINDOWS); ensureActivityConfiguration(); if (mTransitionController.isCollecting(this)) { // In case the task was changed from PiP but still keeps old transform. task.resetSurfaceControlTransforms(); Loading Loading @@ -8017,7 +8012,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A // the request is handled at task level with letterbox. if (!getMergedOverrideConfiguration().equals( mLastReportedConfiguration.getMergedConfiguration())) { ensureActivityConfiguration(0 /* globalChanges */, false /* preserveWindow */, ensureActivityConfiguration( false /* ignoreVisibility */, true /* isRequestedOrientationChanged */); if (mTransitionController.inPlayingTransition(this)) { mTransitionController.mValidateActivityCompat.add(this); Loading Loading @@ -9525,14 +9520,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return mLastReportedDisplayId != getDisplayId(); } boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow) { return ensureActivityConfiguration(globalChanges, preserveWindow, false /* ignoreVisibility */, false /* isRequestedOrientationChanged */); boolean ensureActivityConfiguration() { return ensureActivityConfiguration(false /* ignoreVisibility */); } boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility) { return ensureActivityConfiguration(globalChanges, preserveWindow, ignoreVisibility, boolean ensureActivityConfiguration(boolean ignoreVisibility) { return ensureActivityConfiguration(ignoreVisibility, false /* isRequestedOrientationChanged */); } Loading @@ -9540,9 +9533,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * Make sure the given activity matches the current configuration. Ensures the HistoryRecord * is updated with the correct configuration and all other bookkeeping is handled. * * @param globalChanges The changes to the global configuration. * @param preserveWindow If the activity window should be preserved on screen if the activity * is relaunched. * @param ignoreVisibility If we should try to relaunch the activity even if it is invisible * (stopped state). This is useful for the case where we know the * activity will be visible soon and we want to ensure its configuration Loading @@ -9552,8 +9542,8 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * @return False if the activity was relaunched and true if it wasn't relaunched because we * can't or the app handles the specific configuration that is changing. */ boolean ensureActivityConfiguration(int globalChanges, boolean preserveWindow, boolean ignoreVisibility, boolean isRequestedOrientationChanged) { boolean ensureActivityConfiguration(boolean ignoreVisibility, boolean isRequestedOrientationChanged) { final Task rootTask = getRootTask(); if (rootTask.mConfigWillChange) { ProtoLog.v(WM_DEBUG_CONFIGURATION, "Skipping config check " Loading Loading @@ -9667,10 +9657,21 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (shouldRelaunchLocked(changes, mTmpConfig)) { // Aha, the activity isn't handling the change, so DIE DIE DIE. configChangeFlags |= changes; startFreezingScreenLocked(globalChanges); if (mVisible && mAtmService.mTmpUpdateConfigurationResult.mIsUpdating && !mTransitionController.isShellTransitionsEnabled()) { startFreezingScreenLocked(mAtmService.mTmpUpdateConfigurationResult.changes); } final boolean displayMayChange = mTmpConfig.windowConfiguration.getDisplayRotation() != getWindowConfiguration().getDisplayRotation() || !mTmpConfig.windowConfiguration.getMaxBounds().equals( getWindowConfiguration().getMaxBounds()); final boolean isAppResizeOnly = !displayMayChange && (changes & ~(CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT)) == 0; // Do not preserve window if it is freezing screen because the original window won't be // able to update drawn state that causes freeze timeout. preserveWindow &= isResizeOnlyChange(changes) && !mFreezingScreen; // TODO(b/258618073): Always preserve if possible. final boolean preserveWindow = isAppResizeOnly && !mFreezingScreen; final boolean hasResizeChange = hasResizeChange(changes & ~info.getRealConfigChanged()); if (hasResizeChange) { final boolean isDragResizing = task.isDragResizing(); Loading Loading @@ -9834,11 +9835,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A return changes; } private static boolean isResizeOnlyChange(int change) { return (change & ~(CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT)) == 0; } private static boolean hasResizeChange(int change) { return (change & (CONFIG_SCREEN_SIZE | CONFIG_SMALLEST_SCREEN_SIZE | CONFIG_ORIENTATION | CONFIG_SCREEN_LAYOUT)) != 0; Loading Loading @@ -9882,8 +9878,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A task.mTaskId, shortComponentName, Integer.toHexString(configChangeFlags)); } startFreezingScreenLocked(0); try { ProtoLog.i(WM_DEBUG_STATES, "Moving to %s Relaunching %s callers=%s" , (andResume ? "RESUMED" : "PAUSED"), this, Debug.getCallers(6)); Loading
services/core/java/com/android/server/wm/ActivityStarter.java +2 −4 Original line number Diff line number Diff line Loading @@ -73,7 +73,6 @@ import static com.android.server.wm.ActivityTaskManagerDebugConfig.TAG_WITH_CLAS import static com.android.server.wm.ActivityTaskManagerService.ANIMATE; import static com.android.server.wm.ActivityTaskSupervisor.DEFER_RESUME; import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP; import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.BackgroundActivityStartController.BAL_ALLOW_DEFAULT; import static com.android.server.wm.BackgroundActivityStartController.BAL_BLOCK; import static com.android.server.wm.LaunchParamsController.LaunchParamsModifier.PHASE_BOUNDS; Loading Loading @@ -1860,8 +1859,7 @@ class ActivityStarter { // over is removed. // Passing {@code null} as the start parameter ensures all activities are made // visible. mTargetRootTask.ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, !PRESERVE_WINDOWS); mTargetRootTask.ensureActivitiesVisible(null /* starting */); // Go ahead and tell window manager to execute app transition for this activity // since the app transition will not be triggered through the resume channel. mTargetRootTask.mDisplayContent.executeAppTransition(); Loading Loading @@ -2868,7 +2866,7 @@ class ActivityStarter { mRootWindowContainer.resumeFocusedTasksTopActivities(mTargetRootTask, null, mOptions, mTransientLaunch); } else { mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } } else { ActivityOptions.abort(mOptions); Loading
services/core/java/com/android/server/wm/ActivityTaskManagerService.java +10 −25 Original line number Diff line number Diff line Loading @@ -118,7 +118,6 @@ import static com.android.server.wm.ActivityTaskManagerService.H.REPORT_TIME_TRA import static com.android.server.wm.ActivityTaskManagerService.UiHandler.DISMISS_DIALOG_UI_MSG; import static com.android.server.wm.ActivityTaskSupervisor.DEFER_RESUME; import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP; import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS; import static com.android.server.wm.ActivityTaskSupervisor.REMOVE_FROM_RECENTS; import static com.android.server.wm.BackgroundActivityStartController.BalVerdict; import static com.android.server.wm.LockTaskController.LOCK_TASK_AUTH_DONT_LOCK; Loading Loading @@ -496,16 +495,13 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { final UpdateConfigurationResult mTmpUpdateConfigurationResult = new UpdateConfigurationResult(); // TODO(b/258618073): Remove this and make the related methods return whether config is changed. static final class UpdateConfigurationResult { // Configuration changes that were updated. int changes; // If the activity was relaunched to match the new configuration. boolean activityRelaunched; void reset() { changes = 0; activityRelaunched = false; } boolean mIsUpdating; } /** Current sequencing integer of the configuration, for skipping old configurations. */ Loading Loading @@ -3834,8 +3830,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { Settings.System.clearConfiguration(values); } updateConfigurationLocked(values, null, false, false /* persistent */, UserHandle.USER_NULL, false /* deferResume */, mTmpUpdateConfigurationResult); UserHandle.USER_NULL, false /* deferResume */); return mTmpUpdateConfigurationResult.changes != 0; } finally { Binder.restoreCallingIdentity(origId); Loading Loading @@ -4507,12 +4502,6 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } } private boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean initLocale, boolean persistent, int userId, boolean deferResume) { return updateConfigurationLocked(values, starting, initLocale, persistent, userId, deferResume, null /* result */); } /** * Do either or both things: (1) change the current configuration, and (2) * make sure the given activity is running with the (now) current Loading @@ -4524,8 +4513,7 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { * for that particular user */ boolean updateConfigurationLocked(Configuration values, ActivityRecord starting, boolean initLocale, boolean persistent, int userId, boolean deferResume, ActivityTaskManagerService.UpdateConfigurationResult result) { boolean initLocale, boolean persistent, int userId, boolean deferResume) { int changes = 0; boolean kept = true; Loading @@ -4533,19 +4521,18 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { try { if (values != null) { changes = updateGlobalConfigurationLocked(values, initLocale, persistent, userId); mTmpUpdateConfigurationResult.changes = changes; mTmpUpdateConfigurationResult.mIsUpdating = true; } if (!deferResume) { kept = ensureConfigAndVisibilityAfterUpdate(starting, changes); } } finally { mTmpUpdateConfigurationResult.mIsUpdating = false; continueWindowLayout(); } if (result != null) { result.changes = changes; result.activityRelaunched = !kept; } mTmpUpdateConfigurationResult.activityRelaunched = !kept; return kept; } Loading Loading @@ -5325,12 +5312,10 @@ public class ActivityTaskManagerService extends IActivityTaskManager.Stub { } if (starting != null) { kept = starting.ensureActivityConfiguration(changes, false /* preserveWindow */); kept = starting.ensureActivityConfiguration(); // And we need to make sure at this point that all other activities // are made visible with the correct configuration. mRootWindowContainer.ensureActivitiesVisible(starting, changes, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(starting); } } Loading
services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +5 −5 Original line number Diff line number Diff line Loading @@ -1462,7 +1462,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { } mLaunchingActivityWakeLock.release(); } mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); } // Atomically retrieve all of the other things to do. Loading Loading @@ -1603,7 +1603,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { */ rootTask.cancelAnimation(); rootTask.setForceHidden(FLAG_FORCE_HIDDEN_FOR_PINNED_TASK, true /* set */); rootTask.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS); rootTask.ensureActivitiesVisible(null /* starting */); activityIdleInternal(null /* idleActivity */, false /* fromTimeout */, true /* processPausingActivities */, null /* configuration */); Loading @@ -1622,7 +1622,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { // Follow on the workaround: activities are kept force hidden till the new windowing // mode is set. rootTask.setForceHidden(FLAG_FORCE_HIDDEN_FOR_PINNED_TASK, false /* set */); mRootWindowContainer.ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); mRootWindowContainer.resumeFocusedTasksTopActivities(); } finally { mService.continueWindowLayout(); Loading Loading @@ -2026,7 +2026,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { final Task rootTask = r.getRootTask(); if (rootTask.getDisplayArea().allResumedActivitiesComplete()) { mRootWindowContainer.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); mRootWindowContainer.ensureActivitiesVisible(); // Make sure activity & window visibility should be identical // for all displays in this stage. mRootWindowContainer.executeAppTransitionForAllDisplay(); Loading @@ -2042,7 +2042,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { mRecentTasks.add(task); mService.getTaskChangeNotificationController().notifyTaskStackChanged(); rootTask.ensureActivitiesVisible(null, 0, !PRESERVE_WINDOWS); rootTask.ensureActivitiesVisible(null /* starting */); // When launching tasks behind, update the last active time of the top task after the new // task has been shown briefly Loading
services/core/java/com/android/server/wm/BackNavigationController.java +1 −1 Original line number Diff line number Diff line Loading @@ -1614,7 +1614,7 @@ class BackNavigationController { "Setting Activity.mLauncherTaskBehind to true. Activity=%s", activity); activity.mTaskSupervisor.mStoppingActivities.remove(activity); activity.getDisplayContent().ensureActivitiesVisible(null /* starting */, 0 /* configChanges */, false /* preserveWindows */, true); true /* notifyClients */); } private static void restoreLaunchBehind(@NonNull ActivityRecord activity) { Loading