Loading services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +22 −0 Original line number Diff line number Diff line Loading @@ -541,6 +541,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub */ private void extractColors(WallpaperData wallpaper) { String cropFile = null; boolean defaultImageWallpaper = false; int wallpaperId; synchronized (mLock) { Loading @@ -549,6 +550,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub || wallpaper.wallpaperComponent == null; if (imageWallpaper && wallpaper.cropFile != null && wallpaper.cropFile.exists()) { cropFile = wallpaper.cropFile.getAbsolutePath(); } else if (imageWallpaper && !wallpaper.cropExists() && !wallpaper.sourceExists()) { defaultImageWallpaper = true; } wallpaperId = wallpaper.wallpaperId; } Loading @@ -560,6 +563,25 @@ public class WallpaperManagerService extends IWallpaperManager.Stub colors = WallpaperColors.fromBitmap(bitmap); bitmap.recycle(); } } else if (defaultImageWallpaper) { // There is no crop and source file because this is default image wallpaper. try (final InputStream is = WallpaperManager.openDefaultWallpaper(mContext, FLAG_SYSTEM)) { if (is != null) { try { final BitmapFactory.Options options = new BitmapFactory.Options(); final Bitmap bitmap = BitmapFactory.decodeStream(is, null, options); if (bitmap != null) { colors = WallpaperColors.fromBitmap(bitmap); bitmap.recycle(); } } catch (OutOfMemoryError e) { Slog.w(TAG, "Can't decode default wallpaper stream", e); } } } catch (IOException e) { Slog.w(TAG, "Can't close default wallpaper stream", e); } } if (colors == null) { Loading Loading
services/core/java/com/android/server/wallpaper/WallpaperManagerService.java +22 −0 Original line number Diff line number Diff line Loading @@ -541,6 +541,7 @@ public class WallpaperManagerService extends IWallpaperManager.Stub */ private void extractColors(WallpaperData wallpaper) { String cropFile = null; boolean defaultImageWallpaper = false; int wallpaperId; synchronized (mLock) { Loading @@ -549,6 +550,8 @@ public class WallpaperManagerService extends IWallpaperManager.Stub || wallpaper.wallpaperComponent == null; if (imageWallpaper && wallpaper.cropFile != null && wallpaper.cropFile.exists()) { cropFile = wallpaper.cropFile.getAbsolutePath(); } else if (imageWallpaper && !wallpaper.cropExists() && !wallpaper.sourceExists()) { defaultImageWallpaper = true; } wallpaperId = wallpaper.wallpaperId; } Loading @@ -560,6 +563,25 @@ public class WallpaperManagerService extends IWallpaperManager.Stub colors = WallpaperColors.fromBitmap(bitmap); bitmap.recycle(); } } else if (defaultImageWallpaper) { // There is no crop and source file because this is default image wallpaper. try (final InputStream is = WallpaperManager.openDefaultWallpaper(mContext, FLAG_SYSTEM)) { if (is != null) { try { final BitmapFactory.Options options = new BitmapFactory.Options(); final Bitmap bitmap = BitmapFactory.decodeStream(is, null, options); if (bitmap != null) { colors = WallpaperColors.fromBitmap(bitmap); bitmap.recycle(); } } catch (OutOfMemoryError e) { Slog.w(TAG, "Can't decode default wallpaper stream", e); } } } catch (IOException e) { Slog.w(TAG, "Can't close default wallpaper stream", e); } } if (colors == null) { Loading