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

Commit 05921e00 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "System font check for downloadable font" into sc-dev

parents f3284257 30900cac
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -657,6 +657,7 @@ package android {
    field @Deprecated public static final int fontProviderCerts = 16844125; // 0x101055d
    field @Deprecated public static final int fontProviderPackage = 16844119; // 0x1010557
    field @Deprecated public static final int fontProviderQuery = 16844113; // 0x1010551
    field public static final int fontProviderSystemFontFamily = 16844322; // 0x1010622
    field public static final int fontStyle = 16844095; // 0x101053f
    field public static final int fontVariationSettings = 16844144; // 0x1010570
    field public static final int fontWeight = 16844083; // 0x1010533
+17 −2
Original line number Diff line number Diff line
@@ -47,14 +47,17 @@ public class FontResourcesParser {
        private final @NonNull String mProviderAuthority;
        private final @NonNull String mProviderPackage;
        private final @NonNull String mQuery;
        private final @Nullable String mSystemFontFamilyName;
        private final @Nullable List<List<String>> mCerts;

        public ProviderResourceEntry(@NonNull String authority, @NonNull String pkg,
                @NonNull String query, @Nullable List<List<String>> certs) {
                @NonNull String query, @Nullable List<List<String>> certs,
                @Nullable String systemFontFamilyName) {
            mProviderAuthority = authority;
            mProviderPackage = pkg;
            mQuery = query;
            mCerts = certs;
            mSystemFontFamilyName = systemFontFamilyName;
        }

        public @NonNull String getAuthority() {
@@ -69,6 +72,10 @@ public class FontResourcesParser {
            return mQuery;
        }

        public @NonNull String getSystemFontFamilyName() {
            return mSystemFontFamilyName;
        }

        public @Nullable List<List<String>> getCerts() {
            return mCerts;
        }
@@ -166,6 +173,8 @@ public class FontResourcesParser {
        String providerPackage = array.getString(R.styleable.FontFamily_fontProviderPackage);
        String query = array.getString(R.styleable.FontFamily_fontProviderQuery);
        int certsId = array.getResourceId(R.styleable.FontFamily_fontProviderCerts, 0);
        String systemFontFamilyName = array.getString(
                R.styleable.FontFamily_fontProviderSystemFontFamily);
        array.recycle();
        if (authority != null && providerPackage != null && query != null) {
            while (parser.next() != XmlPullParser.END_TAG) {
@@ -191,7 +200,13 @@ public class FontResourcesParser {
                    }
                }
            }
            return new ProviderResourceEntry(authority, providerPackage, query, certs);
            return new ProviderResourceEntry(
                    authority,
                    providerPackage,
                    query,
                    certs,
                    systemFontFamilyName
            );
        }
        List<FontFileResourceEntry> fonts = new ArrayList<>();
        while (parser.next() != XmlPullParser.END_TAG) {
+6 −0
Original line number Diff line number Diff line
@@ -9276,6 +9276,12 @@
             {@deprecated Use app:fontProviderCerts with Jetpack Core library instead.}
         -->
        <attr name="fontProviderCerts" format="reference" />
        <!-- Provides the system font family name to check before downloading the font. For example
        if the fontProviderQuery asked for "Sans Serif", it is possible to define
        fontProviderSystemFontFamily as "sans-serif" to tell the system to use "sans-serif" font
        family if it exists on the system.
         -->
        <attr name="fontProviderSystemFontFamily" format="string" />
    </declare-styleable>
    <!-- Attributes that are read when parsing a  tag. -->
+1 −0
Original line number Diff line number Diff line
@@ -3058,6 +3058,7 @@
    <public name="sspSuffix" />
    <public name="pathAdvancedPattern" />
    <public name="sspAdvancedPattern" />
    <public name="fontProviderSystemFontFamily" />
  </public-group>

  <public-group type="drawable" first-id="0x010800b5">
+2 −1
Original line number Diff line number Diff line
@@ -2,5 +2,6 @@
<font-family xmlns:android="http://schemas.android.com/apk/res/android"
        android:fontProviderAuthority="com.example.test.fontprovider.authority"
        android:fontProviderPackage="com.example.test.fontprovider.package"
        android:fontProviderQuery="MyRequestedFont">
        android:fontProviderQuery="MyRequestedFont"
        android:fontProviderSystemFontFamily="my-request-font">
</font-family>
 No newline at end of file
Loading