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( private fun loadState() = Env(
fastCmd("magisk -v").split(":".toRegex())[0], fastCmd("magisk -v").split(":".toRegex())[0],
runCatching { fastCmd("magisk -V").toInt() }.getOrDefault(-1), runCatching { fastCmd("magisk -V").toInt() }.getOrDefault(-1),
Shell.su("magiskhide --status").exec().isSuccess Shell.su("magiskhide status").exec().isSuccess
) )
class Env( class Env(

View File

@ -99,7 +99,7 @@ class HideProcessRvItem(
set(value) = set(value, process.isHidden, { process.isHidden = it }, BR.hidden) { set(value) = set(value, process.isHidden, { process.isHidden = it }, BR.hidden) {
val arg = if (it) "add" else "rm" val arg = if (it) "add" else "rm"
val (name, pkg) = process val (name, pkg) = process
Shell.su("magiskhide --$arg $pkg $name").submit() Shell.su("magiskhide $arg $pkg $name").submit()
} }
fun toggle() { fun toggle() {

View File

@ -62,12 +62,13 @@ class HideViewModel : BaseViewModel(), Queryable {
state = State.LOADING state = State.LOADING
val (apps, diff) = withContext(Dispatchers.Default) { val (apps, diff) = withContext(Dispatchers.Default) {
val pm = get<PackageManager>() 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) val apps = pm.getInstalledApplications(MATCH_UNINSTALLED_PACKAGES)
.asSequence() .asSequence()
.filter { it.enabled && !blacklist.contains(it.packageName) } .filterNot { blacklist.contains(it.packageName) }
.map { HideAppInfo(it, pm, hideList) } .map { HideAppInfo(it, pm, hideList) }
.filter { it.processes.isNotEmpty() } .filter { it.processes.isNotEmpty() }
.filter { info -> info.enabled || info.processes.any { it.isHidden } }
.map { HideRvItem(it) } .map { HideRvItem(it) }
.toList() .toList()
.sorted() .sorted()

View File

@ -246,7 +246,7 @@ object MagiskHide : BaseSettingsItem.Toggle() {
override var value = Config.magiskHide override var value = Config.magiskHide
set(value) = setV(value, field, { field = it }) { set(value) = setV(value, field, { field = it }) {
val cmd = if (it) "enable" else "disable" 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 if (cb.isSuccess) Config.magiskHide = it
else field = !it else field = !it
} }