summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMahesh A Saptasagar <msapta@codeaurora.org>2014-12-01 23:21:25 +0530
committerArif Hussain <arifhussain@codeaurora.org>2014-12-03 11:52:41 -0800
commit982c1fd9b81782901f7c73c2eeabee189558bc7e (patch)
tree7be0e8bd7c39ea9dc116f9d97fd4d6b665f082c5
parentcb9eece86c466f302988960f67f11aa9e8a7ef98 (diff)
downloadandroid_frameworks_opt_net_wifi-982c1fd9b81782901f7c73c2eeabee189558bc7e.tar.gz
android_frameworks_opt_net_wifi-982c1fd9b81782901f7c73c2eeabee189558bc7e.tar.bz2
android_frameworks_opt_net_wifi-982c1fd9b81782901f7c73c2eeabee189558bc7e.zip
wifi: Reduce the frequency of scans when in disconnected state and display ON
When STA is not connected, display is ON and there are no saved profiles then reduce frequent scans due to scan alarm source by increasing scan alarm time mCurrentScanAlarmMs to 5 minutes since there is already a periodic scan every mSupplicantScanIntervalMs (15 seconds). If there are saved profiles then keep mCurrentScanAlarmMs to 10 seconds. Change-Id: Icc1ec5803b2048f2d12b47092894127be6626dcd CRs-Fixed: 764660
-rw-r--r--[-rwxr-xr-x]service/java/com/android/server/wifi/WifiStateMachine.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index a963d5e13..216474943 100755..100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -3029,7 +3029,19 @@ public class WifiStateMachine extends StateMachine {
// Scan after 200ms
setScanAlarm(true, 200);
} else if (getCurrentState() == mDisconnectedState) {
- mCurrentScanAlarmMs = mDisconnectedScanPeriodMs;
+
+ // Configure the scan alarm time to mFrameworkScanIntervalMs
+ // (5 minutes) if there are no saved profiles as there is
+ // already a periodic scan getting issued for every
+ // mSupplicantScanIntervalMs seconds. However keep the
+ // scan frequency by setting it to mDisconnectedScanPeriodMs
+ // (10 seconds) when there are configured profiles.
+ if (mWifiConfigStore.getConfiguredNetworks().size() != 0) {
+ mCurrentScanAlarmMs = mDisconnectedScanPeriodMs;
+ } else {
+ mCurrentScanAlarmMs = mFrameworkScanIntervalMs;
+ }
+
// Scan after 200ms
setScanAlarm(true, 200);
}
@@ -7693,9 +7705,19 @@ public class WifiStateMachine extends StateMachine {
Settings.Global.WIFI_FRAMEWORK_SCAN_INTERVAL_MS,
mDefaultFrameworkScanIntervalMs);
- if (mScreenOn)
- mCurrentScanAlarmMs = mDisconnectedScanPeriodMs;
-
+ // Configure the scan alarm time to mFrameworkScanIntervalMs
+ // (5 minutes) if there are no saved profiles as there is
+ // already a periodic scan getting issued for every
+ // mSupplicantScanIntervalMs seconds. However keep the
+ // scan frequency by setting it to mDisconnectedScanPeriodMs
+ // (10 seconds) when there are configured profiles.
+ if (mScreenOn) {
+ if (mWifiConfigStore.getConfiguredNetworks().size() != 0) {
+ mCurrentScanAlarmMs = mDisconnectedScanPeriodMs;
+ } else {
+ mCurrentScanAlarmMs = mFrameworkScanIntervalMs;
+ }
+ }
if (PDBG) {
loge(" Enter disconnected State scan interval " + mFrameworkScanIntervalMs
+ " mEnableBackgroundScan= " + mEnableBackgroundScan