diff options
author | Roshan Pius <rpius@google.com> | 2020-07-10 06:57:23 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2020-07-10 14:24:43 +0000 |
commit | 771b4dd25daedb13c9de736a8bca18485fcb1ab6 (patch) | |
tree | 60f15584a44a1bd71c1b58165f7f552297736a8d /tests | |
parent | 696f9eea14613069104a8ddceb1b5658925389e3 (diff) |
ClientModeImpl: Reset WifiInfo on NETWORK_DISCONNECTION_EVENT
Invoke WifiInfo.reset() on connection failure.
Bug: 160787425
Test: atest com.android.server.wifi
Change-Id: I5c3000b4c9eefa8a264ee7ae89abd0b8039dca88
Merged-In: I5c3000b4c9eefa8a264ee7ae89abd0b8039dca88
Diffstat (limited to 'tests')
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java index 23726786d..3048ef3d5 100644 --- a/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java +++ b/tests/wifitests/src/com/android/server/wifi/ClientModeImplTest.java @@ -5295,4 +5295,28 @@ public class ClientModeImplTest extends WifiBaseTest { assertEquals(mNetwork, mCmi.syncGetCurrentNetwork(mCmiAsyncChannel)); mLooper.stopAutoDispatch(); } + + @Test + public void clearRequestingPackageNameInWifiInfoOnConnectionFailure() throws Exception { + mConnectedNetwork.fromWifiNetworkSpecifier = true; + mConnectedNetwork.ephemeral = true; + mConnectedNetwork.creatorName = OP_PACKAGE_NAME; + + triggerConnect(); + + // association completed + mCmi.sendMessage(WifiMonitor.SUPPLICANT_STATE_CHANGE_EVENT, 0, 0, + new StateChangeResult(0, sWifiSsid, sBSSID, SupplicantState.ASSOCIATED)); + mLooper.dispatchAll(); + + assertTrue(mCmi.getWifiInfo().isEphemeral()); + assertEquals(OP_PACKAGE_NAME, mCmi.getWifiInfo().getRequestingPackageName()); + + // fail the connection. + mCmi.sendMessage(WifiMonitor.NETWORK_DISCONNECTION_EVENT, FRAMEWORK_NETWORK_ID, 0, sBSSID); + mLooper.dispatchAll(); + + assertFalse(mCmi.getWifiInfo().isEphemeral()); + assertNull(mCmi.getWifiInfo().getRequestingPackageName()); + } } |