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

Commit c9105734 authored by Lucas Dupin's avatar Lucas Dupin Committed by android-build-merger
Browse files

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

am: 4f65a357

Change-Id: Ic77d657bef1e7336e1774395da26886e4840a03c
parents f83e8111 4f65a357
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) {