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

Commit 41f69424 authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Fix problem where wrong colors would be picked

getWallpaperSafeLocked doesn't do what we need, it creates a new
WallpaperData if a lock screen wallpaper isn't set.
The desired behavior would be to get the current system wallpaper colors instead.

There was also a synchronization problem in there.

Test: set live wallpaper and look at lock screen colors
Change-Id: I12a2acb6956ba31bb1d3c0843e04b8e4566e4f12
parent 13e82946
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -1262,14 +1262,23 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
        userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
                Binder.getCallingUid(), userId, false, true, "clearWallpaper", null);

        WallpaperData data = null;
        synchronized (mLock) {
            clearWallpaperLocked(false, which, userId, null);

            if (which == FLAG_LOCK) {
                data = mLockWallpaperMap.get(userId);
            }
            if (which == FLAG_SYSTEM || data == null) {
                data = mWallpaperMap.get(userId);
            }
        }

        // When clearing a wallpaper, broadcast new valid colors
        WallpaperData data = getWallpaperSafeLocked(mCurrentUserId, which);
        if (data != null) {
            notifyWallpaperColorsChanged(data, which);
        }
    }

    void clearWallpaperLocked(boolean defaultFailed, int which, int userId, IRemoteCallback reply) {
        if (which != FLAG_SYSTEM && which != FLAG_LOCK) {