Prohibit Config.HARDWARE in factory methods, that create mutable bitmaps

Test: android.cts.graphics.BitmapTest#testCreateMutableBitmapWithHardwareConfig
bug:30999911
Change-Id: I7cd4e2625563b6659613ccd180a57c56dcf7c2b1
This commit is contained in:
sergeyv
2016-11-23 10:27:33 -08:00
parent 939e6cf681
commit 9fbb0b5ab3
7 changed files with 63 additions and 6 deletions

View File

@@ -178,8 +178,12 @@ public final class BitmapRegionDecoder {
* inPurgeable is not supported.
* @return The decoded bitmap, or null if the image data could not be
* decoded.
* @throws IllegalArgumentException if {@link BitmapFactory.Options#inPreferredConfig}
* is {@link android.graphics.Bitmap.Config#HARDWARE}
* and {@link BitmapFactory.Options#inMutable} is set.
*/
public Bitmap decodeRegion(Rect rect, BitmapFactory.Options options) {
BitmapFactory.Options.validate(options);
synchronized (mNativeLock) {
checkRecycled("decodeRegion called on recycled region decoder");
if (rect.right <= 0 || rect.bottom <= 0 || rect.left >= getWidth()