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

Commit a6a52745 authored by Evan Rosky's avatar Evan Rosky
Browse files

Switch to buffer sync when overriding sync-method to BLAST

When overriding a window's sync-method to BLAST, we need
to also make sure to increment the buffer-seq-id so that
we properly request the client to use BLAST sync.

Bug: 385976595
Test: atest WindowStateTests
Flag: com.android.window.flags.always_seq_id_layout
Change-Id: Ia114e9fc513c2e1342272d0605bc051205a7d963
parent 1dfaa3ec
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -89,6 +89,10 @@ public class WindowStateResizeItem extends WindowStateTransactionItem {
        Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
    }

    public boolean getSyncWithBuffersForTest() {
        return mSyncWithBuffers;
    }

    // Parcelable implementation

    /** Writes to Parcel. */
+1 −1
Original line number Diff line number Diff line
@@ -227,7 +227,7 @@ class DeferredDisplayUpdater {
                        && mDisplayContent.mAtmService.mKeyguardController.isKeyguardOrAodShowing(
                        mDisplayContent.mDisplayId)) {
                    Slog.i(TAG, notificationShade + " uses blast for display switch");
                    notificationShade.mSyncMethodOverride = BLASTSyncEngine.METHOD_BLAST;
                    notificationShade.useBlastForNextSync();
                }
            }

+3 −4
Original line number Diff line number Diff line
@@ -647,7 +647,7 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
        final WindowState top = dc.getDisplayPolicy().getTopFullscreenOpaqueWindow();
        if (top != null) {
            mIsSeamlessRotation = true;
            top.mSyncMethodOverride = BLASTSyncEngine.METHOD_BLAST;
            top.useBlastForNextSync();
            ProtoLog.v(WmProtoLogGroups.WM_DEBUG_WINDOW_TRANSITIONS, "Override sync-method for %s "
                    + "because seamless rotating", top.getName());
        }
@@ -1751,9 +1751,8 @@ class Transition implements BLASTSyncEngine.TransactionReadyListener {
            } else {
                // If there is an existing sync group for the commit-at-end activity,
                // enforce BLAST sync method for its windows, before resuming config dispatch.
                target.forAllWindows(windowState -> {
                    windowState.mSyncMethodOverride = BLASTSyncEngine.METHOD_BLAST;
                }, true /* traverseTopToBottom */);
                target.forAllWindows(WindowState::useBlastForNextSync,
                        true /* traverseTopToBottom */);
            }
            // Reset surface state here (since it was skipped in buildFinishTransaction). Since
            // we are resuming config to the "current" state, we have to calculate the matching
+1 −1
Original line number Diff line number Diff line
@@ -786,7 +786,7 @@ class TransitionController {
                && (endWidth != startWidth || endHeight != startHeight)) {
            displayContent.forAllWindows(w -> {
                if (w.mToken.mRoundedCornerOverlay && w.mHasSurface) {
                    w.mSyncMethodOverride = BLASTSyncEngine.METHOD_BLAST;
                    w.useBlastForNextSync();
                }
            }, true /* traverseTopToBottom */);
        }
+11 −0
Original line number Diff line number Diff line
@@ -5956,6 +5956,17 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        return syncGroup.mSyncMethod;
    }

    void useBlastForNextSync() {
        if (mSyncMethodOverride == BLASTSyncEngine.METHOD_BLAST) return;
        mSyncMethodOverride = BLASTSyncEngine.METHOD_BLAST;
        final BLASTSyncEngine.SyncGroup syncGroup = getSyncGroup();
        // If not in sync, then the seqId will be incremented in prepareSync (when added)
        if (syncGroup == null || syncGroup.mSyncMethod == BLASTSyncEngine.METHOD_BLAST) {
            return;
        }
        mBufferSeqId = mSyncSeqId + 1;
    }

    boolean shouldSyncWithBuffers() {
        if (!mDrawHandlers.isEmpty()) return true;
        return getSyncMethod() == BLASTSyncEngine.METHOD_BLAST;
Loading