RikkaApps/Shizuku-API

How to add fallback in case the calling to the reflected API fails?

Closed this issue · 8 comments

I hope I'm asking this in the correct place. Couldn't find a forum for this...

About my question, suppose you reach the PackageManager class function to disable some app.
If for some reason this API changes in some Android version, can I use Shizuku to call more official commands like on adb?

Meaning in adb it's :

adb shell pm disable PACKAGE_NAME

Is the same thing possible via Shizuku?

Use binder please, don't think about execute commands, or you lose the performance (speed) advantage.

android/content/pm/IPackageManager.aidl setApplicationEnabledSetting & getApplicationEnabledSetting

Such APIs usually do not change unless the API level changes, it's safe enough. Even if it really changes under the same API level, you just need to try catch and then try methods with different parameters.

https://github.com/RikkaW/HiddenApi checkout this lib to learn how to call system APIs, Shizuku itself and all my "magic" apps are using it.

I don't understand what is this other library. Or maybe it's a sample?
I don't mind about having a bit less performance in case some API can't work anymore or that I can't find an alternative to it in the hidden APIs.
I'm sure there are some adb commands that I can't find the equivalent using the binding mechanism.

It's not just about APIs that change. Some APIs can't be found, too.

For example, making some app have the NotificationListener permission:

"adb.exe" shell cmd notification allow_listener PACKAGE_NAME/FULL_PATH_TO_NotificationListener_CLASS

or enabling AccessibilityService :

"adb.exe" shell settings put secure enabled_accessibility_services PACKAGE_NAME/FULL_PATH_TO_AccessibilityService_CLASS

I don't think I can find such things here.

There are even some adb commands that I don't know if they exist, such as setting an app as default callerID/Phone-app or any other default app. Or live wallpaper app, etc...
Maybe there is one for setting an app to be admin, too.

What is behind the commands are these APIs. Executing the command is just a downgrade.

If you want to execute commands, you can do it yourself. Shizuku provides UserService function that allows you to run any Java and native codes, of course including execute commands.

Learn how to use cs.android.com pls, you can find anything :)

Are you sure every adb command has an equivalent in the framework?
Even those that I've mentioned?

Commands finally go "aidl" APIs.

Stop asking mindless questions, use cs.android.com to check source codes pls

If you want to play with adb or root magic, checking the source code is an extremely basic skill. This is quite different from normal development.
x_x

I prefer to have both solutions if possible.
When something is documented it has a better chance of working for a very long time.
adb should be more trusted.