Check environment on emulator

We need to test modules on emulator.
This commit is contained in:
vvb2060 2020-12-01 01:21:36 +08:00 committed by topjohnwu
parent 3f81f9371f
commit ff4cea229a

View File

@ -1,6 +1,5 @@
package com.topjohnwu.magisk.ui.home package com.topjohnwu.magisk.ui.home
import android.os.Build
import androidx.databinding.Bindable import androidx.databinding.Bindable
import androidx.lifecycle.viewModelScope import androidx.lifecycle.viewModelScope
import com.topjohnwu.magisk.BuildConfig import com.topjohnwu.magisk.BuildConfig
@ -152,17 +151,7 @@ class HomeViewModel(
MagiskState.NOT_INSTALLED, MagiskState.NOT_INSTALLED,
MagiskState.LOADING MagiskState.LOADING
) )
if (invalidStates.any { it == stateMagisk } || shownDialog) return
// Don't bother checking env when magisk is not installed, loading or already has been shown
if (
invalidStates.any { it == stateMagisk } ||
shownDialog ||
// don't care for emulators either
Build.DEVICE.orEmpty().contains("generic") ||
Build.PRODUCT.orEmpty().contains("generic")
) {
return
}
val result = Shell.su("env_check").await() val result = Shell.su("env_check").await()
if (!result.isSuccess) { if (!result.isSuccess) {