diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-09-03 23:07:48 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-09-03 23:07:48 +0000 |
commit | 3456413e4622e34ea345688ecf6a3fe2b4bae7f7 (patch) | |
tree | 8b00aaa6034cd50d6f87acf6bdba4a1c0b834cf4 | |
parent | c7dce9834d8a88c1e1f136c82d0e13548e9f8ca5 (diff) | |
parent | e4e5a49dbe4ca726c51d9350fa61088c2bb23d8a (diff) |
Snap for 6812348 from e4e5a49dbe4ca726c51d9350fa61088c2bb23d8a to rvc-qpr1-release
Change-Id: Id6aacd89b881fbb09cc45a9e8de7d0ee4d9d73b4
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 5 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index 95983096a..9f4c41f83 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -5013,11 +5013,12 @@ public class ClientModeImpl extends StateMachine { && mLastNetworkId != WifiConfiguration.INVALID_NETWORK_ID) { WifiConfiguration config = mWifiConfigManager.getConfiguredNetwork(mLastNetworkId); - if ((message.arg1 == RESET_SIM_REASON_DEFAULT_DATA_SIM_CHANGED + if (config != null + && ((message.arg1 == RESET_SIM_REASON_DEFAULT_DATA_SIM_CHANGED && config.carrierId != TelephonyManager.UNKNOWN_CARRIER_ID) || (config.enterpriseConfig != null && config.enterpriseConfig.isAuthenticationSimBased() - && !mWifiCarrierInfoManager.isSimPresent(mLastSubId))) { + && !mWifiCarrierInfoManager.isSimPresent(mLastSubId)))) { mWifiMetrics.logStaEvent(StaEvent.TYPE_FRAMEWORK_DISCONNECT, StaEvent.DISCONNECT_RESET_SIM_NETWORKS); // remove local PMKSA cache in framework diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index a9d7f0ce2..fd1ef1718 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -1114,6 +1114,23 @@ public class ClientModeImplTest extends WifiBaseTest { } /** + * When the SIM card was removed, if the current wifi connection is using it, the connection + * should be disconnected, otherwise, the connection shouldn't be impacted. + */ + @Test + public void testResetSimWhenConnectedSimRemovedAfterNetworkRemoval() throws Exception { + setupEapSimConnection(); + doReturn(false).when(mWifiCarrierInfoManager).isSimPresent(eq(DATA_SUBID)); + when(mWifiConfigManager.getConfiguredNetwork(anyInt())).thenReturn(null); + mCmi.sendMessage(ClientModeImpl.CMD_RESET_SIM_NETWORKS, + ClientModeImpl.RESET_SIM_REASON_SIM_REMOVED); + mLooper.dispatchAll(); + + verify(mSimRequiredNotifier, never()).showSimRequiredNotification(any(), any()); + assertEquals("ObtainingIpState", getCurrentState().getName()); + } + + /** * When the default data SIM is changed, if the current wifi connection is carrier wifi, * the connection should be disconnected. */ |