Commit 7e3ff031 authored by topjohnwu's avatar topjohnwu

Default to canary channel if running canary build

parent a1827fd6
...@@ -315,7 +315,8 @@ public class Config { ...@@ -315,7 +315,8 @@ public class Config {
defs.put(Key.SU_REQUEST_TIMEOUT, 10); defs.put(Key.SU_REQUEST_TIMEOUT, 10);
defs.put(Key.SU_AUTO_RESPONSE, Value.SU_PROMPT); defs.put(Key.SU_AUTO_RESPONSE, Value.SU_PROMPT);
defs.put(Key.SU_NOTIFICATION, Value.NOTIFICATION_TOAST); defs.put(Key.SU_NOTIFICATION, Value.NOTIFICATION_TOAST);
defs.put(Key.UPDATE_CHANNEL, Value.STABLE_CHANNEL); defs.put(Key.UPDATE_CHANNEL, Utils.isCanary() ?
Value.CANARY_DEBUG_CHANNEL : Value.STABLE_CHANNEL);
// prefs bool // prefs bool
defs.put(Key.CHECK_UPDATES, true); defs.put(Key.CHECK_UPDATES, true);
......
...@@ -112,7 +112,7 @@ public class SettingsFragment extends BasePreferenceFragment implements Topic.Su ...@@ -112,7 +112,7 @@ public class SettingsFragment extends BasePreferenceFragment implements Topic.Su
/* We only show canary channels if user is already on canary channel /* We only show canary channels if user is already on canary channel
* or the user have already chosen canary channel */ * or the user have already chosen canary channel */
if (!BuildConfig.VERSION_NAME.contains("-") && if (!Utils.isCanary() &&
(int) Config.get(Config.Key.UPDATE_CHANNEL) < Config.Value.CANARY_CHANNEL) { (int) Config.get(Config.Key.UPDATE_CHANNEL) < Config.Value.CANARY_CHANNEL) {
// Remove the last 2 entries // Remove the last 2 entries
CharSequence[] entries = updateChannel.getEntries(); CharSequence[] entries = updateChannel.getEntries();
......
...@@ -12,6 +12,7 @@ import android.provider.OpenableColumns; ...@@ -12,6 +12,7 @@ import android.provider.OpenableColumns;
import android.widget.Toast; import android.widget.Toast;
import com.topjohnwu.magisk.App; import com.topjohnwu.magisk.App;
import com.topjohnwu.magisk.BuildConfig;
import com.topjohnwu.magisk.Config; import com.topjohnwu.magisk.Config;
import com.topjohnwu.magisk.Const; import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.container.Module; import com.topjohnwu.magisk.container.Module;
...@@ -118,4 +119,8 @@ public class Utils { ...@@ -118,4 +119,8 @@ public class Utils {
public static void reboot() { public static void reboot() {
Shell.su("/system/bin/reboot" + (Config.recovery ? " recovery" : "")).submit(); Shell.su("/system/bin/reboot" + (Config.recovery ? " recovery" : "")).submit();
} }
public static boolean isCanary() {
return BuildConfig.VERSION_NAME.contains("-");
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment