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

Commit f8af5a2f authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Clear lock bitmaps when wallpaper applied to home+lock

Let's never keep old bitmap in files. Otherwise if a user has a live
wallpaper on lock screen only, and backups & restore to an older device,
the old bitmap will reappear. Also otherwise, getWallpaperFile() may
return an old bitmap even if the user has a lockscreen live wallpaper.

Only effective with the lockscreen lwp flag

Flag: lockscreen live wallpaper
Bug: 283091821
Test: atest WallpaperManagerTest
Change-Id: I8cd9af52e1a5f3a0388b3af22ab6c8c441520a8e
parent a5dc9ce0
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -366,6 +366,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                    if (lockedWallpaper != null) {
                        detachWallpaperLocked(lockedWallpaper);
                    }
                    clearWallpaperBitmaps(mWallpaper.userId, FLAG_LOCK);
                    mLockWallpaperMap.remove(wallpaper.userId);
                    notifyColorsWhich |= FLAG_LOCK;
                }
@@ -3318,8 +3319,10 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                            });
                        }
                    }
                    boolean lockBitmapCleared = false;
                    if (!mImageWallpaper.equals(newWallpaper.wallpaperComponent)) {
                        clearWallpaperBitmaps(newWallpaper);
                        lockBitmapCleared = newWallpaper.mWhich == FLAG_LOCK;
                    }
                    newWallpaper.wallpaperId = makeWallpaperIdLocked();
                    notifyCallbacksLocked(newWallpaper);
@@ -3337,6 +3340,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub
                                updateEngineFlags(newWallpaper);
                            }
                        }
                        if (!lockBitmapCleared) {
                            clearWallpaperBitmaps(newWallpaper.userId, FLAG_LOCK);
                        }
                        mLockWallpaperMap.remove(newWallpaper.userId);
                    }
                }