From 33f70239476e15cbc0f131893e461302cf0212af Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Wed, 29 Jun 2022 14:43:57 -0700 Subject: Mark display ready when it loses active child When reparenting an actively-collected container out from one display to another, when it becomes ready it will notify the destination display and not the source display. However, since it was added to syncset on the source display, that display will have a ready-tracker entry (since we currently track readiness per-display -- like legacy transitions). As a result the transition will time-out since the source display will never be set ready. To fix this, mark the display ready when a child is moved to the other display. The transition, in total, will still remain unready until that child is ready (on the new display) so it won't fire early. Bug: 237545923 Test: atest MultiDisplayPolicyTests#testStackFocusSwitchOnStackEmptied Change-Id: Ida70bee427e1baa517fa231ae52c53859c2f3dba --- services/core/java/com/android/server/wm/WindowContainer.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/services/core/java/com/android/server/wm/WindowContainer.java b/services/core/java/com/android/server/wm/WindowContainer.java index 33c0fe13af11..f42df02a6252 100644 --- a/services/core/java/com/android/server/wm/WindowContainer.java +++ b/services/core/java/com/android/server/wm/WindowContainer.java @@ -3756,6 +3756,15 @@ class WindowContainer extends ConfigurationContainer< * hierarchy change implies a configuration change. */ private void onSyncReparent(WindowContainer oldParent, WindowContainer newParent) { + // Check if this is changing displays. If so, mark the old display as "ready" for + // transitions. This is to work around the problem where setting readiness against this + // container will only set the new display as ready and leave the old display as unready. + if (mSyncState != SYNC_STATE_NONE && oldParent != null + && oldParent.getDisplayContent() != null && (newParent == null + || oldParent.getDisplayContent() != newParent.getDisplayContent())) { + mTransitionController.setReady(oldParent.getDisplayContent()); + } + if (newParent == null || newParent.mSyncState == SYNC_STATE_NONE) { if (mSyncState == SYNC_STATE_NONE) { return; -- cgit v1.2.3-59-g8ed1b