summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2021-04-12 15:47:39 -0700
committer Vishnu Nair <vishnun@google.com> 2021-04-12 22:52:25 +0000
commitab82b008f1f5660de9bedf0e9e319cb55151baf1 (patch)
treeb05732517c02b4795f440ba914acca0183532c17
parent9a5967ffefd540e7c69b587e7d925d16a237f1e1 (diff)
Honor the BlastSync request from WM until a frame is drawn
If the client cancels a draw via preDraw, we will cancel the blast sync request. This breaks the screen decoration logic which uses the predaw handlers to cancel the draw, change the layout of the window and then redaw the window when the display orientation changes. Fixes: 183171989 Test: enable cutout and rotate screen, check screen decorations are positioned correctly Test: go/wm-smoke Change-Id: I7f802730b69842216b065a4a521a2737e692b82d
-rw-r--r--core/java/android/view/ViewRootImpl.java16
1 files changed, 10 insertions, 6 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 8348a5c65fea..8c9c6bd8feeb 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -723,6 +723,13 @@ public final class ViewRootImpl implements ViewParent,
private boolean mNextDrawUseBlastSync = false;
/**
+ * Wait for the blast sync transaction complete callback before drawing and queuing up more
+ * frames. This will prevent out of order buffers submissions when WM has requested to
+ * synchronize with the client.
+ */
+ private boolean mWaitForBlastSyncComplete = false;
+
+ /**
* Keeps track of whether a traverse was triggered while the UI thread was paused. This can
* occur when the client is waiting on another process to submit the transaction that
* contains the buffer. The UI thread needs to wait on the callback before it can submit
@@ -2463,7 +2470,7 @@ public final class ViewRootImpl implements ViewParent,
//
// When the callback is invoked, it will trigger a traversal request if
// mRequestedTraverseWhilePaused is set so there's no need to attempt a retry here.
- if (mNextDrawUseBlastSync) {
+ if (mWaitForBlastSyncComplete) {
if (DEBUG_BLAST) {
Log.w(mTag, "Can't perform draw while waiting for a transaction complete");
}
@@ -3244,10 +3251,6 @@ public final class ViewRootImpl implements ViewParent,
pendingDrawFinished();
}
}
-
- // We were unable to draw this traversal. Unset this flag since we'll block without
- // ever being able to draw again
- mNextDrawUseBlastSync = false;
}
if (mAttachInfo.mContentCaptureEvents != null) {
@@ -3990,7 +3993,7 @@ public final class ViewRootImpl implements ViewParent,
+ " reportNextDraw=" + reportNextDraw
+ " hasBlurUpdates=" + hasBlurUpdates);
}
-
+ mWaitForBlastSyncComplete = nextDrawUseBlastSync;
final BackgroundBlurDrawable.BlurRegion[] blurRegionsForFrame =
needsCallbackForBlur ? mBlurRegionAggregator.getBlurRegionsCopyForRT() : null;
@@ -4025,6 +4028,7 @@ public final class ViewRootImpl implements ViewParent,
}
mHandler.postAtFrontOfQueue(() -> {
mNextDrawUseBlastSync = false;
+ mWaitForBlastSyncComplete = false;
if (DEBUG_BLAST) {
Log.d(mTag, "Scheduling a traversal=" + mRequestedTraverseWhilePaused
+ " due to a previous skipped traversal.");