Merge "Supress roaming indications during a carrier network change." into oc-dr1-dev

This commit is contained in:
Shishir Agrawal
2017-06-27 01:23:07 +00:00
committed by Android (Google) Code Review
2 changed files with 77 additions and 0 deletions

View File

@@ -341,6 +341,10 @@ public class MobileSignalController extends SignalController<
}
private boolean isRoaming() {
// During a carrier change, roaming indications need to be supressed.
if (isCarrierNetworkChangeActive()) {
return false;
}
if (isCdma()) {
final int iconMode = mServiceState.getCdmaEriIconMode();
return mServiceState.getCdmaEriIconIndex() != EriInfo.ROAMING_INDICATOR_OFF

View File

@@ -494,6 +494,79 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
DEFAULT_ICON /* typeIcon */);
}
@Test
public void testCarrierNetworkChange_roamingBeforeNetworkChange() {
int strength = SignalStrength.SIGNAL_STRENGTH_GREAT;
setupDefaultSignal();
setLevel(strength);
setGsmRoaming(true);
// Verify baseline
verifyLastMobileDataIndicators(true /* visible */,
strength /* strengthIcon */,
DEFAULT_ICON /* typeIcon */,
true /* roaming */);
// API call is made
setCarrierNetworkChange(true /* enabled */);
// Carrier network change is true, show special indicator, no roaming.
verifyLastMobileDataIndicators(true /* visible */,
SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
0 /* typeIcon */,
false /* roaming */);
// Revert back
setCarrierNetworkChange(false /* enabled */);
// Verify back in previous state
verifyLastMobileDataIndicators(true /* visible */,
strength /* strengthIcon */,
DEFAULT_ICON /* typeIcon */,
true /* roaming */);
}
@Test
public void testCarrierNetworkChange_roamingAfterNetworkChange() {
int strength = SignalStrength.SIGNAL_STRENGTH_GREAT;
setupDefaultSignal();
setLevel(strength);
// Verify baseline
verifyLastMobileDataIndicators(true /* visible */,
strength /* strengthIcon */,
DEFAULT_ICON /* typeIcon */,
false /* roaming */);
// API call is made
setCarrierNetworkChange(true /* enabled */);
// Carrier network change is true, show special indicator, no roaming.
verifyLastMobileDataIndicators(true /* visible */,
SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
0 /* typeIcon */,
false /* roaming */);
setGsmRoaming(true);
// Roaming should not show.
verifyLastMobileDataIndicators(true /* visible */,
SignalDrawable.getCarrierChangeState(SignalStrength.NUM_SIGNAL_STRENGTH_BINS),
0 /* typeIcon */,
false /* roaming */);
// Revert back
setCarrierNetworkChange(false /* enabled */);
// Verify back in previous state
verifyLastMobileDataIndicators(true /* visible */,
strength /* strengthIcon */,
DEFAULT_ICON /* typeIcon */,
true /* roaming */);
}
private void verifyEmergencyOnly(boolean isEmergencyOnly) {
ArgumentCaptor<Boolean> emergencyOnly = ArgumentCaptor.forClass(Boolean.class);
Mockito.verify(mCallbackHandler, Mockito.atLeastOnce()).setEmergencyCallsOnly(