Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BBS grants all apps access to hidden APIs, not just itself #891

Open
djpohly opened this issue Jun 29, 2022 · 7 comments
Open

BBS grants all apps access to hidden APIs, not just itself #891

djpohly opened this issue Jun 29, 2022 · 7 comments

Comments

@djpohly
Copy link

djpohly commented Jun 29, 2022

BBS runs the following command to enable hidden APIs on rooted devices:

settings put global hidden_api_policy 1

which grants every app on the system access to hidden APIs.

A tighter approach, which could be done with a Magisk helper module, is to place a copy or stub of BBS in /system/app and add a file to /system/etc/sysconfig:

<?xml version="1.0" encoding="utf-8"?>
<config>
  <hidden-api-whitelisted-app package="com.asksven.betterbatterystats" />
  <hidden-api-whitelisted-app package="com.asksven.betterbatterystats_xdaedition" />
</config>

(The stub is needed because the sysconfig whitelist only applies to system apps.)

I've tested this on an AOSP12-based phone and am able to get full stats without setting the systemwide policy.

@djpohly
Copy link
Author

djpohly commented Jun 29, 2022

See module here: https://github.com/djpohly/magisk-bbs-hidden-apis.

@asksven
Copy link
Owner

asksven commented Jul 3, 2022

This is pretty neat! BBS used to have a feature to install itself as a system app (for rooted devices) so I guess I will try to re-instate this.

@djpohly
Copy link
Author

djpohly commented Jul 3, 2022

I remember those days!

You're welcome to adapt whatever you want of the module into the BBS repo if you'd like to make it an official feature. I don't know what is the most convenient way for an app to package a Magisk module, but I do see a magisk --install-module FILE.zip shell command that might be useful.

@furopi
Copy link

furopi commented Oct 8, 2022

See module here: https://github.com/djpohly/magisk-bbs-hidden-apis.

Great work, ty! 😀

@xxtecraxx
Copy link

See module here: https://github.com/djpohly/magisk-bbs-hidden-apis.

forgive my ignorance but do we install this from magisk as a module?

just installed BBS on rooted cheetah p7p

@djpohly
Copy link
Author

djpohly commented Oct 31, 2022

@xxtecraxx Yes, it's a Magisk module that specifically adds BBS to the list of apps allowed to use hidden APIs, as opposed to disabling the restriction globally (which grants access for all system apps). You can download the ZIP on the releases page and install it via Magisk Manager.

@xxtecraxx xxtecraxx mentioned this issue Nov 1, 2022
@xxtecraxx
Copy link

@djpohly thank you for rapid response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants