- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
117 lines
4.4 KiB
Java
117 lines
4.4 KiB
Java
package com.singular.sdk.internal;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.ServiceConnection;
|
|
import android.os.Binder;
|
|
import android.os.IBinder;
|
|
import android.os.IInterface;
|
|
import android.os.Parcel;
|
|
import android.util.Log;
|
|
import java.util.concurrent.BlockingQueue;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public abstract class ExternalAIFAHelper {
|
|
public static String getAIFA(Context context) {
|
|
try {
|
|
return queryAdvertisingIdFromService(context);
|
|
} catch (Exception unused) {
|
|
Log.w("Singular/ExtAIFAHelper", "Could not determine AIFA");
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static String queryAdvertisingIdFromService(Context context) {
|
|
GoogleAdvertisingServiceConnection googleAdvertisingServiceConnection = new GoogleAdvertisingServiceConnection();
|
|
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
|
|
intent.setPackage("com.google.android.gms");
|
|
if (!context.bindService(intent, googleAdvertisingServiceConnection, 1)) {
|
|
return "";
|
|
}
|
|
try {
|
|
return GoogleAdvertisingInfo.GoogleAdvertisingInfoBinder.Create(googleAdvertisingServiceConnection.getBinder()).getId();
|
|
} catch (Exception unused) {
|
|
return "";
|
|
} finally {
|
|
context.unbindService(googleAdvertisingServiceConnection);
|
|
}
|
|
}
|
|
|
|
public static class GoogleAdvertisingServiceConnection implements ServiceConnection {
|
|
public final BlockingQueue _binderQueue;
|
|
public boolean _consumed;
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceDisconnected(ComponentName componentName) {
|
|
}
|
|
|
|
public GoogleAdvertisingServiceConnection() {
|
|
this._consumed = false;
|
|
this._binderQueue = new LinkedBlockingQueue();
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
try {
|
|
this._binderQueue.put(iBinder);
|
|
} catch (InterruptedException unused) {
|
|
}
|
|
}
|
|
|
|
public IBinder getBinder() {
|
|
if (this._consumed) {
|
|
throw new IllegalStateException();
|
|
}
|
|
this._consumed = true;
|
|
return (IBinder) this._binderQueue.take();
|
|
}
|
|
}
|
|
|
|
public interface GoogleAdvertisingInfo extends IInterface {
|
|
String getId();
|
|
|
|
public static abstract class GoogleAdvertisingInfoBinder extends Binder implements GoogleAdvertisingInfo {
|
|
public static GoogleAdvertisingInfo Create(IBinder iBinder) {
|
|
if (iBinder == null) {
|
|
return null;
|
|
}
|
|
IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
|
|
if (queryLocalInterface != null && (queryLocalInterface instanceof GoogleAdvertisingInfo)) {
|
|
return (GoogleAdvertisingInfo) queryLocalInterface;
|
|
}
|
|
return new GoogleAdvertisingInfoImplementation(iBinder);
|
|
}
|
|
|
|
public static class GoogleAdvertisingInfoImplementation implements GoogleAdvertisingInfo {
|
|
public IBinder _binder;
|
|
|
|
@Override // android.os.IInterface
|
|
public IBinder asBinder() {
|
|
return this._binder;
|
|
}
|
|
|
|
public GoogleAdvertisingInfoImplementation(IBinder iBinder) {
|
|
this._binder = iBinder;
|
|
}
|
|
|
|
@Override // com.singular.sdk.internal.ExternalAIFAHelper.GoogleAdvertisingInfo
|
|
public String getId() {
|
|
Parcel obtain = Parcel.obtain();
|
|
Parcel obtain2 = Parcel.obtain();
|
|
try {
|
|
obtain.writeInterfaceToken("com.google.android.gms.ads.identifier.internal.IAdvertisingIdService");
|
|
this._binder.transact(1, obtain, obtain2, 0);
|
|
obtain2.readException();
|
|
return obtain2.readString();
|
|
} finally {
|
|
obtain2.recycle();
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|