Article 3 Superuser customization-Permission silent interception (the simplest solution for a long time), Article 3 superuser
I recently studied Supersuser in the evening. Apk permission control software. Of course, your own ideas and needs are simple:
1. can intercept any software permission requests
2. allow our own programs to have permissions. Other programs secretly request permissions and KIll them without responding.
At first, the request is a c-Layer Code because of the su super permission. When the application uses the following code to request the su
String cmd = String. format ("echo % s> % s \ n", arg, mSwitchUsbFileTextEdit. getText (). toString (); try {Process exeEcho = runtime.getruntime(.exe c ("su"); exeEcho. getOutputStream (). write (cmd. getBytes (); exeEcho. getOutputStream (). flush ();} catch (IOException e) {showMessage ("Excute exception:" + e. when getMessage ();} is used, su first checks whether Supersuser.apk is installed, if su is installed, a query database in sqlite3.c is called to check whether the application requesting the permission is permitted. After confirmation, the user ID of the application is sent to Supersuser through am to display the authorization interface.
That is, su ----------> Activity.
The previous idea was to modify su. c adds a sqlite3 database insertion method, but it is not very convenient to be unfamiliar with the c syntax and call and debugging between JNI, so it has been stranded.
This morning, I suddenly thought of adding an intermediate Service as an intermediate Service. The service is the background interface, so we can silently process the interception.
Specifically, if you need superuser.apk, You can synchronize the source code and compile it yourself. And NDK compilation su. c. Su and Superuser are well-known for their one-to-one correspondence.