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
This commit is contained in:
wilsonshih
2020-12-21 11:56:01 +08:00
committed by Wei Sheng Shih
parent 2122345cc6
commit ed0a167067

View File

@@ -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