Commit 984f32f9 authored by vvb2060's avatar vvb2060 Committed by topjohnwu

Move copy_sepolicy_rules to manager

We don’t need it when patch boot
parent eee7f097
...@@ -10,6 +10,7 @@ import androidx.core.os.postDelayed ...@@ -10,6 +10,7 @@ import androidx.core.os.postDelayed
import androidx.localbroadcastmanager.content.LocalBroadcastManager import androidx.localbroadcastmanager.content.LocalBroadcastManager
import com.topjohnwu.magisk.R import com.topjohnwu.magisk.R
import com.topjohnwu.magisk.core.Config import com.topjohnwu.magisk.core.Config
import com.topjohnwu.magisk.core.Info
import com.topjohnwu.magisk.core.utils.MediaStoreUtils import com.topjohnwu.magisk.core.utils.MediaStoreUtils
import com.topjohnwu.magisk.core.utils.MediaStoreUtils.inputStream import com.topjohnwu.magisk.core.utils.MediaStoreUtils.inputStream
import com.topjohnwu.magisk.core.utils.MediaStoreUtils.outputStream import com.topjohnwu.magisk.core.utils.MediaStoreUtils.outputStream
...@@ -339,6 +340,13 @@ abstract class MagiskInstallImpl : KoinComponent { ...@@ -339,6 +340,13 @@ abstract class MagiskInstallImpl : KoinComponent {
return true return true
} }
private fun copySepolicyRules(): Boolean {
if (Info.remote.magisk.versionCode >= 21100) return true
// Copy existing rules for migration
"copy_sepolicy_rules".sh()
return true
}
private fun flashBoot(): Boolean { private fun flashBoot(): Boolean {
if (!"direct_install $installDir $srcBoot".sh().isSuccess) if (!"direct_install $installDir $srcBoot".sh().isSuccess)
return false return false
...@@ -373,10 +381,11 @@ abstract class MagiskInstallImpl : KoinComponent { ...@@ -373,10 +381,11 @@ abstract class MagiskInstallImpl : KoinComponent {
protected fun doPatchFile(patchFile: Uri) = extractZip() && handleFile(patchFile) protected fun doPatchFile(patchFile: Uri) = extractZip() && handleFile(patchFile)
protected fun direct() = findImage() && extractZip() && patchBoot() && flashBoot() protected fun direct() = findImage() && extractZip() && patchBoot() &&
copySepolicyRules() && flashBoot()
protected suspend fun secondSlot() = protected suspend fun secondSlot() = findSecondaryImage() && extractZip() &&
findSecondaryImage() && extractZip() && patchBoot() && flashBoot() && postOTA() patchBoot() && copySepolicyRules() && flashBoot() && postOTA()
protected fun fixEnv(zip: Uri): Boolean { protected fun fixEnv(zip: Uri): Boolean {
installDir = SuFile("/data/adb/magisk") installDir = SuFile("/data/adb/magisk")
......
...@@ -185,8 +185,5 @@ ui_print "- Repacking boot image" ...@@ -185,8 +185,5 @@ ui_print "- Repacking boot image"
# Sign chromeos boot # Sign chromeos boot
$CHROMEOS && sign_chromeos $CHROMEOS && sign_chromeos
# Copy existing rules for migration
$BOOTMODE && copy_sepolicy_rules
# Reset any error code # Reset any error code
true true
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment