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/SurfaceControl.java | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'core/java/android/view/SurfaceControl.java') diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index b718696b2202..519c1e2454df 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -95,6 +95,11 @@ public class SurfaceControl { IBinder displayToken, int mode); private static native void nativeDeferTransactionUntil(long nativeObject, IBinder handle, long frame); + private static native void nativeDeferTransactionUntilSurface(long nativeObject, + long surfaceObject, long frame); + private static native void nativeReparentChildren(long nativeObject, + IBinder handle); + private static native void nativeSeverChildren(long nativeObject); private static native void nativeSetOverrideScalingMode(long nativeObject, int scalingMode); private static native IBinder nativeGetHandle(long nativeObject); @@ -418,7 +423,23 @@ public class SurfaceControl { } public void deferTransactionUntil(IBinder handle, long frame) { - nativeDeferTransactionUntil(mNativeObject, handle, frame); + if (frame > 0) { + nativeDeferTransactionUntil(mNativeObject, handle, frame); + } + } + + public void deferTransactionUntil(Surface barrier, long frame) { + if (frame > 0) { + nativeDeferTransactionUntilSurface(mNativeObject, barrier.mNativeObject, frame); + } + } + + public void reparentChildren(IBinder newParentHandle) { + nativeReparentChildren(mNativeObject, newParentHandle); + } + + public void detachChildren() { + nativeSeverChildren(mNativeObject); } public void setOverrideScalingMode(int scalingMode) { -- cgit v1.2.3