am fd12d3a6: Merge "Fix to prevent unnecessary mode changes in LTE network modes."
* commit 'fd12d3a6c72d56cdafc639402bf7e0ff9048c1b7':
Fix to prevent unnecessary mode changes in LTE network modes.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index b360c4b..6a9de65 100755
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -362,11 +362,27 @@
<string name="preferred_network_mode_cdma_only_summary">Preferred network mode: CDMA only</string>
<!-- Mobile network settings, summary for preferred network mode EvDo only [CHAR LIMIT=100] -->
<string name="preferred_network_mode_evdo_only_summary">Preferred network mode: EvDo only</string>
- <!-- Mobile network settings, summary for preferred network mode LTE / CDMA[CHAR LIMIT=100] -->
- <string name="preferred_network_mode_lte_cdma_summary">Preferred network mode: LTE / CDMA</string>
+ <!-- Mobile network settings, summary for preferred network mode CDMA/EvDo/GSM/WCDMA[CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_cdma_evdo_gsm_wcdma_summary">Preferred network mode: CDMA/EvDo/GSM/WCDMA</string>
+ <!-- Mobile network settings, summary for preferred network mode LTE [CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_summary">Preferred network mode: LTE </string>
+ <!-- Mobile network settings, summary for preferred network mode GSM/WCDMA/LTE [CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_gsm_wcdma_summary">Preferred network mode: GSM/WCDMA/LTE</string>
+ <!-- Mobile network settings, summary for preferred network mode CDMA+LTE/EVDO[CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_cdma_evdo_summary">Preferred network mode: CDMA+LTE/EVDO</string>
+ <!-- Mobile network settings, summary for preferred network mode Global[CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_global_summary">Preferred network mode: Global</string>
+ <!-- Mobile network settings, summary for preferred network mode LTE / WCDMA[CHAR LIMIT=100] -->
+ <string name="preferred_network_mode_lte_wcdma_summary">Preferred network mode: LTE / WCDMA</string>
+
<string-array name="preferred_network_mode_choices">
- <item>LTE/CDMA</item>
+ <item>LTE / WCDMA</item>
+ <item>LTE</item>
+ <item>Global</item>
+ <item>GSM/WCDMA/LTE</item>
+ <item>CDMA + LTE/EvDo</item>
+ <item>CDMA/EvDo/GSM/WCDMA</item>
<item>EvDo only</item>
<item>CDMA w/o EvDo</item>
<item>CDMA/EvDo auto</item>
@@ -376,6 +392,11 @@
<item>GSM/WCDMA preferred</item>
</string-array>
<string-array name="preferred_network_mode_values" translatable="false">
+ <item>"12"</item>
+ <item>"11"</item>
+ <item>"10"</item>
+ <item>"9"</item>
+ <item>"8"</item>
<item>"7"</item>
<item>"6"</item>
<item>"5"</item>
@@ -385,15 +406,6 @@
<item>"1"</item>
<item>"0"</item>
</string-array>
- <!-- Mobile network settings, network mode choices for a device supporting CDMA and LTE [CHAR LIMIT=25] -->
- <string-array name="preferred_network_mode_choices_lte">
- <item>LTE/CDMA</item>
- <item>CDMA</item>
- </string-array>
- <string-array name="preferred_network_mode_values_lte" translatable="false">
- <item>"7"</item>
- <item>"4"</item>
- </string-array>
<!-- Mobile network settings screen, data enabling checkbox name -->
<string name="data_enabled">Data enabled</string>
<!-- Mobile network settings screen, setting summary text when check box is not selected (explains what selecting it would do) -->
diff --git a/src/com/android/phone/MobileNetworkSettings.java b/src/com/android/phone/MobileNetworkSettings.java
index a81d7c2..d11ca0e 100644
--- a/src/com/android/phone/MobileNetworkSettings.java
+++ b/src/com/android/phone/MobileNetworkSettings.java
@@ -244,10 +244,6 @@
mCdmaOptions = new CdmaOptions(this, prefSet, mPhone);
if (isLteOnCdma) {
mButtonPreferredNetworkMode.setOnPreferenceChangeListener(this);
- mButtonPreferredNetworkMode.setEntries(
- R.array.preferred_network_mode_choices_lte);
- mButtonPreferredNetworkMode.setEntryValues(
- R.array.preferred_network_mode_values_lte);
int settingsNetworkMode = android.provider.Settings.Global.getInt(
mPhone.getContext().getContentResolver(),
android.provider.Settings.Global.PREFERRED_NETWORK_MODE,
@@ -332,41 +328,27 @@
android.provider.Settings.Global.PREFERRED_NETWORK_MODE, preferredNetworkMode);
if (buttonNetworkMode != settingsNetworkMode) {
int modemNetworkMode;
- switch(buttonNetworkMode) {
- case Phone.NT_MODE_GLOBAL:
- modemNetworkMode = Phone.NT_MODE_GLOBAL;
- break;
- case Phone.NT_MODE_EVDO_NO_CDMA:
- modemNetworkMode = Phone.NT_MODE_EVDO_NO_CDMA;
- break;
- case Phone.NT_MODE_CDMA_NO_EVDO:
- modemNetworkMode = Phone.NT_MODE_CDMA_NO_EVDO;
- break;
- case Phone.NT_MODE_CDMA:
- modemNetworkMode = Phone.NT_MODE_CDMA;
- break;
- case Phone.NT_MODE_GSM_UMTS:
- modemNetworkMode = Phone.NT_MODE_GSM_UMTS;
- break;
- case Phone.NT_MODE_WCDMA_ONLY:
- modemNetworkMode = Phone.NT_MODE_WCDMA_ONLY;
- break;
- case Phone.NT_MODE_GSM_ONLY:
- modemNetworkMode = Phone.NT_MODE_GSM_ONLY;
- break;
+ // if new mode is invalid ignore it
+ switch (buttonNetworkMode) {
case Phone.NT_MODE_WCDMA_PREF:
- modemNetworkMode = Phone.NT_MODE_WCDMA_PREF;
+ case Phone.NT_MODE_GSM_ONLY:
+ case Phone.NT_MODE_WCDMA_ONLY:
+ case Phone.NT_MODE_GSM_UMTS:
+ case Phone.NT_MODE_CDMA:
+ case Phone.NT_MODE_CDMA_NO_EVDO:
+ case Phone.NT_MODE_EVDO_NO_CDMA:
+ case Phone.NT_MODE_GLOBAL:
+ case Phone.NT_MODE_LTE_CDMA_AND_EVDO:
+ case Phone.NT_MODE_LTE_GSM_WCDMA:
+ case Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
+ case Phone.NT_MODE_LTE_ONLY:
+ case Phone.NT_MODE_LTE_WCDMA:
+ // This is one of the modes we recognize
+ modemNetworkMode = buttonNetworkMode;
break;
default:
- modemNetworkMode = Phone.PREFERRED_NT_MODE;
- }
-
- // If button has no valid selection && setting is LTE ONLY
- // mode, let the setting stay in LTE ONLY mode. UI is not
- // supported but LTE ONLY mode could be used in testing.
- if ((modemNetworkMode == Phone.PREFERRED_NT_MODE) &&
- (settingsNetworkMode == Phone.NT_MODE_LTE_ONLY)) {
- return true;
+ loge("Invalid Network Mode (" + buttonNetworkMode + ") chosen. Ignore.");
+ return true;
}
UpdatePreferredNetworkModeSummary(buttonNetworkMode);
@@ -431,7 +413,12 @@
modemNetworkMode == Phone.NT_MODE_CDMA ||
modemNetworkMode == Phone.NT_MODE_CDMA_NO_EVDO ||
modemNetworkMode == Phone.NT_MODE_EVDO_NO_CDMA ||
- modemNetworkMode == Phone.NT_MODE_GLOBAL ) {
+ modemNetworkMode == Phone.NT_MODE_GLOBAL ||
+ modemNetworkMode == Phone.NT_MODE_LTE_CDMA_AND_EVDO ||
+ modemNetworkMode == Phone.NT_MODE_LTE_GSM_WCDMA ||
+ modemNetworkMode == Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA ||
+ modemNetworkMode == Phone.NT_MODE_LTE_ONLY ||
+ modemNetworkMode == Phone.NT_MODE_LTE_WCDMA) {
if (DBG) {
log("handleGetPreferredNetworkTypeResponse: if 1: modemNetworkMode = " +
modemNetworkMode);
@@ -460,9 +447,6 @@
UpdatePreferredNetworkModeSummary(modemNetworkMode);
// changes the mButtonPreferredNetworkMode accordingly to modemNetworkMode
mButtonPreferredNetworkMode.setValue(Integer.toString(modemNetworkMode));
- } else if (modemNetworkMode == Phone.NT_MODE_LTE_ONLY) {
- // LTE Only mode not yet supported on UI, but could be used for testing
- if (DBG) log("handleGetPreferredNetworkTypeResponse: lte only: no action");
} else {
if (DBG) log("handleGetPreferredNetworkTypeResponse: else: reset to default");
resetNetworkModeToDefault();
@@ -536,10 +520,33 @@
mButtonPreferredNetworkMode.setSummary(
R.string.preferred_network_mode_evdo_only_summary);
break;
+ case Phone.NT_MODE_LTE_ONLY:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_summary);
+ break;
+ case Phone.NT_MODE_LTE_GSM_WCDMA:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_gsm_wcdma_summary);
+ break;
+ case Phone.NT_MODE_LTE_CDMA_AND_EVDO:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_cdma_evdo_summary);
+ break;
+ case Phone.NT_MODE_LTE_CMDA_EVDO_GSM_WCDMA:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_global_summary);
+ break;
case Phone.NT_MODE_GLOBAL:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_cdma_evdo_gsm_wcdma_summary);
+ break;
+ case Phone.NT_MODE_LTE_WCDMA:
+ mButtonPreferredNetworkMode.setSummary(
+ R.string.preferred_network_mode_lte_wcdma_summary);
+ break;
default:
mButtonPreferredNetworkMode.setSummary(
- R.string.preferred_network_mode_lte_cdma_summary);
+ R.string.preferred_network_mode_global_summary);
}
}
@@ -566,6 +573,10 @@
Log.d(LOG_TAG, msg);
}
+ private static void loge(String msg) {
+ Log.e(LOG_TAG, msg);
+ }
+
@Override
public boolean onOptionsItemSelected(MenuItem item) {
final int itemId = item.getItemId();