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

Commit a645aac5 authored by Chris Tate's avatar Chris Tate Committed by android-build-merger
Browse files

Merge "Make sure that updated wallpaper id is immediate" into oc-mr1-dev

am: 955bfb6e

Change-Id: Ibfe8cdef80d78bc6ac7b915e55c16b25d978ce8e
parents c98bf2f7 955bfb6e
Loading
Loading
Loading
Loading
+15 −11
Original line number Diff line number Diff line
@@ -1138,7 +1138,13 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
        mMonitor = new MyPackageMonitor();
        mMonitor.register(context, null, UserHandle.ALL, true);
        getWallpaperDir(UserHandle.USER_SYSTEM).mkdirs();

        // Initialize state from the persistent store, then guarantee that the
        // WallpaperData for the system imagery is instantiated & active, creating
        // it from defaults if necessary.
        loadSettingsLocked(UserHandle.USER_SYSTEM, false);
        getWallpaperSafeLocked(UserHandle.USER_SYSTEM, FLAG_SYSTEM);

        mColorsChangedListeners = new SparseArray<>();
    }

@@ -1627,14 +1633,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
                    (which == FLAG_LOCK) ? mLockWallpaperMap : mWallpaperMap;
            WallpaperData wallpaper = whichSet.get(wallpaperUserId);
            if (wallpaper == null) {
                // common case, this is the first lookup post-boot of the system or
                // unified lock, so we bring up the saved state lazily now and recheck.
                loadSettingsLocked(wallpaperUserId, false);
                wallpaper = whichSet.get(wallpaperUserId);
                if (wallpaper == null) {
                // There is no established wallpaper imagery of this type (expected
                // only for lock wallpapers; a system WallpaperData is established at
                // user switch)
                return null;
            }
            }
            try {
                if (outParams != null) {
                    outParams.putInt("width", wallpaper.width);
@@ -1658,7 +1661,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
    @Override
    public WallpaperInfo getWallpaperInfo(int userId) {
        userId = ActivityManager.handleIncomingUser(Binder.getCallingPid(),
                Binder.getCallingUid(), userId, false, true, "getWallpaperIdForUser", null);
                Binder.getCallingUid(), userId, false, true, "getWallpaperInfo", null);
        synchronized (mLock) {
            WallpaperData wallpaper = mWallpaperMap.get(userId);
            if (wallpaper != null && wallpaper.connection != null) {
@@ -2260,7 +2263,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
    private void writeWallpaperAttributes(XmlSerializer out, String tag, WallpaperData wallpaper)
            throws IllegalArgumentException, IllegalStateException, IOException {
        if (DEBUG) {
            Slog.v(TAG, "writeWallpaperAttributes");
            Slog.v(TAG, "writeWallpaperAttributes id=" + wallpaper.wallpaperId);
        }
        out.startTag(null, tag);
        out.attribute(null, "id", Integer.toString(wallpaper.wallpaperId));
@@ -2359,6 +2362,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
     * the event yet.  We use this safe method when we don't care about this ordering and just
     * want to update the data.  The data is going to be applied when the user switch observer
     * is eventually executed.
     *
     * Important: this method loads settings to initialize the given user's wallpaper data if
     * there is no current in-memory state.
     */
    private WallpaperData getWallpaperSafeLocked(int userId, int which) {
        // We're setting either just system (work with the system wallpaper),
@@ -2397,8 +2403,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
    }

    private void loadSettingsLocked(int userId, boolean keepDimensionHints) {
        if (DEBUG) Slog.v(TAG, "loadSettingsLocked");

        JournaledFile journal = makeJournaledFile(userId);
        FileInputStream stream = null;
        File file = journal.chooseForRead();