diff options
author | Roshan Pius <rpius@google.com> | 2017-01-24 15:47:37 -0800 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2017-01-25 15:27:44 -0800 |
commit | 5574ae254943a9f6bbb763f20777a52a377d7a39 (patch) | |
tree | 69d7b10f2f9074d9a80023f21bad0f433e816ced /service | |
parent | 4f294fab991c91d629b9dfab5ed3a35a69ed3ce6 (diff) |
WifiStateMachine: Allow all apps to connect to a network
We had previously disallowed non settings apps from initiating
connection to a specific network for O using |disableOthers| flag in
WifiManager.enableNetwork.
But, we're relaxing this for O. We'll enforce this back in the next
release.
Note: We're adding an API surface with better semantics
(Network Specifier) for apps to make such requests in the future.
Bug: 34520151
Test: Unit tests
Change-Id: I78c382eab67a6dcff18627b6ca8ee282a04b3dde
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index 112f589e2..46ec7abe8 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -1263,8 +1263,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss /** * Initiates connection to a network specified by the user/app. This method checks if the * requesting app holds the WIFI_CONFIG_OVERRIDE permission. - * a) If yes, we start a new connection attempt to the specified network. - * b) if no, then we ask connectivity manager to start a new scan and trigger network selection. */ private boolean connectToUserSelectNetwork(int netId, int uid) { if (!mWifiConfigManager.enableNetwork(netId, true, uid)) { @@ -1273,22 +1271,18 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss return false; } if (!mWifiConfigManager.checkAndUpdateLastConnectUid(netId, uid)) { - loge("connectToUserSelectNetwork uid " + uid - + " did not have the permissions to connect=" + netId); - // App does not have the permission to force a connection. But, we should still - // reconsider this newly enabled network for network selection. - mWifiConnectivityManager.forceConnectivityScan(); + logi("connectToUserSelectNetwork Allowing uid " + uid + + " with insufficient permissions to connect=" + netId); + } + // Trigger an immediate connection to the specified network. We're also noting the user + // connect choice here, so that it will be considered in the next network selection. + mWifiConnectivityManager.setUserConnectChoice(netId); + if (mWifiInfo.getNetworkId() == netId) { + // We're already connected to the user specified network, don't trigger a + // reconnection. + logi("connectToUserSelectNetwork already connecting/connected=" + netId); } else { - // Trigger an immediate connection to the specified network. We're also noting the user - // connect choice here, so that it will be considered in the next network selection. - mWifiConnectivityManager.setUserConnectChoice(netId); - if (mWifiInfo.getNetworkId() == netId) { - // We're already connected to the user specified network, don't trigger a - // reconnection. - logi("connectToUserSelectNetwork already connecting/connected=" + netId); - } else { - startConnectToNetwork(netId, SUPPLICANT_BSSID_ANY); - } + startConnectToNetwork(netId, SUPPLICANT_BSSID_ANY); } return true; } |