From 5fdf7b8d26f3cd1a2f2fb8a441d40d33270d3b77 Mon Sep 17 00:00:00 2001 From: Huihong Luo Date: Fri, 15 Jan 2021 14:27:06 -0800 Subject: Add SurfaceControl to hwui add a method, setSurfaceControl, for java layer to pass surface control to the render thread Bug: 173671170 Test: call setSurfaceControl method in ViewRootImpl.java Change-Id: I886a79c377938f19cf38b9058f2bec64e1439000 --- graphics/java/android/graphics/HardwareRenderer.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'graphics/java/android') diff --git a/graphics/java/android/graphics/HardwareRenderer.java b/graphics/java/android/graphics/HardwareRenderer.java index b70fa0e693c2..88cf96a9eb4e 100644 --- a/graphics/java/android/graphics/HardwareRenderer.java +++ b/graphics/java/android/graphics/HardwareRenderer.java @@ -39,6 +39,7 @@ import android.view.IGraphicsStatsCallback; import android.view.NativeVectorDrawableAnimator; import android.view.PixelCopy; import android.view.Surface; +import android.view.SurfaceControl; import android.view.SurfaceHolder; import android.view.animation.AnimationUtils; @@ -313,6 +314,16 @@ public class HardwareRenderer { nSetSurface(mNativeProxy, surface, discardBuffer); } + /** + * Sets the SurfaceControl to be used internally inside render thread + * @hide + * @param surfaceControl The surface control to pass to render thread in hwui. + * If null, any previous references held in render thread will be discarded. + */ + public void setSurfaceControl(@Nullable SurfaceControl surfaceControl) { + nSetSurfaceControl(mNativeProxy, surfaceControl != null ? surfaceControl.mNativeObject : 0); + } + /** * Sets the parameters that can be used to control a render request for a * {@link HardwareRenderer}. This is not thread-safe and must not be held on to for longer @@ -1216,6 +1227,8 @@ public class HardwareRenderer { private static native void nSetSurface(long nativeProxy, Surface window, boolean discardBuffer); + private static native void nSetSurfaceControl(long nativeProxy, long nativeSurfaceControl); + private static native boolean nPause(long nativeProxy); private static native void nSetStopped(long nativeProxy, boolean stopped); -- cgit v1.2.3-59-g8ed1b