public static void setAndAllowWhileIdle(@NonNull AlarmManager alarmManager, int type,
                                            long triggerAtMillis, @NonNull PendingIntent operation) {
        if (Build.VERSION.SDK_INT >= 23) {
            alarmManager.setAndAllowWhileIdle(type, triggerAtMillis, operation);
        } else {
            alarmManager.set(type, triggerAtMillis, operation);
        }
    }
Like {@link AlarmManager#set(int, long, PendingIntent)}, but this alarm will be allowed to
execute even when the system is in low-power idle modes.  This type of alarm must <b>only</b>
be used for situations where it is actually required that the alarm go off while in
idle -- a reasonable example would be for a calendar notification that should make a
sound so the user is aware of it.  When the alarm is dispatched, the app will also be
added to the system's temporary allow-list for approximately 10 seconds to allow that
application to acquire further wake locks in which to complete its work.</p>

<p>These alarms can significantly impact the power use
of the device when idle (and thus cause significant battery blame to the app scheduling
them), so they should be used with care.  To reduce abuse, there are restrictions on how
frequently these alarms will go off for a particular application.
Under normal system operation, it will not dispatch these
alarms more than about every minute (at which point every such pending alarm is
dispatched); when in low-power idle modes this duration may be significantly longer,
such as 15 minutes.</p>

<p>Unlike other alarms, the system is free to reschedule this type of alarm to happen
out of order with any other alarms, even those from the same app.  This will clearly happen
when the device is idle (since this alarm can go off while idle, when any other alarms
from the app will be held until later), but may also happen even when not idle.</p>

<p>Regardless of the app's target SDK version, this call always allows batching of the
alarm.</p>

@param alarmManager    AlarmManager instance used to set the alarm
@param type            One of {@link AlarmManager#ELAPSED_REALTIME},
                       {@link AlarmManager#ELAPSED_REALTIME_WAKEUP},
                       {@link AlarmManager#RTC}, or {@link AlarmManager#RTC_WAKEUP}.
@param triggerAtMillis time in milliseconds that the alarm should go
                       off, using the appropriate clock (depending on the alarm type).
@param operation       Action to perform when the alarm goes off;
                       typically comes from {@link PendingIntent#getBroadcast
                       IntentSender.getBroadcast()}.
@see AlarmManager#set(int, long, PendingIntent)
@see #setExactAndAllowWhileIdle
@see AlarmManager#cancel
@see android.content.Context#sendBroadcast
@see android.content.Context#registerReceiver
@see android.content.Intent#filterEquals
@see AlarmManager#ELAPSED_REALTIME
@see AlarmManager#ELAPSED_REALTIME_WAKEUP
@see AlarmManager#RTC
@see AlarmManager#RTC_WAKEUP
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/AlarmManagerCompat.java