Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d82a46fd authored by sergeyv's avatar sergeyv Committed by android-build-merger
Browse files

Merge "Throw if BitmapFactory.Options.inBitmap is HARDWARE" into oc-mr1-dev

am: cebe4326

Change-Id: Id5d81c128f6e96bef732508b8a50bad35f3cb298
parents 87fcf18a cebe4326
Loading
Loading
Loading
Loading
+6 −1
Original line number Original line Diff line number Diff line
@@ -433,10 +433,15 @@ public class BitmapFactory {
        static void validate(Options opts) {
        static void validate(Options opts) {
            if (opts == null) return;
            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");
                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 != null) {
                if (!(opts.inPreferredColorSpace instanceof ColorSpace.Rgb)) {
                if (!(opts.inPreferredColorSpace instanceof ColorSpace.Rgb)) {
                    throw new IllegalArgumentException("The destination color space must use the " +
                    throw new IllegalArgumentException("The destination color space must use the " +