diff options
| author | 2024-02-13 14:02:00 +0000 | |
|---|---|---|
| committer | 2024-02-14 13:58:19 +0000 | |
| commit | 6fe2a4ed60c7b3f40f55eb813c58d2d5e354ce3b (patch) | |
| tree | 133dbfd3adb65f423c37be92a648dbff62f61128 | |
| parent | 109e56377ab5a5b5c30ec21d0f850e88150f0467 (diff) | |
Reorder loading wallpapers during a user switch.
If the target user's home and lock screen wallpapers are different,
both of them are loaded during the user switch and this lengthens
the user switch duration unnecessarily. We can load the necessary one
during the user switch and postpone loading the other after the switch
depending on whether the target user has credentials or not.
Bug: 324911115
Test: atest WallpaperManagerTest
Flag: ACONFIG android.multiuser.reorder_wallpaper_during_user_switch DEVELOPMENT
Change-Id: I3b073f3315d9f69d18d45d7292cb734eaffe3458
| -rw-r--r-- | services/core/java/com/android/server/wallpaper/WallpaperManagerService.java | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java index 118985a729aa..18afafd05861 100644 --- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java @@ -52,6 +52,7 @@ import android.app.ApplicationExitInfo; import android.app.ILocalWallpaperColorConsumer; import android.app.IWallpaperManager; import android.app.IWallpaperManagerCallback; +import android.app.KeyguardManager; import android.app.PendingIntent; import android.app.UidObserver; import android.app.UserSwitchObserver; @@ -1792,10 +1793,27 @@ public class WallpaperManagerService extends IWallpaperManager.Stub systemWallpaper.wallpaperObserver = new WallpaperObserver(systemWallpaper); systemWallpaper.wallpaperObserver.startWatching(); } - if (lockWallpaper != systemWallpaper) { - switchWallpaper(lockWallpaper, null); + if (Flags.reorderWallpaperDuringUserSwitch()) { + if (mLastLockWallpaper != null) { + detachWallpaperLocked(mLastLockWallpaper); + } + if (mLastWallpaper != null) { + detachWallpaperLocked(mLastWallpaper); + } + if (lockWallpaper == systemWallpaper) { + switchWallpaper(systemWallpaper, reply); + } else { + KeyguardManager km = mContext.getSystemService(KeyguardManager.class); + boolean isDeviceSecure = km != null && km.isDeviceSecure(userId); + switchWallpaper(isDeviceSecure ? lockWallpaper : systemWallpaper, reply); + switchWallpaper(isDeviceSecure ? systemWallpaper : lockWallpaper, null); + } + } else { + if (lockWallpaper != systemWallpaper) { + switchWallpaper(lockWallpaper, null); + } + switchWallpaper(systemWallpaper, reply); } - switchWallpaper(systemWallpaper, reply); mInitialUserSwitch = false; } |