Allow canceled draws to get retried for sync

Apps can cancel draws using the PreDrawListener. When this happens during a sync request, we don't allow another draw to happen since we are trying to avoid multiple draw requests until a sync is complete.

This change makes sure we can draw once before respecting the cancelDraw flag sent from WMS. So even if WMS says it can't draw again, we will allow retries if the cancel happened due to PreDrawListener

Test: Apps that cancel draw don't get stuck during sync
Fixes: 236910512
Change-Id: I67742d03b78306855e258f06c1496b2ba29ca74e
This commit is contained in:
Chavi Weingarten
2022-06-28 19:12:46 +00:00
parent 9bf636182f
commit 1adc33b5ff

View File

@@ -604,6 +604,8 @@ public final class ViewRootImpl implements ViewParent,
*/
private boolean mCheckIfCanDraw = false;
private boolean mDrewOnceForSync = false;
int mSyncSeqId = 0;
int mLastSyncSeqId = 0;
@@ -2991,6 +2993,9 @@ public final class ViewRootImpl implements ViewParent,
reportNextDraw();
mSyncBuffer = true;
isSyncRequest = true;
if (!cancelDraw) {
mDrewOnceForSync = false;
}
}
final boolean surfaceControlChanged =
@@ -3512,9 +3517,11 @@ public final class ViewRootImpl implements ViewParent,
mCheckIfCanDraw = isSyncRequest || cancelDraw;
boolean cancelAndRedraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || cancelDraw;
boolean cancelAndRedraw =
mAttachInfo.mTreeObserver.dispatchOnPreDraw() || (cancelDraw && mDrewOnceForSync);
if (!cancelAndRedraw) {
createSyncIfNeeded();
mDrewOnceForSync = true;
}
if (!isViewVisible) {