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

Bind system service as root? #15

Open
Mygod opened this issue Jun 16, 2020 · 3 comments
Open

Bind system service as root? #15

Mygod opened this issue Jun 16, 2020 · 3 comments

Comments

@Mygod
Copy link

Mygod commented Jun 16, 2020

When I attempt to bind it I encountered the exception:

            throw new SecurityException(
                    "Unable to find app for caller " + caller
                    + " (pid=" + Binder.getCallingPid()
                    + ") when binding service " + service);
@Chainfire
Copy link
Owner

Many service check if your app is registered by PID. As you're not actually running an app, that doesn't work. Some services can be reached via reflection (see Reflection.java in librootjava sources). For some services you can get to the base AIDL, get the Binder object from ServiceManager (again reflection).

It can be very tricky to get things to work this way, but I usually manage to get what I need. It usually requires diving into Android source code to figure out exactly what you need, though, and some things just aren't possible. Even if you the service object, specific interface calls may still trigger the error you quoted.

@Mygod
Copy link
Author

Mygod commented Jun 17, 2020

Thank you! I saw that you used ActivityManagerNative to send broadcast. I will look into that later.

@Mygod
Copy link
Author

Mygod commented Jun 17, 2020

It looks like this class is deprecated now and soon to be removed according to doc. The method broadcastIntent is already removed in master. :( Never mind sorry!

Still hits the same exception. :/

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

2 participants