diff --git a/app-core/src/main/java/com/topjohnwu/magisk/Config.java b/app-core/src/main/java/com/topjohnwu/magisk/Config.java index fe9c5a9c1..76672af68 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/Config.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/Config.java @@ -73,6 +73,8 @@ public class Config { public static final int STABLE_CHANNEL = 0; public static final int BETA_CHANNEL = 1; public static final int CUSTOM_CHANNEL = 2; + public static final int CANARY_CHANNEL = 3; + public static final int CANARY_DEBUG_CHANNEL = 4; public static final int ROOT_ACCESS_DISABLED = 0; public static final int ROOT_ACCESS_APPS_ONLY = 1; public static final int ROOT_ACCESS_ADB_ONLY = 2; diff --git a/app-core/src/main/java/com/topjohnwu/magisk/Const.java b/app-core/src/main/java/com/topjohnwu/magisk/Const.java index 4eb01cfa2..15c31acf4 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/Const.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/Const.java @@ -63,6 +63,8 @@ public class Const { } public static final String STABLE_URL = getRaw("master", "stable.json"); public static final String BETA_URL = getRaw("master", "beta.json"); + public static final String CANARY_URL = getRaw("master", "canary_builds/release.json"); + public static final String CANARY_DEBUG_URL = getRaw("master", "canary_builds/canary.json"); public static final String REPO_URL = "https://api.github.com/users/Magisk-Modules-Repo/repos?per_page=100&sort=pushed&page=%d"; public static final String FILE_URL = "https://raw.githubusercontent.com/Magisk-Modules-Repo/%s/master/%s"; public static final String ZIP_URL = "https://github.com/Magisk-Modules-Repo/%s/archive/master.zip"; diff --git a/app-core/src/main/java/com/topjohnwu/magisk/tasks/CheckUpdates.java b/app-core/src/main/java/com/topjohnwu/magisk/tasks/CheckUpdates.java index a65336eb0..e26401e15 100644 --- a/app-core/src/main/java/com/topjohnwu/magisk/tasks/CheckUpdates.java +++ b/app-core/src/main/java/com/topjohnwu/magisk/tasks/CheckUpdates.java @@ -24,6 +24,12 @@ public class CheckUpdates { case Config.Value.CUSTOM_CHANNEL: url = Config.get(Config.Key.CUSTOM_CHANNEL); break; + case Config.Value.CANARY_CHANNEL: + url = Const.Url.CANARY_URL; + break; + case Config.Value.CANARY_DEBUG_CHANNEL: + url = Const.Url.CANARY_DEBUG_URL; + break; case Config.Value.STABLE_CHANNEL: default: url = Const.Url.STABLE_URL; diff --git a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java index 0334a42b6..718b3b432 100644 --- a/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/SettingsFragment.java @@ -33,6 +33,7 @@ import com.topjohnwu.net.Networking; import com.topjohnwu.superuser.Shell; import java.io.IOException; +import java.util.Arrays; import java.util.Locale; public class SettingsFragment extends BasePreferenceFragment implements Topic.Subscriber { @@ -109,6 +110,15 @@ public class SettingsFragment extends BasePreferenceFragment implements Topic.Su return true; }); + /* We only show canary channels if user is already on canary channel + * or the user have already chosen canary channel */ + if (!BuildConfig.VERSION_NAME.contains("-") && + (int) Config.get(Config.Key.UPDATE_CHANNEL) < Config.Value.CANARY_CHANNEL) { + // Remove the last 2 entries + CharSequence[] entries = updateChannel.getEntries(); + updateChannel.setEntries(Arrays.copyOf(entries, entries.length - 2)); + } + setSummary(); // Disable dangerous settings in secondary user diff --git a/app/src/full/res/values/arrays.xml b/app/src/full/res/values/arrays.xml index 4941a7ee0..94546fe02 100644 --- a/app/src/full/res/values/arrays.xml +++ b/app/src/full/res/values/arrays.xml @@ -21,6 +21,7 @@ 1 2 3 + 4 @@ -80,6 +81,9 @@ @string/settings_update_stable @string/settings_update_beta @string/settings_update_custom + + Canary + Canary (Debug)