Prepare for public release

This commit is contained in:
topjohnwu 2020-09-29 03:57:23 -07:00
parent e973d49517
commit 241f2656fa
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,6 @@
package com.topjohnwu.magisk.core package com.topjohnwu.magisk.core
import android.os.Process import android.os.Process
import com.topjohnwu.magisk.BuildConfig
object Const { object Const {
@ -26,9 +25,10 @@ object Const {
const val MIN_VERSION = "v19.0" const val MIN_VERSION = "v19.0"
const val MIN_VERCODE = 19000 const val MIN_VERCODE = 19000
fun atLeast_20_2() = Info.env.magiskVersionCode >= 20200 fun atLeast_20_2() = Info.env.magiskVersionCode >= 20200 || isCanary()
fun atLeast_20_4() = Info.env.magiskVersionCode >= 20400 fun atLeast_20_4() = Info.env.magiskVersionCode >= 20400 || isCanary()
fun atLeastCanary() = Info.env.magiskVersionCode > BuildConfig.LATEST_MAGISK / 100 * 100 fun atLeast_21_0() = Info.env.magiskVersionCode >= 21000 || isCanary()
fun isCanary() = Info.env.magiskVersionCode % 100 != 0
} }
object ID { object ID {

View File

@ -67,7 +67,7 @@ class SuRequestHandler(
private suspend fun init(intent: Intent) = withContext(Dispatchers.IO) { private suspend fun init(intent: Intent) = withContext(Dispatchers.IO) {
try { try {
val uid: Int val uid: Int
if (Const.Version.atLeastCanary()) { if (Const.Version.atLeast_21_0()) {
val name = intent.getStringExtra("fifo") ?: throw SuRequestError() val name = intent.getStringExtra("fifo") ?: throw SuRequestError()
uid = intent.getIntExtra("uid", -1).also { if (it < 0) throw SuRequestError() } uid = intent.getIntExtra("uid", -1).also { if (it < 0) throw SuRequestError() }
output = DataOutputStream(FileOutputStream(name).buffered()) output = DataOutputStream(FileOutputStream(name).buffered())

View File

@ -25,7 +25,7 @@ class RootInit : Shell.Initializer() {
} else { } else {
add("export MAGISKTMP=/sbin/.magisk") add("export MAGISKTMP=/sbin/.magisk")
} }
if (Const.Version.atLeastCanary()) { if (Const.Version.atLeast_21_0()) {
add("export ASH_STANDALONE=1") add("export ASH_STANDALONE=1")
add("[ -x /data/adb/magisk/busybox ] && exec /data/adb/magisk/busybox sh") add("[ -x /data/adb/magisk/busybox ] && exec /data/adb/magisk/busybox sh")
} else { } else {