Add signal strength customization
Also add default behavior in case carrier config bundle is null. Bug: 69730732 Test: manual and new unit test Change-Id: Ia38462a7e1b6f2e27ff45d93beef09465a68ae5c
This commit is contained in:
@@ -34,11 +34,14 @@ import static com.android.settings.deviceinfo.simstatus.SimStatusDialogControlle
|
||||
.ROAMING_INFO_VALUE_ID;
|
||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController
|
||||
.SERVICE_STATE_VALUE_ID;
|
||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController
|
||||
.SIGNAL_STRENGTH_LABEL_ID;
|
||||
import static com.android.settings.deviceinfo.simstatus.SimStatusDialogController
|
||||
.SIGNAL_STRENGTH_VALUE_ID;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.doReturn;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -157,6 +160,9 @@ public class SimStatusDialogControllerTest {
|
||||
@Test
|
||||
public void initialize_updateDataStateWithPowerOff_shouldUpdateSettingAndResetSignalStrength() {
|
||||
when(mServiceState.getState()).thenReturn(ServiceState.STATE_POWER_OFF);
|
||||
when(mPersistableBundle.getBoolean(
|
||||
CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(
|
||||
true);
|
||||
|
||||
mController.initialize();
|
||||
|
||||
@@ -172,6 +178,9 @@ public class SimStatusDialogControllerTest {
|
||||
final int signalAsu = 50;
|
||||
doReturn(signalDbm).when(mController).getDbm(mSignalStrength);
|
||||
doReturn(signalAsu).when(mController).getAsuLevel(mSignalStrength);
|
||||
when(mPersistableBundle.getBoolean(
|
||||
CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(
|
||||
true);
|
||||
|
||||
mController.initialize();
|
||||
|
||||
@@ -225,6 +234,30 @@ public class SimStatusDialogControllerTest {
|
||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initialize_doNotShowSignalStrength_shouldRemoveSignalStrengthSetting() {
|
||||
when(mPersistableBundle.getBoolean(
|
||||
CarrierConfigManager.KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL)).thenReturn(
|
||||
false);
|
||||
|
||||
mController.initialize();
|
||||
|
||||
verify(mDialog).removeSettingFromScreen(SIGNAL_STRENGTH_LABEL_ID);
|
||||
verify(mDialog).removeSettingFromScreen(SIGNAL_STRENGTH_VALUE_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initialize_showSignalStrengthAndIccId_shouldShowSignalStrengthAndIccIdSetting() {
|
||||
// getConfigForSubId is nullable, so make sure the default behavior is correct
|
||||
when(mCarrierConfigManager.getConfigForSubId(anyInt())).thenReturn(null);
|
||||
|
||||
mController.initialize();
|
||||
|
||||
verify(mDialog).setText(eq(SIGNAL_STRENGTH_VALUE_ID), any());
|
||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_LABEL_ID);
|
||||
verify(mDialog).removeSettingFromScreen(ICCID_INFO_VALUE_ID);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initialize_showIccid_shouldSetIccidToSetting() {
|
||||
final String iccid = "12351351231241";
|
||||
|
Reference in New Issue
Block a user