mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-11-30 13:35:27 +00:00
Revert to old behavior on old MagiskHide versions
This commit is contained in:
parent
8e9a7b25a1
commit
10f50e2401
@ -39,6 +39,7 @@ import java.util.Set;
|
||||
import butterknife.BindView;
|
||||
import java9.util.Comparators;
|
||||
import java9.util.Objects;
|
||||
import java9.util.Sets;
|
||||
import java9.util.stream.Collectors;
|
||||
import java9.util.stream.Stream;
|
||||
import java9.util.stream.StreamSupport;
|
||||
@ -48,6 +49,7 @@ public class ApplicationAdapter extends SectionedAdapter
|
||||
|
||||
private static final String SAFETYNET_PROCESS = "com.google.android.gms.unstable";
|
||||
private static final String GMS_PACKAGE = "com.google.android.gms";
|
||||
private static boolean old_hide = false;
|
||||
|
||||
/* A list of apps that should not be shown as hide-able */
|
||||
private static final List<String> HIDE_BLACKLIST = Arrays.asList(
|
||||
@ -243,17 +245,21 @@ public class ApplicationAdapter extends SectionedAdapter
|
||||
fullList = StreamSupport.stream(pm.getInstalledApplications(0))
|
||||
.filter(info -> !HIDE_BLACKLIST.contains(info.packageName) && info.enabled)
|
||||
.map(info -> {
|
||||
Set<String> set = new ArraySet<>();
|
||||
PackageInfo pkg = getPackageInfo(info.packageName);
|
||||
if (pkg != null) {
|
||||
addProcesses(set, pkg.activities);
|
||||
addProcesses(set, pkg.services);
|
||||
addProcesses(set, pkg.receivers);
|
||||
addProcesses(set, pkg.providers);
|
||||
if (old_hide) {
|
||||
return new HideAppInfo(info, Sets.of(info.packageName));
|
||||
} else {
|
||||
Set<String> set = new ArraySet<>();
|
||||
PackageInfo pkg = getPackageInfo(info.packageName);
|
||||
if (pkg != null) {
|
||||
addProcesses(set, pkg.activities);
|
||||
addProcesses(set, pkg.services);
|
||||
addProcesses(set, pkg.receivers);
|
||||
addProcesses(set, pkg.providers);
|
||||
}
|
||||
if (set.isEmpty())
|
||||
return null;
|
||||
return new HideAppInfo(info, set);
|
||||
}
|
||||
if (set.isEmpty())
|
||||
return null;
|
||||
return new HideAppInfo(info, set);
|
||||
}).filter(Objects::nonNull).sorted()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
@ -368,13 +374,14 @@ public class ApplicationAdapter extends SectionedAdapter
|
||||
String process;
|
||||
|
||||
HideTarget(String line) {
|
||||
String[] split = line.split("\\|");
|
||||
String[] split = line.split("\\|", 2);
|
||||
pkg = split[0];
|
||||
if (split.length >= 2) {
|
||||
if (split.length == 2) {
|
||||
process = split[1];
|
||||
} else {
|
||||
// Backwards compatibility
|
||||
process = pkg.equals(GMS_PACKAGE) ? SAFETYNET_PROCESS : pkg;
|
||||
old_hide = true;
|
||||
process = pkg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user