207 lines
8.4 KiB
Java
207 lines
8.4 KiB
Java
package com.facebook.internal;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.ServiceConnection;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.IBinder;
|
|
import android.os.IInterface;
|
|
import android.os.Looper;
|
|
import android.os.Parcel;
|
|
import android.os.RemoteException;
|
|
import com.facebook.FacebookException;
|
|
import java.lang.reflect.Method;
|
|
import java.util.concurrent.BlockingQueue;
|
|
import java.util.concurrent.LinkedBlockingDeque;
|
|
import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class AttributionIdentifiers {
|
|
private static final String f = "com.facebook.internal.AttributionIdentifiers";
|
|
private static AttributionIdentifiers g;
|
|
private String a;
|
|
private String b;
|
|
private String c;
|
|
private boolean d;
|
|
private long e;
|
|
|
|
private static final class GoogleAdInfo implements IInterface {
|
|
private IBinder a;
|
|
|
|
GoogleAdInfo(IBinder iBinder) {
|
|
this.a = iBinder;
|
|
}
|
|
|
|
@Override // android.os.IInterface
|
|
public IBinder asBinder() {
|
|
return this.a;
|
|
}
|
|
|
|
public String i() throws RemoteException {
|
|
Parcel obtain = Parcel.obtain();
|
|
Parcel obtain2 = Parcel.obtain();
|
|
try {
|
|
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
|
|
this.a.transact(1, obtain, obtain2, 0);
|
|
obtain2.readException();
|
|
return obtain2.readString();
|
|
} finally {
|
|
obtain2.recycle();
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
|
|
public boolean j() throws RemoteException {
|
|
Parcel obtain = Parcel.obtain();
|
|
Parcel obtain2 = Parcel.obtain();
|
|
try {
|
|
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
|
|
obtain.writeInt(1);
|
|
this.a.transact(2, obtain, obtain2, 0);
|
|
obtain2.readException();
|
|
return obtain2.readInt() != 0;
|
|
} finally {
|
|
obtain2.recycle();
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
}
|
|
|
|
private static final class GoogleAdServiceConnection implements ServiceConnection {
|
|
private AtomicBoolean a;
|
|
private final BlockingQueue<IBinder> b;
|
|
|
|
private GoogleAdServiceConnection() {
|
|
this.a = new AtomicBoolean(false);
|
|
this.b = new LinkedBlockingDeque();
|
|
}
|
|
|
|
public IBinder a() throws InterruptedException {
|
|
if (this.a.compareAndSet(true, true)) {
|
|
throw new IllegalStateException("Binder already consumed");
|
|
}
|
|
return this.b.take();
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
if (iBinder != null) {
|
|
try {
|
|
this.b.put(iBinder);
|
|
} catch (InterruptedException unused) {
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceDisconnected(ComponentName componentName) {
|
|
}
|
|
}
|
|
|
|
private static AttributionIdentifiers a(Context context) {
|
|
AttributionIdentifiers b = b(context);
|
|
if (b != null) {
|
|
return b;
|
|
}
|
|
AttributionIdentifiers c = c(context);
|
|
return c == null ? new AttributionIdentifiers() : c;
|
|
}
|
|
|
|
private static AttributionIdentifiers b(Context context) {
|
|
Method a;
|
|
Object a2;
|
|
try {
|
|
if (Looper.myLooper() == Looper.getMainLooper()) {
|
|
throw new FacebookException("getAndroidId cannot be called on the main thread.");
|
|
}
|
|
Method a3 = Utility.a("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", (Class<?>[]) new Class[]{Context.class});
|
|
if (a3 == null) {
|
|
return null;
|
|
}
|
|
Object a4 = Utility.a((Object) null, a3, context);
|
|
if (!(a4 instanceof Integer) || ((Integer) a4).intValue() != 0 || (a = Utility.a("com.google.android.gms.ads.identifier.AdvertisingIdClient", "getAdvertisingIdInfo", (Class<?>[]) new Class[]{Context.class})) == null || (a2 = Utility.a((Object) null, a, context)) == null) {
|
|
return null;
|
|
}
|
|
Method a5 = Utility.a(a2.getClass(), "getId", (Class<?>[]) new Class[0]);
|
|
Method a6 = Utility.a(a2.getClass(), "isLimitAdTrackingEnabled", (Class<?>[]) new Class[0]);
|
|
if (a5 != null && a6 != null) {
|
|
AttributionIdentifiers attributionIdentifiers = new AttributionIdentifiers();
|
|
attributionIdentifiers.b = (String) Utility.a(a2, a5, new Object[0]);
|
|
attributionIdentifiers.d = ((Boolean) Utility.a(a2, a6, new Object[0])).booleanValue();
|
|
return attributionIdentifiers;
|
|
}
|
|
return null;
|
|
} catch (Exception e) {
|
|
Utility.a("android_id", e);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static AttributionIdentifiers c(Context context) {
|
|
GoogleAdServiceConnection googleAdServiceConnection = new GoogleAdServiceConnection();
|
|
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
|
|
intent.setPackage("com.google.android.gms");
|
|
if (context.bindService(intent, googleAdServiceConnection, 1)) {
|
|
try {
|
|
GoogleAdInfo googleAdInfo = new GoogleAdInfo(googleAdServiceConnection.a());
|
|
AttributionIdentifiers attributionIdentifiers = new AttributionIdentifiers();
|
|
attributionIdentifiers.b = googleAdInfo.i();
|
|
attributionIdentifiers.d = googleAdInfo.j();
|
|
return attributionIdentifiers;
|
|
} catch (Exception e) {
|
|
Utility.a("android_id", e);
|
|
} finally {
|
|
context.unbindService(googleAdServiceConnection);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
/* JADX WARN: Removed duplicated region for block: B:18:0x0064 A[Catch: all -> 0x00c7, Exception -> 0x00c9, TryCatch #5 {Exception -> 0x00c9, all -> 0x00c7, blocks: (B:12:0x0031, B:14:0x0042, B:16:0x005e, B:18:0x0064, B:20:0x0068, B:22:0x006c, B:57:0x004a, B:59:0x0056), top: B:11:0x0031 }] */
|
|
/* JADX WARN: Removed duplicated region for block: B:20:0x0068 A[Catch: all -> 0x00c7, Exception -> 0x00c9, TryCatch #5 {Exception -> 0x00c9, all -> 0x00c7, blocks: (B:12:0x0031, B:14:0x0042, B:16:0x005e, B:18:0x0064, B:20:0x0068, B:22:0x006c, B:57:0x004a, B:59:0x0056), top: B:11:0x0031 }] */
|
|
/* JADX WARN: Removed duplicated region for block: B:22:0x006c A[Catch: all -> 0x00c7, Exception -> 0x00c9, TRY_LEAVE, TryCatch #5 {Exception -> 0x00c9, all -> 0x00c7, blocks: (B:12:0x0031, B:14:0x0042, B:16:0x005e, B:18:0x0064, B:20:0x0068, B:22:0x006c, B:57:0x004a, B:59:0x0056), top: B:11:0x0031 }] */
|
|
/* JADX WARN: Removed duplicated region for block: B:53:0x00ef */
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
public static com.facebook.internal.AttributionIdentifiers d(android.content.Context r12) {
|
|
/*
|
|
Method dump skipped, instructions count: 243
|
|
To view this dump change 'Code comments level' option to 'DEBUG'
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.facebook.internal.AttributionIdentifiers.d(android.content.Context):com.facebook.internal.AttributionIdentifiers");
|
|
}
|
|
|
|
private static String e(Context context) {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (packageManager != null) {
|
|
return packageManager.getInstallerPackageName(context.getPackageName());
|
|
}
|
|
return null;
|
|
}
|
|
|
|
private static AttributionIdentifiers a(AttributionIdentifiers attributionIdentifiers) {
|
|
attributionIdentifiers.e = System.currentTimeMillis();
|
|
g = attributionIdentifiers;
|
|
return attributionIdentifiers;
|
|
}
|
|
|
|
public String a() {
|
|
return this.b;
|
|
}
|
|
|
|
public String c() {
|
|
return this.a;
|
|
}
|
|
|
|
public String b() {
|
|
return this.c;
|
|
}
|
|
|
|
public boolean d() {
|
|
return this.d;
|
|
}
|
|
}
|