Fix WallpaperEngine object leaked during stress test.
The wallpaper engine object may not have released due to someone continuously change wallpaper with the same component, such as image wallpaper. In this case, server side may receive attached engine to a connection, however, it could already detached. Example sequence: bind wallpaper (A) connection (C1) detachWallpaperLocked(lastwallpaper) lastwallpaper = A + C1 bind wallpaper (A) connection (C2) detachWallpaperLocked(lastwallpaper = A + C1) last = A + C2 attachEngine to C1 Then the connection C1 will never be released because it was be detached. We can fix this by notify that WallpaperService is detached. When it was detached, it shall destroy its engine if there is, and doesn't attach back to WallpaperManagerService anymore. Bug: 128974839 Test: run atest WallpaperManagerTest, then dump adb shell dumpsys activity service com.android.systemui/com.android.systemui.ImageWallpaper to make sure there is only one WallpaperEngine object. Change-Id: Ifea201fe8860af11376717d344fee77182b38e54
Loading
Please register or sign in to comment