Android-Power-management

About e-con Systems™

e-con Systems™, a pioneer in building embedded products has proven expertise in taking Android based products to the market. e-con Systems™ has been working on Android for over 7 years now. e-con has done extensive work on the Android internals and our embedded engineers have an in-depth system level understanding.

Android Power Management

Power management is the most critical thing in any operating system due to the power demand of high end mobile devices. Power management is a technique to conserve power in the expense of latency/performance.

Android Power management built on top of Linux Power Management. Linux Power management is not good enough for a Mobile device. So android keeps the low level power management implementation on Linux and built Android Power management stack on top of Linux PM.

There are two Power management methods in Linux.

  1. APM ( Advanced Power Management)
  2. ACPI ( Advanced Configuration and Power Interface

Android uses neither. Instead it has its own power management extension called Power Manager. Android added its own core power management driver to its Linux flavour. This module provides low level drivers in order to control the peripherals supported by the Power Manager. Android Power management is mainly application centric. The overall system PM is controlled by the Power Manager which resides on the Android Framework.

Normally Android tries to put the system in sleep mode as soon as possible. Android Applications has to request the Power Manager through “WakeLock” to prevent system going into sleep mode or to keep the peripherals active. If there is no WakeLocks, Power manager will put the system in sleep mode. The following table shows currently supported Android WakeLocks and its effects.

Wake Lock CPU Screen Keyboard
PARTIAL_WAKE_LOCK ON OFF OFF
SCREEN_DIM_WAKE_LOCK ON DIM OFF
SCREEN_BRIGHT_WAKE_LOCK ON BRIGHT OFF
FULL_WAKE_LOCK ON BRIGHT BRIGHT

PARTIAL_WAKE_LOCK

  • CPU will be in ON State
  • Screen and Keyboard might not be on

SCREEN_DIM_WAKE_LOCK

  • Ensures the CPU will be ON
  • Let the screen back light and keyboard can go off

SCREEN_BRIGHT_WAKE_LOCK

  • CPU will be On
  • Screen Back light will be ON – Bright state
  • Key board can go off

FULL_WAKE_LOCK

  • Full Power state.

Android Power Management

Apart from application wake, android does have Kernel wake lock as well. Just to prevent the CPU to goes to sleep mode before it completes some important tasks. Drivers can take a wakelock to do some important tasks like receiving a complete packet from the wireless adaptor.

Also the wake lock can be acquired from native applications through power.c interface.

Just like holding the device not to get into the sleep state, the application can also force the device to force the device to go the sleep state by pressing the power button. The application should have DEVICE_POWER permission to do so.

Upon pressing the power button the application will call the goToSleep API which will force release all the wake locks. This will allow the device to go to sleep state immediately and then /sys/power/state will be set to mem.

e-con Systems™ optimizes power management to a great extent by working closely with the lower level BSP of the processor and the Android Power States. Contact our Android experts – sales@e-consystems.com if you require any support or have any queries.