diff --git a/res/layout/dialog_sim_status.xml b/res/layout/dialog_sim_status.xml index 66d583be31a..9c67f13c378 100644 --- a/res/layout/dialog_sim_status.xml +++ b/res/layout/dialog_sim_status.xml @@ -105,13 +105,26 @@ + android:text="@string/status_voice_network_type"/> + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 9fb515bb797..a614bc5e6cc 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -2750,7 +2750,9 @@ ICCID - Mobile network type + Mobile data network type + + Mobile voice network type Operator info diff --git a/res/xml/device_info_sim_status.xml b/res/xml/device_info_sim_status.xml deleted file mode 100644 index aa8896c8cbb..00000000000 --- a/res/xml/device_info_sim_status.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java index af898d55a57..8795e7b4bbb 100644 --- a/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java +++ b/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogController.java @@ -77,7 +77,9 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O @VisibleForTesting final static int SIGNAL_STRENGTH_VALUE_ID = R.id.signal_strength_value; @VisibleForTesting - final static int CELLULAR_NETWORK_TYPE_VALUE_ID = R.id.network_type_value; + final static int CELL_VOICE_NETWORK_TYPE_VALUE_ID = R.id.voice_network_type_value; + @VisibleForTesting + final static int CELL_DATA_NETWORK_TYPE_VALUE_ID = R.id.data_network_type_value; @VisibleForTesting final static int ROAMING_INFO_VALUE_ID = R.id.roaming_state_value; @VisibleForTesting @@ -318,14 +320,16 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O private void updateNetworkType() { // Whether EDGE, UMTS, etc... - String networktype = null; + String dataNetworkTypeName = null; + String voiceNetworkTypeName = null; final int subId = mSubscriptionInfo.getSubscriptionId(); final int actualDataNetworkType = mTelephonyManager.getDataNetworkType(subId); final int actualVoiceNetworkType = mTelephonyManager.getVoiceNetworkType(subId); if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualDataNetworkType) { - networktype = mTelephonyManager.getNetworkTypeName(actualDataNetworkType); - } else if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualVoiceNetworkType) { - networktype = mTelephonyManager.getNetworkTypeName(actualVoiceNetworkType); + dataNetworkTypeName = mTelephonyManager.getNetworkTypeName(actualDataNetworkType); + } + if (TelephonyManager.NETWORK_TYPE_UNKNOWN != actualVoiceNetworkType) { + voiceNetworkTypeName = mTelephonyManager.getNetworkTypeName(actualVoiceNetworkType); } boolean show4GForLTE = false; @@ -336,13 +340,20 @@ public class SimStatusDialogController implements LifecycleObserver, OnResume, O "bool" /* default type */, "com.android.systemui" /* default package */); show4GForLTE = con.getResources().getBoolean(id); } catch (PackageManager.NameNotFoundException e) { - Log.e(TAG, "NameNotFoundException for show4GFotLTE"); + Log.e(TAG, "NameNotFoundException for show4GForLTE"); } - if (TextUtils.equals(networktype, "LTE") && show4GForLTE) { - networktype = "4G"; + if (show4GForLTE) { + if ("LTE".equals(dataNetworkTypeName)) { + dataNetworkTypeName = "4G"; + } + if ("LTE".equals(voiceNetworkTypeName)) { + voiceNetworkTypeName = "4G"; + } } - mDialog.setText(CELLULAR_NETWORK_TYPE_VALUE_ID, networktype); + + mDialog.setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID, voiceNetworkTypeName); + mDialog.setText(CELL_DATA_NETWORK_TYPE_VALUE_ID, dataNetworkTypeName); } private void updateRoamingStatus(ServiceState serviceState) { diff --git a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java index 1b2c36f8a12..4d6cab7f14c 100644 --- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java +++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java @@ -16,7 +16,8 @@ package com.android.settings.deviceinfo.simstatus; -import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELLULAR_NETWORK_TYPE_VALUE_ID; +import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_DATA_NETWORK_TYPE_VALUE_ID; +import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.CELL_VOICE_NETWORK_TYPE_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.EID_INFO_VALUE_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_LABEL_ID; import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController.ICCID_INFO_VALUE_ID; @@ -188,13 +189,24 @@ public class SimStatusDialogControllerTest { } @Test - public void initialize_updateNetworkTypeWithEdge_shouldUpdateSettingToEdge() { + public void initialize_updateVoiceNetworkTypeWithEdge_shouldUpdateSettingToEdge() { + when(mTelephonyManager.getVoiceNetworkType(anyInt())).thenReturn( + TelephonyManager.NETWORK_TYPE_EDGE); + + mController.initialize(); + + verify(mDialog).setText(CELL_VOICE_NETWORK_TYPE_VALUE_ID, + TelephonyManager.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE)); + } + + @Test + public void initialize_updateDataNetworkTypeWithEdge_shouldUpdateSettingToEdge() { when(mTelephonyManager.getDataNetworkType(anyInt())).thenReturn( TelephonyManager.NETWORK_TYPE_EDGE); mController.initialize(); - verify(mDialog).setText(CELLULAR_NETWORK_TYPE_VALUE_ID, + verify(mDialog).setText(CELL_DATA_NETWORK_TYPE_VALUE_ID, TelephonyManager.getNetworkTypeName(TelephonyManager.NETWORK_TYPE_EDGE)); }