52 lines
1.6 KiB
Java
52 lines
1.6 KiB
Java
package com.huawei.hms.adapter.sysobs;
|
|
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import com.huawei.hms.support.log.HMSLog;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class ApkResolutionFailedManager {
|
|
private static final ApkResolutionFailedManager c = new ApkResolutionFailedManager();
|
|
private final Handler a = new Handler(Looper.getMainLooper());
|
|
private final Map<String, Runnable> b = new HashMap(2);
|
|
|
|
private ApkResolutionFailedManager() {
|
|
}
|
|
|
|
public void postTask(String str, Runnable runnable) {
|
|
if (Looper.myLooper() != Looper.getMainLooper()) {
|
|
HMSLog.e("ApkResolutionFailedManager", "postTask is not in main thread");
|
|
} else {
|
|
this.b.put(str, runnable);
|
|
this.a.postDelayed(runnable, 2000L);
|
|
}
|
|
}
|
|
|
|
public void removeTask(String str) {
|
|
if (Looper.myLooper() != Looper.getMainLooper()) {
|
|
HMSLog.e("ApkResolutionFailedManager", "removeTask is not in main thread");
|
|
return;
|
|
}
|
|
Runnable remove = this.b.remove(str);
|
|
if (remove == null) {
|
|
HMSLog.e("ApkResolutionFailedManager", "cancel runnable is null");
|
|
} else {
|
|
this.a.removeCallbacks(remove);
|
|
}
|
|
}
|
|
|
|
public void removeValueOnly(String str) {
|
|
if (Looper.myLooper() != Looper.getMainLooper()) {
|
|
HMSLog.e("ApkResolutionFailedManager", "removeValueOnly is not in main thread");
|
|
} else {
|
|
this.b.remove(str);
|
|
}
|
|
}
|
|
|
|
public static ApkResolutionFailedManager getInstance() {
|
|
return c;
|
|
}
|
|
}
|