47 lines
1.3 KiB
Java
47 lines
1.3 KiB
Java
package com.huawei.hms.activity.internal;
|
|
|
|
import android.text.TextUtils;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ForegroundBusResponseMgr {
|
|
private static final ForegroundBusResponseMgr b = new ForegroundBusResponseMgr();
|
|
private final Map<String, BusResponseCallback> a = new HashMap();
|
|
|
|
public BusResponseCallback get(String str) {
|
|
BusResponseCallback busResponseCallback;
|
|
if (TextUtils.isEmpty(str)) {
|
|
return null;
|
|
}
|
|
synchronized (this.a) {
|
|
busResponseCallback = this.a.get(str);
|
|
}
|
|
return busResponseCallback;
|
|
}
|
|
|
|
public void registerObserver(String str, BusResponseCallback busResponseCallback) {
|
|
if (TextUtils.isEmpty(str) || busResponseCallback == null) {
|
|
return;
|
|
}
|
|
synchronized (this.a) {
|
|
if (!this.a.containsKey(str)) {
|
|
this.a.put(str, busResponseCallback);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void unRegisterObserver(String str) {
|
|
if (TextUtils.isEmpty(str)) {
|
|
return;
|
|
}
|
|
synchronized (this.a) {
|
|
this.a.remove(str);
|
|
}
|
|
}
|
|
|
|
public static ForegroundBusResponseMgr getInstance() {
|
|
return b;
|
|
}
|
|
}
|