Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 946e1a90 authored by yingying's avatar yingying Committed by Steve Kondik
Browse files

AlarmManager: Reschedule the date changed event if time changed.

 - Receive the time changed action, and reschedule the date changed
   event if the time changed.
 - Changed to use HOUR_OF_DAY to set the beginning of one day.

CRs-fixed: 740009

Change-Id: I9ff23951a9997ebe5f9d37313147d0ba2461634a
parent e0110562
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -2056,6 +2056,7 @@ class AlarmManagerService extends SystemService {
        public ClockReceiver() {
            IntentFilter filter = new IntentFilter();
            filter.addAction(Intent.ACTION_TIME_TICK);
            filter.addAction(Intent.ACTION_TIME_CHANGED);
            filter.addAction(Intent.ACTION_DATE_CHANGED);
            getContext().registerReceiver(this, filter);
        }
@@ -2067,6 +2068,11 @@ class AlarmManagerService extends SystemService {
                    Slog.v(TAG, "Received TIME_TICK alarm; rescheduling");
                }
                scheduleTimeTickEvent();
            } else if (intent.getAction().equals(Intent.ACTION_TIME_CHANGED)) {
                if (DEBUG_BATCH) {
                    Slog.v(TAG, "Received TIME_CHANGED alarm; reschedule date changed event.");
                }
                scheduleDateChangedEvent();
            } else if (intent.getAction().equals(Intent.ACTION_DATE_CHANGED)) {
                // Since the kernel does not keep track of DST, we need to
                // reset the TZ information at the beginning of each day
@@ -2095,7 +2101,7 @@ class AlarmManagerService extends SystemService {
        public void scheduleDateChangedEvent() {
            Calendar calendar = Calendar.getInstance();
            calendar.setTimeInMillis(System.currentTimeMillis());
            calendar.set(Calendar.HOUR, 0);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);