An attempt to provide advanced battery stats for Android

Overview

Build CircleCI

#License BetterBatteryStats is an open source project unter the terms of the Apache 2.0 License. The license does not apply to the use of the names "BetterBatteryStats" and "Better Battery Stats", nor to the icon / artwork created for BetterBatteryStats.

Build

In order to build (with gradle / Android Studio) following changes to the local project are required

HockeyApp

The environment variable HOCKEYAPP_APP_ID must be set to a valid value

Signing

The signing config uses environment variables:

    signingConfigs {
        release {
            storeFile file(System.getenv("KEYSTORE_RELEASE"))
            storePassword System.getenv("KEYSTORE_PASSWORD")
            keyAlias System.getenv("KEY_ALIAS")
            keyPassword System.getenv("KEY_PASSWORD")
        }
        debug {
            storeFile file(System.getenv("KEYSTORE_DEBUG"))
        }
    }
  • KEYSTORE_RELEASE points to the release .keystore file
  • KEYSTORE_DEBUG points to the debug .keystore file
  • KEY_ALIAS defines the alias name
  • KEY_PASSWORD is the keystore password

Continuous Integration

The continuous integration (in this example CircleCI) needs to have access to some private settings.

Google play publishing

Publishing profile

The encrypted file (sa-google-play.json-cipher) is located in /app, and referenced by the gradle build.

See also https://github.com/Triple-T/gradle-play-publisher.

Deploy task

In circle.yml we define that all the google play publishing (to beta) is triggered on tag release-*

Encrypt

openssl aes-256-cbc -e -in secret-env-plain -out secret-env-cipher -k $KEY

See also https://github.com/circleci/encrypted-files

Decrypt (on CircleCI, as defined in circle.yml and using an env-variable KEY)

openssl aes-256-cbc -d -in secret-file-cipher -out secret-file-plain -k $KEY

The signing keys

The environment variables $KEYSTORE_RELEASE, $KEYSTORE_DEBUG, $KEY_ALIAS, $KEY_PASSWORD and $KEYSTORE_PASSWORDmust be set.

There variables are set in secret-env-plain (not part of the project for obvious reasons).

In order to run your own build create a file secret-env-plain and set the variables:

export KEYSTORE_PASSWORD=<your-keystore-pwd>
export KEY_PASSWORD=<your-key-pwd>
export KEY_ALIAS=<your-key-alias>
export KEYSTORE_DEBUG=<name-of-debug-keystore>
export KEYSTORE_RELEASE=<name-of-release-keystore>

and then encrypt this file using openssl aes-256-cbc -e -in secret-env-plain -out secret-env-cipher -k $KEY

In the piepline the decyption is done using the script circleciscripts/decrypt_env_vars.sh with the $KEY stored in circle-ci's env vars.

As the signing keys are not in the github repo a script circleciscripts/download_keystore.sh does the job of downloading and decrypting the keys at build-time. For that to happen following addition environment variables must be set:

  • $KEYSTORE_URI a public URI from where the files can be downloaded using http
  • $KEY the key to decrypt the keystores (same env var as for google-services.json)
Comments
  • BetterBatteryStats on Fdroid / Gradle based build

    BetterBatteryStats on Fdroid / Gradle based build

    I wanted to bring back BetterBatteryStats back to Fdroid as there is currently only a seriously out of date version available.

    I struggled with the current ant based build system and was not able to successfully build BBS that way. However I was able to convert the build to using gradle without too much effort.

    Now integrating this into the Fdroid's automated build system poses a few challenges and I'd like to ask your opinion on how to proceed.

    1. I can provide grade build files which you can merge additionally to the current system. This would have to be done for both BetterBatteryStats and AndroidCommon.
    2. You switch to gradle altogether. I don't know how disruptive that would be for you, but gradle is clearly the more modern and more advanced build system. I can provide a pull request for this too.
    3. I work from a personal fork on github where I can adapt the project structure myself. Fdroid builds from that fork but I would have to manually merge every update back into that fork.

    I think all three solutions (but probably mostly 1. and 2.) improve how easy it is for people to not only look at the source but download and build it themselves and maybe sent back improvements to you.

    opened by Bubu 12
  • Nothing displayed on screen

    Nothing displayed on screen

    Starting the app, the Computing notification pops up, and once that is done, i'm left with the two drop down options. No matter what I do, nothing is shown.

    Android 2.3.5 BetterBatteryStats 1.1.1.0

    opened by advilivda 12
  • Fallback to since boot

    Fallback to since boot

    I am getting an error saying "fallback to since boot" and all the stats collected gets deleted automatically to show me.. "no stats have been collected" after 50% battery or so... Don't know what is happening here... I have attached a screenshot for reference. Screenshot_2021-10-14-18-59-49-627_com asksven betterbatterystats_xdaedition

    Bbs 2.6-382 Miui 12.5 based on a11

    opened by ajaikumarnadar 10
  • android 11 error

    android 11 error

    Hello, I'm using beta 2.6-378 on android 11 stock (not rooted). the device is a samsung a42 5g.

    I have installed the apk and given the permissions using adb, but it doesn't work. See the screenshot for the error (sorry the screenshot is in italian, I have selected to force english language in bbs options but it is still displayed in italian).

    On another device running android 10 it works correctly.

    Screenshot_20210330-113638

    opened by 424344 9
  • Crash when long pressing row

    Crash when long pressing row

    When I long press a row, BBS xda ed 2.0.0rc2 crashes on my rooted Nexus 5 with Lollipop 5.0.0. Please see this screenshot (or the crash feedback I've sent - do you actually get those?). http://pix.skwar.me/screenshots/Screenshot_2014-12-15-22-15-22.png

    opened by alexs77 9
  • [feature] add permissions without system app

    [feature] add permissions without system app

    At least on some Android version (e.g. Android 5.1 Lollipop) it is possile to grant necesarry BATTERY_STATS and DUMP permissions to Better Battery Stats by invoking the following commands as root (without installing system app):

    pm grant com.asksven.betterbatterystats android.permission.BATTERY_STATS
    pm grant com.asksven.betterbatterystats android.permission.DUMP
    

    I suggest leaving system app as last resort (it is possible that it is not needed at all - I have not tested these command lines on all affected Android versions). I suggest invoking these commands as root and restarting Better Battery Stats process before offering to install the system app. Process can be restarted by setting up AlarmManager alarm and doing System.exit(0);.

    opened by DavisNT 7
  • Asus Transformers have Two batteries

    Asus Transformers have Two batteries

    BBS looks awesome - but it gets quite confused by the Asus Transformer, which has a battery in the keyboard dock. BBS doesnt detect the second battery or the real state of charging because when docked (but not plugged in) it thinks the tablet is charging... which it is, but only from the dock. Confusing yes.

    If you're interested in resolving this, please let me know how I can help debug it.

    Thanks.

    opened by phedders 6
  • [feature] add better sources for used libs

    [feature] add better sources for used libs

    by dalb8: Thanks for putting the jar licenses in the libs/, but could you write where you got them too and also the commits used for the sub projects? I would like to include this in F-Droid.org repo for the benefit of all freedom loving Android users. Obviously we would remove Analytics because it isn't free. Donation links are welcome.

    opened by asksven 6
  • The application can not be started!

    The application can not be started!

    BBS v2.2.2.0 Phone HUAWEI HONOR 7 (PLK-L01C10B331, Android 6.0 Marshmallow, EmUI 4.0.2, Rooted) Installation of the application is normal. But when I run the application, for about a minute I see an empty white screen, then the banner "Calculation ..." appears on the screen and hangs endlessly. I can exit from this only by killing the process in task killer

    android.permission.BLUETOOTH android.permission.WAKE_LOCK android.permission.GET_TASKS android.permission.ACCESS_NETWORK_STATE android.permission.BATTERY_STATS android.permission.READ_EXTERNAL_STORAGE android.permission.ACCESS.SUPERUSER android.permission.RECEIVE_BOOT_COMPLETED android.permission.DEVICE_POWER android.permission.ACCESS_WIFI_STATE android.permission.WRITE_EXTERNAL_STORAGE android.permission.READ_PHONE_STATE android.permission.DUMP android.permission.READ_LOGS

    opened by AStasenko 5
  • Unable to build application

    Unable to build application

    I am trying to build this application from source. However, due to a pretty complete lack of documentation, I have not been able to do this so far.

    What I did so far: I cloned this repo, AndroidCommon and ckChangeLog into a common folder (because this repo kept complaining about those folders being missing). However if I do ant release in BetterBatteryStats in this repo, it complains

    /home/r/bin/android-sdk/tools/ant/build.xml:573: ../../ckChangeLog/ckChangeLog/src/main resolve to a path with no project.properties file for project /home/r/src/android/BetterBatteryStats/BetterBatteryStats/BetterBatteryStats
    

    However, trying to build ckChangeLog also fails. I am doing ./gradlew assemble, and the result is

    > No such property: nexusUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
    

    Is it even possible to build this application with the publicly available sources?

    opened by RalfJung 5
  • [bug] not working in lollipop / android 5

    [bug] not working in lollipop / android 5

    thanks for this great App. Unfortunately, I cannot use it any more in lollipop. I tried to install it as system app before, which made the app completely unusable. Any workaround?

    opened by luckyhandler 5
  • crash on opening the settings

    crash on opening the settings

    Stack Trace:

    FATAL EXCEPTION: main
    Process: com.asksven.betterbatterystats, PID: 11268
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asksven.betterbatterystats/com.asksven.betterbatterystats.PreferencesFragmentActivity}: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2819)
    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
    	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4740)
    	at android.app.ActivityThread.-wrap18(Unknown Source:0)
    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1629)
    	at android.os.Handler.dispatchMessage(Handler.java:106)
    	at android.os.Looper.loop(Looper.java:164)
    	at android.app.ActivityThread.main(ActivityThread.java:6548)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
    Caused by: android.view.InflateException: Binary XML file line #10: Binary XML file line #10: Error inflating class fragment
    Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class fragment
    Caused by: java.lang.IllegalStateException: Fragment com.asksven.betterbatterystats.PreferencesFragmentActivity$PrefsFragment did not create a view.
    	at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3569)
    	at android.app.FragmentController.onCreateView(FragmentController.java:98)
    	at android.app.Activity.onCreateView(Activity.java:6219)
    	at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
    	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:780)
    	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
    	at android.view.LayoutInflater.rInflate(LayoutInflater.java:863)
    	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
    	at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:706)
    	at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
    	at com.asksven.betterbatterystats.PreferencesFragmentActivity.onCreate(PreferencesFragmentActivity.java:52)
    	at android.app.Activity.performCreate(Activity.java:7009)
    	at android.app.Activity.performCreate(Activity.java:7000)
    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1214)
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2772)
    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2897)
    	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4740)
    	at android.app.ActivityThread.-wrap18(Unknown Source:0)
    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1629)
    	at android.os.Handler.dispatchMessage(Handler.java:106)
    	at android.os.Looper.loop(Looper.java:164)
    	at android.app.ActivityThread.main(ActivityThread.java:6548)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:857)
    
    opened by Quantenzitrone 0
  • BBS crash when use shelter app and work space

    BBS crash when use shelter app and work space

    when open "partial wakelock",bbs crash.Probable reason is multiuser. When BBS detects some apps installed in android work space, it crash.

    additional info: https://paste.evolution-x.org/lcq2Cp

    time: 1662271076617 msg: java.lang.SecurityException: getPackagesForUid: UID 10005 requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS or android.permission.INTERACT_ACROSS_PROFILES to access user . stacktrace: java.lang.SecurityException: getPackagesForUid: UID 10005 requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS or android.permission.INTERACT_ACROSS_PROFILES to access user . at android.os.Parcel.createExceptionOrNull(Parcel.java:2426) at android.os.Parcel.createException(Parcel.java:2410) at android.os.Parcel.readException(Parcel.java:2393) at android.os.Parcel.readException(Parcel.java:2335) at android.content.pm.IPackageManager$Stub$Proxy.getPackagesForUid(IPackageManager.java:5389) at android.app.ApplicationPackageManager$3.recompute(ApplicationPackageManager.java:1050) at android.app.ApplicationPackageManager$3.recompute(ApplicationPackageManager.java:1044) at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:562) at android.app.ApplicationPackageManager.getPackagesForUid(ApplicationPackageManager.java:1063) at com.asksven.android.common.nameutils.UidNameResolver.getNameForUid(UidNameResolver.java:107) at com.asksven.android.common.privateapiproxies.StatElement.getFullQualifiedName(StatElement.java:88) at com.asksven.android.common.privateapiproxies.StatElement.getFqn(StatElement.java:112) at com.asksven.betterbatterystats.adapters.StatsAdapter.getView(StatsAdapter.java:231) at android.widget.AbsListView.obtainView(AbsListView.java:2400) at android.widget.ListView.makeAndAddView(ListView.java:2067) at android.widget.ListView.fillDown(ListView.java:793) at android.widget.ListView.fillFromTop(ListView.java:855) at android.widget.ListView.layoutChildren(ListView.java:1838) at android.widget.AbsListView.onLayout(AbsListView.java:2197) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:689) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673) at android.widget.LinearLayout.onLayout(LinearLayout.java:1582) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at com.android.internal.policy.DecorView.onLayout(DecorView.java:797) at android.view.View.layout(View.java:23203) at android.view.ViewGroup.layout(ViewGroup.java:6411) at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3753) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3203) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2177) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8803) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037) at android.view.Choreographer.doCallbacks(Choreographer.java:845) at android.view.Choreographer.doFrame(Choreographer.java:780) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003) Main Website Wiki

    opened by mydreamworldpolly 1
  • link to adding udev rules broken

    link to adding udev rules broken

    on https://better.asksven.io/betterbatterystats/non-root/ , the link to the Stakexchange question on how to add udev rules

    http://stackoverflow.com/questions/3...vice-on-ubuntu

    is literally pointing to this shortened version. could you please fix it?

    opened by chaserene 0
  • Crash with permission error at method getPackagesForUid (Android 12)

    Crash with permission error at method getPackagesForUid (Android 12)

    BBS 3.0 LOS 19.1 (Android 12)

    When I click "partial wakelocks" (including the "raw statistics"), BBS crashes, with log

    AndroidRuntime
    FATAL EXCEPTION: main
    Process: com.asksven.betterbatterystats, PID: 19068
    java.lang.SecurityException: getPackagesForUid: UID 10290 requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS or android.permission.INTERACT_ACROSS_PROFILES to access user .
    	at android.os.Parcel.createExceptionOrNull(Parcel.java:2426)
    	at android.os.Parcel.createException(Parcel.java:2410)
    	at android.os.Parcel.readException(Parcel.java:2393)
    	at android.os.Parcel.readException(Parcel.java:2335)
    	at android.content.pm.IPackageManager$Stub$Proxy.getPackagesForUid(IPackageManager.java:5389)
    	at android.app.ApplicationPackageManager$3.recompute(ApplicationPackageManager.java:1013)
    	at android.app.ApplicationPackageManager$3.recompute(ApplicationPackageManager.java:1007)
    	at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:562)
    	at android.app.ApplicationPackageManager.getPackagesForUid(ApplicationPackageManager.java:1026)
    	at com.asksven.android.common.nameutils.UidNameResolver.getNameForUid(UidNameResolver.java:107)
    	at com.asksven.android.common.privateapiproxies.StatElement.getFullQualifiedName(StatElement.java:88)
    	at com.asksven.android.common.privateapiproxies.StatElement.getFqn(StatElement.java:112)
    	at com.asksven.betterbatterystats.adapters.StatsAdapter.getView(StatsAdapter.java:231)
    	at android.widget.AbsListView.obtainView(AbsListView.java:2398)
    	at android.widget.ListView.makeAndAddView(ListView.java:2067)
    	at android.widget.ListView.fillDown(ListView.java:793)
    	at android.widget.ListView.fillFromTop(ListView.java:855)
    	at android.widget.ListView.layoutChildren(ListView.java:1838)
    	at android.widget.AbsListView.onLayout(AbsListView.java:2195)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at androidx.swiperefreshlayout.widget.SwipeRefreshLayout.onLayout(SwipeRefreshLayout.java:689)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
    	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
    	at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
    	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
    	at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1829)
    	at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1673)
    	at android.widget.LinearLayout.onLayout(LinearLayout.java:1582)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.widget.FrameLayout.layoutChildren(FrameLayout.java:332)
    	at android.widget.FrameLayout.onLayout(FrameLayout.java:270)
    	at com.android.internal.policy.DecorView.onLayout(DecorView.java:797)
    	at android.view.View.layout(View.java:23203)
    	at android.view.ViewGroup.layout(ViewGroup.java:6412)
    	at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:3755)
    	at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3205)
    	at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2179)
    	at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8793)
    

    The debug info contains sensitive info, but there are Result [wakelock ... which ends up with Wakelock [m_wakeType=0, m_name=androidx.core:wake:com.google.android.gms/or which seems incomplete.

    Surrounding logs, maybe useful:

    sh
    type=1400 audit(0.0:22191): avc: denied { read } for name="/" dev="dm-0" ino=2 scontext=u:r:untrusted_app:s0:c34,c257,c512,c768 tcontext=u:object_r:rootfs:s0 tclass=dir permissive=0 app=com.asksven.betterterbatterystats
    
    terbatterystat
    Long monitor contention with owner AsyncTask #4 (19491) at com.asksven.betterbatterystats.data.Reference com.asksven.betterbatterystats.data.StatsProvider.populateReference(int, com.asksven.betterbatterystats.data.Reference)(StatsProvider.java:2762) waiters=0 in com.asksven.betterbatterystats.data.Reference com.asksven.betterbatterystats.data.StatsProvider.populateReference(int, com.asksven.betterbatterystats.data.Reference) for 322ms
    
    StatsProvider
    Exception: java.lang.SecurityException: getPackagesForUid: UID 10290 requires android.permission.INTERACT_ACROSS_USERS_FULL or android.permission.INTERACT_ACROSS_USERS or android.permission.INTERACT_ACROSS_PROFILES to access user .
    	at android.os.Parcel.createExceptionOrNull(Parcel.java:2426)
    	at android.os.Parcel.createException(Parcel.java:2410)
    	at android.os.Parcel.readException(Parcel.java:2393)
    	at android.os.Parcel.readException(Parcel.java:2335)
    	at android.content.pm.IPackageManager$Stub$Proxy.getPackagesForUid(IPackageManager.java:5389)
    	at android.app.ApplicationPackageManager$3.recompute(ApplicationPackageManager.java:1013)
    	at android.app.ApplicationPackageManager$3.recompute(ApplicationPackageManager.java:1007)
    	at android.app.PropertyInvalidatedCache.query(PropertyInvalidatedCache.java:562)
    	at android.app.ApplicationPackageManager.getPackagesForUid(ApplicationPackageManager.java:1026)
    	at com.asksven.android.common.nameutils.UidNameResolver.getNameForUid(UidNameResolver.java:107)
    	at com.asksven.android.common.privateapiproxies.BatteryStatsProxy.getNetworkUsageStats(BatteryStatsProxy.java:3508)
    	at com.asksven.betterbatterystats.data.StatsProvider.getCurrentNetworkUsageStatList(StatsProvider.java:1388)
    	at com.asksven.betterbatterystats.data.StatsProvider.populateReference(StatsProvider.java:2710)
    	at com.asksven.betterbatterystats.data.StatsProvider.setCurrentReference(StatsProvider.java:2494)
    	at com.asksven.betterbatterystats.services.WriteCurrentReferenceService.onHandleIntent(WriteCurrentReferenceService.java:51)
    	at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:78)
    	at android.os.Handler.dispatchMessage(Handler.java:106)
    	at android.os.Looper.loopOnce(Looper.java:201)
    	at android.os.Looper.loop(Looper.java:288)
    	at android.os.HandlerThread.run(HandlerThread.java:67)
    
    opened by Iey4iej3 1
  • android.view.InflateException crash

    android.view.InflateException crash

    Built 2816ac210c7645f5de572ad8a128e1c845df3385 AOSP11

    Press Back at the App Permissions screen (did not grant anything), go to menu - Settings, crash:

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.asksven.betterbatterystats/com.asksven.betterbatterystats.PreferencesFragmentActivity}: android.view.InflateException: Binary XML file line #10 in com.asksven.betterbatterystats:layout/preferences_fragment: Binary XML file line #10 in com.asksven.betterbatterystats:layout/preferences_fragment: Error inflating class fragment
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3432)
    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3596)
    	at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5456)
    	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
    	at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    	at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58)
    	at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5415)
    	at android.app.ActivityThread.access$3300(ActivityThread.java:238)
    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2077)
    	at android.os.Handler.dispatchMessage(Handler.java:106)
    	at android.os.Looper.loop(Looper.java:223)
    	at android.app.ActivityThread.main(ActivityThread.java:7705)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
    Caused by: android.view.InflateException: Binary XML file line #10 in com.asksven.betterbatterystats:layout/preferences_fragment: Binary XML file line #10 in com.asksven.betterbatterystats:layout/preferences_fragment: Error inflating class fragment
    Caused by: android.view.InflateException: Binary XML file line #10 in com.asksven.betterbatterystats:layout/preferences_fragment: Error inflating class fragment
    Caused by: java.lang.IllegalStateException: Fragment com.asksven.betterbatterystats.PreferencesFragmentActivity$PrefsFragment did not create a view.
    	at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:3594)
    	at android.app.FragmentController.onCreateView(FragmentController.java:104)
    	at android.app.Activity.onCreateView(Activity.java:7106)
    	at androidx.fragment.app.FragmentActivity.onCreateView(FragmentActivity.java:300)
    	at android.view.LayoutInflater.tryCreateView(LayoutInflater.java:1067)
    	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:995)
    	at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:959)
    	at android.view.LayoutInflater.rInflate(LayoutInflater.java:1121)
    	at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1082)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:680)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:532)
    	at android.view.LayoutInflater.inflate(LayoutInflater.java:479)
    	at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:706)
    	at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:195)
    	at com.asksven.betterbatterystats.PreferencesFragmentActivity.onCreate(PreferencesFragmentActivity.java:52)
    	at android.app.Activity.performCreate(Activity.java:7994)
    	at android.app.Activity.performCreate(Activity.java:7978)
    	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1310)
    	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3405)
    	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3596)
    	at android.app.ActivityThread.handleRelaunchActivityInner(ActivityThread.java:5456)
    	at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:5362)
    	at android.app.servertransaction.ActivityRelaunchItem.execute(ActivityRelaunchItem.java:69)
    	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
    	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
    	at android.app.ClientTransactionHandler.executeTransaction(ClientTransactionHandler.java:58)
    	at android.app.ActivityThread.handleRelaunchActivityLocally(ActivityThread.java:5415)
    	at android.app.ActivityThread.access$3300(ActivityThread.java:238)
    	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2077)
    	at android.os.Handler.dispatchMessage(Handler.java:106)
    	at android.os.Looper.loop(Looper.java:223)
    	at android.app.ActivityThread.main(ActivityThread.java:7705)
    	at java.lang.reflect.Method.invoke(Native Method)
    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:952)
    

    Also, on reopen the Theme is changed to Light instead of System, and the crash no longer occurs.

    But I can repro if I Clear App Data.

    opened by licaon-kter 0
Owner
asksven
asksven
Cordova plugin for Android Serial USB communication (easily connect an Arduino board to an Android device).

PR-DC cordova-plugin-serialusb Cordova plugin for Android Serial USB communication. This plugin makes a connection to the external board trivial, for

PR-DC 3 May 8, 2022
Stetho is a debug bridge for Android applications, enabling the powerful Chrome Developer Tools and much more.

Stetho Stetho is a sophisticated debug bridge for Android applications. When enabled, developers have access to the Chrome Developer Tools feature nat

Facebook 12.6k Jan 7, 2023
A library for debugging android databases and shared preferences - Make Debugging Great Again

Android Debug Database Android Debug Database is a powerful library for debugging databases and shared preferences in Android applications Android Deb

AMIT SHEKHAR 8.1k Dec 29, 2022
🔪Swiss-army knife for Android testing and development 🔪 ⛺

ADB Enhanced ADB-Enhanced is a Swiss-army knife for Android testing and development. A command-line interface to trigger various scenarios like screen

Ashish Bhatia 938 Dec 20, 2022
Under the Hood is a flexible and powerful Android debug view library. It uses a modular template system that can be easily extended to your needs, although coming with many useful elements built-in.

Under the Hood - Android App Debug View Library Under the Hood is a flexible and powerful Android debug view library. It uses a modular template syste

Patrick Favre-Bulle 217 Nov 25, 2022
Android library to record the network calls through the interceptor mechanism of the http clients.

Android Snooper Introduction Android Snooper is a library which helps in debugging issues while running the applications on android devices. One of th

Prateek 151 Nov 25, 2022
A Read-Eval-Print-Loop server for Android and SQLite

Android DebugPort Android DebugPort is a drop-in utility which allows you to write and execute code within your app's context, at runtime, and from th

Jason Feinstein 148 Nov 14, 2022
traffic debugging library for android

TrafficMonitor About Display traffic per Activity.Observing traffic is used by TrafficStats API. OkHttp Interceptor observer is implementing. Demo Bai

Tetsuya Masuda 17 Feb 4, 2022
Easy android exception tracer and handler.

Introduction Lup is a small android library that can help you to tracking bug that causes application stopped working (force close). Whiting this libr

icodeu 4 Sep 29, 2022
Sources for the LiveBoot app for rooted Android devices

This is the sauce for the LiveBoot app. License Copyright © 2011-2020 Jorrit Chainfire Jongma This code is released under the GPLv3. LICENSE, COPYING.

Chainfire 131 Jan 9, 2023
android logcat

android logcat

Ji Sungbin 3 Dec 2, 2022
A local ADB shell for Android!

LADB A local ADB shell for Android! How does it work? LADB bundles an ADB server within the app libraries. Normally, this server cannot connect to the

Tyler 1.1k Jan 2, 2023
btrace(AKA RheaTrace) is a high performance Android trace tool which is based on Systrace

btrace README 中文版 btrace(AKA RheaTrace) is a high performance Android trace tool

Bytedance Inc. 1.2k Jan 4, 2023
Pluto: An on-device debugging framework for Android applications

Pluto is an on-device debugging framework for Android applications, which helps in the inspection of HTTP requests/responses, captures Crashes, and ANRs, and manipulates application data on the go.

Pluto 550 Dec 27, 2022
Android QA/Debug tools to speed up and streamline the development progress.

Android Dev Tools is a library that contains various QA/Debug tools to speed up and streamline the development progress.

Trendyol Open Source 105 Dec 5, 2022
TSBattery a new way to save your battery avoid cancer apps hacker it.

TSBattery TSBattery a new way to save your battery avoid cancer apps hacker it. TSBattery 是一个旨在使 QQ、TIM 变得更省电的开源 Xposed 模块 Get startted 此模块支持原生 Xposed

Fankesyooni 375 Jan 2, 2023
Make your device sip only small amounts of battery when not in use.

trickle Make your device sip only small amounts of battery when not in use. What Automatically place your device into battery-saver mode when the scre

pyamsoft 3 Dec 21, 2022
A tiny Android app that can receive WhatsApp group message export files and parse message history stats.

A tiny Android app that can receive WhatsApp group message export files and parse message history stats.

Zac Sweers 2 May 3, 2022
A cryptocurrency data aggregator that tracks price, volume, social stats.

CryptoMania A cryptocurrency data aggregator that tracks price, volume, social stats. Challenge description Design & implement an Android application

Gabriel TEKOMBO 23 Aug 6, 2022