diff options
| author | 2018-04-30 18:25:55 -0700 | |
|---|---|---|
| committer | 2018-04-30 18:25:55 -0700 | |
| commit | ff910d2ba8d0e9e79677188d66ec993a505b7ea3 (patch) | |
| tree | 3f46ccf3a5c0708f6e59a8a6af5ccddd118e23f1 | |
| parent | 9411ab158935bbcf4ace5c8b881b9af977990c2b (diff) | |
SurfaceControl: Close CloseGuard when destroying surface in transaction.
As this signifies releasing the native resources protected by the guard. See comment
for more indepth discussion.
Bug: 78629612
Test: Manual.
Change-Id: Iee9fe9558b1fee171789580c48f4890c2be1c219
| -rw-r--r-- | core/java/android/view/SurfaceControl.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java index 5deee11ba11e..ed8b0053e5bf 100644 --- a/core/java/android/view/SurfaceControl.java +++ b/core/java/android/view/SurfaceControl.java @@ -1580,6 +1580,20 @@ public class SurfaceControl implements Parcelable { */ public Transaction destroy(SurfaceControl sc) { sc.checkNotReleased(); + + /** + * Perhaps it's safer to transfer the close guard to the Transaction + * but then we have a whole wonky scenario regarding merging, multiple + * close-guards per transaction etc...the whole scenario is kind of wonky + * and it seems really we'd like to just be able to call release here + * but the WindowManager has some code that looks like + * --- destroyInTransaction(a) + * --- reparentChildrenInTransaction(a) + * so we need to ensure the SC remains valid until the transaction + * is applied. + */ + sc.mCloseGuard.close(); + nativeDestroy(mNativeObject, sc.mNativeObject); return this; } |