Loading core/java/android/app/WallpaperManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -298,6 +298,14 @@ public class WallpaperManager { public static final String EXTRA_FROM_FOREGROUND_APP = "android.service.wallpaper.extra.FROM_FOREGROUND_APP"; /** * Extra passed on {@link Intent.ACTION_WALLPAPER_CHANGED} indicating if wallpaper was set from * a foreground app. * @hide */ public static final String EXTRA_WHICH_WALLPAPER_CHANGED = "android.service.wallpaper.extra.WHICH_WALLPAPER_CHANGED"; /** * The different screen orientations. {@link #getOrientation} provides their exact definition. * This is only used internally by the framework and the WallpaperBackupAgent. Loading core/java/android/app/wallpaper.aconfig +8 −0 Original line number Diff line number Diff line package: "android.app" container: "system" flag { name: "remove_next_wallpaper_component" namespace: "systemui" description: "Remove deprecated field WallpaperData#nextWallpaperComponent. Only effective after rebooting." bug: "365991991" } flag { name: "fix_wallpaper_changed" namespace: "systemui" description: "Fixes timing of wallpaper changed notification and adds extra information. Only effective after rebooting." bug: "369814294" } services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +33 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE; import static android.Manifest.permission.READ_WALLPAPER_INTERNAL; import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND; import static android.app.Flags.fixWallpaperChanged; import static android.app.Flags.removeNextWallpaperComponent; import static android.app.WallpaperManager.COMMAND_REAPPLY; import static android.app.WallpaperManager.FLAG_LOCK; Loading Loading @@ -349,8 +350,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub if (DEBUG) { Slog.d(TAG, "publish system wallpaper changed!"); } notifyWallpaperComplete(wallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(wallpaper); } } }; // If this was the system wallpaper, rebind... Loading @@ -369,8 +373,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub if (DEBUG) { Slog.d(TAG, "publish lock wallpaper changed!"); } notifyWallpaperComplete(wallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(wallpaper); } } }; wallpaper.mBindSource = BindSource.SET_STATIC; Loading Loading @@ -403,8 +410,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } } private void notifyWallpaperChanged(WallpaperData wallpaper) { // Publish completion *after* we've persisted the changes /* * Calls wallpaper setComplete methods. Called for static wallpapers after the wallpaper is set * and changes are persisted. */ private void notifyWallpaperComplete(WallpaperData wallpaper) { if (wallpaper.setComplete != null) { try { wallpaper.setComplete.onWallpaperChanged(); Loading Loading @@ -1787,6 +1797,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub switchWallpaper(systemWallpaper, null); // TODO(b/278261563): call notifyCallbacksLocked inside switchWallpaper notifyCallbacksLocked(systemWallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(systemWallpaper); } } if (mLockWallpaperWaitingForUnlock) { final WallpaperData lockWallpaper = Loading @@ -1794,6 +1807,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub lockWallpaper.mBindSource = BindSource.SWITCH_WALLPAPER_UNLOCK_USER; switchWallpaper(lockWallpaper, null); notifyCallbacksLocked(lockWallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(lockWallpaper); } } // Make sure that the SELinux labeling of all the relevant files is correct. Loading Loading @@ -3248,6 +3264,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } newWallpaper.wallpaperId = makeWallpaperIdLocked(); notifyCallbacksLocked(newWallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(newWallpaper); } shouldNotifyColors = true; if (offloadColorExtraction()) { shouldNotifyColors = false; Loading Loading @@ -3625,8 +3644,18 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } wallpaper.callbacks.finishBroadcast(); if (!fixWallpaperChanged()) { final Intent intent = new Intent(Intent.ACTION_WALLPAPER_CHANGED); intent.putExtra(WallpaperManager.EXTRA_FROM_FOREGROUND_APP, wallpaper.fromForegroundApp); mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId)); } } private void notifyWallpaperChanged(WallpaperData wallpaper) { final Intent intent = new Intent(Intent.ACTION_WALLPAPER_CHANGED); intent.putExtra(WallpaperManager.EXTRA_FROM_FOREGROUND_APP, wallpaper.fromForegroundApp); intent.putExtra(WallpaperManager.EXTRA_WHICH_WALLPAPER_CHANGED, wallpaper.mWhich); mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId)); } Loading Loading
core/java/android/app/WallpaperManager.java +8 −0 Original line number Diff line number Diff line Loading @@ -298,6 +298,14 @@ public class WallpaperManager { public static final String EXTRA_FROM_FOREGROUND_APP = "android.service.wallpaper.extra.FROM_FOREGROUND_APP"; /** * Extra passed on {@link Intent.ACTION_WALLPAPER_CHANGED} indicating if wallpaper was set from * a foreground app. * @hide */ public static final String EXTRA_WHICH_WALLPAPER_CHANGED = "android.service.wallpaper.extra.WHICH_WALLPAPER_CHANGED"; /** * The different screen orientations. {@link #getOrientation} provides their exact definition. * This is only used internally by the framework and the WallpaperBackupAgent. Loading
core/java/android/app/wallpaper.aconfig +8 −0 Original line number Diff line number Diff line package: "android.app" container: "system" flag { name: "remove_next_wallpaper_component" namespace: "systemui" description: "Remove deprecated field WallpaperData#nextWallpaperComponent. Only effective after rebooting." bug: "365991991" } flag { name: "fix_wallpaper_changed" namespace: "systemui" description: "Fixes timing of wallpaper changed notification and adds extra information. Only effective after rebooting." bug: "369814294" }
services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +33 −4 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL; import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE; import static android.Manifest.permission.READ_WALLPAPER_INTERNAL; import static android.app.ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND; import static android.app.Flags.fixWallpaperChanged; import static android.app.Flags.removeNextWallpaperComponent; import static android.app.WallpaperManager.COMMAND_REAPPLY; import static android.app.WallpaperManager.FLAG_LOCK; Loading Loading @@ -349,8 +350,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub if (DEBUG) { Slog.d(TAG, "publish system wallpaper changed!"); } notifyWallpaperComplete(wallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(wallpaper); } } }; // If this was the system wallpaper, rebind... Loading @@ -369,8 +373,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub if (DEBUG) { Slog.d(TAG, "publish lock wallpaper changed!"); } notifyWallpaperComplete(wallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(wallpaper); } } }; wallpaper.mBindSource = BindSource.SET_STATIC; Loading Loading @@ -403,8 +410,11 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } } private void notifyWallpaperChanged(WallpaperData wallpaper) { // Publish completion *after* we've persisted the changes /* * Calls wallpaper setComplete methods. Called for static wallpapers after the wallpaper is set * and changes are persisted. */ private void notifyWallpaperComplete(WallpaperData wallpaper) { if (wallpaper.setComplete != null) { try { wallpaper.setComplete.onWallpaperChanged(); Loading Loading @@ -1787,6 +1797,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub switchWallpaper(systemWallpaper, null); // TODO(b/278261563): call notifyCallbacksLocked inside switchWallpaper notifyCallbacksLocked(systemWallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(systemWallpaper); } } if (mLockWallpaperWaitingForUnlock) { final WallpaperData lockWallpaper = Loading @@ -1794,6 +1807,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub lockWallpaper.mBindSource = BindSource.SWITCH_WALLPAPER_UNLOCK_USER; switchWallpaper(lockWallpaper, null); notifyCallbacksLocked(lockWallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(lockWallpaper); } } // Make sure that the SELinux labeling of all the relevant files is correct. Loading Loading @@ -3248,6 +3264,9 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } newWallpaper.wallpaperId = makeWallpaperIdLocked(); notifyCallbacksLocked(newWallpaper); if (fixWallpaperChanged()) { notifyWallpaperChanged(newWallpaper); } shouldNotifyColors = true; if (offloadColorExtraction()) { shouldNotifyColors = false; Loading Loading @@ -3625,8 +3644,18 @@ public class WallpaperManagerService extends IWallpaperManager.Stub } wallpaper.callbacks.finishBroadcast(); if (!fixWallpaperChanged()) { final Intent intent = new Intent(Intent.ACTION_WALLPAPER_CHANGED); intent.putExtra(WallpaperManager.EXTRA_FROM_FOREGROUND_APP, wallpaper.fromForegroundApp); mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId)); } } private void notifyWallpaperChanged(WallpaperData wallpaper) { final Intent intent = new Intent(Intent.ACTION_WALLPAPER_CHANGED); intent.putExtra(WallpaperManager.EXTRA_FROM_FOREGROUND_APP, wallpaper.fromForegroundApp); intent.putExtra(WallpaperManager.EXTRA_WHICH_WALLPAPER_CHANGED, wallpaper.mWhich); mContext.sendBroadcastAsUser(intent, new UserHandle(mCurrentUserId)); } Loading