From 122a73e086dabbb7db3d70fea4be1e29305b52ca Mon Sep 17 00:00:00 2001 From: vvb2060 Date: Thu, 25 Feb 2021 04:24:44 +0800 Subject: [PATCH] Always show hidden apps --- app/src/main/java/com/topjohnwu/magisk/core/Info.kt | 2 +- .../main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt | 2 +- .../main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt | 5 +++-- .../java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt b/app/src/main/java/com/topjohnwu/magisk/core/Info.kt index 8e9816299..3e5151385 100644 --- a/app/src/main/java/com/topjohnwu/magisk/core/Info.kt +++ b/app/src/main/java/com/topjohnwu/magisk/core/Info.kt @@ -66,7 +66,7 @@ object Info { private fun loadState() = Env( fastCmd("magisk -v").split(":".toRegex())[0], runCatching { fastCmd("magisk -V").toInt() }.getOrDefault(-1), - Shell.su("magiskhide --status").exec().isSuccess + Shell.su("magiskhide status").exec().isSuccess ) class Env( diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt index d35d03630..a4d8ae448 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideRvItems.kt @@ -99,7 +99,7 @@ class HideProcessRvItem( set(value) = set(value, process.isHidden, { process.isHidden = it }, BR.hidden) { val arg = if (it) "add" else "rm" val (name, pkg) = process - Shell.su("magiskhide --$arg $pkg $name").submit() + Shell.su("magiskhide $arg $pkg $name").submit() } fun toggle() { diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt index 45ded7020..2248a293c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/hide/HideViewModel.kt @@ -62,12 +62,13 @@ class HideViewModel : BaseViewModel(), Queryable { state = State.LOADING val (apps, diff) = withContext(Dispatchers.Default) { val pm = get() - val hideList = Shell.su("magiskhide --ls").exec().out.map { CmdlineHiddenItem(it) } + val hideList = Shell.su("magiskhide ls").exec().out.map { CmdlineHiddenItem(it) } val apps = pm.getInstalledApplications(MATCH_UNINSTALLED_PACKAGES) .asSequence() - .filter { it.enabled && !blacklist.contains(it.packageName) } + .filterNot { blacklist.contains(it.packageName) } .map { HideAppInfo(it, pm, hideList) } .filter { it.processes.isNotEmpty() } + .filter { info -> info.enabled || info.processes.any { it.isHidden } } .map { HideRvItem(it) } .toList() .sorted() diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt index fe176409b..98708c64b 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/settings/SettingsItems.kt @@ -246,7 +246,7 @@ object MagiskHide : BaseSettingsItem.Toggle() { override var value = Config.magiskHide set(value) = setV(value, field, { field = it }) { val cmd = if (it) "enable" else "disable" - Shell.su("magiskhide --$cmd").submit { cb -> + Shell.su("magiskhide $cmd").submit { cb -> if (cb.isSuccess) Config.magiskHide = it else field = !it }