Regarding raising rights for a modified application.
What is the essence of the problems? Initially, from the factory, the oscilloscope application - Sparrow.app - was signed by Rigol with the same key with which he signed the Android kernel when assembling it. This allows the application to run under the sysytem account and gives it privileged access to system resources and system API calls. For example, some API calls require such privileged access during the screenshot process. But we don’t know this key, so we have no way to sign the application with it after modification. Because of this, our application runs under the account of an ordinary user and the system denies access to some API calls when taking a screenshot. Our modified application can't take screenshots, yeah. Perhaps there are similar restrictions in some other areas, but I only noticed this.
But I found a description of a workaround online, available if you have root access to the system, and we have it
The point of this workaround is to place the application in
/system/priv-app. Applications located in this directory are automatically considered trusted and receive privileged access, almost the same as applications running under the
system account (and maybe completely the same, I don’t fully understand this).
To do this, we first need to install the application in the usual way, so that during installation a .odex file is created for our application in the
/data/app directory (in its own subdirectory, separate for each application, in our case it will be
/data/app/com.rigol.scope-1).
Further:
- Stop the work of the com.rigol.launcher application first, and then com.rigol.scope.
- In the /system/priv-app directory we create a directory with the file name of our application, in our case it is /system/priv-app/Sparrow.
- Copy the lib and oat subdirectories with all contents into it from the /data/app/com.rigol.scope-1 directory, recursively including nested subdirectories.
- Copy the file of our modified application - Sparrow.apk - into the same directory (it must be written in advance from the PC somewhere accessible on the oscilloscope, for example in /rigol/data).
- Assign attributes 755 (rwxr-xr-x) to the /system/priv-app/Sparrow directory and all its contents at full depth recursively. I'm actually not sure if this step is necessary, but I was having some kind of glitch until I assigned these attributes. Maybe it was a coincidence.
- Completely delete the /data/app/com.rigol.scope-1 directory with all its contents.
- Reboot the oscilloscope.
That's it, now our application, although it still runs under the account of a regular user, becomes trusted and has privileged access to system APIs. And it can take screenshots again
When updating our application after the next modification, we will need to repeat all this. So I'm thinking of writing a script with all these actions and putting it in
/rigol/data. During the next update after the standard installation process, simply drop a new application file into
/rigol/data and run this script there, which will do everything necessary. But while we haven’t gotten around to it yet, we need to check a couple more points and test such an installation using a script.