iMX8QM Android Automotive OS Root Permission Error

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

iMX8QM Android Automotive OS Root Permission Error

1,012 次查看
cbl
Contributor V

Hello,

I compiled Android Automotive OS 10 with userdebug build option for NXP iMX8QM.

I need to give root privileges by running the "su" command from within the APK that I developed with Android Studio.

public static void sudo(String... strings) {
        try {
            Process su = Runtime.getRuntime().exec("su");
            DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());

            for (String s : strings) {
                outputStream.writeBytes(s + "\n");
                outputStream.flush();
            }

            outputStream.writeBytes("exit\n");
            outputStream.flush();
            try {
                su.waitFor();
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            outputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

 

I am using the code block below to do this. But I get the error "W/System.err: java.io.IOException: Cannot run program "su": error=13, Permission denied".

What should I do in this situation, could you please help me this issue?

Best regards,

Efecan

 

 

 

0 项奖励
回复
2 回复数

990 次查看
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Looks like the problem is in the host setup for su, the password of the BSP is "root".

Regards

0 项奖励
回复

987 次查看
cbl
Contributor V

Hi @Bio_TICFSL,

When I run the "su" command from the console of Android Automotive OS, I become root.

I want to do this with the APK I developed, but I can't.

As I said above, when I send the "su" command from within the APK, I get a "permission denied" error in the Android Studio console.

Best regards,

Efecan

0 项奖励
回复