package com.applovin.impl.sdk.utils; import android.content.ContentResolver; import android.content.Context; import android.provider.Settings; import androidx.annotation.Nullable; import com.applovin.impl.sdk.p; import com.applovin.impl.sdk.w; import com.applovin.sdk.AppLovinSdkUtils; import com.google.android.gms.ads.identifier.AdvertisingIdClient; import java.util.Collection; import java.util.HashSet; import java.util.concurrent.CountDownLatch; public class c { /* renamed from: a reason: collision with root package name */ private static boolean f4059a = true; /* renamed from: b reason: collision with root package name */ private static final Object f4060b = new Object(); /* renamed from: c reason: collision with root package name */ private static final Collection<CountDownLatch> f4061c = new HashSet(); /* renamed from: d reason: collision with root package name */ private static boolean f4062d = false; /* renamed from: e reason: collision with root package name */ private static p.a f4063e = null; @Nullable public static p.a a(Context context) { return b(context); } public static boolean a() { return Utils.checkClassExistence("com.google.android.gms.ads.identifier.AdvertisingIdClient"); } /* JADX WARNING: Code restructure failed: missing block: B:10:0x001b, code lost: if (r2 == false) goto L_0x0046; */ /* JADX WARNING: Code restructure failed: missing block: B:11:0x001d, code lost: r5 = c(r5); */ /* JADX WARNING: Code restructure failed: missing block: B:12:0x0021, code lost: monitor-enter(r0); */ /* JADX WARNING: Code restructure failed: missing block: B:14:?, code lost: com.applovin.impl.sdk.utils.c.f4062d = true; com.applovin.impl.sdk.utils.c.f4063e = r5; r5 = new java.util.HashSet(r1); r1.clear(); */ /* JADX WARNING: Code restructure failed: missing block: B:15:0x002e, code lost: monitor-exit(r0); */ /* JADX WARNING: Code restructure failed: missing block: B:16:0x002f, code lost: r5 = r5.iterator(); */ /* JADX WARNING: Code restructure failed: missing block: B:18:0x0037, code lost: if (r5.hasNext() == false) goto L_0x0046; */ /* JADX WARNING: Code restructure failed: missing block: B:19:0x0039, code lost: ((java.util.concurrent.CountDownLatch) r5.next()).countDown(); */ /* JADX WARNING: Code restructure failed: missing block: B:26:0x004e, code lost: if (r3.await(60, java.util.concurrent.TimeUnit.SECONDS) != false) goto L_0x006c; */ /* JADX WARNING: Code restructure failed: missing block: B:28:0x0054, code lost: if (com.applovin.impl.sdk.w.a() == false) goto L_0x006c; */ /* JADX WARNING: Code restructure failed: missing block: B:29:0x0056, code lost: com.applovin.impl.sdk.w.i("DataCollector", "Could not collect Google Advertising ID - this will negatively impact your eCPMs! Please integrate the Google Play Services SDK into your application. More info can be found online at http://developer.android.com/google/play-services/setup.html. If you're sure you've integrated the SDK and are still seeing this message, you may need to add a ProGuard exception: -keep public class com.google.android.gms.** { public protected *; }: collection timeout"); */ /* JADX WARNING: Code restructure failed: missing block: B:30:0x005e, code lost: r5 = move-exception; */ /* JADX WARNING: Code restructure failed: missing block: B:32:0x0063, code lost: if (com.applovin.impl.sdk.w.a() != false) goto L_0x0065; */ /* JADX WARNING: Code restructure failed: missing block: B:33:0x0065, code lost: com.applovin.impl.sdk.w.c("DataCollector", "Could not collect Google Advertising ID - this will negatively impact your eCPMs! Please integrate the Google Play Services SDK into your application. More info can be found online at http://developer.android.com/google/play-services/setup.html. If you're sure you've integrated the SDK and are still seeing this message, you may need to add a ProGuard exception: -keep public class com.google.android.gms.** { public protected *; }", r5); */ /* JADX WARNING: Code restructure failed: missing block: B:34:0x006c, code lost: r5 = com.applovin.impl.sdk.utils.c.f4060b; */ /* JADX WARNING: Code restructure failed: missing block: B:35:0x006e, code lost: monitor-enter(r5); */ /* JADX WARNING: Code restructure failed: missing block: B:37:?, code lost: r0 = com.applovin.impl.sdk.utils.c.f4063e; */ /* JADX WARNING: Code restructure failed: missing block: B:38:0x0071, code lost: monitor-exit(r5); */ /* JADX WARNING: Code restructure failed: missing block: B:39:0x0072, code lost: return r0; */ @Nullable private static p.a b(Context context) { Object obj = f4060b; synchronized (obj) { if (f4062d) { return f4063e; } Collection<CountDownLatch> collection = f4061c; boolean isEmpty = collection.isEmpty(); CountDownLatch countDownLatch = new CountDownLatch(1); collection.add(countDownLatch); } } private static p.a c(Context context) { p.a d10 = d(context); if (d10 == null) { d10 = e(context); } return d10 == null ? new p.a() : d10; } @Nullable private static p.a d(Context context) { if (a()) { try { p.a aVar = new p.a(); AdvertisingIdClient.Info advertisingIdInfo = AdvertisingIdClient.getAdvertisingIdInfo(context); aVar.f4022a = advertisingIdInfo.isLimitAdTrackingEnabled(); aVar.f4023b = advertisingIdInfo.getId(); return aVar; } catch (Throwable th) { if (AppLovinSdkUtils.isFireOS(context) || !w.a()) { return null; } w.c("DataCollector", "Could not collect Google Advertising ID - this will negatively impact your eCPMs! Please integrate the Google Play Services SDK into your application. More info can be found online at http://developer.android.com/google/play-services/setup.html. If you're sure you've integrated the SDK and are still seeing this message, you may need to add a ProGuard exception: -keep public class com.google.android.gms.** { public protected *; }", th); return null; } } else if (AppLovinSdkUtils.isFireOS(context) || !w.a()) { return null; } else { w.i("DataCollector", "Could not collect Google Advertising ID - this will negatively impact your eCPMs! Please integrate the Google Play Services SDK into your application. More info can be found online at http://developer.android.com/google/play-services/setup.html. If you're sure you've integrated the SDK and are still seeing this message, you may need to add a ProGuard exception: -keep public class com.google.android.gms.** { public protected *; }"); return null; } } @Nullable private static p.a e(Context context) { String str; if (f4059a) { try { ContentResolver contentResolver = context.getContentResolver(); p.a aVar = new p.a(); aVar.f4023b = StringUtils.emptyIfNull(Settings.Secure.getString(contentResolver, "advertising_id")); aVar.f4022a = Settings.Secure.getInt(contentResolver, "limit_ad_tracking") != 0; return aVar; } catch (Settings.SettingNotFoundException e10) { th = e10; if (w.a()) { str = "Unable to determine if Fire OS limited ad tracking is turned on"; w.c("DataCollector", str, th); } } catch (Throwable th) { th = th; if (w.a()) { str = "Unable to collect Fire OS IDFA"; w.c("DataCollector", str, th); } } } f4059a = false; return null; } }