Share the summary about alarm when debugging the alarm Shutdown alarm;
Upper-layer calls of alarm include RTC wake-up and alarm alarms. The former is used more frequently and the interfaces are the same. frequent calls of upper-layer applications to rtc wake-up systems increase power consumption, some manufacturers have implemented the so-called synchronous heartbeat technology to uniformly plan the RTC wake-up system;
In essence, alarm starts timer at the underlying layer. When the system is not sleep, timer triggers the trigger and calls the alarm callback function to change global variables.
Enable the ioctl ANDROID_ALARM_WAIT initiated by the upper layer to return a successful result. If the return fails, the ioctl wait will be continuously returned. When the system is sleeping, the current alarm timer is set to the end.
The RTC register plays a role. A few seconds before the timer trigger triggers an RTC interrupt and serves as the interrupt source to wake up the system. After the wake-up, timer counts the sleep time into the on-time alarm. The same applies to the Shutdown Alarm,
The trigger of the alarm trigger is triggered by RTC interruption to enable the alarm on time;
Timer initialization:
Alarm callback function:
Ioctl wait: // wae_up must be waited for when the trigger is triggered; otherwise, the process remains asleep;
RTC wake up the underlying LOG:
Time written to the RTC register:
ALARM timer trigger time: