- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
268 lines
11 KiB
Java
268 lines
11 KiB
Java
package androidx.core.provider;
|
|
|
|
import android.content.Context;
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.ProviderInfo;
|
|
import android.content.res.Resources;
|
|
import android.graphics.Typeface;
|
|
import android.net.Uri;
|
|
import android.os.CancellationSignal;
|
|
import android.os.Handler;
|
|
import android.provider.BaseColumns;
|
|
import androidx.annotation.IntRange;
|
|
import androidx.annotation.NonNull;
|
|
import androidx.annotation.Nullable;
|
|
import androidx.annotation.RestrictTo;
|
|
import androidx.annotation.VisibleForTesting;
|
|
import androidx.core.content.res.ResourcesCompat;
|
|
import androidx.core.graphics.TypefaceCompat;
|
|
import androidx.core.graphics.TypefaceCompat$$ExternalSyntheticBackport2;
|
|
import androidx.core.graphics.TypefaceCompatUtil;
|
|
import androidx.core.util.Preconditions;
|
|
import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.concurrent.Executor;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class FontsContractCompat {
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public static final String PARCEL_FONT_RESULTS = "font_results";
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
static final int RESULT_CODE_PROVIDER_NOT_FOUND = -1;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
static final int RESULT_CODE_WRONG_CERTIFICATES = -2;
|
|
|
|
public static final class Columns implements BaseColumns {
|
|
public static final String FILE_ID = "file_id";
|
|
public static final String ITALIC = "font_italic";
|
|
public static final String RESULT_CODE = "result_code";
|
|
public static final int RESULT_CODE_FONT_NOT_FOUND = 1;
|
|
public static final int RESULT_CODE_FONT_UNAVAILABLE = 2;
|
|
public static final int RESULT_CODE_MALFORMED_QUERY = 3;
|
|
public static final int RESULT_CODE_OK = 0;
|
|
public static final String TTC_INDEX = "font_ttc_index";
|
|
public static final String VARIATION_SETTINGS = "font_variation_settings";
|
|
public static final String WEIGHT = "font_weight";
|
|
}
|
|
|
|
public static class FontRequestCallback {
|
|
public static final int FAIL_REASON_FONT_LOAD_ERROR = -3;
|
|
public static final int FAIL_REASON_FONT_NOT_FOUND = 1;
|
|
public static final int FAIL_REASON_FONT_UNAVAILABLE = 2;
|
|
public static final int FAIL_REASON_MALFORMED_QUERY = 3;
|
|
public static final int FAIL_REASON_PROVIDER_NOT_FOUND = -1;
|
|
public static final int FAIL_REASON_SECURITY_VIOLATION = -4;
|
|
public static final int FAIL_REASON_WRONG_CERTIFICATES = -2;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public static final int RESULT_OK = 0;
|
|
static final int RESULT_SUCCESS = 0;
|
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public @interface FontRequestFailReason {
|
|
}
|
|
|
|
public void onTypefaceRequestFailed(int i) {
|
|
}
|
|
|
|
public void onTypefaceRetrieved(Typeface typeface) {
|
|
}
|
|
}
|
|
|
|
private FontsContractCompat() {
|
|
}
|
|
|
|
@Nullable
|
|
public static Typeface buildTypeface(@NonNull Context context, @Nullable CancellationSignal cancellationSignal, @NonNull FontInfo[] fontInfoArr) {
|
|
return TypefaceCompat.createFromFontInfo(context, cancellationSignal, fontInfoArr, 0);
|
|
}
|
|
|
|
@NonNull
|
|
public static FontFamilyResult fetchFonts(@NonNull Context context, @Nullable CancellationSignal cancellationSignal, @NonNull FontRequest fontRequest) throws PackageManager.NameNotFoundException {
|
|
List m;
|
|
m = TypefaceCompat$$ExternalSyntheticBackport2.m(new Object[]{fontRequest});
|
|
return FontProvider.getFontFamilyResult(context, m, cancellationSignal);
|
|
}
|
|
|
|
@Deprecated
|
|
public static void requestFont(@NonNull Context context, @NonNull FontRequest fontRequest, @NonNull FontRequestCallback fontRequestCallback, @NonNull Handler handler) {
|
|
List m;
|
|
CallbackWrapper callbackWrapper = new CallbackWrapper(fontRequestCallback);
|
|
Executor createHandlerExecutor = RequestExecutor.createHandlerExecutor(handler);
|
|
Context applicationContext = context.getApplicationContext();
|
|
m = TypefaceCompat$$ExternalSyntheticBackport2.m(new Object[]{fontRequest});
|
|
FontRequestWorker.requestFontAsync(applicationContext, m, 0, createHandlerExecutor, callbackWrapper);
|
|
}
|
|
|
|
public static void requestFont(@NonNull Context context, @NonNull FontRequest fontRequest, int i, @Nullable Executor executor, @NonNull Executor executor2, @NonNull FontRequestCallback fontRequestCallback) {
|
|
List m;
|
|
CallbackWrapper callbackWrapper = new CallbackWrapper(fontRequestCallback, executor2);
|
|
Context applicationContext = context.getApplicationContext();
|
|
m = TypefaceCompat$$ExternalSyntheticBackport2.m(new Object[]{fontRequest});
|
|
FontRequestWorker.requestFontAsync(applicationContext, m, i, executor, callbackWrapper);
|
|
}
|
|
|
|
public static void requestFontWithFallbackChain(@NonNull Context context, @NonNull List<FontRequest> list, int i, @Nullable Executor executor, @NonNull Executor executor2, @NonNull FontRequestCallback fontRequestCallback) {
|
|
FontRequestWorker.requestFontAsync(context.getApplicationContext(), list, i, executor, new CallbackWrapper(fontRequestCallback, executor2));
|
|
}
|
|
|
|
@Nullable
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
public static Typeface requestFont(@NonNull Context context, @NonNull List<FontRequest> list, int i, boolean z, @IntRange(from = 0) int i2, @NonNull Handler handler, @NonNull FontRequestCallback fontRequestCallback) {
|
|
CallbackWrapper callbackWrapper = new CallbackWrapper(fontRequestCallback, RequestExecutor.createHandlerExecutor(handler));
|
|
if (z) {
|
|
if (list.size() > 1) {
|
|
throw new IllegalArgumentException("Fallbacks with blocking fetches are not supported for performance reasons");
|
|
}
|
|
return FontRequestWorker.requestFontSync(context, list.get(0), callbackWrapper, i, i2);
|
|
}
|
|
return FontRequestWorker.requestFontAsync(context, list, i, null, callbackWrapper);
|
|
}
|
|
|
|
@Nullable
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public static Typeface requestFont(@NonNull Context context, @NonNull FontRequest fontRequest, int i, boolean z, @IntRange(from = 0) int i2, @NonNull Handler handler, @NonNull FontRequestCallback fontRequestCallback) {
|
|
List m;
|
|
m = TypefaceCompat$$ExternalSyntheticBackport2.m(new Object[]{fontRequest});
|
|
return requestFont(context, (List<FontRequest>) m, i, z, i2, handler, fontRequestCallback);
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY})
|
|
@VisibleForTesting
|
|
public static void resetTypefaceCache() {
|
|
FontRequestWorker.resetTypefaceCache();
|
|
}
|
|
|
|
public static class FontInfo {
|
|
private final boolean mItalic;
|
|
private final int mResultCode;
|
|
private final int mTtcIndex;
|
|
private final Uri mUri;
|
|
private final int mWeight;
|
|
|
|
public int getResultCode() {
|
|
return this.mResultCode;
|
|
}
|
|
|
|
@IntRange(from = 0)
|
|
public int getTtcIndex() {
|
|
return this.mTtcIndex;
|
|
}
|
|
|
|
@NonNull
|
|
public Uri getUri() {
|
|
return this.mUri;
|
|
}
|
|
|
|
@IntRange(from = 1, to = 1000)
|
|
public int getWeight() {
|
|
return this.mWeight;
|
|
}
|
|
|
|
public boolean isItalic() {
|
|
return this.mItalic;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public FontInfo(@NonNull Uri uri, @IntRange(from = 0) int i, @IntRange(from = 1, to = 1000) int i2, boolean z, int i3) {
|
|
this.mUri = (Uri) Preconditions.checkNotNull(uri);
|
|
this.mTtcIndex = i;
|
|
this.mWeight = i2;
|
|
this.mItalic = z;
|
|
this.mResultCode = i3;
|
|
}
|
|
|
|
public static FontInfo create(@NonNull Uri uri, @IntRange(from = 0) int i, @IntRange(from = 1, to = 1000) int i2, boolean z, int i3) {
|
|
return new FontInfo(uri, i, i2, z, i3);
|
|
}
|
|
}
|
|
|
|
public static class FontFamilyResult {
|
|
public static final int STATUS_OK = 0;
|
|
public static final int STATUS_UNEXPECTED_DATA_PROVIDED = 2;
|
|
public static final int STATUS_WRONG_CERTIFICATES = 1;
|
|
private final List<FontInfo[]> mFonts;
|
|
private final int mStatusCode;
|
|
|
|
@NonNull
|
|
public List<FontInfo[]> getFontsWithFallbacks() {
|
|
return this.mFonts;
|
|
}
|
|
|
|
public int getStatusCode() {
|
|
return this.mStatusCode;
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public FontFamilyResult(int i, @Nullable FontInfo[] fontInfoArr) {
|
|
this.mStatusCode = i;
|
|
this.mFonts = Collections.singletonList(fontInfoArr);
|
|
}
|
|
|
|
public FontFamilyResult(int i, @NonNull List<FontInfo[]> list) {
|
|
this.mStatusCode = i;
|
|
this.mFonts = list;
|
|
}
|
|
|
|
public FontInfo[] getFonts() {
|
|
return this.mFonts.get(0);
|
|
}
|
|
|
|
public boolean hasFallback() {
|
|
return this.mFonts.size() > 1;
|
|
}
|
|
|
|
public static FontFamilyResult create(int i, @Nullable FontInfo[] fontInfoArr) {
|
|
return new FontFamilyResult(i, fontInfoArr);
|
|
}
|
|
|
|
public static FontFamilyResult create(int i, @Nullable List<FontInfo[]> list) {
|
|
return new FontFamilyResult(i, list);
|
|
}
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public static Typeface getFontSync(Context context, FontRequest fontRequest, @Nullable ResourcesCompat.FontCallback fontCallback, @Nullable Handler handler, boolean z, int i, int i2) {
|
|
List m;
|
|
TypefaceCompat.ResourcesCallbackAdapter resourcesCallbackAdapter = new TypefaceCompat.ResourcesCallbackAdapter(fontCallback);
|
|
Handler handler2 = ResourcesCompat.FontCallback.getHandler(handler);
|
|
m = TypefaceCompat$$ExternalSyntheticBackport2.m(new Object[]{fontRequest});
|
|
return requestFont(context, (List<FontRequest>) m, i2, z, i, handler2, resourcesCallbackAdapter);
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public static void resetCache() {
|
|
FontRequestWorker.resetTypefaceCache();
|
|
}
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
@Deprecated
|
|
public static Map<Uri, ByteBuffer> prepareFontData(Context context, FontInfo[] fontInfoArr, CancellationSignal cancellationSignal) {
|
|
return TypefaceCompatUtil.readFontInfoIntoByteBuffer(context, fontInfoArr, cancellationSignal);
|
|
}
|
|
|
|
@VisibleForTesting
|
|
@Deprecated
|
|
@Nullable
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
|
|
public static ProviderInfo getProvider(@NonNull PackageManager packageManager, @NonNull FontRequest fontRequest, @Nullable Resources resources) throws PackageManager.NameNotFoundException {
|
|
return FontProvider.getProvider(packageManager, fontRequest, resources);
|
|
}
|
|
}
|