Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Phone: Forward port Add national data roaming and make it optional (2/2)

  by Robin Morawetz (Rdlgrmpf) and Davor Bertovic (LorD ClockaN)
  Id: I9fccddf4d9081d228540d5e62f132383b9579c52

Change-Id: I524f3b71e9e8ef3483351adc4907fba4622e4b3c
  • Loading branch information...
commit 16cf873819c341f40ec137e673f41b58def758f2 1 parent d46fce9
@LorDClockaN LorDClockaN authored Bajee11 committed
View
12 res/values/strings.xml
@@ -1494,4 +1494,16 @@
<!-- Title for the category "ringtone", which is shown above ringote settings
[CHAR LIMIT=40] -->
<string name="preference_category_ringtone">Ringtone</string>
+
+ <!-- CYANOGENMOD ADDITIONS START -->
+
+ <!-- Mobile network settings screen, setting check box name -->
+ <string name="national_roaming">National data roaming</string>
+ <!-- Mobile network settings screen, setting summary text when check box is selected -->
+ <string name="national_roaming_enable">Connect to data services when nationally roaming</string>
+ <!-- Mobile network settings screen, setting summary text when check box is clear -->
+ <string name="national_roaming_disable">Connect to data services when nationally roaming</string>
+
+ <!-- CYANOGENMOD ADDITIONS END -->
+
</resources>
View
7 res/xml/network_setting.xml
@@ -35,6 +35,13 @@
android:summaryOn="@string/roaming_enable"
android:summaryOff="@string/roaming_disable"/>
+ <CheckBoxPreference
+ android:key="button_national_roaming_key"
+ android:title="@string/national_roaming"
+ android:persistent="false"
+ android:summaryOn="@string/national_roaming_enable"
+ android:summaryOff="@string/national_roaming_disable"/>
+
<PreferenceScreen
android:key="button_data_usage_key"
android:title="@string/throttle_data_usage"
View
12 src/com/android/phone/MobileNetworkSettings.java
@@ -70,6 +70,7 @@
private static final String BUTTON_PREFERED_NETWORK_MODE = "preferred_network_mode_key";
private static final String BUTTON_ROAMING_KEY = "button_roaming_key";
private static final String BUTTON_CDMA_LTE_DATA_SERVICE_KEY = "cdma_lte_data_service_key";
+ private static final String BUTTON_NATIONAL_ROAMING_KEY = "button_national_roaming_key";
static final int preferredNetworkMode = Phone.PREFERRED_NT_MODE;
@@ -83,6 +84,7 @@
private CheckBoxPreference mButtonDataRoam;
private CheckBoxPreference mButtonDataEnabled;
private Preference mLteDataServicePref;
+ private CheckBoxPreference mButtonNationalDataRoam;
private Preference mButtonDataUsage;
private DataUsageListener mDataUsageListener;
@@ -168,6 +170,11 @@ public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preferen
mPhone.setDataRoamingEnabled(false);
}
return true;
+ } else if (preference == mButtonNationalDataRoam) {
+ android.provider.Settings.System.putInt(mPhone.getContext().getContentResolver(),
+ android.provider.Settings.System.MVNO_ROAMING,
+ mButtonNationalDataRoam.isChecked() ? 1 : 0);
+ return true;
} else if (preference == mButtonDataEnabled) {
if (DBG) log("onPreferenceTreeClick: preference == mButtonDataEnabled.");
ConnectivityManager cm =
@@ -217,6 +224,7 @@ protected void onCreate(Bundle icicle) {
mButtonDataEnabled = (CheckBoxPreference) prefSet.findPreference(BUTTON_DATA_ENABLED_KEY);
mButtonDataRoam = (CheckBoxPreference) prefSet.findPreference(BUTTON_ROAMING_KEY);
+ mButtonNationalDataRoam = (CheckBoxPreference) prefSet.findPreference(BUTTON_NATIONAL_ROAMING_KEY);
mButtonPreferredNetworkMode = (ListPreference) prefSet.findPreference(
BUTTON_PREFERED_NETWORK_MODE);
mButtonDataUsage = prefSet.findPreference(BUTTON_DATA_USAGE_KEY);
@@ -313,6 +321,10 @@ protected void onResume() {
// and the UI state would be inconsistent with actual state
mButtonDataRoam.setChecked(mPhone.getDataRoamingEnabled());
+ mButtonNationalDataRoam.setChecked(android.provider.Settings.System.getInt(
+ mPhone.getContext().getContentResolver(),
+ android.provider.Settings.System.MVNO_ROAMING, 0) == 1);
+
if (getPreferenceScreen().findPreference(BUTTON_PREFERED_NETWORK_MODE) != null) {
mPhone.getPreferredNetworkType(mHandler.obtainMessage(
MyHandler.MESSAGE_GET_PREFERRED_NETWORK_TYPE));
Please sign in to comment.
Something went wrong with that request. Please try again.