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

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

Reduce unnecessary redraw for non blast sync

For example, when resuming an existing activity from background:
1. The snapshot starting window is added to the next top activity.
2. The previous activity is paused and then the next top activity
   is collected, so the starting window is SYNC_STATE_WAITING_FOR_DRAW.
   Then shouldSendRedrawForSync() returns true so request redraw.
3. Starting window reports finish draw from 1.
4. Additional finish draw from 2.

By making mRedrawForSyncReported default true, unless
requestRedrawForSync is called explicitly, the window won't be
requested to redraw just because of its sync state.

Bug: 260059642
Test: Enable shell transition.
      adb shell wm logging enable-text WM_DEBUG_RESIZE
      Hot launch app from launcher.
      Log should not show "Resizing window" for SnapshotStartingWindow
Change-Id: Icbc9c7ec024595395b78136007895608ba52acb0
parent 44fdc24a
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
    boolean mHidden = true;    // Used to determine if to show child windows.
    private boolean mDragResizing;
    private boolean mDragResizingChangeReported = true;
    private boolean mRedrawForSyncReported;
    private boolean mRedrawForSyncReported = true;

    /**
     * Used to assosciate a given set of state changes sent from MSG_RESIZED
@@ -5956,8 +5956,11 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mSyncSeqId++;
        if (getSyncMethod() == BLASTSyncEngine.METHOD_BLAST) {
            mPrepareSyncSeqId = mSyncSeqId;
        }
            requestRedrawForSync();
        } else if (mHasSurface && mWinAnimator.mDrawState != DRAW_PENDING) {
            // Only need to request redraw if the window has reported draw.
            requestRedrawForSync();
        }
        return true;
    }

+0 −4
Original line number Diff line number Diff line
@@ -428,10 +428,6 @@ class WindowStateAnimator {
        mShownAlpha = mAlpha;
    }

    private boolean isInBlastSync() {
        return mService.useBLASTSync() && mWin.useBLASTSync();
    }

    void prepareSurfaceLocked(SurfaceControl.Transaction t) {
        final WindowState w = mWin;
        if (!hasSurface()) {