Remove canary debug channel
All canary builds will be debug only
This commit is contained in:
parent
a748d5291a
commit
45b5e89912
@ -70,7 +70,6 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
const val BETA_CHANNEL = 1
|
const val BETA_CHANNEL = 1
|
||||||
const val CUSTOM_CHANNEL = 2
|
const val CUSTOM_CHANNEL = 2
|
||||||
const val CANARY_CHANNEL = 3
|
const val CANARY_CHANNEL = 3
|
||||||
const val CANARY_DEBUG_CHANNEL = 4
|
|
||||||
|
|
||||||
// root access mode
|
// root access mode
|
||||||
const val ROOT_ACCESS_DISABLED = 0
|
const val ROOT_ACCESS_DISABLED = 0
|
||||||
@ -106,12 +105,10 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val defaultChannel =
|
private val defaultChannel =
|
||||||
if (isCanaryVersion) {
|
if (BuildConfig.DEBUG)
|
||||||
if (BuildConfig.DEBUG)
|
Value.CANARY_CHANNEL
|
||||||
Value.CANARY_DEBUG_CHANNEL
|
else
|
||||||
else
|
Value.DEFAULT_CHANNEL
|
||||||
Value.CANARY_CHANNEL
|
|
||||||
} else Value.DEFAULT_CHANNEL
|
|
||||||
|
|
||||||
var bootId by preference(Key.BOOT_ID, "")
|
var bootId by preference(Key.BOOT_ID, "")
|
||||||
|
|
||||||
@ -154,33 +151,34 @@ object Config : PreferenceModel, DBConfig {
|
|||||||
|
|
||||||
private const val SU_FINGERPRINT = "su_fingerprint"
|
private const val SU_FINGERPRINT = "su_fingerprint"
|
||||||
|
|
||||||
fun initialize() = prefs.also {
|
fun initialize() {
|
||||||
if (it.getBoolean(SU_FINGERPRINT, false)) {
|
prefs.edit { parsePrefs() }
|
||||||
suBiometric = true
|
|
||||||
|
prefs.edit {
|
||||||
|
// Settings migration
|
||||||
|
if (prefs.getBoolean(SU_FINGERPRINT, false))
|
||||||
|
suBiometric = true
|
||||||
|
remove(SU_FINGERPRINT)
|
||||||
|
prefs.getString(Key.UPDATE_CHANNEL, null).also {
|
||||||
|
if (it == null)
|
||||||
|
putString(Key.UPDATE_CHANNEL, defaultChannel.toString())
|
||||||
|
else if (it.toInt() > Value.CANARY_CHANNEL)
|
||||||
|
putString(Key.UPDATE_CHANNEL, Value.CANARY_CHANNEL.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get actual state
|
||||||
|
putBoolean(Key.COREONLY, Const.MAGISK_DISABLE_FILE.exists())
|
||||||
|
|
||||||
|
// Write database configs
|
||||||
|
putString(Key.ROOT_ACCESS, rootMode.toString())
|
||||||
|
putString(Key.SU_MNT_NS, suMntNamespaceMode.toString())
|
||||||
|
putString(Key.SU_MULTIUSER_MODE, suMultiuserMode.toString())
|
||||||
|
putBoolean(Key.SU_BIOMETRIC, BiometricHelper.isEnabled)
|
||||||
}
|
}
|
||||||
}.edit {
|
|
||||||
parsePrefs(this)
|
|
||||||
|
|
||||||
// Legacy stuff
|
|
||||||
remove(SU_FINGERPRINT)
|
|
||||||
|
|
||||||
// Get actual state
|
|
||||||
putBoolean(Key.COREONLY, Const.MAGISK_DISABLE_FILE.exists())
|
|
||||||
|
|
||||||
// Write database configs
|
|
||||||
putString(Key.ROOT_ACCESS, rootMode.toString())
|
|
||||||
putString(Key.SU_MNT_NS, suMntNamespaceMode.toString())
|
|
||||||
putString(Key.SU_MULTIUSER_MODE, suMultiuserMode.toString())
|
|
||||||
putBoolean(Key.SU_BIOMETRIC, BiometricHelper.isEnabled)
|
|
||||||
}.also {
|
|
||||||
if (!prefs.contains(Key.UPDATE_CHANNEL))
|
|
||||||
prefs.edit().putString(Key.UPDATE_CHANNEL, defaultChannel.toString()).apply()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun parsePrefs(editor: SharedPreferences.Editor) = editor.apply {
|
private fun SharedPreferences.Editor.parsePrefs() {
|
||||||
val config = SuFile.open("/data/adb",
|
val config = SuFile.open("/data/adb", Const.MANAGER_CONFIGS)
|
||||||
Const.MANAGER_CONFIGS
|
|
||||||
)
|
|
||||||
if (config.exists()) runCatching {
|
if (config.exists()) runCatching {
|
||||||
val input = SuFileInputStream(config)
|
val input = SuFileInputStream(config)
|
||||||
val parser = Xml.newPullParser()
|
val parser = Xml.newPullParser()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package com.topjohnwu.magisk.core
|
package com.topjohnwu.magisk.core
|
||||||
|
|
||||||
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
|
import com.github.pwittchen.reactivenetwork.library.rx2.ReactiveNetwork
|
||||||
import com.topjohnwu.magisk.BuildConfig
|
|
||||||
import com.topjohnwu.magisk.DynAPK
|
import com.topjohnwu.magisk.DynAPK
|
||||||
import com.topjohnwu.magisk.core.model.UpdateInfo
|
import com.topjohnwu.magisk.core.model.UpdateInfo
|
||||||
import com.topjohnwu.magisk.extensions.get
|
import com.topjohnwu.magisk.extensions.get
|
||||||
@ -14,7 +13,6 @@ import java.io.FileInputStream
|
|||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
val isRunningAsStub get() = Info.stub != null
|
val isRunningAsStub get() = Info.stub != null
|
||||||
val isCanaryVersion = !BuildConfig.VERSION_NAME.contains(".")
|
|
||||||
|
|
||||||
object Info {
|
object Info {
|
||||||
|
|
||||||
|
@ -19,11 +19,8 @@ interface GithubRawServices {
|
|||||||
@GET("$MAGISK_FILES/master/beta.json")
|
@GET("$MAGISK_FILES/master/beta.json")
|
||||||
fun fetchBetaUpdate(): Single<UpdateInfo>
|
fun fetchBetaUpdate(): Single<UpdateInfo>
|
||||||
|
|
||||||
@GET("$MAGISK_FILES/canary/release.json")
|
|
||||||
fun fetchCanaryUpdate(): Single<UpdateInfo>
|
|
||||||
|
|
||||||
@GET("$MAGISK_FILES/canary/debug.json")
|
@GET("$MAGISK_FILES/canary/debug.json")
|
||||||
fun fetchCanaryDebugUpdate(): Single<UpdateInfo>
|
fun fetchCanaryUpdate(): Single<UpdateInfo>
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
fun fetchCustomUpdate(@Url url: String): Single<UpdateInfo>
|
fun fetchCustomUpdate(@Url url: String): Single<UpdateInfo>
|
||||||
@ -73,9 +70,11 @@ interface GithubRawServices {
|
|||||||
interface GithubApiServices {
|
interface GithubApiServices {
|
||||||
|
|
||||||
@GET("repos")
|
@GET("repos")
|
||||||
fun fetchRepos(@Query("page") page: Int,
|
fun fetchRepos(
|
||||||
@Header(Const.Key.IF_NONE_MATCH) etag: String,
|
@Query("page") page: Int,
|
||||||
@Query("sort") sort: String = "pushed",
|
@Header(Const.Key.IF_NONE_MATCH) etag: String,
|
||||||
@Query("per_page") count: Int = 100): Flowable<Result<List<GithubRepoInfo>>>
|
@Query("sort") sort: String = "pushed",
|
||||||
|
@Query("per_page") count: Int = 100
|
||||||
|
): Flowable<Result<List<GithubRepoInfo>>>
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,7 @@ class MagiskRepository(
|
|||||||
Config.Value.DEFAULT_CHANNEL, Config.Value.STABLE_CHANNEL -> apiRaw.fetchStableUpdate()
|
Config.Value.DEFAULT_CHANNEL, Config.Value.STABLE_CHANNEL -> apiRaw.fetchStableUpdate()
|
||||||
Config.Value.BETA_CHANNEL -> apiRaw.fetchBetaUpdate()
|
Config.Value.BETA_CHANNEL -> apiRaw.fetchBetaUpdate()
|
||||||
Config.Value.CANARY_CHANNEL -> apiRaw.fetchCanaryUpdate()
|
Config.Value.CANARY_CHANNEL -> apiRaw.fetchCanaryUpdate()
|
||||||
Config.Value.CANARY_DEBUG_CHANNEL -> apiRaw.fetchCanaryDebugUpdate()
|
Config.Value.CUSTOM_CHANNEL -> apiRaw.fetchCustomUpdate(Config.customChannelUrl)
|
||||||
Config.Value.CUSTOM_CHANNEL -> apiRaw.fetchCustomUpdate(
|
|
||||||
Config.customChannelUrl)
|
|
||||||
else -> throw IllegalArgumentException()
|
else -> throw IllegalArgumentException()
|
||||||
}.flatMap {
|
}.flatMap {
|
||||||
// If remote version is lower than current installed, try switching to beta
|
// If remote version is lower than current installed, try switching to beta
|
||||||
|
@ -12,7 +12,6 @@ import com.topjohnwu.magisk.R
|
|||||||
import com.topjohnwu.magisk.core.Config
|
import com.topjohnwu.magisk.core.Config
|
||||||
import com.topjohnwu.magisk.core.Const
|
import com.topjohnwu.magisk.core.Const
|
||||||
import com.topjohnwu.magisk.core.Info
|
import com.topjohnwu.magisk.core.Info
|
||||||
import com.topjohnwu.magisk.core.isCanaryVersion
|
|
||||||
import com.topjohnwu.magisk.core.utils.*
|
import com.topjohnwu.magisk.core.utils.*
|
||||||
import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
|
import com.topjohnwu.magisk.databinding.DialogSettingsAppNameBinding
|
||||||
import com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
|
import com.topjohnwu.magisk.databinding.DialogSettingsDownloadPathBinding
|
||||||
@ -141,8 +140,7 @@ object UpdateChannel : SettingsItem.Selector() {
|
|||||||
|
|
||||||
override val title = R.string.settings_update_channel_title.asTransitive()
|
override val title = R.string.settings_update_channel_title.asTransitive()
|
||||||
override val entries get() = resources.getStringArray(R.array.update_channel).let {
|
override val entries get() = resources.getStringArray(R.array.update_channel).let {
|
||||||
if (!isCanaryVersion && Config.updateChannel < Config.Value.CANARY_CHANNEL)
|
if (BuildConfig.DEBUG) it.toMutableList().apply { add("Canary") }.toTypedArray() else it
|
||||||
it.take(it.size - 2).toTypedArray() else it
|
|
||||||
}
|
}
|
||||||
override val entryValRes = R.array.value_array
|
override val entryValRes = R.array.value_array
|
||||||
}
|
}
|
||||||
|
@ -81,9 +81,6 @@
|
|||||||
<item>@string/settings_update_stable</item>
|
<item>@string/settings_update_stable</item>
|
||||||
<item>@string/settings_update_beta</item>
|
<item>@string/settings_update_beta</item>
|
||||||
<item>@string/settings_update_custom</item>
|
<item>@string/settings_update_custom</item>
|
||||||
<!-- Debug only, don't care to translate -->
|
|
||||||
<item>Canary</item>
|
|
||||||
<item>Canary (Debug)</item>
|
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="span_count">
|
<string-array name="span_count">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user