Add decompiled APK source code (JADX)

- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-18 14:52:23 -08:00
parent cc210a65ea
commit f9d20bb3fc
26991 changed files with 2541449 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
package androidx.core.content;
import android.content.ContentProvider;
import android.content.Context;
import androidx.annotation.NonNull;
/* loaded from: classes.dex */
public final class ContentProviderCompat {
private ContentProviderCompat() {
}
@NonNull
public static Context requireContext(@NonNull ContentProvider contentProvider) {
Context context = contentProvider.getContext();
if (context != null) {
return context;
}
throw new IllegalStateException("Cannot find context from the provider.");
}
}

View File

@@ -0,0 +1,33 @@
package androidx.core.content;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.os.OperationCanceledException;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.os.CancellationSignal;
/* loaded from: classes.dex */
public final class ContentResolverCompat {
private ContentResolverCompat() {
}
@Nullable
@Deprecated
public static Cursor query(@NonNull ContentResolver contentResolver, @NonNull Uri uri, @Nullable String[] strArr, @Nullable String str, @Nullable String[] strArr2, @Nullable String str2, @Nullable CancellationSignal cancellationSignal) {
return query(contentResolver, uri, strArr, str, strArr2, str2, cancellationSignal != null ? (android.os.CancellationSignal) cancellationSignal.getCancellationSignalObject() : null);
}
@Nullable
public static Cursor query(@NonNull ContentResolver contentResolver, @NonNull Uri uri, @Nullable String[] strArr, @Nullable String str, @Nullable String[] strArr2, @Nullable String str2, @Nullable android.os.CancellationSignal cancellationSignal) {
try {
return contentResolver.query(uri, strArr, str, strArr2, str2, cancellationSignal);
} catch (Exception e) {
if (e instanceof OperationCanceledException) {
throw new androidx.core.os.OperationCanceledException();
}
throw e;
}
}
}

View File

@@ -0,0 +1,40 @@
package androidx.core.content;
import android.content.ContentValues;
import kotlin.Pair;
/* loaded from: classes.dex */
public final class ContentValuesKt {
public static final ContentValues contentValuesOf(Pair... pairArr) {
ContentValues contentValues = new ContentValues(pairArr.length);
for (Pair pair : pairArr) {
String str = (String) pair.component1();
Object component2 = pair.component2();
if (component2 == null) {
contentValues.putNull(str);
} else if (component2 instanceof String) {
contentValues.put(str, (String) component2);
} else if (component2 instanceof Integer) {
contentValues.put(str, (Integer) component2);
} else if (component2 instanceof Long) {
contentValues.put(str, (Long) component2);
} else if (component2 instanceof Boolean) {
contentValues.put(str, (Boolean) component2);
} else if (component2 instanceof Float) {
contentValues.put(str, (Float) component2);
} else if (component2 instanceof Double) {
contentValues.put(str, (Double) component2);
} else if (component2 instanceof byte[]) {
contentValues.put(str, (byte[]) component2);
} else if (component2 instanceof Byte) {
contentValues.put(str, (Byte) component2);
} else {
if (!(component2 instanceof Short)) {
throw new IllegalArgumentException("Illegal value type " + component2.getClass().getCanonicalName() + " for key \"" + str + '\"');
}
contentValues.put(str, (Short) component2);
}
}
return contentValues;
}
}

View File

@@ -0,0 +1,482 @@
package androidx.core.content;
import android.accounts.AccountManager;
import android.annotation.SuppressLint;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.AppOpsManager;
import android.app.DownloadManager;
import android.app.KeyguardManager;
import android.app.NotificationManager;
import android.app.SearchManager;
import android.app.UiModeManager;
import android.app.WallpaperManager;
import android.app.admin.DevicePolicyManager;
import android.app.job.JobScheduler;
import android.app.usage.UsageStatsManager;
import android.appwidget.AppWidgetManager;
import android.bluetooth.BluetoothManager;
import android.content.BroadcastReceiver;
import android.content.ClipboardManager;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.RestrictionsManager;
import android.content.pm.LauncherApps;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.hardware.ConsumerIrManager;
import android.hardware.SensorManager;
import android.hardware.camera2.CameraManager;
import android.hardware.display.DisplayManager;
import android.hardware.input.InputManager;
import android.hardware.usb.UsbManager;
import android.location.LocationManager;
import android.media.AudioManager;
import android.media.MediaRouter;
import android.media.projection.MediaProjectionManager;
import android.media.session.MediaSessionManager;
import android.media.tv.TvInputManager;
import android.net.ConnectivityManager;
import android.net.nsd.NsdManager;
import android.net.wifi.WifiManager;
import android.net.wifi.p2p.WifiP2pManager;
import android.nfc.NfcManager;
import android.os.BatteryManager;
import android.os.Build;
import android.os.Bundle;
import android.os.DropBoxManager;
import android.os.Handler;
import android.os.PowerManager;
import android.os.Process;
import android.os.UserManager;
import android.os.Vibrator;
import android.os.storage.StorageManager;
import android.print.PrintManager;
import android.telecom.TelecomManager;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
import android.view.LayoutInflater;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityManager;
import android.view.accessibility.CaptioningManager;
import android.view.inputmethod.InputMethodManager;
import android.view.textservice.TextServicesManager;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.ReplaceWith;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.app.LocaleManagerCompat;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.os.ConfigurationCompat;
import androidx.core.os.ExecutorCompat;
import androidx.core.os.LocaleListCompat;
import androidx.core.util.ObjectsCompat;
import com.applovin.sdk.AppLovinEventTypes;
import com.ironsource.r8;
import com.ironsource.v8;
import com.vungle.ads.internal.presenter.NativeAdPresenter;
import java.io.File;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashMap;
import java.util.concurrent.Executor;
@SuppressLint({"PrivateConstructorForUtilityClass"})
/* loaded from: classes.dex */
public class ContextCompat {
private static final String DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION_SUFFIX = ".DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION";
public static final int RECEIVER_EXPORTED = 2;
public static final int RECEIVER_NOT_EXPORTED = 4;
public static final int RECEIVER_VISIBLE_TO_INSTANT_APPS = 1;
private static final String TAG = "ContextCompat";
private static final Object sSync = new Object();
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface RegisterReceiverFlags {
}
public static boolean startActivities(@NonNull Context context, @NonNull Intent[] intentArr) {
return startActivities(context, intentArr, null);
}
public static boolean startActivities(@NonNull Context context, @NonNull Intent[] intentArr, @Nullable Bundle bundle) {
context.startActivities(intentArr, bundle);
return true;
}
@ReplaceWith(expression = "context.startActivity(intent, options)")
@Deprecated
public static void startActivity(@NonNull Context context, @NonNull Intent intent, @Nullable Bundle bundle) {
context.startActivity(intent, bundle);
}
@Nullable
public static File getDataDir(@NonNull Context context) {
return Api24Impl.getDataDir(context);
}
@NonNull
@ReplaceWith(expression = "context.getObbDirs()")
@Deprecated
public static File[] getObbDirs(@NonNull Context context) {
return context.getObbDirs();
}
@NonNull
@ReplaceWith(expression = "context.getExternalFilesDirs(type)")
@Deprecated
public static File[] getExternalFilesDirs(@NonNull Context context, @Nullable String str) {
return context.getExternalFilesDirs(str);
}
@NonNull
@ReplaceWith(expression = "context.getExternalCacheDirs()")
@Deprecated
public static File[] getExternalCacheDirs(@NonNull Context context) {
return context.getExternalCacheDirs();
}
@Nullable
public static Drawable getDrawable(@NonNull Context context, @DrawableRes int i) {
return Api21Impl.getDrawable(context, i);
}
@Nullable
public static ColorStateList getColorStateList(@NonNull Context context, @ColorRes int i) {
return ResourcesCompat.getColorStateList(context.getResources(), i, context.getTheme());
}
@ColorInt
public static int getColor(@NonNull Context context, @ColorRes int i) {
return Api23Impl.getColor(context, i);
}
public static int checkSelfPermission(@NonNull Context context, @NonNull String str) {
ObjectsCompat.requireNonNull(str, "permission must be non-null");
if (Build.VERSION.SDK_INT >= 33 || !TextUtils.equals("android.permission.POST_NOTIFICATIONS", str)) {
return context.checkPermission(str, Process.myPid(), Process.myUid());
}
return NotificationManagerCompat.from(context).areNotificationsEnabled() ? 0 : -1;
}
@Nullable
public static File getNoBackupFilesDir(@NonNull Context context) {
return Api21Impl.getNoBackupFilesDir(context);
}
@NonNull
public static File getCodeCacheDir(@NonNull Context context) {
return Api21Impl.getCodeCacheDir(context);
}
private static File createFilesDir(File file) {
synchronized (sSync) {
try {
if (!file.exists()) {
if (file.mkdirs()) {
return file;
}
Log.w(TAG, "Unable to create files subdir " + file.getPath());
}
return file;
} catch (Throwable th) {
throw th;
}
}
}
@Nullable
public static Context createDeviceProtectedStorageContext(@NonNull Context context) {
return Api24Impl.createDeviceProtectedStorageContext(context);
}
public static boolean isDeviceProtectedStorage(@NonNull Context context) {
return Api24Impl.isDeviceProtectedStorage(context);
}
@NonNull
public static Executor getMainExecutor(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 28) {
return Api28Impl.getMainExecutor(context);
}
return ExecutorCompat.create(new Handler(context.getMainLooper()));
}
public static void startForegroundService(@NonNull Context context, @NonNull Intent intent) {
Api26Impl.startForegroundService(context, intent);
}
@NonNull
public static Display getDisplayOrDefault(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 30) {
return Api30Impl.getDisplayOrDefault(context);
}
return ((WindowManager) context.getSystemService("window")).getDefaultDisplay();
}
@Nullable
public static <T> T getSystemService(@NonNull Context context, @NonNull Class<T> cls) {
return (T) Api23Impl.getSystemService(context, cls);
}
@Nullable
public static Intent registerReceiver(@NonNull Context context, @Nullable BroadcastReceiver broadcastReceiver, @NonNull IntentFilter intentFilter, int i) {
return registerReceiver(context, broadcastReceiver, intentFilter, null, null, i);
}
@Nullable
public static Intent registerReceiver(@NonNull Context context, @Nullable BroadcastReceiver broadcastReceiver, @NonNull IntentFilter intentFilter, @Nullable String str, @Nullable Handler handler, int i) {
int i2 = i & 1;
if (i2 != 0 && (i & 4) != 0) {
throw new IllegalArgumentException("Cannot specify both RECEIVER_VISIBLE_TO_INSTANT_APPS and RECEIVER_NOT_EXPORTED");
}
if (i2 != 0) {
i |= 2;
}
int i3 = i;
int i4 = i3 & 2;
if (i4 == 0 && (i3 & 4) == 0) {
throw new IllegalArgumentException("One of either RECEIVER_EXPORTED or RECEIVER_NOT_EXPORTED is required");
}
if (i4 != 0 && (i3 & 4) != 0) {
throw new IllegalArgumentException("Cannot specify both RECEIVER_EXPORTED and RECEIVER_NOT_EXPORTED");
}
if (Build.VERSION.SDK_INT >= 33) {
return Api33Impl.registerReceiver(context, broadcastReceiver, intentFilter, str, handler, i3);
}
return Api26Impl.registerReceiver(context, broadcastReceiver, intentFilter, str, handler, i3);
}
@Nullable
public static String getSystemServiceName(@NonNull Context context, @NonNull Class<?> cls) {
return Api23Impl.getSystemServiceName(context, cls);
}
@NonNull
public static String getString(@NonNull Context context, int i) {
return getContextForLanguage(context).getString(i);
}
@NonNull
public static Context getContextForLanguage(@NonNull Context context) {
LocaleListCompat applicationLocales = LocaleManagerCompat.getApplicationLocales(context);
if (Build.VERSION.SDK_INT > 32 || applicationLocales.isEmpty()) {
return context;
}
Configuration configuration = new Configuration(context.getResources().getConfiguration());
ConfigurationCompat.setLocales(configuration, applicationLocales);
return context.createConfigurationContext(configuration);
}
@Nullable
public static String getAttributionTag(@NonNull Context context) {
if (Build.VERSION.SDK_INT >= 30) {
return Api30Impl.getAttributionTag(context);
}
return null;
}
@NonNull
public static Context createAttributionContext(@NonNull Context context, @Nullable String str) {
return Build.VERSION.SDK_INT >= 30 ? Api30Impl.createAttributionContext(context, str) : context;
}
public static String obtainAndCheckReceiverPermission(Context context) {
String str = context.getPackageName() + DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION_SUFFIX;
if (PermissionChecker.checkSelfPermission(context, str) == 0) {
return str;
}
throw new RuntimeException("Permission " + str + " is required by your application to receive broadcasts, please add it to your manifest");
}
public static final class LegacyServiceMapHolder {
static final HashMap<Class<?>, String> SERVICES;
private LegacyServiceMapHolder() {
}
static {
HashMap<Class<?>, String> hashMap = new HashMap<>();
SERVICES = hashMap;
hashMap.put(SubscriptionManager.class, "telephony_subscription_service");
hashMap.put(UsageStatsManager.class, "usagestats");
hashMap.put(AppWidgetManager.class, "appwidget");
hashMap.put(BatteryManager.class, "batterymanager");
hashMap.put(CameraManager.class, "camera");
hashMap.put(JobScheduler.class, "jobscheduler");
hashMap.put(LauncherApps.class, "launcherapps");
hashMap.put(MediaProjectionManager.class, "media_projection");
hashMap.put(MediaSessionManager.class, "media_session");
hashMap.put(RestrictionsManager.class, "restrictions");
hashMap.put(TelecomManager.class, "telecom");
hashMap.put(TvInputManager.class, "tv_input");
hashMap.put(AppOpsManager.class, "appops");
hashMap.put(CaptioningManager.class, "captioning");
hashMap.put(ConsumerIrManager.class, "consumer_ir");
hashMap.put(PrintManager.class, "print");
hashMap.put(BluetoothManager.class, r8.d);
hashMap.put(DisplayManager.class, "display");
hashMap.put(UserManager.class, "user");
hashMap.put(InputManager.class, "input");
hashMap.put(MediaRouter.class, "media_router");
hashMap.put(NsdManager.class, "servicediscovery");
hashMap.put(AccessibilityManager.class, "accessibility");
hashMap.put(AccountManager.class, "account");
hashMap.put(ActivityManager.class, "activity");
hashMap.put(AlarmManager.class, NotificationCompat.CATEGORY_ALARM);
hashMap.put(AudioManager.class, "audio");
hashMap.put(ClipboardManager.class, "clipboard");
hashMap.put(ConnectivityManager.class, "connectivity");
hashMap.put(DevicePolicyManager.class, "device_policy");
hashMap.put(DownloadManager.class, NativeAdPresenter.DOWNLOAD);
hashMap.put(DropBoxManager.class, "dropbox");
hashMap.put(InputMethodManager.class, "input_method");
hashMap.put(KeyguardManager.class, "keyguard");
hashMap.put(LayoutInflater.class, "layout_inflater");
hashMap.put(LocationManager.class, "location");
hashMap.put(NfcManager.class, "nfc");
hashMap.put(NotificationManager.class, "notification");
hashMap.put(PowerManager.class, "power");
hashMap.put(SearchManager.class, AppLovinEventTypes.USER_EXECUTED_SEARCH);
hashMap.put(SensorManager.class, "sensor");
hashMap.put(StorageManager.class, v8.a.j);
hashMap.put(TelephonyManager.class, "phone");
hashMap.put(TextServicesManager.class, "textservices");
hashMap.put(UiModeManager.class, "uimode");
hashMap.put(UsbManager.class, "usb");
hashMap.put(Vibrator.class, "vibrator");
hashMap.put(WallpaperManager.class, "wallpaper");
hashMap.put(WifiP2pManager.class, "wifip2p");
hashMap.put(WifiManager.class, "wifi");
hashMap.put(WindowManager.class, "window");
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static Drawable getDrawable(Context context, int i) {
return context.getDrawable(i);
}
public static File getNoBackupFilesDir(Context context) {
return context.getNoBackupFilesDir();
}
public static File getCodeCacheDir(Context context) {
return context.getCodeCacheDir();
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
public static int getColor(Context context, int i) {
return context.getColor(i);
}
public static <T> T getSystemService(Context context, Class<T> cls) {
return (T) context.getSystemService(cls);
}
public static String getSystemServiceName(Context context, Class<?> cls) {
return context.getSystemServiceName(cls);
}
}
@RequiresApi(24)
public static class Api24Impl {
private Api24Impl() {
}
public static File getDataDir(Context context) {
return context.getDataDir();
}
public static Context createDeviceProtectedStorageContext(Context context) {
return context.createDeviceProtectedStorageContext();
}
public static boolean isDeviceProtectedStorage(Context context) {
return context.isDeviceProtectedStorage();
}
}
@RequiresApi(26)
public static class Api26Impl {
private Api26Impl() {
}
public static Intent registerReceiver(Context context, @Nullable BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, String str, Handler handler, int i) {
if ((i & 4) != 0 && str == null) {
return context.registerReceiver(broadcastReceiver, intentFilter, ContextCompat.obtainAndCheckReceiverPermission(context), handler);
}
return context.registerReceiver(broadcastReceiver, intentFilter, str, handler, i & 1);
}
public static ComponentName startForegroundService(Context context, Intent intent) {
return context.startForegroundService(intent);
}
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static Executor getMainExecutor(Context context) {
return context.getMainExecutor();
}
}
@RequiresApi(30)
public static class Api30Impl {
private Api30Impl() {
}
public static String getAttributionTag(Context context) {
return context.getAttributionTag();
}
public static Display getDisplayOrDefault(Context context) {
try {
return context.getDisplay();
} catch (UnsupportedOperationException unused) {
Log.w(ContextCompat.TAG, "The context:" + context + " is not associated with any display. Return a fallback display instead.");
return ((DisplayManager) context.getSystemService(DisplayManager.class)).getDisplay(0);
}
}
@NonNull
public static Context createAttributionContext(@NonNull Context context, @Nullable String str) {
return context.createAttributionContext(str);
}
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
public static Intent registerReceiver(Context context, @Nullable BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, String str, Handler handler, int i) {
return context.registerReceiver(broadcastReceiver, intentFilter, str, handler, i);
}
}
}

View File

@@ -0,0 +1,45 @@
package androidx.core.content;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import androidx.annotation.AttrRes;
import androidx.annotation.StyleRes;
import com.google.android.gms.ads.RequestConfiguration;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes.dex */
public final class ContextKt {
public static final /* synthetic */ <T> T getSystemService(Context context) {
Intrinsics.reifiedOperationMarker(4, RequestConfiguration.MAX_AD_CONTENT_RATING_T);
return (T) ContextCompat.getSystemService(context, Object.class);
}
public static final void withStyledAttributes(Context context, AttributeSet attributeSet, int[] iArr, @AttrRes int i, @StyleRes int i2, Function1 function1) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i, i2);
function1.invoke(obtainStyledAttributes);
obtainStyledAttributes.recycle();
}
public static /* synthetic */ void withStyledAttributes$default(Context context, AttributeSet attributeSet, int[] iArr, int i, int i2, Function1 function1, int i3, Object obj) {
if ((i3 & 1) != 0) {
attributeSet = null;
}
if ((i3 & 4) != 0) {
i = 0;
}
if ((i3 & 8) != 0) {
i2 = 0;
}
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, iArr, i, i2);
function1.invoke(obtainStyledAttributes);
obtainStyledAttributes.recycle();
}
public static final void withStyledAttributes(Context context, @StyleRes int i, int[] iArr, Function1 function1) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(i, iArr);
function1.invoke(obtainStyledAttributes);
obtainStyledAttributes.recycle();
}
}

View File

@@ -0,0 +1,421 @@
package androidx.core.content;
import android.annotation.SuppressLint;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.content.Context;
import android.content.pm.ProviderInfo;
import android.content.res.XmlResourceParser;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.text.TextUtils;
import android.webkit.MimeTypeMap;
import androidx.annotation.CallSuper;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.XmlRes;
import androidx.core.util.ObjectsCompat;
import com.google.android.gms.drive.DriveFile;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import org.xmlpull.v1.XmlPullParserException;
/* loaded from: classes.dex */
public class FileProvider extends ContentProvider {
private static final String ATTR_NAME = "name";
private static final String ATTR_PATH = "path";
private static final String DISPLAYNAME_FIELD = "displayName";
private static final String META_DATA_FILE_PROVIDER_PATHS = "android.support.FILE_PROVIDER_PATHS";
private static final String TAG_CACHE_PATH = "cache-path";
private static final String TAG_EXTERNAL = "external-path";
private static final String TAG_EXTERNAL_CACHE = "external-cache-path";
private static final String TAG_EXTERNAL_FILES = "external-files-path";
private static final String TAG_EXTERNAL_MEDIA = "external-media-path";
private static final String TAG_FILES_PATH = "files-path";
private static final String TAG_ROOT_PATH = "root-path";
@GuardedBy("mLock")
private String mAuthority;
@Nullable
@GuardedBy("mLock")
private PathStrategy mLocalPathStrategy;
@NonNull
private final Object mLock;
private final int mResourceId;
private static final String[] COLUMNS = {"_display_name", "_size"};
private static final File DEVICE_ROOT = new File("/");
@GuardedBy("sCache")
private static final HashMap<String, PathStrategy> sCache = new HashMap<>();
public interface PathStrategy {
File getFileForUri(Uri uri);
Uri getUriForFile(File file);
}
@Override // android.content.ContentProvider
@Nullable
public String getTypeAnonymous(@NonNull Uri uri) {
return "application/octet-stream";
}
@Override // android.content.ContentProvider
public boolean onCreate() {
return true;
}
public FileProvider() {
this(0);
}
public FileProvider(@XmlRes int i) {
this.mLock = new Object();
this.mResourceId = i;
}
@Override // android.content.ContentProvider
@CallSuper
public void attachInfo(@NonNull Context context, @NonNull ProviderInfo providerInfo) {
super.attachInfo(context, providerInfo);
if (providerInfo.exported) {
throw new SecurityException("Provider must not be exported");
}
if (!providerInfo.grantUriPermissions) {
throw new SecurityException("Provider must grant uri permissions");
}
String str = providerInfo.authority.split(";")[0];
synchronized (this.mLock) {
this.mAuthority = str;
}
HashMap<String, PathStrategy> hashMap = sCache;
synchronized (hashMap) {
hashMap.remove(str);
}
}
public static Uri getUriForFile(@NonNull Context context, @NonNull String str, @NonNull File file) {
return getPathStrategy(context, str, 0).getUriForFile(file);
}
@NonNull
@SuppressLint({"StreamFiles"})
public static Uri getUriForFile(@NonNull Context context, @NonNull String str, @NonNull File file, @NonNull String str2) {
return getUriForFile(context, str, file).buildUpon().appendQueryParameter(DISPLAYNAME_FIELD, str2).build();
}
@Override // android.content.ContentProvider
@NonNull
public Cursor query(@NonNull Uri uri, @Nullable String[] strArr, @Nullable String str, @Nullable String[] strArr2, @Nullable String str2) {
int i;
File fileForUri = getLocalPathStrategy().getFileForUri(uri);
String queryParameter = uri.getQueryParameter(DISPLAYNAME_FIELD);
if (strArr == null) {
strArr = COLUMNS;
}
String[] strArr3 = new String[strArr.length];
Object[] objArr = new Object[strArr.length];
int i2 = 0;
for (String str3 : strArr) {
if ("_display_name".equals(str3)) {
strArr3[i2] = "_display_name";
i = i2 + 1;
objArr[i2] = queryParameter == null ? fileForUri.getName() : queryParameter;
} else if ("_size".equals(str3)) {
strArr3[i2] = "_size";
i = i2 + 1;
objArr[i2] = Long.valueOf(fileForUri.length());
}
i2 = i;
}
String[] copyOf = copyOf(strArr3, i2);
Object[] copyOf2 = copyOf(objArr, i2);
MatrixCursor matrixCursor = new MatrixCursor(copyOf, 1);
matrixCursor.addRow(copyOf2);
return matrixCursor;
}
@Override // android.content.ContentProvider
@Nullable
public String getType(@NonNull Uri uri) {
File fileForUri = getLocalPathStrategy().getFileForUri(uri);
int lastIndexOf = fileForUri.getName().lastIndexOf(46);
if (lastIndexOf < 0) {
return "application/octet-stream";
}
String mimeTypeFromExtension = MimeTypeMap.getSingleton().getMimeTypeFromExtension(fileForUri.getName().substring(lastIndexOf + 1));
return mimeTypeFromExtension != null ? mimeTypeFromExtension : "application/octet-stream";
}
@Override // android.content.ContentProvider
public Uri insert(@NonNull Uri uri, @NonNull ContentValues contentValues) {
throw new UnsupportedOperationException("No external inserts");
}
@Override // android.content.ContentProvider
public int update(@NonNull Uri uri, @NonNull ContentValues contentValues, @Nullable String str, @Nullable String[] strArr) {
throw new UnsupportedOperationException("No external updates");
}
@Override // android.content.ContentProvider
public int delete(@NonNull Uri uri, @Nullable String str, @Nullable String[] strArr) {
return getLocalPathStrategy().getFileForUri(uri).delete() ? 1 : 0;
}
@Override // android.content.ContentProvider
@SuppressLint({"UnknownNullness"})
public ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String str) throws FileNotFoundException {
return ParcelFileDescriptor.open(getLocalPathStrategy().getFileForUri(uri), modeToMode(str));
}
@NonNull
private PathStrategy getLocalPathStrategy() {
PathStrategy pathStrategy;
synchronized (this.mLock) {
try {
ObjectsCompat.requireNonNull(this.mAuthority, "mAuthority is null. Did you override attachInfo and did not call super.attachInfo()?");
if (this.mLocalPathStrategy == null) {
this.mLocalPathStrategy = getPathStrategy(getContext(), this.mAuthority, this.mResourceId);
}
pathStrategy = this.mLocalPathStrategy;
} catch (Throwable th) {
throw th;
}
}
return pathStrategy;
}
private static PathStrategy getPathStrategy(Context context, String str, int i) {
PathStrategy pathStrategy;
HashMap<String, PathStrategy> hashMap = sCache;
synchronized (hashMap) {
try {
pathStrategy = hashMap.get(str);
if (pathStrategy == null) {
try {
try {
pathStrategy = parsePathStrategy(context, str, i);
hashMap.put(str, pathStrategy);
} catch (IOException e) {
throw new IllegalArgumentException("Failed to parse android.support.FILE_PROVIDER_PATHS meta-data", e);
}
} catch (XmlPullParserException e2) {
throw new IllegalArgumentException("Failed to parse android.support.FILE_PROVIDER_PATHS meta-data", e2);
}
}
} catch (Throwable th) {
throw th;
}
}
return pathStrategy;
}
@VisibleForTesting
public static XmlResourceParser getFileProviderPathsMetaData(Context context, String str, @Nullable ProviderInfo providerInfo, int i) {
if (providerInfo == null) {
throw new IllegalArgumentException("Couldn't find meta-data for provider with authority " + str);
}
if (providerInfo.metaData == null && i != 0) {
Bundle bundle = new Bundle(1);
providerInfo.metaData = bundle;
bundle.putInt(META_DATA_FILE_PROVIDER_PATHS, i);
}
XmlResourceParser loadXmlMetaData = providerInfo.loadXmlMetaData(context.getPackageManager(), META_DATA_FILE_PROVIDER_PATHS);
if (loadXmlMetaData != null) {
return loadXmlMetaData;
}
throw new IllegalArgumentException("Missing android.support.FILE_PROVIDER_PATHS meta-data");
}
private static PathStrategy parsePathStrategy(Context context, String str, int i) throws IOException, XmlPullParserException {
SimplePathStrategy simplePathStrategy = new SimplePathStrategy(str);
XmlResourceParser fileProviderPathsMetaData = getFileProviderPathsMetaData(context, str, context.getPackageManager().resolveContentProvider(str, 128), i);
while (true) {
int next = fileProviderPathsMetaData.next();
if (next == 1) {
return simplePathStrategy;
}
if (next == 2) {
String name = fileProviderPathsMetaData.getName();
File file = null;
String attributeValue = fileProviderPathsMetaData.getAttributeValue(null, "name");
String attributeValue2 = fileProviderPathsMetaData.getAttributeValue(null, "path");
if (TAG_ROOT_PATH.equals(name)) {
file = DEVICE_ROOT;
} else if (TAG_FILES_PATH.equals(name)) {
file = context.getFilesDir();
} else if (TAG_CACHE_PATH.equals(name)) {
file = context.getCacheDir();
} else if (TAG_EXTERNAL.equals(name)) {
file = Environment.getExternalStorageDirectory();
} else if (TAG_EXTERNAL_FILES.equals(name)) {
File[] externalFilesDirs = ContextCompat.getExternalFilesDirs(context, null);
if (externalFilesDirs.length > 0) {
file = externalFilesDirs[0];
}
} else if (TAG_EXTERNAL_CACHE.equals(name)) {
File[] externalCacheDirs = ContextCompat.getExternalCacheDirs(context);
if (externalCacheDirs.length > 0) {
file = externalCacheDirs[0];
}
} else if (TAG_EXTERNAL_MEDIA.equals(name)) {
File[] externalMediaDirs = Api21Impl.getExternalMediaDirs(context);
if (externalMediaDirs.length > 0) {
file = externalMediaDirs[0];
}
}
if (file != null) {
simplePathStrategy.addRoot(attributeValue, buildPath(file, attributeValue2));
}
}
}
}
public static class SimplePathStrategy implements PathStrategy {
private final String mAuthority;
private final HashMap<String, File> mRoots = new HashMap<>();
public SimplePathStrategy(String str) {
this.mAuthority = str;
}
public void addRoot(String str, File file) {
if (TextUtils.isEmpty(str)) {
throw new IllegalArgumentException("Name must not be empty");
}
try {
this.mRoots.put(str, file.getCanonicalFile());
} catch (IOException e) {
throw new IllegalArgumentException("Failed to resolve canonical path for " + file, e);
}
}
@Override // androidx.core.content.FileProvider.PathStrategy
public Uri getUriForFile(File file) {
String substring;
try {
String canonicalPath = file.getCanonicalPath();
Map.Entry<String, File> entry = null;
for (Map.Entry<String, File> entry2 : this.mRoots.entrySet()) {
String path = entry2.getValue().getPath();
if (belongsToRoot(canonicalPath, path) && (entry == null || path.length() > entry.getValue().getPath().length())) {
entry = entry2;
}
}
if (entry == null) {
throw new IllegalArgumentException("Failed to find configured root that contains " + canonicalPath);
}
String path2 = entry.getValue().getPath();
if (path2.endsWith("/")) {
substring = canonicalPath.substring(path2.length());
} else {
substring = canonicalPath.substring(path2.length() + 1);
}
return new Uri.Builder().scheme("content").authority(this.mAuthority).encodedPath(Uri.encode(entry.getKey()) + '/' + Uri.encode(substring, "/")).build();
} catch (IOException unused) {
throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
}
}
@Override // androidx.core.content.FileProvider.PathStrategy
public File getFileForUri(Uri uri) {
String encodedPath = uri.getEncodedPath();
int indexOf = encodedPath.indexOf(47, 1);
String decode = Uri.decode(encodedPath.substring(1, indexOf));
String decode2 = Uri.decode(encodedPath.substring(indexOf + 1));
File file = this.mRoots.get(decode);
if (file == null) {
throw new IllegalArgumentException("Unable to find configured root for " + uri);
}
File file2 = new File(file, decode2);
try {
File canonicalFile = file2.getCanonicalFile();
if (belongsToRoot(canonicalFile.getPath(), file.getPath())) {
return canonicalFile;
}
throw new SecurityException("Resolved path jumped beyond configured root");
} catch (IOException unused) {
throw new IllegalArgumentException("Failed to resolve canonical path for " + file2);
}
}
private boolean belongsToRoot(@NonNull String str, @NonNull String str2) {
String removeTrailingSlash = FileProvider.removeTrailingSlash(str);
String removeTrailingSlash2 = FileProvider.removeTrailingSlash(str2);
if (!removeTrailingSlash.equals(removeTrailingSlash2)) {
if (!removeTrailingSlash.startsWith(removeTrailingSlash2 + '/')) {
return false;
}
}
return true;
}
}
private static int modeToMode(String str) {
if ("r".equals(str)) {
return DriveFile.MODE_READ_ONLY;
}
if ("w".equals(str) || "wt".equals(str)) {
return 738197504;
}
if ("wa".equals(str)) {
return 704643072;
}
if ("rw".equals(str)) {
return 939524096;
}
if ("rwt".equals(str)) {
return 1006632960;
}
throw new IllegalArgumentException("Invalid mode: " + str);
}
private static File buildPath(File file, String... strArr) {
for (String str : strArr) {
if (str != null) {
file = new File(file, str);
}
}
return file;
}
private static String[] copyOf(String[] strArr, int i) {
String[] strArr2 = new String[i];
System.arraycopy(strArr, 0, strArr2, 0, i);
return strArr2;
}
private static Object[] copyOf(Object[] objArr, int i) {
Object[] objArr2 = new Object[i];
System.arraycopy(objArr, 0, objArr2, 0, i);
return objArr2;
}
/* JADX INFO: Access modifiers changed from: private */
@NonNull
public static String removeTrailingSlash(@NonNull String str) {
return (str.length() <= 0 || str.charAt(str.length() + (-1)) != '/') ? str : str.substring(0, str.length() - 1);
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static File[] getExternalMediaDirs(Context context) {
return context.getExternalMediaDirs();
}
}
}

View File

@@ -0,0 +1,112 @@
package androidx.core.content;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.util.Preconditions;
import java.io.Serializable;
import java.util.ArrayList;
/* loaded from: classes.dex */
public final class IntentCompat {
@SuppressLint({"ActionValue"})
public static final String ACTION_CREATE_REMINDER = "android.intent.action.CREATE_REMINDER";
public static final String CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER";
public static final String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT";
public static final String EXTRA_START_PLAYBACK = "android.intent.extra.START_PLAYBACK";
@SuppressLint({"ActionValue"})
public static final String EXTRA_TIME = "android.intent.extra.TIME";
private IntentCompat() {
}
@NonNull
public static Intent makeMainSelectorActivity(@NonNull String str, @NonNull String str2) {
return Intent.makeMainSelectorActivity(str, str2);
}
@NonNull
public static Intent createManageUnusedAppRestrictionsIntent(@NonNull Context context, @NonNull String str) {
if (!PackageManagerCompat.areUnusedAppRestrictionsAvailable(context.getPackageManager())) {
throw new UnsupportedOperationException("Unused App Restriction features are not available on this device");
}
int i = Build.VERSION.SDK_INT;
if (i >= 31) {
return new Intent("android.settings.APPLICATION_DETAILS_SETTINGS").setData(Uri.fromParts("package", str, null));
}
Intent data = new Intent(PackageManagerCompat.ACTION_PERMISSION_REVOCATION_SETTINGS).setData(Uri.fromParts("package", str, null));
return i >= 30 ? data : data.setPackage((String) Preconditions.checkNotNull(PackageManagerCompat.getPermissionRevocationVerifierApp(context.getPackageManager())));
}
@Nullable
public static <T> T getParcelableExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<T> cls) {
if (Build.VERSION.SDK_INT >= 34) {
return (T) Api33Impl.getParcelableExtra(intent, str, cls);
}
T t = (T) intent.getParcelableExtra(str);
if (cls.isInstance(t)) {
return t;
}
return null;
}
@Nullable
@SuppressLint({"ArrayReturn", "NullableCollection"})
public static Parcelable[] getParcelableArrayExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<? extends Parcelable> cls) {
if (Build.VERSION.SDK_INT >= 34) {
return (Parcelable[]) Api33Impl.getParcelableArrayExtra(intent, str, cls);
}
return intent.getParcelableArrayExtra(str);
}
@Nullable
@SuppressLint({"ConcreteCollection", "NullableCollection"})
public static <T> ArrayList<T> getParcelableArrayListExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<? extends T> cls) {
if (Build.VERSION.SDK_INT >= 34) {
return Api33Impl.getParcelableArrayListExtra(intent, str, cls);
}
return intent.getParcelableArrayListExtra(str);
}
@Nullable
public static <T extends Serializable> T getSerializableExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<T> cls) {
if (Build.VERSION.SDK_INT >= 34) {
return (T) Api33Impl.getSerializableExtra(intent, str, cls);
}
T t = (T) intent.getSerializableExtra(str);
if (cls.isInstance(t)) {
return t;
}
return null;
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
public static <T> T getParcelableExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<T> cls) {
return (T) intent.getParcelableExtra(str, cls);
}
public static <T> T[] getParcelableArrayExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<T> cls) {
return (T[]) intent.getParcelableArrayExtra(str, cls);
}
public static <T> ArrayList<T> getParcelableArrayListExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<? extends T> cls) {
return intent.getParcelableArrayListExtra(str, cls);
}
public static <T extends Serializable> T getSerializableExtra(@NonNull Intent intent, @Nullable String str, @NonNull Class<T> cls) {
return (T) intent.getSerializableExtra(str, cls);
}
}
}

View File

@@ -0,0 +1,13 @@
package androidx.core.content;
import androidx.core.util.Predicate;
/* loaded from: classes.dex */
public final /* synthetic */ class IntentSanitizer$Builder$$ExternalSyntheticLambda11 implements Predicate {
public final /* synthetic */ String f$0;
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
return this.f$0.equals((String) obj);
}
}

View File

@@ -0,0 +1,832 @@
package androidx.core.content;
import android.annotation.SuppressLint;
import android.content.ClipData;
import android.content.ComponentName;
import android.content.Intent;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.core.content.IntentSanitizer;
import androidx.core.util.Consumer;
import androidx.core.util.Preconditions;
import androidx.core.util.Predicate;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
/* loaded from: classes.dex */
public class IntentSanitizer {
private static final String TAG = "IntentSanitizer";
private boolean mAllowAnyComponent;
private boolean mAllowClipDataText;
private boolean mAllowIdentifier;
private boolean mAllowSelector;
private boolean mAllowSourceBounds;
private Predicate<String> mAllowedActions;
private Predicate<String> mAllowedCategories;
private Predicate<ClipData> mAllowedClipData;
private Predicate<Uri> mAllowedClipDataUri;
private Predicate<ComponentName> mAllowedComponents;
private Predicate<Uri> mAllowedData;
private Map<String, Predicate<Object>> mAllowedExtras;
private int mAllowedFlags;
private Predicate<String> mAllowedPackages;
private Predicate<String> mAllowedTypes;
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$sanitizeByFiltering$0(String str) {
}
private IntentSanitizer() {
}
@NonNull
public Intent sanitizeByFiltering(@NonNull Intent intent) {
return sanitize(intent, new Consumer() { // from class: androidx.core.content.IntentSanitizer$$ExternalSyntheticLambda0
@Override // androidx.core.util.Consumer
public final void accept(Object obj) {
IntentSanitizer.lambda$sanitizeByFiltering$0((String) obj);
}
});
}
@NonNull
public Intent sanitizeByThrowing(@NonNull Intent intent) {
return sanitize(intent, new Consumer() { // from class: androidx.core.content.IntentSanitizer$$ExternalSyntheticLambda1
@Override // androidx.core.util.Consumer
public final void accept(Object obj) {
IntentSanitizer.lambda$sanitizeByThrowing$1((String) obj);
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void lambda$sanitizeByThrowing$1(String str) {
throw new SecurityException(str);
}
@NonNull
public Intent sanitize(@NonNull Intent intent, @NonNull Consumer<String> consumer) {
Intent intent2 = new Intent();
ComponentName component = intent.getComponent();
if ((this.mAllowAnyComponent && component == null) || this.mAllowedComponents.test(component)) {
intent2.setComponent(component);
} else {
consumer.accept("Component is not allowed: " + component);
intent2.setComponent(new ComponentName("android", "java.lang.Void"));
}
String str = intent.getPackage();
if (str == null || this.mAllowedPackages.test(str)) {
intent2.setPackage(str);
} else {
consumer.accept("Package is not allowed: " + str);
}
int flags = this.mAllowedFlags | intent.getFlags();
int i = this.mAllowedFlags;
if (flags == i) {
intent2.setFlags(intent.getFlags());
} else {
intent2.setFlags(intent.getFlags() & i);
consumer.accept("The intent contains flags that are not allowed: 0x" + Integer.toHexString(intent.getFlags() & (~this.mAllowedFlags)));
}
String action = intent.getAction();
if (action == null || this.mAllowedActions.test(action)) {
intent2.setAction(action);
} else {
consumer.accept("Action is not allowed: " + action);
}
Uri data = intent.getData();
if (data == null || this.mAllowedData.test(data)) {
intent2.setData(data);
} else {
consumer.accept("Data is not allowed: " + data);
}
String type = intent.getType();
if (type == null || this.mAllowedTypes.test(type)) {
intent2.setDataAndType(intent2.getData(), type);
} else {
consumer.accept("Type is not allowed: " + type);
}
Set<String> categories = intent.getCategories();
if (categories != null) {
for (String str2 : categories) {
if (this.mAllowedCategories.test(str2)) {
intent2.addCategory(str2);
} else {
consumer.accept("Category is not allowed: " + str2);
}
}
}
Bundle extras = intent.getExtras();
if (extras != null) {
for (String str3 : extras.keySet()) {
if (str3.equals("android.intent.extra.STREAM") && (this.mAllowedFlags & 1) == 0) {
consumer.accept("Allowing Extra Stream requires also allowing at least FLAG_GRANT_READ_URI_PERMISSION Flag.");
} else if (str3.equals("output") && ((~this.mAllowedFlags) & 3) != 0) {
consumer.accept("Allowing Extra Output requires also allowing FLAG_GRANT_READ_URI_PERMISSION and FLAG_GRANT_WRITE_URI_PERMISSION Flags.");
} else {
Object obj = extras.get(str3);
Predicate<Object> predicate = this.mAllowedExtras.get(str3);
if (predicate != null && predicate.test(obj)) {
putExtra(intent2, str3, obj);
} else {
consumer.accept("Extra is not allowed. Key: " + str3 + ". Value: " + obj);
}
}
}
}
sanitizeClipData(intent, intent2, this.mAllowedClipData, this.mAllowClipDataText, this.mAllowedClipDataUri, consumer);
if (Build.VERSION.SDK_INT >= 29) {
if (this.mAllowIdentifier) {
Api29Impl.setIdentifier(intent2, Api29Impl.getIdentifier(intent));
} else if (Api29Impl.getIdentifier(intent) != null) {
consumer.accept("Identifier is not allowed: " + Api29Impl.getIdentifier(intent));
}
}
if (this.mAllowSelector) {
intent2.setSelector(intent.getSelector());
} else if (intent.getSelector() != null) {
consumer.accept("Selector is not allowed: " + intent.getSelector());
}
if (this.mAllowSourceBounds) {
intent2.setSourceBounds(intent.getSourceBounds());
} else if (intent.getSourceBounds() != null) {
consumer.accept("SourceBounds is not allowed: " + intent.getSourceBounds());
}
return intent2;
}
private void putExtra(Intent intent, String str, Object obj) {
if (obj == null) {
intent.getExtras().putString(str, null);
return;
}
if (obj instanceof Parcelable) {
intent.putExtra(str, (Parcelable) obj);
return;
}
if (obj instanceof Parcelable[]) {
intent.putExtra(str, (Parcelable[]) obj);
} else {
if (obj instanceof Serializable) {
intent.putExtra(str, (Serializable) obj);
return;
}
throw new IllegalArgumentException("Unsupported type " + obj.getClass());
}
}
public static final class Builder {
private static final int HISTORY_STACK_FLAGS = 2112614400;
private static final int RECEIVER_FLAGS = 2015363072;
private boolean mAllowAnyComponent;
private boolean mAllowIdentifier;
private boolean mAllowSelector;
private boolean mAllowSomeComponents;
private boolean mAllowSourceBounds;
private int mAllowedFlags;
private Predicate<String> mAllowedActions = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda2
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$0;
lambda$new$0 = IntentSanitizer.Builder.lambda$new$0((String) obj);
return lambda$new$0;
}
};
private Predicate<Uri> mAllowedData = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda3
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$1;
lambda$new$1 = IntentSanitizer.Builder.lambda$new$1((Uri) obj);
return lambda$new$1;
}
};
private Predicate<String> mAllowedTypes = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda4
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$2;
lambda$new$2 = IntentSanitizer.Builder.lambda$new$2((String) obj);
return lambda$new$2;
}
};
private Predicate<String> mAllowedCategories = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda5
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$3;
lambda$new$3 = IntentSanitizer.Builder.lambda$new$3((String) obj);
return lambda$new$3;
}
};
private Predicate<String> mAllowedPackages = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda6
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$4;
lambda$new$4 = IntentSanitizer.Builder.lambda$new$4((String) obj);
return lambda$new$4;
}
};
private Predicate<ComponentName> mAllowedComponents = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda7
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$5;
lambda$new$5 = IntentSanitizer.Builder.lambda$new$5((ComponentName) obj);
return lambda$new$5;
}
};
private Map<String, Predicate<Object>> mAllowedExtras = new HashMap();
private boolean mAllowClipDataText = false;
private Predicate<Uri> mAllowedClipDataUri = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda8
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$6;
lambda$new$6 = IntentSanitizer.Builder.lambda$new$6((Uri) obj);
return lambda$new$6;
}
};
private Predicate<ClipData> mAllowedClipData = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda9
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$new$7;
lambda$new$7 = IntentSanitizer.Builder.lambda$new$7((ClipData) obj);
return lambda$new$7;
}
};
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowAnyComponent$10(ComponentName componentName) {
return true;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowExtra$12(Object obj) {
return true;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowExtra$14(Object obj) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$0(String str) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$1(Uri uri) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$2(String str) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$3(String str) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$4(String str) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$5(ComponentName componentName) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$6(Uri uri) {
return false;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$new$7(ClipData clipData) {
return false;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowClipDataText() {
this.mAllowClipDataText = true;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowFlags(int i) {
this.mAllowedFlags = i | this.mAllowedFlags;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowHistoryStackFlags() {
this.mAllowedFlags |= HISTORY_STACK_FLAGS;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowIdentifier() {
this.mAllowIdentifier = true;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowReceiverFlags() {
this.mAllowedFlags |= RECEIVER_FLAGS;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowSelector() {
this.mAllowSelector = true;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowSourceBounds() {
this.mAllowSourceBounds = true;
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowAction(@NonNull String str) {
Preconditions.checkNotNull(str);
Objects.requireNonNull(str);
allowAction(new IntentSanitizer$Builder$$ExternalSyntheticLambda11(str));
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowAction(@NonNull Predicate<String> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedActions = this.mAllowedActions.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowDataWithAuthority(@NonNull final String str) {
Preconditions.checkNotNull(str);
allowData(new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda16
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowDataWithAuthority$8;
lambda$allowDataWithAuthority$8 = IntentSanitizer.Builder.lambda$allowDataWithAuthority$8(str, (Uri) obj);
return lambda$allowDataWithAuthority$8;
}
});
return this;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowDataWithAuthority$8(String str, Uri uri) {
return str.equals(uri.getAuthority());
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowData(@NonNull Predicate<Uri> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedData = this.mAllowedData.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowType(@NonNull String str) {
Preconditions.checkNotNull(str);
Objects.requireNonNull(str);
return allowType(new IntentSanitizer$Builder$$ExternalSyntheticLambda11(str));
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowType(@NonNull Predicate<String> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedTypes = this.mAllowedTypes.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowCategory(@NonNull String str) {
Preconditions.checkNotNull(str);
Objects.requireNonNull(str);
return allowCategory(new IntentSanitizer$Builder$$ExternalSyntheticLambda11(str));
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowCategory(@NonNull Predicate<String> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedCategories = this.mAllowedCategories.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowPackage(@NonNull String str) {
Preconditions.checkNotNull(str);
Objects.requireNonNull(str);
return allowPackage(new IntentSanitizer$Builder$$ExternalSyntheticLambda11(str));
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowPackage(@NonNull Predicate<String> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedPackages = this.mAllowedPackages.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowComponent(@NonNull final ComponentName componentName) {
Preconditions.checkNotNull(componentName);
Objects.requireNonNull(componentName);
return allowComponent(new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda18
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
return componentName.equals((ComponentName) obj);
}
});
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowComponent(@NonNull Predicate<ComponentName> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowSomeComponents = true;
this.mAllowedComponents = this.mAllowedComponents.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowComponentWithPackage(@NonNull final String str) {
Preconditions.checkNotNull(str);
return allowComponent(new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda15
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowComponentWithPackage$9;
lambda$allowComponentWithPackage$9 = IntentSanitizer.Builder.lambda$allowComponentWithPackage$9(str, (ComponentName) obj);
return lambda$allowComponentWithPackage$9;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowComponentWithPackage$9(String str, ComponentName componentName) {
return str.equals(componentName.getPackageName());
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowAnyComponent() {
this.mAllowAnyComponent = true;
this.mAllowedComponents = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda13
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowAnyComponent$10;
lambda$allowAnyComponent$10 = IntentSanitizer.Builder.lambda$allowAnyComponent$10((ComponentName) obj);
return lambda$allowAnyComponent$10;
}
};
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowClipDataUriWithAuthority(@NonNull final String str) {
Preconditions.checkNotNull(str);
return allowClipDataUri(new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda10
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowClipDataUriWithAuthority$11;
lambda$allowClipDataUriWithAuthority$11 = IntentSanitizer.Builder.lambda$allowClipDataUriWithAuthority$11(str, (Uri) obj);
return lambda$allowClipDataUriWithAuthority$11;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowClipDataUriWithAuthority$11(String str, Uri uri) {
return str.equals(uri.getAuthority());
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowClipDataUri(@NonNull Predicate<Uri> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedClipDataUri = this.mAllowedClipDataUri.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowClipData(@NonNull Predicate<ClipData> predicate) {
Preconditions.checkNotNull(predicate);
this.mAllowedClipData = this.mAllowedClipData.or(predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowExtra(@NonNull String str, @NonNull Class<?> cls) {
return allowExtra(str, cls, new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda1
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowExtra$12;
lambda$allowExtra$12 = IntentSanitizer.Builder.lambda$allowExtra$12(obj);
return lambda$allowExtra$12;
}
});
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public <T> Builder allowExtra(@NonNull String str, @NonNull final Class<T> cls, @NonNull final Predicate<T> predicate) {
Preconditions.checkNotNull(str);
Preconditions.checkNotNull(cls);
Preconditions.checkNotNull(predicate);
return allowExtra(str, new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda14
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowExtra$13;
lambda$allowExtra$13 = IntentSanitizer.Builder.lambda$allowExtra$13(cls, predicate, obj);
return lambda$allowExtra$13;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowExtra$13(Class cls, Predicate predicate, Object obj) {
return cls.isInstance(obj) && predicate.test(cls.cast(obj));
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowExtra(@NonNull String str, @NonNull Predicate<Object> predicate) {
Preconditions.checkNotNull(str);
Preconditions.checkNotNull(predicate);
Predicate<Object> predicate2 = this.mAllowedExtras.get(str);
if (predicate2 == null) {
predicate2 = new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda0
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowExtra$14;
lambda$allowExtra$14 = IntentSanitizer.Builder.lambda$allowExtra$14(obj);
return lambda$allowExtra$14;
}
};
}
this.mAllowedExtras.put(str, predicate2.or(predicate));
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowExtraStreamUriWithAuthority(@NonNull final String str) {
Preconditions.checkNotNull(str);
allowExtra("android.intent.extra.STREAM", Uri.class, new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda12
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowExtraStreamUriWithAuthority$15;
lambda$allowExtraStreamUriWithAuthority$15 = IntentSanitizer.Builder.lambda$allowExtraStreamUriWithAuthority$15(str, (Uri) obj);
return lambda$allowExtraStreamUriWithAuthority$15;
}
});
return this;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowExtraStreamUriWithAuthority$15(String str, Uri uri) {
return str.equals(uri.getAuthority());
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowExtraStream(@NonNull Predicate<Uri> predicate) {
allowExtra("android.intent.extra.STREAM", Uri.class, predicate);
return this;
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowExtraOutput(@NonNull final String str) {
allowExtra("output", Uri.class, new Predicate() { // from class: androidx.core.content.IntentSanitizer$Builder$$ExternalSyntheticLambda17
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$allowExtraOutput$16;
lambda$allowExtraOutput$16 = IntentSanitizer.Builder.lambda$allowExtraOutput$16(str, (Uri) obj);
return lambda$allowExtraOutput$16;
}
});
return this;
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$allowExtraOutput$16(String str, Uri uri) {
return str.equals(uri.getAuthority());
}
@NonNull
@SuppressLint({"BuilderSetStyle"})
public Builder allowExtraOutput(@NonNull Predicate<Uri> predicate) {
allowExtra("output", Uri.class, predicate);
return this;
}
@NonNull
public IntentSanitizer build() {
boolean z = this.mAllowAnyComponent;
if ((z && this.mAllowSomeComponents) || (!z && !this.mAllowSomeComponents)) {
throw new SecurityException("You must call either allowAnyComponent or one or more of the allowComponent methods; but not both.");
}
IntentSanitizer intentSanitizer = new IntentSanitizer();
intentSanitizer.mAllowedFlags = this.mAllowedFlags;
intentSanitizer.mAllowedActions = this.mAllowedActions;
intentSanitizer.mAllowedData = this.mAllowedData;
intentSanitizer.mAllowedTypes = this.mAllowedTypes;
intentSanitizer.mAllowedCategories = this.mAllowedCategories;
intentSanitizer.mAllowedPackages = this.mAllowedPackages;
intentSanitizer.mAllowAnyComponent = this.mAllowAnyComponent;
intentSanitizer.mAllowedComponents = this.mAllowedComponents;
intentSanitizer.mAllowedExtras = this.mAllowedExtras;
intentSanitizer.mAllowClipDataText = this.mAllowClipDataText;
intentSanitizer.mAllowedClipDataUri = this.mAllowedClipDataUri;
intentSanitizer.mAllowedClipData = this.mAllowedClipData;
intentSanitizer.mAllowIdentifier = this.mAllowIdentifier;
intentSanitizer.mAllowSelector = this.mAllowSelector;
intentSanitizer.mAllowSourceBounds = this.mAllowSourceBounds;
return intentSanitizer;
}
}
/* JADX WARN: Removed duplicated region for block: B:29:0x00be */
/* JADX WARN: Removed duplicated region for block: B:31:0x00cd */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public static void sanitizeClipData(@androidx.annotation.NonNull android.content.Intent r7, android.content.Intent r8, androidx.core.util.Predicate<android.content.ClipData> r9, boolean r10, androidx.core.util.Predicate<android.net.Uri> r11, androidx.core.util.Consumer<java.lang.String> r12) {
/*
android.content.ClipData r7 = r7.getClipData()
if (r7 != 0) goto L7
return
L7:
if (r9 == 0) goto L14
boolean r9 = r9.test(r7)
if (r9 == 0) goto L14
r8.setClipData(r7)
goto Lde
L14:
r9 = 0
r0 = 0
r1 = r9
L17:
int r2 = r7.getItemCount()
if (r0 >= r2) goto Ld9
android.content.ClipData$Item r2 = r7.getItemAt(r0)
int r3 = android.os.Build.VERSION.SDK_INT
r4 = 31
if (r3 < r4) goto L2b
androidx.core.content.IntentSanitizer.Api31Impl.checkOtherMembers(r0, r2, r12)
goto L2e
L2b:
checkOtherMembers(r0, r2, r12)
L2e:
if (r10 == 0) goto L35
java.lang.CharSequence r3 = r2.getText()
goto L5c
L35:
java.lang.CharSequence r3 = r2.getText()
if (r3 == 0) goto L5b
java.lang.StringBuilder r3 = new java.lang.StringBuilder
r3.<init>()
java.lang.String r4 = "Item text cannot contain value. Item position: "
r3.append(r4)
r3.append(r0)
java.lang.String r4 = ". Text: "
r3.append(r4)
java.lang.CharSequence r4 = r2.getText()
r3.append(r4)
java.lang.String r3 = r3.toString()
r12.accept(r3)
L5b:
r3 = r9
L5c:
java.lang.String r4 = ". URI: "
java.lang.String r5 = "Item URI is not allowed. Item position: "
if (r11 != 0) goto L85
android.net.Uri r6 = r2.getUri()
if (r6 == 0) goto Lb2
java.lang.StringBuilder r6 = new java.lang.StringBuilder
r6.<init>()
r6.append(r5)
r6.append(r0)
r6.append(r4)
android.net.Uri r2 = r2.getUri()
r6.append(r2)
java.lang.String r2 = r6.toString()
r12.accept(r2)
goto Lb2
L85:
android.net.Uri r6 = r2.getUri()
if (r6 == 0) goto Lb4
android.net.Uri r6 = r2.getUri()
boolean r6 = r11.test(r6)
if (r6 == 0) goto L96
goto Lb4
L96:
java.lang.StringBuilder r6 = new java.lang.StringBuilder
r6.<init>()
r6.append(r5)
r6.append(r0)
r6.append(r4)
android.net.Uri r2 = r2.getUri()
r6.append(r2)
java.lang.String r2 = r6.toString()
r12.accept(r2)
Lb2:
r2 = r9
goto Lb8
Lb4:
android.net.Uri r2 = r2.getUri()
Lb8:
if (r3 != 0) goto Lbc
if (r2 == 0) goto Ld5
Lbc:
if (r1 != 0) goto Lcd
android.content.ClipData r1 = new android.content.ClipData
android.content.ClipDescription r4 = r7.getDescription()
android.content.ClipData$Item r5 = new android.content.ClipData$Item
r5.<init>(r3, r9, r2)
r1.<init>(r4, r5)
goto Ld5
Lcd:
android.content.ClipData$Item r4 = new android.content.ClipData$Item
r4.<init>(r3, r9, r2)
r1.addItem(r4)
Ld5:
int r0 = r0 + 1
goto L17
Ld9:
if (r1 == 0) goto Lde
r8.setClipData(r1)
Lde:
return
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.content.IntentSanitizer.sanitizeClipData(android.content.Intent, android.content.Intent, androidx.core.util.Predicate, boolean, androidx.core.util.Predicate, androidx.core.util.Consumer):void");
}
private static void checkOtherMembers(int i, ClipData.Item item, Consumer<String> consumer) {
if (item.getHtmlText() == null && item.getIntent() == null) {
return;
}
consumer.accept("ClipData item at position " + i + " contains htmlText, textLinks or intent: " + item);
}
@RequiresApi(31)
public static class Api31Impl {
private Api31Impl() {
}
public static void checkOtherMembers(int i, ClipData.Item item, Consumer<String> consumer) {
if (item.getHtmlText() == null && item.getIntent() == null && item.getTextLinks() == null) {
return;
}
consumer.accept("ClipData item at position " + i + " contains htmlText, textLinks or intent: " + item);
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static Intent setIdentifier(Intent intent, String str) {
return intent.setIdentifier(str);
}
public static String getIdentifier(Intent intent) {
return intent.getIdentifier();
}
}
}

View File

@@ -0,0 +1,88 @@
package androidx.core.content;
import android.content.LocusId;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.core.util.Preconditions;
import com.ironsource.v8;
/* loaded from: classes.dex */
public final class LocusIdCompat {
private final String mId;
private final LocusId mWrapped;
@NonNull
public String getId() {
return this.mId;
}
@NonNull
@RequiresApi(29)
public LocusId toLocusId() {
return this.mWrapped;
}
public LocusIdCompat(@NonNull String str) {
this.mId = (String) Preconditions.checkStringNotEmpty(str, "id cannot be empty");
if (Build.VERSION.SDK_INT >= 29) {
this.mWrapped = Api29Impl.create(str);
} else {
this.mWrapped = null;
}
}
public int hashCode() {
String str = this.mId;
return 31 + (str == null ? 0 : str.hashCode());
}
public boolean equals(@Nullable Object obj) {
if (this == obj) {
return true;
}
if (obj == null || LocusIdCompat.class != obj.getClass()) {
return false;
}
LocusIdCompat locusIdCompat = (LocusIdCompat) obj;
String str = this.mId;
if (str == null) {
return locusIdCompat.mId == null;
}
return str.equals(locusIdCompat.mId);
}
@NonNull
public String toString() {
return "LocusIdCompat[" + getSanitizedId() + v8.i.e;
}
@NonNull
@RequiresApi(29)
public static LocusIdCompat toLocusIdCompat(@NonNull LocusId locusId) {
Preconditions.checkNotNull(locusId, "locusId cannot be null");
return new LocusIdCompat((String) Preconditions.checkStringNotEmpty(Api29Impl.getId(locusId), "id cannot be empty"));
}
@NonNull
private String getSanitizedId() {
return this.mId.length() + "_chars";
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
@NonNull
public static LocusId create(@NonNull String str) {
return new LocusId(str);
}
@NonNull
public static String getId(@NonNull LocusId locusId) {
return locusId.getId();
}
}
}

View File

@@ -0,0 +1,78 @@
package androidx.core.content;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.webkit.ProxyConfig;
import java.util.ArrayList;
/* loaded from: classes.dex */
public final class MimeTypeFilter {
private MimeTypeFilter() {
}
private static boolean mimeTypeAgainstFilter(@NonNull String[] strArr, @NonNull String[] strArr2) {
if (strArr2.length != 2) {
throw new IllegalArgumentException("Ill-formatted MIME type filter. Must be type/subtype.");
}
if (strArr2[0].isEmpty() || strArr2[1].isEmpty()) {
throw new IllegalArgumentException("Ill-formatted MIME type filter. Type or subtype empty.");
}
if (strArr.length != 2) {
return false;
}
if (ProxyConfig.MATCH_ALL_SCHEMES.equals(strArr2[0]) || strArr2[0].equals(strArr[0])) {
return ProxyConfig.MATCH_ALL_SCHEMES.equals(strArr2[1]) || strArr2[1].equals(strArr[1]);
}
return false;
}
public static boolean matches(@Nullable String str, @NonNull String str2) {
if (str == null) {
return false;
}
return mimeTypeAgainstFilter(str.split("/"), str2.split("/"));
}
@Nullable
public static String matches(@Nullable String str, @NonNull String[] strArr) {
if (str == null) {
return null;
}
String[] split = str.split("/");
for (String str2 : strArr) {
if (mimeTypeAgainstFilter(split, str2.split("/"))) {
return str2;
}
}
return null;
}
@Nullable
public static String matches(@Nullable String[] strArr, @NonNull String str) {
if (strArr == null) {
return null;
}
String[] split = str.split("/");
for (String str2 : strArr) {
if (mimeTypeAgainstFilter(str2.split("/"), split)) {
return str2;
}
}
return null;
}
@NonNull
public static String[] matchesMany(@Nullable String[] strArr, @NonNull String str) {
if (strArr == null) {
return new String[0];
}
ArrayList arrayList = new ArrayList();
String[] split = str.split("/");
for (String str2 : strArr) {
if (mimeTypeAgainstFilter(str2.split("/"), split)) {
arrayList.add(str2);
}
}
return (String[]) arrayList.toArray(new String[arrayList.size()]);
}
}

View File

@@ -0,0 +1,11 @@
package androidx.core.content;
import android.content.res.Configuration;
import androidx.core.util.Consumer;
/* loaded from: classes.dex */
public interface OnConfigurationChangedProvider {
void addOnConfigurationChangedListener(Consumer<Configuration> consumer);
void removeOnConfigurationChangedListener(Consumer<Configuration> consumer);
}

View File

@@ -0,0 +1,10 @@
package androidx.core.content;
import androidx.core.util.Consumer;
/* loaded from: classes.dex */
public interface OnTrimMemoryProvider {
void addOnTrimMemoryListener(Consumer<Integer> consumer);
void removeOnTrimMemoryListener(Consumer<Integer> consumer);
}

View File

@@ -0,0 +1,114 @@
package androidx.core.content;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.concurrent.futures.ResolvableFuture;
import androidx.core.os.UserManagerCompat;
import com.google.common.util.concurrent.ListenableFuture;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Iterator;
import java.util.concurrent.Executors;
/* loaded from: classes.dex */
public final class PackageManagerCompat {
@SuppressLint({"ActionValue"})
public static final String ACTION_PERMISSION_REVOCATION_SETTINGS = "android.intent.action.AUTO_REVOKE_PERMISSIONS";
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static final String LOG_TAG = "PackageManagerCompat";
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface UnusedAppRestrictionsStatus {
}
private PackageManagerCompat() {
}
@NonNull
public static ListenableFuture getUnusedAppRestrictionsStatus(@NonNull Context context) {
ResolvableFuture<Integer> create = ResolvableFuture.create();
if (!UserManagerCompat.isUserUnlocked(context)) {
create.set(0);
Log.e(LOG_TAG, "User is in locked direct boot mode");
return create;
}
if (!areUnusedAppRestrictionsAvailable(context.getPackageManager())) {
create.set(1);
return create;
}
int i = context.getApplicationInfo().targetSdkVersion;
if (i < 30) {
create.set(0);
Log.e(LOG_TAG, "Target SDK version below API 30");
return create;
}
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 31) {
if (Api30Impl.areUnusedAppRestrictionsEnabled(context)) {
create.set(Integer.valueOf(i >= 31 ? 5 : 4));
} else {
create.set(2);
}
return create;
}
if (i2 == 30) {
create.set(Integer.valueOf(Api30Impl.areUnusedAppRestrictionsEnabled(context) ? 4 : 2));
return create;
}
final UnusedAppRestrictionsBackportServiceConnection unusedAppRestrictionsBackportServiceConnection = new UnusedAppRestrictionsBackportServiceConnection(context);
create.addListener(new Runnable() { // from class: androidx.core.content.PackageManagerCompat$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
UnusedAppRestrictionsBackportServiceConnection.this.disconnectFromService();
}
}, Executors.newSingleThreadExecutor());
unusedAppRestrictionsBackportServiceConnection.connectAndFetchResult(create);
return create;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static boolean areUnusedAppRestrictionsAvailable(@NonNull PackageManager packageManager) {
int i = Build.VERSION.SDK_INT;
return (i >= 30) || ((i < 30) && (getPermissionRevocationVerifierApp(packageManager) != null));
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static String getPermissionRevocationVerifierApp(@NonNull PackageManager packageManager) {
String str = null;
Iterator<ResolveInfo> it = packageManager.queryIntentActivities(new Intent(ACTION_PERMISSION_REVOCATION_SETTINGS).setData(Uri.fromParts("package", "com.example", null)), 0).iterator();
while (it.hasNext()) {
String str2 = it.next().activityInfo.packageName;
if (packageManager.checkPermission("android.permission.PACKAGE_VERIFICATION_AGENT", str2) == 0) {
if (str != null) {
return str;
}
str = str2;
}
}
return str;
}
@RequiresApi(30)
public static class Api30Impl {
private Api30Impl() {
}
public static boolean areUnusedAppRestrictionsEnabled(@NonNull Context context) {
return !context.getPackageManager().isAutoRevokeWhitelisted();
}
}
}

View File

@@ -0,0 +1,68 @@
package androidx.core.content;
import android.content.Context;
import android.os.Binder;
import android.os.Process;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.app.AppOpsManagerCompat;
import androidx.core.util.ObjectsCompat;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public final class PermissionChecker {
public static final int PERMISSION_DENIED = -1;
public static final int PERMISSION_DENIED_APP_OP = -2;
public static final int PERMISSION_GRANTED = 0;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface PermissionResult {
}
private PermissionChecker() {
}
public static int checkPermission(@NonNull Context context, @NonNull String str, int i, int i2, @Nullable String str2) {
int noteProxyOpNoThrow;
if (context.checkPermission(str, i, i2) == -1) {
return -1;
}
String permissionToOp = AppOpsManagerCompat.permissionToOp(str);
if (permissionToOp == null) {
return 0;
}
if (str2 == null) {
String[] packagesForUid = context.getPackageManager().getPackagesForUid(i2);
if (packagesForUid == null || packagesForUid.length <= 0) {
return -1;
}
str2 = packagesForUid[0];
}
int myUid = Process.myUid();
String packageName = context.getPackageName();
if (myUid == i2 && ObjectsCompat.equals(packageName, str2)) {
noteProxyOpNoThrow = AppOpsManagerCompat.checkOrNoteProxyOp(context, i2, permissionToOp, str2);
} else {
noteProxyOpNoThrow = AppOpsManagerCompat.noteProxyOpNoThrow(context, permissionToOp, str2);
}
return noteProxyOpNoThrow == 0 ? 0 : -2;
}
public static int checkSelfPermission(@NonNull Context context, @NonNull String str) {
return checkPermission(context, str, Process.myPid(), Process.myUid(), context.getPackageName());
}
public static int checkCallingPermission(@NonNull Context context, @NonNull String str, @Nullable String str2) {
if (Binder.getCallingPid() == Process.myPid()) {
return -1;
}
return checkPermission(context, str, Binder.getCallingPid(), Binder.getCallingUid(), str2);
}
public static int checkCallingOrSelfPermission(@NonNull Context context, @NonNull String str) {
return checkPermission(context, str, Binder.getCallingPid(), Binder.getCallingUid(), Binder.getCallingPid() == Process.myPid() ? context.getPackageName() : null);
}
}

View File

@@ -0,0 +1,44 @@
package androidx.core.content;
import android.content.SharedPreferences;
import androidx.annotation.NonNull;
@Deprecated
/* loaded from: classes.dex */
public final class SharedPreferencesCompat {
@Deprecated
public static final class EditorCompat {
private static EditorCompat sInstance;
private final Helper mHelper = new Helper();
public static class Helper {
public void apply(@NonNull SharedPreferences.Editor editor) {
try {
editor.apply();
} catch (AbstractMethodError unused) {
editor.commit();
}
}
}
private EditorCompat() {
}
@Deprecated
public static EditorCompat getInstance() {
if (sInstance == null) {
sInstance = new EditorCompat();
}
return sInstance;
}
@Deprecated
public void apply(@NonNull SharedPreferences.Editor editor) {
this.mHelper.apply(editor);
}
}
private SharedPreferencesCompat() {
}
}

View File

@@ -0,0 +1,32 @@
package androidx.core.content;
import android.annotation.SuppressLint;
import android.content.SharedPreferences;
import kotlin.jvm.functions.Function1;
/* loaded from: classes.dex */
public final class SharedPreferencesKt {
@SuppressLint({"ApplySharedPref"})
public static final void edit(SharedPreferences sharedPreferences, boolean z, Function1 function1) {
SharedPreferences.Editor edit = sharedPreferences.edit();
function1.invoke(edit);
if (z) {
edit.commit();
} else {
edit.apply();
}
}
public static /* synthetic */ void edit$default(SharedPreferences sharedPreferences, boolean z, Function1 function1, int i, Object obj) {
if ((i & 1) != 0) {
z = false;
}
SharedPreferences.Editor edit = sharedPreferences.edit();
function1.invoke(edit);
if (z) {
edit.commit();
} else {
edit.apply();
}
}
}

View File

@@ -0,0 +1,20 @@
package androidx.core.content;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback;
/* loaded from: classes.dex */
public class UnusedAppRestrictionsBackportCallback {
private IUnusedAppRestrictionsBackportCallback mCallback;
@RestrictTo({RestrictTo.Scope.LIBRARY})
public UnusedAppRestrictionsBackportCallback(@NonNull IUnusedAppRestrictionsBackportCallback iUnusedAppRestrictionsBackportCallback) {
this.mCallback = iUnusedAppRestrictionsBackportCallback;
}
public void onResult(boolean z, boolean z2) throws RemoteException {
this.mCallback.onIsPermissionRevocationEnabledForAppResult(z, z2);
}
}

View File

@@ -0,0 +1,35 @@
package androidx.core.content;
import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback;
import androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportService;
/* loaded from: classes.dex */
public abstract class UnusedAppRestrictionsBackportService extends Service {
@SuppressLint({"ActionValue"})
public static final String ACTION_UNUSED_APP_RESTRICTIONS_BACKPORT_CONNECTION = "android.support.unusedapprestrictions.action.CustomUnusedAppRestrictionsBackportService";
private IUnusedAppRestrictionsBackportService.Stub mBinder = new IUnusedAppRestrictionsBackportService.Stub() { // from class: androidx.core.content.UnusedAppRestrictionsBackportService.1
@Override // androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportService
public void isPermissionRevocationEnabledForApp(@Nullable IUnusedAppRestrictionsBackportCallback iUnusedAppRestrictionsBackportCallback) throws RemoteException {
if (iUnusedAppRestrictionsBackportCallback == null) {
return;
}
UnusedAppRestrictionsBackportService.this.isPermissionRevocationEnabled(new UnusedAppRestrictionsBackportCallback(iUnusedAppRestrictionsBackportCallback));
}
};
public abstract void isPermissionRevocationEnabled(@NonNull UnusedAppRestrictionsBackportCallback unusedAppRestrictionsBackportCallback);
@Override // android.app.Service
@Nullable
public IBinder onBind(@Nullable Intent intent) {
return this.mBinder;
}
}

View File

@@ -0,0 +1,81 @@
package androidx.core.content;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.concurrent.futures.ResolvableFuture;
import androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback;
import androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportService;
/* loaded from: classes.dex */
class UnusedAppRestrictionsBackportServiceConnection implements ServiceConnection {
private final Context mContext;
@NonNull
ResolvableFuture<Integer> mResultFuture;
@Nullable
@VisibleForTesting
IUnusedAppRestrictionsBackportService mUnusedAppRestrictionsService = null;
private boolean mHasBoundService = false;
@Override // android.content.ServiceConnection
public void onServiceDisconnected(ComponentName componentName) {
this.mUnusedAppRestrictionsService = null;
}
public UnusedAppRestrictionsBackportServiceConnection(@NonNull Context context) {
this.mContext = context;
}
@Override // android.content.ServiceConnection
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
IUnusedAppRestrictionsBackportService asInterface = IUnusedAppRestrictionsBackportService.Stub.asInterface(iBinder);
this.mUnusedAppRestrictionsService = asInterface;
try {
asInterface.isPermissionRevocationEnabledForApp(getBackportCallback());
} catch (RemoteException unused) {
this.mResultFuture.set(0);
}
}
public void connectAndFetchResult(@NonNull ResolvableFuture<Integer> resolvableFuture) {
if (this.mHasBoundService) {
throw new IllegalStateException("Each UnusedAppRestrictionsBackportServiceConnection can only be bound once.");
}
this.mHasBoundService = true;
this.mResultFuture = resolvableFuture;
this.mContext.bindService(new Intent(UnusedAppRestrictionsBackportService.ACTION_UNUSED_APP_RESTRICTIONS_BACKPORT_CONNECTION).setPackage(PackageManagerCompat.getPermissionRevocationVerifierApp(this.mContext.getPackageManager())), this, 1);
}
public void disconnectFromService() {
if (!this.mHasBoundService) {
throw new IllegalStateException("bindService must be called before unbind");
}
this.mHasBoundService = false;
this.mContext.unbindService(this);
}
private IUnusedAppRestrictionsBackportCallback getBackportCallback() {
return new IUnusedAppRestrictionsBackportCallback.Stub() { // from class: androidx.core.content.UnusedAppRestrictionsBackportServiceConnection.1
@Override // androidx.core.app.unusedapprestrictions.IUnusedAppRestrictionsBackportCallback
public void onIsPermissionRevocationEnabledForAppResult(boolean z, boolean z2) throws RemoteException {
if (!z) {
UnusedAppRestrictionsBackportServiceConnection.this.mResultFuture.set(0);
Log.e(PackageManagerCompat.LOG_TAG, "Unable to retrieve the permission revocation setting from the backport");
} else if (z2) {
UnusedAppRestrictionsBackportServiceConnection.this.mResultFuture.set(3);
} else {
UnusedAppRestrictionsBackportServiceConnection.this.mResultFuture.set(2);
}
}
};
}
}

View File

@@ -0,0 +1,14 @@
package androidx.core.content;
/* loaded from: classes.dex */
public final class UnusedAppRestrictionsConstants {
public static final int API_30 = 4;
public static final int API_30_BACKPORT = 3;
public static final int API_31 = 5;
public static final int DISABLED = 2;
public static final int ERROR = 0;
public static final int FEATURE_NOT_AVAILABLE = 1;
private UnusedAppRestrictionsConstants() {
}
}

View File

@@ -0,0 +1,29 @@
package androidx.core.content;
import android.content.UriMatcher;
import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.core.util.Predicate;
/* loaded from: classes.dex */
public class UriMatcherCompat {
private UriMatcherCompat() {
}
@NonNull
public static Predicate<Uri> asPredicate(@NonNull final UriMatcher uriMatcher) {
return new Predicate() { // from class: androidx.core.content.UriMatcherCompat$$ExternalSyntheticLambda0
@Override // androidx.core.util.Predicate
public final boolean test(Object obj) {
boolean lambda$asPredicate$0;
lambda$asPredicate$0 = UriMatcherCompat.lambda$asPredicate$0(uriMatcher, (Uri) obj);
return lambda$asPredicate$0;
}
};
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ boolean lambda$asPredicate$0(UriMatcher uriMatcher, Uri uri) {
return uriMatcher.match(uri) != -1;
}
}

View File

@@ -0,0 +1,12 @@
package androidx.core.content.pm;
@Deprecated
/* loaded from: classes.dex */
public final class ActivityInfoCompat {
@Deprecated
public static final int CONFIG_UI_MODE = 512;
private ActivityInfoCompat() {
}
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class PackageInfoCompat$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,156 @@
package androidx.core.content.pm;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.content.pm.SigningInfo;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.Size;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class PackageInfoCompat {
public static long getLongVersionCode(@NonNull PackageInfo packageInfo) {
if (Build.VERSION.SDK_INT >= 28) {
return Api28Impl.getLongVersionCode(packageInfo);
}
return packageInfo.versionCode;
}
@NonNull
public static List<Signature> getSignatures(@NonNull PackageManager packageManager, @NonNull String str) throws PackageManager.NameNotFoundException {
Signature[] signatureArr;
SigningInfo signingInfo;
if (Build.VERSION.SDK_INT >= 28) {
signingInfo = packageManager.getPackageInfo(str, 134217728).signingInfo;
if (Api28Impl.hasMultipleSigners(signingInfo)) {
signatureArr = Api28Impl.getApkContentsSigners(signingInfo);
} else {
signatureArr = Api28Impl.getSigningCertificateHistory(signingInfo);
}
} else {
signatureArr = packageManager.getPackageInfo(str, 64).signatures;
}
if (signatureArr == null) {
return Collections.emptyList();
}
return Arrays.asList(signatureArr);
}
public static boolean hasSignatures(@NonNull PackageManager packageManager, @NonNull String str, @NonNull @Size(min = 1) Map<byte[], Integer> map, boolean z) throws PackageManager.NameNotFoundException {
byte[][] bArr;
if (map.isEmpty()) {
return false;
}
Set<byte[]> keySet = map.keySet();
for (byte[] bArr2 : keySet) {
if (bArr2 == null) {
throw new IllegalArgumentException("Cert byte array cannot be null when verifying " + str);
}
Integer num = map.get(bArr2);
if (num == null) {
throw new IllegalArgumentException("Type must be specified for cert when verifying " + str);
}
int intValue = num.intValue();
if (intValue != 0 && intValue != 1) {
throw new IllegalArgumentException("Unsupported certificate type " + num + " when verifying " + str);
}
}
List<Signature> signatures = getSignatures(packageManager, str);
if (!z && Build.VERSION.SDK_INT >= 28) {
for (byte[] bArr3 : keySet) {
if (!Api28Impl.hasSigningCertificate(packageManager, str, bArr3, map.get(bArr3).intValue())) {
return false;
}
}
return true;
}
if (signatures.size() != 0 && map.size() <= signatures.size() && (!z || map.size() == signatures.size())) {
if (map.containsValue(1)) {
bArr = new byte[signatures.size()][];
for (int i = 0; i < signatures.size(); i++) {
bArr[i] = computeSHA256Digest(signatures.get(i).toByteArray());
}
} else {
bArr = null;
}
Iterator<byte[]> it = keySet.iterator();
if (it.hasNext()) {
byte[] next = it.next();
Integer num2 = map.get(next);
int intValue2 = num2.intValue();
if (intValue2 != 0) {
if (intValue2 == 1) {
if (!byteArrayContains(bArr, next)) {
return false;
}
} else {
throw new IllegalArgumentException("Unsupported certificate type " + num2);
}
} else if (!signatures.contains(new Signature(next))) {
return false;
}
return true;
}
}
return false;
}
private static boolean byteArrayContains(@NonNull byte[][] bArr, @NonNull byte[] bArr2) {
for (byte[] bArr3 : bArr) {
if (Arrays.equals(bArr2, bArr3)) {
return true;
}
}
return false;
}
private static byte[] computeSHA256Digest(byte[] bArr) {
try {
return MessageDigest.getInstance("SHA256").digest(bArr);
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException("Device doesn't support SHA256 cert checking", e);
}
}
private PackageInfoCompat() {
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static boolean hasSigningCertificate(@NonNull PackageManager packageManager, @NonNull String str, @NonNull byte[] bArr, int i) {
return packageManager.hasSigningCertificate(str, bArr, i);
}
public static boolean hasMultipleSigners(@NonNull SigningInfo signingInfo) {
return signingInfo.hasMultipleSigners();
}
@Nullable
public static Signature[] getApkContentsSigners(@NonNull SigningInfo signingInfo) {
return signingInfo.getApkContentsSigners();
}
@Nullable
public static Signature[] getSigningCertificateHistory(@NonNull SigningInfo signingInfo) {
return signingInfo.getSigningCertificateHistory();
}
public static long getLongVersionCode(PackageInfo packageInfo) {
return packageInfo.getLongVersionCode();
}
}
}

View File

@@ -0,0 +1,58 @@
package androidx.core.content.pm;
import android.annotation.SuppressLint;
import android.content.pm.PermissionInfo;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/* loaded from: classes.dex */
public final class PermissionInfoCompat {
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface Protection {
}
@SuppressLint({"UniqueConstants"})
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY})
public @interface ProtectionFlags {
}
private PermissionInfoCompat() {
}
@SuppressLint({"WrongConstant"})
public static int getProtection(@NonNull PermissionInfo permissionInfo) {
if (Build.VERSION.SDK_INT >= 28) {
return Api28Impl.getProtection(permissionInfo);
}
return permissionInfo.protectionLevel & 15;
}
@SuppressLint({"WrongConstant"})
public static int getProtectionFlags(@NonNull PermissionInfo permissionInfo) {
if (Build.VERSION.SDK_INT >= 28) {
return Api28Impl.getProtectionFlags(permissionInfo);
}
return permissionInfo.protectionLevel & (-16);
}
@RequiresApi(28)
public static class Api28Impl {
private Api28Impl() {
}
public static int getProtection(PermissionInfo permissionInfo) {
return permissionInfo.getProtection();
}
public static int getProtectionFlags(PermissionInfo permissionInfo) {
return permissionInfo.getProtectionFlags();
}
}
}

View File

@@ -0,0 +1,30 @@
package androidx.core.content.pm;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import java.util.List;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public abstract class ShortcutInfoChangeListener {
@AnyThread
public void onAllShortcutsRemoved() {
}
@AnyThread
public void onShortcutAdded(@NonNull List<ShortcutInfoCompat> list) {
}
@AnyThread
public void onShortcutRemoved(@NonNull List<String> list) {
}
@AnyThread
public void onShortcutUpdated(@NonNull List<ShortcutInfoCompat> list) {
}
@AnyThread
public void onShortcutUsageReported(@NonNull List<String> list) {
}
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutInfoCompat$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutInfoCompat$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutInfoCompat$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutInfoCompat$$ExternalSyntheticApiModelOutline3 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutInfoCompat$Builder$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutInfoCompat$Builder$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,677 @@
package androidx.core.content.pm;
import android.annotation.SuppressLint;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.LocusId;
import android.content.pm.PackageManager;
import android.content.pm.ShortcutInfo;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.os.UserHandle;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.collection.ArraySet;
import androidx.core.app.Person;
import androidx.core.content.LocusIdCompat;
import androidx.core.graphics.drawable.IconCompat;
import androidx.core.net.UriCompat;
import androidx.core.util.Preconditions;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public class ShortcutInfoCompat {
private static final String EXTRA_LOCUS_ID = "extraLocusId";
private static final String EXTRA_LONG_LIVED = "extraLongLived";
private static final String EXTRA_PERSON_ = "extraPerson_";
private static final String EXTRA_PERSON_COUNT = "extraPersonCount";
private static final String EXTRA_SLICE_URI = "extraSliceUri";
public static final int SURFACE_LAUNCHER = 1;
ComponentName mActivity;
Set<String> mCategories;
Context mContext;
CharSequence mDisabledMessage;
int mDisabledReason;
int mExcludedSurfaces;
PersistableBundle mExtras;
boolean mHasKeyFieldsOnly;
IconCompat mIcon;
String mId;
Intent[] mIntents;
boolean mIsAlwaysBadged;
boolean mIsCached;
boolean mIsDeclaredInManifest;
boolean mIsDynamic;
boolean mIsEnabled = true;
boolean mIsImmutable;
boolean mIsLongLived;
boolean mIsPinned;
CharSequence mLabel;
long mLastChangedTimestamp;
@Nullable
LocusIdCompat mLocusId;
CharSequence mLongLabel;
String mPackageName;
Person[] mPersons;
int mRank;
Bundle mTransientExtras;
UserHandle mUser;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface Surface {
}
@Nullable
public ComponentName getActivity() {
return this.mActivity;
}
@Nullable
public Set<String> getCategories() {
return this.mCategories;
}
@Nullable
public CharSequence getDisabledMessage() {
return this.mDisabledMessage;
}
public int getDisabledReason() {
return this.mDisabledReason;
}
public int getExcludedFromSurfaces() {
return this.mExcludedSurfaces;
}
@Nullable
public PersistableBundle getExtras() {
return this.mExtras;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public IconCompat getIcon() {
return this.mIcon;
}
@NonNull
public String getId() {
return this.mId;
}
public long getLastChangedTimestamp() {
return this.mLastChangedTimestamp;
}
@Nullable
public LocusIdCompat getLocusId() {
return this.mLocusId;
}
@Nullable
public CharSequence getLongLabel() {
return this.mLongLabel;
}
@NonNull
public String getPackage() {
return this.mPackageName;
}
public int getRank() {
return this.mRank;
}
@NonNull
public CharSequence getShortLabel() {
return this.mLabel;
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public Bundle getTransientExtras() {
return this.mTransientExtras;
}
@Nullable
public UserHandle getUserHandle() {
return this.mUser;
}
public boolean hasKeyFieldsOnly() {
return this.mHasKeyFieldsOnly;
}
public boolean isCached() {
return this.mIsCached;
}
public boolean isDeclaredInManifest() {
return this.mIsDeclaredInManifest;
}
public boolean isDynamic() {
return this.mIsDynamic;
}
public boolean isEnabled() {
return this.mIsEnabled;
}
public boolean isExcludedFromSurfaces(int i) {
return (i & this.mExcludedSurfaces) != 0;
}
public boolean isImmutable() {
return this.mIsImmutable;
}
public boolean isPinned() {
return this.mIsPinned;
}
@RequiresApi(25)
public ShortcutInfo toShortcutInfo() {
ShortcutInfo.Builder intents = new ShortcutInfo.Builder(this.mContext, this.mId).setShortLabel(this.mLabel).setIntents(this.mIntents);
IconCompat iconCompat = this.mIcon;
if (iconCompat != null) {
intents.setIcon(iconCompat.toIcon(this.mContext));
}
if (!TextUtils.isEmpty(this.mLongLabel)) {
intents.setLongLabel(this.mLongLabel);
}
if (!TextUtils.isEmpty(this.mDisabledMessage)) {
intents.setDisabledMessage(this.mDisabledMessage);
}
ComponentName componentName = this.mActivity;
if (componentName != null) {
intents.setActivity(componentName);
}
Set<String> set = this.mCategories;
if (set != null) {
intents.setCategories(set);
}
intents.setRank(this.mRank);
PersistableBundle persistableBundle = this.mExtras;
if (persistableBundle != null) {
intents.setExtras(persistableBundle);
}
if (Build.VERSION.SDK_INT >= 29) {
Person[] personArr = this.mPersons;
if (personArr != null && personArr.length > 0) {
int length = personArr.length;
android.app.Person[] personArr2 = new android.app.Person[length];
for (int i = 0; i < length; i++) {
personArr2[i] = this.mPersons[i].toAndroidPerson();
}
intents.setPersons(personArr2);
}
LocusIdCompat locusIdCompat = this.mLocusId;
if (locusIdCompat != null) {
intents.setLocusId(locusIdCompat.toLocusId());
}
intents.setLongLived(this.mIsLongLived);
} else {
intents.setExtras(buildLegacyExtrasBundle());
}
if (Build.VERSION.SDK_INT >= 33) {
Api33Impl.setExcludedFromSurfaces(intents, this.mExcludedSurfaces);
}
return intents.build();
}
@RequiresApi(22)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
private PersistableBundle buildLegacyExtrasBundle() {
if (this.mExtras == null) {
this.mExtras = new PersistableBundle();
}
Person[] personArr = this.mPersons;
if (personArr != null && personArr.length > 0) {
this.mExtras.putInt(EXTRA_PERSON_COUNT, personArr.length);
int i = 0;
while (i < this.mPersons.length) {
PersistableBundle persistableBundle = this.mExtras;
StringBuilder sb = new StringBuilder();
sb.append(EXTRA_PERSON_);
int i2 = i + 1;
sb.append(i2);
persistableBundle.putPersistableBundle(sb.toString(), this.mPersons[i].toPersistableBundle());
i = i2;
}
}
LocusIdCompat locusIdCompat = this.mLocusId;
if (locusIdCompat != null) {
this.mExtras.putString(EXTRA_LOCUS_ID, locusIdCompat.getId());
}
this.mExtras.putBoolean(EXTRA_LONG_LIVED, this.mIsLongLived);
return this.mExtras;
}
public Intent addToIntent(Intent intent) {
intent.putExtra("android.intent.extra.shortcut.INTENT", this.mIntents[r0.length - 1]).putExtra("android.intent.extra.shortcut.NAME", this.mLabel.toString());
if (this.mIcon != null) {
Drawable drawable = null;
if (this.mIsAlwaysBadged) {
PackageManager packageManager = this.mContext.getPackageManager();
ComponentName componentName = this.mActivity;
if (componentName != null) {
try {
drawable = packageManager.getActivityIcon(componentName);
} catch (PackageManager.NameNotFoundException unused) {
}
}
if (drawable == null) {
drawable = this.mContext.getApplicationInfo().loadIcon(packageManager);
}
}
this.mIcon.addToShortcutIntent(intent, drawable, this.mContext);
}
return intent;
}
@NonNull
public Intent getIntent() {
return this.mIntents[r0.length - 1];
}
@NonNull
public Intent[] getIntents() {
Intent[] intentArr = this.mIntents;
return (Intent[]) Arrays.copyOf(intentArr, intentArr.length);
}
@VisibleForTesting
@Nullable
@RequiresApi(25)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static Person[] getPersonsFromExtra(@NonNull PersistableBundle persistableBundle) {
if (persistableBundle == null || !persistableBundle.containsKey(EXTRA_PERSON_COUNT)) {
return null;
}
int i = persistableBundle.getInt(EXTRA_PERSON_COUNT);
Person[] personArr = new Person[i];
int i2 = 0;
while (i2 < i) {
StringBuilder sb = new StringBuilder();
sb.append(EXTRA_PERSON_);
int i3 = i2 + 1;
sb.append(i3);
personArr[i2] = Person.fromPersistableBundle(persistableBundle.getPersistableBundle(sb.toString()));
i2 = i3;
}
return personArr;
}
@RequiresApi(25)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
@VisibleForTesting
public static boolean getLongLivedFromExtra(@Nullable PersistableBundle persistableBundle) {
if (persistableBundle == null || !persistableBundle.containsKey(EXTRA_LONG_LIVED)) {
return false;
}
return persistableBundle.getBoolean(EXTRA_LONG_LIVED);
}
@RequiresApi(25)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static List<ShortcutInfoCompat> fromShortcuts(@NonNull Context context, @NonNull List<ShortcutInfo> list) {
ArrayList arrayList = new ArrayList(list.size());
Iterator<ShortcutInfo> it = list.iterator();
while (it.hasNext()) {
arrayList.add(new Builder(context, it.next()).build());
}
return arrayList;
}
@Nullable
@RequiresApi(25)
public static LocusIdCompat getLocusId(@NonNull ShortcutInfo shortcutInfo) {
LocusId locusId;
LocusId locusId2;
if (Build.VERSION.SDK_INT >= 29) {
locusId = shortcutInfo.getLocusId();
if (locusId == null) {
return null;
}
locusId2 = shortcutInfo.getLocusId();
return LocusIdCompat.toLocusIdCompat(locusId2);
}
return getLocusIdFromExtra(shortcutInfo.getExtras());
}
@Nullable
@RequiresApi(25)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
private static LocusIdCompat getLocusIdFromExtra(@Nullable PersistableBundle persistableBundle) {
String string;
if (persistableBundle == null || (string = persistableBundle.getString(EXTRA_LOCUS_ID)) == null) {
return null;
}
return new LocusIdCompat(string);
}
public static class Builder {
private Map<String, Map<String, List<String>>> mCapabilityBindingParams;
private Set<String> mCapabilityBindings;
private final ShortcutInfoCompat mInfo;
private boolean mIsConversation;
private Uri mSliceUri;
@NonNull
public Builder setIsConversation() {
this.mIsConversation = true;
return this;
}
@NonNull
@SuppressLint({"MissingGetterMatchingBuilder"})
public Builder setSliceUri(@NonNull Uri uri) {
this.mSliceUri = uri;
return this;
}
public Builder(@NonNull Context context, @NonNull String str) {
ShortcutInfoCompat shortcutInfoCompat = new ShortcutInfoCompat();
this.mInfo = shortcutInfoCompat;
shortcutInfoCompat.mContext = context;
shortcutInfoCompat.mId = str;
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public Builder(@NonNull ShortcutInfoCompat shortcutInfoCompat) {
ShortcutInfoCompat shortcutInfoCompat2 = new ShortcutInfoCompat();
this.mInfo = shortcutInfoCompat2;
shortcutInfoCompat2.mContext = shortcutInfoCompat.mContext;
shortcutInfoCompat2.mId = shortcutInfoCompat.mId;
shortcutInfoCompat2.mPackageName = shortcutInfoCompat.mPackageName;
Intent[] intentArr = shortcutInfoCompat.mIntents;
shortcutInfoCompat2.mIntents = (Intent[]) Arrays.copyOf(intentArr, intentArr.length);
shortcutInfoCompat2.mActivity = shortcutInfoCompat.mActivity;
shortcutInfoCompat2.mLabel = shortcutInfoCompat.mLabel;
shortcutInfoCompat2.mLongLabel = shortcutInfoCompat.mLongLabel;
shortcutInfoCompat2.mDisabledMessage = shortcutInfoCompat.mDisabledMessage;
shortcutInfoCompat2.mDisabledReason = shortcutInfoCompat.mDisabledReason;
shortcutInfoCompat2.mIcon = shortcutInfoCompat.mIcon;
shortcutInfoCompat2.mIsAlwaysBadged = shortcutInfoCompat.mIsAlwaysBadged;
shortcutInfoCompat2.mUser = shortcutInfoCompat.mUser;
shortcutInfoCompat2.mLastChangedTimestamp = shortcutInfoCompat.mLastChangedTimestamp;
shortcutInfoCompat2.mIsCached = shortcutInfoCompat.mIsCached;
shortcutInfoCompat2.mIsDynamic = shortcutInfoCompat.mIsDynamic;
shortcutInfoCompat2.mIsPinned = shortcutInfoCompat.mIsPinned;
shortcutInfoCompat2.mIsDeclaredInManifest = shortcutInfoCompat.mIsDeclaredInManifest;
shortcutInfoCompat2.mIsImmutable = shortcutInfoCompat.mIsImmutable;
shortcutInfoCompat2.mIsEnabled = shortcutInfoCompat.mIsEnabled;
shortcutInfoCompat2.mLocusId = shortcutInfoCompat.mLocusId;
shortcutInfoCompat2.mIsLongLived = shortcutInfoCompat.mIsLongLived;
shortcutInfoCompat2.mHasKeyFieldsOnly = shortcutInfoCompat.mHasKeyFieldsOnly;
shortcutInfoCompat2.mRank = shortcutInfoCompat.mRank;
Person[] personArr = shortcutInfoCompat.mPersons;
if (personArr != null) {
shortcutInfoCompat2.mPersons = (Person[]) Arrays.copyOf(personArr, personArr.length);
}
if (shortcutInfoCompat.mCategories != null) {
shortcutInfoCompat2.mCategories = new HashSet(shortcutInfoCompat.mCategories);
}
PersistableBundle persistableBundle = shortcutInfoCompat.mExtras;
if (persistableBundle != null) {
shortcutInfoCompat2.mExtras = persistableBundle;
}
shortcutInfoCompat2.mExcludedSurfaces = shortcutInfoCompat.mExcludedSurfaces;
}
@RequiresApi(25)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public Builder(@NonNull Context context, @NonNull ShortcutInfo shortcutInfo) {
boolean isCached;
int disabledReason;
ShortcutInfoCompat shortcutInfoCompat = new ShortcutInfoCompat();
this.mInfo = shortcutInfoCompat;
shortcutInfoCompat.mContext = context;
shortcutInfoCompat.mId = shortcutInfo.getId();
shortcutInfoCompat.mPackageName = shortcutInfo.getPackage();
Intent[] intents = shortcutInfo.getIntents();
shortcutInfoCompat.mIntents = (Intent[]) Arrays.copyOf(intents, intents.length);
shortcutInfoCompat.mActivity = shortcutInfo.getActivity();
shortcutInfoCompat.mLabel = shortcutInfo.getShortLabel();
shortcutInfoCompat.mLongLabel = shortcutInfo.getLongLabel();
shortcutInfoCompat.mDisabledMessage = shortcutInfo.getDisabledMessage();
int i = Build.VERSION.SDK_INT;
if (i >= 28) {
disabledReason = shortcutInfo.getDisabledReason();
shortcutInfoCompat.mDisabledReason = disabledReason;
} else {
shortcutInfoCompat.mDisabledReason = shortcutInfo.isEnabled() ? 0 : 3;
}
shortcutInfoCompat.mCategories = shortcutInfo.getCategories();
shortcutInfoCompat.mPersons = ShortcutInfoCompat.getPersonsFromExtra(shortcutInfo.getExtras());
shortcutInfoCompat.mUser = shortcutInfo.getUserHandle();
shortcutInfoCompat.mLastChangedTimestamp = shortcutInfo.getLastChangedTimestamp();
if (i >= 30) {
isCached = shortcutInfo.isCached();
shortcutInfoCompat.mIsCached = isCached;
}
shortcutInfoCompat.mIsDynamic = shortcutInfo.isDynamic();
shortcutInfoCompat.mIsPinned = shortcutInfo.isPinned();
shortcutInfoCompat.mIsDeclaredInManifest = shortcutInfo.isDeclaredInManifest();
shortcutInfoCompat.mIsImmutable = shortcutInfo.isImmutable();
shortcutInfoCompat.mIsEnabled = shortcutInfo.isEnabled();
shortcutInfoCompat.mHasKeyFieldsOnly = shortcutInfo.hasKeyFieldsOnly();
shortcutInfoCompat.mLocusId = ShortcutInfoCompat.getLocusId(shortcutInfo);
shortcutInfoCompat.mRank = shortcutInfo.getRank();
shortcutInfoCompat.mExtras = shortcutInfo.getExtras();
}
@NonNull
public Builder setShortLabel(@NonNull CharSequence charSequence) {
this.mInfo.mLabel = charSequence;
return this;
}
@NonNull
public Builder setLongLabel(@NonNull CharSequence charSequence) {
this.mInfo.mLongLabel = charSequence;
return this;
}
@NonNull
public Builder setDisabledMessage(@NonNull CharSequence charSequence) {
this.mInfo.mDisabledMessage = charSequence;
return this;
}
@NonNull
public Builder setIntent(@NonNull Intent intent) {
return setIntents(new Intent[]{intent});
}
@NonNull
public Builder setIntents(@NonNull Intent[] intentArr) {
this.mInfo.mIntents = intentArr;
return this;
}
@NonNull
public Builder setIcon(IconCompat iconCompat) {
this.mInfo.mIcon = iconCompat;
return this;
}
@NonNull
public Builder setLocusId(@Nullable LocusIdCompat locusIdCompat) {
this.mInfo.mLocusId = locusIdCompat;
return this;
}
@NonNull
public Builder setActivity(@NonNull ComponentName componentName) {
this.mInfo.mActivity = componentName;
return this;
}
@NonNull
public Builder setAlwaysBadged() {
this.mInfo.mIsAlwaysBadged = true;
return this;
}
@NonNull
public Builder setPerson(@NonNull Person person) {
return setPersons(new Person[]{person});
}
@NonNull
public Builder setPersons(@NonNull Person[] personArr) {
this.mInfo.mPersons = personArr;
return this;
}
@NonNull
public Builder setCategories(@NonNull Set<String> set) {
ArraySet arraySet = new ArraySet();
arraySet.addAll(set);
this.mInfo.mCategories = arraySet;
return this;
}
@NonNull
@Deprecated
public Builder setLongLived() {
this.mInfo.mIsLongLived = true;
return this;
}
@NonNull
public Builder setLongLived(boolean z) {
this.mInfo.mIsLongLived = z;
return this;
}
@NonNull
public Builder setExcludedFromSurfaces(int i) {
this.mInfo.mExcludedSurfaces = i;
return this;
}
@NonNull
public Builder setRank(int i) {
this.mInfo.mRank = i;
return this;
}
@NonNull
public Builder setExtras(@NonNull PersistableBundle persistableBundle) {
this.mInfo.mExtras = persistableBundle;
return this;
}
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public Builder setTransientExtras(@NonNull Bundle bundle) {
this.mInfo.mTransientExtras = (Bundle) Preconditions.checkNotNull(bundle);
return this;
}
@NonNull
@SuppressLint({"MissingGetterMatchingBuilder"})
public Builder addCapabilityBinding(@NonNull String str) {
if (this.mCapabilityBindings == null) {
this.mCapabilityBindings = new HashSet();
}
this.mCapabilityBindings.add(str);
return this;
}
@NonNull
@SuppressLint({"MissingGetterMatchingBuilder"})
public Builder addCapabilityBinding(@NonNull String str, @NonNull String str2, @NonNull List<String> list) {
addCapabilityBinding(str);
if (!list.isEmpty()) {
if (this.mCapabilityBindingParams == null) {
this.mCapabilityBindingParams = new HashMap();
}
if (this.mCapabilityBindingParams.get(str) == null) {
this.mCapabilityBindingParams.put(str, new HashMap());
}
this.mCapabilityBindingParams.get(str).put(str2, list);
}
return this;
}
@NonNull
public ShortcutInfoCompat build() {
if (TextUtils.isEmpty(this.mInfo.mLabel)) {
throw new IllegalArgumentException("Shortcut must have a non-empty label");
}
ShortcutInfoCompat shortcutInfoCompat = this.mInfo;
Intent[] intentArr = shortcutInfoCompat.mIntents;
if (intentArr == null || intentArr.length == 0) {
throw new IllegalArgumentException("Shortcut must have an intent");
}
if (this.mIsConversation) {
if (shortcutInfoCompat.mLocusId == null) {
shortcutInfoCompat.mLocusId = new LocusIdCompat(shortcutInfoCompat.mId);
}
this.mInfo.mIsLongLived = true;
}
if (this.mCapabilityBindings != null) {
ShortcutInfoCompat shortcutInfoCompat2 = this.mInfo;
if (shortcutInfoCompat2.mCategories == null) {
shortcutInfoCompat2.mCategories = new HashSet();
}
this.mInfo.mCategories.addAll(this.mCapabilityBindings);
}
if (this.mCapabilityBindingParams != null) {
ShortcutInfoCompat shortcutInfoCompat3 = this.mInfo;
if (shortcutInfoCompat3.mExtras == null) {
shortcutInfoCompat3.mExtras = new PersistableBundle();
}
for (String str : this.mCapabilityBindingParams.keySet()) {
Map<String, List<String>> map = this.mCapabilityBindingParams.get(str);
this.mInfo.mExtras.putStringArray(str, (String[]) map.keySet().toArray(new String[0]));
for (String str2 : map.keySet()) {
List<String> list = map.get(str2);
this.mInfo.mExtras.putStringArray(str + "/" + str2, list == null ? new String[0] : (String[]) list.toArray(new String[0]));
}
}
}
if (this.mSliceUri != null) {
ShortcutInfoCompat shortcutInfoCompat4 = this.mInfo;
if (shortcutInfoCompat4.mExtras == null) {
shortcutInfoCompat4.mExtras = new PersistableBundle();
}
this.mInfo.mExtras.putString(ShortcutInfoCompat.EXTRA_SLICE_URI, UriCompat.toSafeString(this.mSliceUri));
}
return this.mInfo;
}
}
@RequiresApi(33)
public static class Api33Impl {
private Api33Impl() {
}
public static void setExcludedFromSurfaces(@NonNull ShortcutInfo.Builder builder, int i) {
builder.setExcludedFromSurfaces(i);
}
}
}

View File

@@ -0,0 +1,55 @@
package androidx.core.content.pm;
import androidx.annotation.AnyThread;
import androidx.annotation.RestrictTo;
import androidx.annotation.WorkerThread;
import java.util.ArrayList;
import java.util.List;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public abstract class ShortcutInfoCompatSaver<T> {
@AnyThread
public abstract T addShortcuts(List<ShortcutInfoCompat> list);
@AnyThread
public abstract T removeAllShortcuts();
@AnyThread
public abstract T removeShortcuts(List<String> list);
@WorkerThread
public List<ShortcutInfoCompat> getShortcuts() throws Exception {
return new ArrayList();
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static class NoopImpl extends ShortcutInfoCompatSaver<Void> {
@Override // androidx.core.content.pm.ShortcutInfoCompatSaver
/* renamed from: addShortcuts, reason: avoid collision after fix types in other method */
public Void addShortcuts2(List<ShortcutInfoCompat> list) {
return null;
}
@Override // androidx.core.content.pm.ShortcutInfoCompatSaver
public Void removeAllShortcuts() {
return null;
}
@Override // androidx.core.content.pm.ShortcutInfoCompatSaver
/* renamed from: removeShortcuts, reason: avoid collision after fix types in other method */
public Void removeShortcuts2(List<String> list) {
return null;
}
@Override // androidx.core.content.pm.ShortcutInfoCompatSaver
public /* bridge */ /* synthetic */ Void addShortcuts(List list) {
return addShortcuts2((List<ShortcutInfoCompat>) list);
}
@Override // androidx.core.content.pm.ShortcutInfoCompatSaver
public /* bridge */ /* synthetic */ Void removeShortcuts(List list) {
return removeShortcuts2((List<String>) list);
}
}
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutManagerCompat$$ExternalSyntheticApiModelOutline0 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutManagerCompat$$ExternalSyntheticApiModelOutline1 {
}

View File

@@ -0,0 +1,5 @@
package androidx.core.content.pm;
/* loaded from: classes.dex */
public abstract /* synthetic */ class ShortcutManagerCompat$$ExternalSyntheticApiModelOutline2 {
}

View File

@@ -0,0 +1,481 @@
package androidx.core.content.pm;
import android.app.ActivityManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.ShortcutInfo;
import android.content.pm.ShortcutManager;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Build;
import android.os.Bundle;
import android.util.DisplayMetrics;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.core.content.pm.ShortcutInfoCompat;
import androidx.core.content.pm.ShortcutInfoCompatSaver;
import androidx.core.graphics.drawable.IconCompat;
import androidx.core.util.Preconditions;
import java.io.InputStream;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
/* loaded from: classes.dex */
public class ShortcutManagerCompat {
@VisibleForTesting
static final String ACTION_INSTALL_SHORTCUT = "com.android.launcher.action.INSTALL_SHORTCUT";
private static final int DEFAULT_MAX_ICON_DIMENSION_DP = 96;
private static final int DEFAULT_MAX_ICON_DIMENSION_LOWRAM_DP = 48;
public static final String EXTRA_SHORTCUT_ID = "android.intent.extra.shortcut.ID";
public static final int FLAG_MATCH_CACHED = 8;
public static final int FLAG_MATCH_DYNAMIC = 2;
public static final int FLAG_MATCH_MANIFEST = 1;
public static final int FLAG_MATCH_PINNED = 4;
@VisibleForTesting
static final String INSTALL_SHORTCUT_PERMISSION = "com.android.launcher.permission.INSTALL_SHORTCUT";
private static final String SHORTCUT_LISTENER_INTENT_FILTER_ACTION = "androidx.core.content.pm.SHORTCUT_LISTENER";
private static final String SHORTCUT_LISTENER_META_DATA_KEY = "androidx.core.content.pm.shortcut_listener_impl";
private static volatile List<ShortcutInfoChangeListener> sShortcutInfoChangeListeners;
private static volatile ShortcutInfoCompatSaver<?> sShortcutInfoCompatSaver;
@Retention(RetentionPolicy.SOURCE)
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public @interface ShortcutMatchFlags {
}
@VisibleForTesting
public static List<ShortcutInfoChangeListener> getShortcutInfoChangeListeners() {
return sShortcutInfoChangeListeners;
}
@VisibleForTesting
public static void setShortcutInfoChangeListeners(List<ShortcutInfoChangeListener> list) {
sShortcutInfoChangeListeners = list;
}
@VisibleForTesting
public static void setShortcutInfoCompatSaver(ShortcutInfoCompatSaver<Void> shortcutInfoCompatSaver) {
sShortcutInfoCompatSaver = shortcutInfoCompatSaver;
}
private ShortcutManagerCompat() {
}
public static boolean isRequestPinShortcutSupported(@NonNull Context context) {
return ((ShortcutManager) context.getSystemService(ShortcutManager.class)).isRequestPinShortcutSupported();
}
public static boolean requestPinShortcut(@NonNull Context context, @NonNull ShortcutInfoCompat shortcutInfoCompat, @Nullable IntentSender intentSender) {
if (Build.VERSION.SDK_INT > 32 || !shortcutInfoCompat.isExcludedFromSurfaces(1)) {
return ((ShortcutManager) context.getSystemService(ShortcutManager.class)).requestPinShortcut(shortcutInfoCompat.toShortcutInfo(), intentSender);
}
return false;
}
/* renamed from: androidx.core.content.pm.ShortcutManagerCompat$1, reason: invalid class name */
public class AnonymousClass1 extends BroadcastReceiver {
final /* synthetic */ IntentSender val$callback;
public AnonymousClass1(IntentSender intentSender) {
this.val$callback = intentSender;
}
@Override // android.content.BroadcastReceiver
public void onReceive(Context context, Intent intent) {
try {
this.val$callback.sendIntent(context, 0, null, null, null);
} catch (IntentSender.SendIntentException unused) {
}
}
}
@NonNull
public static Intent createShortcutResultIntent(@NonNull Context context, @NonNull ShortcutInfoCompat shortcutInfoCompat) {
Intent createShortcutResultIntent = ((ShortcutManager) context.getSystemService(ShortcutManager.class)).createShortcutResultIntent(shortcutInfoCompat.toShortcutInfo());
if (createShortcutResultIntent == null) {
createShortcutResultIntent = new Intent();
}
return shortcutInfoCompat.addToIntent(createShortcutResultIntent);
}
@NonNull
public static List<ShortcutInfoCompat> getShortcuts(@NonNull Context context, int i) {
List shortcuts;
if (Build.VERSION.SDK_INT >= 30) {
shortcuts = ((ShortcutManager) context.getSystemService(ShortcutManager.class)).getShortcuts(i);
return ShortcutInfoCompat.fromShortcuts(context, shortcuts);
}
ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(ShortcutManager.class);
ArrayList arrayList = new ArrayList();
if ((i & 1) != 0) {
arrayList.addAll(shortcutManager.getManifestShortcuts());
}
if ((i & 2) != 0) {
arrayList.addAll(shortcutManager.getDynamicShortcuts());
}
if ((i & 4) != 0) {
arrayList.addAll(shortcutManager.getPinnedShortcuts());
}
return ShortcutInfoCompat.fromShortcuts(context, arrayList);
}
public static boolean addDynamicShortcuts(@NonNull Context context, @NonNull List<ShortcutInfoCompat> list) {
List<ShortcutInfoCompat> removeShortcutsExcludedFromSurface = removeShortcutsExcludedFromSurface(list, 1);
if (Build.VERSION.SDK_INT <= 29) {
convertUriIconsToBitmapIcons(context, removeShortcutsExcludedFromSurface);
}
ArrayList arrayList = new ArrayList();
Iterator<ShortcutInfoCompat> it = removeShortcutsExcludedFromSurface.iterator();
while (it.hasNext()) {
arrayList.add(it.next().toShortcutInfo());
}
if (!((ShortcutManager) context.getSystemService(ShortcutManager.class)).addDynamicShortcuts(arrayList)) {
return false;
}
getShortcutInfoSaverInstance(context).addShortcuts(removeShortcutsExcludedFromSurface);
Iterator<ShortcutInfoChangeListener> it2 = getShortcutInfoListeners(context).iterator();
while (it2.hasNext()) {
it2.next().onShortcutAdded(list);
}
return true;
}
public static int getMaxShortcutCountPerActivity(@NonNull Context context) {
Preconditions.checkNotNull(context);
return ((ShortcutManager) context.getSystemService(ShortcutManager.class)).getMaxShortcutCountPerActivity();
}
public static boolean isRateLimitingActive(@NonNull Context context) {
Preconditions.checkNotNull(context);
return ((ShortcutManager) context.getSystemService(ShortcutManager.class)).isRateLimitingActive();
}
public static int getIconMaxWidth(@NonNull Context context) {
Preconditions.checkNotNull(context);
return ((ShortcutManager) context.getSystemService(ShortcutManager.class)).getIconMaxWidth();
}
public static int getIconMaxHeight(@NonNull Context context) {
Preconditions.checkNotNull(context);
return ((ShortcutManager) context.getSystemService(ShortcutManager.class)).getIconMaxHeight();
}
public static void reportShortcutUsed(@NonNull Context context, @NonNull String str) {
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(str);
((ShortcutManager) context.getSystemService(ShortcutManager.class)).reportShortcutUsed(str);
Iterator<ShortcutInfoChangeListener> it = getShortcutInfoListeners(context).iterator();
while (it.hasNext()) {
it.next().onShortcutUsageReported(Collections.singletonList(str));
}
}
public static boolean setDynamicShortcuts(@NonNull Context context, @NonNull List<ShortcutInfoCompat> list) {
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(list);
List<ShortcutInfoCompat> removeShortcutsExcludedFromSurface = removeShortcutsExcludedFromSurface(list, 1);
ArrayList arrayList = new ArrayList(removeShortcutsExcludedFromSurface.size());
Iterator<ShortcutInfoCompat> it = removeShortcutsExcludedFromSurface.iterator();
while (it.hasNext()) {
arrayList.add(it.next().toShortcutInfo());
}
if (!((ShortcutManager) context.getSystemService(ShortcutManager.class)).setDynamicShortcuts(arrayList)) {
return false;
}
getShortcutInfoSaverInstance(context).removeAllShortcuts();
getShortcutInfoSaverInstance(context).addShortcuts(removeShortcutsExcludedFromSurface);
for (ShortcutInfoChangeListener shortcutInfoChangeListener : getShortcutInfoListeners(context)) {
shortcutInfoChangeListener.onAllShortcutsRemoved();
shortcutInfoChangeListener.onShortcutAdded(list);
}
return true;
}
@NonNull
public static List<ShortcutInfoCompat> getDynamicShortcuts(@NonNull Context context) {
List<ShortcutInfo> dynamicShortcuts = ((ShortcutManager) context.getSystemService(ShortcutManager.class)).getDynamicShortcuts();
ArrayList arrayList = new ArrayList(dynamicShortcuts.size());
Iterator<ShortcutInfo> it = dynamicShortcuts.iterator();
while (it.hasNext()) {
arrayList.add(new ShortcutInfoCompat.Builder(context, it.next()).build());
}
return arrayList;
}
public static boolean updateShortcuts(@NonNull Context context, @NonNull List<ShortcutInfoCompat> list) {
List<ShortcutInfoCompat> removeShortcutsExcludedFromSurface = removeShortcutsExcludedFromSurface(list, 1);
if (Build.VERSION.SDK_INT <= 29) {
convertUriIconsToBitmapIcons(context, removeShortcutsExcludedFromSurface);
}
ArrayList arrayList = new ArrayList();
Iterator<ShortcutInfoCompat> it = removeShortcutsExcludedFromSurface.iterator();
while (it.hasNext()) {
arrayList.add(it.next().toShortcutInfo());
}
if (!((ShortcutManager) context.getSystemService(ShortcutManager.class)).updateShortcuts(arrayList)) {
return false;
}
getShortcutInfoSaverInstance(context).addShortcuts(removeShortcutsExcludedFromSurface);
Iterator<ShortcutInfoChangeListener> it2 = getShortcutInfoListeners(context).iterator();
while (it2.hasNext()) {
it2.next().onShortcutUpdated(list);
}
return true;
}
@VisibleForTesting
public static boolean convertUriIconToBitmapIcon(@NonNull Context context, @NonNull ShortcutInfoCompat shortcutInfoCompat) {
Bitmap decodeStream;
IconCompat createWithBitmap;
IconCompat iconCompat = shortcutInfoCompat.mIcon;
if (iconCompat == null) {
return false;
}
int i = iconCompat.mType;
if (i != 6 && i != 4) {
return true;
}
InputStream uriInputStream = iconCompat.getUriInputStream(context);
if (uriInputStream == null || (decodeStream = BitmapFactory.decodeStream(uriInputStream)) == null) {
return false;
}
if (i == 6) {
createWithBitmap = IconCompat.createWithAdaptiveBitmap(decodeStream);
} else {
createWithBitmap = IconCompat.createWithBitmap(decodeStream);
}
shortcutInfoCompat.mIcon = createWithBitmap;
return true;
}
@VisibleForTesting
public static void convertUriIconsToBitmapIcons(@NonNull Context context, @NonNull List<ShortcutInfoCompat> list) {
for (ShortcutInfoCompat shortcutInfoCompat : new ArrayList(list)) {
if (!convertUriIconToBitmapIcon(context, shortcutInfoCompat)) {
list.remove(shortcutInfoCompat);
}
}
}
public static void disableShortcuts(@NonNull Context context, @NonNull List<String> list, @Nullable CharSequence charSequence) {
((ShortcutManager) context.getSystemService(ShortcutManager.class)).disableShortcuts(list, charSequence);
getShortcutInfoSaverInstance(context).removeShortcuts(list);
Iterator<ShortcutInfoChangeListener> it = getShortcutInfoListeners(context).iterator();
while (it.hasNext()) {
it.next().onShortcutRemoved(list);
}
}
public static void enableShortcuts(@NonNull Context context, @NonNull List<ShortcutInfoCompat> list) {
List<ShortcutInfoCompat> removeShortcutsExcludedFromSurface = removeShortcutsExcludedFromSurface(list, 1);
ArrayList arrayList = new ArrayList(list.size());
Iterator<ShortcutInfoCompat> it = removeShortcutsExcludedFromSurface.iterator();
while (it.hasNext()) {
arrayList.add(it.next().mId);
}
((ShortcutManager) context.getSystemService(ShortcutManager.class)).enableShortcuts(arrayList);
getShortcutInfoSaverInstance(context).addShortcuts(removeShortcutsExcludedFromSurface);
Iterator<ShortcutInfoChangeListener> it2 = getShortcutInfoListeners(context).iterator();
while (it2.hasNext()) {
it2.next().onShortcutAdded(list);
}
}
public static void removeDynamicShortcuts(@NonNull Context context, @NonNull List<String> list) {
((ShortcutManager) context.getSystemService(ShortcutManager.class)).removeDynamicShortcuts(list);
getShortcutInfoSaverInstance(context).removeShortcuts(list);
Iterator<ShortcutInfoChangeListener> it = getShortcutInfoListeners(context).iterator();
while (it.hasNext()) {
it.next().onShortcutRemoved(list);
}
}
public static void removeAllDynamicShortcuts(@NonNull Context context) {
((ShortcutManager) context.getSystemService(ShortcutManager.class)).removeAllDynamicShortcuts();
getShortcutInfoSaverInstance(context).removeAllShortcuts();
Iterator<ShortcutInfoChangeListener> it = getShortcutInfoListeners(context).iterator();
while (it.hasNext()) {
it.next().onAllShortcutsRemoved();
}
}
public static void removeLongLivedShortcuts(@NonNull Context context, @NonNull List<String> list) {
if (Build.VERSION.SDK_INT < 30) {
removeDynamicShortcuts(context, list);
return;
}
((ShortcutManager) context.getSystemService(ShortcutManager.class)).removeLongLivedShortcuts(list);
getShortcutInfoSaverInstance(context).removeShortcuts(list);
Iterator<ShortcutInfoChangeListener> it = getShortcutInfoListeners(context).iterator();
while (it.hasNext()) {
it.next().onShortcutRemoved(list);
}
}
public static boolean pushDynamicShortcut(@NonNull Context context, @NonNull ShortcutInfoCompat shortcutInfoCompat) {
Preconditions.checkNotNull(context);
Preconditions.checkNotNull(shortcutInfoCompat);
int i = Build.VERSION.SDK_INT;
if (i <= 32 && shortcutInfoCompat.isExcludedFromSurfaces(1)) {
Iterator<ShortcutInfoChangeListener> it = getShortcutInfoListeners(context).iterator();
while (it.hasNext()) {
it.next().onShortcutAdded(Collections.singletonList(shortcutInfoCompat));
}
return true;
}
int maxShortcutCountPerActivity = getMaxShortcutCountPerActivity(context);
if (maxShortcutCountPerActivity == 0) {
return false;
}
if (i <= 29) {
convertUriIconToBitmapIcon(context, shortcutInfoCompat);
}
if (i >= 30) {
((ShortcutManager) context.getSystemService(ShortcutManager.class)).pushDynamicShortcut(shortcutInfoCompat.toShortcutInfo());
} else {
ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(ShortcutManager.class);
if (shortcutManager.isRateLimitingActive()) {
return false;
}
List<ShortcutInfo> dynamicShortcuts = shortcutManager.getDynamicShortcuts();
if (dynamicShortcuts.size() >= maxShortcutCountPerActivity) {
shortcutManager.removeDynamicShortcuts(Arrays.asList(Api25Impl.getShortcutInfoWithLowestRank(dynamicShortcuts)));
}
shortcutManager.addDynamicShortcuts(Arrays.asList(shortcutInfoCompat.toShortcutInfo()));
}
ShortcutInfoCompatSaver<?> shortcutInfoSaverInstance = getShortcutInfoSaverInstance(context);
try {
List<ShortcutInfoCompat> shortcuts = shortcutInfoSaverInstance.getShortcuts();
if (shortcuts.size() >= maxShortcutCountPerActivity) {
shortcutInfoSaverInstance.removeShortcuts(Arrays.asList(getShortcutInfoCompatWithLowestRank(shortcuts)));
}
shortcutInfoSaverInstance.addShortcuts(Arrays.asList(shortcutInfoCompat));
Iterator<ShortcutInfoChangeListener> it2 = getShortcutInfoListeners(context).iterator();
while (it2.hasNext()) {
it2.next().onShortcutAdded(Collections.singletonList(shortcutInfoCompat));
}
reportShortcutUsed(context, shortcutInfoCompat.getId());
return true;
} catch (Exception unused) {
Iterator<ShortcutInfoChangeListener> it3 = getShortcutInfoListeners(context).iterator();
while (it3.hasNext()) {
it3.next().onShortcutAdded(Collections.singletonList(shortcutInfoCompat));
}
reportShortcutUsed(context, shortcutInfoCompat.getId());
return false;
} catch (Throwable th) {
Iterator<ShortcutInfoChangeListener> it4 = getShortcutInfoListeners(context).iterator();
while (it4.hasNext()) {
it4.next().onShortcutAdded(Collections.singletonList(shortcutInfoCompat));
}
reportShortcutUsed(context, shortcutInfoCompat.getId());
throw th;
}
}
private static String getShortcutInfoCompatWithLowestRank(@NonNull List<ShortcutInfoCompat> list) {
int i = -1;
String str = null;
for (ShortcutInfoCompat shortcutInfoCompat : list) {
if (shortcutInfoCompat.getRank() > i) {
str = shortcutInfoCompat.getId();
i = shortcutInfoCompat.getRank();
}
}
return str;
}
private static int getIconDimensionInternal(@NonNull Context context, boolean z) {
ActivityManager activityManager = (ActivityManager) context.getSystemService("activity");
int max = Math.max(1, activityManager == null || activityManager.isLowRamDevice() ? 48 : DEFAULT_MAX_ICON_DIMENSION_DP);
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
return (int) (max * ((z ? displayMetrics.xdpi : displayMetrics.ydpi) / 160.0f));
}
private static ShortcutInfoCompatSaver<?> getShortcutInfoSaverInstance(Context context) {
if (sShortcutInfoCompatSaver == null) {
try {
sShortcutInfoCompatSaver = (ShortcutInfoCompatSaver) Class.forName("androidx.sharetarget.ShortcutInfoCompatSaverImpl", false, ShortcutManagerCompat.class.getClassLoader()).getMethod("getInstance", Context.class).invoke(null, context);
} catch (Exception unused) {
}
if (sShortcutInfoCompatSaver == null) {
sShortcutInfoCompatSaver = new ShortcutInfoCompatSaver.NoopImpl();
}
}
return sShortcutInfoCompatSaver;
}
private static List<ShortcutInfoChangeListener> getShortcutInfoListeners(Context context) {
Bundle bundle;
String string;
if (sShortcutInfoChangeListeners == null) {
ArrayList arrayList = new ArrayList();
PackageManager packageManager = context.getPackageManager();
Intent intent = new Intent(SHORTCUT_LISTENER_INTENT_FILTER_ACTION);
intent.setPackage(context.getPackageName());
Iterator<ResolveInfo> it = packageManager.queryIntentActivities(intent, 128).iterator();
while (it.hasNext()) {
ActivityInfo activityInfo = it.next().activityInfo;
if (activityInfo != null && (bundle = activityInfo.metaData) != null && (string = bundle.getString(SHORTCUT_LISTENER_META_DATA_KEY)) != null) {
try {
arrayList.add((ShortcutInfoChangeListener) Class.forName(string, false, ShortcutManagerCompat.class.getClassLoader()).getMethod("getInstance", Context.class).invoke(null, context));
} catch (Exception unused) {
}
}
}
if (sShortcutInfoChangeListeners == null) {
sShortcutInfoChangeListeners = arrayList;
}
}
return sShortcutInfoChangeListeners;
}
@NonNull
private static List<ShortcutInfoCompat> removeShortcutsExcludedFromSurface(@NonNull List<ShortcutInfoCompat> list, int i) {
Objects.requireNonNull(list);
if (Build.VERSION.SDK_INT > 32) {
return list;
}
ArrayList arrayList = new ArrayList(list);
for (ShortcutInfoCompat shortcutInfoCompat : list) {
if (shortcutInfoCompat.isExcludedFromSurfaces(i)) {
arrayList.remove(shortcutInfoCompat);
}
}
return arrayList;
}
@RequiresApi(25)
public static class Api25Impl {
private Api25Impl() {
}
public static String getShortcutInfoWithLowestRank(@NonNull List<ShortcutInfo> list) {
int i = -1;
String str = null;
for (ShortcutInfo shortcutInfo : list) {
if (shortcutInfo.getRank() > i) {
str = shortcutInfo.getId();
i = shortcutInfo.getRank();
}
}
return str;
}
}
}

View File

@@ -0,0 +1,116 @@
package androidx.core.content.pm;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.pm.ResolveInfo;
import android.content.res.XmlResourceParser;
import android.os.Bundle;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.RestrictTo;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes.dex */
public class ShortcutXmlParser {
private static final String ATTR_SHORTCUT_ID = "shortcutId";
private static final Object GET_INSTANCE_LOCK = new Object();
private static final String META_DATA_APP_SHORTCUTS = "android.app.shortcuts";
private static final String TAG = "ShortcutXmlParser";
private static final String TAG_SHORTCUT = "shortcut";
private static volatile ArrayList<String> sShortcutIds;
@NonNull
@WorkerThread
public static List<String> getShortcutIds(@NonNull Context context) {
if (sShortcutIds == null) {
synchronized (GET_INSTANCE_LOCK) {
try {
if (sShortcutIds == null) {
sShortcutIds = new ArrayList<>();
sShortcutIds.addAll(parseShortcutIds(context));
}
} finally {
}
}
}
return sShortcutIds;
}
private ShortcutXmlParser() {
}
@NonNull
private static Set<String> parseShortcutIds(@NonNull Context context) {
HashSet hashSet = new HashSet();
Intent intent = new Intent("android.intent.action.MAIN");
intent.addCategory("android.intent.category.LAUNCHER");
intent.setPackage(context.getPackageName());
List<ResolveInfo> queryIntentActivities = context.getPackageManager().queryIntentActivities(intent, 128);
if (queryIntentActivities != null && queryIntentActivities.size() != 0) {
try {
Iterator<ResolveInfo> it = queryIntentActivities.iterator();
while (it.hasNext()) {
ActivityInfo activityInfo = it.next().activityInfo;
Bundle bundle = activityInfo.metaData;
if (bundle != null && bundle.containsKey(META_DATA_APP_SHORTCUTS)) {
XmlResourceParser xmlResourceParser = getXmlResourceParser(context, activityInfo);
try {
hashSet.addAll(parseShortcutIds(xmlResourceParser));
if (xmlResourceParser != null) {
xmlResourceParser.close();
}
} finally {
}
}
}
} catch (Exception e) {
Log.e(TAG, "Failed to parse the Xml resource: ", e);
}
}
return hashSet;
}
@NonNull
private static XmlResourceParser getXmlResourceParser(Context context, ActivityInfo activityInfo) {
XmlResourceParser loadXmlMetaData = activityInfo.loadXmlMetaData(context.getPackageManager(), META_DATA_APP_SHORTCUTS);
if (loadXmlMetaData != null) {
return loadXmlMetaData;
}
throw new IllegalArgumentException("Failed to open android.app.shortcuts meta-data resource of " + activityInfo.name);
}
@NonNull
@VisibleForTesting
public static List<String> parseShortcutIds(@NonNull XmlPullParser xmlPullParser) throws IOException, XmlPullParserException {
String attributeValue;
ArrayList arrayList = new ArrayList(1);
while (true) {
int next = xmlPullParser.next();
if (next == 1 || (next == 3 && xmlPullParser.getDepth() <= 0)) {
break;
}
int depth = xmlPullParser.getDepth();
String name = xmlPullParser.getName();
if (next == 2 && depth == 2 && TAG_SHORTCUT.equals(name) && (attributeValue = getAttributeValue(xmlPullParser, ATTR_SHORTCUT_ID)) != null) {
arrayList.add(attributeValue);
}
}
return arrayList;
}
private static String getAttributeValue(XmlPullParser xmlPullParser, String str) {
String attributeValue = xmlPullParser.getAttributeValue("http://schemas.android.com/apk/res/android", str);
return attributeValue == null ? xmlPullParser.getAttributeValue(null, str) : attributeValue;
}
}

View File

@@ -0,0 +1,287 @@
package androidx.core.content.res;
import androidx.annotation.ColorInt;
import androidx.annotation.FloatRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.Size;
import androidx.core.graphics.ColorUtils;
import kotlin.jvm.internal.DoubleCompanionObject;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes.dex */
public class CamColor {
private static final float CHROMA_SEARCH_ENDPOINT = 0.4f;
private static final float DE_MAX = 1.0f;
private static final float DL_MAX = 0.2f;
private static final float LIGHTNESS_SEARCH_ENDPOINT = 0.01f;
private final float mAstar;
private final float mBstar;
private final float mChroma;
private final float mHue;
private final float mJ;
private final float mJstar;
private final float mM;
private final float mQ;
private final float mS;
@FloatRange(from = DoubleCompanionObject.NEGATIVE_INFINITY, fromInclusive = false, to = DoubleCompanionObject.POSITIVE_INFINITY, toInclusive = false)
public float getAStar() {
return this.mAstar;
}
@FloatRange(from = DoubleCompanionObject.NEGATIVE_INFINITY, fromInclusive = false, to = DoubleCompanionObject.POSITIVE_INFINITY, toInclusive = false)
public float getBStar() {
return this.mBstar;
}
@FloatRange(from = 0.0d, to = DoubleCompanionObject.POSITIVE_INFINITY, toInclusive = false)
public float getChroma() {
return this.mChroma;
}
@FloatRange(from = 0.0d, to = 360.0d, toInclusive = false)
public float getHue() {
return this.mHue;
}
@FloatRange(from = 0.0d, to = 100.0d)
public float getJ() {
return this.mJ;
}
@FloatRange(from = 0.0d, to = 100.0d)
public float getJStar() {
return this.mJstar;
}
@FloatRange(from = 0.0d, to = DoubleCompanionObject.POSITIVE_INFINITY, toInclusive = false)
public float getM() {
return this.mM;
}
@FloatRange(from = 0.0d, to = DoubleCompanionObject.POSITIVE_INFINITY, toInclusive = false)
public float getQ() {
return this.mQ;
}
@FloatRange(from = 0.0d, to = DoubleCompanionObject.POSITIVE_INFINITY, toInclusive = false)
public float getS() {
return this.mS;
}
public CamColor(float f, float f2, float f3, float f4, float f5, float f6, float f7, float f8, float f9) {
this.mHue = f;
this.mChroma = f2;
this.mJ = f3;
this.mQ = f4;
this.mM = f5;
this.mS = f6;
this.mJstar = f7;
this.mAstar = f8;
this.mBstar = f9;
}
public static int toColor(@FloatRange(from = 0.0d, to = 360.0d) float f, @FloatRange(from = 0.0d, to = Double.POSITIVE_INFINITY, toInclusive = false) float f2, @FloatRange(from = 0.0d, to = 100.0d) float f3) {
return toColor(f, f2, f3, ViewingConditions.DEFAULT);
}
@NonNull
public static CamColor fromColor(@ColorInt int i) {
float[] fArr = new float[7];
float[] fArr2 = new float[3];
fromColorInViewingConditions(i, ViewingConditions.DEFAULT, fArr, fArr2);
return new CamColor(fArr2[0], fArr2[1], fArr[0], fArr[1], fArr[2], fArr[3], fArr[4], fArr[5], fArr[6]);
}
public static void getM3HCTfromColor(@ColorInt int i, @NonNull @Size(3) float[] fArr) {
fromColorInViewingConditions(i, ViewingConditions.DEFAULT, null, fArr);
fArr[2] = CamUtils.lStarFromInt(i);
}
public static void fromColorInViewingConditions(@ColorInt int i, @NonNull ViewingConditions viewingConditions, @Nullable @Size(7) float[] fArr, @NonNull @Size(3) float[] fArr2) {
CamUtils.xyzFromInt(i, fArr2);
float[][] fArr3 = CamUtils.XYZ_TO_CAM16RGB;
float f = fArr2[0];
float[] fArr4 = fArr3[0];
float f2 = fArr4[0] * f;
float f3 = fArr2[1];
float f4 = f2 + (fArr4[1] * f3);
float f5 = fArr2[2];
float f6 = f4 + (fArr4[2] * f5);
float[] fArr5 = fArr3[1];
float f7 = (fArr5[0] * f) + (fArr5[1] * f3) + (fArr5[2] * f5);
float[] fArr6 = fArr3[2];
float f8 = (f * fArr6[0]) + (f3 * fArr6[1]) + (f5 * fArr6[2]);
float f9 = viewingConditions.getRgbD()[0] * f6;
float f10 = viewingConditions.getRgbD()[1] * f7;
float f11 = viewingConditions.getRgbD()[2] * f8;
float pow = (float) Math.pow((viewingConditions.getFl() * Math.abs(f9)) / 100.0d, 0.42d);
float pow2 = (float) Math.pow((viewingConditions.getFl() * Math.abs(f10)) / 100.0d, 0.42d);
float pow3 = (float) Math.pow((viewingConditions.getFl() * Math.abs(f11)) / 100.0d, 0.42d);
float signum = ((Math.signum(f9) * 400.0f) * pow) / (pow + 27.13f);
float signum2 = ((Math.signum(f10) * 400.0f) * pow2) / (pow2 + 27.13f);
float signum3 = ((Math.signum(f11) * 400.0f) * pow3) / (pow3 + 27.13f);
double d = signum3;
float f12 = ((float) (((signum * 11.0d) + (signum2 * (-12.0d))) + d)) / 11.0f;
float f13 = ((float) ((signum + signum2) - (d * 2.0d))) / 9.0f;
float f14 = signum2 * 20.0f;
float f15 = (((signum * 20.0f) + f14) + (21.0f * signum3)) / 20.0f;
float f16 = (((signum * 40.0f) + f14) + signum3) / 20.0f;
float atan2 = (((float) Math.atan2(f13, f12)) * 180.0f) / 3.1415927f;
if (atan2 < 0.0f) {
atan2 += 360.0f;
} else if (atan2 >= 360.0f) {
atan2 -= 360.0f;
}
float f17 = (3.1415927f * atan2) / 180.0f;
float pow4 = ((float) Math.pow((f16 * viewingConditions.getNbb()) / viewingConditions.getAw(), viewingConditions.getC() * viewingConditions.getZ())) * 100.0f;
float c = (4.0f / viewingConditions.getC()) * ((float) Math.sqrt(pow4 / 100.0f)) * (viewingConditions.getAw() + 4.0f) * viewingConditions.getFlRoot();
float sqrt = ((float) Math.sqrt(pow4 / 100.0d)) * ((float) Math.pow(1.64d - Math.pow(0.29d, viewingConditions.getN()), 0.73d)) * ((float) Math.pow((((((((float) (Math.cos((((((double) atan2) < 20.14d ? 360.0f + atan2 : atan2) * 3.141592653589793d) / 180.0d) + 2.0d) + 3.8d)) * 0.25f) * 3846.1538f) * viewingConditions.getNc()) * viewingConditions.getNcb()) * ((float) Math.sqrt((f12 * f12) + (f13 * f13)))) / (f15 + 0.305f), 0.9d));
float flRoot = viewingConditions.getFlRoot() * sqrt;
float sqrt2 = ((float) Math.sqrt((r7 * viewingConditions.getC()) / (viewingConditions.getAw() + 4.0f))) * 50.0f;
float f18 = (1.7f * pow4) / ((0.007f * pow4) + DE_MAX);
float log = ((float) Math.log((0.0228f * flRoot) + DE_MAX)) * 43.85965f;
double d2 = f17;
float cos = ((float) Math.cos(d2)) * log;
float sin = log * ((float) Math.sin(d2));
fArr2[0] = atan2;
fArr2[1] = sqrt;
if (fArr != null) {
fArr[0] = pow4;
fArr[1] = c;
fArr[2] = flRoot;
fArr[3] = sqrt2;
fArr[4] = f18;
fArr[5] = cos;
fArr[6] = sin;
}
}
@NonNull
private static CamColor fromJch(@FloatRange(from = 0.0d, to = 100.0d) float f, @FloatRange(from = 0.0d, to = Double.POSITIVE_INFINITY, toInclusive = false) float f2, @FloatRange(from = 0.0d, to = 360.0d) float f3) {
return fromJchInFrame(f, f2, f3, ViewingConditions.DEFAULT);
}
@NonNull
private static CamColor fromJchInFrame(@FloatRange(from = 0.0d, to = 100.0d) float f, @FloatRange(from = 0.0d, to = Double.POSITIVE_INFINITY, toInclusive = false) float f2, @FloatRange(from = 0.0d, to = 360.0d) float f3, ViewingConditions viewingConditions) {
float c = (4.0f / viewingConditions.getC()) * ((float) Math.sqrt(f / 100.0d)) * (viewingConditions.getAw() + 4.0f) * viewingConditions.getFlRoot();
float flRoot = f2 * viewingConditions.getFlRoot();
float sqrt = ((float) Math.sqrt(((f2 / ((float) Math.sqrt(r4))) * viewingConditions.getC()) / (viewingConditions.getAw() + 4.0f))) * 50.0f;
float f4 = (1.7f * f) / ((0.007f * f) + DE_MAX);
float log = ((float) Math.log((flRoot * 0.0228d) + 1.0d)) * 43.85965f;
double d = (3.1415927f * f3) / 180.0f;
return new CamColor(f3, f2, f, c, flRoot, sqrt, f4, log * ((float) Math.cos(d)), log * ((float) Math.sin(d)));
}
public float distance(@NonNull CamColor camColor) {
float jStar = getJStar() - camColor.getJStar();
float aStar = getAStar() - camColor.getAStar();
float bStar = getBStar() - camColor.getBStar();
return (float) (Math.pow(Math.sqrt((jStar * jStar) + (aStar * aStar) + (bStar * bStar)), 0.63d) * 1.41d);
}
@ColorInt
public int viewedInSrgb() {
return viewed(ViewingConditions.DEFAULT);
}
@ColorInt
public int viewed(@NonNull ViewingConditions viewingConditions) {
float pow = (float) Math.pow(((((double) getChroma()) == 0.0d || ((double) getJ()) == 0.0d) ? 0.0f : getChroma() / ((float) Math.sqrt(getJ() / 100.0d))) / Math.pow(1.64d - Math.pow(0.29d, viewingConditions.getN()), 0.73d), 1.1111111111111112d);
double hue = (getHue() * 3.1415927f) / 180.0f;
float cos = ((float) (Math.cos(2.0d + hue) + 3.8d)) * 0.25f;
float aw = viewingConditions.getAw() * ((float) Math.pow(getJ() / 100.0d, (1.0d / viewingConditions.getC()) / viewingConditions.getZ()));
float nc = cos * 3846.1538f * viewingConditions.getNc() * viewingConditions.getNcb();
float nbb = aw / viewingConditions.getNbb();
float sin = (float) Math.sin(hue);
float cos2 = (float) Math.cos(hue);
float f = (((0.305f + nbb) * 23.0f) * pow) / (((nc * 23.0f) + ((11.0f * pow) * cos2)) + ((pow * 108.0f) * sin));
float f2 = cos2 * f;
float f3 = f * sin;
float f4 = nbb * 460.0f;
float f5 = (((451.0f * f2) + f4) + (288.0f * f3)) / 1403.0f;
float f6 = ((f4 - (891.0f * f2)) - (261.0f * f3)) / 1403.0f;
float signum = Math.signum(f5) * (100.0f / viewingConditions.getFl()) * ((float) Math.pow((float) Math.max(0.0d, (Math.abs(f5) * 27.13d) / (400.0d - Math.abs(f5))), 2.380952380952381d));
float signum2 = Math.signum(f6) * (100.0f / viewingConditions.getFl()) * ((float) Math.pow((float) Math.max(0.0d, (Math.abs(f6) * 27.13d) / (400.0d - Math.abs(f6))), 2.380952380952381d));
float signum3 = Math.signum(((f4 - (f2 * 220.0f)) - (f3 * 6300.0f)) / 1403.0f) * (100.0f / viewingConditions.getFl()) * ((float) Math.pow((float) Math.max(0.0d, (Math.abs(r8) * 27.13d) / (400.0d - Math.abs(r8))), 2.380952380952381d));
float f7 = signum / viewingConditions.getRgbD()[0];
float f8 = signum2 / viewingConditions.getRgbD()[1];
float f9 = signum3 / viewingConditions.getRgbD()[2];
float[][] fArr = CamUtils.CAM16RGB_TO_XYZ;
float[] fArr2 = fArr[0];
float f10 = (fArr2[0] * f7) + (fArr2[1] * f8) + (fArr2[2] * f9);
float[] fArr3 = fArr[1];
float f11 = (fArr3[0] * f7) + (fArr3[1] * f8) + (fArr3[2] * f9);
float[] fArr4 = fArr[2];
return ColorUtils.XYZToColor(f10, f11, (f7 * fArr4[0]) + (f8 * fArr4[1]) + (f9 * fArr4[2]));
}
@ColorInt
public static int toColor(@FloatRange(from = 0.0d, to = 360.0d) float f, @FloatRange(from = 0.0d, to = Double.POSITIVE_INFINITY, toInclusive = false) float f2, @FloatRange(from = 0.0d, to = 100.0d) float f3, @NonNull ViewingConditions viewingConditions) {
if (f2 < 1.0d || Math.round(f3) <= 0.0d || Math.round(f3) >= 100.0d) {
return CamUtils.intFromLStar(f3);
}
float min = f < 0.0f ? 0.0f : Math.min(360.0f, f);
CamColor camColor = null;
boolean z = true;
float f4 = 0.0f;
float f5 = f2;
while (Math.abs(f4 - f2) >= CHROMA_SEARCH_ENDPOINT) {
CamColor findCamByJ = findCamByJ(min, f5, f3);
if (!z) {
if (findCamByJ == null) {
f2 = f5;
} else {
f4 = f5;
camColor = findCamByJ;
}
f5 = ((f2 - f4) / 2.0f) + f4;
} else {
if (findCamByJ != null) {
return findCamByJ.viewed(viewingConditions);
}
f5 = ((f2 - f4) / 2.0f) + f4;
z = false;
}
}
if (camColor == null) {
return CamUtils.intFromLStar(f3);
}
return camColor.viewed(viewingConditions);
}
@Nullable
private static CamColor findCamByJ(@FloatRange(from = 0.0d, to = 360.0d) float f, @FloatRange(from = 0.0d, to = Double.POSITIVE_INFINITY, toInclusive = false) float f2, @FloatRange(from = 0.0d, to = 100.0d) float f3) {
float f4 = 100.0f;
float f5 = 1000.0f;
float f6 = 0.0f;
CamColor camColor = null;
float f7 = 1000.0f;
while (Math.abs(f6 - f4) > LIGHTNESS_SEARCH_ENDPOINT) {
float f8 = ((f4 - f6) / 2.0f) + f6;
int viewedInSrgb = fromJch(f8, f2, f).viewedInSrgb();
float lStarFromInt = CamUtils.lStarFromInt(viewedInSrgb);
float abs = Math.abs(f3 - lStarFromInt);
if (abs < DL_MAX) {
CamColor fromColor = fromColor(viewedInSrgb);
float distance = fromColor.distance(fromJch(fromColor.getJ(), fromColor.getChroma(), f));
if (distance <= DE_MAX) {
camColor = fromColor;
f5 = abs;
f7 = distance;
}
}
if (f5 == 0.0f && f7 == 0.0f) {
break;
}
if (lStarFromInt < f3) {
f6 = f8;
} else {
f4 = f8;
}
}
return camColor;
}
}

View File

@@ -0,0 +1,79 @@
package androidx.core.content.res;
import android.graphics.Color;
import androidx.annotation.NonNull;
import androidx.core.graphics.ColorUtils;
import androidx.core.view.ViewCompat;
/* loaded from: classes.dex */
final class CamUtils {
static final float[][] XYZ_TO_CAM16RGB = {new float[]{0.401288f, 0.650173f, -0.051461f}, new float[]{-0.250268f, 1.204414f, 0.045854f}, new float[]{-0.002079f, 0.048952f, 0.953127f}};
static final float[][] CAM16RGB_TO_XYZ = {new float[]{1.8620678f, -1.0112547f, 0.14918678f}, new float[]{0.38752654f, 0.62144744f, -0.00897398f}, new float[]{-0.0158415f, -0.03412294f, 1.0499644f}};
static final float[] WHITE_POINT_D65 = {95.047f, 100.0f, 108.883f};
static final float[][] SRGB_TO_XYZ = {new float[]{0.41233894f, 0.35762063f, 0.18051042f}, new float[]{0.2126f, 0.7152f, 0.0722f}, new float[]{0.01932141f, 0.11916382f, 0.9503448f}};
public static float lerp(float f, float f2, float f3) {
return f + ((f2 - f) * f3);
}
private CamUtils() {
}
public static int intFromLStar(float f) {
if (f < 1.0f) {
return ViewCompat.MEASURED_STATE_MASK;
}
if (f > 99.0f) {
return -1;
}
float f2 = (f + 16.0f) / 116.0f;
float f3 = f > 8.0f ? f2 * f2 * f2 : f / 903.2963f;
float f4 = f2 * f2 * f2;
boolean z = f4 > 0.008856452f;
float f5 = z ? f4 : ((f2 * 116.0f) - 16.0f) / 903.2963f;
if (!z) {
f4 = ((f2 * 116.0f) - 16.0f) / 903.2963f;
}
float[] fArr = WHITE_POINT_D65;
return ColorUtils.XYZToColor(f5 * fArr[0], f3 * fArr[1], f4 * fArr[2]);
}
public static float lStarFromInt(int i) {
return lStarFromY(yFromInt(i));
}
public static float lStarFromY(float f) {
float f2 = f / 100.0f;
return f2 <= 0.008856452f ? f2 * 903.2963f : (((float) Math.cbrt(f2)) * 116.0f) - 16.0f;
}
public static float yFromInt(int i) {
float linearized = linearized(Color.red(i));
float linearized2 = linearized(Color.green(i));
float linearized3 = linearized(Color.blue(i));
float[] fArr = SRGB_TO_XYZ[1];
return (linearized * fArr[0]) + (linearized2 * fArr[1]) + (linearized3 * fArr[2]);
}
public static void xyzFromInt(int i, @NonNull float[] fArr) {
float linearized = linearized(Color.red(i));
float linearized2 = linearized(Color.green(i));
float linearized3 = linearized(Color.blue(i));
float[][] fArr2 = SRGB_TO_XYZ;
float[] fArr3 = fArr2[0];
fArr[0] = (fArr3[0] * linearized) + (fArr3[1] * linearized2) + (fArr3[2] * linearized3);
float[] fArr4 = fArr2[1];
fArr[1] = (fArr4[0] * linearized) + (fArr4[1] * linearized2) + (fArr4[2] * linearized3);
float[] fArr5 = fArr2[2];
fArr[2] = (linearized * fArr5[0]) + (linearized2 * fArr5[1]) + (linearized3 * fArr5[2]);
}
public static float yFromLStar(float f) {
return (f > 8.0f ? (float) Math.pow((f + 16.0d) / 116.0d, 3.0d) : f / 903.2963f) * 100.0f;
}
public static float linearized(int i) {
float f = i / 255.0f;
return (f <= 0.04045f ? f / 12.92f : (float) Math.pow((f + 0.055f) / 1.055f, 2.4000000953674316d)) * 100.0f;
}
}

View File

@@ -0,0 +1,177 @@
package androidx.core.content.res;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Log;
import android.util.StateSet;
import android.util.TypedValue;
import android.util.Xml;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.FloatRange;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.XmlRes;
import androidx.core.R;
import androidx.core.math.MathUtils;
import androidx.core.view.ViewCompat;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public final class ColorStateListInflaterCompat {
private static final ThreadLocal<TypedValue> sTempTypedValue = new ThreadLocal<>();
private ColorStateListInflaterCompat() {
}
@Nullable
public static ColorStateList inflate(@NonNull Resources resources, @XmlRes int i, @Nullable Resources.Theme theme) {
try {
return createFromXml(resources, resources.getXml(i), theme);
} catch (Exception e) {
Log.e("CSLCompat", "Failed to inflate ColorStateList.", e);
return null;
}
}
@NonNull
public static ColorStateList createFromXml(@NonNull Resources resources, @NonNull XmlPullParser xmlPullParser, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException {
int next;
AttributeSet asAttributeSet = Xml.asAttributeSet(xmlPullParser);
do {
next = xmlPullParser.next();
if (next == 2) {
break;
}
} while (next != 1);
if (next != 2) {
throw new XmlPullParserException("No start tag found");
}
return createFromXmlInner(resources, xmlPullParser, asAttributeSet, theme);
}
@NonNull
public static ColorStateList createFromXmlInner(@NonNull Resources resources, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException {
String name = xmlPullParser.getName();
if (!name.equals("selector")) {
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid color state list tag " + name);
}
return inflate(resources, xmlPullParser, attributeSet, theme);
}
private static ColorStateList inflate(@NonNull Resources resources, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException {
int depth;
int color;
float f;
Resources resources2 = resources;
int i = 1;
int depth2 = xmlPullParser.getDepth() + 1;
int[][] iArr = new int[20][];
int[] iArr2 = new int[20];
int i2 = 0;
while (true) {
int next = xmlPullParser.next();
if (next == i || ((depth = xmlPullParser.getDepth()) < depth2 && next == 3)) {
break;
}
if (next == 2 && depth <= depth2 && xmlPullParser.getName().equals("item")) {
TypedArray obtainAttributes = obtainAttributes(resources2, theme, attributeSet, R.styleable.ColorStateListItem);
int resourceId = obtainAttributes.getResourceId(R.styleable.ColorStateListItem_android_color, -1);
if (resourceId != -1 && !isColorInt(resources2, resourceId)) {
try {
color = createFromXml(resources2, resources2.getXml(resourceId), theme).getDefaultColor();
} catch (Exception unused) {
color = obtainAttributes.getColor(R.styleable.ColorStateListItem_android_color, -65281);
}
} else {
color = obtainAttributes.getColor(R.styleable.ColorStateListItem_android_color, -65281);
}
float f2 = 1.0f;
if (obtainAttributes.hasValue(R.styleable.ColorStateListItem_android_alpha)) {
f2 = obtainAttributes.getFloat(R.styleable.ColorStateListItem_android_alpha, 1.0f);
} else if (obtainAttributes.hasValue(R.styleable.ColorStateListItem_alpha)) {
f2 = obtainAttributes.getFloat(R.styleable.ColorStateListItem_alpha, 1.0f);
}
if (Build.VERSION.SDK_INT >= 31 && obtainAttributes.hasValue(R.styleable.ColorStateListItem_android_lStar)) {
f = obtainAttributes.getFloat(R.styleable.ColorStateListItem_android_lStar, -1.0f);
} else {
f = obtainAttributes.getFloat(R.styleable.ColorStateListItem_lStar, -1.0f);
}
obtainAttributes.recycle();
int attributeCount = attributeSet.getAttributeCount();
int[] iArr3 = new int[attributeCount];
int i3 = 0;
for (int i4 = 0; i4 < attributeCount; i4++) {
int attributeNameResource = attributeSet.getAttributeNameResource(i4);
if (attributeNameResource != 16843173 && attributeNameResource != 16843551 && attributeNameResource != R.attr.alpha && attributeNameResource != R.attr.lStar) {
int i5 = i3 + 1;
if (!attributeSet.getAttributeBooleanValue(i4, false)) {
attributeNameResource = -attributeNameResource;
}
iArr3[i3] = attributeNameResource;
i3 = i5;
}
}
int[] trimStateSet = StateSet.trimStateSet(iArr3, i3);
iArr2 = GrowingArrayUtils.append(iArr2, i2, modulateColorAlpha(color, f2, f));
iArr = (int[][]) GrowingArrayUtils.append(iArr, i2, trimStateSet);
i2++;
}
i = 1;
resources2 = resources;
}
int[] iArr4 = new int[i2];
int[][] iArr5 = new int[i2][];
System.arraycopy(iArr2, 0, iArr4, 0, i2);
System.arraycopy(iArr, 0, iArr5, 0, i2);
return new ColorStateList(iArr5, iArr4);
}
private static boolean isColorInt(@NonNull Resources resources, @ColorRes int i) {
TypedValue typedValue = getTypedValue();
resources.getValue(i, typedValue, true);
int i2 = typedValue.type;
return i2 >= 28 && i2 <= 31;
}
@NonNull
private static TypedValue getTypedValue() {
ThreadLocal<TypedValue> threadLocal = sTempTypedValue;
TypedValue typedValue = threadLocal.get();
if (typedValue != null) {
return typedValue;
}
TypedValue typedValue2 = new TypedValue();
threadLocal.set(typedValue2);
return typedValue2;
}
private static TypedArray obtainAttributes(Resources resources, Resources.Theme theme, AttributeSet attributeSet, int[] iArr) {
if (theme == null) {
return resources.obtainAttributes(attributeSet, iArr);
}
return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
}
@ColorInt
private static int modulateColorAlpha(@ColorInt int i, @FloatRange(from = 0.0d, to = 1.0d) float f, @FloatRange(from = 0.0d, to = 100.0d) float f2) {
boolean z = f2 >= 0.0f && f2 <= 100.0f;
if (f == 1.0f && !z) {
return i;
}
int clamp = MathUtils.clamp((int) ((Color.alpha(i) * f) + 0.5f), 0, 255);
if (z) {
CamColor fromColor = CamColor.fromColor(i);
i = CamColor.toColor(fromColor.getHue(), fromColor.getChroma(), f2);
}
return (i & ViewCompat.MEASURED_SIZE_MASK) | (clamp << 24);
}
}

View File

@@ -0,0 +1,117 @@
package androidx.core.content.res;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.graphics.Shader;
import android.util.AttributeSet;
import android.util.Log;
import android.util.Xml;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import java.io.IOException;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public final class ComplexColorCompat {
private static final String LOG_TAG = "ComplexColorCompat";
private int mColor;
private final ColorStateList mColorStateList;
private final Shader mShader;
@ColorInt
public int getColor() {
return this.mColor;
}
@Nullable
public Shader getShader() {
return this.mShader;
}
public boolean isGradient() {
return this.mShader != null;
}
public void setColor(@ColorInt int i) {
this.mColor = i;
}
private ComplexColorCompat(Shader shader, ColorStateList colorStateList, @ColorInt int i) {
this.mShader = shader;
this.mColorStateList = colorStateList;
this.mColor = i;
}
public static ComplexColorCompat from(@NonNull Shader shader) {
return new ComplexColorCompat(shader, null, 0);
}
public static ComplexColorCompat from(@NonNull ColorStateList colorStateList) {
return new ComplexColorCompat(null, colorStateList, colorStateList.getDefaultColor());
}
public static ComplexColorCompat from(@ColorInt int i) {
return new ComplexColorCompat(null, null, i);
}
public boolean isStateful() {
ColorStateList colorStateList;
return this.mShader == null && (colorStateList = this.mColorStateList) != null && colorStateList.isStateful();
}
public boolean onStateChanged(int[] iArr) {
if (isStateful()) {
ColorStateList colorStateList = this.mColorStateList;
int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor());
if (colorForState != this.mColor) {
this.mColor = colorForState;
return true;
}
}
return false;
}
public boolean willDraw() {
return isGradient() || this.mColor != 0;
}
@Nullable
public static ComplexColorCompat inflate(@NonNull Resources resources, @ColorRes int i, @Nullable Resources.Theme theme) {
try {
return createFromXml(resources, i, theme);
} catch (Exception e) {
Log.e(LOG_TAG, "Failed to inflate ComplexColor.", e);
return null;
}
}
@NonNull
private static ComplexColorCompat createFromXml(@NonNull Resources resources, @ColorRes int i, @Nullable Resources.Theme theme) throws IOException, XmlPullParserException {
int next;
XmlResourceParser xml = resources.getXml(i);
AttributeSet asAttributeSet = Xml.asAttributeSet(xml);
do {
next = xml.next();
if (next == 2) {
break;
}
} while (next != 1);
if (next != 2) {
throw new XmlPullParserException("No start tag found");
}
String name = xml.getName();
name.hashCode();
if (name.equals("gradient")) {
return from(GradientColorInflaterCompat.createFromXmlInner(resources, xml, asAttributeSet, theme));
}
if (name.equals("selector")) {
return from(ColorStateListInflaterCompat.createFromXmlInner(resources, xml, asAttributeSet, theme));
}
throw new XmlPullParserException(xml.getPositionDescription() + ": unsupported complex color tag " + name);
}
}

View File

@@ -0,0 +1,14 @@
package androidx.core.content.res;
import android.content.res.Resources;
import androidx.annotation.NonNull;
/* loaded from: classes.dex */
public final class ConfigurationHelper {
private ConfigurationHelper() {
}
public static int getDensityDpi(@NonNull Resources resources) {
return resources.getConfiguration().densityDpi;
}
}

View File

@@ -0,0 +1,320 @@
package androidx.core.content.res;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.util.Base64;
import android.util.Xml;
import androidx.annotation.ArrayRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.R;
import androidx.core.provider.FontRequest;
import java.io.IOException;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class FontResourcesParserCompat {
private static final int DEFAULT_TIMEOUT_MILLIS = 500;
public static final int FETCH_STRATEGY_ASYNC = 1;
public static final int FETCH_STRATEGY_BLOCKING = 0;
public static final int INFINITE_TIMEOUT_VALUE = -1;
private static final int ITALIC = 1;
private static final int NORMAL_WEIGHT = 400;
public interface FamilyResourceEntry {
}
@Retention(RetentionPolicy.SOURCE)
public @interface FetchStrategy {
}
public static final class ProviderResourceEntry implements FamilyResourceEntry {
@Nullable
private final FontRequest mFallbackRequest;
@NonNull
private final FontRequest mRequest;
private final int mStrategy;
@Nullable
private final String mSystemFontFamilyName;
private final int mTimeoutMs;
@Nullable
public FontRequest getFallbackRequest() {
return this.mFallbackRequest;
}
public int getFetchStrategy() {
return this.mStrategy;
}
@NonNull
public FontRequest getRequest() {
return this.mRequest;
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY})
public String getSystemFontFamilyName() {
return this.mSystemFontFamilyName;
}
public int getTimeout() {
return this.mTimeoutMs;
}
@RestrictTo({RestrictTo.Scope.LIBRARY})
public ProviderResourceEntry(@NonNull FontRequest fontRequest, @Nullable FontRequest fontRequest2, int i, int i2, @Nullable String str) {
this.mRequest = fontRequest;
this.mFallbackRequest = fontRequest2;
this.mStrategy = i;
this.mTimeoutMs = i2;
this.mSystemFontFamilyName = str;
}
public ProviderResourceEntry(@NonNull FontRequest fontRequest, int i, int i2) {
this(fontRequest, null, i, i2, null);
}
}
public static final class FontFileResourceEntry {
@NonNull
private final String mFileName;
private final boolean mItalic;
private final int mResourceId;
private final int mTtcIndex;
private final String mVariationSettings;
private final int mWeight;
@NonNull
public String getFileName() {
return this.mFileName;
}
public int getResourceId() {
return this.mResourceId;
}
public int getTtcIndex() {
return this.mTtcIndex;
}
@Nullable
public String getVariationSettings() {
return this.mVariationSettings;
}
public int getWeight() {
return this.mWeight;
}
public boolean isItalic() {
return this.mItalic;
}
public FontFileResourceEntry(@NonNull String str, int i, boolean z, @Nullable String str2, int i2, int i3) {
this.mFileName = str;
this.mWeight = i;
this.mItalic = z;
this.mVariationSettings = str2;
this.mTtcIndex = i2;
this.mResourceId = i3;
}
}
public static final class FontFamilyFilesResourceEntry implements FamilyResourceEntry {
@NonNull
private final FontFileResourceEntry[] mEntries;
@NonNull
public FontFileResourceEntry[] getEntries() {
return this.mEntries;
}
public FontFamilyFilesResourceEntry(@NonNull FontFileResourceEntry[] fontFileResourceEntryArr) {
this.mEntries = fontFileResourceEntryArr;
}
}
@Nullable
public static FamilyResourceEntry parse(@NonNull XmlPullParser xmlPullParser, @NonNull Resources resources) throws XmlPullParserException, IOException {
int next;
do {
next = xmlPullParser.next();
if (next == 2) {
break;
}
} while (next != 1);
if (next != 2) {
throw new XmlPullParserException("No start tag found");
}
return readFamilies(xmlPullParser, resources);
}
@Nullable
private static FamilyResourceEntry readFamilies(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
xmlPullParser.require(2, null, "font-family");
if (xmlPullParser.getName().equals("font-family")) {
return readFamily(xmlPullParser, resources);
}
skip(xmlPullParser);
return null;
}
@Nullable
private static FamilyResourceEntry readFamily(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), R.styleable.FontFamily);
String string = obtainAttributes.getString(R.styleable.FontFamily_fontProviderAuthority);
String string2 = obtainAttributes.getString(R.styleable.FontFamily_fontProviderPackage);
String string3 = obtainAttributes.getString(R.styleable.FontFamily_fontProviderQuery);
String string4 = obtainAttributes.getString(R.styleable.FontFamily_fontProviderFallbackQuery);
int resourceId = obtainAttributes.getResourceId(R.styleable.FontFamily_fontProviderCerts, 0);
int integer = obtainAttributes.getInteger(R.styleable.FontFamily_fontProviderFetchStrategy, 1);
int integer2 = obtainAttributes.getInteger(R.styleable.FontFamily_fontProviderFetchTimeout, 500);
String string5 = obtainAttributes.getString(R.styleable.FontFamily_fontProviderSystemFontFamily);
obtainAttributes.recycle();
if (string != null && string2 != null && string3 != null) {
while (xmlPullParser.next() != 3) {
skip(xmlPullParser);
}
List<List<byte[]>> readCerts = readCerts(resources, resourceId);
return new ProviderResourceEntry(new FontRequest(string, string2, string3, readCerts), string4 != null ? new FontRequest(string, string2, string4, readCerts) : null, integer, integer2, string5);
}
ArrayList arrayList = new ArrayList();
while (xmlPullParser.next() != 3) {
if (xmlPullParser.getEventType() == 2) {
if (xmlPullParser.getName().equals("font")) {
arrayList.add(readFont(xmlPullParser, resources));
} else {
skip(xmlPullParser);
}
}
}
if (arrayList.isEmpty()) {
return null;
}
return new FontFamilyFilesResourceEntry((FontFileResourceEntry[]) arrayList.toArray(new FontFileResourceEntry[0]));
}
private static int getType(TypedArray typedArray, int i) {
return Api21Impl.getType(typedArray, i);
}
@NonNull
public static List<List<byte[]>> readCerts(@NonNull Resources resources, @ArrayRes int i) {
if (i == 0) {
return Collections.emptyList();
}
TypedArray obtainTypedArray = resources.obtainTypedArray(i);
try {
if (obtainTypedArray.length() == 0) {
return Collections.emptyList();
}
ArrayList arrayList = new ArrayList();
if (getType(obtainTypedArray, 0) == 1) {
for (int i2 = 0; i2 < obtainTypedArray.length(); i2++) {
int resourceId = obtainTypedArray.getResourceId(i2, 0);
if (resourceId != 0) {
arrayList.add(toByteArrayList(resources.getStringArray(resourceId)));
}
}
} else {
arrayList.add(toByteArrayList(resources.getStringArray(i)));
}
return arrayList;
} finally {
obtainTypedArray.recycle();
}
}
private static List<byte[]> toByteArrayList(String[] strArr) {
ArrayList arrayList = new ArrayList();
for (String str : strArr) {
arrayList.add(Base64.decode(str, 0));
}
return arrayList;
}
private static FontFileResourceEntry readFont(XmlPullParser xmlPullParser, Resources resources) throws XmlPullParserException, IOException {
int i;
int i2;
int i3;
int i4;
int i5;
TypedArray obtainAttributes = resources.obtainAttributes(Xml.asAttributeSet(xmlPullParser), R.styleable.FontFamilyFont);
if (obtainAttributes.hasValue(R.styleable.FontFamilyFont_fontWeight)) {
i = R.styleable.FontFamilyFont_fontWeight;
} else {
i = R.styleable.FontFamilyFont_android_fontWeight;
}
int i6 = obtainAttributes.getInt(i, 400);
if (obtainAttributes.hasValue(R.styleable.FontFamilyFont_fontStyle)) {
i2 = R.styleable.FontFamilyFont_fontStyle;
} else {
i2 = R.styleable.FontFamilyFont_android_fontStyle;
}
boolean z = 1 == obtainAttributes.getInt(i2, 0);
if (obtainAttributes.hasValue(R.styleable.FontFamilyFont_ttcIndex)) {
i3 = R.styleable.FontFamilyFont_ttcIndex;
} else {
i3 = R.styleable.FontFamilyFont_android_ttcIndex;
}
if (obtainAttributes.hasValue(R.styleable.FontFamilyFont_fontVariationSettings)) {
i4 = R.styleable.FontFamilyFont_fontVariationSettings;
} else {
i4 = R.styleable.FontFamilyFont_android_fontVariationSettings;
}
String string = obtainAttributes.getString(i4);
int i7 = obtainAttributes.getInt(i3, 0);
if (obtainAttributes.hasValue(R.styleable.FontFamilyFont_font)) {
i5 = R.styleable.FontFamilyFont_font;
} else {
i5 = R.styleable.FontFamilyFont_android_font;
}
int resourceId = obtainAttributes.getResourceId(i5, 0);
String string2 = obtainAttributes.getString(i5);
obtainAttributes.recycle();
while (xmlPullParser.next() != 3) {
skip(xmlPullParser);
}
return new FontFileResourceEntry(string2, i6, z, string, i7, resourceId);
}
private static void skip(XmlPullParser xmlPullParser) throws XmlPullParserException, IOException {
int i = 1;
while (i > 0) {
int next = xmlPullParser.next();
if (next == 2) {
i++;
} else if (next == 3) {
i--;
}
}
}
private FontResourcesParserCompat() {
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static int getType(TypedArray typedArray, int i) {
return typedArray.getType(i);
}
}
}

View File

@@ -0,0 +1,204 @@
package androidx.core.content.res;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.LinearGradient;
import android.graphics.RadialGradient;
import android.graphics.Shader;
import android.graphics.SweepGradient;
import android.util.AttributeSet;
import android.util.Xml;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.core.R;
import java.io.IOException;
import java.util.List;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
final class GradientColorInflaterCompat {
private static final int TILE_MODE_CLAMP = 0;
private static final int TILE_MODE_MIRROR = 2;
private static final int TILE_MODE_REPEAT = 1;
private GradientColorInflaterCompat() {
}
public static Shader createFromXml(@NonNull Resources resources, @NonNull XmlPullParser xmlPullParser, @Nullable Resources.Theme theme) throws XmlPullParserException, IOException {
int next;
AttributeSet asAttributeSet = Xml.asAttributeSet(xmlPullParser);
do {
next = xmlPullParser.next();
if (next == 2) {
break;
}
} while (next != 1);
if (next != 2) {
throw new XmlPullParserException("No start tag found");
}
return createFromXmlInner(resources, xmlPullParser, asAttributeSet, theme);
}
public static Shader createFromXmlInner(@NonNull Resources resources, @NonNull XmlPullParser xmlPullParser, @NonNull AttributeSet attributeSet, @Nullable Resources.Theme theme) throws IOException, XmlPullParserException {
String name = xmlPullParser.getName();
if (!name.equals("gradient")) {
throw new XmlPullParserException(xmlPullParser.getPositionDescription() + ": invalid gradient color tag " + name);
}
TypedArray obtainAttributes = TypedArrayUtils.obtainAttributes(resources, theme, attributeSet, R.styleable.GradientColor);
float namedFloat = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "startX", R.styleable.GradientColor_android_startX, 0.0f);
float namedFloat2 = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "startY", R.styleable.GradientColor_android_startY, 0.0f);
float namedFloat3 = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "endX", R.styleable.GradientColor_android_endX, 0.0f);
float namedFloat4 = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "endY", R.styleable.GradientColor_android_endY, 0.0f);
float namedFloat5 = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "centerX", R.styleable.GradientColor_android_centerX, 0.0f);
float namedFloat6 = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "centerY", R.styleable.GradientColor_android_centerY, 0.0f);
int namedInt = TypedArrayUtils.getNamedInt(obtainAttributes, xmlPullParser, "type", R.styleable.GradientColor_android_type, 0);
int namedColor = TypedArrayUtils.getNamedColor(obtainAttributes, xmlPullParser, "startColor", R.styleable.GradientColor_android_startColor, 0);
boolean hasAttribute = TypedArrayUtils.hasAttribute(xmlPullParser, "centerColor");
int namedColor2 = TypedArrayUtils.getNamedColor(obtainAttributes, xmlPullParser, "centerColor", R.styleable.GradientColor_android_centerColor, 0);
int namedColor3 = TypedArrayUtils.getNamedColor(obtainAttributes, xmlPullParser, "endColor", R.styleable.GradientColor_android_endColor, 0);
int namedInt2 = TypedArrayUtils.getNamedInt(obtainAttributes, xmlPullParser, "tileMode", R.styleable.GradientColor_android_tileMode, 0);
float namedFloat7 = TypedArrayUtils.getNamedFloat(obtainAttributes, xmlPullParser, "gradientRadius", R.styleable.GradientColor_android_gradientRadius, 0.0f);
obtainAttributes.recycle();
ColorStops checkColors = checkColors(inflateChildElements(resources, xmlPullParser, attributeSet, theme), namedColor, namedColor3, hasAttribute, namedColor2);
if (namedInt != 1) {
if (namedInt == 2) {
return new SweepGradient(namedFloat5, namedFloat6, checkColors.mColors, checkColors.mOffsets);
}
return new LinearGradient(namedFloat, namedFloat2, namedFloat3, namedFloat4, checkColors.mColors, checkColors.mOffsets, parseTileMode(namedInt2));
}
if (namedFloat7 <= 0.0f) {
throw new XmlPullParserException("<gradient> tag requires 'gradientRadius' attribute with radial type");
}
return new RadialGradient(namedFloat5, namedFloat6, namedFloat7, checkColors.mColors, checkColors.mOffsets, parseTileMode(namedInt2));
}
/* JADX WARN: Code restructure failed: missing block: B:31:0x0084, code lost:
throw new org.xmlpull.v1.XmlPullParserException(r9.getPositionDescription() + ": <item> tag requires a 'color' attribute and a 'offset' attribute!");
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static androidx.core.content.res.GradientColorInflaterCompat.ColorStops inflateChildElements(@androidx.annotation.NonNull android.content.res.Resources r8, @androidx.annotation.NonNull org.xmlpull.v1.XmlPullParser r9, @androidx.annotation.NonNull android.util.AttributeSet r10, @androidx.annotation.Nullable android.content.res.Resources.Theme r11) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException {
/*
int r0 = r9.getDepth()
r1 = 1
int r0 = r0 + r1
java.util.ArrayList r2 = new java.util.ArrayList
r3 = 20
r2.<init>(r3)
java.util.ArrayList r4 = new java.util.ArrayList
r4.<init>(r3)
L12:
int r3 = r9.next()
if (r3 == r1) goto L85
int r5 = r9.getDepth()
if (r5 >= r0) goto L21
r6 = 3
if (r3 == r6) goto L85
L21:
r6 = 2
if (r3 == r6) goto L25
goto L12
L25:
if (r5 > r0) goto L12
java.lang.String r3 = r9.getName()
java.lang.String r5 = "item"
boolean r3 = r3.equals(r5)
if (r3 != 0) goto L34
goto L12
L34:
int[] r3 = androidx.core.R.styleable.GradientColorItem
android.content.res.TypedArray r3 = androidx.core.content.res.TypedArrayUtils.obtainAttributes(r8, r11, r10, r3)
int r5 = androidx.core.R.styleable.GradientColorItem_android_color
boolean r5 = r3.hasValue(r5)
int r6 = androidx.core.R.styleable.GradientColorItem_android_offset
boolean r6 = r3.hasValue(r6)
if (r5 == 0) goto L6a
if (r6 == 0) goto L6a
int r5 = androidx.core.R.styleable.GradientColorItem_android_color
r6 = 0
int r5 = r3.getColor(r5, r6)
int r6 = androidx.core.R.styleable.GradientColorItem_android_offset
r7 = 0
float r6 = r3.getFloat(r6, r7)
r3.recycle()
java.lang.Integer r3 = java.lang.Integer.valueOf(r5)
r4.add(r3)
java.lang.Float r3 = java.lang.Float.valueOf(r6)
r2.add(r3)
goto L12
L6a:
org.xmlpull.v1.XmlPullParserException r8 = new org.xmlpull.v1.XmlPullParserException
java.lang.StringBuilder r10 = new java.lang.StringBuilder
r10.<init>()
java.lang.String r9 = r9.getPositionDescription()
r10.append(r9)
java.lang.String r9 = ": <item> tag requires a 'color' attribute and a 'offset' attribute!"
r10.append(r9)
java.lang.String r9 = r10.toString()
r8.<init>(r9)
throw r8
L85:
int r8 = r4.size()
if (r8 <= 0) goto L91
androidx.core.content.res.GradientColorInflaterCompat$ColorStops r8 = new androidx.core.content.res.GradientColorInflaterCompat$ColorStops
r8.<init>(r4, r2)
return r8
L91:
r8 = 0
return r8
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.content.res.GradientColorInflaterCompat.inflateChildElements(android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet, android.content.res.Resources$Theme):androidx.core.content.res.GradientColorInflaterCompat$ColorStops");
}
private static ColorStops checkColors(@Nullable ColorStops colorStops, @ColorInt int i, @ColorInt int i2, boolean z, @ColorInt int i3) {
if (colorStops != null) {
return colorStops;
}
if (z) {
return new ColorStops(i, i3, i2);
}
return new ColorStops(i, i2);
}
private static Shader.TileMode parseTileMode(int i) {
if (i == 1) {
return Shader.TileMode.REPEAT;
}
if (i == 2) {
return Shader.TileMode.MIRROR;
}
return Shader.TileMode.CLAMP;
}
public static final class ColorStops {
final int[] mColors;
final float[] mOffsets;
public ColorStops(@NonNull List<Integer> list, @NonNull List<Float> list2) {
int size = list.size();
this.mColors = new int[size];
this.mOffsets = new float[size];
for (int i = 0; i < size; i++) {
this.mColors[i] = list.get(i).intValue();
this.mOffsets[i] = list2.get(i).floatValue();
}
}
public ColorStops(@ColorInt int i, @ColorInt int i2) {
this.mColors = new int[]{i, i2};
this.mOffsets = new float[]{0.0f, 1.0f};
}
public ColorStops(@ColorInt int i, @ColorInt int i2, @ColorInt int i3) {
this.mColors = new int[]{i, i2, i3};
this.mOffsets = new float[]{0.0f, 0.5f, 1.0f};
}
}
}

View File

@@ -0,0 +1,110 @@
package androidx.core.content.res;
import java.lang.reflect.Array;
/* loaded from: classes.dex */
final class GrowingArrayUtils {
public static int growSize(int i) {
if (i <= 4) {
return 8;
}
return i * 2;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, java.lang.Object[]] */
public static <T> T[] append(T[] tArr, int i, T t) {
if (i + 1 > tArr.length) {
?? r0 = (Object[]) Array.newInstance(tArr.getClass().getComponentType(), growSize(i));
System.arraycopy(tArr, 0, r0, 0, i);
tArr = r0;
}
tArr[i] = t;
return tArr;
}
public static int[] append(int[] iArr, int i, int i2) {
if (i + 1 > iArr.length) {
int[] iArr2 = new int[growSize(i)];
System.arraycopy(iArr, 0, iArr2, 0, i);
iArr = iArr2;
}
iArr[i] = i2;
return iArr;
}
public static long[] append(long[] jArr, int i, long j) {
if (i + 1 > jArr.length) {
long[] jArr2 = new long[growSize(i)];
System.arraycopy(jArr, 0, jArr2, 0, i);
jArr = jArr2;
}
jArr[i] = j;
return jArr;
}
public static boolean[] append(boolean[] zArr, int i, boolean z) {
if (i + 1 > zArr.length) {
boolean[] zArr2 = new boolean[growSize(i)];
System.arraycopy(zArr, 0, zArr2, 0, i);
zArr = zArr2;
}
zArr[i] = z;
return zArr;
}
public static <T> T[] insert(T[] tArr, int i, int i2, T t) {
if (i + 1 <= tArr.length) {
System.arraycopy(tArr, i2, tArr, i2 + 1, i - i2);
tArr[i2] = t;
return tArr;
}
T[] tArr2 = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), growSize(i)));
System.arraycopy(tArr, 0, tArr2, 0, i2);
tArr2[i2] = t;
System.arraycopy(tArr, i2, tArr2, i2 + 1, tArr.length - i2);
return tArr2;
}
public static int[] insert(int[] iArr, int i, int i2, int i3) {
if (i + 1 <= iArr.length) {
System.arraycopy(iArr, i2, iArr, i2 + 1, i - i2);
iArr[i2] = i3;
return iArr;
}
int[] iArr2 = new int[growSize(i)];
System.arraycopy(iArr, 0, iArr2, 0, i2);
iArr2[i2] = i3;
System.arraycopy(iArr, i2, iArr2, i2 + 1, iArr.length - i2);
return iArr2;
}
public static long[] insert(long[] jArr, int i, int i2, long j) {
if (i + 1 <= jArr.length) {
System.arraycopy(jArr, i2, jArr, i2 + 1, i - i2);
jArr[i2] = j;
return jArr;
}
long[] jArr2 = new long[growSize(i)];
System.arraycopy(jArr, 0, jArr2, 0, i2);
jArr2[i2] = j;
System.arraycopy(jArr, i2, jArr2, i2 + 1, jArr.length - i2);
return jArr2;
}
public static boolean[] insert(boolean[] zArr, int i, int i2, boolean z) {
if (i + 1 <= zArr.length) {
System.arraycopy(zArr, i2, zArr, i2 + 1, i - i2);
zArr[i2] = z;
return zArr;
}
boolean[] zArr2 = new boolean[growSize(i)];
System.arraycopy(zArr, 0, zArr2, 0, i2);
zArr2[i2] = z;
System.arraycopy(zArr, i2, zArr2, i2 + 1, zArr.length - i2);
return zArr2;
}
private GrowingArrayUtils() {
}
}

View File

@@ -0,0 +1,436 @@
package androidx.core.content.res;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.util.SparseArray;
import android.util.TypedValue;
import androidx.annotation.AnyRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DimenRes;
import androidx.annotation.DrawableRes;
import androidx.annotation.FontRes;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import androidx.core.content.res.ResourcesCompat;
import androidx.core.util.ObjectsCompat;
import androidx.core.util.Preconditions;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Iterator;
import java.util.WeakHashMap;
/* loaded from: classes.dex */
public final class ResourcesCompat {
@AnyRes
public static final int ID_NULL = 0;
private static final String TAG = "ResourcesCompat";
private static final ThreadLocal<TypedValue> sTempTypedValue = new ThreadLocal<>();
@GuardedBy("sColorStateCacheLock")
private static final WeakHashMap<ColorStateListCacheKey, SparseArray<ColorStateListCacheEntry>> sColorStateCaches = new WeakHashMap<>(0);
private static final Object sColorStateCacheLock = new Object();
public static void clearCachesForTheme(@NonNull Resources.Theme theme) {
synchronized (sColorStateCacheLock) {
try {
Iterator<ColorStateListCacheKey> it = sColorStateCaches.keySet().iterator();
while (it.hasNext()) {
ColorStateListCacheKey next = it.next();
if (next != null && theme.equals(next.mTheme)) {
it.remove();
}
}
} catch (Throwable th) {
throw th;
}
}
}
@Nullable
public static Drawable getDrawable(@NonNull Resources resources, @DrawableRes int i, @Nullable Resources.Theme theme) throws Resources.NotFoundException {
return Api21Impl.getDrawable(resources, i, theme);
}
@Nullable
public static Drawable getDrawableForDensity(@NonNull Resources resources, @DrawableRes int i, int i2, @Nullable Resources.Theme theme) throws Resources.NotFoundException {
return Api21Impl.getDrawableForDensity(resources, i, i2, theme);
}
@ColorInt
public static int getColor(@NonNull Resources resources, @ColorRes int i, @Nullable Resources.Theme theme) throws Resources.NotFoundException {
return Api23Impl.getColor(resources, i, theme);
}
@Nullable
public static ColorStateList getColorStateList(@NonNull Resources resources, @ColorRes int i, @Nullable Resources.Theme theme) throws Resources.NotFoundException {
ColorStateListCacheKey colorStateListCacheKey = new ColorStateListCacheKey(resources, theme);
ColorStateList cachedColorStateList = getCachedColorStateList(colorStateListCacheKey, i);
if (cachedColorStateList != null) {
return cachedColorStateList;
}
ColorStateList inflateColorStateList = inflateColorStateList(resources, i, theme);
if (inflateColorStateList != null) {
addColorStateListToCache(colorStateListCacheKey, i, inflateColorStateList, theme);
return inflateColorStateList;
}
return Api23Impl.getColorStateList(resources, i, theme);
}
@Nullable
private static ColorStateList inflateColorStateList(Resources resources, int i, @Nullable Resources.Theme theme) {
if (isColorInt(resources, i)) {
return null;
}
try {
return ColorStateListInflaterCompat.createFromXml(resources, resources.getXml(i), theme);
} catch (Exception e) {
Log.w(TAG, "Failed to inflate ColorStateList, leaving it to the framework", e);
return null;
}
}
/* JADX WARN: Code restructure failed: missing block: B:23:0x003c, code lost:
if (r2.mThemeHash == r5.hashCode()) goto L22;
*/
@androidx.annotation.Nullable
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static android.content.res.ColorStateList getCachedColorStateList(@androidx.annotation.NonNull androidx.core.content.res.ResourcesCompat.ColorStateListCacheKey r5, @androidx.annotation.ColorRes int r6) {
/*
java.lang.Object r0 = androidx.core.content.res.ResourcesCompat.sColorStateCacheLock
monitor-enter(r0)
java.util.WeakHashMap<androidx.core.content.res.ResourcesCompat$ColorStateListCacheKey, android.util.SparseArray<androidx.core.content.res.ResourcesCompat$ColorStateListCacheEntry>> r1 = androidx.core.content.res.ResourcesCompat.sColorStateCaches // Catch: java.lang.Throwable -> L32
java.lang.Object r1 = r1.get(r5) // Catch: java.lang.Throwable -> L32
android.util.SparseArray r1 = (android.util.SparseArray) r1 // Catch: java.lang.Throwable -> L32
if (r1 == 0) goto L45
int r2 = r1.size() // Catch: java.lang.Throwable -> L32
if (r2 <= 0) goto L45
java.lang.Object r2 = r1.get(r6) // Catch: java.lang.Throwable -> L32
androidx.core.content.res.ResourcesCompat$ColorStateListCacheEntry r2 = (androidx.core.content.res.ResourcesCompat.ColorStateListCacheEntry) r2 // Catch: java.lang.Throwable -> L32
if (r2 == 0) goto L45
android.content.res.Configuration r3 = r2.mConfiguration // Catch: java.lang.Throwable -> L32
android.content.res.Resources r4 = r5.mResources // Catch: java.lang.Throwable -> L32
android.content.res.Configuration r4 = r4.getConfiguration() // Catch: java.lang.Throwable -> L32
boolean r3 = r3.equals(r4) // Catch: java.lang.Throwable -> L32
if (r3 == 0) goto L42
android.content.res.Resources$Theme r5 = r5.mTheme // Catch: java.lang.Throwable -> L32
if (r5 != 0) goto L34
int r3 = r2.mThemeHash // Catch: java.lang.Throwable -> L32
if (r3 == 0) goto L3e
goto L34
L32:
r5 = move-exception
goto L48
L34:
if (r5 == 0) goto L42
int r3 = r2.mThemeHash // Catch: java.lang.Throwable -> L32
int r5 = r5.hashCode() // Catch: java.lang.Throwable -> L32
if (r3 != r5) goto L42
L3e:
android.content.res.ColorStateList r5 = r2.mValue // Catch: java.lang.Throwable -> L32
monitor-exit(r0) // Catch: java.lang.Throwable -> L32
return r5
L42:
r1.remove(r6) // Catch: java.lang.Throwable -> L32
L45:
monitor-exit(r0) // Catch: java.lang.Throwable -> L32
r5 = 0
return r5
L48:
monitor-exit(r0) // Catch: java.lang.Throwable -> L32
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.content.res.ResourcesCompat.getCachedColorStateList(androidx.core.content.res.ResourcesCompat$ColorStateListCacheKey, int):android.content.res.ColorStateList");
}
private static void addColorStateListToCache(@NonNull ColorStateListCacheKey colorStateListCacheKey, @ColorRes int i, @NonNull ColorStateList colorStateList, @Nullable Resources.Theme theme) {
synchronized (sColorStateCacheLock) {
try {
WeakHashMap<ColorStateListCacheKey, SparseArray<ColorStateListCacheEntry>> weakHashMap = sColorStateCaches;
SparseArray<ColorStateListCacheEntry> sparseArray = weakHashMap.get(colorStateListCacheKey);
if (sparseArray == null) {
sparseArray = new SparseArray<>();
weakHashMap.put(colorStateListCacheKey, sparseArray);
}
sparseArray.append(i, new ColorStateListCacheEntry(colorStateList, colorStateListCacheKey.mResources.getConfiguration(), theme));
} catch (Throwable th) {
throw th;
}
}
}
private static boolean isColorInt(@NonNull Resources resources, @ColorRes int i) {
TypedValue typedValue = getTypedValue();
resources.getValue(i, typedValue, true);
int i2 = typedValue.type;
return i2 >= 28 && i2 <= 31;
}
@NonNull
private static TypedValue getTypedValue() {
ThreadLocal<TypedValue> threadLocal = sTempTypedValue;
TypedValue typedValue = threadLocal.get();
if (typedValue != null) {
return typedValue;
}
TypedValue typedValue2 = new TypedValue();
threadLocal.set(typedValue2);
return typedValue2;
}
public static final class ColorStateListCacheKey {
final Resources mResources;
final Resources.Theme mTheme;
public ColorStateListCacheKey(@NonNull Resources resources, @Nullable Resources.Theme theme) {
this.mResources = resources;
this.mTheme = theme;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || ColorStateListCacheKey.class != obj.getClass()) {
return false;
}
ColorStateListCacheKey colorStateListCacheKey = (ColorStateListCacheKey) obj;
return this.mResources.equals(colorStateListCacheKey.mResources) && ObjectsCompat.equals(this.mTheme, colorStateListCacheKey.mTheme);
}
public int hashCode() {
return ObjectsCompat.hash(this.mResources, this.mTheme);
}
}
public static class ColorStateListCacheEntry {
final Configuration mConfiguration;
final int mThemeHash;
final ColorStateList mValue;
public ColorStateListCacheEntry(@NonNull ColorStateList colorStateList, @NonNull Configuration configuration, @Nullable Resources.Theme theme) {
this.mValue = colorStateList;
this.mConfiguration = configuration;
this.mThemeHash = theme == null ? 0 : theme.hashCode();
}
}
public static float getFloat(@NonNull Resources resources, @DimenRes int i) {
if (Build.VERSION.SDK_INT >= 29) {
return Api29Impl.getFloat(resources, i);
}
TypedValue typedValue = getTypedValue();
resources.getValue(i, typedValue, true);
if (typedValue.type == 4) {
return typedValue.getFloat();
}
throw new Resources.NotFoundException("Resource ID #0x" + Integer.toHexString(i) + " type #0x" + Integer.toHexString(typedValue.type) + " is not valid");
}
@Nullable
public static Typeface getFont(@NonNull Context context, @FontRes int i) throws Resources.NotFoundException {
if (context.isRestricted()) {
return null;
}
return loadFont(context, i, new TypedValue(), 0, null, null, false, false);
}
@Nullable
public static Typeface getCachedFont(@NonNull Context context, @FontRes int i) throws Resources.NotFoundException {
if (context.isRestricted()) {
return null;
}
return loadFont(context, i, new TypedValue(), 0, null, null, false, true);
}
public static abstract class FontCallback {
/* renamed from: onFontRetrievalFailed, reason: merged with bridge method [inline-methods] */
public abstract void lambda$callbackFailAsync$1(int i);
/* renamed from: onFontRetrieved, reason: merged with bridge method [inline-methods] */
public abstract void lambda$callbackSuccessAsync$0(@NonNull Typeface typeface);
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public final void callbackSuccessAsync(@NonNull final Typeface typeface, @Nullable Handler handler) {
getHandler(handler).post(new Runnable() { // from class: androidx.core.content.res.ResourcesCompat$FontCallback$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
ResourcesCompat.FontCallback.this.lambda$callbackSuccessAsync$0(typeface);
}
});
}
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public final void callbackFailAsync(final int i, @Nullable Handler handler) {
getHandler(handler).post(new Runnable() { // from class: androidx.core.content.res.ResourcesCompat$FontCallback$$ExternalSyntheticLambda1
@Override // java.lang.Runnable
public final void run() {
ResourcesCompat.FontCallback.this.lambda$callbackFailAsync$1(i);
}
});
}
@NonNull
@RestrictTo({RestrictTo.Scope.LIBRARY})
public static Handler getHandler(@Nullable Handler handler) {
return handler == null ? new Handler(Looper.getMainLooper()) : handler;
}
}
public static void getFont(@NonNull Context context, @FontRes int i, @NonNull FontCallback fontCallback, @Nullable Handler handler) throws Resources.NotFoundException {
Preconditions.checkNotNull(fontCallback);
if (context.isRestricted()) {
fontCallback.callbackFailAsync(-4, handler);
} else {
loadFont(context, i, new TypedValue(), 0, fontCallback, handler, false, false);
}
}
@Nullable
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
public static Typeface getFont(@NonNull Context context, @FontRes int i, @NonNull TypedValue typedValue, int i2, @Nullable FontCallback fontCallback) throws Resources.NotFoundException {
if (context.isRestricted()) {
return null;
}
return loadFont(context, i, typedValue, i2, fontCallback, null, true, false);
}
private static Typeface loadFont(@NonNull Context context, int i, @NonNull TypedValue typedValue, int i2, @Nullable FontCallback fontCallback, @Nullable Handler handler, boolean z, boolean z2) {
Resources resources = context.getResources();
resources.getValue(i, typedValue, true);
Typeface loadFont = loadFont(context, resources, typedValue, i, i2, fontCallback, handler, z, z2);
if (loadFont != null || fontCallback != null || z2) {
return loadFont;
}
throw new Resources.NotFoundException("Font resource ID #0x" + Integer.toHexString(i) + " could not be retrieved.");
}
/* JADX WARN: Removed duplicated region for block: B:40:0x00c1 */
/* JADX WARN: Removed duplicated region for block: B:42:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
private static android.graphics.Typeface loadFont(@androidx.annotation.NonNull android.content.Context r16, android.content.res.Resources r17, @androidx.annotation.NonNull android.util.TypedValue r18, int r19, int r20, @androidx.annotation.Nullable androidx.core.content.res.ResourcesCompat.FontCallback r21, @androidx.annotation.Nullable android.os.Handler r22, boolean r23, boolean r24) {
/*
Method dump skipped, instructions count: 245
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.core.content.res.ResourcesCompat.loadFont(android.content.Context, android.content.res.Resources, android.util.TypedValue, int, int, androidx.core.content.res.ResourcesCompat$FontCallback, android.os.Handler, boolean, boolean):android.graphics.Typeface");
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static float getFloat(@NonNull Resources resources, @DimenRes int i) {
return resources.getFloat(i);
}
}
@RequiresApi(23)
public static class Api23Impl {
private Api23Impl() {
}
@NonNull
public static ColorStateList getColorStateList(@NonNull Resources resources, @ColorRes int i, @Nullable Resources.Theme theme) {
return resources.getColorStateList(i, theme);
}
public static int getColor(Resources resources, int i, Resources.Theme theme) {
return resources.getColor(i, theme);
}
}
@RequiresApi(21)
public static class Api21Impl {
private Api21Impl() {
}
public static Drawable getDrawable(Resources resources, int i, Resources.Theme theme) {
return resources.getDrawable(i, theme);
}
public static Drawable getDrawableForDensity(Resources resources, int i, int i2, Resources.Theme theme) {
return resources.getDrawableForDensity(i, i2, theme);
}
}
private ResourcesCompat() {
}
public static final class ThemeCompat {
private ThemeCompat() {
}
public static void rebase(@NonNull Resources.Theme theme) {
if (Build.VERSION.SDK_INT >= 29) {
Api29Impl.rebase(theme);
} else {
Api23Impl.rebase(theme);
}
}
@RequiresApi(29)
public static class Api29Impl {
private Api29Impl() {
}
public static void rebase(@NonNull Resources.Theme theme) {
theme.rebase();
}
}
@RequiresApi(23)
public static class Api23Impl {
private static Method sRebaseMethod;
private static boolean sRebaseMethodFetched;
private static final Object sRebaseMethodLock = new Object();
private Api23Impl() {
}
@SuppressLint({"BanUncheckedReflection"})
public static void rebase(@NonNull Resources.Theme theme) {
synchronized (sRebaseMethodLock) {
if (!sRebaseMethodFetched) {
try {
Method declaredMethod = Resources.Theme.class.getDeclaredMethod("rebase", new Class[0]);
sRebaseMethod = declaredMethod;
declaredMethod.setAccessible(true);
} catch (NoSuchMethodException unused) {
}
sRebaseMethodFetched = true;
}
Method method = sRebaseMethod;
if (method != null) {
try {
method.invoke(theme, new Object[0]);
} catch (IllegalAccessException | InvocationTargetException unused2) {
sRebaseMethod = null;
}
}
}
}
}
}
}

View File

@@ -0,0 +1,22 @@
package androidx.core.content.res;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import androidx.annotation.RequiresApi;
import androidx.annotation.StyleableRes;
import kotlin.jvm.internal.Intrinsics;
@RequiresApi(26)
/* loaded from: classes.dex */
final class TypedArrayApi26ImplKt {
public static final TypedArrayApi26ImplKt INSTANCE = new TypedArrayApi26ImplKt();
private TypedArrayApi26ImplKt() {
}
public static final Typeface getFont(TypedArray typedArray, @StyleableRes int i) {
Typeface font = typedArray.getFont(i);
Intrinsics.checkNotNull(font);
return font;
}
}

View File

@@ -0,0 +1,124 @@
package androidx.core.content.res;
import android.content.res.ColorStateList;
import android.content.res.TypedArray;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import androidx.annotation.AnyRes;
import androidx.annotation.ColorInt;
import androidx.annotation.Dimension;
import androidx.annotation.RequiresApi;
import androidx.annotation.StyleableRes;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nTypedArray.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TypedArray.kt\nandroidx/core/content/res/TypedArrayKt\n+ 2 fake.kt\nkotlin/jvm/internal/FakeKt\n*L\n1#1,238:1\n1#2:239\n*E\n"})
/* loaded from: classes.dex */
public final class TypedArrayKt {
private static final void checkAttribute(TypedArray typedArray, @StyleableRes int i) {
if (!typedArray.hasValue(i)) {
throw new IllegalArgumentException("Attribute not defined in set.");
}
}
public static final boolean getBooleanOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getBoolean(i, false);
}
@ColorInt
public static final int getColorOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getColor(i, 0);
}
public static final ColorStateList getColorStateListOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
ColorStateList colorStateList = typedArray.getColorStateList(i);
if (colorStateList != null) {
return colorStateList;
}
throw new IllegalStateException("Attribute value was not a color or color state list.".toString());
}
public static final float getDimensionOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getDimension(i, 0.0f);
}
@Dimension
public static final int getDimensionPixelOffsetOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getDimensionPixelOffset(i, 0);
}
@Dimension
public static final int getDimensionPixelSizeOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getDimensionPixelSize(i, 0);
}
public static final Drawable getDrawableOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
Drawable drawable = typedArray.getDrawable(i);
Intrinsics.checkNotNull(drawable);
return drawable;
}
public static final float getFloatOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getFloat(i, 0.0f);
}
@RequiresApi(26)
public static final Typeface getFontOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return TypedArrayApi26ImplKt.getFont(typedArray, i);
}
public static final int getIntOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getInt(i, 0);
}
public static final int getIntegerOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getInteger(i, 0);
}
@AnyRes
public static final int getResourceIdOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getResourceId(i, 0);
}
public static final String getStringOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
String string = typedArray.getString(i);
if (string != null) {
return string;
}
throw new IllegalStateException("Attribute value could not be coerced to String.".toString());
}
public static final CharSequence getTextOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
CharSequence text = typedArray.getText(i);
if (text != null) {
return text;
}
throw new IllegalStateException("Attribute value could not be coerced to CharSequence.".toString());
}
public static final CharSequence[] getTextArrayOrThrow(TypedArray typedArray, @StyleableRes int i) {
checkAttribute(typedArray, i);
return typedArray.getTextArray(i);
}
public static final <R> R use(TypedArray typedArray, Function1 function1) {
R r = (R) function1.invoke(typedArray);
typedArray.recycle();
return r;
}
}

View File

@@ -0,0 +1,156 @@
package androidx.core.content.res;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.TypedValue;
import androidx.annotation.AnyRes;
import androidx.annotation.ColorInt;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.StyleableRes;
import org.xmlpull.v1.XmlPullParser;
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP_PREFIX})
/* loaded from: classes.dex */
public class TypedArrayUtils {
private static final String NAMESPACE = "http://schemas.android.com/apk/res/android";
public static boolean hasAttribute(@NonNull XmlPullParser xmlPullParser, @NonNull String str) {
return xmlPullParser.getAttributeValue(NAMESPACE, str) != null;
}
public static float getNamedFloat(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, float f) {
return !hasAttribute(xmlPullParser, str) ? f : typedArray.getFloat(i, f);
}
public static boolean getNamedBoolean(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, boolean z) {
return !hasAttribute(xmlPullParser, str) ? z : typedArray.getBoolean(i, z);
}
public static int getNamedInt(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, int i2) {
return !hasAttribute(xmlPullParser, str) ? i2 : typedArray.getInt(i, i2);
}
@ColorInt
public static int getNamedColor(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, @ColorInt int i2) {
return !hasAttribute(xmlPullParser, str) ? i2 : typedArray.getColor(i, i2);
}
public static ComplexColorCompat getNamedComplexColor(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @Nullable Resources.Theme theme, @NonNull String str, @StyleableRes int i, @ColorInt int i2) {
if (hasAttribute(xmlPullParser, str)) {
TypedValue typedValue = new TypedValue();
typedArray.getValue(i, typedValue);
int i3 = typedValue.type;
if (i3 >= 28 && i3 <= 31) {
return ComplexColorCompat.from(typedValue.data);
}
ComplexColorCompat inflate = ComplexColorCompat.inflate(typedArray.getResources(), typedArray.getResourceId(i, 0), theme);
if (inflate != null) {
return inflate;
}
}
return ComplexColorCompat.from(i2);
}
@Nullable
public static ColorStateList getNamedColorStateList(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @Nullable Resources.Theme theme, @NonNull String str, @StyleableRes int i) {
if (!hasAttribute(xmlPullParser, str)) {
return null;
}
TypedValue typedValue = new TypedValue();
typedArray.getValue(i, typedValue);
int i2 = typedValue.type;
if (i2 != 2) {
if (i2 >= 28 && i2 <= 31) {
return getNamedColorStateListFromInt(typedValue);
}
return ColorStateListInflaterCompat.inflate(typedArray.getResources(), typedArray.getResourceId(i, 0), theme);
}
throw new UnsupportedOperationException("Failed to resolve attribute at index " + i + ": " + typedValue);
}
@NonNull
private static ColorStateList getNamedColorStateListFromInt(@NonNull TypedValue typedValue) {
return ColorStateList.valueOf(typedValue.data);
}
@AnyRes
public static int getNamedResourceId(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i, @AnyRes int i2) {
return !hasAttribute(xmlPullParser, str) ? i2 : typedArray.getResourceId(i, i2);
}
@Nullable
public static String getNamedString(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, @StyleableRes int i) {
if (hasAttribute(xmlPullParser, str)) {
return typedArray.getString(i);
}
return null;
}
@Nullable
public static TypedValue peekNamedValue(@NonNull TypedArray typedArray, @NonNull XmlPullParser xmlPullParser, @NonNull String str, int i) {
if (hasAttribute(xmlPullParser, str)) {
return typedArray.peekValue(i);
}
return null;
}
@NonNull
public static TypedArray obtainAttributes(@NonNull Resources resources, @Nullable Resources.Theme theme, @NonNull AttributeSet attributeSet, @NonNull int[] iArr) {
if (theme == null) {
return resources.obtainAttributes(attributeSet, iArr);
}
return theme.obtainStyledAttributes(attributeSet, iArr, 0, 0);
}
public static boolean getBoolean(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2, boolean z) {
return typedArray.getBoolean(i, typedArray.getBoolean(i2, z));
}
@Nullable
public static Drawable getDrawable(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2) {
Drawable drawable = typedArray.getDrawable(i);
return drawable == null ? typedArray.getDrawable(i2) : drawable;
}
public static int getInt(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2, int i3) {
return typedArray.getInt(i, typedArray.getInt(i2, i3));
}
@AnyRes
public static int getResourceId(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2, @AnyRes int i3) {
return typedArray.getResourceId(i, typedArray.getResourceId(i2, i3));
}
@Nullable
public static String getString(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2) {
String string = typedArray.getString(i);
return string == null ? typedArray.getString(i2) : string;
}
@Nullable
public static CharSequence getText(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2) {
CharSequence text = typedArray.getText(i);
return text == null ? typedArray.getText(i2) : text;
}
@Nullable
public static CharSequence[] getTextArray(@NonNull TypedArray typedArray, @StyleableRes int i, @StyleableRes int i2) {
CharSequence[] textArray = typedArray.getTextArray(i);
return textArray == null ? typedArray.getTextArray(i2) : textArray;
}
public static int getAttr(@NonNull Context context, int i, int i2) {
TypedValue typedValue = new TypedValue();
context.getTheme().resolveAttribute(i, typedValue, true);
return typedValue.resourceId != 0 ? i : i2;
}
private TypedArrayUtils() {
}
}

View File

@@ -0,0 +1,111 @@
package androidx.core.content.res;
import androidx.annotation.NonNull;
/* loaded from: classes.dex */
final class ViewingConditions {
static final ViewingConditions DEFAULT = make(CamUtils.WHITE_POINT_D65, (float) ((CamUtils.yFromLStar(50.0f) * 63.66197723675813d) / 100.0d), 50.0f, 2.0f, false);
private final float mAw;
private final float mC;
private final float mFl;
private final float mFlRoot;
private final float mN;
private final float mNbb;
private final float mNc;
private final float mNcb;
private final float[] mRgbD;
private final float mZ;
public float getAw() {
return this.mAw;
}
public float getC() {
return this.mC;
}
public float getFl() {
return this.mFl;
}
public float getFlRoot() {
return this.mFlRoot;
}
public float getN() {
return this.mN;
}
public float getNbb() {
return this.mNbb;
}
public float getNc() {
return this.mNc;
}
public float getNcb() {
return this.mNcb;
}
@NonNull
public float[] getRgbD() {
return this.mRgbD;
}
public float getZ() {
return this.mZ;
}
private ViewingConditions(float f, float f2, float f3, float f4, float f5, float f6, float[] fArr, float f7, float f8, float f9) {
this.mN = f;
this.mAw = f2;
this.mNbb = f3;
this.mNcb = f4;
this.mC = f5;
this.mNc = f6;
this.mRgbD = fArr;
this.mFl = f7;
this.mFlRoot = f8;
this.mZ = f9;
}
@NonNull
public static ViewingConditions make(@NonNull float[] fArr, float f, float f2, float f3, boolean z) {
float[][] fArr2 = CamUtils.XYZ_TO_CAM16RGB;
float f4 = fArr[0];
float[] fArr3 = fArr2[0];
float f5 = fArr3[0] * f4;
float f6 = fArr[1];
float f7 = f5 + (fArr3[1] * f6);
float f8 = fArr[2];
float f9 = f7 + (fArr3[2] * f8);
float[] fArr4 = fArr2[1];
float f10 = (fArr4[0] * f4) + (fArr4[1] * f6) + (fArr4[2] * f8);
float[] fArr5 = fArr2[2];
float f11 = (f4 * fArr5[0]) + (f6 * fArr5[1]) + (f8 * fArr5[2]);
float f12 = (f3 / 10.0f) + 0.8f;
float lerp = ((double) f12) >= 0.9d ? CamUtils.lerp(0.59f, 0.69f, (f12 - 0.9f) * 10.0f) : CamUtils.lerp(0.525f, 0.59f, (f12 - 0.8f) * 10.0f);
float exp = z ? 1.0f : (1.0f - (((float) Math.exp(((-f) - 42.0f) / 92.0f)) * 0.2777778f)) * f12;
double d = exp;
if (d > 1.0d) {
exp = 1.0f;
} else if (d < 0.0d) {
exp = 0.0f;
}
float[] fArr6 = {(((100.0f / f9) * exp) + 1.0f) - exp, (((100.0f / f10) * exp) + 1.0f) - exp, (((100.0f / f11) * exp) + 1.0f) - exp};
float f13 = 1.0f / ((5.0f * f) + 1.0f);
float f14 = f13 * f13 * f13 * f13;
float f15 = 1.0f - f14;
float cbrt = (f14 * f) + (0.1f * f15 * f15 * ((float) Math.cbrt(f * 5.0d)));
float yFromLStar = CamUtils.yFromLStar(f2) / fArr[1];
double d2 = yFromLStar;
float sqrt = ((float) Math.sqrt(d2)) + 1.48f;
float pow = 0.725f / ((float) Math.pow(d2, 0.2d));
float pow2 = (float) Math.pow(((fArr6[2] * cbrt) * f11) / 100.0d, 0.42d);
float[] fArr7 = {(float) Math.pow(((fArr6[0] * cbrt) * f9) / 100.0d, 0.42d), (float) Math.pow(((fArr6[1] * cbrt) * f10) / 100.0d, 0.42d), pow2};
float f16 = fArr7[0];
float f17 = fArr7[1];
return new ViewingConditions(yFromLStar, ((((f16 * 400.0f) / (f16 + 27.13f)) * 2.0f) + ((f17 * 400.0f) / (f17 + 27.13f)) + (((400.0f * pow2) / (pow2 + 27.13f)) * 0.05f)) * pow, pow, pow, lerp, f12, fArr6, cbrt, (float) Math.pow(cbrt, 0.25d), sqrt);
}
}