Merge "Merge "Throw if BitmapFactory.Options.inBitmap is HARDWARE" into oc-mr1-dev am: cebe432650" into oc-mr1-dev-plus-aosp

This commit is contained in:
Android Build Merger (Role)
2017-09-15 02:43:03 +00:00
committed by Android (Google) Code Review

View File

@@ -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 " +