- 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
176 lines
7.4 KiB
Java
176 lines
7.4 KiB
Java
package com.glu.plugins.gluanalytics.util;
|
|
|
|
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.os.RemoteException;
|
|
import android.text.TextUtils;
|
|
import androidx.annotation.NonNull;
|
|
import com.glu.plugins.gluanalytics.AnalyticsData;
|
|
import java.util.concurrent.BlockingQueue;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class GoogleAdvertisingIDUtil {
|
|
private static final String ADVERTISING_ID_SERVICE_NAME = "com.google.android.gms.ads.identifier.internal.IAdvertisingIdService";
|
|
|
|
public static AnalyticsData.AdvertisingIdInfo getAdvertisingIdInfo(Context context) {
|
|
AnalyticsData.AdvertisingIdInfo advertisingIdInfo = AnalyticsData.getAdvertisingIdInfo(context);
|
|
return (advertisingIdInfo == null || isAdvertisingIDEmpty(advertisingIdInfo)) ? getAdvertisingIDByBackupMethod(context) : advertisingIdInfo;
|
|
}
|
|
|
|
private static boolean isAdvertisingIDEmpty(AnalyticsData.AdvertisingIdInfo advertisingIdInfo) {
|
|
return advertisingIdInfo != null && TextUtils.isEmpty(advertisingIdInfo.advertisingId);
|
|
}
|
|
|
|
private static AnalyticsData.AdvertisingIdInfo getAdvertisingIDByBackupMethod(Context context) {
|
|
try {
|
|
return queryAdvertisingIDFromService(context);
|
|
} catch (Throwable unused) {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private static AnalyticsData.AdvertisingIdInfo queryAdvertisingIDFromService(Context context) {
|
|
boolean z;
|
|
GoogleAdvertisingServiceConnection googleAdvertisingServiceConnection = new GoogleAdvertisingServiceConnection();
|
|
Intent intent = new Intent("com.google.android.gms.ads.identifier.service.START");
|
|
intent.setPackage("com.google.android.gms");
|
|
try {
|
|
z = context.bindService(intent, googleAdvertisingServiceConnection, 1);
|
|
} catch (Throwable unused) {
|
|
z = false;
|
|
}
|
|
if (z) {
|
|
try {
|
|
GoogleAdvertisingInfo create = GoogleAdvertisingInfo.GoogleAdvertisingInfoBinder.create(googleAdvertisingServiceConnection.getBinder());
|
|
AnalyticsData.AdvertisingIdInfo advertisingIdInfo = new AnalyticsData.AdvertisingIdInfo(create.getId(), create.getEnabled(true));
|
|
if (z) {
|
|
context.unbindService(googleAdvertisingServiceConnection);
|
|
}
|
|
return advertisingIdInfo;
|
|
} catch (Throwable unused2) {
|
|
if (!z) {
|
|
return null;
|
|
}
|
|
}
|
|
} else if (!z) {
|
|
return null;
|
|
}
|
|
context.unbindService(googleAdvertisingServiceConnection);
|
|
return null;
|
|
}
|
|
|
|
public interface GoogleAdvertisingInfo extends IInterface {
|
|
boolean getEnabled(boolean z) throws RemoteException;
|
|
|
|
String getId() throws RemoteException;
|
|
|
|
public static abstract class GoogleAdvertisingInfoBinder extends Binder implements GoogleAdvertisingInfo {
|
|
public static GoogleAdvertisingInfo create(IBinder iBinder) {
|
|
if (iBinder == null) {
|
|
return null;
|
|
}
|
|
IInterface queryLocalInterface = iBinder.queryLocalInterface(GoogleAdvertisingIDUtil.ADVERTISING_ID_SERVICE_NAME);
|
|
if (queryLocalInterface instanceof GoogleAdvertisingInfo) {
|
|
return (GoogleAdvertisingInfo) queryLocalInterface;
|
|
}
|
|
return new GoogleAdvertisingInfoImplementation(iBinder);
|
|
}
|
|
|
|
@Override // android.os.Binder
|
|
public boolean onTransact(int i, @NonNull Parcel parcel, Parcel parcel2, int i2) throws RemoteException {
|
|
if (i == 1) {
|
|
parcel.enforceInterface(GoogleAdvertisingIDUtil.ADVERTISING_ID_SERVICE_NAME);
|
|
String id = getId();
|
|
parcel2.writeNoException();
|
|
parcel2.writeString(id);
|
|
return true;
|
|
}
|
|
if (i == 2) {
|
|
parcel.enforceInterface(GoogleAdvertisingIDUtil.ADVERTISING_ID_SERVICE_NAME);
|
|
boolean enabled = getEnabled(parcel.readInt() != 0);
|
|
parcel2.writeNoException();
|
|
parcel2.writeInt(enabled ? 1 : 0);
|
|
return true;
|
|
}
|
|
return super.onTransact(i, parcel, parcel2, i2);
|
|
}
|
|
|
|
public static class GoogleAdvertisingInfoImplementation implements GoogleAdvertisingInfo {
|
|
private final IBinder mBinder;
|
|
|
|
@Override // android.os.IInterface
|
|
public IBinder asBinder() {
|
|
return this.mBinder;
|
|
}
|
|
|
|
public GoogleAdvertisingInfoImplementation(IBinder iBinder) {
|
|
this.mBinder = iBinder;
|
|
}
|
|
|
|
@Override // com.glu.plugins.gluanalytics.util.GoogleAdvertisingIDUtil.GoogleAdvertisingInfo
|
|
public String getId() throws RemoteException {
|
|
Parcel obtain = Parcel.obtain();
|
|
Parcel obtain2 = Parcel.obtain();
|
|
try {
|
|
obtain.writeInterfaceToken(GoogleAdvertisingIDUtil.ADVERTISING_ID_SERVICE_NAME);
|
|
this.mBinder.transact(1, obtain, obtain2, 0);
|
|
obtain2.readException();
|
|
return obtain2.readString();
|
|
} finally {
|
|
obtain2.recycle();
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
|
|
@Override // com.glu.plugins.gluanalytics.util.GoogleAdvertisingIDUtil.GoogleAdvertisingInfo
|
|
public boolean getEnabled(boolean z) throws RemoteException {
|
|
Parcel obtain = Parcel.obtain();
|
|
Parcel obtain2 = Parcel.obtain();
|
|
try {
|
|
obtain.writeInterfaceToken(GoogleAdvertisingIDUtil.ADVERTISING_ID_SERVICE_NAME);
|
|
obtain.writeInt(z ? 1 : 0);
|
|
this.mBinder.transact(2, obtain, obtain2, 0);
|
|
obtain2.readException();
|
|
return obtain2.readInt() != 0;
|
|
} finally {
|
|
obtain2.recycle();
|
|
obtain.recycle();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public static class GoogleAdvertisingServiceConnection implements ServiceConnection {
|
|
private final BlockingQueue<IBinder> mBinderQueue = new LinkedBlockingQueue();
|
|
boolean mConsumed = false;
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceDisconnected(ComponentName componentName) {
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
|
|
try {
|
|
this.mBinderQueue.put(iBinder);
|
|
} catch (Throwable unused) {
|
|
}
|
|
}
|
|
|
|
public IBinder getBinder() throws InterruptedException {
|
|
if (this.mConsumed) {
|
|
throw new IllegalStateException();
|
|
}
|
|
this.mConsumed = true;
|
|
return this.mBinderQueue.take();
|
|
}
|
|
}
|
|
}
|