Merge "Make sure only the top-most running activity can be active" into rvc-dev am: 3b6ade6a89
Change-Id: I70e3a2433826d50272aceb3f91040c4992042925
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user