Loading core/java/android/app/WallpaperManager.java +17 −4 Original line number Original line Diff line number Diff line Loading @@ -282,6 +282,10 @@ public class WallpaperManager { } } public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) { public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) { return peekWallpaperBitmap(context, returnDefault, context.getUserId()); } public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault, int userId) { synchronized (this) { synchronized (this) { if (mService != null) { if (mService != null) { try { try { Loading @@ -300,7 +304,7 @@ public class WallpaperManager { } } mWallpaper = null; mWallpaper = null; try { try { mWallpaper = getCurrentWallpaperLocked(context); mWallpaper = getCurrentWallpaperLocked(userId); } catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) { Log.w(TAG, "No memory load current wallpaper", e); Log.w(TAG, "No memory load current wallpaper", e); } } Loading @@ -323,7 +327,7 @@ public class WallpaperManager { } } } } private Bitmap getCurrentWallpaperLocked(Context context) { private Bitmap getCurrentWallpaperLocked(int userId) { if (mService == null) { if (mService == null) { Log.w(TAG, "WallpaperService not running"); Log.w(TAG, "WallpaperService not running"); return null; return null; Loading @@ -332,7 +336,7 @@ public class WallpaperManager { try { try { Bundle params = new Bundle(); Bundle params = new Bundle(); ParcelFileDescriptor fd = mService.getWallpaper(this, FLAG_SET_SYSTEM, ParcelFileDescriptor fd = mService.getWallpaper(this, FLAG_SET_SYSTEM, params, context.getUserId()); params, userId); if (fd != null) { if (fd != null) { try { try { BitmapFactory.Options options = new BitmapFactory.Options(); BitmapFactory.Options options = new BitmapFactory.Options(); Loading Loading @@ -644,7 +648,16 @@ public class WallpaperManager { * @hide * @hide */ */ public Bitmap getBitmap() { public Bitmap getBitmap() { return sGlobals.peekWallpaperBitmap(mContext, true); return getBitmapAsUser(mContext.getUserId()); } /** * Like {@link #getDrawable()} but returns a Bitmap for the provided user. * * @hide */ public Bitmap getBitmapAsUser(int userId) { return sGlobals.peekWallpaperBitmap(mContext, true, userId); } } /** /** Loading services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -1072,6 +1072,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { } } } } @Override public ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, final int which, public ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, final int which, Bundle outParams, int wallpaperUserId) { Bundle outParams, int wallpaperUserId) { if (wallpaperUserId != UserHandle.getCallingUserId()) { if (wallpaperUserId != UserHandle.getCallingUserId()) { Loading Loading
core/java/android/app/WallpaperManager.java +17 −4 Original line number Original line Diff line number Diff line Loading @@ -282,6 +282,10 @@ public class WallpaperManager { } } public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) { public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault) { return peekWallpaperBitmap(context, returnDefault, context.getUserId()); } public Bitmap peekWallpaperBitmap(Context context, boolean returnDefault, int userId) { synchronized (this) { synchronized (this) { if (mService != null) { if (mService != null) { try { try { Loading @@ -300,7 +304,7 @@ public class WallpaperManager { } } mWallpaper = null; mWallpaper = null; try { try { mWallpaper = getCurrentWallpaperLocked(context); mWallpaper = getCurrentWallpaperLocked(userId); } catch (OutOfMemoryError e) { } catch (OutOfMemoryError e) { Log.w(TAG, "No memory load current wallpaper", e); Log.w(TAG, "No memory load current wallpaper", e); } } Loading @@ -323,7 +327,7 @@ public class WallpaperManager { } } } } private Bitmap getCurrentWallpaperLocked(Context context) { private Bitmap getCurrentWallpaperLocked(int userId) { if (mService == null) { if (mService == null) { Log.w(TAG, "WallpaperService not running"); Log.w(TAG, "WallpaperService not running"); return null; return null; Loading @@ -332,7 +336,7 @@ public class WallpaperManager { try { try { Bundle params = new Bundle(); Bundle params = new Bundle(); ParcelFileDescriptor fd = mService.getWallpaper(this, FLAG_SET_SYSTEM, ParcelFileDescriptor fd = mService.getWallpaper(this, FLAG_SET_SYSTEM, params, context.getUserId()); params, userId); if (fd != null) { if (fd != null) { try { try { BitmapFactory.Options options = new BitmapFactory.Options(); BitmapFactory.Options options = new BitmapFactory.Options(); Loading Loading @@ -644,7 +648,16 @@ public class WallpaperManager { * @hide * @hide */ */ public Bitmap getBitmap() { public Bitmap getBitmap() { return sGlobals.peekWallpaperBitmap(mContext, true); return getBitmapAsUser(mContext.getUserId()); } /** * Like {@link #getDrawable()} but returns a Bitmap for the provided user. * * @hide */ public Bitmap getBitmapAsUser(int userId) { return sGlobals.peekWallpaperBitmap(mContext, true, userId); } } /** /** Loading
services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +1 −0 Original line number Original line Diff line number Diff line Loading @@ -1072,6 +1072,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub { } } } } @Override public ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, final int which, public ParcelFileDescriptor getWallpaper(IWallpaperManagerCallback cb, final int which, Bundle outParams, int wallpaperUserId) { Bundle outParams, int wallpaperUserId) { if (wallpaperUserId != UserHandle.getCallingUserId()) { if (wallpaperUserId != UserHandle.getCallingUserId()) { Loading