Android's power management framework
Android uses locks and timers to switch the state of the system to minimize power consumption, and the entire system's power management framework is divided into five parts: the application layer, the framework layer, the JNI layer, the HAL layer, and the kernel layer. The Power management architecture diagram is as follows:
The PowerManager class provides interfaces to the application, such as Wakelock acquire, release, etc., where the upper-level application implements power management through these interfaces.
Powermanagerservice implements the PowerManager interface, PowerManager accesses Powermanagerservice through IBinder.
The powermanagerservice accesses the underlying interface via JNI to enable monitoring of the power state.
The JNI access Hal (POWER.C) invokes the kernel.
The HAL layer accesses the power management functions provided by the kernel through SYSFS. /sys/power/wake_lock,/sys/power/wake_unlock and so on.
Android's power management framework