Update vbmeta option hiding criteria

Hide when Samsung, A/B, or vbmeta partition exists
This commit is contained in:
topjohnwu 2022-01-11 04:47:11 -08:00 committed by John Wu
parent fd7bf2bc3a
commit ba6e6cc15a
3 changed files with 13 additions and 13 deletions

View File

@ -28,21 +28,23 @@ object Info {
// Device state
@JvmStatic val env by lazy { loadState() }
@JvmStatic var isSAR = false
@JvmField var isSAR = false
var isAB = false
val isVirtualAB = getProperty("ro.virtual_ab.enabled", "false") == "true"
@JvmField val isZygiskEnabled = System.getenv("ZYGISK_ENABLED") == "1"
@JvmStatic val isFDE get() = crypto == "block"
@JvmField var ramdisk = false
@JvmField var vbmeta = false
@JvmField var hasGMS = true
@JvmField val isPixel = Build.BRAND == "google"
@JvmField val isEmulator =
getProperty("ro.kernel.qemu", "0") == "1" ||
getProperty("ro.boot.qemu", "0") == "1"
var crypto = ""
var noDataExec = false
@JvmField var hasGMS = true
@JvmField val isPixel = Build.BRAND == "google"
val isSamsung = Build.MANUFACTURER.equals("samsung", ignoreCase = true)
@JvmField val isEmulator =
getProperty("ro.kernel.qemu", "0") == "1" ||
getProperty("ro.boot.qemu", "0") == "1"
val isConnected by lazy {
ObservableBoolean(false).also { field ->
NetworkObserver.observe(AppContext) {

View File

@ -1,7 +1,6 @@
package com.topjohnwu.magisk.ui.install
import android.net.Uri
import android.os.Build
import androidx.databinding.Bindable
import androidx.lifecycle.viewModelScope
import com.topjohnwu.magisk.BR
@ -27,11 +26,12 @@ class InstallViewModel(
) : BaseViewModel() {
val isRooted = Shell.rootAccess()
val skipOptions = Info.ramdisk && !Info.isFDE && Info.isSAR && !(!Info.vbmeta && Build.VERSION.SDK_INT >= 30)
val hideVbmeta = Info.vbmeta || Info.isSamsung || Info.isAB
val skipOptions = Info.isEmulator || (Info.isSAR && !Info.isFDE && hideVbmeta && Info.ramdisk)
val noSecondSlot = !isRooted || Info.isPixel || Info.isVirtualAB || !Info.isAB || Info.isEmulator
@get:Bindable
var step = if (Info.isEmulator || skipOptions) 1 else 0
var step = if (skipOptions) 1 else 0
set(value) = set(value, field, { field = it }, BR.step)
var _method = -1

View File

@ -9,8 +9,6 @@
<import type="com.topjohnwu.magisk.core.Config" />
<import type="android.os.Build" />
<variable
name="viewModel"
type="com.topjohnwu.magisk.ui.install.InstallViewModel" />
@ -36,7 +34,7 @@
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card"
gone="@{viewModel.skipOptions || Info.isEmulator}"
gone="@{viewModel.skipOptions}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
@ -112,7 +110,7 @@
<CheckBox
style="@style/WidgetFoundation.Checkbox"
goneUnless="@{!Info.vbmeta &amp;&amp; Build.VERSION.SDK_INT >= 30}"
gone="@{viewModel.hideVbmeta}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="@={Config.patchVbmeta}"