From d5c7dd6da810a6b89151b337bea79fd817e6b72a Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Wed, 8 Mar 2017 10:39:30 -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 the revert was an incorrect JNI signature around deferTransactionUntilSurface. I've noted it inline. 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: Ie56b6f7ab16f32d7fc459b8eba26594337ad55de --- 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