From cd4aeef88052571365d4e193a2c41e2e6d145491 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Fri, 3 Mar 2017 10:48:11 -0800 Subject: Modify SurfaceView to use SurfaceFlinger child surfaces. Here we have SurfaceView bypass the WindowManager and speak directly to SurfaceFlinger using child surfaces. We also implement some logic in the WM to handle child surfaces in various Surface replacement scenarios. For those following along in the revert Saga, this also includes the follow up CLs to the original CL. - Surface inset calculation - Animation fixes. The error causing revert was a deferTransactionUntil(-1)...-1 cast to uint, defer transaction until MAX_UINT. Bug: 28858420 Bug: 31518219 Bug: 34888808 Bug: 35588318 Bug: 35396882 Test: Existing tests still pass (except for the ones that don't and will be deleted). Change-Id: Ib37236950a1dd3c4f9f4b58fd41ef9003c0557ef --- core/java/android/view/ViewRootImpl.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'core/java/android/view/ViewRootImpl.java') diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 20d960fff661..f9863b0a6761 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -2632,6 +2632,14 @@ public final class ViewRootImpl implements ViewParent, } } + private void onDrawFinished() { + try { + mWindowSession.finishDrawing(mWindow); + } catch (RemoteException e) { + // Have fun! + } + } + private void performDraw() { if (mAttachInfo.mDisplayState == Display.STATE_OFF && !mReportNextDraw) { return; @@ -2682,7 +2690,7 @@ public final class ViewRootImpl implements ViewParent, } if (mSurfaceHolder != null && mSurface.isValid()) { - SurfaceCallbackHelper sch = new SurfaceCallbackHelper(mWindowSession, mWindow); + SurfaceCallbackHelper sch = new SurfaceCallbackHelper(this::onDrawFinished); SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks(); sch.dispatchSurfaceRedrawNeededAsync(mSurfaceHolder, callbacks); -- cgit v1.2.3