- 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
241 lines
10 KiB
Java
241 lines
10 KiB
Java
package com.facebook.appevents.ondeviceprocessing;
|
|
|
|
import android.content.ComponentName;
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.ServiceConnection;
|
|
import android.content.pm.PackageManager;
|
|
import android.os.Bundle;
|
|
import android.os.IBinder;
|
|
import android.os.RemoteException;
|
|
import androidx.annotation.RestrictTo;
|
|
import com.facebook.FacebookSdk;
|
|
import com.facebook.appevents.AppEvent;
|
|
import com.facebook.appevents.internal.AppEventUtility;
|
|
import com.facebook.internal.FacebookSignatureValidator;
|
|
import com.facebook.internal.Utility;
|
|
import com.facebook.internal.instrument.crashshield.CrashShieldHandler;
|
|
import com.facebook.ppml.receiver.IReceiverService;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.concurrent.CountDownLatch;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.collections.CollectionsKt__CollectionsKt;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
|
|
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
|
|
/* loaded from: classes2.dex */
|
|
public final class RemoteServiceWrapper {
|
|
public static final String RECEIVER_SERVICE_ACTION = "ReceiverService";
|
|
public static final String RECEIVER_SERVICE_PACKAGE = "com.facebook.katana";
|
|
public static final String RECEIVER_SERVICE_PACKAGE_WAKIZASHI = "com.facebook.wakizashi";
|
|
private static Boolean isServiceAvailable;
|
|
public static final RemoteServiceWrapper INSTANCE = new RemoteServiceWrapper();
|
|
private static final String TAG = RemoteServiceWrapper.class.getSimpleName();
|
|
|
|
private RemoteServiceWrapper() {
|
|
}
|
|
|
|
public static final boolean isServiceAvailable() {
|
|
if (CrashShieldHandler.isObjectCrashing(RemoteServiceWrapper.class)) {
|
|
return false;
|
|
}
|
|
try {
|
|
if (isServiceAvailable == null) {
|
|
isServiceAvailable = Boolean.valueOf(INSTANCE.getVerifiedServiceIntent(FacebookSdk.getApplicationContext()) != null);
|
|
}
|
|
Boolean bool = isServiceAvailable;
|
|
if (bool == null) {
|
|
return false;
|
|
}
|
|
return bool.booleanValue();
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, RemoteServiceWrapper.class);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public static final ServiceResult sendInstallEvent(String applicationId) {
|
|
if (CrashShieldHandler.isObjectCrashing(RemoteServiceWrapper.class)) {
|
|
return null;
|
|
}
|
|
try {
|
|
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
|
|
return INSTANCE.sendEvents(EventType.MOBILE_APP_INSTALL, applicationId, CollectionsKt__CollectionsKt.emptyList());
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, RemoteServiceWrapper.class);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static final ServiceResult sendCustomEvents(String applicationId, List<AppEvent> appEvents) {
|
|
if (CrashShieldHandler.isObjectCrashing(RemoteServiceWrapper.class)) {
|
|
return null;
|
|
}
|
|
try {
|
|
Intrinsics.checkNotNullParameter(applicationId, "applicationId");
|
|
Intrinsics.checkNotNullParameter(appEvents, "appEvents");
|
|
return INSTANCE.sendEvents(EventType.CUSTOM_APP_EVENTS, applicationId, appEvents);
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, RemoteServiceWrapper.class);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private final ServiceResult sendEvents(EventType eventType, String str, List<AppEvent> list) {
|
|
ServiceResult serviceResult;
|
|
String str2;
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
ServiceResult serviceResult2 = ServiceResult.SERVICE_NOT_AVAILABLE;
|
|
AppEventUtility.assertIsNotMainThread();
|
|
Context applicationContext = FacebookSdk.getApplicationContext();
|
|
Intent verifiedServiceIntent = getVerifiedServiceIntent(applicationContext);
|
|
if (verifiedServiceIntent == null) {
|
|
return serviceResult2;
|
|
}
|
|
RemoteServiceConnection remoteServiceConnection = new RemoteServiceConnection();
|
|
try {
|
|
if (applicationContext.bindService(verifiedServiceIntent, remoteServiceConnection, 1)) {
|
|
try {
|
|
try {
|
|
IBinder binder = remoteServiceConnection.getBinder();
|
|
if (binder != null) {
|
|
IReceiverService asInterface = IReceiverService.Stub.asInterface(binder);
|
|
Bundle buildEventsBundle = RemoteServiceParametersHelper.buildEventsBundle(eventType, str, list);
|
|
if (buildEventsBundle != null) {
|
|
asInterface.sendEvents(buildEventsBundle);
|
|
Utility utility = Utility.INSTANCE;
|
|
Utility.logd(TAG, Intrinsics.stringPlus("Successfully sent events to the remote service: ", buildEventsBundle));
|
|
}
|
|
serviceResult2 = ServiceResult.OPERATION_SUCCESS;
|
|
}
|
|
applicationContext.unbindService(remoteServiceConnection);
|
|
Utility utility2 = Utility.INSTANCE;
|
|
Utility.logd(TAG, "Unbound from the remote service");
|
|
return serviceResult2;
|
|
} catch (RemoteException e) {
|
|
serviceResult = ServiceResult.SERVICE_ERROR;
|
|
Utility utility3 = Utility.INSTANCE;
|
|
str2 = TAG;
|
|
Utility.logd(str2, e);
|
|
applicationContext.unbindService(remoteServiceConnection);
|
|
Utility.logd(str2, "Unbound from the remote service");
|
|
return serviceResult;
|
|
}
|
|
} catch (InterruptedException e2) {
|
|
serviceResult = ServiceResult.SERVICE_ERROR;
|
|
Utility utility4 = Utility.INSTANCE;
|
|
str2 = TAG;
|
|
Utility.logd(str2, e2);
|
|
applicationContext.unbindService(remoteServiceConnection);
|
|
Utility.logd(str2, "Unbound from the remote service");
|
|
return serviceResult;
|
|
}
|
|
}
|
|
return ServiceResult.SERVICE_ERROR;
|
|
} catch (Throwable th) {
|
|
applicationContext.unbindService(remoteServiceConnection);
|
|
Utility utility5 = Utility.INSTANCE;
|
|
Utility.logd(TAG, "Unbound from the remote service");
|
|
throw th;
|
|
}
|
|
} catch (Throwable th2) {
|
|
CrashShieldHandler.handleThrowable(th2, this);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
private final Intent getVerifiedServiceIntent(Context context) {
|
|
if (CrashShieldHandler.isObjectCrashing(this)) {
|
|
return null;
|
|
}
|
|
try {
|
|
PackageManager packageManager = context.getPackageManager();
|
|
if (packageManager != null) {
|
|
Intent intent = new Intent(RECEIVER_SERVICE_ACTION);
|
|
intent.setPackage("com.facebook.katana");
|
|
if (packageManager.resolveService(intent, 0) != null && FacebookSignatureValidator.validateSignature(context, "com.facebook.katana")) {
|
|
return intent;
|
|
}
|
|
Intent intent2 = new Intent(RECEIVER_SERVICE_ACTION);
|
|
intent2.setPackage("com.facebook.wakizashi");
|
|
if (packageManager.resolveService(intent2, 0) != null) {
|
|
if (FacebookSignatureValidator.validateSignature(context, "com.facebook.wakizashi")) {
|
|
return intent2;
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
} catch (Throwable th) {
|
|
CrashShieldHandler.handleThrowable(th, this);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public enum ServiceResult {
|
|
OPERATION_SUCCESS,
|
|
SERVICE_NOT_AVAILABLE,
|
|
SERVICE_ERROR;
|
|
|
|
/* renamed from: values, reason: to resolve conflict with enum method */
|
|
public static ServiceResult[] valuesCustom() {
|
|
ServiceResult[] valuesCustom = values();
|
|
return (ServiceResult[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
|
|
}
|
|
}
|
|
|
|
public enum EventType {
|
|
MOBILE_APP_INSTALL("MOBILE_APP_INSTALL"),
|
|
CUSTOM_APP_EVENTS("CUSTOM_APP_EVENTS");
|
|
|
|
private final String eventType;
|
|
|
|
@Override // java.lang.Enum
|
|
public String toString() {
|
|
return this.eventType;
|
|
}
|
|
|
|
EventType(String str) {
|
|
this.eventType = str;
|
|
}
|
|
|
|
/* renamed from: values, reason: to resolve conflict with enum method */
|
|
public static EventType[] valuesCustom() {
|
|
EventType[] valuesCustom = values();
|
|
return (EventType[]) Arrays.copyOf(valuesCustom, valuesCustom.length);
|
|
}
|
|
}
|
|
|
|
public static final class RemoteServiceConnection implements ServiceConnection {
|
|
private IBinder binder;
|
|
private final CountDownLatch latch = new CountDownLatch(1);
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceDisconnected(ComponentName name) {
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onServiceConnected(ComponentName name, IBinder serviceBinder) {
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
Intrinsics.checkNotNullParameter(serviceBinder, "serviceBinder");
|
|
this.binder = serviceBinder;
|
|
this.latch.countDown();
|
|
}
|
|
|
|
@Override // android.content.ServiceConnection
|
|
public void onNullBinding(ComponentName name) {
|
|
Intrinsics.checkNotNullParameter(name, "name");
|
|
this.latch.countDown();
|
|
}
|
|
|
|
public final IBinder getBinder() throws InterruptedException {
|
|
this.latch.await(5L, TimeUnit.SECONDS);
|
|
return this.binder;
|
|
}
|
|
}
|
|
}
|