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
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:
adb shell dumpsys power
Check if there are any PARTIALWAKELOCKs like this one for example: PARTIALWAKELOCK ‘AudioOut_2’ activated(minState=0, uid=1013, pid=157)
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 .