diff options
author | David Su <dysu@google.com> | 2019-05-06 17:19:08 -0700 |
---|---|---|
committer | David Su <dysu@google.com> | 2019-05-10 17:28:24 +0000 |
commit | b8003d2181aa7d7606dd9d3222712d93abf09649 (patch) | |
tree | 6de6161b596c6bff05cfb669c28041d0d56da04c /tests | |
parent | bfe8dc332f563cfb9569dacb69d689f05dc37ba8 (diff) |
Get isSimPresent() directly from Telephony
Instead of caching isSimPresent in Wifi, directly call the Telephony API to
query if a SIM card is loaded.
Also reset identity/anonymous identity of Wifi networks using SIM-based
authentication when the SIM card is removed rather than when the SIM card is
inserted, to support multi-SIM use cases.
Bug: 130875004
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: On a device with multiple SIMs, connect to a EAP-SIM network using
one SIM, then remove that SIM. Wifi network should disconnect and not
re-connect.
Change-Id: Id878c0402e3611b9f23c09bf8df87ab0a0ef8e60
Diffstat (limited to 'tests')
5 files changed, 99 insertions, 82 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index f0e0daefc..0fd040c7e 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -3413,7 +3413,7 @@ public class ClientModeImplTest { mLooper.dispatchAll(); verify(mPasspointManager).removeEphemeralProviders(); - verify(mWifiConfigManager).resetSimNetworks(eq(false)); + verify(mWifiConfigManager).resetSimNetworks(); } /** diff --git a/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java index 15b64c4df..ff8c8250a 100644 --- a/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/SavedNetworkEvaluatorTest.java @@ -27,6 +27,7 @@ import android.content.res.Resources; import android.net.wifi.ScanResult; import android.net.wifi.WifiConfiguration; import android.os.SystemClock; +import android.telephony.SubscriptionManager; import android.util.LocalLog; import androidx.test.filters.SmallTest; @@ -76,7 +77,9 @@ public class SavedNetworkEvaluatorTest { mSavedNetworkEvaluator = new SavedNetworkEvaluator(mContext, new ScoringParams(mContext), mWifiConfigManager, - mClock, mLocalLog, mWifiConnectivityHelper); + mClock, mLocalLog, mWifiConnectivityHelper, mSubscriptionManager); + // SIM is absent + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[0]); } /** Cleans up test. */ @@ -92,6 +95,7 @@ public class SavedNetworkEvaluatorTest { @Mock private Resources mResource; @Mock private Clock mClock; @Mock private OnConnectableListener mOnConnectableListener; + @Mock private SubscriptionManager mSubscriptionManager; private LocalLog mLocalLog; private int mThresholdMinimumRssi2G; private int mThresholdMinimumRssi5G; diff --git a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java index b8f6c57fc..3b86be887 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiConfigManagerTest.java @@ -51,6 +51,7 @@ import androidx.test.filters.SmallTest; import com.android.dx.mockito.inline.extended.ExtendedMockito; import com.android.internal.R; +import com.android.server.wifi.util.TelephonyUtil; import com.android.server.wifi.util.WifiPermissionsUtil; import com.android.server.wifi.util.WifiPermissionsWrapper; @@ -4308,71 +4309,79 @@ public class WifiConfigManagerTest { verifyAddNetworkToWifiConfigManager(simNetwork); verifyAddNetworkToWifiConfigManager(peapSimNetwork); - // Verify SIM is not present initially. - assertFalse(mWifiConfigManager.isSimPresent()); + // SIM was removed, resetting SIM Networks + mWifiConfigManager.resetSimNetworks(); - // Call resetSimNetworks with true(SIM is present). - mWifiConfigManager.resetSimNetworks(true); - - // Verify SIM is present, SIM configs are reset and non-SIM configs are not changed. - assertTrue(mWifiConfigManager.isSimPresent()); + // Verify SIM configs are reset and non-SIM configs are not changed. WifiConfigurationTestUtil.assertConfigurationEqualForConfigManagerAddOrUpdate( network, mWifiConfigManager.getConfiguredNetworkWithPassword(network.networkId)); WifiConfiguration retrievedSimNetwork = mWifiConfigManager.getConfiguredNetwork(simNetwork.networkId); - assertTrue(retrievedSimNetwork.enterpriseConfig.getAnonymousIdentity().isEmpty()); - assertTrue(retrievedSimNetwork.enterpriseConfig.getIdentity().isEmpty()); + assertEquals("", retrievedSimNetwork.enterpriseConfig.getAnonymousIdentity()); + assertEquals("", retrievedSimNetwork.enterpriseConfig.getIdentity()); WifiConfiguration retrievedPeapSimNetwork = mWifiConfigManager.getConfiguredNetwork(peapSimNetwork.networkId); assertEquals(expectedIdentity, retrievedPeapSimNetwork.enterpriseConfig.getIdentity()); - assertFalse(retrievedPeapSimNetwork.enterpriseConfig.getAnonymousIdentity().isEmpty()); - - // Call resetSimNetworks with false(SIM is not present). - when(mDataTelephonyManager.getSubscriberId()).thenReturn("3214561234567891"); - retrievedSimNetwork.enterpriseConfig.setAnonymousIdentity("anonymous_identity22"); - verifyUpdateNetworkToWifiConfigManagerWithoutIpChange(retrievedSimNetwork); - mWifiConfigManager.resetSimNetworks(false); - - // Verify SIM is not present and all configs are not changed. - assertFalse(mWifiConfigManager.isSimPresent()); - WifiConfigurationTestUtil.assertConfigurationEqualForConfigManagerAddOrUpdate( - network, - mWifiConfigManager.getConfiguredNetworkWithPassword(network.networkId)); - WifiConfigurationTestUtil.assertConfigurationEqualForConfigManagerAddOrUpdate( - retrievedSimNetwork, - mWifiConfigManager.getConfiguredNetworkWithPassword(simNetwork.networkId)); - WifiConfigurationTestUtil.assertConfigurationEqualForConfigManagerAddOrUpdate( - retrievedPeapSimNetwork, - mWifiConfigManager.getConfiguredNetworkWithPassword(peapSimNetwork.networkId)); + assertNotEquals("", retrievedPeapSimNetwork.enterpriseConfig.getAnonymousIdentity()); } /** - * Verifies that the method resetSimNetworks updates SIM presence status if - * getSimIdentity returns null. + * {@link WifiConfigManager#resetSimNetworks()} should reset all non-PEAP SIM networks, no + * matter if {@link com.android.server.wifi.util.TelephonyUtil#getSimIdentity(TelephonyManager, + * TelephonyUtil, WifiConfiguration, CarrierNetworkConfig) TelephonyUtil#getSimIdentity} + * returns null or not. */ @Test - public void testResetSimNetworksWithNullIdentity() { + public void testResetSimNetworks_getSimIdentityNull_shouldResetAllNonPeapSimIdentities() { + when(mDataTelephonyManager.getSubscriberId()).thenReturn("3214561234567890"); + when(mDataTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY); + when(mDataTelephonyManager.getSimOperator()).thenReturn("321456"); + when(mDataTelephonyManager.getCarrierInfoForImsiEncryption(anyInt())).thenReturn(null); + // null CarrierNetworkConfig => getSimIdentity returns null => PEAP identity unchanged + when(mWifiInjector.getCarrierNetworkConfig()).thenReturn(null); + + WifiConfiguration peapSimNetwork = WifiConfigurationTestUtil.createEapNetwork( + WifiEnterpriseConfig.Eap.PEAP, WifiEnterpriseConfig.Phase2.SIM); + peapSimNetwork.enterpriseConfig.setIdentity("identity_peap"); + peapSimNetwork.enterpriseConfig.setAnonymousIdentity("anonymous_identity_peap"); + verifyAddNetworkToWifiConfigManager(peapSimNetwork); + + WifiConfiguration network = WifiConfigurationTestUtil.createEapNetwork(); + network.enterpriseConfig.setIdentity("identity"); + network.enterpriseConfig.setAnonymousIdentity("anonymous_identity"); + verifyAddNetworkToWifiConfigManager(network); + WifiConfiguration simNetwork = WifiConfigurationTestUtil.createEapNetwork( WifiEnterpriseConfig.Eap.SIM, WifiEnterpriseConfig.Phase2.NONE); + simNetwork.enterpriseConfig.setIdentity("identity_eap_sim"); + simNetwork.enterpriseConfig.setAnonymousIdentity("anonymous_identity_eap_sim"); verifyAddNetworkToWifiConfigManager(simNetwork); - assertFalse(mWifiConfigManager.isSimPresent()); - - mWifiConfigManager.resetSimNetworks(true); - assertTrue(mWifiConfigManager.isSimPresent()); + // SIM was removed, resetting SIM Networks + mWifiConfigManager.resetSimNetworks(); - mWifiConfigManager.resetSimNetworks(false); - assertFalse(mWifiConfigManager.isSimPresent()); + // EAP non-SIM network should be unchanged + WifiConfigurationTestUtil.assertConfigurationEqualForConfigManagerAddOrUpdate( + network, mWifiConfigManager.getConfiguredNetworkWithPassword(network.networkId)); + // EAP-SIM network should have identity & anonymous identity reset + WifiConfiguration retrievedSimNetwork = + mWifiConfigManager.getConfiguredNetwork(simNetwork.networkId); + assertEquals("", retrievedSimNetwork.enterpriseConfig.getAnonymousIdentity()); + assertEquals("", retrievedSimNetwork.enterpriseConfig.getIdentity()); + // PEAP network should have unchanged identity & anonymous identity + WifiConfiguration retrievedPeapSimNetwork = + mWifiConfigManager.getConfiguredNetwork(peapSimNetwork.networkId); + assertEquals("identity_peap", retrievedPeapSimNetwork.enterpriseConfig.getIdentity()); + assertEquals("anonymous_identity_peap", + retrievedPeapSimNetwork.enterpriseConfig.getAnonymousIdentity()); } /** - * Verifies that SIM config is reset if store is read after the method resetSimNetworks - * is called. + * Verifies that SIM configs are reset on {@link WifiConfigManager#loadFromStore()}. */ @Test - public void testResetSimNetworksIsCalledAgainAfterLoadFromStore() { - String expectedIdentity = "13214561234567890@wlan.mnc456.mcc321.3gppnetwork.org"; + public void testLoadFromStoreResetsSimIdentity() { when(mDataTelephonyManager.getSubscriberId()).thenReturn("3214561234567890"); when(mDataTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY); when(mDataTelephonyManager.getSimOperator()).thenReturn("321456"); @@ -4397,27 +4406,20 @@ public class WifiConfigManagerTest { }; setupStoreDataForRead(sharedNetworks, new ArrayList<>(), new HashMap<>()); - // 1. Call resetSimNetworks with true(SIM is present). - mWifiConfigManager.resetSimNetworks(true); - - // Verify SIM is present. - assertTrue(mWifiConfigManager.isSimPresent()); - - // 2. Read from store now. + // read from store now assertTrue(mWifiConfigManager.loadFromStore()); - // Verify SIM is present just in case and SIM config is reset. - assertTrue(mWifiConfigManager.isSimPresent()); - + // assert that the expected identities are reset WifiConfiguration retrievedSimNetwork = mWifiConfigManager.getConfiguredNetwork(simNetwork.networkId); - assertTrue(retrievedSimNetwork.enterpriseConfig.getIdentity().isEmpty()); - assertTrue(retrievedSimNetwork.enterpriseConfig.getAnonymousIdentity().isEmpty()); + assertEquals("", retrievedSimNetwork.enterpriseConfig.getIdentity()); + assertEquals("", retrievedSimNetwork.enterpriseConfig.getAnonymousIdentity()); WifiConfiguration retrievedPeapNetwork = mWifiConfigManager.getConfiguredNetwork(peapSimNetwork.networkId); - assertEquals(retrievedPeapNetwork.enterpriseConfig.getIdentity(), "identity"); - assertFalse(retrievedPeapNetwork.enterpriseConfig.getAnonymousIdentity().isEmpty()); + assertEquals("identity", retrievedPeapNetwork.enterpriseConfig.getIdentity()); + assertEquals("anonymous_identity", + retrievedPeapNetwork.enterpriseConfig.getAnonymousIdentity()); } /** @@ -4631,14 +4633,6 @@ public class WifiConfigManagerTest { WifiConfigManager.createDebugTimeStampString(TEST_WALLCLOCK_UPDATE_TIME_MILLIS); } - private void assertNotEquals(Object expected, Object actual) { - if (actual != null) { - assertFalse(actual.equals(expected)); - } else { - assertNotNull(expected); - } - } - /** * Modifies the provided WifiConfiguration with the specified bssid value. Also, asserts that * the existing |BSSID| field is not the same value as the one being set diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java index bf71b927e..338f7bc40 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointManagerTest.java @@ -72,6 +72,7 @@ import android.os.Handler; import android.os.Looper; import android.os.UserHandle; import android.os.test.TestLooper; +import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.Base64; import android.util.Pair; @@ -186,6 +187,7 @@ public class PasspointManagerTest { @Mock ClientModeImpl mClientModeImpl; @Mock TelephonyManager mTelephonyManager; @Mock TelephonyManager mDataTelephonyManager; + @Mock SubscriptionManager mSubscriptionManager; Handler mHandler; TestLooper mLooper; @@ -216,7 +218,7 @@ public class PasspointManagerTest { mHandler = new Handler(mLooper.getLooper()); mManager = new PasspointManager(mContext, mWifiInjector, mHandler, mWifiNative, mWifiKeyStore, mClock, mSimAccessor, mObjectFactory, mWifiConfigManager, - mWifiConfigStore, mWifiMetrics, mTelephonyManager); + mWifiConfigStore, mWifiMetrics, mTelephonyManager, mSubscriptionManager); ArgumentCaptor<PasspointEventHandler.Callbacks> callbacks = ArgumentCaptor.forClass(PasspointEventHandler.Callbacks.class); verify(mObjectFactory).makePasspointEventHandler(any(WifiNative.class), @@ -231,6 +233,8 @@ public class PasspointManagerTest { mCallbacks = callbacks.getValue(); mSharedDataSource = sharedDataSource.getValue(); mUserDataSource = userDataSource.getValue(); + // SIM is absent + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[0]); } /** @@ -1626,7 +1630,8 @@ public class PasspointManagerTest { when(mDataTelephonyManager.getSimOperator()).thenReturn("123456"); PasspointManager passpointManager = new PasspointManager(mContext, mWifiInjector, mHandler, mWifiNative, mWifiKeyStore, mClock, mSimAccessor, mObjectFactory, - mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager); + mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager, + mSubscriptionManager); assertNull(passpointManager.createEphemeralPasspointConfigForCarrier( EAPConstants.EAP_TLS)); @@ -1643,7 +1648,8 @@ public class PasspointManagerTest { when(mDataTelephonyManager.getSimOperatorName()).thenReturn("test"); PasspointManager passpointManager = new PasspointManager(mContext, mWifiInjector, mHandler, mWifiNative, mWifiKeyStore, mClock, mSimAccessor, mObjectFactory, - mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager); + mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager, + mSubscriptionManager); PasspointConfiguration result = passpointManager.createEphemeralPasspointConfigForCarrier( @@ -1660,7 +1666,8 @@ public class PasspointManagerTest { */ @Test public void verifyInstallEphemeralPasspointConfigurationWithNonCarrierEapMethod() { - when(mWifiConfigManager.isSimPresent()).thenReturn(true); + // SIM is present + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[1]); PasspointConfiguration config = createTestConfigWithUserCredential("abc.com", "test"); PasspointProvider provider = createMockProvider(config); when(mObjectFactory.makePasspointProvider(eq(config), eq(mWifiKeyStore), @@ -1674,7 +1681,8 @@ public class PasspointManagerTest { */ @Test public void verifyInstallEphemeralPasspointConfiguration() { - when(mWifiConfigManager.isSimPresent()).thenReturn(true); + // SIM is present + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[1]); PasspointConfiguration config = createTestConfigWithSimCredential(TEST_FQDN, TEST_IMSI, TEST_REALM); PasspointProvider provider = createMockProvider(config); @@ -1719,7 +1727,8 @@ public class PasspointManagerTest { when(mTelephonyManager.createForSubscriptionId(anyInt())) .thenReturn(mDataTelephonyManager); when(mDataTelephonyManager.getSimOperator()).thenReturn(TEST_MCC_MNC); - when(mWifiConfigManager.isSimPresent()).thenReturn(true); + // SIM is present + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[1]); List<ScanDetail> scanDetails = new ArrayList<>(); scanDetails.add(generateScanDetail(TEST_SSID, TEST_BSSID_STRING, TEST_HESSID, TEST_ANQP_DOMAIN_ID, true)); @@ -1740,7 +1749,8 @@ public class PasspointManagerTest { PasspointManager passpointManager = new PasspointManager(mContext, mWifiInjector, mHandler, mWifiNative, mWifiKeyStore, mClock, mSimAccessor, mObjectFactory, - mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager); + mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager, + mSubscriptionManager); assertEquals(EAPConstants.EAP_AKA, passpointManager.findEapMethodFromNAIRealmMatchedWithCarrier(scanDetails)); } finally { @@ -1761,13 +1771,15 @@ public class PasspointManagerTest { when(mTelephonyManager.createForSubscriptionId(anyInt())) .thenReturn(mDataTelephonyManager); when(mDataTelephonyManager.getSimOperator()).thenReturn(TEST_MCC_MNC); - when(mWifiConfigManager.isSimPresent()).thenReturn(true); + // SIM is present + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[1]); List<ScanDetail> scanDetails = new ArrayList<>(); scanDetails.add(generateScanDetail(TEST_SSID, TEST_BSSID_STRING, 0, 0, false)); PasspointManager passpointManager = new PasspointManager(mContext, mWifiInjector, mHandler, mWifiNative, mWifiKeyStore, mClock, mSimAccessor, mObjectFactory, - mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager); + mWifiConfigManager, mWifiConfigStore, mWifiMetrics, mTelephonyManager, + mSubscriptionManager); assertEquals(-1, passpointManager.findEapMethodFromNAIRealmMatchedWithCarrier(scanDetails)); diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java index f9d6a1c8d..3048abae0 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/PasspointNetworkEvaluatorTest.java @@ -37,6 +37,7 @@ import android.net.wifi.WifiConfiguration; import android.net.wifi.WifiEnterpriseConfig; import android.net.wifi.hotspot2.PasspointConfiguration; import android.net.wifi.hotspot2.pps.HomeSp; +import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import android.util.LocalLog; import android.util.Pair; @@ -59,6 +60,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import java.util.Arrays; +import java.util.Collections; import java.util.List; /** @@ -84,6 +86,7 @@ public class PasspointNetworkEvaluatorTest { @Mock OnConnectableListener mOnConnectableListener; @Mock TelephonyManager mTelephonyManager; @Mock TelephonyManager mDataTelephonyManager; + @Mock SubscriptionManager mSubscriptionManager; @Mock CarrierNetworkConfig mCarrierNetworkConfig; @Mock WifiInjector mWifiInjector; LocalLog mLocalLog; @@ -149,10 +152,11 @@ public class PasspointNetworkEvaluatorTest { initMocks(this); mLocalLog = new LocalLog(512); mEvaluator = new PasspointNetworkEvaluator(mPasspointManager, mWifiConfigManager, mLocalLog, - mCarrierNetworkConfig, mWifiInjector); + mCarrierNetworkConfig, mWifiInjector, mSubscriptionManager); when(mWifiInjector.makeTelephonyManager()).thenReturn(mTelephonyManager); when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mDataTelephonyManager); - when(mWifiConfigManager.isSimPresent()).thenReturn(true); + // SIM is present + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[1]); when(mDataTelephonyManager.getSimOperator()).thenReturn("123456"); when(mDataTelephonyManager.getSimState()).thenReturn(TelephonyManager.SIM_STATE_READY); } @@ -382,7 +386,8 @@ public class PasspointNetworkEvaluatorTest { when(mPasspointManager.matchProvider(any(ScanResult.class))).thenReturn(homeProvider); when(testProvider.isSimCredential()).thenReturn(true); - when(mWifiConfigManager.isSimPresent()).thenReturn(false); + // SIM is absent + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[0]); assertEquals(null, mEvaluator.evaluateNetworks( scanDetails, null, null, false, false, mOnConnectableListener)); @@ -413,7 +418,8 @@ public class PasspointNetworkEvaluatorTest { mTelephonyManager); when(mPasspointManager.matchProvider(any(ScanResult.class))).thenReturn(homeProvider); when(testProvider.isSimCredential()).thenReturn(true); - when(mWifiConfigManager.isSimPresent()).thenReturn(true); + // SIM is present + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[1]); when(mCarrierNetworkConfig.isCarrierEncryptionInfoAvailable()).thenReturn(true); when(mCarrierNetworkConfig.isSupportAnonymousIdentity()).thenReturn(true); when(mWifiConfigManager.addOrUpdateNetwork(any(WifiConfiguration.class), anyInt())) @@ -452,13 +458,14 @@ public class PasspointNetworkEvaluatorTest { @Test public void skipCreateEphemeralPasspointConfigurationWithoutSIMCard() { // Setup ScanDetail and match providers. - List<ScanDetail> scanDetails = Arrays.asList(new ScanDetail[] { - generateScanDetail(TEST_SSID1, TEST_BSSID1)}); - when(mWifiConfigManager.isSimPresent()).thenReturn(false); + List<ScanDetail> scanDetails = Collections.singletonList( + generateScanDetail(TEST_SSID1, TEST_BSSID1)); + // SIM is absent + when(mSubscriptionManager.getActiveSubscriptionIdList()).thenReturn(new int[0]); when(mPasspointManager.hasCarrierProvider(anyString())).thenReturn(false); when(mCarrierNetworkConfig.isCarrierEncryptionInfoAvailable()).thenReturn(true); - assertEquals(null, mEvaluator.evaluateNetworks( + assertNull(mEvaluator.evaluateNetworks( scanDetails, null, null, false, false, mOnConnectableListener)); verify(mPasspointManager, never()).createEphemeralPasspointConfigForCarrier(anyInt()); } |