Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d7f9a3af authored by Riddle Hsu's avatar Riddle Hsu
Browse files

Complete sync draw only for visible window

Otherwise the sync may be finished too early if the client performs
relayout with View.INVISIBLE (e.g. the activity is stopping).

Besides, window manager service should only consider View.VISIBLE
as real visible.

Bug: 240564946
Test: adb shell setprop persist.wm.debug.shell_transit 1; reboot
      atest CloseImeAutoOpenWindowToHomeTest
Change-Id: I9a9868ba5a628b8fa7312380a5b1bb8148865f21
parent 39f9fc43
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -2542,7 +2542,7 @@ public class WindowManagerService extends IWindowManager.Stub


            if (outSyncIdBundle != null) {
            if (outSyncIdBundle != null) {
                final int maybeSyncSeqId;
                final int maybeSyncSeqId;
                if (USE_BLAST_SYNC && win.useBLASTSync() && viewVisibility != View.GONE
                if (USE_BLAST_SYNC && win.useBLASTSync() && viewVisibility == View.VISIBLE
                        && win.mSyncSeqId > lastSyncSeqId) {
                        && win.mSyncSeqId > lastSyncSeqId) {
                    maybeSyncSeqId = win.shouldSyncWithBuffers() ? win.mSyncSeqId : -1;
                    maybeSyncSeqId = win.shouldSyncWithBuffers() ? win.mSyncSeqId : -1;
                    win.markRedrawForSyncReported();
                    win.markRedrawForSyncReported();
+3 −3
Original line number Original line Diff line number Diff line
@@ -5953,10 +5953,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP


    @Override
    @Override
    boolean isSyncFinished() {
    boolean isSyncFinished() {
        if (mSyncState == SYNC_STATE_WAITING_FOR_DRAW && mViewVisibility == View.GONE
        if (mSyncState == SYNC_STATE_WAITING_FOR_DRAW && mViewVisibility != View.VISIBLE
                && !isVisibleRequested()) {
                && !isVisibleRequested()) {
            // Don't wait for GONE windows. However, we don't alter the state in case the window
            // Don't wait for invisible windows. However, we don't alter the state in case the
            // becomes un-gone while the syncset is still active.
            // window becomes visible while the sync group is still active.
            return true;
            return true;
        }
        }
        return super.isSyncFinished();
        return super.isSyncFinished();