Always show hidden apps

This commit is contained in:
vvb2060 2021-02-25 04:24:44 +08:00 committed by John Wu
parent 29a9b18c4c
commit 122a73e086
4 changed files with 6 additions and 5 deletions

View File

@ -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(

View File

@ -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() {

View File

@ -62,12 +62,13 @@ class HideViewModel : BaseViewModel(), Queryable {
state = State.LOADING
val (apps, diff) = withContext(Dispatchers.Default) {
val pm = get<PackageManager>()
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()

View File

@ -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
}