From 71e6329765a95a8c5eb77d6d376fb9b1bcba689c Mon Sep 17 00:00:00 2001 From: chaviw Date: Tue, 7 Jun 2022 12:02:07 -0500 Subject: [PATCH] Report sync complete when VRI won't draw There is some checks in performDraw that will skip drawing. For example, if the display is off or if there's no view. In those cases, we don't want to wait for a frame since there will be none and instead immediately report back that the sync for this VRI is complete. Test: Repro from bug Fixes: 234426290 Change-Id: I7d5993f9980b9cdafc99a5712e74a4de704aef47 --- core/java/android/view/ViewRootImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 127c7b7a8dc94..b29cb7606828a 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3496,7 +3496,9 @@ public final class ViewRootImpl implements ViewParent, } mPendingTransitions.clear(); } - performDraw(); + if (!performDraw() && mSyncBufferCallback != null) { + mSyncBufferCallback.onBufferReady(null); + } } if (mAttachInfo.mContentCaptureEvents != null) { @@ -4239,11 +4241,11 @@ public final class ViewRootImpl implements ViewParent, }); } - private void performDraw() { + private boolean performDraw() { if (mAttachInfo.mDisplayState == Display.STATE_OFF && !mReportNextDraw) { - return; + return false; } else if (mView == null) { - return; + return false; } final boolean fullRedrawNeeded = mFullRedrawNeeded || mSyncBufferCallback != null; @@ -4327,6 +4329,7 @@ public final class ViewRootImpl implements ViewParent, if (mPerformContentCapture) { performContentCaptureInitialReport(); } + return true; } /**