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


Question

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.



Tracking truant apps that cause battery draining wakelocks




  • 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



Eliminating the bad apps or controlling them



Once you have identified the culprits, you have three choices





Taming wakelocks and improving Doze



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










Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes