Loading services/core/java/com/android/server/am/ActivityStackSupervisor.java +3 −0 Original line number Diff line number Diff line Loading @@ -3302,6 +3302,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } boolean reportResumedActivityLocked(ActivityRecord r) { // A resumed activity cannot be stopping. remove from list mStoppingActivities.remove(r); final ActivityStack stack = r.getStack(); if (isFocusedStack(stack)) { mService.updateUsageStats(r, true); Loading services/tests/servicestests/src/com/android/server/am/ActivityStackSupervisorTests.java +18 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; import android.content.ComponentName; import android.graphics.Rect; Loading Loading @@ -117,4 +118,21 @@ public class ActivityStackSupervisorTests extends ActivityTestsBase { assertTrue(stackTasks.contains(task)); } } /** * Ensures that an activity is removed from the stopping activities list once it is resumed. */ @Test public void testStoppingActivityRemovedWhenResumed() throws Exception { final ActivityManagerService service = createActivityManagerService(); final TaskRecord firstTask = createTask(service, testActivityComponent, FULLSCREEN_WORKSPACE_STACK_ID); final ActivityRecord firstActivity = createActivity(service, testActivityComponent, firstTask); service.mStackSupervisor.mStoppingActivities.add(firstActivity); firstActivity.completeResumeLocked(); assertFalse(service.mStackSupervisor.mStoppingActivities.contains(firstActivity)); } } services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java +4 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,10 @@ public class ActivityTestsBase { protected ActivityStackSupervisor createStackSupervisor() { return new TestActivityStackSupervisor(this, mHandlerThread.getLooper()); } @Override void updateUsageStats(ActivityRecord component, boolean resumed) { } } /** Loading Loading
services/core/java/com/android/server/am/ActivityStackSupervisor.java +3 −0 Original line number Diff line number Diff line Loading @@ -3302,6 +3302,9 @@ public class ActivityStackSupervisor extends ConfigurationContainer implements D } boolean reportResumedActivityLocked(ActivityRecord r) { // A resumed activity cannot be stopping. remove from list mStoppingActivities.remove(r); final ActivityStack stack = r.getStack(); if (isFocusedStack(stack)) { mService.updateUsageStats(r, true); Loading
services/tests/servicestests/src/com/android/server/am/ActivityStackSupervisorTests.java +18 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import static android.app.ActivityManager.StackId.PINNED_STACK_ID; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; import android.content.ComponentName; import android.graphics.Rect; Loading Loading @@ -117,4 +118,21 @@ public class ActivityStackSupervisorTests extends ActivityTestsBase { assertTrue(stackTasks.contains(task)); } } /** * Ensures that an activity is removed from the stopping activities list once it is resumed. */ @Test public void testStoppingActivityRemovedWhenResumed() throws Exception { final ActivityManagerService service = createActivityManagerService(); final TaskRecord firstTask = createTask(service, testActivityComponent, FULLSCREEN_WORKSPACE_STACK_ID); final ActivityRecord firstActivity = createActivity(service, testActivityComponent, firstTask); service.mStackSupervisor.mStoppingActivities.add(firstActivity); firstActivity.completeResumeLocked(); assertFalse(service.mStackSupervisor.mStoppingActivities.contains(firstActivity)); } }
services/tests/servicestests/src/com/android/server/am/ActivityTestsBase.java +4 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,10 @@ public class ActivityTestsBase { protected ActivityStackSupervisor createStackSupervisor() { return new TestActivityStackSupervisor(this, mHandlerThread.getLooper()); } @Override void updateUsageStats(ActivityRecord component, boolean resumed) { } } /** Loading