}
/**
- * If the current wallpaper is a live wallpaper component, return the
- * information about that wallpaper. Otherwise, if it is a static image,
- * simply return null.
+ * Returns the information about the wallpaper if the current wallpaper is
+ * a live wallpaper component. Otherwise, if the wallpaper is a static image,
+ * this returns null.
*/
public WallpaperInfo getWallpaperInfo() {
+ return getWallpaperInfo(mContext.getUserId());
+ }
+
+ /**
+ * Returns the information about the wallpaper if the current wallpaper is
+ * a live wallpaper component. Otherwise, if the wallpaper is a static image,
+ * this returns null.
+ *
+ * @param userId Owner of the wallpaper.
+ * @hide
+ */
+ public WallpaperInfo getWallpaperInfo(int userId) {
try {
if (sGlobals.mService == null) {
Log.w(TAG, "WallpaperService not running");
throw new RuntimeException(new DeadSystemException());
} else {
- return sGlobals.mService.getWallpaperInfo(mContext.getUserId());
+ return sGlobals.mService.getWallpaperInfo(userId);
}
} catch (RemoteException e) {
throw e.rethrowFromSystemServer();
protected NotificationLockscreenUserManager mLockscreenUserManager;
protected NotificationRemoteInputManager mRemoteInputManager;
- private BroadcastReceiver mWallpaperChangedReceiver = new BroadcastReceiver() {
+ private final BroadcastReceiver mWallpaperChangedReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
WallpaperManager wallpaperManager = context.getSystemService(WallpaperManager.class);
Log.w(TAG, "WallpaperManager not available");
return;
}
- WallpaperInfo info = wallpaperManager.getWallpaperInfo();
+ WallpaperInfo info = wallpaperManager.getWallpaperInfo(UserHandle.USER_CURRENT);
final boolean supportsAmbientMode = info != null &&
info.getSupportsAmbientMode();
// Make sure we always have the most current wallpaper info.
IntentFilter wallpaperChangedFilter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
- mContext.registerReceiver(mWallpaperChangedReceiver, wallpaperChangedFilter);
+ mContext.registerReceiverAsUser(mWallpaperChangedReceiver, UserHandle.ALL,
+ wallpaperChangedFilter, null /* broadcastPermission */, null /* scheduler */);
mWallpaperChangedReceiver.onReceive(mContext, null);
mLockscreenUserManager.setUpWithPresenter(this, mEntryManager);
updateNotificationViews();
mMediaManager.clearCurrentMediaNotification();
setLockscreenUser(newUserId);
+ mWallpaperChangedReceiver.onReceive(mContext, null);
}
@Override