Configurable PNO watchdog duration
OEM upstreaming request.
Bug: 174123572
Test: atest com.android.server.wifi
Change-Id: I0e1b49e1ce198529370dd41c378e420339e5fb89
diff --git a/service/java/com/android/server/wifi/WifiConnectivityManager.java b/service/java/com/android/server/wifi/WifiConnectivityManager.java
index ca58fd7..f28f095 100644
--- a/service/java/com/android/server/wifi/WifiConnectivityManager.java
+++ b/service/java/com/android/server/wifi/WifiConnectivityManager.java
@@ -103,10 +103,6 @@
// Number of milli-seconds to delay before retry starting
// a previously failed scan
private static final int RESTART_SCAN_DELAY_MS = 2 * 1000; // 2 seconds
- // When in disconnected mode, a watchdog timer will be fired
- // every WATCHDOG_INTERVAL_MS to start a single scan. This is
- // to prevent caveat from things like PNO scan.
- private static final int WATCHDOG_INTERVAL_MS = 20 * 60 * 1000; // 20 minutes
// Restricted channel list age out value.
private static final long CHANNEL_LIST_AGE_MS = 60 * 60 * 1000; // 1 hour
// This is the time interval for the connection attempt rate calculation. Connection attempt
@@ -256,8 +252,8 @@
}
}
- // As a watchdog mechanism, a single scan will be scheduled every WATCHDOG_INTERVAL_MS
- // if it is in the WIFI_STATE_DISCONNECTED state.
+ // As a watchdog mechanism, a single scan will be scheduled every
+ // config_wifiPnoWatchdogIntervalMinutes if it is in the WIFI_STATE_DISCONNECTED state.
private final AlarmManager.OnAlarmListener mWatchdogListener =
new AlarmManager.OnAlarmListener() {
public void onAlarm() {
@@ -1926,7 +1922,8 @@
localLog("scheduleWatchdogTimer");
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP,
- mClock.getElapsedSinceBootMillis() + WATCHDOG_INTERVAL_MS,
+ mClock.getElapsedSinceBootMillis() + mContext.getResources().getInteger(
+ R.integer.config_wifiPnoWatchdogIntervalMs),
WATCHDOG_TIMER_TAG,
mWatchdogListener, mEventHandler);
}
diff --git a/service/res/values/config.xml b/service/res/values/config.xml
index 60cb7c4..4d9e342 100644
--- a/service/res/values/config.xml
+++ b/service/res/values/config.xml
@@ -427,6 +427,10 @@
<!-- Maximum number of SSIDs that can be PNO scanned concurrently-->
<integer translatable="false" name="config_wifiMaxPnoSsidCount">16</integer>
+ <!-- When disconnected and PNO scan is enabled, wake up to do a single scan every
+ config_wifiPnoWatchdogIntervalMs in case PNO scan failed. (default = 20 minutes)-->
+ <integer translatable="false" name="config_wifiPnoWatchdogIntervalMs">1200000</integer>
+
<!-- Suspend optimization. -->
<bool translatable="false" name="config_wifiSuspendOptimizationsEnabled">true</bool>
diff --git a/service/res/values/overlayable.xml b/service/res/values/overlayable.xml
index f72f9ad..7fe8c8c 100644
--- a/service/res/values/overlayable.xml
+++ b/service/res/values/overlayable.xml
@@ -136,6 +136,7 @@
<item type="bool" name="config_wifiPnoFrequencyCullingEnabled" />
<item type="bool" name="config_wifiPnoRecencySortingEnabled" />
<item type="integer" name="config_wifiMaxPnoSsidCount" />
+ <item type="integer" name="config_wifiPnoWatchdogIntervalMs" />
<item type="bool" name="config_wifiSuspendOptimizationsEnabled" />
<item type="bool" name="config_wifiHighMovementNetworkSelectionOptimizationEnabled" />
<item type="integer" name="config_wifiHighMovementNetworkSelectionOptimizationScanDelayMs" />