jimu-decompiled/sources/io/fabric/sdk/android/services/common/AdvertisingInfoReflectionStrategy.java
2025-05-13 19:24:51 +02:00

57 lines
2.2 KiB
Java

package io.fabric.sdk.android.services.common;
import android.content.Context;
import io.fabric.sdk.android.Fabric;
/* loaded from: classes2.dex */
class AdvertisingInfoReflectionStrategy implements AdvertisingInfoStrategy {
private final Context a;
public AdvertisingInfoReflectionStrategy(Context context) {
this.a = context.getApplicationContext();
}
private String b() {
try {
return (String) Class.forName("com.google.android.gms.ads.identifier.AdvertisingIdClient$Info").getMethod("getId", new Class[0]).invoke(c(), new Object[0]);
} catch (Exception unused) {
Fabric.g().w("Fabric", "Could not call getId on com.google.android.gms.ads.identifier.AdvertisingIdClient$Info");
return null;
}
}
private Object c() {
try {
return Class.forName("com.google.android.gms.ads.identifier.AdvertisingIdClient").getMethod("getAdvertisingIdInfo", Context.class).invoke(null, this.a);
} catch (Exception unused) {
Fabric.g().w("Fabric", "Could not call getAdvertisingIdInfo on com.google.android.gms.ads.identifier.AdvertisingIdClient");
return null;
}
}
private boolean d() {
try {
return ((Boolean) Class.forName("com.google.android.gms.ads.identifier.AdvertisingIdClient$Info").getMethod("isLimitAdTrackingEnabled", new Class[0]).invoke(c(), new Object[0])).booleanValue();
} catch (Exception unused) {
Fabric.g().w("Fabric", "Could not call isLimitAdTrackingEnabled on com.google.android.gms.ads.identifier.AdvertisingIdClient$Info");
return false;
}
}
boolean a(Context context) {
try {
return ((Integer) Class.forName("com.google.android.gms.common.GooglePlayServicesUtil").getMethod("isGooglePlayServicesAvailable", Context.class).invoke(null, context)).intValue() == 0;
} catch (Exception unused) {
return false;
}
}
@Override // io.fabric.sdk.android.services.common.AdvertisingInfoStrategy
public AdvertisingInfo a() {
if (a(this.a)) {
return new AdvertisingInfo(b(), d());
}
return null;
}
}