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

Commit f0bc25e4 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Native crash -> ISE" into udc-dev

parents c31d0bea 69c66253
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -401,8 +401,9 @@ public final class Bitmap implements Parcelable {
    /**
    /**
     * This is called by methods that want to throw an exception if the bitmap
     * This is called by methods that want to throw an exception if the bitmap
     * has already been recycled.
     * has already been recycled.
     * @hide
     */
     */
    private void checkRecycled(String errorMessage) {
    void checkRecycled(String errorMessage) {
        if (mRecycled) {
        if (mRecycled) {
            throw new IllegalStateException(errorMessage);
            throw new IllegalStateException(errorMessage);
        }
        }
+3 −0
Original line number Original line Diff line number Diff line
@@ -120,6 +120,7 @@ public class BitmapShader extends Shader {
        if (bitmap == null) {
        if (bitmap == null) {
            throw new IllegalArgumentException("Bitmap must be non-null");
            throw new IllegalArgumentException("Bitmap must be non-null");
        }
        }
        bitmap.checkRecycled("Cannot create BitmapShader for recycled bitmap");
        mBitmap = bitmap;
        mBitmap = bitmap;
        mTileX = tileX;
        mTileX = tileX;
        mTileY = tileY;
        mTileY = tileY;
@@ -188,6 +189,8 @@ public class BitmapShader extends Shader {
    /** @hide */
    /** @hide */
    @Override
    @Override
    protected long createNativeInstance(long nativeMatrix, boolean filterFromPaint) {
    protected long createNativeInstance(long nativeMatrix, boolean filterFromPaint) {
        mBitmap.checkRecycled("BitmapShader's bitmap has been recycled");

        boolean enableLinearFilter = mFilterMode == FILTER_MODE_LINEAR;
        boolean enableLinearFilter = mFilterMode == FILTER_MODE_LINEAR;
        if (mFilterMode == FILTER_MODE_DEFAULT) {
        if (mFilterMode == FILTER_MODE_DEFAULT) {
            mFilterFromPaint = filterFromPaint;
            mFilterFromPaint = filterFromPaint;