102 lines
3.3 KiB
Java
102 lines
3.3 KiB
Java
package com.kofax.kmc.klo.logistics.service;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.ServiceConnection;
|
|
import android.os.IBinder;
|
|
import android.os.IInterface;
|
|
import android.os.Looper;
|
|
import android.os.Parcel;
|
|
import android.os.RemoteException;
|
|
import java.io.IOException;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public class CustomAdvertisingIdClient {
|
|
private static final String js = "com.google.android.gms.ads.identifier.service.START";
|
|
private static final String jt = "com.google.android.gms";
|
|
private static final String ju = "com.google.android.gms.ads.identifier.internal.IAdvertisingIdService";
|
|
|
|
public static String getAdvertisingIdInfo(Context context) throws Exception {
|
|
if (Looper.myLooper() == Looper.getMainLooper()) {
|
|
throw new IllegalStateException("Cannot be called from the main thread");
|
|
}
|
|
a aVar = new a();
|
|
Intent intent = new Intent(js);
|
|
intent.setPackage("com.google.android.gms");
|
|
try {
|
|
try {
|
|
if (context.getApplicationContext().bindService(intent, aVar, 1)) {
|
|
return new b(aVar.getBinder()).getId();
|
|
}
|
|
context.getApplicationContext().unbindService(aVar);
|
|
throw new IOException("Google Play connection failed");
|
|
} catch (Exception e) {
|
|
throw e;
|
|
}
|
|
} finally {
|
|
context.getApplicationContext().unbindService(aVar);
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes3.dex */
|
|
static class a implements ServiceConnection {
|
|
boolean jv;
|
|
private final LinkedBlockingQueue<IBinder> jw;
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceDisconnected(ComponentName componentName) {
|
|
}
|
|
|
|
private a() {
|
|
this.jv = false;
|
|
this.jw = new LinkedBlockingQueue<>(1);
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
try {
|
|
this.jw.put(iBinder);
|
|
} catch (InterruptedException unused) {
|
|
}
|
|
}
|
|
|
|
public IBinder getBinder() throws InterruptedException {
|
|
if (this.jv) {
|
|
throw new IllegalStateException();
|
|
}
|
|
this.jv = true;
|
|
return this.jw.take();
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes3.dex */
|
|
static class b implements IInterface {
|
|
private IBinder jx;
|
|
|
|
public b(IBinder iBinder) {
|
|
this.jx = iBinder;
|
|
}
|
|
|
|
public String getId() throws RemoteException {
|
|
Parcel obtain = Parcel.obtain();
|
|
Parcel obtain2 = Parcel.obtain();
|
|
try {
|
|
obtain.writeInterfaceToken(CustomAdvertisingIdClient.ju);
|
|
this.jx.transact(1, obtain, obtain2, 0);
|
|
obtain2.readException();
|
|
return obtain2.readString();
|
|
} finally {
|
|
obtain2.recycle();
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
|
|
@Override // android.os.IInterface
|
|
public IBinder asBinder() {
|
|
return this.jx;
|
|
}
|
|
}
|
|
}
|