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

Commit fdc7ce1e authored by Leon Scroggins's avatar Leon Scroggins Committed by Android (Google) Code Review
Browse files

Merge "Move Canvas compatibility settings into Compatibility class"

parents ded57e59 9a494273
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -5346,10 +5346,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            // of whether a layout was requested on that View.
            // of whether a layout was requested on that View.
            sIgnoreMeasureCache = targetSdkVersion < Build.VERSION_CODES.KITKAT;
            sIgnoreMeasureCache = targetSdkVersion < Build.VERSION_CODES.KITKAT;
            Canvas.sCompatibilityRestore = targetSdkVersion < Build.VERSION_CODES.M;
            Canvas.sCompatibilitySetBitmap = targetSdkVersion < Build.VERSION_CODES.O;
            Canvas.setCompatibilityVersion(targetSdkVersion);
            // In M and newer, our widgets can pass a "hint" value in the size
            // In M and newer, our widgets can pass a "hint" value in the size
            // for UNSPECIFIED MeasureSpecs. This lets child views of scrolling containers
            // for UNSPECIFIED MeasureSpecs. This lets child views of scrolling containers
            // know what the expected parent size is going to be, so e.g. list items can size
            // know what the expected parent size is going to be, so e.g. list items can size
+5 −6
Original line number Original line Diff line number Diff line
@@ -51,10 +51,8 @@ import javax.microedition.khronos.opengles.GL;
 */
 */
public class Canvas extends BaseCanvas {
public class Canvas extends BaseCanvas {
    private static int sCompatiblityVersion = 0;
    private static int sCompatiblityVersion = 0;
    /** @hide */
    private static boolean sCompatibilityRestore = false;
    public static boolean sCompatibilityRestore = false;
    private static boolean sCompatibilitySetBitmap = false;
    /** @hide */
    public static boolean sCompatibilitySetBitmap = false;


    /** @hide */
    /** @hide */
    @UnsupportedAppUsage
    @UnsupportedAppUsage
@@ -1426,9 +1424,10 @@ public class Canvas extends BaseCanvas {
        nFreeTextLayoutCaches();
        nFreeTextLayoutCaches();
    }
    }


    /** @hide */
    /*package*/ static void setCompatibilityVersion(int apiLevel) {
    public static void setCompatibilityVersion(int apiLevel) {
        sCompatiblityVersion = apiLevel;
        sCompatiblityVersion = apiLevel;
        sCompatibilityRestore = apiLevel < Build.VERSION_CODES.M;
        sCompatibilitySetBitmap = apiLevel < Build.VERSION_CODES.O;
        nSetCompatibilityVersion(apiLevel);
        nSetCompatibilityVersion(apiLevel);
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -37,6 +37,7 @@ public final class Compatibility {
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    @SystemApi(client = SystemApi.Client.MODULE_LIBRARIES)
    public static void setTargetSdkVersion(int targetSdkVersion) {
    public static void setTargetSdkVersion(int targetSdkVersion) {
        sTargetSdkVersion = targetSdkVersion;
        sTargetSdkVersion = targetSdkVersion;
        Canvas.setCompatibilityVersion(targetSdkVersion);
    }
    }


    /**
    /**