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

Commit 8c7b965b authored by Roman Birg's avatar Roman Birg
Browse files

improve lock screen wallpaper behavior



 - Fix lockscreen wallpaper not being reloaded on user switch.
   There was an issue where the wrong user id was being queried for the
   keyguard wallpaper. Always use the current user id.

 - Also clean up a left-over call for some regular wallpaper
   migration logic that the lock screen wallpaper

 - Add method for removing references to the current lock screen
   wallpaper, which we call from systemui when switching users.

 - Only apply the lock screen wallpaper if there is no media metadata
   to show. There were some cases when it would still appear even when
   music was playing.

Change-Id: I610a38ac11a19638298ca9490b3c87b7ab6106f2
Signed-off-by: default avatarRoman Birg <roman@cyngn.com>
parent 27d0b221
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -304,6 +304,12 @@ public class WallpaperManager {
            }
        }

        public void forgetLoadedKeyguardWallpaper() {
            synchronized (this) {
                mKeyguardWallpaper = null;
            }
        }

        private Bitmap getCurrentWallpaperLocked(Context context) {
            if (mService == null) {
                Log.w(TAG, "WallpaperService not running");
@@ -699,6 +705,13 @@ public class WallpaperManager {
        sGlobals.forgetLoadedWallpaper();
    }

    /**
     * @hide
     */
    public void forgetLoadedKeyguardWallpaper() {
        sGlobals.forgetLoadedKeyguardWallpaper();
    }

    /**
     * If the current wallpaper is a live wallpaper component, return the
     * information about that wallpaper.  Otherwise, if it is a static image,
+7 −1
Original line number Diff line number Diff line
@@ -2260,7 +2260,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        }

        // apply user lockscreen image
        if (backdropBitmap == null) {
        if (mMediaMetadata == null && backdropBitmap == null) {
            WallpaperManager wm = (WallpaperManager)
                    mContext.getSystemService(Context.WALLPAPER_SERVICE);
            if (wm != null) {
@@ -3729,6 +3729,12 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
        updateNotifications();
        resetUserSetupObserver();
        setControllerUsers();

        WallpaperManager wm = (WallpaperManager)
                mContext.getSystemService(Context.WALLPAPER_SERVICE);
        wm.forgetLoadedKeyguardWallpaper();
        updateMediaMetaData(true);

        if (mNavigationBarView != null) {
            mNavigationBarView.updateSettings();
        }
+1 −13
Original line number Diff line number Diff line
@@ -897,15 +897,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
    public ParcelFileDescriptor getKeyguardWallpaper(IWallpaperManagerCallback cb,
                                                     Bundle outParams) {
        synchronized (mLock) {
            // This returns the current user's wallpaper, if called by a system service. Else it
            // returns the wallpaper for the calling user.
            int callingUid = Binder.getCallingUid();
            int wallpaperUserId = 0;
            if (callingUid == android.os.Process.SYSTEM_UID) {
                wallpaperUserId = mCurrentUserId;
            } else {
                wallpaperUserId = UserHandle.getUserId(callingUid);
            }
            int wallpaperUserId = mCurrentUserId;
            KeyguardWallpaperData wallpaper = mKeyguardWallpaperMap.get(wallpaperUserId);
            try {
                if (outParams != null) {
@@ -1494,10 +1486,6 @@ public class WallpaperManagerService extends IWallpaperManager.Stub {
        JournaledFile journal = makeJournaledFile(KEYGUARD_WALLPAPER_INFO, userId);
        FileInputStream stream = null;
        File file = journal.chooseForRead();
        if (!file.exists()) {
            // This should only happen one time, when upgrading from a legacy system
            migrateFromOld();
        }
        KeyguardWallpaperData keyguardWallpaper = mKeyguardWallpaperMap.get(userId);
        if (keyguardWallpaper == null) {
            keyguardWallpaper = new KeyguardWallpaperData(userId);