How Execute My Own Binary in Kid App?

75 views
Skip to first unread message

whitedavidp

unread,
Mar 28, 2022, 12:53:33 PM3/28/22
to Tasker

I have done this sort of thing inside of my own java apps before (and I know it is no permitted on Android >=10 unless the target build is < Android 10). But I want to do this from a Tasker kid app and I think the basics are there given the info see here for loading the binary as a resource.

To test this, I have installed my app, used a rooted file manager to copy a busybox executable into the app's "home folder" under /data/data, checked the permissions + owner, and then from the app run a shell command /data/data/kid_app_pkg_name/busybox without root.

I always get permission denied. If I use root, it runs fine. So I suspect the issue is permission somewhere in the directory tree using the fully qualified path to the busybox executable.

I checked to see what the home directory is set to in the shell executed by Tasker and it seems to be / on my phone. So does anyone know of a way to execute this busybox from within Tasker? Perhaps it can be done using Java? I have not looked into that yet.

Thanks

whitedavidp

unread,
Mar 28, 2022, 1:47:00 PM3/28/22
to Tasker
As a follow-up, I decided to try using Java code as shown here (within Tasker itself):

    Task: Prograde Test
   
    A1: Variable Set [
         Name: %binary
         To: /data/data/net.dinglisch.android.taskerm/files/busybox
         Max Rounding Digits: 3 ]
   
    A2: Java Function [
         Return: runtime
         Class Or Object: Runtime
         Function: getRuntime
         {Runtime} () ]
   
    A3: Java Function [
         Return: process
         Class Or Object: (Runtime) runtime
         Function: exec
         {Process} (String)
         Param 1 (String): %binary ]
   
    A4: Java Function [
         Return: input_stream
         Class Or Object: (Process)process
         Function: getInputStream
         {InputStream} () ]
   
    A5: Java Function [
         Return: data_input_stream
         Class Or Object: DataInputStream
         Function: new
         {DataInputStream} (InputStream)
         Param 1 (InputStream): (InputStream)input_stream ]
   
    A6: Java Function [
         Return: %results
         Class Or Object: (DataInputStream)data_input_stream
         Function: readLine
         {String} () ]
   
    A7: Flash [
         Text: %results
         Long: On
         Continue Task Immediately: On
         Dismiss On Click: On ]
      
It seems that this too ends in a permission error.Clipboard01.png

whitedavidp

unread,
Mar 29, 2022, 3:50:29 PM3/29/22
to Tasker
Ah, I have stumbled into the answer(s):

1. Of course it doesn't work in Tasker itself because Tasker's target API is already at 30.

2. In my kid app, if I keep the target API at 28 I can do this. But I must first change directory to the location where the binary is installed and only then execute the binary.

Interesting...
Reply all
Reply to author
Forward
0 new messages