diff options
| author | Vishnu Nair <vishnun@google.com> | 2019-06-25 17:29:27 -0700 |
|---|---|---|
| committer | Vishnu Nair <vishnun@google.com> | 2019-06-25 17:31:11 -0700 |
| commit | 4bcd152a3a3178c0c0c4b30a5da729ea8bbfcfed (patch) | |
| tree | d437cd364c0f4f6c91b85d18c8b97dfc79a2f2a3 /core/java/android | |
| parent | 82e696d5d3f009eb1475202acffaa410ac0e3ec8 (diff) | |
Remove SurfaceControl#getHandle from JAVA apis 1/2
Holding on to a reference of the handle in Java will keep the server-side surface alive until
the reference is removed by GC. This may cause surfaces to be kept alive longer than necessary.
Instead hold on the surface control and call SurfaceControl#release which will release the local
reference to the server-side surface.
Bug: 136004147
Test: go/wm-smoke
Test: gesture nav sanity tests
Test: atest CompositionSamplingListenerTest
Change-Id: Iab33680746c8f48c28783e6a2a13c9ac7ae04980
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/view/CompositionSamplingListener.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/core/java/android/view/CompositionSamplingListener.java b/core/java/android/view/CompositionSamplingListener.java index e4309a6d9aa4..368445cde72c 100644 --- a/core/java/android/view/CompositionSamplingListener.java +++ b/core/java/android/view/CompositionSamplingListener.java @@ -17,7 +17,6 @@ package android.view; import android.graphics.Rect; -import android.os.IBinder; import com.android.internal.util.Preconditions; @@ -58,11 +57,12 @@ public abstract class CompositionSamplingListener { * Registers a sampling listener. */ public static void register(CompositionSamplingListener listener, - int displayId, IBinder stopLayer, Rect samplingArea) { + int displayId, SurfaceControl stopLayer, Rect samplingArea) { Preconditions.checkArgument(displayId == Display.DEFAULT_DISPLAY, "default display only for now"); - nativeRegister(listener.mNativeListener, stopLayer, samplingArea.left, samplingArea.top, - samplingArea.right, samplingArea.bottom); + long nativeStopLayerObject = stopLayer != null ? stopLayer.mNativeObject : 0; + nativeRegister(listener.mNativeListener, nativeStopLayerObject, samplingArea.left, + samplingArea.top, samplingArea.right, samplingArea.bottom); } /** @@ -84,7 +84,7 @@ public abstract class CompositionSamplingListener { private static native long nativeCreate(CompositionSamplingListener thiz); private static native void nativeDestroy(long ptr); - private static native void nativeRegister(long ptr, IBinder stopLayer, + private static native void nativeRegister(long ptr, long stopLayerObject, int samplingAreaLeft, int top, int right, int bottom); private static native void nativeUnregister(long ptr); } |
