From 8b607589d37a68aa615d15fde953401ad3b37798 Mon Sep 17 00:00:00 2001 From: Vishnu Nair Date: Tue, 9 May 2023 21:48:24 -0700 Subject: [PATCH] [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 --- .../core/java/com/android/server/wm/WindowManagerService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 25b7df4eda08d..77761324ec96d 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -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; }