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 159f8be79..02a090dce 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 @@ -14,6 +14,7 @@ import com.topjohnwu.magisk.ktx.get import com.topjohnwu.magisk.ktx.packageInfo import com.topjohnwu.magisk.ktx.packageName import com.topjohnwu.magisk.ktx.processes +import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.magisk.utils.set import com.topjohnwu.superuser.Shell import kotlinx.coroutines.Dispatchers @@ -46,6 +47,10 @@ class HideViewModel : BaseViewModel(), Queryable { } override fun refresh() = viewModelScope.launch { + if (!Utils.showSuperUser()) { + state = State.LOADING_FAILED + return@launch + } state = State.LOADING val (apps, diff) = withContext(Dispatchers.Default) { val pm = get() diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt index 55bc83d17..2bf16dab1 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/superuser/SuperuserViewModel.kt @@ -18,6 +18,7 @@ import com.topjohnwu.magisk.databinding.ComparableRvItem import com.topjohnwu.magisk.events.SnackbarEvent import com.topjohnwu.magisk.events.dialog.BiometricEvent import com.topjohnwu.magisk.events.dialog.SuperuserRevokeDialog +import com.topjohnwu.magisk.utils.Utils import com.topjohnwu.magisk.view.TappableHeadlineItem import com.topjohnwu.magisk.view.TextItem import kotlinx.coroutines.Dispatchers @@ -48,6 +49,10 @@ class SuperuserViewModel( // --- override fun refresh() = viewModelScope.launch { + if (!Utils.showSuperUser()) { + state = State.LOADING_FAILED + return@launch + } state = State.LOADING val (policies, diff) = withContext(Dispatchers.Default) { val policies = db.fetchAll { diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.kt b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.kt index dad7d4c46..6c5a9b6be 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/Utils.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/Utils.kt @@ -23,7 +23,7 @@ object Utils { fun showSuperUser(): Boolean { return Info.env.isActive && (Const.USER_ID == 0 - || Config.suMultiuserMode != Config.Value.MULTIUSER_MODE_OWNER_MANAGED) + || Config.suMultiuserMode == Config.Value.MULTIUSER_MODE_USER) } fun openLink(context: Context, link: Uri) { diff --git a/app/src/main/res/layout/fragment_hide_md2.xml b/app/src/main/res/layout/fragment_hide_md2.xml index 5798565c3..50e6fbb14 100644 --- a/app/src/main/res/layout/fragment_hide_md2.xml +++ b/app/src/main/res/layout/fragment_hide_md2.xml @@ -35,6 +35,7 @@ + + + + + + diff --git a/app/src/main/res/layout/fragment_superuser_md2.xml b/app/src/main/res/layout/fragment_superuser_md2.xml index 7069376e1..e09bc06fe 100644 --- a/app/src/main/res/layout/fragment_superuser_md2.xml +++ b/app/src/main/res/layout/fragment_superuser_md2.xml @@ -57,6 +57,24 @@ + + + + + +