Finish sync for relayout a drawn window

An activity may change visibility in a short time as visible
-> invisible -> visible without reset drawn state. E.g. scene
transition convert to translucent. Then if its window relayout
to clear mRedrawForSyncReported, the window will stuck by
SYNC_STATE_WAITING_FOR_DRAW until it becomes invisible or timeout.

This also relates to non-sync blast so maybeSyncSeqId is -1 then
the window won't report drawn.

Bug: 260093427
Test: Enable shell transition.
      Launch Messages and click its search bar.
      There should be fade out/in animation for activity switch.
Change-Id: I49746b56e7dda76c530366663000b0d11ae779f3
This commit is contained in:
Riddle Hsu
2022-11-23 01:03:48 +08:00
parent 58de71a4a9
commit 0078150dd5

View File

@@ -2587,6 +2587,12 @@ public class WindowManagerService extends IWindowManager.Stub
&& win.mSyncSeqId > lastSyncSeqId) {
maybeSyncSeqId = win.shouldSyncWithBuffers() ? win.mSyncSeqId : -1;
win.markRedrawForSyncReported();
if (win.mSyncState == WindowContainer.SYNC_STATE_WAITING_FOR_DRAW
&& winAnimator.mDrawState == WindowStateAnimator.HAS_DRAWN
&& maybeSyncSeqId < 0) {
// Do not wait for a drawn window which won't report draw.
win.onSyncFinishedDrawing();
}
} else {
maybeSyncSeqId = -1;
}