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

Commit 6434dd18 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

Update TIME_TICK removal warning

When kernel sends a time change event, we reset the TIME_TICK alarm to
go at the next minute change. This requires removing and rescheduling
the TIME_TICK alarm and results in spurious warning notifications from
the AlarmStore.

Moving the warning to removal history code, which automatically skips
code paths not relevant for this warning. These are:
- calling app is instant
- rescheduling
- user removed

The warning is in place to detect erroneous removal of TIME_TICK.

Flag: EXEMPT bugfix
Test: Manual. Change the time and look at logcat.

Bug: 356549385
Change-Id: I96b52ba509994a7bef4488fb474aa7ed93b4d141
parent ebf8e0c8
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ public class AlarmManagerService extends SystemService {
     */
    int mSystemUiUid;

    static boolean isTimeTickAlarm(Alarm a) {
    private static boolean isTimeTickAlarm(Alarm a) {
        return a.uid == Process.SYSTEM_UID && TIME_TICK_TAG.equals(a.listenerTag);
    }

@@ -3947,6 +3947,9 @@ public class AlarmManagerService extends SystemService {
            if (!RemovedAlarm.isLoggable(reason)) {
                continue;
            }
            if (isTimeTickAlarm(removed)) {
                Slog.wtf(TAG, "Removed TIME_TICK alarm");
            }
            RingBuffer<RemovedAlarm> bufferForUid = mRemovalHistory.get(removed.uid);
            if (bufferForUid == null) {
                bufferForUid = new RingBuffer<>(RemovedAlarm.class, REMOVAL_HISTORY_SIZE_PER_UID);
+0 −7
Original line number Diff line number Diff line
@@ -17,11 +17,9 @@
package com.android.server.alarm;

import static com.android.server.alarm.AlarmManagerService.dumpAlarmList;
import static com.android.server.alarm.AlarmManagerService.isTimeTickAlarm;

import android.app.AlarmManager;
import android.util.IndentingPrintWriter;
import android.util.Slog;
import android.util.proto.ProtoOutputStream;

import com.android.internal.annotations.VisibleForTesting;
@@ -88,11 +86,6 @@ public class LazyAlarmStore implements AlarmStore {
                if (removed.alarmClock != null && mOnAlarmClockRemoved != null) {
                    mOnAlarmClockRemoved.run();
                }
                if (isTimeTickAlarm(removed)) {
                    // This code path is not invoked when delivering alarms, only when removing
                    // alarms due to the caller cancelling it or getting uninstalled, etc.
                    Slog.wtf(TAG, "Removed TIME_TICK alarm");
                }
                removedAlarms.add(removed);
            }
        }