diff options
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 239185e5c25d..7c814f4a5773 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -80,6 +80,7 @@ import android.util.SparseBooleanArray; import android.util.TimeUtils; import android.util.TypedValue; import android.view.Surface.OutOfResourcesException; +import android.view.ThreadedRenderer.FrameDrawingCallback; import android.view.View.AttachInfo; import android.view.View.FocusDirection; import android.view.View.MeasureSpec; @@ -175,6 +176,8 @@ public final class ViewRootImpl implements ViewParent, static final ArrayList<Runnable> sFirstDrawHandlers = new ArrayList(); static boolean sFirstDrawComplete = false; + private FrameDrawingCallback mNextRtFrameCallback; + /** * Callback for notifying about global configuration changes. */ @@ -967,6 +970,17 @@ public final class ViewRootImpl implements ViewParent, } } + /** + * Registers a callback to be executed when the next frame is being drawn on RenderThread. This + * callback will be executed on a RenderThread worker thread, and only used for the next frame + * and thus it will only fire once. + * + * @param callback The callback to register. + */ + public void registerRtFrameCallback(FrameDrawingCallback callback) { + mNextRtFrameCallback = callback; + } + private void enableHardwareAcceleration(WindowManager.LayoutParams attrs) { mAttachInfo.mHardwareAccelerated = false; mAttachInfo.mHardwareAccelerationRequested = false; @@ -3260,7 +3274,8 @@ public final class ViewRootImpl implements ViewParent, requestDrawWindow(); } - mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this); + mAttachInfo.mThreadedRenderer.draw(mView, mAttachInfo, this, mNextRtFrameCallback); + mNextRtFrameCallback = null; } else { // If we get here with a disabled & requested hardware renderer, something went // wrong (an invalidate posted right before we destroyed the hardware surface |
