summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author sergeyv <sergeyv@google.com> 2017-09-15 11:46:10 +0000
committer android-build-merger <android-build-merger@google.com> 2017-09-15 11:46:10 +0000
commit10c6d8b68ed18aad06cec22aa18af63d22023a56 (patch)
tree7781a8e1e6d169d23dd3479217117dc70ef6f0c2
parent6d71e1363063fa12d1b5b28e59f16da0d64c7034 (diff)
parent7a9b7da0514004d98beeff49072a3f1d167f6060 (diff)
Merge "Merge "Throw if BitmapFactory.Options.inBitmap is HARDWARE" into oc-mr1-dev am: cebe432650" into oc-mr1-dev-plus-aosp
am: 7a9b7da051 Change-Id: If0cad94709d037fd47a96870d7b4f56622e9131a
-rw-r--r--graphics/java/android/graphics/BitmapFactory.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 3b272c8ddec7..ffb39e339119 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -433,10 +433,15 @@ public class BitmapFactory {
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 " +