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

Commit b116d877 authored by Haoyu Zhang's avatar Haoyu Zhang Committed by Android (Google) Code Review
Browse files

Merge "Restrict UnsupportedAppUsage after Q"

parents 1d81656f 9f9301cc
Loading
Loading
Loading
Loading
+17 −8
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import android.annotation.Nullable;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.res.AssetManager;
import android.graphics.fonts.FontVariationAxis;
import android.os.Build;
import android.text.TextUtils;

import dalvik.annotation.optimization.CriticalNative;
@@ -58,7 +59,8 @@ public class FontFamily {
     *
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public long mNativePtr;

    // Points native font family builder. Must be zero after freezing this family.
@@ -67,7 +69,8 @@ public class FontFamily {
    /**
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public FontFamily() {
        mBuilderPtr = nInitBuilder(null, 0);
        mNativeBuilderCleaner = sBuilderRegistry.registerNativeAllocation(this, mBuilderPtr);
@@ -76,7 +79,8 @@ public class FontFamily {
    /**
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public FontFamily(@Nullable String[] langs, int variant) {
        final String langsString;
        if (langs == null || langs.length == 0) {
@@ -98,7 +102,8 @@ public class FontFamily {
     *
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public boolean freeze() {
        if (mBuilderPtr == 0) {
            throw new IllegalStateException("This FontFamily is already frozen");
@@ -115,7 +120,8 @@ public class FontFamily {
    /**
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public void abortCreation() {
        if (mBuilderPtr == 0) {
            throw new IllegalStateException("This FontFamily is already frozen or abandoned");
@@ -127,7 +133,8 @@ public class FontFamily {
    /**
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public boolean addFont(String path, int ttcIndex, FontVariationAxis[] axes, int weight,
            int italic) {
        if (mBuilderPtr == 0) {
@@ -151,7 +158,8 @@ public class FontFamily {
    /**
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public boolean addFontFromBuffer(ByteBuffer font, int ttcIndex, FontVariationAxis[] axes,
            int weight, int italic) {
        if (mBuilderPtr == 0) {
@@ -179,7 +187,8 @@ public class FontFamily {
     *
     * This cannot be deleted because it's in use by AndroidX.
     */
    @UnsupportedAppUsage(trackingBug = 123768928)
    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.Q,
            publicAlternatives = "Use {@link android.graphics.fonts.FontFamily} instead.")
    public boolean addFontFromAssetManager(AssetManager mgr, String path, int cookie,
            boolean isAsset, int ttcIndex, int weight, int isItalic,
            FontVariationAxis[] axes) {