package com.tapjoy; import android.content.Context; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import com.tapjoy.TJAdUnitConstants; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; import kotlin.collections.CollectionsKt__CollectionsKt; import kotlin.collections.CollectionsKt__IterablesKt; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; @SourceDebugExtension({"SMAP\nTJIntegrationCheck.kt\nKotlin\n*S Kotlin\n*F\n+ 1 TJIntegrationCheck.kt\ncom/tapjoy/TJIntegrationCheck\n+ 2 _Collections.kt\nkotlin/collections/CollectionsKt___CollectionsKt\n*L\n1#1,201:1\n1549#2:202\n1620#2,3:203\n*S KotlinDebug\n*F\n+ 1 TJIntegrationCheck.kt\ncom/tapjoy/TJIntegrationCheck\n*L\n76#1:202\n76#1:203,3\n*E\n"}) /* loaded from: classes4.dex */ public final class TJIntegrationCheck { public static final TJIntegrationCheck INSTANCE = new TJIntegrationCheck(); public static final String[] a = {"android.permission.INTERNET", "android.permission.ACCESS_NETWORK_STATE"}; public static final List b; public final void integrationCheck(Context context) { List listOf; Intrinsics.checkNotNullParameter(context, "context"); try { ActivityInfo[] activities = context.getPackageManager().getPackageInfo(context.getPackageName(), 1).activities; Intrinsics.checkNotNullExpressionValue(activities, "activities"); listOf = CollectionsKt__CollectionsKt.listOf(Arrays.copyOf(activities, activities.length)); a(listOf); for (ActivityInfo activityInfo : listOf) { Intrinsics.checkNotNull(activityInfo); a(activityInfo); } a(context); try { Intrinsics.checkNotNullExpressionValue(TJAdUnitJSBridge.class, "forName(...)"); try { TJAdUnitJSBridge.class.getMethod(TJAdUnitConstants.String.CLOSE_REQUESTED, (Class[]) Arrays.copyOf(new Class[]{Boolean.TRUE.getClass()}, 1)); if (Intrinsics.areEqual(TapjoyConnectCore.getInstance().getConnectFlagValue(TapjoyConnectFlag.DISABLE_ADVERTISING_ID_CHECK), "true")) { TapjoyLog.i("TJIntegrationCheck", "Skipping integration check for Google Play Services and Advertising ID. Do this only if you do not have access to Google Play Services."); return; } TJTracking tJTracking = TJTracking.INSTANCE; if (!tJTracking.isGpsAvailable()) { throw new TapjoyIntegrationException("Tapjoy SDK is disabled because Google Play Services was not found. For more information about including the Google Play services client library visit https://developers.google.com/android/guides/setup or https://dev.tapjoy.com/en/android-sdk/Manual-Integration"); } if (!tJTracking.isGpsManifestConfigured()) { throw new TapjoyIntegrationException("Failed to load AndroidManifest.xml meta-data, 'com.google.android.gms.version' not found. For more information about including the Google Play services client library visit https://developers.google.com/android/guides/setup or https://dev.tapjoy.com/en/android-sdk/Manual-Integration"); } } catch (NoSuchMethodException unused) { throw new TapjoyIntegrationException("Try configuring Proguard or other code obfuscation tools to ignore com.tapjoy classes. Visit http://dev.tapjoy.com for more information."); } } catch (ClassNotFoundException unused2) { throw new TapjoyIntegrationException("ClassNotFoundException: com.tapjoy.TJAdUnitJSBridge was not found."); } } catch (PackageManager.NameNotFoundException unused3) { throw new TapjoyIntegrationException("Error while getting package info."); } } static { List listOf; listOf = CollectionsKt__CollectionsKt.listOf((Object[]) new String[]{"com.tapjoy.TJAdUnitActivity", "com.tapjoy.TJWebViewActivity"}); b = listOf; } public static void a(List list) { int i = 0; String str = ""; for (String str2 : b) { ArrayList arrayList = new ArrayList(CollectionsKt__IterablesKt.collectionSizeOrDefault(list, 10)); Iterator it = list.iterator(); while (it.hasNext()) { arrayList.add(((ActivityInfo) it.next()).name); } if (!arrayList.contains(str2)) { str = str + (i > 0 ? ", " : "") + str2; i++; } } if (str.length() > 0) { throw new TapjoyIntegrationException("Missing " + str + " " + (i == 1 ? "activity" : "activities") + " in AndroidManifest."); } } public static void a(Context context) { ArrayList arrayList = new ArrayList(); String[] strArr = a; for (int i = 0; i < 2; i++) { String str = strArr[i]; if (context.getPackageManager().checkPermission(str, context.getPackageName()) != 0) { arrayList.add(str); } } if (arrayList.isEmpty()) { return; } throw new TapjoyIntegrationException("Missing " + (arrayList.size() == 1 ? "permission" : "permissions") + " in AndroidManifest: " + arrayList); } public static void a(ActivityInfo activityInfo) { List list = b; if (list.contains(activityInfo.name)) { int indexOf = list.indexOf(activityInfo.name); try { Class.forName((String) list.get(indexOf)); ArrayList arrayList = new ArrayList(); if ((activityInfo.configChanges & 128) != 128) { arrayList.add("orientation"); } if ((activityInfo.configChanges & 32) != 32) { arrayList.add("keyboardHidden"); } if (!arrayList.isEmpty()) { throw new TapjoyIntegrationException(arrayList + " " + (arrayList.size() == 1 ? "property is" : "properties are") + " not specified in AndroidManifest configChanges for " + list.get(indexOf)); } if ((activityInfo.flags & 512) == 512) { if ((activityInfo.configChanges & 1024) != 1024) { TapjoyLog.w("TJIntegrationCheck", "WARNING -- screenSize property is not specified in AndroidManifest configChanges for " + list.get(indexOf)); return; } return; } throw new TapjoyIntegrationException("'hardwareAccelerated' property not specified in AndroidManifest for " + list.get(indexOf)); } catch (ClassNotFoundException unused) { throw new TapjoyIntegrationException("[ClassNotFoundException] Could not find dependency class " + b.get(indexOf)); } } } }