mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-22 07:57:39 +00:00
Introduce new debug channel
This commit is contained in:
parent
071ae79fa8
commit
dc65a2b884
@ -70,6 +70,7 @@ object Config : PreferenceModel, DBConfig {
|
||||
const val BETA_CHANNEL = 1
|
||||
const val CUSTOM_CHANNEL = 2
|
||||
const val CANARY_CHANNEL = 3
|
||||
const val DEBUG_CHANNEL = 4
|
||||
|
||||
// root access mode
|
||||
const val ROOT_ACCESS_DISABLED = 0
|
||||
@ -106,6 +107,8 @@ object Config : PreferenceModel, DBConfig {
|
||||
|
||||
private val defaultChannel =
|
||||
if (BuildConfig.DEBUG)
|
||||
Value.DEBUG_CHANNEL
|
||||
else if (Const.APP_IS_CANARY)
|
||||
Value.CANARY_CHANNEL
|
||||
else
|
||||
Value.DEFAULT_CHANNEL
|
||||
|
@ -4,6 +4,7 @@ import com.topjohnwu.magisk.core.Config
|
||||
import com.topjohnwu.magisk.core.Config.Value.BETA_CHANNEL
|
||||
import com.topjohnwu.magisk.core.Config.Value.CANARY_CHANNEL
|
||||
import com.topjohnwu.magisk.core.Config.Value.CUSTOM_CHANNEL
|
||||
import com.topjohnwu.magisk.core.Config.Value.DEBUG_CHANNEL
|
||||
import com.topjohnwu.magisk.core.Config.Value.DEFAULT_CHANNEL
|
||||
import com.topjohnwu.magisk.core.Config.Value.STABLE_CHANNEL
|
||||
import com.topjohnwu.magisk.core.Info
|
||||
@ -24,12 +25,12 @@ class NetworkService(
|
||||
DEFAULT_CHANNEL, STABLE_CHANNEL -> fetchStableUpdate()
|
||||
BETA_CHANNEL -> fetchBetaUpdate()
|
||||
CANARY_CHANNEL -> fetchCanaryUpdate()
|
||||
DEBUG_CHANNEL -> fetchDebugUpdate()
|
||||
CUSTOM_CHANNEL -> fetchCustomUpdate(Config.customChannelUrl)
|
||||
else -> throw IllegalArgumentException()
|
||||
}
|
||||
if (info.magisk.versionCode < Info.env.versionCode &&
|
||||
Config.updateChannel == DEFAULT_CHANNEL
|
||||
) {
|
||||
Config.updateChannel == DEFAULT_CHANNEL) {
|
||||
Config.updateChannel = BETA_CHANNEL
|
||||
info = fetchBetaUpdate()
|
||||
}
|
||||
@ -40,6 +41,7 @@ class NetworkService(
|
||||
private suspend fun fetchStableUpdate() = pages.fetchUpdateJSON("stable.json")
|
||||
private suspend fun fetchBetaUpdate() = pages.fetchUpdateJSON("beta.json")
|
||||
private suspend fun fetchCanaryUpdate() = pages.fetchUpdateJSON("canary.json")
|
||||
private suspend fun fetchDebugUpdate() = pages.fetchUpdateJSON("debug.json")
|
||||
private suspend fun fetchCustomUpdate(url: String) = raw.fetchCustomUpdate(url)
|
||||
|
||||
private inline fun <T> safe(factory: () -> T): T? {
|
||||
|
@ -65,6 +65,7 @@
|
||||
<item>@string/settings_update_beta</item>
|
||||
<item>@string/settings_update_custom</item>
|
||||
<item>Canary</item>
|
||||
<item>Debug</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
||||
|
8
build.py
8
build.py
@ -275,8 +275,8 @@ def write_if_diff(file_name, text):
|
||||
f.write(text)
|
||||
|
||||
|
||||
def dump_bin_header():
|
||||
stub = op.join(config['outdir'], 'stub-release.apk')
|
||||
def dump_bin_header(args):
|
||||
stub = op.join(config['outdir'], f'stub-{"release" if args.release else "debug"}.apk')
|
||||
if not op.exists(stub):
|
||||
error('Build stub APK before building "magiskinit"')
|
||||
mkdir_p(native_gen_path)
|
||||
@ -353,7 +353,7 @@ def build_binary(args):
|
||||
flag = ''
|
||||
|
||||
if 'magiskinit' in args.target:
|
||||
dump_bin_header()
|
||||
dump_bin_header(args)
|
||||
flag += ' B_INIT=1'
|
||||
|
||||
if 'resetprop' in args.target:
|
||||
@ -370,7 +370,7 @@ def build_binary(args):
|
||||
|
||||
|
||||
def build_apk(args, module):
|
||||
build_type = 'Release' if args.release or module == 'stub' else 'Debug'
|
||||
build_type = 'Release' if args.release else 'Debug'
|
||||
|
||||
proc = execv([gradlew, f'{module}:assemble{build_type}',
|
||||
'-PconfigPath=' + op.abspath(args.config)])
|
||||
|
@ -40,7 +40,9 @@ import io.michaelrocks.paranoid.Obfuscate;
|
||||
public class DownloadActivity extends Activity {
|
||||
|
||||
private static final String APP_NAME = "Magisk";
|
||||
private static final String CANARY_URL = "https://topjohnwu.github.io/magisk-files/canary.json";
|
||||
private static final String JSON_URL = BuildConfig.DEBUG ?
|
||||
"https://topjohnwu.github.io/magisk-files/debug.json" :
|
||||
"https://topjohnwu.github.io/magisk-files/canary.json";
|
||||
|
||||
private String apkLink = BuildConfig.APK_URL;
|
||||
private Context themed;
|
||||
@ -105,7 +107,7 @@ public class DownloadActivity extends Activity {
|
||||
|
||||
private void fetchCanary() {
|
||||
dialog = ProgressDialog.show(themed, "", "", true);
|
||||
request(CANARY_URL).getAsJSONObject(json -> {
|
||||
request(JSON_URL).getAsJSONObject(json -> {
|
||||
dialog.dismiss();
|
||||
try {
|
||||
apkLink = json.getJSONObject("magisk").getString("link");
|
||||
|
Loading…
x
Reference in New Issue
Block a user