Files
rr3-apk/decompiled-community/sources/com/singular/sdk/internal/LicenseChecker.java
Daniel Elliott c080f0d97f Add Discord community version (64-bit only)
- 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
2026-02-18 15:48:36 -08:00

95 lines
3.9 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.Handler;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.RemoteException;
import com.android.vending.licensing.ILicenseResultListener;
import com.android.vending.licensing.ILicensingService;
import com.singular.sdk.internal.LicenseApiHelper;
import java.security.SecureRandom;
/* loaded from: classes4.dex */
public class LicenseChecker implements ServiceConnection {
public static final SecureRandom RANDOM = new SecureRandom();
public static final SingularLog logger = SingularLog.getLogger(LicenseApiHelper.class.getSimpleName());
public final LicenseApiHelper.LicenseResultHandler handler;
public final Context mContext;
public Handler mHandler;
public final String mPackageName;
public ILicensingService mService;
public LicenseChecker(Context context, LicenseApiHelper.LicenseResultHandler licenseResultHandler) {
HandlerThread handlerThread = new HandlerThread("license_checker");
handlerThread.start();
this.mContext = context;
this.mPackageName = context.getPackageName();
this.mHandler = new Handler(handlerThread.getLooper());
this.handler = licenseResultHandler;
}
public synchronized void checkAccess() {
ILicensingService iLicensingService = this.mService;
if (iLicensingService == null) {
SingularLog singularLog = logger;
singularLog.info("Binding to licensing service.");
try {
if (!this.mContext.bindService(new Intent("com.android.vending.licensing.ILicensingService").setPackage("com.android.vending"), this, 1)) {
singularLog.error("Could not bind to service.");
this.handler.handle(-1, "Binding failed", "");
}
} catch (SecurityException e) {
logger.error("SecurityException", e);
this.handler.handle(-1, String.format("Exception: %s, Message: %s", e.toString(), e.getMessage()), "");
}
logger.info("Binding done.");
} else {
try {
iLicensingService.checkLicense(generateNonce(), this.mPackageName, new ResultListener());
} catch (RemoteException e2) {
logger.error("RemoteException in checkLicense call.", e2);
this.handler.handle(-1, String.format("Exception: %s, Message: %s", e2.toString(), e2.getMessage()), "");
}
}
}
@Override // android.content.ServiceConnection
public synchronized void onServiceConnected(ComponentName componentName, IBinder iBinder) {
SingularLog singularLog = logger;
singularLog.info("onServiceConnected.");
ILicensingService asInterface = ILicensingService.Stub.asInterface(iBinder);
this.mService = asInterface;
try {
asInterface.checkLicense(generateNonce(), this.mPackageName, new ResultListener());
singularLog.info("checkLicense call done.");
} catch (RemoteException e) {
logger.error("RemoteException in checkLicense call.", e);
this.handler.handle(-1, e.toString(), "");
}
}
@Override // android.content.ServiceConnection
public synchronized void onServiceDisconnected(ComponentName componentName) {
logger.info("Service unexpectedly disconnected.");
this.mService = null;
}
public class ResultListener extends ILicenseResultListener.Stub {
public ResultListener() {
}
@Override // com.android.vending.licensing.ILicenseResultListener
public void verifyLicense(int i, String str, String str2) {
LicenseChecker.this.handler.handle(i, str, str2);
}
}
public final int generateNonce() {
return RANDOM.nextInt();
}
}