To fix bug, summary is wrong if nr_enabled_bool=false
The carrier config nr_enabled_bool is false, preferred network mode
should hide 5G UI. This bug is that the summary show 5G item when
nr_enabled_bool is false.
Solution: if nr_enabled_bool is false, it checks capability and then
removes 5G capability of network mode.
Bug: 170460943
Test: make RunSettingsRoboTests ROBOTEST_FILTER=\
EnabledNetworkModePreferenceControllerTest (PASS)
Change-Id: I3f7d41c196569c0cb61e89cfc270b957e2f0add5
(cherry picked from commit 706036e5b3
)
This commit is contained in:
committed by
android-build-team Robot
parent
3945f309c8
commit
78b33b3824
@@ -221,6 +221,28 @@ public class EnabledNetworkModePreferenceControllerTest {
|
||||
TelephonyManagerConstants.NETWORK_MODE_LTE_TDSCDMA_CDMA_EVDO_GSM_WCDMA));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_NrEnableBoolFalse_5gOptionHidden() {
|
||||
mockEnabledNetworkMode(TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA);
|
||||
mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
|
||||
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_NR_ENABLED_BOOL, false);
|
||||
|
||||
mController.init(mLifecycle, SUB_ID);
|
||||
Settings.Global.putInt(mContext.getContentResolver(),
|
||||
Settings.Global.PREFERRED_NETWORK_MODE + SUB_ID,
|
||||
TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA);
|
||||
|
||||
mController.updateState(mPreference);
|
||||
|
||||
assertThat(mPreference.getValue()).isEqualTo(
|
||||
String.valueOf(
|
||||
TelephonyManagerConstants.NETWORK_MODE_LTE_GSM_WCDMA));
|
||||
assertThat(mPreference.getEntryValues())
|
||||
.asList()
|
||||
.doesNotContain(
|
||||
String.valueOf(TelephonyManager.NETWORK_MODE_NR_LTE_GSM_WCDMA));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void updateState_GlobalDisAllowed5g_GlobalWithoutNR() {
|
||||
mockAccessFamily(TelephonyManager.NETWORK_MODE_NR_LTE_CDMA_EVDO_GSM_WCDMA);
|
||||
@@ -393,6 +415,11 @@ public class EnabledNetworkModePreferenceControllerTest {
|
||||
} else if (networkMode == TelephonyManagerConstants.NETWORK_MODE_NR_LTE_TDSCDMA_GSM_WCDMA) {
|
||||
mockPhoneType(TelephonyManager.PHONE_TYPE_GSM);
|
||||
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_SUPPORT_TDSCDMA_BOOL, true);
|
||||
} else if (networkMode
|
||||
== TelephonyManagerConstants.NETWORK_MODE_NR_LTE_GSM_WCDMA) {
|
||||
mockPhoneType(TelephonyManager.PHONE_TYPE_GSM);
|
||||
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_PREFER_2G_BOOL, true);
|
||||
mPersistableBundle.putBoolean(CarrierConfigManager.KEY_LTE_ENABLED_BOOL, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,6 +434,6 @@ public class EnabledNetworkModePreferenceControllerTest {
|
||||
}
|
||||
|
||||
private void mockPhoneType(int phoneType) {
|
||||
doReturn(TelephonyManager.PHONE_TYPE_GSM).when(mTelephonyManager).getPhoneType();
|
||||
doReturn(phoneType).when(mTelephonyManager).getPhoneType();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user