From 83753c9ad2768fc0832b3a1a8d7e94b101975b75 Mon Sep 17 00:00:00 2001 From: Evan Rosky Date: Tue, 10 Aug 2021 16:27:07 -0700 Subject: [PATCH] Treat GONE windows as READY for sync Otherwise we will wait on them until the sync timeout. Bug: 183993924 Test: atest AppConfigurationTests#testAppOrientationRequestConfigChange Change-Id: I5e4050cc36997d87dcc3192d53959f7b56d516b0 --- .../core/java/com/android/server/wm/WindowState.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index bee8bda16008e..0091b618696e2 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -5974,7 +5974,7 @@ class WindowState extends WindowContainer implements WindowManagerP // since a generic WindowContainer only needs to wait for its // children to finish and is immediately ready from its own // perspective but at the WindowState level we need to wait for ourselves - // to draw even if the children draw first our don't need to sync, so we start + // to draw even if the children draw first or don't need to sync, so we start // in WAITING state rather than READY. mSyncState = SYNC_STATE_WAITING_FOR_DRAW; requestRedrawForSync(); @@ -5985,6 +5985,16 @@ class WindowState extends WindowContainer implements WindowManagerP return true; } + @Override + boolean isSyncFinished() { + if (mSyncState == SYNC_STATE_WAITING_FOR_DRAW && mViewVisibility == View.GONE) { + // Don't wait for GONE windows. However, we don't alter the state in case the window + // becomes un-gone while the syncset is still active. + return true; + } + return super.isSyncFinished(); + } + boolean finishDrawing(SurfaceControl.Transaction postDrawTransaction) { if (mOrientationChangeRedrawRequestTime > 0) { final long duration =