From ed0a167067bdadc3deff0ce18bbf94fba4cd744a Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Mon, 21 Dec 2020 11:56:01 +0800 Subject: Workaround for wallpapers render thread been paused while visible. Workaround for some wallpapers cannot trigger the rendering threads of the remaining engines even if they are visible, so we need to toggle the state to get their attention. Bug: 168759123 Test: atest WallpaperManagerTest WallpaperServiceTest WallpaperServiceTests Change-Id: I4c047f6e932b280e6408f44e590e39b1a9b62128 --- core/java/android/service/wallpaper/WallpaperService.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 507dc7a1d59a..95c959da8456 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -1494,6 +1494,16 @@ public abstract class WallpaperService extends Service { private void doDetachEngine() { mActiveEngines.remove(mEngine); mEngine.detach(); + // Some wallpapers will not trigger the rendering threads of the remaining engines even + // if they are visible, so we need to toggle the state to get their attention. + if (!mDetached.get()) { + for (Engine eng : mActiveEngines) { + if (eng.mVisible) { + eng.doVisibilityChanged(false); + eng.doVisibilityChanged(true); + } + } + } } @Override -- cgit v1.2.3-59-g8ed1b