summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorRoshan Pius <rpius@google.com>2017-03-08 15:10:20 -0800
committerRoshan Pius <rpius@google.com>2017-03-10 18:49:46 +0000
commit4a5f4e08d677a6da1b436e58d027de99518a97cf (patch)
treec456804860aaf54b34ad8a1653cbc4bf9b8a73f8 /service
parentb8b3fb8228a1f90106bad8c59ce006b81ef7921c (diff)
WifiStateMachine: Allow any app to initiate connection
This brings the existing API's in parity with behaviour in N. We allow apps to initiate connection to a network even if they have no permission to modify it. Bug: 36040264 Test: Unit tests Change-Id: I3316877ea88969fe4397552fea9461acb4d52cf2
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 9836e03f8..7840b09ec 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -1258,12 +1258,12 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
* requesting app holds the WIFI_CONFIG_OVERRIDE permission.
*/
private boolean connectToUserSelectNetwork(int netId, int uid) {
- if (!mWifiConfigManager.enableNetwork(netId, true, uid)) {
- loge("connectToUserSelectNetwork uid " + uid
- + " did not have the permissions to enable=" + netId);
+ if (mWifiConfigManager.getConfiguredNetwork(netId) == null) {
+ loge("connectToUserSelectNetwork Invalid network Id=" + netId);
return false;
}
- if (!mWifiConfigManager.checkAndUpdateLastConnectUid(netId, uid)) {
+ if (!mWifiConfigManager.enableNetwork(netId, true, uid)
+ || !mWifiConfigManager.checkAndUpdateLastConnectUid(netId, uid)) {
logi("connectToUserSelectNetwork Allowing uid " + uid
+ " with insufficient permissions to connect=" + netId);
}