From 5a6161d928dd26307e1797db4959b446c166d935 Mon Sep 17 00:00:00 2001 From: "chuanghua.zhao" Date: Fri, 22 Dec 2023 13:04:41 +0800 Subject: [PATCH] Fix launcher holds a surfaceController When the dark night mode switch is triggered,systemui calls binder to the onNavigationBarSurface method in the launcher and applies the surfaceController. Keep switching,you will keep applying,resulting in more surface objects. The behaviour would cause that SurfaceFlinger couldn't remove the unnecessary navigationbar layers timely and the navigationbar layer would leak in SF. Actively release the SC after using the SC in the launcher. Bug: 317336417 Test: 1.Launch the settings app 2.Click Display menu 3.click the dark theme menu multiple times 4.Check whether the surfaceController is released adb shell "ls -l/proc/904/fd|wc -l" Change-Id: Ic449de9dbe0c52e0053be91e67ee9081a574581b --- .../src/com/android/quickstep/TouchInteractionService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 5baf6d43bd..80682949cf 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -301,6 +301,10 @@ public class TouchInteractionService extends Service { @Override public void onNavigationBarSurface(SurfaceControl surface) { // TODO: implement + if (surface != null) { + surface.release(); + surface = null; + } } @BinderThread