Quantcast
Channel: xda-developers - Android Q&A, Help & Troubleshooting
Viewing all articles
Browse latest Browse all 18891

[Q] App development using su permission causes SuperSU problem with su binary file

$
0
0
Hello everyone,

An error related to SuperSU's su binary file occured when i try to run "mount" linux command through background sh process.

Everything is ok in the process of running su and a root permission is properly got by SuperSU, code is here:

Code:

Process process = (new ProcessBuilder("/system/bin/sh")).redirectErrorStream(true).start();

        BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));

        PrintWriter writer = new PringWriter(process.getOutputStream());

        writer.println("echo start");
   
        writer.println("su");

        writer.println("echo end");

        String res = null;

        while ((res = reader.readLine()) != null) {
            if (res.equals("end")) break;
        }

Of cause i run it in a sub thread and won't block the UI thread.

And in the click listener of a button i trigger the mount command in the similar process.

writer.println("toolbox mount -o rw,remount /system");

But when i successfully mount that path and return to SuperSU, the error occurs with no doult.

An error dialog will be poped up like this: There is no SU binary installed, and SuperSU cannot install it. This is a problem!

Any one have an idea that why running a single linux mount command can cause that problem? And how couldi do?

Viewing all articles
Browse latest Browse all 18891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>