diff options
author | Ecco Park <eccopark@google.com> | 2018-11-12 22:19:00 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-11-12 22:19:00 +0000 |
commit | c6571a3424320c0ab3bcfbb0ab92439ed5adba64 (patch) | |
tree | 9d44fc59e67666fe0f4021a51c5dedc647f15971 | |
parent | 5ca503e12af88171c4aa47c0192c777fb5b27cfe (diff) | |
parent | 1c1418a33d4303f54ecfcf8335b908072630c31c (diff) |
Merge "passpoint-r2: unregister ConnectivityCallbacks when it disconnects OSU AP"
-rw-r--r-- | service/java/com/android/server/wifi/hotspot2/OsuNetworkConnection.java | 1 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/hotspot2/OsuNetworkConnection.java b/service/java/com/android/server/wifi/hotspot2/OsuNetworkConnection.java index 367a80dc6..0de441434 100644 --- a/service/java/com/android/server/wifi/hotspot2/OsuNetworkConnection.java +++ b/service/java/com/android/server/wifi/hotspot2/OsuNetworkConnection.java @@ -136,6 +136,7 @@ public class OsuNetworkConnection { } return; } + mConnectivityManager.unregisterNetworkCallback(mConnectivityCallbacks); mWifiManager.removeNetwork(mNetworkId); mNetworkId = -1; mNetwork = null; diff --git a/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java b/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java index ae1f6ce03..f94c43976 100644 --- a/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java +++ b/tests/wifitests/src/com/android/server/wifi/hotspot2/OsuNetworkConnectionTest.java @@ -220,7 +220,11 @@ public class OsuNetworkConnectionTest { callback.onLost(mCurrentNetwork); verify(mNetworkCallbacks).onDisconnected(); + mNetworkConnection.disconnectIfNeeded(); + + verify(mConnectivityManager).unregisterNetworkCallback(any(ConnectivityManager + .NetworkCallback.class)); verify(mWifiManager).removeNetwork(TEST_NETWORK_ID); } @@ -246,7 +250,11 @@ public class OsuNetworkConnectionTest { callback.onUnavailable(); verify(mNetworkCallbacks).onTimeOut(); + mNetworkConnection.disconnectIfNeeded(); + + verify(mConnectivityManager).unregisterNetworkCallback(any(ConnectivityManager + .NetworkCallback.class)); verify(mWifiManager).removeNetwork(TEST_NETWORK_ID); } @@ -258,7 +266,11 @@ public class OsuNetworkConnectionTest { public void verifyNetworkDisconnect() { mNetworkConnection.init(mHandler); assertEquals(true, mNetworkConnection.connect(TEST_SSID, TEST_NAI)); + mNetworkConnection.disconnectIfNeeded(); + + verify(mConnectivityManager).unregisterNetworkCallback(any(ConnectivityManager + .NetworkCallback.class)); verify(mWifiManager).removeNetwork(TEST_NETWORK_ID); } |