Saturday, July 30, 2016

How to tame "Phone Idle" battery drain on unrooted device?


I use AccuBattery and Kaspersky Battery Life to measure energy consumption. Kaspersky Battery Life shows, that all the tasks use minimal energy. AccuBattery Pro shows, that phone uses 5-10 mAh. This is a fairly new, 3000 mAh battery. Phone is a THL T9 Pro, Android 6.0 is installed on it.


UPDATE: I deleted all the mentioned applications and installed new one, GSam Battery Monitor to get detailed data:


gsam screen


There is data from the built-in usage chart too. I checked applications under Battery optimization, I found there only one, Google Play Services.


built-in chart



Answer



How to nail Phone Idle battery drain is the question, but being unrooted device, it calls for some efforts. Finding the culprit apps isn't as easy as it is on rooted devices but is possible using commands to enable higher privileges 1


(At the time of writing, OP is working on his Linux to detect his device 2. Once done with that, they can follow this answer.)


The primary cause of idle drain is truant (s) and the answer is around how to detect apps that cause wakelocks that hurt (Wakelocks aren't bad, they are needed but not such ones). It may help to improve performance but more about that later.



All methods below are working on my unrooted device running Oreo 8.0.




  • Measuring Battery Drain and first level wakelock detection


Battery usage statistics in Android, unfortunately, don't reveal much and are difficult to interpret (not withstanding the improvements in Oreo). GSam Battery Monitor is arguably the best for stock devices. One needs to enable enhanced statistics (Menu → more → Enable more stats) and follow the steps which are


adb -d shell pm grant com.gsamlabs.bbm android.permission.BATTERY_STATSmust read 3


For the PRO version, change 'com.gsamlabs.bbm' to 'com.gsamlabs.bbm.pro' (thanks acejavelin).


The enhanced statistics gives better view of app usage and wakelocks as shown. Long press of held awake (which in OP's case is 77%) shows additional information as shown in the third screenshot.


enter image description here enter image description here




  • Second level bad wakelock detection (One can optionally start with this step)


Download Wakelock Detector [LITE] (XDA thread) which works without root (see this slideshare for details). Two ways to run without root




  • As a Chrome extension or on Chromium. OP had issues with this




  • A better method is adb again





adb shell pm grant com.uzumapps.wakelockdetector.noroot android.permission.BATTERY_STATS


How to use (from Play Store description)





  • Charge your phone above 90% and unplug cable (or just reboot the phone)





  • Give it a time (1-2 hours) to accumulate some wakelock usage statistics




  • Open Wakelock Detector




  • Check the apps on the top, if they show very long wakelock usage time then you found the cause of your battery drain!






While 2 hours is enough to gather the information about top culprits, longer duration obviously leads to more data. During data collection, don't use the device and let it be as you would normally use the phone (with data or WiFi connected as is your normal usage). Screenshots below from my device (not under test but normal usage).


Left to right, they show Screen Wakelock, CPU Wakelock and Wakeup triggers. Check the top contributors to understand what's draining your battery.


enter image description here enter image description here enter image description here



Once you have identified the culprits, you have three choices




Greenify is a fantastic app but very powerful so needs to be used carefully. Read the XDA thread and Greenify tag wiki for help.


I will limit to using adb to unleashing a fair part of its power to help rein in wakelocks and enhancing Doze performance.


A word about Doze, which was introduced since Marshmallow. Though it has evolved better, it has some drawbacks from battery saving point of view.





  • It takes time to kick in, during which apps are active causing drain (even though screen is off)




  • Doze mode is interrupted when you move the device, for example, when you are moving causing battery drain. Doze kicks in again when you are stationary with a wait period




Greenify tackles these problems with Aggresive Doze and Doze on the go (There are other apps that do this too, like ForceDoze, but Greenify manages both Wakelocks and Doze).


Instructions for using adb



For different features, you need to run adb commands to grant the corresponding permission:




  • Accessibility service run-on-demand:


    adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS




  • Aggressive Doze on Android 7.0+ (non-root):


    adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS





  • Doze on the Go:


    adb -d shell pm grant com.oasisfeng.greenify android.permission.DUMP




  • Aggressive Doze (on device/ROM with Doze disabled):


    adb -d shell pm grant com.oasisfeng.greenify android.permission.DUMP




  • Wake-up Tracker:



    adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_LOGS




  • Wake-up Cut-off: (Android 4.4~5.x):


    adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_LOGS


    adb -d shell pm grant com.oasisfeng.greenify android.permission.WRITE_SECURE_SETTINGS




Background-free enforcement on Android 8+ (non-root):


adb -d shell pm grant com.oasisfeng.greenify android.permission.READ_APP_OPS_STATS


I will restrict to snapshots of settings from my device to help set it up faster after running adb commands above. I have pro version so ignore those donation settings


enter image description here enter image description here


With those settings, even when the device is running, you will see a hibernation alert in your status bar with the app icon and in your notification panel. Clicking on that will force close and hibernate the app


enter image description here


You can also hibernate errant apps from Wakelock Detector by long pressing on the app


enter image description here


Caution: Be very careful with what you want to hibernate. Simple rule - don't hibernate apps that are critical to you. Hibernate you errant apps that are not critical


Edit


BetterBatteryStats (XDA thread) is a very powerful tool which has been recently (end Feb 18) updated to work with Oreo and sweeter still is that escalated privileges using adb is possible



adb -d shell pm grant com.asksven.betterbatterystats android.permission.BATTERY_STATS


adb -d shell pm grant com.asksven.betterbatterystats android.permission.DUMP


On Lollipop and forward, additionally run: adb -d shell pm grant com.asksven.betterbatterystats android.permission.PACKAGE_USAGE_STATS


enter image description hereenter image description here


Happy Wakelock hunting!



  • I've done everything you suggested but it didn't help


It's likely that a system app is causing the Wakelocks for which there isn't much you can do on an unrooted device 4








No comments:

Post a Comment

samsung galaxy s 2 - Cannot restore Kies backup after firmware upgrade

I backed up my Samsung Galaxy S2 on Kies before updating to Ice Cream Sandwich. After the upgrade I tried to restore, but the restore fails ...