yashsingh1/xdaforums huggingface dataset:
[BetterBatteryStats] mag01:
Yes I get what's going on in that part. So as it's either root missing (definitely not the case) or inability to get the Alarms stats as root I did some more tests and I think it's the latter.

11-21 23:42:17.515 17540 18892 I StatsProvider: Trace: Calling root operations2014-11-21 23:42:17
11-21 23:42:18.258 178 178 W servicemanager: type=1400 audit(0.0:5697): avc: denied { search } for name="19221" dev="proc" ino=137482 scontext=u:r:servicemanager:s0 tcontext=u:r:init:s0 tclass=dir
11-21 23:42:18.268 178 178 E ServiceManager: SELinux: getpidcon(pid=19221) failed to retrieve pid context.
11-21 23:42:18.268 178 178 E ServiceManager: find_service('alarm') uid=0 - PERMISSION DENIED
11-21 23:42:18.337 17540 18892 I StatsProvider: Accessing Alarms in API mode
11-21 23:42:18.342 17540 18892 I StatsProvider: Trace: Finished root operations2014-11-21 23:42:18

This is with SuperSU 2.22 to which I rolled back yesterday to test SELinux policy restrictions with few apps. Since 2.23 the situation is more relaxed so that's probably why it happens to me now at 2.22. With 2.22, 'dumpsys alarm' doesn't succeed as it would have to be executed from within the 'u:r:untrusted_app:s0' context (at least).

So normally (at Android 5.0) you'd need to call it like:

su --context u:r:untrusted_app:s0 "dumpsys alarm"

With later SuperSU it succeeds because Chainfire has done some additional hacks, but with more strict 2.22 it doesn't.

As for kernel wakelocks, I think one problem is here:

package com.asksven.android.common.kernelutils;

public class WakeupSources extends Wakelocks

public static boolean fileExists()

starting at line 214:

if (exists)
{
try
{
fr.close();
}
catch (IOException e)
{
// do nothing
}
}

Where you'd need to test the fr for null before attempting to close it.

EDIT: Simply instead of testing "if (exists)", test "if (fr != null)".

That's because if the reader instantiation fails (at line 196, due to SELinux policy - here it's executed directly from the app so it's within context u:r:untrusted_app:s0 but it would have to be u:r:init:s0 (SuperSU default) or u:r:shell:s0) and you fall back to su attempt, the fr is just null in this case so attempting to close it throws NPE which is not handled anywhere.
[BetterBatteryStats] chamonix:
Timebox was up and I didn't want to keep the kernel wakelocks on lolipop from you longer so here you go, that's what I could sqeeze out :)

I have added primitive preferences for font size and icon size. Please feel free to report what whorks best for you with screenshots, values and screen density.

I don't know if those prefs will stay so for now no need to translate.
[BetterBatteryStats] chamonix:
This is rather a beauty thing but not related to the kernel wakelocks not working (the catch just makes sure that if the file could not be opened for any reason the close does not throw an exception higher).
[BetterBatteryStats] mdamaged:
chamonix, you have been very active lately, you're a good man, you should take a break before you burn out!
[BetterBatteryStats] mag01:
Well, that may be true (I didn't check the whole code path if that NPE doesn't really tear things apart in the calling block), but kernel wakelocks still don't work for me properly :( - see attached logs for both modes. Raw stats show data for both modes so the issue doesn't seem to be in obtaining these stats or in their parsing.

Getting rid of that NPE is easy (and there's really no need to test for "exists" when you put there test for "fr != null" which is the right one at that place as the following operation is going to be performed on the fr object)

Also one thing that's perhaps strange is that it tries to read /sys/kernel/debug/wakeup_sources even if kernel wakelocks are forced via API.

And some more to translate :D

package com.asksven.betterbatterystats;

public class PermissionsFragmentActivity extends BaseActivity

dialog.setTitle("Legend"); -- use label_title here

package com.asksven.betterbatterystats;

public class FirstLaunch

.setTitle("Welcome to " + ctx.getString(R.string.app_name)) -- this: "Welcome to "

res/xml/preferences.xml

android:title="Thumbnail Size" />

android:title="Medium Font Size" />
[BetterBatteryStats] CM17X:
I don't know if it has being reported, but, on Android 5 Lollipop and rooted, i can't install BBS as a System App. Root app is working and i can set permissions to other apps, but trying this i get "Failed" notification. Any advice?
[BetterBatteryStats] RASTAVIPER:
Don't agree.

It's working fine art my rooted Nexus 4 with stock Lollipop 5.0.

Unleashed by my Nexus 4
[BetterBatteryStats] jukyO:
Works for me on CM12 for i9195.

Try with supersu.

Or, move apk to /system/priv-app from /data/app.

From recovery.
[BetterBatteryStats] CM17X:
Glad to know is working, then i have something wrong with my root. Goota check. Thanks man.
[BetterBatteryStats] efattal:
Hi everyone,

Is someone able to explain what is going on with my OnePlus One with Mahdi ROM please? I don't understand why the drain is 2.2%/h since the cpu is sleeping 99% of time. Thanks for helping.

https://docs.google.com/file/d/0B8g71puoe1DeVE16OG5RWS1lalE/edit?usp=docslist_api

Sent from my 1+1 (Mahdi ROM, Philz recovery, AK kernel/UKM, PA Gapps pico, SuperSU)
[BetterBatteryStats] hzmenxd:
Thanks a lot, I succesfully bought your app 1 week ago and the prize really worth it. Keep working hard, I appreciate so much bro!
[BetterBatteryStats] gaich:
A small mistake with App Opps button here:

And some thoughts about other strings to translate - #569

The 6th Beta was unexpected, I even did not manage to translate its changelog, sorry...:p
[BetterBatteryStats] chamonix:
Thanks.

Yea sorry for the quick release but I wanted to get it out in order to get feedback about the kernel wakelocks. I am glad I did as there was yet another issue, that is fixed now. I will probably be releasing the next beta this evening, pushing changes reglarly meanwhile
[BetterBatteryStats] SagiGo:
Here is an attached dump file , Thank you for your analysis :)
[BetterBatteryStats] Karpfenhai:
[MENTION=1330150]chamonix[/MENTION], thx Sven that's brilliant :)

I guess you were in hurry but it looks promising !

The don't size within the circle doesn't match yet plus circle thickness is still to much.

The icons aren't in line (no space between then and the text)

I'm looking forward to b7.

Thank you mate!
[BetterBatteryStats] marknoll:
Noticed finity on wl
[BetterBatteryStats] cmd512:
Apologies if this has already been reported, but still getting the kernel error on my Note 4 with the latest B6. I've also tried enabling the api option, same error. Cheers!
[BetterBatteryStats] chamonix:
raw is working in b6, normal stats are coming with b7.
[BetterBatteryStats] cmd512:
Yes sir, raw is confirmed working, thanks!
[BetterBatteryStats] marknoll:
What's this mean?
[BetterBatteryStats] gaich:
[MENTION=1330150]chamonix[/MENTION]

As the in-app help was removed and cannot be translated, I cloned your Project better page to Google docs and translated it.

I just suggest to place the link to Russian translation (and I hope, other translations later) somewhere near the Project better title, when a user presses help in the app, he goes to the English help page, but he could choose other language, pressing the link.

That`s like SDMaid developer did, for the instance.
[BetterBatteryStats] chamonix:
B7 is finished and all files have been uploaded. Please update all translations and submit the pull requests so that I can build this afternoon.
[BetterBatteryStats] SagiGo:
Can you guys check my dump file ?

Need to your help to diagnose my phone battery drain.

There is a difference between alleged time of being awake and screen on I believe that is a good starting point.

Thank you very much.

Thanks.
[BetterBatteryStats] Karpfenhai:
Hmm, you didn't get an answer yet?

Looks like you did something wrong, it's recommended to perform a straight idle reading.

Regards
[BetterBatteryStats] chamonix:
2.0B7 is up with quite a lot of changes.

Bfore you test the workaround for accessing dumpsys alarms on Lolipop please be warned: on my device with SuperSU 2.2 it slows down every refresh by about 30s due to the su --context call being really slow. So please test with care and report your experience back by telling how performance was and tell me the SuperSU version you have were using.

The backlog shinks and the next version will most probably be an RC!
[BetterBatteryStats] seky2205:
I have just uploaded translations :S
[BetterBatteryStats] mag01:
[MENTION=1330150]chamonix[/MENTION]

Quick response to 2b7:

- kernel wakelocks now work in both modes, good

- however API and native modes produce very different results. Raw stats are (more or less) similar, but processed ones differ significantly, see attached screenshots and logs

- similar issue affects alarms which I already reported not a long ago, I think they're both affected by the same issue - EDIT: I think the problem is related to switching these modes after reference has been set in the other mode. Then after switching mode, the results are incorrect until a new reference is created in the new mode.

- in advanced settings the following 3 items should be perhaps reordered to have both API mode options next to each other, now they appear in the following order: Alarms using API, Use su --context, Kernel Wakelocks using API

- translations - didn't you forget about these 3 places? ;) http://xdaforums.com/showpost.php?p=56949728&postcount=26654
[BetterBatteryStats] chamonix:
It makes perfectly sense that the stats are off when switching modes: the labels are the keys and they change when changing settings. I will see if this changes anythign about that: #583

About the prefs: ack, #584

About the strings: sorry, I guess I overlooked them: #582

I am curious if you can see any improvement in su --context if you are using a more recent supersu version (beta)
[BetterBatteryStats] chamonix:
Thanks for your efforts!

Can you please update your pull request? the one I have still contains arrays.xml

And no worries, RC1 will come soon, I have a long train trip tomorrow ;)
[BetterBatteryStats] mag01:
With SuperSU 2.27 it's quick. I'll test with older 2.22 (last one before Chainfire's 1st set of major changes) later - it wil lrequire reflashing the whole system partition (otherwise it doesn't even boot after downgrade).

By the way, graph screen scrolls much better now, though generating graphs can still take quite a long time.
[BetterBatteryStats] seky2205:
I thought i did it.. I'm sorry if I'm doing something wrong but this is my first time using github.. I'll upload picture of changes.. Tell me what to do if that is not good
[BetterBatteryStats] pikachukaki:
How I can reduce those two alarms... And how much power an alarm is using?
[BetterBatteryStats] mag01:
[MENTION=1330150]chamonix[/MENTION]

Alright, with SuperSU 2.22 it's really, really slow. But it's strange, because when I execute something from terminal using the context param, it isn't that slow at all. And for example Autostarts (source at https://github.com/miracle2k/android-autostarts ) which added the context recently as well, is still very quick. They always do it in a separate thread though.

EDIT: Based on the SuperSU log, you seem to be executing "su --context u:r:untrusted_app:s0 -c 'dumpsys alarm' within already existing root shell (see attached	L14167723060000.GRANTED.com.asksven.betterbatterystats_xdaedition.txt - open it as text file). Couldn't this nesting be a problem in your code? For example that then you don't exit from it cleanly and instead are waiting for some timeout etc?

BBS log:

11-23 20:14:51.639 I/StatsProvider( 3208): Trace: Calling root operations2014-11-23 20:14:51
11-23 20:14:52.193 D/StatsProvider( 3208): Result [NetworkUsage [m_uid=0, m_bytesReceived=5006, m_bytesSent=21625], NetworkUsage [m_uid=10008, m_bytesReceived=24464, m_bytesSent=0], NetworkUsage [m_uid=10096, m_bytesReceived=4576, m_bytesSent=0], NetworkUsage [m_uid=10022, m_bytesReceived=1760, m_bytesSent=0], NetworkUsage [m_uid=1000, m_bytesReceived=484, m_bytesSent=532]]
11-23 20:14:52.668 I/StatsProvider( 3208): Accessing Alarms passing the SELinux context
11-23 20:14:52.669 I/AlarmsDumpsys( 3208): getAlarms: SDK=21, RELEASE=5.0
11-23 20:14:57.109 I/ReferenceStore( 3208): Retrieved reference from cache: Reference ref_unplugged created 1 m 39 s (Wl: 0 elements; KWl: 45elements; NetS: 5 elements; Alrm: 0 elements; Proc: 0 elements; Oth: 3 elements; CPU: 14 elements)
11-23 20:14:57.110 I/ReferenceStore( 3208): Retrieved reference from cache: Reference ref_current created 5 m 56 s (Wl: 0 elements; KWl: 72elements; NetS: 5 elements; Alrm: 4 elements; Proc: 40 elements; Oth: 6 elements; CPU: 15 elements)
11-23 20:14:57.112 D/StatsProvider( 3208): Since (not used anymore): 3 m 56 s
11-23 20:14:57.112 D/StatsProvider( 3208): Since: 4 m 17 s
11-23 20:15:13.158 D/StatsProvider( 3208): Result [com.google.android.gms [Wakeups: 5 (∞ / min)], android [Wakeups: 2 (∞ / min)], com.android.providers.calendar [Wakeups: 2 (∞ / min)], com.android.vending [Wakeups: 2 (∞ / min)]]
11-23 20:15:13.159 I/StatsProvider( 3208): Trace: Finished root operations2014-11-23 20:15:13
[BetterBatteryStats] Karpfenhai:
[MENTION=1330150]chamonix[/MENTION], outstanding!

Perfect, don't forget to fix the menu color issue (white at 3 dot)

Will test further, love it! [emoji106] [emoji106] [emoji41]
[BetterBatteryStats] chamonix:
I hope ai can find a clue in google's forum. That issue looks like an appcompat one as there is only one menu in the code.... I need to find out where it's rendering is controlled and why it does not respect the style. Possibly the issue is due to the fact that the actionbar is light and not dark....
[BetterBatteryStats] maximosm:
Is anywhan what is the eventx-xxx tha are dreinig my battery? Pleaee help i have veri bic problem.
[BetterBatteryStats] wilkster:
Try using Amplify (if you are rooted w/xposed). The free version will allow you to throttle the ALARM_WAKEUP_LOCATOR and the donate version will allow you to throttle all of the alarms, including the SYNC alarm. These alarms cause your device to wake up and either get the network location (ALARM_WAKEUP_LOCATOR) or trigger a sync (SYNC_ALARM). Both of these actions will keep your phone awake while they complete. So they do use a little power while your would otherwise have your phone sleeping. Look at the wakelock duration for network location and syncs to see how long your phone is held awake..
[BetterBatteryStats] pikachukaki:
Yeah I'm on L so no Xposed for me now... I saw that this goddemed location settings was on... I'm only using cell and wifi locations for checkins but it seems that they causing a lot of wakelocks
[BetterBatteryStats] chamonix:
I'd focus on the first one if I were you. A wakeup to sync some data is far too much and a sign of a poorly designed app. The problem is that it is not easy to find which account it is except turning them off one by one until you found the faulty one.
[BetterBatteryStats] HDtracer:
Does anyone know what causes this alarm?

Alarms: 231, Intent: android.app.backup.intent.RUN

In 24 hours the android battery stats says that android system is responsible for 75% of the total battery use and the above alarm is the biggest wakeup (over 200 in 8hours over night)
[BetterBatteryStats] mdamaged:
Google backing up stuff, disable it and use TiB instead.
[BetterBatteryStats] HDtracer:
Hmm I was pretty sure I had stopped all Google/drive/cloud/gmail etc backups from running and I cant think of any apps I have installed that should be doing anything like this.

I will have to go through again and see what I could have missed.
[BetterBatteryStats] guido_glx:
Latest B7 works excellent here!

But I'm still seeing display twice, and advanced selection keeps being cut off

Enviado desde mi GT-I9300 mediante Tapatalk
[BetterBatteryStats] ccoager:
My phone seems to be staying awake because of msm_hsic_host. Any idea what is causing this?
[BetterBatteryStats] Karpfenhai:
That's weird, you seem to be the only one claiming that issue, are you using a custom dpi set?

Regards

---------- Post added at 04:32 AM ---------- Previous post was at 04:30 AM ----------

Hmm, could point to a sensor going mad, do you user any fancy features like pocket mode or slide to wake?

Regards
[BetterBatteryStats] Celestial Fury:
Any way to regulate the time and frequency it backups with a tasker like program? Turned of sync and it STILL tries to backup.
[BetterBatteryStats] ccoager:
No and no.
[BetterBatteryStats] wonsky21:
You need to do this:

I've just figured it out yesterday :)

GT-I9505 | SlimKat 4.4.4 jflte 8.14 WEEKLY
[BetterBatteryStats] Celestial Fury:
Thanks but can an automation app toggle that backup switch? Ex. I only want to backup when connected to a power supply.
[BetterBatteryStats] saleemakbani:
Can someone please have a look at my stats. Nexus 5,running paranoid Android beta with faux kernel. https://www.dropbox.com/s/sm5ij3u5tb38jxq/BetterBatteryStats-2014-11-24_075514709.txt?dl=0
[BetterBatteryStats] wonsky21:
No, AFAIK. But use Titanium Backup instead. Do the same + your data isn't stored on google servers. And you can set scheduled backup.
[BetterBatteryStats] chamonix:
I just added #589 as I think I remember an article about analysing sync issues and finding more details about the account
[BetterBatteryStats] 0robreid0:
Did you manage to fix this?

I'm having the same problem on 4.4 CM11.
[BetterBatteryStats] wonsky21:
Try convert it to system app with TB

GT-I9505 | SlimKat 4.4.4 jflte 8.14 WEEKLY
[BetterBatteryStats] guido_glx:
Thanks for replying!

I quoted another guy's post, that makes two of us [emoji12]

Custom dpi set? Where can I find that?

This is what I see:

Enviado desde mi GT-I9300 mediante Tapatalk
[BetterBatteryStats] JaJeJJ:
Partial Wakelocks -> unplugged and current:

"no stats have been collected yet"

3h 4m running betterbatterystats =(
[BetterBatteryStats] chamonix:
Be reminded that I will not answer to incomplete bug reports or questions. The first post of this thread sets the expectation on the level of quality required. Not fulfilling these prevent us/me to help you.
[BetterBatteryStats] gaich:
Weird things are happening with kernel wakelocks on Lollipop - there are dozens on LG G3, other app shows lot of them, with B7 I just see the top and the collective ones, no matter I use api or native...

[YOUTUBE]PtluVNWEA0E[/YOUTUBE]

View attachment BetterBatteryStats-2014-11-24_213218769.txt

View attachment logcat-2014-11-24_213218810.txt
[BetterBatteryStats] Perseus:
Not to my knowledge.
[BetterBatteryStats] mag01:
One interesting thing about your GSam output is that it contains entries such as ipc0000037b_sensors.qcom and ipc0000037c_sensors.qcom which don't show up in the BBS parsed output from /sys/kernel/debug/wakeup_sources at all. Can you also post (unmodified) output from 'cat /sys/kernel/debug/wakeup_sources' executed as root (besides the usual BBS logs), or at least enable debug logging in BBS and post just those logs?
[BetterBatteryStats] Karpfenhai:
[MENTION=1330150]chamonix[/MENTION], if you don't mind having a look into #26705 ? Any clue what could cause this?

[MENTION=5294162]guido_glx[/MENTION], could you switch the theme to dark and back to white?

Regards
[BetterBatteryStats] guido_glx:
I've just done that, same thing happens on dark theme and again when I'm back to white.

I can post more screenshots or a logcat if it's useful.

Enviado desde mi GT-I9300 mediante Tapatalk
[BetterBatteryStats] 0robreid0:
Sorry, I thought I'd check if it had been fixed first.
[BetterBatteryStats] CM17X:
Yes, it was something related to my rooting process. Seems like I wasn't full rooted or so. What I did was fix the root permisions with the option available into CWM.

I really dont know how it worked, but it did it
[BetterBatteryStats] Karpfenhai:
Okay, we're running out of options, let's see what the dev decides how to go further,I doubt a logcat could help here.

Regards
[BetterBatteryStats] chamonix:
I am out of ideas so please post a logcat. I'd like to look into potential errors occurring while rendering the dialog/fragments
[BetterBatteryStats] chamonix:
the first place to start would be to make sure that you always look into raw as this will show stats since boot. Second make sure to remove zero filtering from the prefs to show all entries. That should show everything from wake_sources and make a comparison with the logs easier
[BetterBatteryStats] guido_glx:
Sure, I've attached the logcat.

Anyway, if it's just me, you can ignore it, it's not a big deal. I thought it happened to everybody.
[BetterBatteryStats] pikachukaki:
Do location on battery saving with both location report and history off can cause so many alarms?I need location for chronus and swamp checkins do I have to close it an manually open it when I need it??
[BetterBatteryStats] RobertusITA:
I rooted my nexus 5 lollipop with CF autoroot and supersu 2.20, but betterbatterystats 2.0.0.0B5 in Kernel Wakelock say "no stata have ben collected yet".

So settings - advanced - kernel wakelock using api

And i can see.

But now i rooted again my device with last supersu 2.27 and i flashed a stock kernel, but dame story.

How can i fix it?
[BetterBatteryStats] gaich:
Thank you, I just unchecked zero filtering and all kernel wackeloks displaying went back!!
[BetterBatteryStats] Vash.89:
Same problem :(

and I also have problems with the theme..
[BetterBatteryStats] chamonix:
start by using the current beta
[BetterBatteryStats] j1gga84:
My phone is very active the last days and did not go to deep sleep very much..

Under 'Kernel Wakelocks' I have quite much..

at about 8h uptime I have:

multidp with about 36min

secril_fd-interface with about 24min

radio-interface about 12min

umts_ipc0 12min

sec-battery-monitor 5min

rpm_hsic 3min

And I think this patch from CM concerning the alarm com.android.internal.telephony.data-stall does not work properly (on my side..).

I have more wakelocks than before now..

regards
[BetterBatteryStats] Perseus:
Multipdp in various incarnations represents struggle to connect to tower. Toggle airplane mode briefly when you are home or when at work.
[BetterBatteryStats] Lownita:
Any idea what might be causing that high number of alarms from light flow?
[BetterBatteryStats] Perseus:
that app is known for that. Ask the Dev.
[BetterBatteryStats] chamonix:
Yay, we have our own app forum \o/

I have not given much tought about shaping it into a new structure yet and I certainly want to be conservative when it comes to changing too much too fast and break a running system.

Suggestions are of course as always welcome! Until we have settled on the format I suggest that we merge all threads started in the root to this one, to keep things clean.
[BetterBatteryStats] mdamaged:
The place could use some new curtains.
[BetterBatteryStats] Aliante:
I believe an "Announcements Only" thread locked for everybody where only you can post new messages for each releases and/or important communication would be really nice to have.
[BetterBatteryStats] vukis:
Nexus 5 Lollipop sleeps like a bear during winter, but looses ~50% over night. And wifi is on nevertheless that wifi sleep policy is turned to only when charging and viber is also setuped to use system wifi sleep policy.

What do you think?
[BetterBatteryStats] samdal:
Kernel wakelock and partial wakelock dont show in stock lollipop on nexus 5, even though I have installed as system app. Anyone else having this problem and/or know of a solution?
[BetterBatteryStats] saleemakbani:
Can somebody please have a look at the stats. I'm loosing around 3%/hr. http://goo.gl/H4KYBF
[BetterBatteryStats] chamonix:
are you using 2.0b7? if not please upgrade and enable the advanced preferences to retrieve kernel wakelocks using api and you should be all set
[BetterBatteryStats] chamonix:
location collection/reporting and Google fit cause lots of wakeups and are the main reason for the drain. Please collect an idle reading to confirm (you screen on time may blur the picture)
[BetterBatteryStats] amjath:
Guys please help. Battery drains out in 4 hours fully on my galaxy s2 due to wake locks help.

http://pastebin.com/raw.php?i=Xcb7zUfk