Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 22c65502 authored by Jason Monk's avatar Jason Monk Committed by Android Git Automerger
Browse files

am 5a938481: am d6b001f1: am 8d72046b: Merge "Don\'t show no sim icon on wifi...

am 5a938481: am d6b001f1: am 8d72046b: Merge "Don\'t show no sim icon on wifi devices" into lmp-mr1-dev

* commit '5a938481':
  Don't show no sim icon on wifi devices
parents 8dd5cd73 5a938481
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -428,8 +428,9 @@ public class NetworkControllerImpl extends BroadcastReceiver
        updateNoSims();
    }

    private void updateNoSims() {
        boolean hasNoSims = mPhone.getPhoneCount() != 0 && mMobileSignalControllers.size() == 0;
    @VisibleForTesting
    protected void updateNoSims() {
        boolean hasNoSims = mHasMobileDataFeature && mMobileSignalControllers.size() == 0;
        if (hasNoSims != mHasNoSims) {
            mHasNoSims = hasNoSims;
            notifyListeners();
+12 −0
Original line number Diff line number Diff line
@@ -212,6 +212,18 @@ public class NetworkControllerBaseTest extends AndroidTestCase {
        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,
            boolean dataIn, boolean dataOut) {
        ArgumentCaptor<Integer> iconArg = ArgumentCaptor.forClass(Integer.class);
+24 −0
Original line number Diff line number Diff line
@@ -29,6 +29,30 @@ public class NetworkControllerSignalTest extends NetworkControllerBaseTest {
        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() {
        for (int testStrength = SignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN;
                testStrength <= SignalStrength.SIGNAL_STRENGTH_GREAT; testStrength++) {