- 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
247 lines
8.2 KiB
Java
247 lines
8.2 KiB
Java
package csdk.starlightsecurity.eventbus;
|
|
|
|
import android.util.Log;
|
|
import androidx.annotation.NonNull;
|
|
import csdk.glucentralservices.eventbus.IServerEventBus;
|
|
import csdk.glucentralservices.eventbus.IServerEventHandler;
|
|
import csdk.glucentralservices.eventbus.ServerEventBus;
|
|
import java.util.AbstractMap;
|
|
import java.util.Arrays;
|
|
import java.util.Collection;
|
|
import java.util.HashSet;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* loaded from: classes4.dex */
|
|
public abstract class GluEventBus {
|
|
public static final GluEventBus DISCONNECTED = new DisconnectedEventBus();
|
|
private static final String EVT_ACTION = "action";
|
|
private static final String EVT_CHANNEL = "channel";
|
|
private static final String EVT_DATA = "data";
|
|
private static final String EVT_SENDER = "sender";
|
|
public static final Object GLOBAL_TOKEN;
|
|
private static final Set<String> KEYS;
|
|
public static final GluEventBus SHARED;
|
|
|
|
public interface IEventHandler {
|
|
void handleEvent(GluEventBus gluEventBus, Object obj, String str, Event event) throws Exception;
|
|
}
|
|
|
|
public abstract Object globalToken();
|
|
|
|
public abstract boolean isConnected();
|
|
|
|
public abstract void publish(Object obj, Event event);
|
|
|
|
public abstract Object subscribe(Object obj, String str, Collection<String> collection, IEventHandler iEventHandler);
|
|
|
|
public abstract void unsubscribe(Object obj);
|
|
|
|
static {
|
|
GluEventBus createEventBus = createEventBus();
|
|
SHARED = createEventBus;
|
|
GLOBAL_TOKEN = createEventBus.globalToken();
|
|
KEYS = createKeys();
|
|
}
|
|
|
|
private static GluEventBus createEventBus() {
|
|
try {
|
|
return new RealEventBus(ServerEventBus.getShared());
|
|
} catch (NoClassDefFoundError unused) {
|
|
return DISCONNECTED;
|
|
}
|
|
}
|
|
|
|
private static Set<String> createKeys() {
|
|
HashSet hashSet = new HashSet();
|
|
hashSet.add("channel");
|
|
hashSet.add("action");
|
|
hashSet.add(EVT_SENDER);
|
|
hashSet.add("data");
|
|
return hashSet;
|
|
}
|
|
|
|
public static class Event implements Map<String, Object> {
|
|
public String action;
|
|
public String channel;
|
|
public Map<String, Object> data;
|
|
public String sender;
|
|
|
|
public Event() {
|
|
}
|
|
|
|
public Event(String str, String str2, String str3, Map<String, Object> map) {
|
|
this.channel = str;
|
|
this.action = str2;
|
|
this.sender = str3;
|
|
this.data = map;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public int size() {
|
|
return keySet().size();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean isEmpty() {
|
|
return size() == 0;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean containsKey(Object obj) {
|
|
return GluEventBus.KEYS.contains(obj);
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean containsValue(Object obj) {
|
|
return values().contains(obj);
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public Object get(Object obj) {
|
|
if (obj == null) {
|
|
return null;
|
|
}
|
|
if (obj.equals("channel")) {
|
|
return this.channel;
|
|
}
|
|
if (obj.equals("action")) {
|
|
return this.action;
|
|
}
|
|
if (obj.equals(GluEventBus.EVT_SENDER)) {
|
|
return this.sender;
|
|
}
|
|
if (obj.equals("data")) {
|
|
return this.data;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public Object put(String str, Object obj) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public Object remove(Object obj) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public void putAll(@NonNull Map<? extends String, ? extends Object> map) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
@NonNull
|
|
public Set<String> keySet() {
|
|
return GluEventBus.KEYS;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
@NonNull
|
|
public Collection<Object> values() {
|
|
return Arrays.asList(this.channel, this.action, this.sender, this.data);
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
@NonNull
|
|
public Set<Map.Entry<String, Object>> entrySet() {
|
|
HashSet hashSet = new HashSet();
|
|
hashSet.add(new AbstractMap.SimpleImmutableEntry("channel", this.channel));
|
|
hashSet.add(new AbstractMap.SimpleImmutableEntry("action", this.action));
|
|
hashSet.add(new AbstractMap.SimpleImmutableEntry(GluEventBus.EVT_SENDER, this.sender));
|
|
hashSet.add(new AbstractMap.SimpleImmutableEntry("data", this.data));
|
|
return hashSet;
|
|
}
|
|
}
|
|
|
|
public static class DisconnectedEventBus extends GluEventBus {
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public Object globalToken() {
|
|
return this;
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public boolean isConnected() {
|
|
return false;
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public void publish(Object obj, Event event) {
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public void unsubscribe(Object obj) {
|
|
}
|
|
|
|
private DisconnectedEventBus() {
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public Object subscribe(Object obj, String str, Collection<String> collection, IEventHandler iEventHandler) {
|
|
if (iEventHandler != null) {
|
|
try {
|
|
iEventHandler.handleEvent(this, obj, str, new Event("#me", "unsubscribed", "@eb.disconnected", null));
|
|
} catch (Exception e) {
|
|
Log.e("DisconnectedEventBus", "Failed to destroy handler", e);
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
}
|
|
|
|
public static class RealEventBus extends GluEventBus {
|
|
private final IServerEventBus mEventBus;
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public boolean isConnected() {
|
|
return true;
|
|
}
|
|
|
|
public RealEventBus(IServerEventBus iServerEventBus) {
|
|
this.mEventBus = iServerEventBus;
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public Object subscribe(Object obj, String str, Collection<String> collection, final IEventHandler iEventHandler) {
|
|
return this.mEventBus.subscribe(obj, str, collection, iEventHandler != null ? new IServerEventHandler() { // from class: csdk.starlightsecurity.eventbus.GluEventBus.RealEventBus.1
|
|
@Override // csdk.glucentralservices.eventbus.IServerEventHandler
|
|
public void handleEvent(IServerEventBus iServerEventBus, Object obj2, String str2, Map<String, Object> map) throws Exception {
|
|
Event event;
|
|
if (map != null) {
|
|
event = new Event();
|
|
event.channel = (String) map.get("channel");
|
|
event.action = (String) map.get("action");
|
|
event.sender = (String) map.get(GluEventBus.EVT_SENDER);
|
|
event.data = (Map) map.get("data");
|
|
} else {
|
|
event = null;
|
|
}
|
|
iEventHandler.handleEvent(RealEventBus.this, obj2, str2, event);
|
|
}
|
|
} : null);
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public void unsubscribe(Object obj) {
|
|
this.mEventBus.unsubscribe(obj);
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public void publish(Object obj, Event event) {
|
|
this.mEventBus.publish(obj, event);
|
|
}
|
|
|
|
@Override // csdk.starlightsecurity.eventbus.GluEventBus
|
|
public Object globalToken() {
|
|
return this.mEventBus.globalToken();
|
|
}
|
|
}
|
|
}
|