am 39a9ec20: Allow overlays to configure ConnectivityService\'s network sampling to not wake the device. This can increase clockwork device battery life. Bug:15455204

* commit '39a9ec20d4cb149f1a8f8e4806aded3d67d6bd66':
  Allow overlays to configure ConnectivityService's network sampling to not wake the device. This can increase clockwork device battery life. Bug:15455204
This commit is contained in:
Aaron Whyte
2014-07-11 01:46:08 +00:00
committed by Android Git Automerger

View File

@@ -5038,8 +5038,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent); setAlarm(samplingIntervalInSeconds * 1000, mSampleIntervalElapsedIntent);
} }
/**
* Sets a network sampling alarm.
*/
void setAlarm(int timeoutInMilliseconds, PendingIntent intent) { void setAlarm(int timeoutInMilliseconds, PendingIntent intent) {
long wakeupTime = SystemClock.elapsedRealtime() + timeoutInMilliseconds; 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);
} }
} }