Loading core/java/android/app/WallpaperManager.java +12 −2 Original line number Diff line number Diff line Loading @@ -1603,8 +1603,18 @@ public class WallpaperManager { @SetWallpaperFlags int which, boolean originalBitmap) { checkExactlyOneWallpaperFlagSet(which); try { return sGlobals.mService.getBitmapCrops(displaySizes, which, originalBitmap, mContext.getUserId()); List<Rect> result = sGlobals.mService.getBitmapCrops( displaySizes, which, originalBitmap, mContext.getUserId()); if (result != null) return result; // mService.getBitmapCrops returns null if the requested wallpaper is an ImageWallpaper, // but there are no crop hints and the bitmap size is unknown to the service (this // mostly happens for the default wallpaper). In that case, fetch the bitmap dimensions // and use the other getBitmapCrops API with no cropHints to figure out the crops. Rect bitmapDimensions = peekBitmapDimensions(which, true); if (bitmapDimensions == null) return List.of(); Point bitmapSize = new Point(bitmapDimensions.width(), bitmapDimensions.height()); return getBitmapCrops(bitmapSize, displaySizes, null); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -2269,6 +2269,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub Point croppedBitmapSize = new Point( (int) (0.5f + wallpaper.cropHint.width() / wallpaper.mSampleSize), (int) (0.5f + wallpaper.cropHint.height() / wallpaper.mSampleSize)); if (croppedBitmapSize.equals(0, 0)) { // There is an ImageWallpaper, but there are no crop hints and the bitmap size is // unknown (e.g. the default wallpaper). Return a special "null" value that will be // handled by WallpaperManager, which will fetch the dimensions of the wallpaper. return null; } SparseArray<Rect> relativeDefaultCrops = mWallpaperCropper.getDefaultCrops(relativeSuggestedCrops, croppedBitmapSize); SparseArray<Rect> adjustedRelativeSuggestedCrops = new SparseArray<>(); Loading Loading
core/java/android/app/WallpaperManager.java +12 −2 Original line number Diff line number Diff line Loading @@ -1603,8 +1603,18 @@ public class WallpaperManager { @SetWallpaperFlags int which, boolean originalBitmap) { checkExactlyOneWallpaperFlagSet(which); try { return sGlobals.mService.getBitmapCrops(displaySizes, which, originalBitmap, mContext.getUserId()); List<Rect> result = sGlobals.mService.getBitmapCrops( displaySizes, which, originalBitmap, mContext.getUserId()); if (result != null) return result; // mService.getBitmapCrops returns null if the requested wallpaper is an ImageWallpaper, // but there are no crop hints and the bitmap size is unknown to the service (this // mostly happens for the default wallpaper). In that case, fetch the bitmap dimensions // and use the other getBitmapCrops API with no cropHints to figure out the crops. Rect bitmapDimensions = peekBitmapDimensions(which, true); if (bitmapDimensions == null) return List.of(); Point bitmapSize = new Point(bitmapDimensions.width(), bitmapDimensions.height()); return getBitmapCrops(bitmapSize, displaySizes, null); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } Loading
services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +6 −0 Original line number Diff line number Diff line Loading @@ -2269,6 +2269,12 @@ public class WallpaperManagerService extends IWallpaperManager.Stub Point croppedBitmapSize = new Point( (int) (0.5f + wallpaper.cropHint.width() / wallpaper.mSampleSize), (int) (0.5f + wallpaper.cropHint.height() / wallpaper.mSampleSize)); if (croppedBitmapSize.equals(0, 0)) { // There is an ImageWallpaper, but there are no crop hints and the bitmap size is // unknown (e.g. the default wallpaper). Return a special "null" value that will be // handled by WallpaperManager, which will fetch the dimensions of the wallpaper. return null; } SparseArray<Rect> relativeDefaultCrops = mWallpaperCropper.getDefaultCrops(relativeSuggestedCrops, croppedBitmapSize); SparseArray<Rect> adjustedRelativeSuggestedCrops = new SparseArray<>(); Loading