Loading services/core/java/com/android/server/am/ActivityDisplay.java +11 −1 Original line number Diff line number Diff line Loading @@ -158,6 +158,8 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> } private void positionChildAt(ActivityStack stack, int position) { // TODO: Keep in sync with WindowContainer.positionChildAt(), once we change that to adjust // the position internally, also update the logic here mStacks.remove(stack); final int insertPosition = getTopInsertPosition(stack, position); mStacks.add(insertPosition, stack); Loading Loading @@ -750,7 +752,15 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> return; } positionChildAt(mHomeStack, Math.max(0, mStacks.indexOf(behindStack) - 1)); // Note that positionChildAt will first remove the given stack before inserting into the // list, so we need to adjust the insertion index to account for the removed index // TODO: Remove this logic when WindowContainer.positionChildAt() is updated to adjust the // position internally final int homeStackIndex = mStacks.indexOf(mHomeStack); final int behindStackIndex = mStacks.indexOf(behindStack); final int insertIndex = homeStackIndex <= behindStackIndex ? behindStackIndex - 1 : behindStackIndex; positionChildAt(mHomeStack, Math.max(0, insertIndex)); } boolean isSleeping() { Loading services/core/java/com/android/server/wm/WindowContainer.java +4 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } break; default: // TODO: Removing the child before reinserting requires the caller to provide a // position that takes into account the removed child (if the index of the // child < position, then the position should be adjusted). We should consider // doing this adjustment here and remove any adjustments in the callers. mChildren.remove(child); mChildren.add(position, child); } Loading services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,10 @@ public class ActivityStackTests extends ActivityTestsBase { WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack fullscreenStack2 = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack fullscreenStack3 = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack fullscreenStack4 = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack homeStack = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, true /* onTop */); Loading @@ -415,6 +419,10 @@ public class ActivityStackTests extends ActivityTestsBase { assertTrue(display.getStackAboveHome() == fullscreenStack1); display.moveHomeStackBehindStack(fullscreenStack2); assertTrue(display.getStackAboveHome() == fullscreenStack2); display.moveHomeStackBehindStack(fullscreenStack4); assertTrue(display.getStackAboveHome() == fullscreenStack4); display.moveHomeStackBehindStack(fullscreenStack2); assertTrue(display.getStackAboveHome() == fullscreenStack2); } private <T extends ActivityStack> T createStackForShouldBeVisibleTest( Loading Loading
services/core/java/com/android/server/am/ActivityDisplay.java +11 −1 Original line number Diff line number Diff line Loading @@ -158,6 +158,8 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> } private void positionChildAt(ActivityStack stack, int position) { // TODO: Keep in sync with WindowContainer.positionChildAt(), once we change that to adjust // the position internally, also update the logic here mStacks.remove(stack); final int insertPosition = getTopInsertPosition(stack, position); mStacks.add(insertPosition, stack); Loading Loading @@ -750,7 +752,15 @@ class ActivityDisplay extends ConfigurationContainer<ActivityStack> return; } positionChildAt(mHomeStack, Math.max(0, mStacks.indexOf(behindStack) - 1)); // Note that positionChildAt will first remove the given stack before inserting into the // list, so we need to adjust the insertion index to account for the removed index // TODO: Remove this logic when WindowContainer.positionChildAt() is updated to adjust the // position internally final int homeStackIndex = mStacks.indexOf(mHomeStack); final int behindStackIndex = mStacks.indexOf(behindStack); final int insertIndex = homeStackIndex <= behindStackIndex ? behindStackIndex - 1 : behindStackIndex; positionChildAt(mHomeStack, Math.max(0, insertIndex)); } boolean isSleeping() { Loading
services/core/java/com/android/server/wm/WindowContainer.java +4 −0 Original line number Diff line number Diff line Loading @@ -406,6 +406,10 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer< } break; default: // TODO: Removing the child before reinserting requires the caller to provide a // position that takes into account the removed child (if the index of the // child < position, then the position should be adjusted). We should consider // doing this adjustment here and remove any adjustments in the callers. mChildren.remove(child); mChildren.add(position, child); } Loading
services/tests/servicestests/src/com/android/server/am/ActivityStackTests.java +8 −0 Original line number Diff line number Diff line Loading @@ -408,6 +408,10 @@ public class ActivityStackTests extends ActivityTestsBase { WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack fullscreenStack2 = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack fullscreenStack3 = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack fullscreenStack4 = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_STANDARD, true /* onTop */); final TestActivityStack homeStack = createStackForShouldBeVisibleTest(display, WINDOWING_MODE_FULLSCREEN, ACTIVITY_TYPE_HOME, true /* onTop */); Loading @@ -415,6 +419,10 @@ public class ActivityStackTests extends ActivityTestsBase { assertTrue(display.getStackAboveHome() == fullscreenStack1); display.moveHomeStackBehindStack(fullscreenStack2); assertTrue(display.getStackAboveHome() == fullscreenStack2); display.moveHomeStackBehindStack(fullscreenStack4); assertTrue(display.getStackAboveHome() == fullscreenStack4); display.moveHomeStackBehindStack(fullscreenStack2); assertTrue(display.getStackAboveHome() == fullscreenStack2); } private <T extends ActivityStack> T createStackForShouldBeVisibleTest( Loading