shill: Enable auto-connect for WiFi services
This performs a few of the last tidbits to get auto-connect
working for WiFi networks. The tweaks include:
* Adding calls to SortServices() in Push/PopProfile
* On successful connection, move service to the profile on
the top of the stack if this service was previously in the
ephemeral profile.
* Add a method to Services to return whether they are eligible
for auto-connect. Implement this for the WiFi services by
using a new method to test if the WiFi device is busy.
BUG=chromium-os:24261,chromium-os:17255
TEST=Unit Tests (for regression)
Manual: Connect to WPA-PSK network successfully; restart shill and
observe an auto-connect after scan.
Change-Id: Ia4e1fd94795a4ce64d66ec6db940ee16ff694431
Reviewed-on: https://gerrit.chromium.org/gerrit/12963
Reviewed-by: mukesh agrawal <quiche@chromium.org>
Commit-Ready: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/wifi_service.cc b/wifi_service.cc
index 217dd1e..1f2d978 100644
--- a/wifi_service.cc
+++ b/wifi_service.cc
@@ -132,6 +132,12 @@
return wifi_->TechnologyIs(type);
}
+bool WiFiService::IsAutoConnectable() {
+ // TODO(quiche): Need to also handle the case where there might be
+ // another service that has posted a Connect task. crosbug.com/24276
+ return connectable() && wifi_->IsIdle();
+}
+
void WiFiService::AddEndpoint(WiFiEndpointConstRefPtr endpoint) {
DCHECK(endpoint->ssid() == ssid());
endpoints_.insert(endpoint);