summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-05-08 13:59:01 -0700
committerJohn Reck <jreck@google.com>2015-05-08 14:02:02 -0700
commit3e776dee3e8af646cdcfb7a60e0e301c99f05293 (patch)
tree168fdb412a62a5709f9db7094b0bc4025b4c5eb7 /graphics
parenta0698b617f1efc71d5301f98aead822e266ec5d6 (diff)
downloadframeworks_base-3e776dee3e8af646cdcfb7a60e0e301c99f05293.zip
frameworks_base-3e776dee3e8af646cdcfb7a60e0e301c99f05293.tar.gz
frameworks_base-3e776dee3e8af646cdcfb7a60e0e301c99f05293.tar.bz2
Compatibility hack
Bug: 20940526 Rather than throwing an exception on accessing a recycled() bitmap let certain operations succeed and just return dummy values. Apps appear to be relying on this. Change-Id: I74df2efdc29d93facd8553ed31cda3addf0b28eb
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Bitmap.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index c850b07..bd52848 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -330,6 +330,7 @@ public final class Bitmap implements Parcelable {
* @return The current generation ID for this bitmap.
*/
public int getGenerationId() {
+ if (mRecycled) return 0;
return nativeGenerationId(mFinalizer.mNativeBitmap);
}
@@ -1040,6 +1041,7 @@ public final class Bitmap implements Parcelable {
* @see BitmapFactory.Options#inPremultiplied
*/
public final boolean isPremultiplied() {
+ if (mRecycled) return false;
return nativeIsPremultiplied(mFinalizer.mNativeBitmap);
}
@@ -1064,6 +1066,7 @@ public final class Bitmap implements Parcelable {
* @see BitmapFactory.Options#inPremultiplied
*/
public final void setPremultiplied(boolean premultiplied) {
+ checkRecycled("setPremultiplied called on a recycled bitmap");
mRequestPremultiplied = premultiplied;
nativeSetPremultiplied(mFinalizer.mNativeBitmap, premultiplied);
}
@@ -1200,6 +1203,7 @@ public final class Bitmap implements Parcelable {
* that config, otherwise return null.
*/
public final Config getConfig() {
+ if (mRecycled) return Config.ARGB_8888;
return Config.nativeToConfig(nativeConfig(mFinalizer.mNativeBitmap));
}
@@ -1212,6 +1216,7 @@ public final class Bitmap implements Parcelable {
* it will return true by default.
*/
public final boolean hasAlpha() {
+ if (mRecycled) return false;
return nativeHasAlpha(mFinalizer.mNativeBitmap);
}
@@ -1226,6 +1231,7 @@ public final class Bitmap implements Parcelable {
* non-opaque per-pixel alpha values.
*/
public void setHasAlpha(boolean hasAlpha) {
+ checkRecycled("setHasAlpha called on a recycled bitmap");
nativeSetHasAlpha(mFinalizer.mNativeBitmap, hasAlpha, mRequestPremultiplied);
}
@@ -1247,6 +1253,7 @@ public final class Bitmap implements Parcelable {
* @see #setHasMipMap(boolean)
*/
public final boolean hasMipMap() {
+ if (mRecycled) return false;
return nativeHasMipMap(mFinalizer.mNativeBitmap);
}
@@ -1271,6 +1278,7 @@ public final class Bitmap implements Parcelable {
* @see #hasMipMap()
*/
public final void setHasMipMap(boolean hasMipMap) {
+ checkRecycled("setHasMipMap called on a recycled bitmap");
nativeSetHasMipMap(mFinalizer.mNativeBitmap, hasMipMap);
}