Loading services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +9 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import static com.android.server.wm.ActivityRecord.State.PAUSED; import static com.android.server.wm.ActivityRecord.State.PAUSING; import static com.android.server.wm.ActivityRecord.State.RESTARTING_PROCESS; import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityRecord.State.STOPPING; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_ALL; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CLEANUP; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_IDLE; Loading Loading @@ -104,6 +105,7 @@ import android.app.servertransaction.ActivityLifecycleItem; import android.app.servertransaction.LaunchActivityItem; import android.app.servertransaction.PauseActivityItem; import android.app.servertransaction.ResumeActivityItem; import android.app.servertransaction.StopActivityItem; import android.companion.virtual.VirtualDeviceManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -944,8 +946,10 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { if (andResume) { lifecycleItem = ResumeActivityItem.obtain(r.token, isTransitionForward, r.shouldSendCompatFakeFocus()); } else { } else if (r.isVisibleRequested()) { lifecycleItem = PauseActivityItem.obtain(r.token); } else { lifecycleItem = StopActivityItem.obtain(r.token); } // Schedule transaction. Loading Loading @@ -1013,7 +1017,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { // a resume. r.setState(RESUMED, "realStartActivityLocked"); r.completeResumeLocked(); } else { } else if (r.isVisibleRequested()) { // This activity is not starting in the resumed state... which should look like we asked // it to pause+stop (but remain visible), and it has done so and reported back the // current icicle and other state. Loading @@ -1021,6 +1025,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { + "(starting in paused state)", r); r.setState(PAUSED, "realStartActivityLocked"); mRootWindowContainer.executeAppTransitionForAllDisplay(); } else { // This activity is starting while invisible, so it should be stopped. r.setState(STOPPING, "realStartActivityLocked"); } // Perform OOM scoring after the activity state is set, so the process can be updated with // the latest state. Loading services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.times; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.ActivityRecord.State.PAUSED; import static com.android.server.wm.ActivityRecord.State.STOPPING; import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE; import static com.android.server.wm.WindowContainer.POSITION_TOP; Loading Loading @@ -164,13 +165,12 @@ public class RecentsAnimationTest extends WindowTestsBase { ActivityRecord recentsActivity = recentsStack.getTopNonFinishingActivity(); // The activity is started in background so it should be invisible and will be stopped. assertThat(recentsActivity).isNotNull(); assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity); assertThat(recentsActivity.getState()).isEqualTo(STOPPING); assertFalse(recentsActivity.isVisibleRequested()); // Assume it is stopped to test next use case. recentsActivity.activityStopped(null /* newIcicle */, null /* newPersistentState */, null /* description */); mSupervisor.mStoppingActivities.remove(recentsActivity); spyOn(recentsActivity); // Start when the recents activity exists. It should ensure the configuration. Loading @@ -178,7 +178,6 @@ public class RecentsAnimationTest extends WindowTestsBase { null /* recentsAnimationRunner */); verify(recentsActivity).ensureActivityConfiguration(eq(true) /* ignoreVisibility */); assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity); } @Test Loading Loading
services/core/java/com/android/server/wm/ActivityTaskSupervisor.java +9 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ import static com.android.server.wm.ActivityRecord.State.PAUSED; import static com.android.server.wm.ActivityRecord.State.PAUSING; import static com.android.server.wm.ActivityRecord.State.RESTARTING_PROCESS; import static com.android.server.wm.ActivityRecord.State.RESUMED; import static com.android.server.wm.ActivityRecord.State.STOPPING; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_ALL; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_CLEANUP; import static com.android.server.wm.ActivityTaskManagerDebugConfig.DEBUG_IDLE; Loading Loading @@ -104,6 +105,7 @@ import android.app.servertransaction.ActivityLifecycleItem; import android.app.servertransaction.LaunchActivityItem; import android.app.servertransaction.PauseActivityItem; import android.app.servertransaction.ResumeActivityItem; import android.app.servertransaction.StopActivityItem; import android.companion.virtual.VirtualDeviceManager; import android.content.ComponentName; import android.content.Context; Loading Loading @@ -944,8 +946,10 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { if (andResume) { lifecycleItem = ResumeActivityItem.obtain(r.token, isTransitionForward, r.shouldSendCompatFakeFocus()); } else { } else if (r.isVisibleRequested()) { lifecycleItem = PauseActivityItem.obtain(r.token); } else { lifecycleItem = StopActivityItem.obtain(r.token); } // Schedule transaction. Loading Loading @@ -1013,7 +1017,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { // a resume. r.setState(RESUMED, "realStartActivityLocked"); r.completeResumeLocked(); } else { } else if (r.isVisibleRequested()) { // This activity is not starting in the resumed state... which should look like we asked // it to pause+stop (but remain visible), and it has done so and reported back the // current icicle and other state. Loading @@ -1021,6 +1025,9 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks { + "(starting in paused state)", r); r.setState(PAUSED, "realStartActivityLocked"); mRootWindowContainer.executeAppTransitionForAllDisplay(); } else { // This activity is starting while invisible, so it should be stopped. r.setState(STOPPING, "realStartActivityLocked"); } // Perform OOM scoring after the activity state is set, so the process can be updated with // the latest state. Loading
services/tests/wmtests/src/com/android/server/wm/RecentsAnimationTest.java +2 −3 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn; import static com.android.dx.mockito.inline.extended.ExtendedMockito.times; import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify; import static com.android.server.wm.ActivityRecord.State.PAUSED; import static com.android.server.wm.ActivityRecord.State.STOPPING; import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE; import static com.android.server.wm.WindowContainer.POSITION_TOP; Loading Loading @@ -164,13 +165,12 @@ public class RecentsAnimationTest extends WindowTestsBase { ActivityRecord recentsActivity = recentsStack.getTopNonFinishingActivity(); // The activity is started in background so it should be invisible and will be stopped. assertThat(recentsActivity).isNotNull(); assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity); assertThat(recentsActivity.getState()).isEqualTo(STOPPING); assertFalse(recentsActivity.isVisibleRequested()); // Assume it is stopped to test next use case. recentsActivity.activityStopped(null /* newIcicle */, null /* newPersistentState */, null /* description */); mSupervisor.mStoppingActivities.remove(recentsActivity); spyOn(recentsActivity); // Start when the recents activity exists. It should ensure the configuration. Loading @@ -178,7 +178,6 @@ public class RecentsAnimationTest extends WindowTestsBase { null /* recentsAnimationRunner */); verify(recentsActivity).ensureActivityConfiguration(eq(true) /* ignoreVisibility */); assertThat(mSupervisor.mStoppingActivities).contains(recentsActivity); } @Test Loading