Loading core/java/android/view/ViewRootImpl.java +34 −27 Original line number Diff line number Diff line Loading @@ -3858,9 +3858,7 @@ public final class ViewRootImpl implements ViewParent, mPendingTransitions.clear(); } if (mActiveSurfaceSyncGroup != null) { mActiveSurfaceSyncGroup.markSyncReady(); } handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mPendingTransaction); } else if (cancelAndRedraw) { mLastPerformTraversalsSkipDrawReason = cancelDueToPreDrawListener ? "predraw_" + mAttachInfo.mTreeObserver.getLastDispatchOnPreDrawCanceledReason() Loading @@ -3874,8 +3872,8 @@ public final class ViewRootImpl implements ViewParent, } mPendingTransitions.clear(); } if (!performDraw(mActiveSurfaceSyncGroup) && mActiveSurfaceSyncGroup != null) { mActiveSurfaceSyncGroup.markSyncReady(); if (!performDraw(mActiveSurfaceSyncGroup)) { handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mPendingTransaction); } } Loading @@ -3890,6 +3888,7 @@ public final class ViewRootImpl implements ViewParent, mReportNextDraw = false; mLastReportNextDrawReason = null; mActiveSurfaceSyncGroup = null; mHasPendingTransactions = false; mSyncBuffer = false; if (isInWMSRequestedSync()) { mWmsRequestSyncGroup.markSyncReady(); Loading Loading @@ -4688,7 +4687,8 @@ public final class ViewRootImpl implements ViewParent, return false; } final boolean fullRedrawNeeded = mFullRedrawNeeded || surfaceSyncGroup != null; final boolean fullRedrawNeeded = mFullRedrawNeeded || surfaceSyncGroup != null || mHasPendingTransactions; mFullRedrawNeeded = false; mIsDrawing = true; Loading Loading @@ -4718,8 +4718,15 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mPendingAnimatingRenderNodes.clear(); } if (mReportNextDraw) { final Transaction pendingTransaction; if (!usingAsyncReport && mHasPendingTransactions) { pendingTransaction = new Transaction(); pendingTransaction.merge(mPendingTransaction); } else { pendingTransaction = null; } if (mReportNextDraw) { // if we're using multi-thread renderer, wait for the window frame draws if (mWindowDrawCountDown != null) { try { Loading @@ -4741,9 +4748,7 @@ public final class ViewRootImpl implements ViewParent, if (mSurfaceHolder != null && mSurface.isValid()) { usingAsyncReport = true; SurfaceCallbackHelper sch = new SurfaceCallbackHelper(() -> { if (surfaceSyncGroup != null) { surfaceSyncGroup.markSyncReady(); } handleSyncRequestWhenNoAsyncDraw(surfaceSyncGroup, pendingTransaction); }); SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks(); Loading @@ -4756,15 +4761,27 @@ public final class ViewRootImpl implements ViewParent, } } if (surfaceSyncGroup != null && !usingAsyncReport) { surfaceSyncGroup.markSyncReady(); if (!usingAsyncReport) { handleSyncRequestWhenNoAsyncDraw(surfaceSyncGroup, pendingTransaction); } if (mPerformContentCapture) { performContentCaptureInitialReport(); } return true; } private void handleSyncRequestWhenNoAsyncDraw(SurfaceSyncGroup surfaceSyncGroup, @Nullable Transaction pendingTransaction) { if (surfaceSyncGroup != null) { if (pendingTransaction != null) { surfaceSyncGroup.addTransaction(pendingTransaction); } surfaceSyncGroup.markSyncReady(); } else if (pendingTransaction != null) { pendingTransaction.apply(); } } /** * Checks (and caches) if content capture is enabled for this context. */ Loading Loading @@ -4850,8 +4867,8 @@ public final class ViewRootImpl implements ViewParent, } } private boolean draw(boolean fullRedrawNeeded, @Nullable SurfaceSyncGroup activeSyncGroup, boolean syncBuffer) { private boolean draw(boolean fullRedrawNeeded, @Nullable SurfaceSyncGroup activeSyncGroup, boolean syncBuffer) { Surface surface = mSurface; if (!surface.isValid()) { return false; Loading Loading @@ -4995,12 +5012,11 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mThreadedRenderer.forceDrawNextFrame(); } } else if (mHasPendingTransactions) { // Register a calback if there's no sync involved but there were calls to // Register a callback if there's no sync involved but there were calls to // applyTransactionOnDraw. If there is a sync involved, the sync callback will // handle merging the pending transaction. registerCallbackForPendingTransactions(); } mHasPendingTransactions = false; mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this); } else { Loading Loading @@ -8977,13 +8993,7 @@ public final class ViewRootImpl implements ViewParent, mAdded = false; AnimationHandler.removeRequestor(this); } if (mActiveSurfaceSyncGroup != null) { mActiveSurfaceSyncGroup.markSyncReady(); mActiveSurfaceSyncGroup = null; } if (mHasPendingTransactions) { mPendingTransaction.apply(); } handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mPendingTransaction); WindowManagerGlobal.getInstance().doRemoveView(this); } Loading Loading @@ -11502,9 +11512,7 @@ public final class ViewRootImpl implements ViewParent, Log.d(mTag, "registerCallbacksForSync syncBuffer=" + syncBuffer); } Transaction t = new Transaction(); t.merge(mPendingTransaction); surfaceSyncGroup.addTransaction(mPendingTransaction); mAttachInfo.mThreadedRenderer.registerRtFrameCallback(new FrameDrawingCallback() { @Override public void onFrameDraw(long frame) { Loading @@ -11518,7 +11526,6 @@ public final class ViewRootImpl implements ViewParent, + frame + "."); } mergeWithNextTransaction(t, frame); // If the syncResults are SYNC_LOST_SURFACE_REWARD_IF_FOUND or // SYNC_CONTEXT_IS_STOPPED it means nothing will draw. There's no need to set up // any blast sync or commit callback, and the code should directly call Loading Loading
core/java/android/view/ViewRootImpl.java +34 −27 Original line number Diff line number Diff line Loading @@ -3858,9 +3858,7 @@ public final class ViewRootImpl implements ViewParent, mPendingTransitions.clear(); } if (mActiveSurfaceSyncGroup != null) { mActiveSurfaceSyncGroup.markSyncReady(); } handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mPendingTransaction); } else if (cancelAndRedraw) { mLastPerformTraversalsSkipDrawReason = cancelDueToPreDrawListener ? "predraw_" + mAttachInfo.mTreeObserver.getLastDispatchOnPreDrawCanceledReason() Loading @@ -3874,8 +3872,8 @@ public final class ViewRootImpl implements ViewParent, } mPendingTransitions.clear(); } if (!performDraw(mActiveSurfaceSyncGroup) && mActiveSurfaceSyncGroup != null) { mActiveSurfaceSyncGroup.markSyncReady(); if (!performDraw(mActiveSurfaceSyncGroup)) { handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mPendingTransaction); } } Loading @@ -3890,6 +3888,7 @@ public final class ViewRootImpl implements ViewParent, mReportNextDraw = false; mLastReportNextDrawReason = null; mActiveSurfaceSyncGroup = null; mHasPendingTransactions = false; mSyncBuffer = false; if (isInWMSRequestedSync()) { mWmsRequestSyncGroup.markSyncReady(); Loading Loading @@ -4688,7 +4687,8 @@ public final class ViewRootImpl implements ViewParent, return false; } final boolean fullRedrawNeeded = mFullRedrawNeeded || surfaceSyncGroup != null; final boolean fullRedrawNeeded = mFullRedrawNeeded || surfaceSyncGroup != null || mHasPendingTransactions; mFullRedrawNeeded = false; mIsDrawing = true; Loading Loading @@ -4718,8 +4718,15 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mPendingAnimatingRenderNodes.clear(); } if (mReportNextDraw) { final Transaction pendingTransaction; if (!usingAsyncReport && mHasPendingTransactions) { pendingTransaction = new Transaction(); pendingTransaction.merge(mPendingTransaction); } else { pendingTransaction = null; } if (mReportNextDraw) { // if we're using multi-thread renderer, wait for the window frame draws if (mWindowDrawCountDown != null) { try { Loading @@ -4741,9 +4748,7 @@ public final class ViewRootImpl implements ViewParent, if (mSurfaceHolder != null && mSurface.isValid()) { usingAsyncReport = true; SurfaceCallbackHelper sch = new SurfaceCallbackHelper(() -> { if (surfaceSyncGroup != null) { surfaceSyncGroup.markSyncReady(); } handleSyncRequestWhenNoAsyncDraw(surfaceSyncGroup, pendingTransaction); }); SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks(); Loading @@ -4756,15 +4761,27 @@ public final class ViewRootImpl implements ViewParent, } } if (surfaceSyncGroup != null && !usingAsyncReport) { surfaceSyncGroup.markSyncReady(); if (!usingAsyncReport) { handleSyncRequestWhenNoAsyncDraw(surfaceSyncGroup, pendingTransaction); } if (mPerformContentCapture) { performContentCaptureInitialReport(); } return true; } private void handleSyncRequestWhenNoAsyncDraw(SurfaceSyncGroup surfaceSyncGroup, @Nullable Transaction pendingTransaction) { if (surfaceSyncGroup != null) { if (pendingTransaction != null) { surfaceSyncGroup.addTransaction(pendingTransaction); } surfaceSyncGroup.markSyncReady(); } else if (pendingTransaction != null) { pendingTransaction.apply(); } } /** * Checks (and caches) if content capture is enabled for this context. */ Loading Loading @@ -4850,8 +4867,8 @@ public final class ViewRootImpl implements ViewParent, } } private boolean draw(boolean fullRedrawNeeded, @Nullable SurfaceSyncGroup activeSyncGroup, boolean syncBuffer) { private boolean draw(boolean fullRedrawNeeded, @Nullable SurfaceSyncGroup activeSyncGroup, boolean syncBuffer) { Surface surface = mSurface; if (!surface.isValid()) { return false; Loading Loading @@ -4995,12 +5012,11 @@ public final class ViewRootImpl implements ViewParent, mAttachInfo.mThreadedRenderer.forceDrawNextFrame(); } } else if (mHasPendingTransactions) { // Register a calback if there's no sync involved but there were calls to // Register a callback if there's no sync involved but there were calls to // applyTransactionOnDraw. If there is a sync involved, the sync callback will // handle merging the pending transaction. registerCallbackForPendingTransactions(); } mHasPendingTransactions = false; mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this); } else { Loading Loading @@ -8977,13 +8993,7 @@ public final class ViewRootImpl implements ViewParent, mAdded = false; AnimationHandler.removeRequestor(this); } if (mActiveSurfaceSyncGroup != null) { mActiveSurfaceSyncGroup.markSyncReady(); mActiveSurfaceSyncGroup = null; } if (mHasPendingTransactions) { mPendingTransaction.apply(); } handleSyncRequestWhenNoAsyncDraw(mActiveSurfaceSyncGroup, mPendingTransaction); WindowManagerGlobal.getInstance().doRemoveView(this); } Loading Loading @@ -11502,9 +11512,7 @@ public final class ViewRootImpl implements ViewParent, Log.d(mTag, "registerCallbacksForSync syncBuffer=" + syncBuffer); } Transaction t = new Transaction(); t.merge(mPendingTransaction); surfaceSyncGroup.addTransaction(mPendingTransaction); mAttachInfo.mThreadedRenderer.registerRtFrameCallback(new FrameDrawingCallback() { @Override public void onFrameDraw(long frame) { Loading @@ -11518,7 +11526,6 @@ public final class ViewRootImpl implements ViewParent, + frame + "."); } mergeWithNextTransaction(t, frame); // If the syncResults are SYNC_LOST_SURFACE_REWARD_IF_FOUND or // SYNC_CONTEXT_IS_STOPPED it means nothing will draw. There's no need to set up // any blast sync or commit callback, and the code should directly call Loading