Loading core/java/android/view/ViewRootImpl.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -704,6 +704,11 @@ public final class ViewRootImpl implements ViewParent, // draw returns. // draw returns. private SurfaceControl.Transaction mRtBLASTSyncTransaction = new SurfaceControl.Transaction(); private SurfaceControl.Transaction mRtBLASTSyncTransaction = new SurfaceControl.Transaction(); // Keeps track of whether the WM requested us to use BLAST Sync when calling relayout. // We use this to make sure we don't send the WM transactions from an internal BLAST sync // (e.g. SurfaceView) private boolean mSendNextFrameToWm = false; private HashSet<ScrollCaptureCallback> mRootScrollCaptureCallbacks; private HashSet<ScrollCaptureCallback> mRootScrollCaptureCallbacks; private String mTag = TAG; private String mTag = TAG; Loading Loading @@ -3053,6 +3058,7 @@ public final class ViewRootImpl implements ViewParent, if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) { if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) { reportNextDraw(); reportNextDraw(); setUseBLASTSyncTransaction(); setUseBLASTSyncTransaction(); mSendNextFrameToWm = true; } } boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible; boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible; Loading Loading @@ -3762,7 +3768,7 @@ public final class ViewRootImpl implements ViewParent, if (needFrameCompleteCallback) { if (needFrameCompleteCallback) { final Handler handler = mAttachInfo.mHandler; final Handler handler = mAttachInfo.mHandler; mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) -> { mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) -> { finishBLASTSync(!reportNextDraw); finishBLASTSync(!mSendNextFrameToWm); handler.postAtFrontOfQueue(() -> { handler.postAtFrontOfQueue(() -> { if (reportNextDraw) { if (reportNextDraw) { // TODO: Use the frame number // TODO: Use the frame number Loading @@ -3784,7 +3790,7 @@ public final class ViewRootImpl implements ViewParent, // so if we are BLAST syncing we make sure the previous draw has // so if we are BLAST syncing we make sure the previous draw has // totally finished. // totally finished. if (mAttachInfo.mThreadedRenderer != null) { if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.fence(); mAttachInfo.mThreadedRenderer.pause(); } } mNextReportConsumeBLAST = true; mNextReportConsumeBLAST = true; Loading Loading @@ -9757,6 +9763,7 @@ public final class ViewRootImpl implements ViewParent, } } private void finishBLASTSync(boolean apply) { private void finishBLASTSync(boolean apply) { mSendNextFrameToWm = false; if (mNextReportConsumeBLAST) { if (mNextReportConsumeBLAST) { mNextReportConsumeBLAST = false; mNextReportConsumeBLAST = false; Loading Loading
core/java/android/view/ViewRootImpl.java +9 −2 Original line number Original line Diff line number Diff line Loading @@ -704,6 +704,11 @@ public final class ViewRootImpl implements ViewParent, // draw returns. // draw returns. private SurfaceControl.Transaction mRtBLASTSyncTransaction = new SurfaceControl.Transaction(); private SurfaceControl.Transaction mRtBLASTSyncTransaction = new SurfaceControl.Transaction(); // Keeps track of whether the WM requested us to use BLAST Sync when calling relayout. // We use this to make sure we don't send the WM transactions from an internal BLAST sync // (e.g. SurfaceView) private boolean mSendNextFrameToWm = false; private HashSet<ScrollCaptureCallback> mRootScrollCaptureCallbacks; private HashSet<ScrollCaptureCallback> mRootScrollCaptureCallbacks; private String mTag = TAG; private String mTag = TAG; Loading Loading @@ -3053,6 +3058,7 @@ public final class ViewRootImpl implements ViewParent, if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) { if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) { reportNextDraw(); reportNextDraw(); setUseBLASTSyncTransaction(); setUseBLASTSyncTransaction(); mSendNextFrameToWm = true; } } boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible; boolean cancelDraw = mAttachInfo.mTreeObserver.dispatchOnPreDraw() || !isViewVisible; Loading Loading @@ -3762,7 +3768,7 @@ public final class ViewRootImpl implements ViewParent, if (needFrameCompleteCallback) { if (needFrameCompleteCallback) { final Handler handler = mAttachInfo.mHandler; final Handler handler = mAttachInfo.mHandler; mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) -> { mAttachInfo.mThreadedRenderer.setFrameCompleteCallback((long frameNr) -> { finishBLASTSync(!reportNextDraw); finishBLASTSync(!mSendNextFrameToWm); handler.postAtFrontOfQueue(() -> { handler.postAtFrontOfQueue(() -> { if (reportNextDraw) { if (reportNextDraw) { // TODO: Use the frame number // TODO: Use the frame number Loading @@ -3784,7 +3790,7 @@ public final class ViewRootImpl implements ViewParent, // so if we are BLAST syncing we make sure the previous draw has // so if we are BLAST syncing we make sure the previous draw has // totally finished. // totally finished. if (mAttachInfo.mThreadedRenderer != null) { if (mAttachInfo.mThreadedRenderer != null) { mAttachInfo.mThreadedRenderer.fence(); mAttachInfo.mThreadedRenderer.pause(); } } mNextReportConsumeBLAST = true; mNextReportConsumeBLAST = true; Loading Loading @@ -9757,6 +9763,7 @@ public final class ViewRootImpl implements ViewParent, } } private void finishBLASTSync(boolean apply) { private void finishBLASTSync(boolean apply) { mSendNextFrameToWm = false; if (mNextReportConsumeBLAST) { if (mNextReportConsumeBLAST) { mNextReportConsumeBLAST = false; mNextReportConsumeBLAST = false; Loading