Hide OTA option on Pixel devices

This commit is contained in:
topjohnwu 2020-09-23 04:49:18 -07:00
parent 85bef8fa96
commit 0ef92a4866
3 changed files with 8 additions and 5 deletions

View File

@ -33,6 +33,7 @@ object Info {
@JvmStatic var ramdisk = false
@JvmStatic var hasGMS = true
@JvmStatic var crypto = ""
@JvmStatic var isPixel = false
val isConnected by lazy {
ObservableBoolean(false).also { field ->

View File

@ -38,14 +38,16 @@ class RootInit : Shell.Initializer() {
add("mm_init")
}.exec()
fun getvar(name: String) = ShellUtils.fastCmd(shell, "echo \$$name")
fun getBool(name: String) = getvar(name).toBoolean()
fun fastCmd(cmd: String) = ShellUtils.fastCmd(shell, cmd)
fun getVar(name: String) = fastCmd("echo \$$name")
fun getBool(name: String) = getVar(name).toBoolean()
Const.MAGISKTMP = getvar("MAGISKTMP")
Const.MAGISKTMP = getVar("MAGISKTMP")
Info.isSAR = getBool("SYSTEM_ROOT")
Info.ramdisk = getBool("RAMDISKEXIST")
Info.isAB = getBool("ISAB")
Info.crypto = getvar("CRYPTOTYPE")
Info.crypto = getVar("CRYPTOTYPE")
Info.isPixel = fastCmd("getprop ro.product.brand") == "google"
// Default presets
Config.recovery = getBool("RECOVERYMODE")

View File

@ -213,7 +213,7 @@
<RadioButton
android:id="@+id/method_inactive_slot"
style="@style/WidgetFoundation.RadioButton"
gone="@{!viewModel.isRooted || !Info.isAB}"
gone="@{!viewModel.isRooted || Info.isPixel || !Info.isAB}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/install_inactive_slot" />