- 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
186 lines
6.7 KiB
Java
186 lines
6.7 KiB
Java
package csdk.starlightsecurity.platform;
|
|
|
|
import android.app.Activity;
|
|
import android.content.Context;
|
|
import android.content.pm.PackageManager;
|
|
import android.widget.Toast;
|
|
import com.ea.fuel.metrics.FuelMetrics;
|
|
import com.mbridge.msdk.foundation.entity.CampaignEx;
|
|
import csdk.starlightsecurity.eventbus.GluEventBus;
|
|
import csdk.starlightsecurity.util.ActivityLifecycleCallbacks;
|
|
import csdk.starlightsecurity.util.Common;
|
|
import csdk.starlightsecurity.util.IAction2;
|
|
import csdk.starlightsecurity.util.StringStore;
|
|
import java.util.ArrayList;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.concurrent.Executors;
|
|
import java.util.concurrent.ScheduledExecutorService;
|
|
import java.util.concurrent.TimeUnit;
|
|
import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class AndroidPlatform {
|
|
private final Activity mActivity;
|
|
private ActivityLifecycleCallbacks mActivityLifecycleCallbacks;
|
|
private final Context mContext;
|
|
private final GluEventBus mEventBus = GluEventBus.SHARED;
|
|
private final ScheduledExecutorService mExecutor = Executors.newSingleThreadScheduledExecutor();
|
|
private boolean mIsAvailable;
|
|
|
|
private native void onApplicationEvent(String str);
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public native void onHandleEvent(long j, Object obj, String str, String str2, String str3, String str4, String str5);
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public native void onTimerEvent(long j);
|
|
|
|
public AndroidPlatform(Activity activity) {
|
|
this.mActivity = activity;
|
|
this.mContext = activity.getApplicationContext();
|
|
StringStore.init();
|
|
this.mIsAvailable = true;
|
|
}
|
|
|
|
public void destroy() {
|
|
this.mIsAvailable = false;
|
|
this.mExecutor.shutdown();
|
|
StringStore.destroy();
|
|
ActivityLifecycleCallbacks activityLifecycleCallbacks = this.mActivityLifecycleCallbacks;
|
|
if (activityLifecycleCallbacks != null) {
|
|
activityLifecycleCallbacks.destroy();
|
|
}
|
|
FuelMetrics.Shutdown();
|
|
}
|
|
|
|
public void registerApplicationEvent() {
|
|
this.mActivityLifecycleCallbacks = new ActivityLifecycleCallbacks(this.mContext, new IAction2() { // from class: csdk.starlightsecurity.platform.AndroidPlatform$$ExternalSyntheticLambda0
|
|
@Override // csdk.starlightsecurity.util.IAction2
|
|
public final void apply(Object obj, Object obj2) {
|
|
AndroidPlatform.this.lambda$registerApplicationEvent$0((String) obj, (Activity) obj2);
|
|
}
|
|
});
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
public /* synthetic */ void lambda$registerApplicationEvent$0(String str, Activity activity) {
|
|
if (this.mIsAvailable) {
|
|
if ("onApplicationPaused".equals(str)) {
|
|
onApplicationEvent(CampaignEx.JSON_NATIVE_VIDEO_PAUSE);
|
|
} else if ("onApplicationResumed".equals(str)) {
|
|
onApplicationEvent(CampaignEx.JSON_NATIVE_VIDEO_RESUME);
|
|
}
|
|
}
|
|
}
|
|
|
|
public String getApplicationVersion() {
|
|
try {
|
|
return this.mContext.getPackageManager().getPackageInfo(this.mContext.getPackageName(), 0).versionName;
|
|
} catch (PackageManager.NameNotFoundException unused) {
|
|
return "";
|
|
}
|
|
}
|
|
|
|
public String getApplicationID() {
|
|
return this.mContext.getPackageName();
|
|
}
|
|
|
|
public String getFromStringStore(String str) {
|
|
return StringStore.get(str);
|
|
}
|
|
|
|
public boolean loadLibrary(String str) {
|
|
try {
|
|
System.loadLibrary(str);
|
|
if (!str.equals("fuelmetrics")) {
|
|
return true;
|
|
}
|
|
FuelMetrics.Startup(this.mContext);
|
|
return true;
|
|
} catch (UnsatisfiedLinkError e) {
|
|
e.toString();
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public void presentToast(final String str) {
|
|
Common.runOnUIThread(new Runnable() { // from class: csdk.starlightsecurity.platform.AndroidPlatform.1
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
Toast.makeText(AndroidPlatform.this.mContext, str, 1).show();
|
|
}
|
|
});
|
|
}
|
|
|
|
public Object subscribe(String str, String[] strArr, final long j) {
|
|
return this.mEventBus.subscribe(GluEventBus.GLOBAL_TOKEN, str, Arrays.asList(strArr), new GluEventBus.IEventHandler() { // from class: csdk.starlightsecurity.platform.AndroidPlatform.2
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus.IEventHandler
|
|
public void handleEvent(GluEventBus gluEventBus, Object obj, String str2, GluEventBus.Event event) {
|
|
String str3;
|
|
try {
|
|
str3 = new JSONObject(event.data).toString();
|
|
} catch (Exception unused) {
|
|
str3 = "";
|
|
}
|
|
AndroidPlatform.this.onHandleEvent(j, obj, str2, event.channel, event.action, event.sender, str3);
|
|
}
|
|
});
|
|
}
|
|
|
|
public void unsubscribe(Object obj) {
|
|
this.mEventBus.unsubscribe(obj);
|
|
}
|
|
|
|
public void publish(Object obj, String str, String str2, String str3, String str4) {
|
|
Map<String, Object> map;
|
|
try {
|
|
map = toMap(new JSONObject(str4));
|
|
} catch (Exception unused) {
|
|
map = null;
|
|
}
|
|
this.mEventBus.publish(obj, new GluEventBus.Event(str, str2, str3, map));
|
|
}
|
|
|
|
public void scheduleEvent(long j, final long j2) {
|
|
this.mExecutor.schedule(new Runnable() { // from class: csdk.starlightsecurity.platform.AndroidPlatform.3
|
|
@Override // java.lang.Runnable
|
|
public void run() {
|
|
AndroidPlatform.this.onTimerEvent(j2);
|
|
}
|
|
}, j, TimeUnit.MILLISECONDS);
|
|
}
|
|
|
|
public static Map<String, Object> toMap(JSONObject jSONObject) throws Exception {
|
|
HashMap hashMap = new HashMap();
|
|
Iterator<String> keys = jSONObject.keys();
|
|
while (keys.hasNext()) {
|
|
String next = keys.next();
|
|
hashMap.put(next, fromJson(jSONObject.get(next)));
|
|
}
|
|
return hashMap;
|
|
}
|
|
|
|
public static List toList(JSONArray jSONArray) throws Exception {
|
|
ArrayList arrayList = new ArrayList();
|
|
for (int i = 0; i < jSONArray.length(); i++) {
|
|
arrayList.add(fromJson(jSONArray.get(i)));
|
|
}
|
|
return arrayList;
|
|
}
|
|
|
|
private static Object fromJson(Object obj) throws Exception {
|
|
if (obj == JSONObject.NULL) {
|
|
return null;
|
|
}
|
|
if (obj instanceof JSONObject) {
|
|
return toMap((JSONObject) obj);
|
|
}
|
|
return obj instanceof JSONArray ? toList((JSONArray) obj) : obj;
|
|
}
|
|
}
|