From 5cac2a027968afddc7e1089a9dbb46369874d544 Mon Sep 17 00:00:00 2001 From: wilsonshih Date: Tue, 16 Jun 2020 11:47:30 +0800 Subject: Force relayout when wallpaper engine become visible. After 9118c9b the surface can be destroy after the window state become invisible, since WallpaperService copy the surface from WMS and it is not implement with ViewRootImpl, WallpaperService#Engine should call relayout to get new surface when client need to redraw it. Bug: 158955956 Test: verify the wallpaper can show by launch LiveWallpaperChange with live wallpaper and push/pull it from recents several times. Test: atest WallpaperServiceTest ImageWallpaperTest Change-Id: I79f97df61696eea325183e9b9057cbb10ce8cc66 --- core/java/android/service/wallpaper/WallpaperService.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index f944dd78dc3d..0d420c5936ae 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -1184,7 +1184,8 @@ public abstract class WallpaperService extends Service { // may have been destroyed so now we need to make // sure it is re-created. doOffsetsChanged(false); - updateSurface(false, false, false); + // force relayout to get new surface + updateSurface(true, false, false); } onVisibilityChanged(visible); } -- cgit v1.2.3-59-g8ed1b