Merge changes from topic "am-37ab0897d803452791072eae772298af" into oc-mr1-dev-plus-aosp
* changes:
Merge changes Id931d441,I83faf974 am: 89c94f67b4 am: 66d7275d39 am: dd3f6046b3 -s ours
Zygote: Fix race condition on package preloads. am: a3d4230b92 -s ours am: f0a3c209ea -s ours am: add03c6742 -s ours
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 3b272c8..ffb39e3 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -433,10 +433,15 @@
static void validate(Options opts) {
if (opts == null) return;
- if (opts.inMutable && opts.inPreferredConfig == Bitmap.Config.HARDWARE) {
+ if (opts.inBitmap != null && opts.inBitmap.getConfig() == Bitmap.Config.HARDWARE) {
throw new IllegalArgumentException("Bitmaps with Config.HARWARE are always immutable");
}
+ if (opts.inMutable && opts.inPreferredConfig == Bitmap.Config.HARDWARE) {
+ throw new IllegalArgumentException("Bitmaps with Config.HARDWARE cannot be " +
+ "decoded into - they are immutable");
+ }
+
if (opts.inPreferredColorSpace != null) {
if (!(opts.inPreferredColorSpace instanceof ColorSpace.Rgb)) {
throw new IllegalArgumentException("The destination color space must use the " +