diff options
| author | Lucas Dupin <dupin@google.com> | 2017-09-15 23:23:48 +0000 |
|---|---|---|
| committer | android-build-merger <android-build-merger@google.com> | 2017-09-15 23:23:48 +0000 |
| commit | c910573484d8a90bbce7e073d200e53bb50bb317 (patch) | |
| tree | 89eaa677fa89023be84acf5a48cbf6328eae5319 | |
| parent | f83e81117ae239e6b22fea3bec05f2c1eb2bf45c (diff) | |
| parent | 4f65a3571345f38c199dcd50ab5369e070877c96 (diff) | |
Merge "Color extraction should not block switchUser" into oc-mr1-dev
am: 4f65a35713
Change-Id: Ic77d657bef1e7336e1774395da26886e4840a03c
| -rw-r--r-- | services/core/java/com/android/server/wallpaper/WallpaperManagerService.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 0536ff155513..b888ec21e708 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -1301,15 +1301,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { } void switchUser(int userId, IRemoteCallback reply) { - WallpaperData systemWallpaper; - WallpaperData lockWallpaper; + final WallpaperData systemWallpaper; + final WallpaperData lockWallpaper; synchronized (mLock) { mCurrentUserId = userId; systemWallpaper = getWallpaperSafeLocked(userId, FLAG_SYSTEM); - lockWallpaper = mLockWallpaperMap.get(userId); - if (lockWallpaper == null) { - lockWallpaper = systemWallpaper; - } + final WallpaperData tmpLockWallpaper = mLockWallpaperMap.get(userId); + lockWallpaper = tmpLockWallpaper == null ? systemWallpaper : tmpLockWallpaper; // Not started watching yet, in case wallpaper data was loaded for other reasons. if (systemWallpaper.wallpaperObserver == null) { systemWallpaper.wallpaperObserver = new WallpaperObserver(systemWallpaper); @@ -1317,8 +1315,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { } switchWallpaper(systemWallpaper, reply); } - notifyWallpaperColorsChanged(systemWallpaper, FLAG_SYSTEM); - notifyWallpaperColorsChanged(lockWallpaper, FLAG_LOCK); + + // Offload color extraction to another thread since switchUser will be called + // from the main thread. + FgThread.getHandler().post(() -> { + notifyWallpaperColorsChanged(systemWallpaper, FLAG_SYSTEM); + notifyWallpaperColorsChanged(lockWallpaper, FLAG_LOCK); + }); } void switchWallpaper(WallpaperData wallpaper, IRemoteCallback reply) { |
