From a49328edd35393280a7586b08d8e4c9c92d1c4eb Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Thu, 7 Mar 2019 02:07:34 -0500 Subject: [PATCH] Workaround Binder transaction limits --- app/build.gradle | 2 +- .../magisk/adapters/ApplicationAdapter.java | 54 ++++++++++++------- 2 files changed, 37 insertions(+), 19 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 3e8726949..a1d384d9f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -74,7 +74,7 @@ dependencies { fullImplementation "androidx.recyclerview:recyclerview:${androidXVersion}" fullImplementation "androidx.cardview:cardview:${androidXVersion}" fullImplementation "com.google.android.material:material:${androidXVersion}" - fullImplementation 'android.arch.work:work-runtime:1.0.0-rc02' + fullImplementation 'android.arch.work:work-runtime:1.0.0' fullImplementation 'androidx.room:room-runtime:2.0.0' fullImplementation 'androidx.transition:transition:1.0.1' diff --git a/app/src/full/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java b/app/src/full/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java index d0c2fe40c..682cccf31 100644 --- a/app/src/full/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java +++ b/app/src/full/java/com/topjohnwu/magisk/adapters/ApplicationAdapter.java @@ -41,7 +41,8 @@ public class ApplicationAdapter extends RecyclerView.Adapter HIDE_BLACKLIST = Arrays.asList( App.self.getPackageName(), "android", - "com.android.chrome" + "com.android.chrome", + "com.google.android.webview" ); private static final String SAFETYNET_PROCESS = "com.google.android.gms.unstable"; private static final String GMS_PACKAGE = "com.google.android.gms"; @@ -73,12 +74,28 @@ public class ApplicationAdapter extends RecyclerView.Adapter installed = pm.getInstalledPackages( - PackageManager.GET_ACTIVITIES | PackageManager.GET_SERVICES | - PackageManager.GET_RECEIVERS | PackageManager.GET_PROVIDERS); + List installed = pm.getInstalledApplications(0); fullList.clear(); hideList.clear(); @@ -86,19 +103,20 @@ public class ApplicationAdapter extends RecyclerView.Adapter procSet = new ArraySet<>(); - addProcesses(procSet, pkg.activities); - addProcesses(procSet, pkg.services); - addProcesses(procSet, pkg.receivers); - addProcesses(procSet, pkg.providers); - for (String proc : procSet) { - fullList.add(new HideAppInfo(pkg.applicationInfo, proc)); + for (ApplicationInfo info : installed) { + // Do not show black-listed and disabled apps + if (!HIDE_BLACKLIST.contains(info.packageName) && info.enabled) { + Set set = new ArraySet<>(); + set.add(info.packageName); + PackageInfo pkg = getPackageInfo(info.packageName); + if (pkg != null) { + addProcesses(set, pkg.activities); + addProcesses(set, pkg.services); + addProcesses(set, pkg.receivers); + addProcesses(set, pkg.providers); } + for (String process : set) + fullList.add(new HideAppInfo(info, process)); } } @@ -222,7 +240,7 @@ public class ApplicationAdapter extends RecyclerView.Adapter c; c = Comparators.comparing((HideAppInfo t) -> t.hidden); c = Comparators.reversed(c); - c = Comparators.thenComparing(c, (a, b) -> a.name.compareToIgnoreCase(b.name)); + c = Comparators.thenComparing(c, t -> t.name, String::compareToIgnoreCase); c = Comparators.thenComparing(c, t -> t.info.packageName); c = Comparators.thenComparing(c, t -> t.process); return c.compare(this, o);