From 4aa30d07c542cec423ec36db7c294825e757a157 Mon Sep 17 00:00:00 2001 From: Derek Sollenberger Date: Fri, 30 Aug 2019 13:53:29 -0400 Subject: Remove native calls to HWUI from Surface and use the public API instead Test: CtsGraphicsTestCases and CtsWindowManagerDeviceTestCases Bug: 137655431 Change-Id: I8427f96e4f33905e8cabb6d48a0cc29443b9ed63 --- graphics/java/android/graphics/HardwareRenderer.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'graphics/java/android') diff --git a/graphics/java/android/graphics/HardwareRenderer.java b/graphics/java/android/graphics/HardwareRenderer.java index b6b2d4e1c46a..3f3ad578e8d7 100644 --- a/graphics/java/android/graphics/HardwareRenderer.java +++ b/graphics/java/android/graphics/HardwareRenderer.java @@ -286,10 +286,24 @@ public class HardwareRenderer { * non-null then {@link Surface#isValid()} must be true. */ public void setSurface(@Nullable Surface surface) { + setSurface(surface, false); + } + + /** + * See {@link #setSurface(Surface)} + * + * @hide + * @param discardBuffer determines whether the surface will attempt to preserve its contents + * between frames. If set to true the renderer will attempt to preserve + * the contents of the buffer between frames if the implementation allows + * it. If set to false no attempt will be made to preserve the buffer's + * contents between frames. + */ + public void setSurface(@Nullable Surface surface, boolean discardBuffer) { if (surface != null && !surface.isValid()) { throw new IllegalArgumentException("Surface is invalid. surface.isValid() == false."); } - nSetSurface(mNativeProxy, surface); + nSetSurface(mNativeProxy, surface, discardBuffer); } /** @@ -1084,7 +1098,7 @@ public class HardwareRenderer { private static native void nSetName(long nativeProxy, String name); - private static native void nSetSurface(long nativeProxy, Surface window); + private static native void nSetSurface(long nativeProxy, Surface window, boolean discardBuffer); private static native boolean nPause(long nativeProxy); -- cgit v1.2.3-59-g8ed1b