summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2016-04-21 22:25:27 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-04-21 22:25:27 +0000
commitca4e81e099ff1608874a91afd9846100d4599f04 (patch)
tree3c9bbcfb77626ca8cf962cc21ee50f4ffd09f541
parent0ab2b1ad5b0c902c3e8b3c9afd786e3b79e30c95 (diff)
parentad36265b6efc83414daf7e38283826482dfb5045 (diff)
Merge "WifiConfigManager: Remove redundant code" into nyc-dev
-rw-r--r--service/java/com/android/server/wifi/WifiConfigManager.java29
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java8
2 files changed, 14 insertions, 23 deletions
diff --git a/service/java/com/android/server/wifi/WifiConfigManager.java b/service/java/com/android/server/wifi/WifiConfigManager.java
index 286416152..4a42a3356 100644
--- a/service/java/com/android/server/wifi/WifiConfigManager.java
+++ b/service/java/com/android/server/wifi/WifiConfigManager.java
@@ -1294,35 +1294,30 @@ public class WifiConfigManager {
* API. The more powerful selectNetwork()/saveNetwork() is used by the
* state machine for connecting to a network
*
- * @param netId network to be enabled
+ * @param config network to be enabled
* @return {@code true} if it succeeds, {@code false} otherwise
*/
- boolean enableNetwork(int netId, boolean disableOthers, int uid) {
- WifiConfiguration config = mConfiguredNetworks.getForCurrentUser(netId);
+ boolean enableNetwork(WifiConfiguration config, boolean disableOthers, int uid) {
if (config == null) {
return false;
}
+
+ updateNetworkSelectionStatus(
+ config, WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLE);
+ setLatestUserSelectedConfiguration(config);
boolean ret = true;
if (disableOthers) {
- ret = selectNetworkWithoutBroadcast(netId);
+ ret = selectNetworkWithoutBroadcast(config.networkId);
if (sVDBG) {
- localLogNetwork("enableNetwork(disableOthers=true, uid=" + uid + ") ", netId);
+ localLogNetwork("enableNetwork(disableOthers=true, uid=" + uid + ") ",
+ config.networkId);
}
- updateLastConnectUid(getWifiConfiguration(netId), uid);
-
+ updateLastConnectUid(config, uid);
writeKnownNetworkHistory();
sendConfiguredNetworksChangedBroadcast();
} else {
- if (sVDBG) localLogNetwork("enableNetwork(disableOthers=false) ", netId);
- WifiConfiguration enabledNetwork;
- synchronized (mConfiguredNetworks) { // !!! Useless synchronization!
- enabledNetwork = mConfiguredNetworks.getForCurrentUser(netId);
- }
- // check just in case the network was removed by someone else.
- if (enabledNetwork != null) {
- sendConfiguredNetworksChangedBroadcast(enabledNetwork,
- WifiManager.CHANGE_REASON_CONFIG_CHANGE);
- }
+ if (sVDBG) localLogNetwork("enableNetwork(disableOthers=false) ", config.networkId);
+ sendConfiguredNetworksChangedBroadcast(config, WifiManager.CHANGE_REASON_CONFIG_CHANGE);
}
return ret;
}
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index ce6a9f690..5e921c607 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -5503,7 +5503,6 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
replyToMessage(message, message.what, FAILURE);
break;
}
-
// disable other only means select this network, does not mean all other
// networks need to be disabled
if (disableOthers) {
@@ -5514,11 +5513,8 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
// Cancel auto roam requests
autoRoamSetBSSID(netId, "any");
- int uid = message.sendingUid;
- mWifiConfigManager.updateNetworkSelectionStatus(config,
- WifiConfiguration.NetworkSelectionStatus.NETWORK_SELECTION_ENABLE);
- mWifiConfigManager.setLatestUserSelectedConfiguration(config);
- ok = mWifiConfigManager.enableNetwork(netId, disableOthers, uid);
+ ok = mWifiConfigManager.enableNetwork(
+ config, disableOthers, message.sendingUid);
if (!ok) {
messageHandlingStatus = MESSAGE_HANDLING_STATUS_FAIL;
} else if (disableOthers) {