summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Robin Lee <rgl@google.com> 2023-02-09 14:41:37 +0100
committer Robin Lee <rgl@google.com> 2023-02-22 11:12:46 +0000
commit9c1d6b45920a402d35f18057151e78cad1ccf0b4 (patch)
tree2dee63f181950c696e9b35e9019848948f5402b6
parente04f925d9ba85e542014ef83e07b04654229b18d (diff)
Release WallpaperService SurfaceControl directly
The SurfaceControl is created with the engine and filled in later after the first time attachging. It can be released as soon as the engine is detached, since wallpaper engines are never reused after detaching. Test: atest WallpaperManagerTest # after which, check dumpsys surfaceflinger for leftover offscreen wallpaper layers Test: adb shell su root kill -10 `adb shell pidof system_server` # and then take a heap dump to ensure the IWindow is also gone. Bug: 261358202 Change-Id: I86f0a3ee9b8272d61bbc8f9c5f80ee3f0ddac96f
-rw-r--r--core/java/android/service/wallpaper/WallpaperService.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java
index 12cd5236017c..f53abce1d1ea 100644
--- a/core/java/android/service/wallpaper/WallpaperService.java
+++ b/core/java/android/service/wallpaper/WallpaperService.java
@@ -2198,6 +2198,11 @@ public abstract class WallpaperService extends Service {
}
mCreated = false;
}
+
+ if (mSurfaceControl != null) {
+ mSurfaceControl.release();
+ mSurfaceControl = null;
+ }
}
private final DisplayListener mDisplayListener = new DisplayListener() {