Merge "Fix typo in stack traversal" into rvc-dev am: 18b8b2d75e
Change-Id: Icdc0d026f6ebaa80ca23704c2d6e73bd2a827f23
This commit is contained in:
@@ -2214,7 +2214,7 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
|
|||||||
// It is possible that request to finish activity might also remove its task and
|
// It is possible that request to finish activity might also remove its task and
|
||||||
// stack, so we need to be careful with indexes in the loop and check child count
|
// stack, so we need to be careful with indexes in the loop and check child count
|
||||||
// every time.
|
// every time.
|
||||||
for (int stackNdx = 0; stackNdx < display.getStackCount(); ++stackNdx) {
|
for (int stackNdx = 0; stackNdx < taskDisplayArea.getStackCount(); ++stackNdx) {
|
||||||
final ActivityStack stack = taskDisplayArea.getStackAt(stackNdx);
|
final ActivityStack stack = taskDisplayArea.getStackAt(stackNdx);
|
||||||
final Task t = stack.finishTopCrashedActivityLocked(app, reason);
|
final Task t = stack.finishTopCrashedActivityLocked(app, reason);
|
||||||
if (stack == focusedStack || finishedTask == null) {
|
if (stack == focusedStack || finishedTask == null) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_SPLIT_SCREEN_PRIMAR
|
|||||||
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
|
import static android.content.pm.ActivityInfo.FLAG_ALWAYS_FOCUSABLE;
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
import static android.view.Display.TYPE_VIRTUAL;
|
import static android.view.Display.TYPE_VIRTUAL;
|
||||||
|
import static android.window.DisplayAreaOrganizer.FEATURE_VENDOR_FIRST;
|
||||||
|
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doNothing;
|
||||||
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
import static com.android.dx.mockito.inline.extended.ExtendedMockito.doReturn;
|
||||||
@@ -247,6 +248,44 @@ public class RootActivityContainerTests extends ActivityTestsBase {
|
|||||||
assertEquals(originalStackCount, defaultTaskDisplayArea.getStackCount());
|
assertEquals(originalStackCount, defaultTaskDisplayArea.getStackCount());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verifies that removal of activities with task and stack is done correctly when there are
|
||||||
|
* several task display areas.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testRemovingStackOnAppCrash_multipleDisplayAreas() {
|
||||||
|
final TaskDisplayArea defaultTaskDisplayArea = mRootWindowContainer
|
||||||
|
.getDefaultTaskDisplayArea();
|
||||||
|
final int originalStackCount = defaultTaskDisplayArea.getStackCount();
|
||||||
|
final ActivityStack stack = defaultTaskDisplayArea.createStack(
|
||||||
|
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, false /* onTop */);
|
||||||
|
final ActivityRecord firstActivity = new ActivityBuilder(mService).setCreateTask(true)
|
||||||
|
.setStack(stack).build();
|
||||||
|
assertEquals(originalStackCount + 1, defaultTaskDisplayArea.getStackCount());
|
||||||
|
|
||||||
|
final DisplayContent dc = defaultTaskDisplayArea.getDisplayContent();
|
||||||
|
doReturn(2).when(dc).getTaskDisplayAreaCount();
|
||||||
|
final TaskDisplayArea secondTaskDisplayArea = new TaskDisplayArea(dc,
|
||||||
|
mRootWindowContainer.mWmService, "SecondaryTaskDisplayArea", FEATURE_VENDOR_FIRST);
|
||||||
|
// Add second display area right above the default one
|
||||||
|
defaultTaskDisplayArea.getParent().addChild(secondTaskDisplayArea,
|
||||||
|
defaultTaskDisplayArea.getParent().mChildren.indexOf(defaultTaskDisplayArea) + 1);
|
||||||
|
doReturn(secondTaskDisplayArea).when(dc).getTaskDisplayAreaAt(1);
|
||||||
|
final ActivityStack secondStack = secondTaskDisplayArea.createStack(
|
||||||
|
WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, false /* onTop */);
|
||||||
|
new ActivityBuilder(mService).setCreateTask(true).setStack(secondStack)
|
||||||
|
.setUseProcess(firstActivity.app).build();
|
||||||
|
assertEquals(1, secondTaskDisplayArea.getStackCount());
|
||||||
|
|
||||||
|
// Let's pretend that the app has crashed.
|
||||||
|
firstActivity.app.setThread(null);
|
||||||
|
mRootWindowContainer.finishTopCrashedActivities(firstActivity.app, "test");
|
||||||
|
|
||||||
|
// Verify that the stacks were removed.
|
||||||
|
assertEquals(originalStackCount, defaultTaskDisplayArea.getStackCount());
|
||||||
|
assertEquals(0, secondTaskDisplayArea.getStackCount());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFocusability() {
|
public void testFocusability() {
|
||||||
final TaskDisplayArea defaultTaskDisplayArea = mRootWindowContainer
|
final TaskDisplayArea defaultTaskDisplayArea = mRootWindowContainer
|
||||||
|
|||||||
Reference in New Issue
Block a user