Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4f65a357 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Color extraction should not block switchUser" into oc-mr1-dev

parents dd3b6c83 9272d45d
Loading
Loading
Loading
Loading
+11 −8
Original line number Diff line number Diff line
@@ -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);
        }

        // 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) {