diff options
4 files changed, 15 insertions, 17 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 17887d3447be..b90f54bf36a3 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -853,7 +853,8 @@ public final class ViewRootImpl implements ViewParent, * integer back over relayout. */ private Bundle mRelayoutBundle = new Bundle(); - private int mSyncSeqId; + private int mSyncSeqId = 0; + private int mLastSyncSeqId = 0; private String mTag = TAG; @@ -2924,7 +2925,8 @@ public final class ViewRootImpl implements ViewParent, final boolean dockedResizing = (relayoutResult & RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0; final boolean dragResizing = freeformResizing || dockedResizing; - if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) { + if (mSyncSeqId > mLastSyncSeqId) { + mLastSyncSeqId = mSyncSeqId; if (DEBUG_BLAST) { Log.d(mTag, "Relayout called with blastSync"); } @@ -7974,6 +7976,7 @@ public final class ViewRootImpl implements ViewParent, insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets, mTempControls, mRelayoutBundle); + mSyncSeqId = mRelayoutBundle.getInt("seqid"); final int transformHint = SurfaceControl.rotationToBufferTransform( (mDisplayInstallOrientation + mDisplay.getRotation()) % 4); diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java index b0da877bfddd..55c9f0f96151 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -97,14 +97,6 @@ public final class WindowManagerGlobal { public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 1 << 5; /** - * This flag indicates the client should not directly submit it's next frame, - * but instead should pass it in the postDrawTransaction of - * {@link WindowManagerService#finishDrawing}. This is used by the WM - * BLASTSyncEngine to synchronize rendering of multiple windows. - */ - public static final int RELAYOUT_RES_BLAST_SYNC = 1 << 6; - - /** * Flag for relayout: the client will be later giving * internal insets; as a result, the window will not impact other window * layouts until the insets are given. diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index eb88b8b0ea97..08ce6817fb6d 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -89,7 +89,6 @@ import static android.view.WindowManager.REMOVE_CONTENT_MODE_UNDEFINED; import static android.view.WindowManager.TRANSIT_NONE; import static android.view.WindowManager.TRANSIT_RELAUNCH; import static android.view.WindowManagerGlobal.ADD_OKAY; -import static android.view.WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC; import static android.view.WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED; import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID; import static android.view.WindowManagerPolicyConstants.TYPE_LAYER_MULTIPLIER; @@ -2508,11 +2507,14 @@ public class WindowManagerService extends IWindowManager.Stub win.mInRelayout = false; if (mUseBLASTSync && win.useBLASTSync() && viewVisibility != View.GONE - && win.mNextRelayoutUseSync) { + && (win.mSyncSeqId > win.mLastSeqIdSentToRelayout)) { win.prepareDrawHandlers(); win.markRedrawForSyncReported(); - win.mNextRelayoutUseSync = false; - result |= RELAYOUT_RES_BLAST_SYNC; + + win.mLastSeqIdSentToRelayout = win.mSyncSeqId; + outSyncIdBundle.putInt("seqid", win.mSyncSeqId); + } else { + outSyncIdBundle.putInt("seqid", -1); } if (configChanged) { diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 227b4365e223..9f60051e65ec 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -369,7 +369,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP private boolean mDragResizingChangeReported = true; private int mResizeMode; private boolean mRedrawForSyncReported; - boolean mNextRelayoutUseSync; + int mSyncSeqId = 0; + int mLastSeqIdSentToRelayout = 0; /** * {@code true} when the client was still drawing for sync when the sync-set was finished or @@ -5926,7 +5927,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP // 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; - mNextRelayoutUseSync = true; + mSyncSeqId++; requestRedrawForSync(); return true; } @@ -6069,7 +6070,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP */ void applyWithNextDraw(Consumer<SurfaceControl.Transaction> consumer) { mPendingDrawHandlers.add(consumer); - mNextRelayoutUseSync = true; + mSyncSeqId++; requestRedrawForSync(); mWmService.mH.sendNewMessageDelayed(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this, |