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

Commit eeb5f381 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Add an O-release targetAPI check for Canvas.setBitmap. am:...

Merge "Merge "Add an O-release targetAPI check for Canvas.setBitmap. am: d70695ee" into oc-dev-plus-aosp am: 172bd073"
parents 717f0e81 ef16269e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4462,6 +4462,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            sIgnoreMeasureCache = targetSdkVersion < Build.VERSION_CODES.KITKAT;
            Canvas.sCompatibilityRestore = targetSdkVersion < Build.VERSION_CODES.M;
            Canvas.sCompatibilitySetBitmap = targetSdkVersion < Build.VERSION_CODES.O;
            // In M and newer, our widgets can pass a "hint" value in the size
            // for UNSPECIFIED MeasureSpecs. This lets child views of scrolling containers
+11 −0
Original line number Diff line number Diff line
@@ -49,6 +49,8 @@ import javax.microedition.khronos.opengles.GL;
public class Canvas extends BaseCanvas {
    /** @hide */
    public static boolean sCompatibilityRestore = false;
    /** @hide */
    public static boolean sCompatibilitySetBitmap = false;

    /** @hide */
    public long getNativeCanvasWrapper() {
@@ -172,6 +174,11 @@ public class Canvas extends BaseCanvas {
            throw new RuntimeException("Can't set a bitmap device on a HW accelerated canvas");
        }

        Matrix preservedMatrix = null;
        if (bitmap != null && sCompatibilitySetBitmap) {
            preservedMatrix = getMatrix();
        }

        if (bitmap == null) {
            nSetBitmap(mNativeCanvasWrapper, null);
            mDensity = Bitmap.DENSITY_NONE;
@@ -185,6 +192,10 @@ public class Canvas extends BaseCanvas {
            mDensity = bitmap.mDensity;
        }

        if (preservedMatrix != null) {
            setMatrix(preservedMatrix);
        }

        mBitmap = bitmap;
    }