yashsingh1/xdaforums huggingface dataset:
[BetterBatteryStats] downloaderfan:
Hi, need your help, BBS Community. I have an Asus Zenfone Max Pro M1 with stock Oreo ROM. Until 2 weeks ago, it was rooted. But an increasing number of apps were using different ways to detect root even with magisk, I got frustrated and uninstalled Magisk. Now I have non rooted stock ROM with bootloader unlocked. Ever since I did this, my battery has been draining ~ 10 % / hour even when phone is not being used. I'm unable to figure out what is causing this or how to fix this. Please check the logs, folks. Just to summarise, I unplugged my phone at night with 100% battery and saved the logs immediately in the morning. Battery went from 100 to 56% with no usage, that's how bad it is. Couldn't generate dmesg file since it says permission denied for some reason.
[BetterBatteryStats] TNSMANI:
It is not a good practice to start the dump at 100%. Either charge it to about 85% and start the dump or if it is already beyond 85%, use the phone till it reaches about 85% and then start the dump. The starting point can even be less than 85% but not more than that.

The present dump is a little confusing. Was your wifi on and connected? Was your mobile data on? How old is the battery? How is the mobile signal at your place?

Location/scanning was on and some apps like Jio, Swiggy etc caused some drain. But these are not the reasons for your huge drain.

Please answer the questions in the first para. Depending on that, you may either require a new battery or a factory reset or a clean flash of the ROM.
[BetterBatteryStats] downloaderfan:
WiFi, Mobile Data & Bluetooth were Off. Mobile Signal usually has no issues as I live in a metropolitan area.

Battery is slightly lesser than 3 years old, but I doubt that is the issue and this suddenly started after I uninstalled Magisk. I was hoping someone could pinpoint the issue using above stats, so that I don't have to reflash and resetup the entire ROM which would take many days for me.
[BetterBatteryStats] TNSMANI:
Surprising. There were background downloads by many apps via mobile data & wifi. Plus some alarms are shown with a minus (-) sign in front of them. I have not come across such minus signs before. So obviously it requires a clean flash. I think that you merely uninstalled Magisk and did not do a clean flash while removing Magisk. That may be the cause.
[BetterBatteryStats] DiamondJohn:
before you go and flash stock and re-setup everything, check that your phone is getting into deep idle, without too much delay. Check your doze cycle.
[BetterBatteryStats] downloaderfan:
How can I go about doing that? The logs I've shared show that my phone was in deep sleep for 93.4% of the time. Doze Idle Mode Time is also 98%.
[BetterBatteryStats] downloaderfan:
Honestly folks, I wouldn't mind flashing stock and re-setting everything if android had a good non root solution to backup app data. When I look for non root ways to backup app data, I come across the adb backup method which is highly unreliable and not officially supported as a backup solution. Many apps simply prevent adb backup while in others restoring the backup would have no effect. This means, if I have 50 apps, I have to manually export app data by opening each app, save it to external storage & then load all that again by opening each app, assuming they support exporting app data in the first place. This takes a colossal amount of time. In the Windows world, I can simply open up a software like EaseUS Todo Backup and backup my entire installation into a hard drive with 3 clicks and restore just as easily.

Google also backups up app data, but again, app developers need to integrate the functionality meaningfully into their applications so that Google can reliably back up and update the app data, so it's not 100% reliable.
[BetterBatteryStats] DiamondJohn:
In the app TeMeFI that I built (and described in this thread already) has a number of features to help diagnose battery issues. Including the doze cycle graph.

And the battery discharge rate over time

There have also been around 100 new graphs added recently, including WiFi signal, Phone signal, Volt, Wake Reason, Wake Up App, Job etc etc etc

See as previous release notes for a list

NB: This app does NOT run in the background to collect data. All the data is garnered from reports / data already collected by android by default. And it can run on historical data, and even be used on data before it was even installed. eg run device over night, install TeMeFI in the morning, then run the reports, after the fact. The battery histiory actually can be run over / through reboots; if you do not reset battery statistics or charge over 90%, which also wipes battery history. However, android resets the doze history on every reboot.

Oh, you have to be rooted.
[BetterBatteryStats] DiamondJohn:
Almost forgot. Your phone may show that it is in "Doze Idle Mode", but there are TWO idle modes, deep & light. Obviously deep is much much better. And "Deep sleep" is NOT "Deep idle". In the above graphs, visually, the blue is light idle, the green is deep idle. When my phone went into deep idle, I would get discharge rates <1%

Also, a while back, when I actually used BBS, my results were looking reasonably good, and people were telling me that I should be happy with what I have, considering the age of my device. However, I found that although it went to idle, it was waking into maintenance periods waaaay to often. So although it was in idle (cant remember if it was deep or light), there were maintenance periods every 5 minutes or so, which allowed battery consuming processes to run.
[BetterBatteryStats] chosenone1:
Can anyone help with my dump. I'm unable to identify battery drain issue. Overnight log with no phone usage
[BetterBatteryStats] chosenone1:
Another dump from tonight
[BetterBatteryStats] TNSMANI:
@chosenone1

With regard to your first dump, the screen on time is more than a minute. It has to be in seconds, preferably as less as possible. Please save the dump as soon as you unlock the phone.

Your wifi seems to have a major issue. Do you have any other devices, especially printers, connected to your router? Switch off all other devices before taking the next dump. Also reset the router by switching it off for >10 seconds and then switching it back on.

Location/scanning seems to be on. Do you require it while sleeping?

There are other alarms/wakelocks too but I am not sure whether they happened during sleep or after the screen was unlocked, given the high screen on time. This applies also to the downloads/uploads of the order of 500 MB.

Regarding your second dump, it is almost the same as the first one. So the observations above apply equally.

Please post a proper dump so that a proper analysis can be done.
[BetterBatteryStats] djyahoo:
Hi @chamonix , thank you for maintaining this app and for letting us being informed about its life :)

I am not yet a user of betterbatterystats (I'm just here thanks to "Francisco Franco Kernel Manager" app, in which an advise to use betterbatterystats appears in the battery tips menu :) ). I am looking forward expermimenting betterbatterystats, so I would like to know if you have got an idea about the time it could take to find betterbatterystats on the Google Play store again ? In other word, shall we have to wait for days/weeks/months (or even for lifetime if ever the patch would be more complicated to do than what you thought on 2021-06-13 :) ) ?

Of course I could use the xda version, but for security concerns I would better prefer install it from Play store :)

Thank you ! Have a good day,
[BetterBatteryStats] krkhaha:
Hi guy's. Why I can't use dark mode in last release? I can't see that option in setting
[BetterBatteryStats] KeinePanik:
Scroll down in settings and open "advanced". There you can change the theme.
[BetterBatteryStats] krkhaha:
Yes. I'm so blind hehe. Thank you.
[BetterBatteryStats] Oswald Boelcke:
That's the correct path to set the theme; however, as reported here (or also in Github) on 2021-06-01 dark theme is not working on v2.6
[BetterBatteryStats] KeinePanik:
Well, as long as dark theme is generally set in system settings, it does work for bbs too. But off course, that's not the way it's supposed to be.
[BetterBatteryStats] Oswald Boelcke:
Thanks very much. I didn't know that but it's good and important to know; maybe also for other users. Personally, I use a substratum theme and I'm convinced therefore it isn't working. However, it was prior to v2.6 but I can easily live with it as I probably open BBS only once every 3 - 5 days for a few seconds.
[BetterBatteryStats] chosenone1:
Actually both dumps were taken right after unlocking phone in morning. The screen on time is probably due to alarm clock. I have two alarms in early morning which I mostly miss so probably it kept ringing until alarm timer expired.

I'll take another one tonight with alarm off.

Regarding router nothing is connected except for laptops and mobiles. At night only mobile phones are connected, nothing else.
[BetterBatteryStats] Zer0_rulz:
why i cant find this app on playstore?, has any1 have a link on it or the app got removed in playstore?
[BetterBatteryStats] Lughnasadh:
Read the 2nd post.
[BetterBatteryStats] chosenone1:
Please find attached last night's dump without any phone usage. Router was also reset.
[BetterBatteryStats] Oswald Boelcke:
The announced attachment is missing.
[BetterBatteryStats] chosenone1:
I don't know how that happened when I had it attached, anyways here it is attached again
[BetterBatteryStats] Oswald Boelcke:
It's still missing. Please be aware that for whatever reasons XDA occasionally doesn't upload txt-files from BBS. Syntax errors or whatever, I don't know. Consider to zip your idle dump and to upload the zip, or use something like https://hastebin.com/about.md and share the link,
[BetterBatteryStats] chosenone1:
Attached. Seems like my attachments are missing after posting.
[BetterBatteryStats] Oswald Boelcke:
See my post above, please. I guess we posted at the same time.
[BetterBatteryStats] chosenone1:
Umm, I had uploaded zip file with my previous post. Is it not visible? I can see it
[BetterBatteryStats] Oswald Boelcke:
Affirmative. It's now available. Thanks a lot. I'm going to have a look as soon as time allows but I assume that e.g. @TNSMANI will be much faster than me.
[BetterBatteryStats] TNSMANI:
Awake screen off is nearly 2 hours.

Mobile signal seems to be not very good. There is no record of the mobile signal for nearly the whole time except for about 7 seconds. I don't know why BBS did not record the full signal history.

Once again wifi was having issues and causing kernel wakelocks. Were the other devices disconnected from wifi?

IMS Service caused wakelocks and alarms for nearly half an hour. Android system was trying for more than 2 hours to shut down everything for sleep.

You didn't answer my query about location/scanning. Geofencelocation service was also setting off alarms.

Other apps also contributed for the drain but they were not alarming.

I think a clean flash is the solution. You can also try another dump before that with everything like wifi, data, location etc. shut off so that we can establish a baseline for the drain below which you can not go with the present setup. You can also try another dump with a different wifi router, if possible or in a different place (with another router).
[BetterBatteryStats] chosenone1:
Hmm, on notification bar, usually it shows full strength for mobile signals.

Only mobile phones are connected with wifi, and this dump was taken after resetting router.

I'll take another dump tonight with wifi data and location off. Would that be helpful or should I keep wifi on and connect with another router?
[BetterBatteryStats] DiamondJohn:
Another option to check is using the "Battery History Extras" graphs on my app TeMeFI

You can find the graphs under Currently Running>Battery>Battery History Extras>Battery History Extras>AUTO-WIDTHx4>Graph Of Mapped Values [MAP]>No Aggregation>*

There are graphs for WiFI Signal Strength, Connection, Device Idle State, Phone Signal Strength and many more.

The app does not run in the background, so will not affect your BBS stats, it uses/scrapes the standard battery history textural report, which is always available already from android. So you run it anytime after, as long as you dont reset your battery history by charging above 90% or manually issuing a reset.

Attached is one I just ran on my phone. You can see my reboots, and also when I strayed away from home; but only for food so COVID safe.... we are in double secret lockdown.
[BetterBatteryStats] TNSMANI:
I would advice both ie. a dump with everything off and another with a different router, for comparison.
[BetterBatteryStats] fabiovilan:
Is there a way to disable the widget updates wakelocks in BBS ? Looking at Partial Wakelock I get THOUSANDS of wakelocks by BBS itself for updating widgets (BTW, I don´t use any BBS widgets):

job/com.asksven.betterbatterystats_xdaedition/com.asksven.betterbatterystats.services.UpdateTextWidgetService

job/com.asksven.betterbatterystats_xdaedition/com.asksven.betterbatterystats.services.UpdateWidgetService

Other than that, Kernel Wakelocks and Sensors are not working. I'm using version 2.6-382 (latest) in Samsung Galaxy Note10+ (N975F) running latest Android 11. Yes, I have enabled all options with ADB, ihcluding the latest one needed for android 11.
[BetterBatteryStats] Enddo:
was the app removed from the play store?
[BetterBatteryStats] Lughnasadh:
Please read Post #2.
[BetterBatteryStats] swapyworld:
Hi, attached here is an overnight log of 7.5 hrs. Battery drooped more than 15%. Please help me identify the reason.
[BetterBatteryStats] TNSMANI:
Mobile signal is a major issue. Doesn't seem to be good at wherever the phone was during sleep. That is usually a major drainer. Coupled with that, your wifi was switched off and phone was on mobile data. With the poor signal, background downloads/uploads via mobile data aggravated the drain.

Location/scanning seems to be on. Do you require it during sleep?

See whether you can control these.

These are all I can find and of them, the mobile signal issue is more serious. Take another dump at a place where you have a better signal. And start the dump from around 85% battery, not from 100%.
[BetterBatteryStats] swapyworld:
Thanks for the reply mate.

Actually i had been on PE plus (Android 9) and recently shifted to Carbon rom (Android 10) official. It's been 2 weeks almost now, since flashing the rom. It was clean install (including data wipe). However, battery life dropped considerably. When i check, it it points out to 'Google play games'. (Line 237 and 270 of BetterBatteryStats-2021-07-30_095547070.txt). That's what i see in graphs inside apps in alarms section.

I flashed flamegaops basic as suggested by OP. could that be an issue? Possible to check again?

Location and scanning (Wifi and Bluetooth) both were off. Only mobile data was on.
[BetterBatteryStats] swapyworld:
Another report with Mobile data off and from 85% battery. Drop was approximately 0.7%/hr. But please check in alarms section. It's again Google Play games!! Request to review and guide.
[BetterBatteryStats] chosenone1:
Attached two dumps, one with good network and one with networks off (wifi data location). Please have a look.
[BetterBatteryStats] TNSMANI:
There may be two reasons for the drop in drain: one, the switching off of mobile data and the starting point of the dump being 85% instead of 100%.

There are still indications of Location/scanning being on. Switch them on and then off.

These alarms also contributed to the drain:

Since I am using a laptop, I don't get line numbers in the dump. Can you please copy/paste the actual lines in your next post?

If you can find a place with a better signal and a solution for the Location/scanning and the two apps noted above, your issues may be sorted out.
[BetterBatteryStats] TNSMANI:
By good network, do you mean wifi or mobile data? The dump with wifi on still has issues with wifi. And all the other observations made earlier hold good for this dump also. The major difference I see is in mobile signal strength. It was better for about one third of the time now. The Geofence Location alarms were firing at will so please check again. Your wifi router is not alright because the background uploads/downloads happened on mobile data also. It is an indication the your wifi connection is not constant.

The dump with everything off shows a better mobile signal for nearly half the time. The drain is 0.5% per hour so, your drain rate with dala, wifi etc enabled cannot go below that with the current setup. Here also the Geofence thing stands out.

In conclusion I would again say that you may have no other option than to clean flash. May be before that take another dump with a different router.
[BetterBatteryStats] chosenone1:
Yes, it was on wifi. I reset the wifi settings. I'll take another dump with a different router. Is it possible to identify any application that may be misbehaving?
[BetterBatteryStats] ppell:
Hello,

I try to get some logs, but whenever I save logcat or dumbfile the .txt are completely empty.

What am I doing wrong?
[BetterBatteryStats] chosenone1:
Here's another dump with a different wifi. I think there's not much difference.
[BetterBatteryStats] TNSMANI:
This time, the wifi is constant, no drop offs. Other than that, there is no other improvement. Mobile signal was also better this time.

Regarding apps, I had already listed those that cause drain, chief among them being IMSservice. No different now.

So your wifi issue is not due to your router. It must be the kernel because it causes kernel wakelocks. You seem to have exhausted all other options except for a clean flash. Or may be a different ROM with a clean flash.
[BetterBatteryStats] chosenone1:
Hmm, I was hoping I wouldn't have to do a reset but it seems there's no other way. I had already reset data / cache for all IMS related apps but it didn't help.

I am suspecting outlook might be causing issues. I'll try uninstalling it
[BetterBatteryStats] swapyworld:
I had myself check... Even emergency scanning and google location accuracy was turned off. Please refer to log mentioned below from 'Alarm' section.

Spoiler content hidden.
[BetterBatteryStats] TNSMANI:
android.gms is what I think you mean. GMS here doesn't mean games. It refers to Google Mobile Services. Please check THIS. This was one of the reasons for my earlier comment about the mobile signal not being very good.
[BetterBatteryStats] ppell:
Anybody here who can help me with this?

I got overnight idle drain of more than 1% per hour. Sometimes up to 15-20% over night.

I want to figure out what causes the drain. But to be honest i don´t know how to read (and understand) the stats properly to figure out what causes the drain.

Hope you guys can help me out.

Thanks
[BetterBatteryStats] Huebabbel:
I got a "batteryinfo service could not be contacted" toast when accessing raw data. Wakelock data is also not being displayed. This occurs for me with BBS 2.6.382 and 2.6.378 on a rooted (Magisk) custom Android 11 ROM.

Version 2.5.341 works fine though. I have not tested other versions.

Here are the relevant log snippets for the cause of the issue (and enough for others to find this posting :))

[33293.102384] (2)[579:logd.auditd]type=1400 audit(1628058498.230:1867752): avc: denied { read } for comm="sh" name="/" dev="dm-0" ino=2 scontext=u:r:untrusted_app_29:s0:c154,c257,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=1 app=com.asksven.betterbatterystats_xdaedition
[33293.104859] (1)[579:logd.auditd]type=1400 audit(1628058498.230:1867753): avc: denied { open } for comm="sh" path="/" dev="dm-0" ino=2 scontext=u:r:untrusted_app_29:s0:c154,c257,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=1 app=com.asksven.betterbatterystats_xdaedition

08-04 08:29:52.975 W/tats_xdaeditio(15906): Accessing hidden method Lcom/android/internal/app/IBatteryStats;->getStatisticsStream()Landroid/os/ParcelFileDescriptor; (greylist-max-o, reflection, denied)
08-04 08:29:52.975 E/BatteryStatsProxy(15906): An exception occured in BatteryStatsProxy(). Message: com.android.internal.app.IBatteryStats.getStatisticsStream [boolean]
08-04 08:29:52.975 I/BatteryStatsProxy(15906): invoking android.os.ServiceManager.getService("batterystats")
08-04 08:29:53.162 E/JavaBinder(15906): !!! FAILED BINDER TRANSACTION !!! (parcel size = 96)
08-04 08:29:53.163 E/BatteryStatsProxy(15906): An exception occured in BatteryStatsProxy(). Message: Transaction failed on small parcel; remote process probably died

I did not install BBS as system app, as the documentation states that this is no longer required. Also I did not add any permissions via ADB, as this is just for non-rooted phones according to the documentation.

Since it complains about "/" access I checked that it is listed as root app in Magisk. I then deleted the entry for testing and restarted BBS, but it did not request root again. Reinstalling helped with that, but the error above kept occurring.

There is an issue on GitHub with a similar error message (but no kernel log).

Well, at least a fairly recent version works. Yet it would of course be great if the most recent versions would also work correctly.
[BetterBatteryStats] TNSMANI:
Please check your BBS version. Ver 2.5.341 is the one that works with all recent versions of Android especially Android 11.
[BetterBatteryStats] Aadhith:
My phone's screen stays awake the whole time it never goes into deepsleep but instead it goes into doze idle mode. Funny thing is i have zero overnight drain. I can't seem to gather much from it apart from a wakelock named : AnyMotionDetector, that constantly checks my phone for any movement, Maybe you folks can help me out.
[BetterBatteryStats] TNSMANI:
There are many discrepancies in the dump and images. They don't coincide. The screen on time for the dump should be in seconds whereas it is 1+ minutes. The images say from Unplugged to Screen off whereas the dump says Unplugged to Current. Wifi and mobile data seem to be off, was it in airplane mode? Then the low drain is understandable.

When you say that the screen was on the whole time, do you mean that Ambient Display was on? Because BBS doesn't seem to recognise that screen was on the whole time.

Please read the first few posts of this thread and post another dump according to it. The dump should start at around 85% or thereabouts and should be saved as soon as you unlock the screen. Images may not be required.
[BetterBatteryStats] Aadhith:
Will post a new dump tomorrow adhering to the standards. Should i let mobile data and Wifi on the whole time? I turned off both mobile data and wifi for this dump.

By screen on i meant Awake(Screen off), I turned off both AOD and Ambient display.
[BetterBatteryStats] TNSMANI:
OK.

For the next dump, please let both wifi and mobile data be on. Location/scanning to be off.
[BetterBatteryStats] Aadhith:
Here's the new dump with wifi and mobile data on. I had a 0.7% drain per hour compared to yesterdays 0.1% when both data and wifi was turned off, Phone never went into deep sleep both times.
[BetterBatteryStats] tomatus270389:
I'm having a problem were everything except for CPU States and Alarms show this: No stats have been collected yet.

I see that under settings, advanced, app permissions it show an error message: STATUS: Failed: Transaction failed on small parcel; remote process probably died

What could be going on?

Main thread: https://xdaforums.com/t/betterbatterystats-cant-collect-most-of-the-stats-status-failed.4315889/