diff options
author | Roshan Pius <rpius@google.com> | 2020-04-09 02:26:53 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2020-04-09 02:26:53 +0000 |
commit | ad8cab35e0fb19d3b667b2cd700c77615b83cb7f (patch) | |
tree | a1e488f34db6e03aa4265fb30907c300b0cda6db /service | |
parent | 5f0f9ba388db8b39d659d6294141778a940c6267 (diff) | |
parent | 168ede29fc294eb4063f0cc2e54b4e9f9394dc01 (diff) |
Merge "WifiNetworkFactory: Ensure we disconnect when we release request" into rvc-dev
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiNetworkFactory.java | 8 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiShellCommand.java | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiNetworkFactory.java b/service/java/com/android/server/wifi/WifiNetworkFactory.java index 271bbefc4..26e602354 100644 --- a/service/java/com/android/server/wifi/WifiNetworkFactory.java +++ b/service/java/com/android/server/wifi/WifiNetworkFactory.java @@ -645,11 +645,11 @@ public class WifiNetworkFactory extends NetworkFactory { return; } if (Objects.equals(mActiveSpecificNetworkRequest, networkRequest)) { - Log.i(TAG, "App released request, cancelling " + Log.i(TAG, "App released active request, cancelling " + mActiveSpecificNetworkRequest); teardownForActiveRequest(); } else if (Objects.equals(mConnectedSpecificNetworkRequest, networkRequest)) { - Log.i(TAG, "App released request, cancelling " + Log.i(TAG, "App released connected request, cancelling " + mConnectedSpecificNetworkRequest); teardownForConnectedNetwork(); } else { @@ -985,6 +985,10 @@ public class WifiNetworkFactory extends NetworkFactory { // Invoked at the termination of current active request processing. private void teardownForActiveRequest() { + if (mPendingConnectionSuccess) { + Log.i(TAG, "Disconnecting from network on reset"); + disconnectAndRemoveNetworkFromWifiConfigManager(mUserSelectedNetwork); + } cleanupActiveRequest(); // ensure there is no connected request in progress. if (mConnectedSpecificNetworkRequest == null) { diff --git a/service/java/com/android/server/wifi/WifiShellCommand.java b/service/java/com/android/server/wifi/WifiShellCommand.java index 1ec56b4ab..64b29f2ac 100644 --- a/service/java/com/android/server/wifi/WifiShellCommand.java +++ b/service/java/com/android/server/wifi/WifiShellCommand.java @@ -470,9 +470,13 @@ public class WifiShellCommand extends BasicShellCommandHandler { pw.println("Wifi is connected to " + info.getSSID()); pw.println("WifiInfo: " + info); Network network = mWifiService.getCurrentNetwork(); - NetworkCapabilities capabilities = - mConnectivityManager.getNetworkCapabilities(network); - pw.println("NetworkCapabilities: " + capabilities); + try { + NetworkCapabilities capabilities = + mConnectivityManager.getNetworkCapabilities(network); + pw.println("NetworkCapabilities: " + capabilities); + } catch (SecurityException e) { + // ignore on unrooted shell. + } } else { pw.println("Wifi is not connected"); } |