Loading services/core/java/com/android/server/wm/ActivityRecord.java +10 −31 Original line number Diff line number Diff line Loading @@ -543,11 +543,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final ActivityTaskSupervisor mTaskSupervisor; final RootWindowContainer mRootWindowContainer; static final int STARTING_WINDOW_NOT_SHOWN = 0; static final int STARTING_WINDOW_SHOWN = 1; static final int STARTING_WINDOW_REMOVED = 2; int mStartingWindowState = STARTING_WINDOW_NOT_SHOWN; // Tracking splash screen status from previous activity boolean mSplashScreenStyleEmpty = false; Loading Loading @@ -888,19 +883,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } }; private static String startingWindowStateToString(int state) { switch (state) { case STARTING_WINDOW_NOT_SHOWN: return "STARTING_WINDOW_NOT_SHOWN"; case STARTING_WINDOW_SHOWN: return "STARTING_WINDOW_SHOWN"; case STARTING_WINDOW_REMOVED: return "STARTING_WINDOW_REMOVED"; default: return "unknown state=" + state; } } @Override void dump(PrintWriter pw, String prefix, boolean dumpAll) { final long now = SystemClock.uptimeMillis(); Loading Loading @@ -1057,9 +1039,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" finishing="); pw.println(finishing); pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" idle="); pw.print(idle); pw.print(" mStartingWindowState="); pw.println(startingWindowStateToString(mStartingWindowState)); pw.print(" idle="); pw.println(idle); pw.print(prefix); pw.print("occludesParent="); pw.print(occludesParent()); pw.print(" noDisplay="); pw.print(noDisplay); pw.print(" immersive="); pw.print(immersive); Loading Loading @@ -2021,6 +2001,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } @VisibleForTesting boolean addStartingWindow(String pkg, int resolvedTheme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning, Loading Loading @@ -2356,13 +2337,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void removeStartingWindow() { if (transferSplashScreenIfNeeded()) { return; } removeStartingWindowAnimation(true /* prepareAnimation */); } void removeStartingWindowAnimation(boolean prepareAnimation) { if (transferSplashScreenIfNeeded()) { return; } mTransferringSplashScreenState = TRANSFER_SPLASH_SCREEN_IDLE; if (mStartingWindow == null) { if (mStartingData != null) { Loading Loading @@ -6498,13 +6479,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final boolean newSingleActivity = !newTask && !activityCreated && task.getActivity((r) -> !r.finishing && r != this) == null; final boolean shown = addStartingWindow(packageName, resolvedTheme, final boolean scheduled = addStartingWindow(packageName, resolvedTheme, compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags, prev != null ? prev.appToken : null, newTask || newSingleActivity, taskSwitch, isProcessRunning(), allowTaskSnapshot(), activityCreated, mSplashScreenStyleEmpty); if (shown) { mStartingWindowState = STARTING_WINDOW_SHOWN; if (DEBUG_STARTING_WINDOW_VERBOSE && scheduled) { Slog.d(TAG, "Scheduled starting window for " + this); } } Loading @@ -6516,14 +6497,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * It should only be called if this activity is behind other fullscreen activity. */ void cancelInitializing() { if (mStartingWindowState == STARTING_WINDOW_SHOWN) { if (mStartingData != null) { // Remove orphaned starting window. if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY, "Found orphaned starting window " + this); mStartingWindowState = STARTING_WINDOW_REMOVED; removeStartingWindowAnimation(false /* prepareAnimation */); } if (isState(INITIALIZING) && !shouldBeVisible( true /* behindFullscreenActivity */, true /* ignoringKeyguard */)) { if (!mDisplayContent.mUnknownAppVisibilityController.allResolved()) { // Remove the unknown visibility record because an invisible activity shouldn't block // the keyguard transition. mDisplayContent.mUnknownAppVisibilityController.appRemovedOrHidden(this); Loading services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm; import static com.android.server.wm.ActivityRecord.State.INITIALIZING; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_VISIBILITY; import static com.android.server.wm.Task.TAG_VISIBILITY; Loading Loading @@ -141,6 +142,8 @@ class EnsureActivitiesVisibleHelper { } else { mBehindFullyOccludedContainer = false; } } else if (r.isState(INITIALIZING)) { r.cancelInitializing(); } if (reallyVisible) { Loading services/core/java/com/android/server/wm/RootWindowContainer.java +0 −8 Original line number Diff line number Diff line Loading @@ -3437,14 +3437,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> }, true /* traverseTopToBottom */); } void cancelInitializingActivities() { forAllRootTasks(task -> { // We don't want to clear starting window for activities that aren't occluded // as we need to display their starting window until they are done initializing. task.forAllOccludedActivities(ActivityRecord::cancelInitializing); }); } Task anyTaskForId(int id) { return anyTaskForId(id, MATCH_ATTACHED_TASK_OR_RECENT_TASKS_AND_RESTORE); } Loading services/core/java/com/android/server/wm/Task.java +2 −31 Original line number Diff line number Diff line Loading @@ -76,7 +76,6 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_LOCKTASK; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_RECENTS_ANIMATIONS; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_STATES; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_TASKS; import static com.android.server.wm.ActivityRecord.STARTING_WINDOW_SHOWN; import static com.android.server.wm.ActivityRecord.State.INITIALIZING; import static com.android.server.wm.ActivityRecord.State.PAUSED; import static com.android.server.wm.ActivityRecord.State.PAUSING; Loading Loading @@ -1429,14 +1428,6 @@ class Task extends TaskFragment { window.getBaseType() == TYPE_APPLICATION_STARTING) != null); } ActivityRecord topActivityWithStartingWindow() { if (getParent() == null) { return null; } return getActivity((r) -> r.mStartingWindowState == STARTING_WINDOW_SHOWN && r.okToShowLocked()); } /** * Return the number of running activities, and the number of non-finishing/initializing * activities in the provided {@param reportOut} respectively. Loading Loading @@ -2840,25 +2831,6 @@ class Task extends TaskFragment { return top != activity ? top : null; } /** Iterates through all occluded activities. */ void forAllOccludedActivities(Consumer<ActivityRecord> handleOccludedActivity) { if (!shouldBeVisible(null /* starting */)) { // The root task is invisible so all activities are occluded. forAllActivities(handleOccludedActivity); return; } final ActivityRecord topOccluding = getOccludingActivityAbove(null); if (topOccluding == null) { // No activities are occluded. return; } // Invoke the callback on the activities behind the top occluding activity. forAllActivities(r -> { handleOccludedActivity.accept(r); return false; }, topOccluding, false /* includeBoundary */, true /* traverseTopToBottom */); } @Override public SurfaceControl.Builder makeAnimationLeash() { return super.makeAnimationLeash().setMetadata(METADATA_TASK_ID, mTaskId); Loading Loading @@ -4896,8 +4868,6 @@ class Task extends TaskFragment { return false; } mRootWindowContainer.cancelInitializingActivities(); final ActivityRecord topActivity = topRunningActivity(true /* focusableOnly */); if (topActivity == null) { // There are no activities left in this task, let's look somewhere else. Loading Loading @@ -5055,7 +5025,8 @@ class Task extends TaskFragment { // window manager to keep the previous window it had previously // created, if it still had one. Task prevTask = r.getTask(); ActivityRecord prev = prevTask.topActivityWithStartingWindow(); ActivityRecord prev = prevTask.getActivity( a -> a.mStartingData != null && a.okToShowLocked()); if (prev != null) { // We don't want to reuse the previous starting preview if: // (1) The current activity is in a different task. Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +0 −1 Original line number Diff line number Diff line Loading @@ -2590,7 +2590,6 @@ public class ActivityRecordTests extends WindowTestsBase { false /* activityCreate */, false /* suggestEmpty */); waitUntilHandlersIdle(); assertHasStartingWindow(activity); activity.mStartingWindowState = ActivityRecord.STARTING_WINDOW_SHOWN; doCallRealMethod().when(task).startActivityLocked( any(), any(), anyBoolean(), anyBoolean(), any(), any()); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +10 −31 Original line number Diff line number Diff line Loading @@ -543,11 +543,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final ActivityTaskSupervisor mTaskSupervisor; final RootWindowContainer mRootWindowContainer; static final int STARTING_WINDOW_NOT_SHOWN = 0; static final int STARTING_WINDOW_SHOWN = 1; static final int STARTING_WINDOW_REMOVED = 2; int mStartingWindowState = STARTING_WINDOW_NOT_SHOWN; // Tracking splash screen status from previous activity boolean mSplashScreenStyleEmpty = false; Loading Loading @@ -888,19 +883,6 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } }; private static String startingWindowStateToString(int state) { switch (state) { case STARTING_WINDOW_NOT_SHOWN: return "STARTING_WINDOW_NOT_SHOWN"; case STARTING_WINDOW_SHOWN: return "STARTING_WINDOW_SHOWN"; case STARTING_WINDOW_REMOVED: return "STARTING_WINDOW_REMOVED"; default: return "unknown state=" + state; } } @Override void dump(PrintWriter pw, String prefix, boolean dumpAll) { final long now = SystemClock.uptimeMillis(); Loading Loading @@ -1057,9 +1039,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A pw.print(" finishing="); pw.println(finishing); pw.print(prefix); pw.print("keysPaused="); pw.print(keysPaused); pw.print(" inHistory="); pw.print(inHistory); pw.print(" idle="); pw.print(idle); pw.print(" mStartingWindowState="); pw.println(startingWindowStateToString(mStartingWindowState)); pw.print(" idle="); pw.println(idle); pw.print(prefix); pw.print("occludesParent="); pw.print(occludesParent()); pw.print(" noDisplay="); pw.print(noDisplay); pw.print(" immersive="); pw.print(immersive); Loading Loading @@ -2021,6 +2001,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } } @VisibleForTesting boolean addStartingWindow(String pkg, int resolvedTheme, CompatibilityInfo compatInfo, CharSequence nonLocalizedLabel, int labelRes, int icon, int logo, int windowFlags, IBinder transferFrom, boolean newTask, boolean taskSwitch, boolean processRunning, Loading Loading @@ -2356,13 +2337,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A } void removeStartingWindow() { if (transferSplashScreenIfNeeded()) { return; } removeStartingWindowAnimation(true /* prepareAnimation */); } void removeStartingWindowAnimation(boolean prepareAnimation) { if (transferSplashScreenIfNeeded()) { return; } mTransferringSplashScreenState = TRANSFER_SPLASH_SCREEN_IDLE; if (mStartingWindow == null) { if (mStartingData != null) { Loading Loading @@ -6498,13 +6479,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A final boolean newSingleActivity = !newTask && !activityCreated && task.getActivity((r) -> !r.finishing && r != this) == null; final boolean shown = addStartingWindow(packageName, resolvedTheme, final boolean scheduled = addStartingWindow(packageName, resolvedTheme, compatInfo, nonLocalizedLabel, labelRes, icon, logo, windowFlags, prev != null ? prev.appToken : null, newTask || newSingleActivity, taskSwitch, isProcessRunning(), allowTaskSnapshot(), activityCreated, mSplashScreenStyleEmpty); if (shown) { mStartingWindowState = STARTING_WINDOW_SHOWN; if (DEBUG_STARTING_WINDOW_VERBOSE && scheduled) { Slog.d(TAG, "Scheduled starting window for " + this); } } Loading @@ -6516,14 +6497,12 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A * It should only be called if this activity is behind other fullscreen activity. */ void cancelInitializing() { if (mStartingWindowState == STARTING_WINDOW_SHOWN) { if (mStartingData != null) { // Remove orphaned starting window. if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY, "Found orphaned starting window " + this); mStartingWindowState = STARTING_WINDOW_REMOVED; removeStartingWindowAnimation(false /* prepareAnimation */); } if (isState(INITIALIZING) && !shouldBeVisible( true /* behindFullscreenActivity */, true /* ignoringKeyguard */)) { if (!mDisplayContent.mUnknownAppVisibilityController.allResolved()) { // Remove the unknown visibility record because an invisible activity shouldn't block // the keyguard transition. mDisplayContent.mUnknownAppVisibilityController.appRemovedOrHidden(this); Loading
services/core/java/com/android/server/wm/EnsureActivitiesVisibleHelper.java +3 −0 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.server.wm; import static com.android.server.wm.ActivityRecord.State.INITIALIZING; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_VISIBILITY; import static com.android.server.wm.Task.TAG_VISIBILITY; Loading Loading @@ -141,6 +142,8 @@ class EnsureActivitiesVisibleHelper { } else { mBehindFullyOccludedContainer = false; } } else if (r.isState(INITIALIZING)) { r.cancelInitializing(); } if (reallyVisible) { Loading
services/core/java/com/android/server/wm/RootWindowContainer.java +0 −8 Original line number Diff line number Diff line Loading @@ -3437,14 +3437,6 @@ class RootWindowContainer extends WindowContainer<DisplayContent> }, true /* traverseTopToBottom */); } void cancelInitializingActivities() { forAllRootTasks(task -> { // We don't want to clear starting window for activities that aren't occluded // as we need to display their starting window until they are done initializing. task.forAllOccludedActivities(ActivityRecord::cancelInitializing); }); } Task anyTaskForId(int id) { return anyTaskForId(id, MATCH_ATTACHED_TASK_OR_RECENT_TASKS_AND_RESTORE); } Loading
services/core/java/com/android/server/wm/Task.java +2 −31 Original line number Diff line number Diff line Loading @@ -76,7 +76,6 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_LOCKTASK; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_RECENTS_ANIMATIONS; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_STATES; import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_TASKS; import static com.android.server.wm.ActivityRecord.STARTING_WINDOW_SHOWN; import static com.android.server.wm.ActivityRecord.State.INITIALIZING; import static com.android.server.wm.ActivityRecord.State.PAUSED; import static com.android.server.wm.ActivityRecord.State.PAUSING; Loading Loading @@ -1429,14 +1428,6 @@ class Task extends TaskFragment { window.getBaseType() == TYPE_APPLICATION_STARTING) != null); } ActivityRecord topActivityWithStartingWindow() { if (getParent() == null) { return null; } return getActivity((r) -> r.mStartingWindowState == STARTING_WINDOW_SHOWN && r.okToShowLocked()); } /** * Return the number of running activities, and the number of non-finishing/initializing * activities in the provided {@param reportOut} respectively. Loading Loading @@ -2840,25 +2831,6 @@ class Task extends TaskFragment { return top != activity ? top : null; } /** Iterates through all occluded activities. */ void forAllOccludedActivities(Consumer<ActivityRecord> handleOccludedActivity) { if (!shouldBeVisible(null /* starting */)) { // The root task is invisible so all activities are occluded. forAllActivities(handleOccludedActivity); return; } final ActivityRecord topOccluding = getOccludingActivityAbove(null); if (topOccluding == null) { // No activities are occluded. return; } // Invoke the callback on the activities behind the top occluding activity. forAllActivities(r -> { handleOccludedActivity.accept(r); return false; }, topOccluding, false /* includeBoundary */, true /* traverseTopToBottom */); } @Override public SurfaceControl.Builder makeAnimationLeash() { return super.makeAnimationLeash().setMetadata(METADATA_TASK_ID, mTaskId); Loading Loading @@ -4896,8 +4868,6 @@ class Task extends TaskFragment { return false; } mRootWindowContainer.cancelInitializingActivities(); final ActivityRecord topActivity = topRunningActivity(true /* focusableOnly */); if (topActivity == null) { // There are no activities left in this task, let's look somewhere else. Loading Loading @@ -5055,7 +5025,8 @@ class Task extends TaskFragment { // window manager to keep the previous window it had previously // created, if it still had one. Task prevTask = r.getTask(); ActivityRecord prev = prevTask.topActivityWithStartingWindow(); ActivityRecord prev = prevTask.getActivity( a -> a.mStartingData != null && a.okToShowLocked()); if (prev != null) { // We don't want to reuse the previous starting preview if: // (1) The current activity is in a different task. Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +0 −1 Original line number Diff line number Diff line Loading @@ -2590,7 +2590,6 @@ public class ActivityRecordTests extends WindowTestsBase { false /* activityCreate */, false /* suggestEmpty */); waitUntilHandlersIdle(); assertHasStartingWindow(activity); activity.mStartingWindowState = ActivityRecord.STARTING_WINDOW_SHOWN; doCallRealMethod().when(task).startActivityLocked( any(), any(), anyBoolean(), anyBoolean(), any(), any()); Loading