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

Commit 998e608d authored by Dianne Hackborn's avatar Dianne Hackborn
Browse files

Work on issue #17477510: Time change notifications sent too often

Record the number of time change events seen by the alarm manager.

Change-Id: I154e7e068626c71f76ee7b26f3e38a885025e0fa
parent bb8c4834
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -127,6 +127,7 @@ class AlarmManagerService extends SystemService {
    long mLastAlarmDeliveryTime;
    long mStartCurrentDelayTime;
    long mNextNonWakeupDeliveryTime;
    int mNumTimeChanged;

    private final SparseArray<AlarmManager.AlarmClockInfo> mNextAlarmClockForUser =
            new SparseArray<>();
@@ -821,6 +822,7 @@ class AlarmManagerService extends SystemService {
                    pw.print(" = "); pw.println(sdf.format(new Date(nextNonWakeupRTC)));
            pw.print("Next wakeup: "); TimeUtils.formatDuration(mNextWakeup, nowELAPSED, pw);
                    pw.print(" = "); pw.println(sdf.format(new Date(nextWakeupRTC)));
            pw.print("Num time change events: "); pw.println(mNumTimeChanged);

            if (mAlarmBatches.size() > 0) {
                pw.println();
@@ -1619,6 +1621,9 @@ class AlarmManagerService extends SystemService {
                    removeImpl(mTimeTickSender);
                    rebatchAllAlarms();
                    mClockReceiver.scheduleTimeTickEvent();
                    synchronized (mLock) {
                        mNumTimeChanged++;
                    }
                    Intent intent = new Intent(Intent.ACTION_TIME_CHANGED);
                    intent.addFlags(Intent.FLAG_RECEIVER_REPLACE_PENDING
                            | Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);