Skip to content

Commit

Permalink
support installation to inactive slot on Pixel devices
Browse files Browse the repository at this point in the history
Co-authored-by: vvb2060 <vvb2060@gmail.com>
  • Loading branch information
yujincheng08 and vvb2060 committed Jan 6, 2022
1 parent 558710b commit c67e187
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 1 addition & 4 deletions app/src/main/java/com/topjohnwu/magisk/core/Info.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.topjohnwu.magisk.core

import android.os.Build
import androidx.databinding.ObservableBoolean
import com.topjohnwu.magisk.DynAPK
import com.topjohnwu.magisk.core.model.UpdateInfo
Expand Down Expand Up @@ -28,14 +27,12 @@ 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 hasGMS = true
@JvmField val isPixel = Build.BRAND == "google"
@JvmField val isEmulator =
getProperty("ro.kernel.qemu", "0") == "1" ||
getProperty("ro.boot.qemu", "0") == "1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class InstallViewModel(

val isRooted = Shell.rootAccess()
val skipOptions = Info.isEmulator || (Info.ramdisk && !Info.isFDE && Info.isSAR)
val noSecondSlot = !isRooted || Info.isPixel || Info.isVirtualAB || !Info.isAB || Info.isEmulator
val noSecondSlot = !isRooted || !Info.isAB || Info.isEmulator

@get:Bindable
var step = if (skipOptions) 1 else 0
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/raw/manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ post_ota() {
cd $NVBASE
cp -f $1 bootctl
rm -f $1
if [ -f "/system/lib64/android.hardware.boot@1.2.so" ]; then
sed -i 's/android.hardware.boot@1.0.so/android.hardware.boot@1.2.so/' bootctl
elif [ -f "/system/lib64/android.hardware.boot@1.1.so" ]; then
sed -i 's/android.hardware.boot@1.0.so/android.hardware.boot@1.1.so/' bootctl
fi
chmod 755 bootctl
./bootctl hal-info || return
[ $(./bootctl get-current-slot) -eq 0 ] && SLOT_NUM=1 || SLOT_NUM=0
Expand Down

0 comments on commit c67e187

Please # to comment.