summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2017-03-14 22:33:03 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-03-14 22:33:04 +0000
commita4d316f8e789bc1aa6645235f139e48636fe1f2d (patch)
tree0a07d657fd8f6765578b4bfd60784a9c46c6244d
parenteb26485dd36b83676b4931e415f20b284abd7dfc (diff)
parenta1727e40dc6b2742df5b32451f1dfa787fc6aa98 (diff)
Merge "WifiStateMachine: Note user selection only for settings app"
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java7
-rw-r--r--tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java4
2 files changed, 8 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 7840b09ec..a5dc9375f 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -1266,10 +1266,11 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
|| !mWifiConfigManager.checkAndUpdateLastConnectUid(netId, uid)) {
logi("connectToUserSelectNetwork Allowing uid " + uid
+ " with insufficient permissions to connect=" + netId);
+ } else {
+ // Note user connect choice here, so that it will be considered in the next network
+ // selection.
+ mWifiConnectivityManager.setUserConnectChoice(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.
diff --git a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
index f77db43a4..c9bc3d657 100644
--- a/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
+++ b/tests/wifitests/src/com/android/server/wifi/WifiStateMachineTest.java
@@ -811,6 +811,8 @@ public class WifiStateMachineTest {
@Test
public void connect() throws Exception {
addNetworkAndVerifySuccess();
+ when(mWifiConfigManager.enableNetwork(eq(0), eq(true), anyInt())).thenReturn(true);
+ when(mWifiConfigManager.checkAndUpdateLastConnectUid(eq(0), anyInt())).thenReturn(true);
mWsm.setOperationalMode(WifiStateMachine.CONNECT_MODE);
mLooper.dispatchAll();
@@ -820,6 +822,7 @@ public class WifiStateMachineTest {
mLooper.stopAutoDispatch();
verify(mWifiConfigManager).enableNetwork(eq(0), eq(true), anyInt());
+ verify(mWifiConnectivityManager).setUserConnectChoice(eq(0));
mWsm.sendMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();
@@ -856,6 +859,7 @@ public class WifiStateMachineTest {
mLooper.stopAutoDispatch();
verify(mWifiConfigManager).enableNetwork(eq(0), eq(true), anyInt());
+ verify(mWifiConnectivityManager, never()).setUserConnectChoice(eq(0));
mWsm.sendMessage(WifiMonitor.NETWORK_CONNECTION_EVENT, 0, 0, sBSSID);
mLooper.dispatchAll();