Alternative to installing Better Battery Stats as system app

Search This thread

dimm0k

Senior Member
Jan 25, 2014
1,651
644
Google Pixel 4 XL
this looks like a great alternative! after getting TWRP and root on my device, I had already gone with flashing the zip to install as a system app. flashing the REMOVE zip looks to have removed the system app, but it looks like BBS still is granted the proper permissions without using this method? is this normal?
 

DavisNT

Inactive Recognized Developer
Aug 27, 2011
522
726
Riga
projects.dm.id.lv
this looks like a great alternative! after getting TWRP and root on my device, I had already gone with flashing the zip to install as a system app. flashing the REMOVE zip looks to have removed the system app, but it looks like BBS still is granted the proper permissions without using this method? is this normal?
This is possible. The system app lets Android to grant the permissions to this BBS. Permissions are just system wide settings, whether they are preserved after system app uninstall I am not sure, but this could be the case.
I'm having trouble doing this on my LG G4 running 6.0. I can get into the adb shell but when I try to run su I get:
Code:
[email protected]:/ $ su
/system/bin/sh: su: not found
Any suggestions?
This method requires root. And looks like your device is not rooted.
 

aidy.lucas

Senior Member
Oct 8, 2014
1,866
610
Also confirmed working on Xperia xa stock unrooted 6.0 mm. Bbs working great so far

Sent from my Xperia XA using XDA Labs
 
  • Like
Reactions: DavisNT

aidy.lucas

Senior Member
Oct 8, 2014
1,866
610
Has the method mentioned in the Original Post worked on a non-rooted device?
Did the su command display an error and both following commands succeed?
Didn't see any errors I just entered the two adb commands and bbs works flawlessly only cores stats are missing.

Sent from my Xperia XA using XDA Labs
 

Attachments

  • Screenshot_20160905-165534.png
    Screenshot_20160905-165534.png
    107.1 KB · Views: 304

iamatechnoob

Senior Member
Jun 8, 2013
144
23
For apk downloaded from xda change the code to
pm grant com.asksven.betterbatterystats_xdaedition android.permission.BATTERY_STATS
pm grant com.asksven.betterbatterystats_xdaedition android.permission.DUMP

This doesn't seem to work for me, anyone able to help? I get the error: "Could not access the Package Manager. Is the system running?" whether BBS is running in the background or not. One thing to note is that when I load BBS for the first time after installing, it is asking me to install as a system app and I have yet to do that (wanted to try this instead).
 

DavisNT

Inactive Recognized Developer
Aug 27, 2011
522
726
Riga
projects.dm.id.lv
This doesn't seem to work for me, anyone able to help? I get the error: "Could not access the Package Manager. Is the system running?" whether BBS is running in the background or not. One thing to note is that when I load BBS for the first time after installing, it is asking me to install as a system app and I have yet to do that (wanted to try this instead).
Before entering the mentioned commands, enter command:
Code:
su
 

pure.by

Senior Member
Jan 23, 2010
544
330
Yes I have already done that and it shows that I am in Root before typing those commands... Somehow just not working for me, is there anything else that might be affecting it?
The XDA beta-RC3 version does not require to be installed as system app. I think it's the best alternative if you have trouble with this method because you get MM support, latest features and no system-app requirement.

Or am I overlooking something?

Sent from my OnePlus 2 using Tapatalk
 

iamatechnoob

Senior Member
Jun 8, 2013
144
23
The XDA beta-RC3 version does not require to be installed as system app. I think it's the best alternative if you have trouble with this method because you get MM support, latest features and no system-app requirement.

Or am I overlooking something?

Sent from my OnePlus 2 using Tapatalk

I am on the XDA beta-RC3 version (double checked it in App Info).. but when I run the app it says that battery_stats and dump is not granted. I also have an option to install it as system app.

Just adding that I am on a systemless root custom ROM, with enforced SELinux.
 

pure.by

Senior Member
Jan 23, 2010
544
330
I am on the XDA beta-RC3 version (double checked it in App Info).. but when I run the app it says that battery_stats and dump is not granted. I also have an option to install it as system app.

Just adding that I am on a systemless root custom ROM, with enforced SELinux.
Ohh sorry don't know in this case :-/

I am using Marshmallow, systemless root and enforced SELinux as well and for me it works.
 
Last edited:

pure.by

Senior Member
Jan 23, 2010
544
330
So you install it and grant it root in SU, and it works magically without any issues?
Yup, just like any other root app. That's how it's supposed to work. If it does not work that way, I suggest you ask help in the official thread.

I must note that I still have PlayStore BBS installed as system app because I didn't want to go through the trouble of uninstalling a system app, but I have disabled it and using RC3 without any major issues (once in a while stats can't properly be loaded properly, but otherwise it's very reliable and stable 9/10 times).

Sent from my OnePlus 2 using Tapatalk
 

iamatechnoob

Senior Member
Jun 8, 2013
144
23
Yup, just like any other root app. That's how it's supposed to work. If it does not work that way, I suggest you ask help in the official thread.

I must note that I still have PlayStore BBS installed as system app because I didn't want to go through the trouble of uninstalling a system app, but I have disabled it and using RC3 without any major issues (once in a while stats can't properly be loaded properly, but otherwise it's very reliable and stable 9/10 times).

Sent from my OnePlus 2 using Tapatalk
Well that makes sense then, by installing playstore BBS as system app you granted the permissions. It stays even after updates/wipes which is perhaps why your xdaedition works right out of the box.
 

pure.by

Senior Member
Jan 23, 2010
544
330
Well that makes sense then, by installing playstore BBS as system app you granted the permissions. It stays even after updates/wipes which is perhaps why your xdaedition works right out of the box.
I don't think you are correct. Even though permissions are granted, both versions are seen as 2 completely different apps by Android. The only way I can imagine they might interact in some way, is if they both shared the same filesystem partition or something like that, but this is very unlikely and beyond my expertise to be completely honest :)

The fact remains that XDA version is supposed to work "out of the box" for everyone, it does not require to be a system app any more nor does it require PlayStore version to be installed at all. So if it does not work with just root, you can better report it in the official thread.

Sent from my OnePlus 2 using Tapatalk
 
  • Like
Reactions: iamatechnoob

iamatechnoob

Senior Member
Jun 8, 2013
144
23
I don't think you are correct. Even though permissions are granted, both versions are seen as 2 completely different apps by Android. The only way I can imagine they might interact in some way, is if they both shared the same filesystem partition or something like that, but this is very unlikely and beyond my expertise to be completely honest :)

The fact remains that XDA version is supposed to work "out of the box" for everyone, it does not require to be a system app any more nor does it require PlayStore version to be installed at all. So if it does not work with just root, you can better report it in the official thread.

Sent from my OnePlus 2 using Tapatalk
Thats beyond my expertise too. I've posted on the original thread, lets hope I can get this solved soon. Thanks anyway.
 

Andr0med

Member
Jan 6, 2009
10
3
Tip for those with unrooted phone, ADB and betterbatterystats : adb -d shell pm grant com.asksven.betterbatterystats_xdaedition android.permission.BATTERY_STATS

Took me a while to find this command, but it works! (credit to alexus' blog). You get full kernel and partial wakelock info
 

Top Liked Posts

  • There are no posts matching your filters.
  • 32
    Starting with Android 4.4 (KitKat) Better Battery Stats (BBS) require installation as system app to be able to collect the stats.
    BBS must re re-installed as system app after each ROM upgrade (upgrade that does not preserve third party system apps).

    I have found an alternative to this - the required permissions can be granted to BBS when it is installed as a regular user app by running these commands in Android Terminal (or ADB shell session):
    Code:
    su
    pm grant com.asksven.betterbatterystats android.permission.BATTERY_STATS
    pm grant com.asksven.betterbatterystats android.permission.DUMP

    After using these commands it might be required to restart BBS process (e.g. reboot the device). Permissions granted this way will be preserved across ROM upgrades (even across those completely overwriting /system partition).

    This has been tested on CyanogenMod 12.1 nightlies (Android 5.1.1).

    Update! This post on BBS thread describes a related method for granting (at least part of) the permissions without root.
    8
    For apk downloaded from xda change the code to
    pm grant com.asksven.betterbatterystats_xdaedition android.permission.BATTERY_STATS
    pm grant com.asksven.betterbatterystats_xdaedition android.permission.DUMP
    3
    If anyone wonders if this method works on not rooted devices running Android M im confirming it does!

    – XDA
    adb -d shell pm grant com.asksven.betterbatterystats_xdaedition android.permission.BATTERY_STATS

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

    I've tested commands pasted in previous pages which didnt work, while this ones has!
    2
    Tip for those with unrooted phone, ADB and betterbatterystats : adb -d shell pm grant com.asksven.betterbatterystats_xdaedition android.permission.BATTERY_STATS

    Took me a while to find this command, but it works! (credit to alexus' blog). You get full kernel and partial wakelock info
    1
    I'd say this method it's not working in Oreo... Can anyone confirm?