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

Commit 9a494273 authored by Leon Scroggins III's avatar Leon Scroggins III Committed by Leon Scroggins
Browse files

Move Canvas compatibility settings into Compatibility class

Bug: 155422223
Test: make

Follow on to Ie7172fb93364a1e04ab844b8fa64887bf9d8b005. Remove @hidden
APIs on Canvas - instead call setCompatibilityVersion from the
Compatibility class already in the Java package. This is a step towards
moving Canvas into a mainline module. Note that this means these are set
when the application is bound, rather than when the first View is
created.

Change-Id: I3f73d77ba7351a6cb653dd550210698c6482e1bb
parent c8d49eff
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -5277,10 +5277,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            // of whether a layout was requested on that View.
            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
            // 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
+5 −6
Original line number Diff line number Diff line
@@ -51,10 +51,8 @@ import javax.microedition.khronos.opengles.GL;
 */
public class Canvas extends BaseCanvas {
    private static int sCompatiblityVersion = 0;
    /** @hide */
    public static boolean sCompatibilityRestore = false;
    /** @hide */
    public static boolean sCompatibilitySetBitmap = false;
    private static boolean sCompatibilityRestore = false;
    private static boolean sCompatibilitySetBitmap = false;

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

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

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

    /**