Add canary channels

Only show if user is already on canary channels
This commit is contained in:
topjohnwu
2019-03-08 06:23:13 -05:00
parent c134fb1939
commit 745865ee53
5 changed files with 24 additions and 0 deletions

View File

@@ -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

View File

@@ -21,6 +21,7 @@
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
</string-array>
<string-array name="request_timeout">
@@ -80,6 +81,9 @@
<item>@string/settings_update_stable</item>
<item>@string/settings_update_beta</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 name="boot_formats">