Better environment status detection

This commit is contained in:
topjohnwu
2019-11-16 17:38:10 -05:00
parent 7f6a6016d6
commit da159e4655
7 changed files with 47 additions and 47 deletions
@@ -14,7 +14,6 @@ import com.topjohnwu.magisk.*
import com.topjohnwu.magisk.extensions.getBitmap
import com.topjohnwu.magisk.ui.SplashActivity
import com.topjohnwu.magisk.utils.Utils
import com.topjohnwu.superuser.Shell
object Shortcuts {
@@ -28,7 +27,6 @@ object Shortcuts {
@RequiresApi(api = 25)
private fun getShortCuts(context: Context): List<ShortcutInfo> {
val shortCuts = mutableListOf<ShortcutInfo>()
val root = Shell.rootAccess()
val intent = context.intent<SplashActivity>()
fun getIcon(id: Int): Icon {
@@ -53,7 +51,7 @@ object Shortcuts {
.build()
)
}
if (root && Info.env.magiskHide) {
if (Info.env.magiskHide) {
shortCuts.add(
ShortcutInfo.Builder(context, "magiskhide")
.setShortLabel(context.getString(R.string.magiskhide))
@@ -68,7 +66,7 @@ object Shortcuts {
.build()
)
}
if (!Config.coreOnly && root && Info.env.magiskVersionCode >= 0) {
if (!Config.coreOnly && Info.env.isActive) {
shortCuts.add(
ShortcutInfo.Builder(context, "modules")
.setShortLabel(context.getString(R.string.modules))