Android Wakelock troubleshooting - identifying the app that is preventing the phone from going into sleep mode and fast draining the battery


My Nexus 5 sometimes drains from 100% chage to zero overnight. This only happens occasionally, and I am assuming some of the apps is not properly handing Android wakelock preventing phone from going to sleep. This assumption is confirmed by the following screenshot (Android KitKat 4.4.4). It shows 9 hrs of "keep awake" time and only 19 minutes of "CPU total" time.

Question: how to find out what app is holding that wake lock preventing the phone from going into sleep mode? Thanks!

System > Settings > Battery > Android OS


Tags: ,

1 Answer

Here is a great article that explains how to troubleshoot Android wakelock problems. Below is an excerpt from that article:

To identify if any wakelocks still held after an application has been put into background, follow this process:

  1. Connect the device to USB.
  2. Launch the application and play with it.
  3. Press the power button to go to sleep mode or exit the application in some other way.
  4. Wait for about 30 sec.
  5. Type the following instruction in command line:

    adb shell dumpsys power

  6. Check if there are any PARTIALWAKELOCKs like this one for example: PARTIALWAKELOCK ‘AudioOut_2’ activated(minState=0, uid=1013, pid=157)

  7. Repeat step 5 every 30 sec 3 to 5 times. If the result stays the same, there may be an issue with improper wakelock handling by the app with given pid .


Post Answer