package o; import android.content.BroadcastReceiver; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.res.ColorStateList; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.Process; import android.text.TextUtils; import android.util.Log; import android.util.TypedValue; import java.io.File; import java.util.concurrent.Executor; /* loaded from: classes.dex */ public class nMh { 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 sLock = new Object(); private static final Object sSync = new Object(); private static TypedValue sTempValue; public static String getAttributionTag(Context context) { if (Build.VERSION.SDK_INT >= 30) { return tOB.b(context); } return null; } public static boolean startActivities(Context context, Intent[] intentArr) { return startActivities(context, intentArr, null); } public static boolean startActivities(Context context, Intent[] intentArr, Bundle bundle) { LWm.nl_(context, intentArr, bundle); return true; } public static void startActivity(Context context, Intent intent, Bundle bundle) { LWm.nm_(context, intent, bundle); } public static File getDataDir(Context context) { return Sts.b(context); } public static File[] getObbDirs(Context context) { return RVV.a(context); } public static File[] getExternalFilesDirs(Context context, String str) { return RVV.e(context, str); } public static File[] getExternalCacheDirs(Context context) { return RVV.b(context); } public static Drawable getDrawable(Context context, int i) { return IeS.nn_(context, i); } public static ColorStateList getColorStateList(Context context, int i) { return kVs.nY_(context.getResources(), i, context.getTheme()); } public static int getColor(Context context, int i) { return HBt.c(context, i); } public static int checkSelfPermission(Context context, String str) { ZEY.c(str, "permission must be non-null"); if (C17488xFm.c() || !TextUtils.equals("android.permission.POST_NOTIFICATIONS", str)) { return context.checkPermission(str, Process.myPid(), Process.myUid()); } return vco.e(context).b() ? 0 : -1; } public static File getNoBackupFilesDir(Context context) { return IeS.a(context); } public static File getCodeCacheDir(Context context) { return IeS.e(context); } private static File createFilesDir(File file) { synchronized (sSync) { if (!file.exists()) { if (file.mkdirs()) { return file; } Log.w(TAG, "Unable to create files subdir " + file.getPath()); } return file; } } public static Context createDeviceProtectedStorageContext(Context context) { return Sts.a(context); } public static boolean isDeviceProtectedStorage(Context context) { return Sts.d(context); } public static Executor getMainExecutor(Context context) { if (Build.VERSION.SDK_INT >= 28) { return ojQ.a(context); } return qYE.qu_(new Handler(context.getMainLooper())); } public static void startForegroundService(Context context, Intent intent) { jbe.np_(context, intent); } public static T getSystemService(Context context, Class cls) { return (T) HBt.a(context, cls); } public static Intent registerReceiver(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, int i) { return registerReceiver(context, broadcastReceiver, intentFilter, null, null, i); } public static Intent registerReceiver(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, String str, 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 (C17488xFm.c()) { return ZqN.nq_(context, broadcastReceiver, intentFilter, str, handler, i3); } return jbe.no_(context, broadcastReceiver, intentFilter, str, handler, i3); } public static String getSystemServiceName(Context context, Class cls) { return HBt.b(context, cls); } static String obtainAndCheckReceiverPermission(Context context) { String str = context.getPackageName() + DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION_SUFFIX; if (C17730zKa.b(context, str) == 0) { return str; } throw new RuntimeException("Permission " + str + " is required by your application to receive broadcasts, please add it to your manifest"); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class LWm { static void nl_(Context context, Intent[] intentArr, Bundle bundle) { context.startActivities(intentArr, bundle); } static void nm_(Context context, Intent intent, Bundle bundle) { context.startActivity(intent, bundle); } } /* loaded from: classes.dex */ static class RVV { static File[] b(Context context) { return context.getExternalCacheDirs(); } static File[] e(Context context, String str) { return context.getExternalFilesDirs(str); } static File[] a(Context context) { return context.getObbDirs(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class IeS { static Drawable nn_(Context context, int i) { return context.getDrawable(i); } static File a(Context context) { return context.getNoBackupFilesDir(); } static File e(Context context) { return context.getCodeCacheDir(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class HBt { static int c(Context context, int i) { return context.getColor(i); } static T a(Context context, Class cls) { return (T) context.getSystemService(cls); } static String b(Context context, Class cls) { return context.getSystemServiceName(cls); } } /* loaded from: classes.dex */ static class Sts { static File b(Context context) { return context.getDataDir(); } static Context a(Context context) { return context.createDeviceProtectedStorageContext(); } static boolean d(Context context) { return context.isDeviceProtectedStorage(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class jbe { static Intent no_(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, String str, Handler handler, int i) { if ((i & 4) != 0 && str == null) { return context.registerReceiver(broadcastReceiver, intentFilter, nMh.obtainAndCheckReceiverPermission(context), handler); } return context.registerReceiver(broadcastReceiver, intentFilter, str, handler, i & 1); } static ComponentName np_(Context context, Intent intent) { return context.startForegroundService(intent); } } /* loaded from: classes.dex */ static class ojQ { static Executor a(Context context) { return context.getMainExecutor(); } } /* loaded from: classes.dex */ static class tOB { static String b(Context context) { return context.getAttributionTag(); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class ZqN { static Intent nq_(Context context, BroadcastReceiver broadcastReceiver, IntentFilter intentFilter, String str, Handler handler, int i) { return context.registerReceiver(broadcastReceiver, intentFilter, str, handler, i); } } }