Merge "Don't show no sim icon on wifi devices" into lmp-mr1-dev
This commit is contained in:
@ -428,8 +428,9 @@ public class NetworkControllerImpl extends BroadcastReceiver
|
|||||||
updateNoSims();
|
updateNoSims();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateNoSims() {
|
@VisibleForTesting
|
||||||
boolean hasNoSims = mPhone.getPhoneCount() != 0 && mMobileSignalControllers.size() == 0;
|
protected void updateNoSims() {
|
||||||
|
boolean hasNoSims = mHasMobileDataFeature && mMobileSignalControllers.size() == 0;
|
||||||
if (hasNoSims != mHasNoSims) {
|
if (hasNoSims != mHasNoSims) {
|
||||||
mHasNoSims = hasNoSims;
|
mHasNoSims = hasNoSims;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
|
@ -195,6 +195,18 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
|
|||||||
mPhoneStateListener.onDataActivity(dataActivity);
|
mPhoneStateListener.onDataActivity(dataActivity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void verifyHasNoSims(boolean hasNoSimsVisible) {
|
||||||
|
ArgumentCaptor<Boolean> hasNoSimsArg = ArgumentCaptor.forClass(Boolean.class);
|
||||||
|
|
||||||
|
Mockito.verify(mSignalCluster, Mockito.atLeastOnce()).setNoSims(hasNoSimsArg.capture());
|
||||||
|
assertEquals("No sims in status bar", hasNoSimsVisible, (boolean) hasNoSimsArg.getValue());
|
||||||
|
|
||||||
|
Mockito.verify(mNetworkSignalChangedCallback, Mockito.atLeastOnce())
|
||||||
|
.onNoSimVisibleChanged(hasNoSimsArg.capture());
|
||||||
|
assertEquals("No sims in quick settings", hasNoSimsVisible,
|
||||||
|
(boolean) hasNoSimsArg.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
protected void verifyLastQsMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
protected void verifyLastQsMobileDataIndicators(boolean visible, int icon, int typeIcon,
|
||||||
boolean dataIn, boolean dataOut) {
|
boolean dataIn, boolean dataOut) {
|
||||||
ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class);
|
ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class);
|
||||||
|
@ -25,6 +25,30 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
|
|||||||
verifyLastMobileDataIndicators(false, 0, 0);
|
verifyLastMobileDataIndicators(false, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testNoSimsIconPresent() {
|
||||||
|
// No Subscriptions.
|
||||||
|
mNetworkController.mMobileSignalControllers.clear();
|
||||||
|
mNetworkController.updateNoSims();
|
||||||
|
|
||||||
|
verifyHasNoSims(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testNoSimlessIconWithoutMobile() {
|
||||||
|
// Turn off mobile network support.
|
||||||
|
Mockito.when(mMockCm.isNetworkSupported(ConnectivityManager.TYPE_MOBILE)).thenReturn(false);
|
||||||
|
// Create a new NetworkController as this is currently handled in constructor.
|
||||||
|
mNetworkController = new NetworkControllerImpl(mContext, mMockCm, mMockTm, mMockWm, mMockSm,
|
||||||
|
mConfig, mock(AccessPointControllerImpl.class),
|
||||||
|
mock(MobileDataControllerImpl.class));
|
||||||
|
setupNetworkController();
|
||||||
|
|
||||||
|
// No Subscriptions.
|
||||||
|
mNetworkController.mMobileSignalControllers.clear();
|
||||||
|
mNetworkController.updateNoSims();
|
||||||
|
|
||||||
|
verifyHasNoSims(false);
|
||||||
|
}
|
||||||
|
|
||||||
public void testSignalStrength() {
|
public void testSignalStrength() {
|
||||||
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
|
||||||
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
|
testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {
|
||||||
|
Reference in New Issue
Block a user