Currently I'am working on an aplication via Android Studio, that executes commands using the next sintaxis:
Process p = Runtime.getRuntime().exec(new String[] { "su", "-c", "ip link show"});
I'am working with the device IMX7D_PICO (it uses Android Things as SO). It is rooted, as is shown in the following pic:
But, when I run a command as root on Android Studio, I get the next error:
W/System.err: java.io.IOException: Cannot run program "su": error=13, Permission denied
W/System.err: at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:692)
at java.lang.Runtime.exec(Runtime.java:560)
I don't know why su works only on adb. In other hand, I know that there are others ways to obtain the data of ip link show, but the next step, it's open a socket RAW with the command that I said. So, I need to run process as su via Android Studio.