mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-17 14:18:29 +00:00
Bump min version to v22
This commit is contained in:
parent
10b1782732
commit
05e5ac2ad2
@ -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)
|
||||
|
@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user