Uncategorized

I bought a used Pixel 7 Pro recently and thought it was a shame that Google’s battery health feature hasn’t been released.

I bought a used Pixel 7 Pro recently and thought it was a shame that Google’s battery health feature hasn’t been released.

It’d be nice to see how many charge cycles it’s had or the estimated % of its original capacity. Fortunately, Google’s made it possible in Android 14!

A few days back, I commented on some new BatteryManager APIs Google added in Android 14. Two of the APIs (cycle count & charging status) are public while the rest (manufacturing date, date of first use, charging policy, state of health) are system APIs.

Taking a deeper look, though, and it seems like the new system APIs can be called by any app that holds the BATTERY_STATS permission. This is a signature|privileged|development permission; “development” permissions can be granted to non-system apps through the ‘pm grant’ command!

Using that knowledge, developer

@thegreatporg whipped up a quick proof-of-concept battery health app that uses these new Android 14 APIs. Their app, Batt, is open source and available to download from GitLab. If you have a phone running Android 14 and want to see its battery health stats, try this app out!

Just install it and then run pm grant com.porg.batt android.permission.BATTERY_STATS (or install with the -g flag), or use Shizuku to have the app grant itself the permission.

Fair warning, though: I don’t know how accurate the stats will be. The app just reports what the APIs return, which in turn depends on whether the stats are actually tracked by the charging IC and whether the HAL supports this feature. In other words, YMMV.

When Google inevitably releases its own battery health feature (hopefully baked directly into the Settings app!), then this app won’t be necessary.

As an alternative, Tasker by João Dias is also adding these battery health stats. You’ll be able to get them through the “Get Battery Info” action in case you want to run some automations based on this info.

Leave a comment