Bump min version to v22

This commit is contained in:
topjohnwu 2022-06-01 03:05:29 -07:00
parent 10b1782732
commit 05e5ac2ad2
2 changed files with 6 additions and 21 deletions

View File

@ -25,10 +25,9 @@ object Const {
val APP_IS_CANARY get() = Version.isCanary(BuildConfig.VERSION_CODE)
object Version {
const val MIN_VERSION = "v21.0"
const val MIN_VERCODE = 21000
const val MIN_VERSION = "v22.0"
const val MIN_VERCODE = 22000
fun atLeast_21_2() = Info.env.versionCode >= 21200 || isCanary()
fun atLeast_24_0() = Info.env.versionCode >= 24000 || isCanary()
fun atLeast_25_0() = Info.env.versionCode >= 25000 || isCanary()
fun isCanary() = isCanary(Info.env.versionCode)

View File

@ -29,7 +29,6 @@ data class LocalModule(
private val removeFile = RootUtils.fs.getFile(path, "remove")
private val disableFile = RootUtils.fs.getFile(path, "disable")
private val updateFile = RootUtils.fs.getFile(path, "update")
private val ruleFile = RootUtils.fs.getFile(path, "sepolicy.rule")
private val riruFolder = RootUtils.fs.getFile(path, "riru")
private val zygiskFolder = RootUtils.fs.getFile(path, "zygisk")
private val unloaded = RootUtils.fs.getFile(zygiskFolder, "unloaded")
@ -42,19 +41,12 @@ data class LocalModule(
var enable: Boolean
get() = !disableFile.exists()
set(enable) {
val dir = "$PERSIST/$id"
if (enable) {
disableFile.delete()
if (Const.Version.atLeast_21_2())
Shell.cmd("copy_sepolicy_rules").submit()
else
Shell.cmd("mkdir -p $dir", "cp -af $ruleFile $dir").submit()
Shell.cmd("copy_sepolicy_rules").submit()
} else {
!disableFile.createNewFile()
if (Const.Version.atLeast_21_2())
Shell.cmd("copy_sepolicy_rules").submit()
else
Shell.cmd("rm -rf $dir").submit()
Shell.cmd("copy_sepolicy_rules").submit()
}
}
@ -64,16 +56,10 @@ data class LocalModule(
if (remove) {
if (updateFile.exists()) return
removeFile.createNewFile()
if (Const.Version.atLeast_21_2())
Shell.cmd("copy_sepolicy_rules").submit()
else
Shell.cmd("rm -rf $PERSIST/$id").submit()
Shell.cmd("copy_sepolicy_rules").submit()
} else {
removeFile.delete()
if (Const.Version.atLeast_21_2())
Shell.cmd("copy_sepolicy_rules").submit()
else
Shell.cmd("cp -af $ruleFile $PERSIST/$id").submit()
Shell.cmd("copy_sepolicy_rules").submit()
}
}