[wm] Explicitly release surfacecontrol in mirrorDisplay

Don't rely on GC to release the surfacecontrol. If we stress
the API like in the case of tests, we may end up not freeing
resources in time and crash the system.

Test: test magnifier
Bug: 279622227

Change-Id: Id70c9387bce0d0e92d40cccdeaab232b9c61d7e8
This commit is contained in:
Vishnu Nair
2023-05-09 21:48:24 -07:00
parent b4eb0b77fd
commit 8b607589d3

View File

@@ -9014,7 +9014,7 @@ public class WindowManagerService extends IWindowManager.Stub
final SurfaceControl mirror = SurfaceControl.mirrorSurface(displaySc);
outSurfaceControl.copyFrom(mirror, "WMS.mirrorDisplay");
mirror.release();
return true;
}