OSDN Git Service

Fix issue with reparenting stacks on displays.
authorWinson Chung <winsonc@google.com>
Thu, 25 Jan 2018 17:44:30 +0000 (09:44 -0800)
committerWinson Chung <winsonc@google.com>
Thu, 25 Jan 2018 22:17:19 +0000 (14:17 -0800)
Bug: 72489026
Test: ActivityManagerMultiDisplayTests
Change-Id: I04d5971206b3b31ee349733de623edfff4c97222

services/core/java/com/android/server/am/ActivityStack.java

index 172228b..4485590 100644 (file)
@@ -642,7 +642,10 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
         // TODO: We should probably resolve the windowing mode for the stack on the new display here
         // so that it end up in a compatible mode in the new display. e.g. split-screen secondary.
         removeFromDisplay();
+        // Reparent the window container before we try to update the position when adding it to
+        // the new display below
         mTmpRect2.setEmpty();
+        mWindowContainerController.reparent(activityDisplay.mDisplayId, mTmpRect2, onTop);
         postAddToDisplay(activityDisplay, mTmpRect2.isEmpty() ? null : mTmpRect2, onTop);
         adjustFocusToNextFocusableStack("reparent", true /* allowFocusSelf */);
         mStackSupervisor.resumeFocusedStackTopActivityLocked();
@@ -650,7 +653,6 @@ class ActivityStack<T extends StackWindowController> extends ConfigurationContai
         // windows that are no longer visible.
         mStackSupervisor.ensureActivitiesVisibleLocked(null /* starting */, 0 /* configChanges */,
                 !PRESERVE_WINDOWS);
-        mWindowContainerController.reparent(activityDisplay.mDisplayId, mTmpRect2, onTop);
     }
 
     /**