diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 1dc4b7e3dd76e11fc174e123acd6920affaa4273..0948e6e2232c67b7a0a3be659645311d6766bce7 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -67,8 +67,10 @@
Locate the fingerprint sensor on the %1$s of your phone.
- Use staging OTA server
- Change to OTA/Production server
+ Connect to /e/OS test channel
+ Access test releases of /e/OS
+ You are about to connect to /e/OS test channel
+ It will allow you to download and install test versions of /e/OS. Those builds may be unstable, and should be used only for test purposes. Please accept only if you know what you are doing.
/e/ legal
diff --git a/src/com/android/settings/development/ChangeSourcePreferenceController.java b/src/com/android/settings/development/ChangeSourcePreferenceController.java
index 3e26fbcc8a7af4c51978b13a97ffc40938a1fbb9..50637a08338400367de85b2efb18e11eab06c26b 100644
--- a/src/com/android/settings/development/ChangeSourcePreferenceController.java
+++ b/src/com/android/settings/development/ChangeSourcePreferenceController.java
@@ -16,22 +16,23 @@
package com.android.settings.development;
+import android.app.AlertDialog;
import android.content.Context;
import android.provider.Settings;
-
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.SwitchPreference;
import android.content.ContentValues;
import android.content.Context;
+import android.content.DialogInterface;
import android.database.Cursor;
import android.net.Uri;
import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.R;
import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
public class ChangeSourcePreferenceController extends DeveloperOptionsPreferenceController implements
Preference.OnPreferenceChangeListener, PreferenceControllerMixin {
@@ -53,10 +54,7 @@ public class ChangeSourcePreferenceController extends DeveloperOptionsPreference
return CHANGE_URL_KEY;
}
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean isEnabled = (Boolean) newValue;
- ((SwitchPreference) mPreference).setChecked(isEnabled);
+ public void updateOtaServer(){
if (count(OTAProvider.CONTENT_URI)) {
ContentValues values = new ContentValues();
@@ -72,7 +70,32 @@ public class ChangeSourcePreferenceController extends DeveloperOptionsPreference
values.put(OTAProvider.Status,"true");
mContext.getContentResolver().insert(OTAProvider.CONTENT_URI, values);
}
- return true;
+ }
+
+ @Override
+ public boolean onPreferenceChange(Preference preference, Object newValue) {
+ final boolean isEnabled = (Boolean) newValue;
+ ((SwitchPreference) mPreference).setChecked(isEnabled);
+ if(retrieveStatus().equals("true")){
+ updateOtaServer();
+ return true;
+ }
+ new AlertDialog.Builder(mContext).
+ setTitle(R.string.use_ota_staging_popup_title)
+ .setMessage(mContext.getResources().getString(R.string.use_ota_staging_popup_message))
+ .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int which) {
+ ((SwitchPreference) mPreference).setChecked(true);
+ updateOtaServer();
+ }
+ }) .setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener()
+ {
+ public void onClick(DialogInterface dialog, int which) {
+ ((SwitchPreference) mPreference).setChecked(false);
+ }
+ }).show();
+ return false;
}
@Override
@@ -120,4 +143,4 @@ public class ChangeSourcePreferenceController extends DeveloperOptionsPreference
}
return status;
}
-}
\ No newline at end of file
+}