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

Commit 171beb55 authored by Cuiping.x.Shu's avatar Cuiping.x.Shu Committed by android-build-merger
Browse files

Merge "Check recycled when createBitmap" am: cc9f4923 am: 2b8063d7

am: 73c478f1

Change-Id: Ic8daf7c007670b096e3b7193fe9ccfed3061ff93
parents be1fd400 73c478f1
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -836,7 +836,7 @@ public final class Bitmap implements Parcelable {
     * @return A bitmap that represents the specified subset of source
     * @return A bitmap that represents the specified subset of source
     * @throws IllegalArgumentException if the x, y, width, height values are
     * @throws IllegalArgumentException if the x, y, width, height values are
     *         outside of the dimensions of the source bitmap, or width is <= 0,
     *         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,
    public static Bitmap createBitmap(@NonNull Bitmap source, int x, int y, int width, int height,
            @Nullable Matrix m, boolean filter) {
            @Nullable Matrix m, boolean filter) {
@@ -849,6 +849,9 @@ public final class Bitmap implements Parcelable {
        if (y + height > source.getHeight()) {
        if (y + height > source.getHeight()) {
            throw new IllegalArgumentException("y + height must be <= bitmap.height()");
            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
        // check if we can just return our argument unchanged
        if (!source.isMutable() && x == 0 && y == 0 && width == source.getWidth() &&
        if (!source.isMutable() && x == 0 && y == 0 && width == source.getWidth() &&