summaryrefslogtreecommitdiff
path: root/graphics/java
diff options
context:
space:
mode:
author Cuiping.x.Shu <cuiping.x.shu@sony.com> 2019-02-25 22:45:02 -0800
committer android-build-merger <android-build-merger@google.com> 2019-02-25 22:45:02 -0800
commit2b8063d780f3f6e9240d7d1039635f646f09d938 (patch)
treebec6c4e808cda54eccc0d4048e8bcc549b135a07 /graphics/java
parent6f72ed8b27e133bf026040a037b57e0633cda10e (diff)
parentcc9f4923d227c5255a7ec2936e3b28260f470b3f (diff)
Merge "Check recycled when createBitmap"
am: cc9f4923d2 Change-Id: Ie9cb9fa170d017515779013a71917481c2c3a2d4
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/Bitmap.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index d6131cf2e5d4..507f767ae3e6 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -814,7 +814,7 @@ public final class Bitmap implements Parcelable {
* @return A bitmap that represents the specified subset of source
* @throws IllegalArgumentException if the x, y, width, height values are
* outside of the dimensions of the source bitmap, or width is <= 0,
- * or height is <= 0
+ * or height is <= 0, or if the source bitmap has already been recycled
*/
public static Bitmap createBitmap(@NonNull Bitmap source, int x, int y, int width, int height,
@Nullable Matrix m, boolean filter) {
@@ -827,6 +827,9 @@ public final class Bitmap implements Parcelable {
if (y + height > source.getHeight()) {
throw new IllegalArgumentException("y + height must be <= bitmap.height()");
}
+ if (source.isRecycled()) {
+ throw new IllegalArgumentException("cannot use a recycled source in createBitmap");
+ }
// check if we can just return our argument unchanged
if (!source.isMutable() && x == 0 && y == 0 && width == source.getWidth() &&