Android SU权限IOException

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?\" >/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 -or,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); } } 

所以这是一段代码,应该将应用程序从/ system / app替换为备份文件夹,然后它应该将通过DM API下载的副本替换为/ system / app。 一切都很完美,直到应用程序开始要求SU权限。 正如您所看到的,我在exception的情况下放置了一些错误字符串以使调试更容易,并且它似乎有一个IOexception(status_error_3)。 我的代码出了什么问题?

UPD:SU成功请求授予我的应用程序权限,因此它应该可以工作,但事实并非如此。

提前致谢!