package com.applovin.impl; import android.content.ContentResolver; import android.content.Context; import android.provider.Settings; import androidx.annotation.Nullable; import com.applovin.impl.sdk.utils.StringUtils; import com.applovin.sdk.AppLovinSdkUtils; import com.google.android.gms.ads.identifier.AdvertisingIdClient; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; /* loaded from: classes.dex */ public abstract class l0 { private static boolean a = true; private static final Object b = new Object(); private static final Collection c = new HashSet(); private static boolean d = false; private static a e = null; private static a a(Context context) { a aVar; HashSet hashSet; yp.a(); Object obj = b; synchronized (obj) { try { if (d) { return e; } Collection collection = c; boolean isEmpty = collection.isEmpty(); CountDownLatch countDownLatch = new CountDownLatch(1); collection.add(countDownLatch); if (isEmpty) { a c2 = c(context); synchronized (obj) { d = true; e = c2; hashSet = new HashSet(collection); collection.clear(); } Iterator it = hashSet.iterator(); while (it.hasNext()) { ((CountDownLatch) it.next()).countDown(); } } try { if (!countDownLatch.await(60L, TimeUnit.SECONDS)) { com.applovin.impl.sdk.n.h("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"); } } catch (InterruptedException e2) { com.applovin.impl.sdk.n.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 *; }", e2); } synchronized (b) { aVar = e; } return aVar; } catch (Throwable th) { throw th; } } } @Nullable private static a collectGoogleAdvertisingInfo(Context context) { yp.a(); if (!a()) { if (AppLovinSdkUtils.isFireOS(context)) { return null; } com.applovin.impl.sdk.n.h("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; } try { a aVar = new a(); AdvertisingIdClient.Info advertisingIdInfo = AdvertisingIdClient.getAdvertisingIdInfo(context); boolean isLimitAdTrackingEnabled = advertisingIdInfo.isLimitAdTrackingEnabled(); aVar.a(isLimitAdTrackingEnabled); aVar.a(isLimitAdTrackingEnabled ? a.EnumC0022a.ON : a.EnumC0022a.OFF); aVar.a(advertisingIdInfo.getId()); return aVar; } catch (Throwable th) { if (AppLovinSdkUtils.isFireOS(context)) { return null; } com.applovin.impl.sdk.n.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; } } @Nullable private static a collectFireOSAdvertisingInfo(Context context) { a.EnumC0022a enumC0022a; if (a) { try { ContentResolver contentResolver = context.getContentResolver(); a aVar = new a(); aVar.a(StringUtils.emptyIfNull(Settings.Secure.getString(contentResolver, "advertising_id"))); boolean z = Settings.Secure.getInt(contentResolver, "limit_ad_tracking") != 0; aVar.a(z); if (z) { enumC0022a = a.EnumC0022a.ON; } else { enumC0022a = a.EnumC0022a.OFF; } aVar.a(enumC0022a); return aVar; } catch (Settings.SettingNotFoundException e2) { com.applovin.impl.sdk.n.c("DataCollector", "Unable to determine if Fire OS limited ad tracking is turned on", e2); } catch (Throwable th) { com.applovin.impl.sdk.n.c("DataCollector", "Unable to collect Fire OS IDFA", th); } } a = false; return null; } public static a b(Context context) { return a(context); } public static boolean a() { return yp.a("com.google.android.gms.ads.identifier.AdvertisingIdClient"); } private static a c(Context context) { a collectGoogleAdvertisingInfo = collectGoogleAdvertisingInfo(context); if (collectGoogleAdvertisingInfo == null) { collectGoogleAdvertisingInfo = collectFireOSAdvertisingInfo(context); } return collectGoogleAdvertisingInfo == null ? new a() : collectGoogleAdvertisingInfo; } public static class a { private boolean a; private String b = ""; private EnumC0022a c = EnumC0022a.NOT_SET; public String a() { return this.b; } public void a(EnumC0022a enumC0022a) { this.c = enumC0022a; } public void a(String str) { this.b = str; } public void a(boolean z) { this.a = z; } public EnumC0022a b() { return this.c; } public boolean c() { return this.a; } public String toString() { return "AdvertisingInfoCollector.AdvertisingIdInformation(adTrackingLimited=" + c() + ", advertisingId=" + a() + ", dntCode=" + b() + ")"; } public boolean a(Object obj) { return obj instanceof a; } public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof a)) { return false; } a aVar = (a) obj; if (!aVar.a(this) || c() != aVar.c()) { return false; } String a = a(); String a2 = aVar.a(); if (a != null ? !a.equals(a2) : a2 != null) { return false; } EnumC0022a b = b(); EnumC0022a b2 = aVar.b(); return b != null ? b.equals(b2) : b2 == null; } public int hashCode() { int i = c() ? 79 : 97; String a = a(); int hashCode = ((i + 59) * 59) + (a == null ? 43 : a.hashCode()); EnumC0022a b = b(); return (hashCode * 59) + (b != null ? b.hashCode() : 43); } /* renamed from: com.applovin.impl.l0$a$a, reason: collision with other inner class name */ public enum EnumC0022a { NOT_SET("dnt_not_set"), ON("dnt_on"), OFF("dnt_off"); private final String a; public String b() { return this.a; } EnumC0022a(String str) { this.a = str; } } } }