Support PATCHVBMETAFLAG env variable

This commit is contained in:
vvb2060
2021-12-15 03:37:52 +08:00
committed by John Wu
parent b2cd24ed1b
commit fd7bf2bc3a
9 changed files with 39 additions and 7 deletions

View File

@@ -109,9 +109,10 @@ object Config : PreferenceModel, DBConfig {
else
Value.DEFAULT_CHANNEL
@JvmStatic var keepVerity = false
@JvmStatic var keepEnc = false
@JvmStatic var recovery = false
@JvmField var keepVerity = false
@JvmField var keepEnc = false
@JvmField var patchVbmeta = false
@JvmField var recovery = false
var bootId by preference(Key.BOOT_ID, "")
var askedHome by preference(Key.ASKED_HOME, false)

View File

@@ -34,6 +34,7 @@ object Info {
@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 =

View File

@@ -357,6 +357,7 @@ abstract class MagiskInstallImpl protected constructor(
"cd $installDir",
"KEEPFORCEENCRYPT=${Config.keepEnc} " +
"KEEPVERITY=${Config.keepVerity} " +
"PATCHVBMETAFLAG=${Config.patchVbmeta} " +
"RECOVERYMODE=${Config.recovery} " +
"sh boot_patch.sh $srcBoot")

View File

@@ -75,6 +75,7 @@ class ShellInit : Shell.Initializer() {
Const.MAGISKTMP = getVar("MAGISKTMP")
Info.isSAR = getBool("SYSTEM_ROOT")
Info.ramdisk = getBool("RAMDISKEXIST")
Info.vbmeta = getBool("VBMETAEXIST")
Info.isAB = getBool("ISAB")
Info.crypto = getVar("CRYPTOTYPE")
@@ -82,6 +83,7 @@ class ShellInit : Shell.Initializer() {
Config.recovery = getBool("RECOVERYMODE")
Config.keepVerity = getBool("KEEPVERITY")
Config.keepEnc = getBool("KEEPFORCEENCRYPT")
Config.patchVbmeta = getBool("PATCHVBMETAFLAG")
return true
}

View File

@@ -1,6 +1,7 @@
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
@@ -26,11 +27,11 @@ class InstallViewModel(
) : BaseViewModel() {
val isRooted = Shell.rootAccess()
val skipOptions = Info.isEmulator || (Info.ramdisk && !Info.isFDE && Info.isSAR)
val skipOptions = Info.ramdisk && !Info.isFDE && Info.isSAR && !(!Info.vbmeta && Build.VERSION.SDK_INT >= 30)
val noSecondSlot = !isRooted || Info.isPixel || Info.isVirtualAB || !Info.isAB || Info.isEmulator
@get:Bindable
var step = if (skipOptions) 1 else 0
var step = if (Info.isEmulator || skipOptions) 1 else 0
set(value) = set(value, field, { field = it }, BR.step)
var _method = -1