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:
@@ -5038,8 +5038,18 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user