[app] Fix app filter (#653)

This commit is contained in:
tehcneko 2021-05-22 20:17:23 +08:00 committed by GitHub
parent 37dd63be81
commit 0a452b7f3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 13 deletions

View File

@ -152,15 +152,6 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
} }
private boolean shouldHideApp(PackageInfo info, ApplicationWithEquals app) { private boolean shouldHideApp(PackageInfo info, ApplicationWithEquals app) {
if (app.userId != module.userId) {
return true;
}
if (info.packageName.equals(this.module.packageName)) {
return true;
}
if (info.packageName.equals(BuildConfig.APPLICATION_ID)) {
return true;
}
if (info.packageName.equals("android")) { if (info.packageName.equals("android")) {
return false; return false;
} }
@ -508,16 +499,20 @@ public class ScopeAdapter extends RecyclerView.Adapter<ScopeAdapter.ViewHolder>
List<String> scopeList = module.getScopeList(); List<String> scopeList = module.getScopeList();
boolean emptyCheckedList = checkedList.isEmpty(); boolean emptyCheckedList = checkedList.isEmpty();
for (PackageInfo info : appList) { for (PackageInfo info : appList) {
int uid = info.applicationInfo.uid; int userId = info.applicationInfo.uid / 100000;
if (info.packageName.equals("android") && uid / 100000 != 0) { String packageName = info.packageName;
if (userId != module.userId ||
packageName.equals("android") && userId != 0 ||
packageName.equals(module.packageName) ||
packageName.equals(BuildConfig.APPLICATION_ID)) {
continue; continue;
} }
ApplicationWithEquals application = new ApplicationWithEquals(info.packageName, uid / 100000); ApplicationWithEquals application = new ApplicationWithEquals(packageName, userId);
installedList.add(application); installedList.add(application);
if (scopeList != null && scopeList.contains(info.packageName)) { if (scopeList != null && scopeList.contains(packageName)) {
recommendedList.add(application); recommendedList.add(application);
if (emptyCheckedList) { if (emptyCheckedList) {
checkedList.add(application); checkedList.add(application);