Merge "Use ELAPSE_REALTIME alarm for tick event"
This commit is contained in:
committed by
Android (Google) Code Review
commit
6683eb2d8d
@@ -764,12 +764,18 @@ class AlarmManagerService extends IAlarmManager.Stub {
|
|||||||
|
|
||||||
public void scheduleTimeTickEvent() {
|
public void scheduleTimeTickEvent() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
final long currentTime = System.currentTimeMillis();
|
||||||
|
calendar.setTimeInMillis(currentTime);
|
||||||
calendar.add(Calendar.MINUTE, 1);
|
calendar.add(Calendar.MINUTE, 1);
|
||||||
calendar.set(Calendar.SECOND, 0);
|
calendar.set(Calendar.SECOND, 0);
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
set(AlarmManager.RTC, calendar.getTimeInMillis(), mTimeTickSender);
|
// Schedule this event for the amount of time that it would take to get to
|
||||||
|
// the top of the next minute.
|
||||||
|
final long tickEventDelay = calendar.getTimeInMillis() - currentTime;
|
||||||
|
|
||||||
|
set(AlarmManager.ELAPSED_REALTIME, SystemClock.elapsedRealtime() + tickEventDelay,
|
||||||
|
mTimeTickSender);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void scheduleDateChangedEvent() {
|
public void scheduleDateChangedEvent() {
|
||||||
|
|||||||
Reference in New Issue
Block a user