am 81c92451: Allow overlays to configure ConnectivityService\'s network sampling to not wake the device. This can increase clockwork device battery life. Bug:15455204
* commit '81c92451950cf58fc75f8726431f22003d988962':
Allow overlays to configure ConnectivityService's network sampling to not wake the device. This can increase clockwork device battery life. Bug:15455204
diff --git a/services/core/java/com/android/server/ConnectivityService.java b/services/core/java/com/android/server/ConnectivityService.java
index 8e08583..aa14da1 100644
--- a/services/core/java/com/android/server/ConnectivityService.java
+++ b/services/core/java/com/android/server/ConnectivityService.java
@@ -5038,8 +5038,18 @@
setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent);
}
+ /**
+ * Sets a network sampling alarm.
+ */
void setAlarm(int timeoutInMilliseconds, PendingIntent intent) {
long wakeupTime = SystemClock.elapsedRealtime() + timeoutInMilliseconds;
- mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, wakeupTime, intent);
+ int alarmType;
+ if (Resources.getSystem().getBoolean(
+ R.bool.config_networkSamplingWakesDevice)) {
+ alarmType = AlarmManager.ELAPSED_REALTIME_WAKEUP;
+ } else {
+ alarmType = AlarmManager.ELAPSED_REALTIME;
+ }
+ mAlarmManager.set(alarmType, wakeupTime, intent);
}
}