2. What is wakelock?
Wakelock is the Android feature which can
be used by apps to override deep sleep and
control power management of device:
● Keep CPU awake (at high frequency)
● Turn on the screen
● Keep the screen on
Like in any other portable device when there is no User Interaction,
the device enters into deep sleep mode, in which it uses the minimum
power to prolong battery life.
Usually, before entering into deep sleep mode:
○ First screen dims
○ Then screen turns off
○ Finally, CPU switches to the lowest frequency (sleeps)
3. Why wakelock is bad?
● Wakelock enables apps to do tasks transparently in the
background, without user's awareness. Which might
waste battery power, network data and other resources.
● Apps can switch on the screen without user's intention.
This can be quite annoying for the users.
● Buggy apps; Whenever the wakelock is acquired, it
must be released, otherwise it can cause sleepless
(insomniac) phone. The phone's CPU keeps running or
the screen won't turn off
4. Who benefits from
WakeLock Detector(WLD)?
● People who suffer from extreme battery drain, even
when they are not using phone (this is caused by CPU
wakelocks)
● People who are annoyed by random Screen wake-ups
(this one is caused by screen-wakelocks)
● People who don’t know which app is keeping their
screen on continuously (this one caused by unreleased
wakelocks)
5. Technical Knowledge:
Wakelock Types in Android System
Android PowerManager supports 4 kind of wakelocks
for developers, which are used in acquire/release method :
Wakelock Type 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
Note:
○ PARTIAL_WAKE_LOCK must be released by developer after acquiring, otherwise it
causes sleepless mode
○ Other wakelock types(screen related wakelocks) are released automatically when
the user presses Power Button
○ By using ACQUIRE_CAUSES_WAKE_UP flag developers can turn on the screen
while acquiring one of above wakelock types
6. Wakelock types in WLD
To simplify the types of wakelocks “Wakelock detector”
combines them into 2 types:
● CPU wakelocks
○ PARTIAL_WAKE_LOCK
● Screen wakelocks
○ SCREEN_DIM_WAKELOCK
○ SCREEN_BRIGHT_WAKELOCK
○ FULL_WAKELOCK
7. What is “Wakeup triggers”
In Android, there is a feature called “AlarmManager”
which can be used by other apps to schedule periodic tasks
(e.g: Facebook schedules a task that checks for new
events every 5 minutes).
This causes the phone to wake-up from its deep sleep
mode for certain period of time.
“Wakeup triggers” shows those apps which triggered the
periodic tasks. It shows the exact amount of how many times the
phone has been awaken by the app. By reducing these wakeups
the battery life will be prolonged significantly (e.g: Reduce
update(refresh) rate of Weather widgets..)
8. Since when wakelock statistics
in WLD is shown
The Battery management service of Android resets
(nullifies) accumulated battery statistics (including wakelock
statistics) in two cases:
● while rebooting phone
● when the phone is unplugged with battery level above
90%
In Wakelock detector you can see statistics either since
the time when it was reset or since the time when you
unplugged the cable.
If you choose “since unplug” then you have shorter
duration but more sophisticated wakelock statistics shown.