[app] Check binder alive in reload installed modules (#1012)

This commit is contained in:
tehcneko 2021-08-26 17:34:16 +08:00 committed by GitHub
parent 5cf522b656
commit 55fe34095d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 2 deletions

View File

@ -47,8 +47,8 @@ public final class ModuleUtil {
private static ModuleUtil instance = null;
private final PackageManager pm;
private final List<ModuleListener> listeners = new CopyOnWriteArrayList<>();
private HashSet<String> enabledModules;
private Map<Pair<String, Integer>, InstalledModule> installedModules;
private HashSet<String> enabledModules = new HashSet<>();
private Map<Pair<String, Integer>, InstalledModule> installedModules = new HashMap<>();
private boolean isReloading = false;
private ModuleUtil() {
@ -81,6 +81,12 @@ public final class ModuleUtil {
return;
isReloading = true;
}
if (!ConfigManager.isBinderAlive()) {
synchronized (this) {
isReloading = false;
}
return;
}
Map<Pair<String, Integer>, InstalledModule> modules = new HashMap<>();
for (PackageInfo pkg : ConfigManager.getInstalledPackagesFromAllUsers(PackageManager.GET_META_DATA, false)) {