Fix black screen after moving top activity to another display

The screen was black after moving the top activity to another display.
The next top activity did not be resumed and was still invisible. The
regression was from bebd8cd, which incidentally reverse the condition.

Since the case of removing a display is already handled by 402b440,
#postReparent is not needed to call again in #reparent (when display
is removing).

Fixing the issue forward by resuming the focusable task in
#moveRootTaskToTaskDisplayArea.

Bug: 192616155
Test: atest ActivityTaskManagerServiceTests
Change-Id: Id0971ad8a1c692fdb5376e2c077faa6f00dd61ac
This commit is contained in:
Louis Chang
2021-07-02 13:55:18 +08:00
parent 558a160fff
commit 5063db3b73
4 changed files with 7 additions and 11 deletions

View File

@@ -353,7 +353,7 @@ public class DisplayAreaOrganizerController extends IDisplayAreaOrganizerControl
// Only update focus/visibility for the last one because there may be many root tasks are
// reparented and the intermediate states are unnecessary.
if (lastReparentedRootTask != null) {
lastReparentedRootTask.postReparent();
lastReparentedRootTask.resumeNextFocusAfterReparent();
}
}
}

View File

@@ -5696,7 +5696,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
// Only update focus/visibility for the last one because there may be many root tasks are
// reparented and the intermediate states are unnecessary.
if (lastReparentedRootTask != null) {
lastReparentedRootTask.postReparent();
lastReparentedRootTask.resumeNextFocusAfterReparent();
}
releaseSelfIfNeeded();
mDisplayPolicy.release();

View File

@@ -71,7 +71,6 @@ import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP;
import static com.android.server.wm.ActivityTaskSupervisor.PRESERVE_WINDOWS;
import static com.android.server.wm.ActivityTaskSupervisor.dumpHistoryList;
import static com.android.server.wm.ActivityTaskSupervisor.printThisActivity;
import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_PLACE;
import static com.android.server.wm.RootWindowContainerProto.IS_HOME_RECENTS_COMPONENT;
import static com.android.server.wm.RootWindowContainerProto.KEYGUARD_CONTROLLER;
import static com.android.server.wm.RootWindowContainerProto.WINDOW_CONTAINER;
@@ -2078,6 +2077,10 @@ class RootWindowContainer extends WindowContainer<DisplayContent>
+ " to its current taskDisplayArea=" + taskDisplayArea);
}
rootTask.reparent(taskDisplayArea, onTop);
// Resume focusable root task after reparenting to another display area.
rootTask.resumeNextFocusAfterReparent();
// TODO(multi-display): resize rootTasks properly if moved from split-screen.
}

View File

@@ -1231,12 +1231,6 @@ class Task extends TaskFragment {
adjustBoundsForDisplayChangeIfNeeded(getDisplayContent());
mRootWindowContainer.updateUIDsPresentOnDisplay();
// Resume next focusable root task after reparenting to another display if we aren't
// removing the prevous display.
if (oldDisplay != null && oldDisplay.isRemoving()) {
postReparent();
}
}
/** Returns the currently topmost resumed activity. */
@@ -4514,8 +4508,7 @@ class Task extends TaskFragment {
mRootWindowContainer.resumeFocusedTasksTopActivities();
}
/** Resume next focusable root task after reparenting to another display. */
void postReparent() {
void resumeNextFocusAfterReparent() {
adjustFocusToNextFocusableTask("reparent", true /* allowFocusSelf */,
true /* moveDisplayToTop */);
mRootWindowContainer.resumeFocusedTasksTopActivities();