- 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
179 lines
6.3 KiB
Java
179 lines
6.3 KiB
Java
package csdk.glucentralservices.eventbus;
|
|
|
|
import android.text.TextUtils;
|
|
import com.firemonkeys.cloudcellapi.LocalNotificationsCenter;
|
|
import java.util.Collection;
|
|
import java.util.Map;
|
|
import org.json.JSONException;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public class ServerEventBus implements IServerEventBus {
|
|
private static final int RES_BAD_JSON_DATA = 2;
|
|
private static final int RES_ERROR = 3;
|
|
private static final int RES_OK = 0;
|
|
private static final ServerEventBus SHARED = createShared();
|
|
private final long mEventBus;
|
|
private final Object mGlobalToken;
|
|
private final long mMIDHandleEvent = getMIDHandleEvent();
|
|
|
|
private static native long getMIDHandleEvent();
|
|
|
|
public static IServerEventBus getShared() {
|
|
return SHARED;
|
|
}
|
|
|
|
private static native long globalToken(long j);
|
|
|
|
private static native void publish(long j, long j2, String str, String str2, String str3, String str4);
|
|
|
|
private static native void publishError(long j, long j2, String str, String str2, String str3, String str4, String str5, String str6, String str7);
|
|
|
|
private static native long shared();
|
|
|
|
private static native long subscribe(long j, long j2, long j3, String str, String[] strArr, EventHandlerData eventHandlerData);
|
|
|
|
private static native void unsubscribe(long j, long j2);
|
|
|
|
@Override // csdk.glucentralservices.eventbus.IServerEventBus
|
|
public Object globalToken() {
|
|
return this.mGlobalToken;
|
|
}
|
|
|
|
private ServerEventBus(long j) {
|
|
this.mEventBus = j;
|
|
this.mGlobalToken = tokenFromNativeToken(globalToken(j));
|
|
}
|
|
|
|
@Override // csdk.glucentralservices.eventbus.IServerEventBus
|
|
public Object subscribe(Object obj, String str, Collection<String> collection, IServerEventHandler iServerEventHandler) {
|
|
String[] strArr;
|
|
if (collection != null) {
|
|
strArr = new String[collection.size()];
|
|
collection.toArray(strArr);
|
|
} else {
|
|
strArr = null;
|
|
}
|
|
return tokenFromNativeToken(subscribe(this.mEventBus, nativeTokenFromToken(obj), this.mMIDHandleEvent, str, strArr, new EventHandlerData(this, iServerEventHandler)));
|
|
}
|
|
|
|
@Override // csdk.glucentralservices.eventbus.IServerEventBus
|
|
public void unsubscribe(Object obj) {
|
|
unsubscribe(this.mEventBus, nativeTokenFromToken(obj));
|
|
}
|
|
|
|
@Override // csdk.glucentralservices.eventbus.IServerEventBus
|
|
public void publish(Object obj, Map<String, Object> map) {
|
|
Exception exc;
|
|
String str;
|
|
String str2;
|
|
String str3;
|
|
String json;
|
|
String str4;
|
|
String str5;
|
|
String str6;
|
|
if (map != null) {
|
|
try {
|
|
String str7 = (String) map.get(LocalNotificationsCenter.EXTRA_CHANNEL_ID);
|
|
try {
|
|
String str8 = (String) map.get("action");
|
|
try {
|
|
String str9 = (String) map.get("sender");
|
|
try {
|
|
Map map2 = (Map) map.get("data");
|
|
json = map2 != null ? CollectionUtil.toJSON(map2) : null;
|
|
str4 = str7;
|
|
str5 = str8;
|
|
str6 = str9;
|
|
} catch (Exception e) {
|
|
exc = e;
|
|
str = str7;
|
|
str2 = str8;
|
|
str3 = str9;
|
|
publishError(this.mEventBus, nativeTokenFromToken(obj), null, exc, str, str2, str3, null);
|
|
return;
|
|
}
|
|
} catch (Exception e2) {
|
|
exc = e2;
|
|
str3 = null;
|
|
str = str7;
|
|
str2 = str8;
|
|
}
|
|
} catch (Exception e3) {
|
|
exc = e3;
|
|
str2 = null;
|
|
str3 = null;
|
|
str = str7;
|
|
}
|
|
} catch (Exception e4) {
|
|
exc = e4;
|
|
str = null;
|
|
str2 = null;
|
|
str3 = null;
|
|
}
|
|
} else {
|
|
str4 = null;
|
|
str5 = null;
|
|
str6 = null;
|
|
json = null;
|
|
}
|
|
publish(this.mEventBus, nativeTokenFromToken(obj), str4, str5, str6, json);
|
|
}
|
|
|
|
private static ServerEventBus createShared() {
|
|
try {
|
|
System.loadLibrary("glucentralservices");
|
|
} catch (UnsatisfiedLinkError unused) {
|
|
}
|
|
return new ServerEventBus(shared());
|
|
}
|
|
|
|
private static int handleEvent(long j, long j2, String str, String str2, String str3, String str4, String str5, EventHandlerData eventHandlerData) {
|
|
try {
|
|
return doHandleEvent(j, j2, str, str2, str3, str4, str5, eventHandlerData);
|
|
} catch (Exception e) {
|
|
publishError(j, j2, str, "critical", e.getMessage(), str2, str3, str4, str5);
|
|
return 3;
|
|
}
|
|
}
|
|
|
|
private static int doHandleEvent(long j, long j2, String str, String str2, String str3, String str4, String str5, EventHandlerData eventHandlerData) throws Exception {
|
|
Map<String, Object> parseJSON;
|
|
if (TextUtils.isEmpty(str5)) {
|
|
parseJSON = null;
|
|
} else {
|
|
try {
|
|
parseJSON = CollectionUtil.parseJSON(str5);
|
|
} catch (JSONException unused) {
|
|
return 2;
|
|
}
|
|
}
|
|
try {
|
|
} catch (Exception e) {
|
|
e = e;
|
|
}
|
|
try {
|
|
eventHandlerData.handler.handleEvent(eventHandlerData.eventBus, tokenFromNativeToken(j2), str, new ServerEvent(str2, str3, str4, parseJSON));
|
|
return 0;
|
|
} catch (Exception e2) {
|
|
e = e2;
|
|
publishError(j, j2, str, e, str2, str3, str4, str5);
|
|
return 3;
|
|
}
|
|
}
|
|
|
|
private static Object tokenFromNativeToken(long j) {
|
|
return Long.valueOf(j);
|
|
}
|
|
|
|
private static long nativeTokenFromToken(Object obj) {
|
|
if (obj != null) {
|
|
return ((Long) obj).longValue();
|
|
}
|
|
return 0L;
|
|
}
|
|
|
|
private static void publishError(long j, long j2, String str, Throwable th, String str2, String str3, String str4, String str5) {
|
|
publishError(j, j2, str, th.getClass().getName(), th.getMessage(), str2, str3, str4, str5);
|
|
}
|
|
}
|