Loading services/core/java/com/android/server/wm/ActivityRecord.java +1 −10 Original line number Diff line number Diff line Loading @@ -4785,16 +4785,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (!task.hasChild(this)) { throw new IllegalStateException("Activity not found in its task"); } final ActivityRecord activityAbove = task.getActivityAbove(this); if (activityAbove == null) { // It's the topmost activity in the task - should become resumed now return true; } // Check if activity above is finishing now and this one becomes the topmost in task. if (activityAbove.finishing) { return true; } return false; return task.topRunningActivity() == this; } void handleAlreadyVisible() { Loading services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +10 −0 Original line number Diff line number Diff line Loading @@ -487,6 +487,16 @@ public class ActivityRecordTests extends ActivityTestsBase { assertEquals(true, mActivity.shouldMakeActive(null /* activeActivity */)); } @Test public void testShouldMakeActive_nonTopVisible() { ActivityRecord finishingActivity = new ActivityBuilder(mService).setTask(mTask).build(); finishingActivity.finishing = true; ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build(); mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing"); assertEquals(false, mActivity.shouldMakeActive(null /* activeActivity */)); } @Test public void testShouldResume_stackVisibility() { mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing"); Loading Loading
services/core/java/com/android/server/wm/ActivityRecord.java +1 −10 Original line number Diff line number Diff line Loading @@ -4785,16 +4785,7 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A if (!task.hasChild(this)) { throw new IllegalStateException("Activity not found in its task"); } final ActivityRecord activityAbove = task.getActivityAbove(this); if (activityAbove == null) { // It's the topmost activity in the task - should become resumed now return true; } // Check if activity above is finishing now and this one becomes the topmost in task. if (activityAbove.finishing) { return true; } return false; return task.topRunningActivity() == this; } void handleAlreadyVisible() { Loading
services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +10 −0 Original line number Diff line number Diff line Loading @@ -487,6 +487,16 @@ public class ActivityRecordTests extends ActivityTestsBase { assertEquals(true, mActivity.shouldMakeActive(null /* activeActivity */)); } @Test public void testShouldMakeActive_nonTopVisible() { ActivityRecord finishingActivity = new ActivityBuilder(mService).setTask(mTask).build(); finishingActivity.finishing = true; ActivityRecord topActivity = new ActivityBuilder(mService).setTask(mTask).build(); mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing"); assertEquals(false, mActivity.shouldMakeActive(null /* activeActivity */)); } @Test public void testShouldResume_stackVisibility() { mActivity.setState(ActivityStack.ActivityState.STOPPED, "Testing"); Loading