Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid SU permissions IOException
    primarykey
    data
    text
    <pre><code>if (DownloadManager.STATUS_SUCCESSFUL == c .getInt(columnIndex)) { mProgress.setProgress(70); mStatus.setText(R.string.status_backup); File dl_path = new File(DownloadManager.COLUMN_LOCAL_URI); File og_path = new File("/system/app/app.apk"); String bu_path = "/sdcard/asdfgsd/backup/app.apk"; Process p; try { // Preform su to get root privledges p = Runtime.getRuntime().exec("su"); // Attempt to write a file to a root-only DataOutputStream os = new DataOutputStream(p.getOutputStream()); os.writeBytes("echo \"Do I have root?\" &gt;/system/sd/temporary.txt\n"); // Close the terminal os.writeBytes("exit\n"); os.flush(); try { p.waitFor(); if (p.exitValue() != 255) { // Trying to remount system partition in read-write mode p.getOutputStream().write("mount -o r,remount -t yaffs2 /dev/block/mtdblock3 /system".getBytes()); if (og_path.renameTo(new File(bu_path))) { mProgress.setProgress(90); mStatus.setText(R.string.status_install); dl_path.renameTo(og_path); } else { mStatus.setText(R.string.status_error_1); } } } catch (InterruptedException e) { mStatus.setText(R.string.status_error_2); } } catch (IOException e) { mStatus.setText(R.string.status_error_3); } } </code></pre> <p>So this is a piece of code that should replace an app from /system/app to backup folder and then it should replace a copy downloaded via DM API to /system/app. Everything works perfect until app starts asking for SU permissions. As you can see, I put some error strings in case of exceptions to make debug easier, and it seems like it got an IO exception (status_error_3). What's wrong with my code?</p> <p>UPD: SU successfully asks for granting permissions to my app, so it should work but it doesn't. </p> <p>Thanks in advance!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload