Please remember to add a category to the bottom of each page that you create.
See categories help for further details, but most will probably be [[Category:HTC ModelName]].

Wakelocks

From XDA-Developers
Jump to: navigation, search

Android Wakelocks

XDA forum member chamonix has created the perfect app to help you track down and eliminate causes for excessive drain. Using undocumented APIcalls to the batteryinfo service, BetterBatteryStats is able to monitor process stats, network usage, and wakelock stats on your Android 2.2- or 2.3-equipped device. http://www.xda-developers.com/android/tune-your-androids-battery-life-with-betterbatterystats/

Wakelocks statistics are good indicators if the battery drain is high when the phone is off and supposed to sleep. Android Froyo provided battery history to spare parts and BetterBatteryStats [APP] adds battery history back to Gingerbread. A good place to start is to unplug your phone and switch the screen off for a few hours. Then look at Better Battery Stats "Since unplugged" and see what apps/processes have prevented the phone from sleeping. Don't go through the whole list, check the top1-2 first and iterate till there are no values through the roof.

1/ Reboot the phone

2/ Leave it in standby for at least one hour (2 hours would be better)

3/ After that time open BetterBatteryStats and check under 'Process since charged' and 'Wakelocks since charged'

Then you will see what has been causing wake and which processes have been running since the device restarted.

Also, there is an alternative app called "Wakelock detector" which is more suitable for non-tech users. It has a simple outlook that groups all wakelocks by their app name. You can choose either to see CPU wakelocks or Screen wakelocks too. https://play.google.com/store/apps/details?id=com.uzumapps.wakelockdetector

This wiki lists some wakelocks with links to further information and suggestions on how to reduce the number of wakelocks and therefore reduce battery usage while the phone is off and meant to be asleep.

Activity Manager

http://developer.android.com/reference/android/app/ActivityManager.html

Activity Manager is a system process and looks after processes including tasks you have recently started, running processes, or those that may be in an 'error' position.

If you were not to use your device for a while then this activity will be very low. If however you were to have opened lots of apps just before turning your screen off, then this activity will be active for a while before entering true deep sleep.

Activity Manager is normal. If you stop it your phone won't work. If you want to reduce it's 'footprint' however, make sure you exit apps you no longer need before turning the screen off. By this I mean pressing the back arrow to exit them rather than pressing the home button to return to the homescreen - and leaving them running in the background.

Just to re-iterate on hitting the back button to leave apps and why it helps reducing wakelocks. It is related to the lifecycle on activities (jargon for windows). You can see onPause is an important transition because it's the transition where the persistent state is to be saved (eg to a database). Pressing back on an activity calls onPause, meaning android can remove the app without the overhead of doing I/Os and the associated Garbage collection later as it does that straight away.

Alarm Manager

http://developer.android.com/reference/android/app/AlarmManager.html

Alarm Manager manages intents to Be triggered at Specific Times. Alarm Manager has little to do with alarm clocks. It is related to Android holding a process in state until it is either needed again or exited fully.

Quote:

This class provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. When an alarm goes off, the Intent that had been registered for it is broadcast by the system, automatically starting the target application if it is not already running. Registered alarms are retained while the device is asleep (and can optionally wake the device up if they go off during that time), but will be cleared if it is turned off and rebooted. ... The Alarm Manager holds a CPU wake lock as long as the alarm receiver's onReceive() method is executing.

Make sure you exit apps you no longer want by using the back button before you put your device to sleep. Do not use the Home button to exit an app.

RILJ

http://www.kandroid.org/online-pdk/guide/telephony.html

Dialer RILJ is the userland counterpart of the RIL (radio interface lib). RILJ handles whatever the phone need to tell or get from the RIL = phone, e.g. dialing but also coarse location.

Quick misc unsorted notes

Alarm manager = calandar reminders, wifi location,google talk,notifications and updates in any app

Fdcomplete time is probably fast dormancy

Dmesg |grep PM Is a Power manager search. Kernel guys might be able to improve in this area

Drocap2 screenshots

Don't trust % from android process view

Email app battery drain fixed thread - use fixed email v 2..3.5r1

Freeze google docs. Disable sync

Facebook chat go offline (sync notify less important)

Use other email to gmail because it makes locks clearer

Disable auto starts

Manual syncing

Gtalk sign out

Nuke calandar

Android os drain needs to be picked apart in the same way alarms are.

Disable location in google search widget

Can use tasker to toggle gmail etc auto sync to every hour... bear in mind tasker can take some juice and that you can optimise this in expert mode

Com.android.qxdmlog could be motion sensor due to fail on spirit level app restore

Push is always more juice hungry than interval.... shame really as push is supposed to be just that - one way

If can't disable fd with dialer code than try freeze but be prepared for non boot