[core] Add missing component filter (#602)

This commit is contained in:
LoveSy 2021-05-17 12:49:18 +08:00 committed by GitHub
parent 418b80a63a
commit dc8deae175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 8 deletions

View File

@ -23,6 +23,7 @@ import static org.lsposed.lspd.service.ServiceManager.TAG;
import android.content.ContentValues; import android.content.ContentValues;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.database.Cursor; import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteStatement; import android.database.sqlite.SQLiteStatement;
@ -314,7 +315,7 @@ public class ConfigManager {
while (cursor.moveToNext()) { while (cursor.moveToNext()) {
String packageName = cursor.getString(pkgNameIdx); String packageName = cursor.getString(pkgNameIdx);
try { try {
PackageInfo pkgInfo = PackageService.getPackageInfoFromAllUsers(packageName, 0); PackageInfo pkgInfo = PackageService.getPackageInfoFromAllUsers(packageName, PackageManager.MATCH_DISABLED_COMPONENTS | PackageManager.MATCH_UNINSTALLED_PACKAGES);
if (pkgInfo != null && pkgInfo.applicationInfo != null) { if (pkgInfo != null && pkgInfo.applicationInfo != null) {
cachedModule.put(pkgInfo.applicationInfo.uid % PER_USER_RANGE, pkgInfo.packageName); cachedModule.put(pkgInfo.applicationInfo.uid % PER_USER_RANGE, pkgInfo.packageName);
} else { } else {
@ -552,13 +553,6 @@ public class ConfigManager {
return true; return true;
} }
public void uninstalledApp(Application app) {
if (removeAppWithoutCache(app)) {
// Called by oneway binder
cacheScopes();
}
}
public void updateAppCache() { public void updateAppCache() {
// Called by oneway binder // Called by oneway binder
cacheScopes(); cacheScopes();

View File

@ -95,6 +95,12 @@ public class LSPosedService extends ILSPosedService.Stub {
break; break;
} }
case Intent.ACTION_PACKAGE_CHANGED: { case Intent.ACTION_PACKAGE_CHANGED: {
// make sure that the change is for the complete package, not only a
// component
String[] components = intent.getStringArrayExtra(Intent.EXTRA_CHANGED_COMPONENT_NAME_LIST);
if (components != null && !Arrays.stream(components).reduce(false, (p, c) -> p || c.equals(moduleName), Boolean::logicalOr)) {
return;
}
// when package is changed, we may need to update cache (module cache or process cache) // when package is changed, we may need to update cache (module cache or process cache)
if (isXposedModule) { if (isXposedModule) {
ConfigManager.getInstance().updateModuleApkPath(moduleName, applicationInfo.sourceDir); ConfigManager.getInstance().updateModuleApkPath(moduleName, applicationInfo.sourceDir);