summaryrefslogtreecommitdiffstats
path: root/services/java
diff options
context:
space:
mode:
authorIrfan Sheriff <isheriff@google.com>2011-02-17 16:44:54 -0800
committerIrfan Sheriff <isheriff@google.com>2011-02-23 10:49:36 -0800
commit74ff3d23f9c0bf0f13a9635473626e9d3cc21103 (patch)
treeca782d68b80da04c757eb98f1da9d0eade15274f /services/java
parentc6c6fe939c83e644b7626f6d3f3be25883af1583 (diff)
downloadframeworks_base-74ff3d23f9c0bf0f13a9635473626e9d3cc21103.zip
frameworks_base-74ff3d23f9c0bf0f13a9635473626e9d3cc21103.tar.gz
frameworks_base-74ff3d23f9c0bf0f13a9635473626e9d3cc21103.tar.bz2
DO NOT MERGE Add support for background scanning
Background scanning (preferred network offload) allows us the host to sleep while the dongle monitors the presence of any preferred networks. This allows us for significant power savings since the system does not have to wake up often to initiate a scan Bug: 3453021 Change-Id: I73dcf4e1c9ab4de280c40b6df6147a74ac003123
Diffstat (limited to 'services/java')
-rw-r--r--services/java/com/android/server/WifiService.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index d2f2ec7..22583f7 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -94,6 +94,9 @@ public class WifiService extends IWifiManager.Stub {
private boolean mDeviceIdle;
private int mPluggedType;
+ /* Chipset supports background scan */
+ private final boolean mBackgroundScanSupported;
+
// true if the user enabled Wifi while in airplane mode
private AtomicBoolean mAirplaneModeOverwridden = new AtomicBoolean(false);
@@ -305,6 +308,9 @@ public class WifiService extends IWifiManager.Stub {
Settings.Secure.WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY, 900) * 1000l;
mNotificationEnabledSettingObserver = new NotificationEnabledSettingObserver(new Handler());
mNotificationEnabledSettingObserver.register();
+
+ mBackgroundScanSupported = mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_wifi_background_scan_support);
}
/**
@@ -874,6 +880,9 @@ public class WifiService extends IWifiManager.Stub {
// because of any locks so clear that tracking immediately.
reportStartWorkSource();
mWifiStateMachine.enableRssiPolling(true);
+ if (mBackgroundScanSupported) {
+ mWifiStateMachine.enableBackgroundScan(false);
+ }
mWifiStateMachine.enableAllNetworks();
updateWifiState();
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
@@ -882,6 +891,9 @@ public class WifiService extends IWifiManager.Stub {
}
mScreenOff = true;
mWifiStateMachine.enableRssiPolling(false);
+ if (mBackgroundScanSupported) {
+ mWifiStateMachine.enableBackgroundScan(true);
+ }
/*
* Set a timer to put Wi-Fi to sleep, but only if the screen is off
* AND the "stay on while plugged in" setting doesn't match the