Do not broadcast when module path not changed (#1622)

This commit is contained in:
LoveSy 2022-02-04 01:53:48 +08:00 committed by GitHub
parent 4955dcb542
commit 4bcf7718ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View File

@ -705,7 +705,7 @@ public class ConfigManager {
updateCaches(true);
return true;
}
return count >= 0;
return count > 0;
}
// Only be called before updating modules. No need to cache.

View File

@ -119,18 +119,17 @@ public class LSPosedService extends ILSPosedService.Stub {
if (components != null && !Arrays.stream(components).reduce(false, (p, c) -> p || c.equals(moduleName), Boolean::logicalOr)) {
return;
}
broadcastAndShowNotification(moduleName, userId, intent, isXposedModule);
if (isXposedModule) {
// When installing a new Xposed module, we update the apk path to mark it as a
// module to send a broadcast when modules that have not been activated are
// uninstalled.
ConfigManager.getInstance().updateModuleApkPath(moduleName, ConfigManager.getInstance().getModuleApkPath(applicationInfo), true);
// when package is changed, we may need to update cache (module cache or process cache)
ConfigManager.getInstance().updateCache();
// If cache not updated, assume it's not xposed module
isXposedModule = ConfigManager.getInstance().updateModuleApkPath(moduleName, ConfigManager.getInstance().getModuleApkPath(applicationInfo), false);
} else if (ConfigManager.getInstance().isUidHooked(uid)) {
// it will automatically remove obsolete app from database
ConfigManager.getInstance().updateAppCache();
}
broadcastAndShowNotification(moduleName, userId, intent, isXposedModule);
break;
}
case Intent.ACTION_UID_REMOVED: {