Merge "Don't crash with non-standard bitmap types." into honeycomb
This commit is contained in:
@@ -796,18 +796,21 @@ public class RemoteViews implements Parcelable, Filter {
|
|||||||
if (this.value != null) {
|
if (this.value != null) {
|
||||||
final Bitmap b = (Bitmap) this.value;
|
final Bitmap b = (Bitmap) this.value;
|
||||||
final Bitmap.Config c = b.getConfig();
|
final Bitmap.Config c = b.getConfig();
|
||||||
|
// If we don't know, be pessimistic and assume 4
|
||||||
int bpp = 4;
|
int bpp = 4;
|
||||||
switch (c) {
|
if (c != null) {
|
||||||
case ALPHA_8:
|
switch (c) {
|
||||||
bpp = 1;
|
case ALPHA_8:
|
||||||
break;
|
bpp = 1;
|
||||||
case RGB_565:
|
break;
|
||||||
case ARGB_4444:
|
case RGB_565:
|
||||||
bpp = 2;
|
case ARGB_4444:
|
||||||
break;
|
bpp = 2;
|
||||||
case ARGB_8888:
|
break;
|
||||||
bpp = 4;
|
case ARGB_8888:
|
||||||
break;
|
bpp = 4;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
counter.bitmapIncrement(b.getWidth() * b.getHeight() * bpp);
|
counter.bitmapIncrement(b.getWidth() * b.getHeight() * bpp);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user