Battery analysis and battery drain trouble solving.

  1. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 3, 2021

    Swejuggalo , Apr 3, 2021 :
    Battery analysis and battery drain trouble solving.
    Battery life is so much more than just screen on time (SoT). Comparing SoT can also be very tricky due to a massive amount of factors behind it.
    What is using the CPU and why? Does it need to? And what can be done about it?
    What does a setting do? Should it be Enabled or Disabled? Does an app really need access to your location?

    First we need to talk about optimizing. When your device is brand new or has been recently factory reset or upgraded it is not fully optimized yet.

    There are 3 levels of optimizing.
    First and perhaps the most obvious one is the battery setting used for the app. As standard the phone tries to learn how you use the app and based on that and the nature of the app it sets what it believes to be the best option for it. The so called “Intelligent Control”. This can take some time and thus drain may be higher for some time. However, you can manually choose to optimize or not optimize them. What you choose here affects the behavior of the app after you have stopped using them (background behavior). Optimizing will mean notifications can turn up late or be put on hold until next time you open the app. Not optimizing will make sure the app stays up running even if that could possibly mean more drain.

    Normally you don’t need to select “Do not optimize” unless the app specifically asks for it, or as a troubleshooting solution for apps that suddenly stops giving notifications.
    At the same time forcing a app to optimize and regularly opening it very often could render it to use MORE power than if it still were left running. Also some apps may misbehave and cause additional drain if the optimized battery setting is selected. So use this with some caution. Try it. Then verify the effect of enabling it. Do you notice anything or does it just lead to slower app loading?

    Secondly, after the apps have been installed and opened up for the first time and simply used normally a type of quick optimize is done. It done fast and is light on resources. But it is not the best optimization.

    The Third level of optimization is the most time consuming one. It can take more time to complete and use a lot more CPU power than what anyone would be willing to do while on battery. So for obvious reasons this is done while on the charger. More specifically when connected and not being used long enough. This leads to an easy optimize. Simply leave it connected for an hour or 2 extra or overnight sometimes. Don’t worry about the phone reaching 100%, as the phone will stop the charging process when needed. The charge technique is designed to allow it safely. However, this can also be done manually, and you can keep whatever charging pattern you prefer.

    ”cmd package bg-dexopt-job” inside Adb shell.
    When this command is not really needed it will finish in about 2 minutes. If there is enough apps and a lot of undone work it could take an hour or similar. When finished it will say "Success".

    Adb unlocks various extra options and can be necessary for giving certain apps extra permissions. This also allows manual de-bloating for example. This means you can actually uninstall an app that does not offer an uninstall button, if you are sure you don't need it of course.


    What dexopt-job command does and further battery related info and much more can be found here.


    The battery usage.
    The first source of battery info is the built-in battery stats. You can see the individual and overall app drain and there is also the possibility to see full device drain (with items like screen drain and system drain included). It’s always good to know how it how your battery is performing here. This makes it a lot easier to notice an issue when it comes. Because suddenly you might see an app using twice or 3 times more with no apparent reason for it. Reasons for it can be many. An app update, app bug, corruption. Wipe the app cache, maybe even app data or temporary uninstall the app (I usually just wipe app data). If nothing helps, then reinstall an older app version or try out the beta version if available (and of course report the issue to the app dev and perhaps OnePlus depending of the nature of the issue).

    Sometimes you want more info and to dig around deeper. Here apps like BetterBatteryStats and GSam can provide some extra stats and widen your view of what is happening on the phone.

    You will find some info below about the 3rd party BetterBatteryStats app (available from the Google Play Store, see temporary notice in the bottom) and how to use it. You need to give extra permissions via Adb to allow all the necessary stats to be collected. BetterBatteryStats has all the commands in the app description on Play Store and inside the app. GSam has one single command shown within the app.


    GSam gives much of the same data but provides graphs and a pretty nice interface.

    ( https://play.google.com/store/apps/details?id=com.gsamlabs.bbm.pro )

    Please use that posted guide to discuss BetterBatteryStats specifics so we can gather more knowledge in the same spot.

    So what to do if drain is extreme and you can’t figure it out the cause of the drain?
    Does the system enter a deep sleep enough? Is an App or process keeping it awake a lot? Here the BetterBatteryStats guide can be helpful. The thing you might want to look at is the wakelocks. Some apps can be highly aggressive and the end result is a high amount of wakelocks. More information on what wakelocks are about is here and with info about how to deal with them. Just note that killing all wakelocks is not the solution. It could come with negative side-effects.

    In apps, for example, DevCheck do you see high CPU usage and elevated temperatures?
    Possibly massive Android OS or Android system drain?
    Here is another trick before resorting to a factory reset etc.

    ”top -m 10” in adb shell.

    This allows display of the top 10 CPU using processes. Any process using the CPU should be visible. The name, what it belongs to. Sometimes it can still be rather cryptic and might not be very easy to figure out despite Googling the name of the process. But it can lead to a solution or at least give you more details you can provide when you report the issue via a bug report.

    So other than having apps that consumes more and more system resource, what can you do? Web apps. Let’s take Office 365 as an example. Go to any computer with a fairly modern browser, log in and continue working with Word or Excel regardless of OS or the availability of an actual Office product. It’s the same thing with phones. More and more places offer an option to simply “install” the webpage as an icon directly in your app drawer. Twitter, Instagram, xe.com… they simply open up as full screen browser windows and are treated separately from the regular browsing. For example, are you using Twitter enough to warrant the full app or would the Webapp version be good enough?

    There is no clear answer or solution for your optimal battery life. “Do this and that and everything will be awesome”. Nope.
    It's more like “What does this setting do? What effect does turning a feature/setting off/on have for my usage? Any effects it may have, are they worth it or should I just leave it alone? What happens if I install an app and will it consume a lot of battery?
    This information here is designed to give you some help to find your own optimal settings for your own particular use and how to find and hopefully solve problems if they become an issue.

    Please do recommend more guides and information sources below.

    A description of your own tweaking and settings that works the best for you can also be interesting and good to share here.

    Notice: Betterbatterystats is currently unavailable at Play Store but the dev is working on it. Official XDA thread and help sections with test builds and older XDA version of the app exists HERE. Direct link to the post about why it's not on Play Store HERE.
    For simplicity of automatic updates and supporting the dev by buying the app, check every now and then for the app coming back to Play Store.
    If anyone here notice it before me, let me know! :)
    Last edited: Jun 25, 2021

  2. erinjacob87
    Donut Apr 3, 2021

    erinjacob87 , via OnePlus 7T Pro , Apr 3, 2021 :
    Thanks for the detailed post!

    My battery issue started after my Oneplus 7Tpro got upgraded to Android 11 last week.

    Tried leaving it on the charger overnight every other night and nothing really changed.
    I also tried the adb command to force the optimization which took around an hour or so to finish. It seemed better for a while but pretty soon(less than 24hours later) went back to being terrible.

    I enabled detailed stats on GSAM. Its always Oneplus system that seems to take the lead on my worst performing apps(Both background CPU and otherwise). Any clues you can see in my screen shot for what meet be going on?

  3. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 3, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 3, 2021 :
    How much percentage does it drain?
    Here is my stats of today on a 9 Pro.



    Android OS and System can be tricky. Stuff that happens behind them can be the cause of work windows for various activity or in some cases a buggy child process. Sometimes the command "top -m 10" can give some insight into the background activity.
    Know a user that found an aggressive child process eating 100% of a CPU core all the time... All I could find about that process was that it was involved in crash dumps or similar. What triggered it remains a mystery though. I guess he ended up wiping the phone to solve it.
    I also have a feeling that the first Android 11 version needs a few bug fix releases to mature a little.

  4. Aaron2017
    General Support Expert Award 2021 Apr 6, 2021

    Aaron2017 , Apr 6, 2021 :
    Some great info mate! I've saved it so i can share it with other people who face battery issues, they can benefit a lot from knowing all of this.

  5. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 6, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 6, 2021 :
    Thanks. Feel free to spread it as much as you want. The more people know the better they can understand their own problems and possible fix them. Even if something can't be solved by the user at least it might result in more details in bug rapports. Win-win for both user and Oneplus.

  6. Aaron2017
    General Support Expert Award 2021 Apr 6, 2021

    Aaron2017 , Apr 6, 2021 :
    Indeed, people just post these issues thinking it's because of an update and leave it at that. And while that's certainly true sometimes, i find in a lot of cases it can be solved by the users themselves, it's just hard to find the causes sometimes. This should defenitely help with that, or as you say, make for better detailed bug reports. Right, i've hogged enough of this thread, i'll leave it for the people with real issues or tips that might help.🙂

  7. Luis62
    Gingerbread Apr 17, 2021

    Luis62 , Apr 17, 2021 :
    Perfect Thank you
    The big problem today is charging our "op9 pro" into Wireless Charger that we were presented when buying the mobile, every time, after charged I can read this :the health status of the battery becomes overheated.... WHY?
    APK AID64

    scryptic likes this.
  8. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 17, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 17, 2021 :
    Sure it's only then? And not just the apps incorrectly giving the warning?
    All apps seems to give faulty warnings due to a system error. Toggling reverse charging on/off may get the warning removed unless you have an actual overheat.
    What are your actual temps when charging?

    scryptic likes this.
  9. Luis62
    Gingerbread Apr 17, 2021

    Luis62 , via OnePlus 9 Pro , Apr 17, 2021 :
    31 C° degrees

  10. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 17, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 17, 2021 :
    That would not be a reason for an actual overheat warning. You probably have the firmware bug that tosses put a false warning.
    The app Ampere even said my battery was overheated at 12.2°C 😉
    If you have an app saying it's overheated toggle reverse charging on/off and it probably goes away until next reboot

  11. Luis62
    Gingerbread Apr 17, 2021

    Luis62 , via OnePlus 9 Pro , Apr 17, 2021 :
    Ok thanks for help

    Swejuggalo likes this.
  12. b_chudasama
    Donut Apr 22, 2021

    b_chudasama , via OnePlus 9 Pro , Apr 22, 2021 :
    I'm using the same apps I was with my op6. My charging temperatures are hitting 42c - 45c. With brightness half way I can use the phone maximum 30 mins before it gets unbearably hot

  13. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 22, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 22, 2021 :
    Really strange. How is your CPU usage?
    View attachment 1597858
    High activity = hotter phone and higher drain

  14. b_chudasama
    Donut Apr 22, 2021

  15. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 22, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 22, 2021 :
    Something seems to use your CPU rather aggressively. There should be traces of it in the battery stats that can explain it.
    You could also set up adb and type "top -m 10" in adb shell to view the processes using the CPU.

    b_chudasama likes this.
  16. b_chudasama
    Donut Apr 22, 2021

    b_chudasama , via OnePlus 9 Pro , Apr 22, 2021 :
    Thanks I'll give it a try. So I just did the update and overheating issue seems to have been fixed. While charging it was at 36 which dropped it by 10c, surprisingly though at 36c my battery status says overheating. Weird. I'm going to use the phone as much as I can and see how battery life is and do tasks just like normal. Hoping for the best.
    As for CPU, seems to be fine after update, it still fluctuates a little and goes high but doesn't stay high like before.


    Swejuggalo likes this.
  17. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 22, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 22, 2021 :
    Great. It can calm down once the update has settled in some. Some activity is always normal. There are after all a lot of background process running. We just need to look out for the misbehaving ones.
    BTW. That overheat warning is a false warning.
    A little trick.
    Only thing I do now is to toggle reverse charging on and off.
    Suddenly system stops reporting overheat.

    b_chudasama likes this.
  18. b_chudasama
    Donut Apr 23, 2021

    b_chudasama , via OnePlus 9 Pro , Apr 23, 2021 :
    Hey guys, just a quick update. I've used the phone pretty much all day without overheating issues and good battery life. I'm happy with the update fix and I hope it remains this way. Phone is not hot to the touch and I can hold it for longer periods. Battery is at steady 32°C - 35°c in Fr check however its stating that it's overheating. Not too worried about it though.

    Thank you all for your help and knowledge

    Swejuggalo likes this.
  19. subboxcb
    Eclair Apr 23, 2021

    subboxcb , via OnePlus 9 Pro , Apr 23, 2021 :
    Is it possible to gain more battery drain if I had done the app and data migration from my old phone (Xiaomi) to OP9pro via OnePlus Switch app? Or It would be better for me and the battery issues if I would do a clean setup without transfer?

  20. Swejuggalo
    OnePlus 9 Series Expert Community Expert Apr 23, 2021

    Swejuggalo , via OnePlus 9 Pro Stellar Black , Apr 23, 2021 :
    I always do clean installs. Even ignore "previous device" transfer during the Google setup.
    Some cases has happened where strange things basically seems linked to a transfer.
    One person from a Xiaomi got random reboots and stuff. He manually removed some Xiaomi stuff that had been transferred. It stopped rebooting randomly.
    So I'm not really that fond of transfers. Great when it works but if it means risking issues you might spend more time on fixing problems than what a clean install may have taken you.
    I just copy back a few files manually. That is it.
    Edit: it was a Huawei in that case
    Last edited: Apr 23, 2021

    ghostofcain likes this.