Don't crash when scaling Bitmaps with private Bitmap.Configs
Bug: 6526197
Change-Id: I89f008f90888f0a679274c00293342ab0fb0e28e
diff --git a/media/java/android/media/RemoteControlClient.java b/media/java/android/media/RemoteControlClient.java
index 18b4ee6..f1c4d34 100644
--- a/media/java/android/media/RemoteControlClient.java
+++ b/media/java/android/media/RemoteControlClient.java
@@ -854,7 +854,11 @@
float scale = Math.min((float) maxWidth / width, (float) maxHeight / height);
int newWidth = Math.round(scale * width);
int newHeight = Math.round(scale * height);
- Bitmap outBitmap = Bitmap.createBitmap(newWidth, newHeight, bitmap.getConfig());
+ Bitmap.Config newConfig = bitmap.getConfig();
+ if (newConfig == null) {
+ newConfig = Bitmap.Config.ARGB_8888;
+ }
+ Bitmap outBitmap = Bitmap.createBitmap(newWidth, newHeight, newConfig);
Canvas canvas = new Canvas(outBitmap);
Paint paint = new Paint();
paint.setAntiAlias(true);