Loading core/java/android/view/SurfaceControl.java +25 −3 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ public final class SurfaceControl implements Parcelable { */ public long mNativeObject; private long mNativeHandle; private Throwable mReleaseStack = null; // TODO: Move this to native. private final Object mSizeLock = new Object(); Loading Loading @@ -431,6 +432,13 @@ public final class SurfaceControl implements Parcelable { } mNativeObject = nativeObject; mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0; if (mNativeObject == 0) { if (Build.IS_DEBUGGABLE) { mReleaseStack = new Throwable("assigned zero nativeObject here"); } } else { mReleaseStack = null; } } /** Loading Loading @@ -989,10 +997,21 @@ public final class SurfaceControl implements Parcelable { nativeRelease(mNativeObject); mNativeObject = 0; mNativeHandle = 0; if (Build.IS_DEBUGGABLE) { mReleaseStack = new Throwable("released here"); } mCloseGuard.close(); } } /** * Returns the call stack that assigned mNativeObject to zero. * @hide */ public Throwable getReleaseStack() { return mReleaseStack; } /** * Disconnect any client still connected to the surface. * @hide Loading @@ -1004,8 +1023,11 @@ public final class SurfaceControl implements Parcelable { } private void checkNotReleased() { if (mNativeObject == 0) throw new NullPointerException( "mNativeObject is null. Have you called release() already?"); if (mNativeObject == 0) { Log.wtf(TAG, "Invalid " + this + " caused by:", mReleaseStack); throw new NullPointerException( "mNativeObject of " + this + " is null. Have you called release() already?"); } } /** Loading services/core/java/com/android/server/wm/WindowManagerService.java +11 −2 Original line number Diff line number Diff line Loading @@ -2445,8 +2445,17 @@ public class WindowManagerService extends IWindowManager.Stub if (controls != null) { final int length = Math.min(controls.length, outControls.length); for (int i = 0; i < length; i++) { outControls[i] = win.isClientLocal() ? new InsetsSourceControl(controls[i]) : controls[i]; final InsetsSourceControl control = controls[i]; // Check if we are sending invalid leashes. final SurfaceControl leash = control != null ? control.getLeash() : null; if (leash != null && !leash.isValid()) { Slog.wtf(TAG, leash + " is not valid before sending to " + win, leash.getReleaseStack()); } outControls[i] = win.isClientLocal() && control != null ? new InsetsSourceControl(control) : control; } } } Loading Loading
core/java/android/view/SurfaceControl.java +25 −3 Original line number Diff line number Diff line Loading @@ -228,6 +228,7 @@ public final class SurfaceControl implements Parcelable { */ public long mNativeObject; private long mNativeHandle; private Throwable mReleaseStack = null; // TODO: Move this to native. private final Object mSizeLock = new Object(); Loading Loading @@ -431,6 +432,13 @@ public final class SurfaceControl implements Parcelable { } mNativeObject = nativeObject; mNativeHandle = mNativeObject != 0 ? nativeGetHandle(nativeObject) : 0; if (mNativeObject == 0) { if (Build.IS_DEBUGGABLE) { mReleaseStack = new Throwable("assigned zero nativeObject here"); } } else { mReleaseStack = null; } } /** Loading Loading @@ -989,10 +997,21 @@ public final class SurfaceControl implements Parcelable { nativeRelease(mNativeObject); mNativeObject = 0; mNativeHandle = 0; if (Build.IS_DEBUGGABLE) { mReleaseStack = new Throwable("released here"); } mCloseGuard.close(); } } /** * Returns the call stack that assigned mNativeObject to zero. * @hide */ public Throwable getReleaseStack() { return mReleaseStack; } /** * Disconnect any client still connected to the surface. * @hide Loading @@ -1004,8 +1023,11 @@ public final class SurfaceControl implements Parcelable { } private void checkNotReleased() { if (mNativeObject == 0) throw new NullPointerException( "mNativeObject is null. Have you called release() already?"); if (mNativeObject == 0) { Log.wtf(TAG, "Invalid " + this + " caused by:", mReleaseStack); throw new NullPointerException( "mNativeObject of " + this + " is null. Have you called release() already?"); } } /** Loading
services/core/java/com/android/server/wm/WindowManagerService.java +11 −2 Original line number Diff line number Diff line Loading @@ -2445,8 +2445,17 @@ public class WindowManagerService extends IWindowManager.Stub if (controls != null) { final int length = Math.min(controls.length, outControls.length); for (int i = 0; i < length; i++) { outControls[i] = win.isClientLocal() ? new InsetsSourceControl(controls[i]) : controls[i]; final InsetsSourceControl control = controls[i]; // Check if we are sending invalid leashes. final SurfaceControl leash = control != null ? control.getLeash() : null; if (leash != null && !leash.isValid()) { Slog.wtf(TAG, leash + " is not valid before sending to " + win, leash.getReleaseStack()); } outControls[i] = win.isClientLocal() && control != null ? new InsetsSourceControl(control) : control; } } } Loading