Android 如何向fileinputstream对象授予超级用户权限并读取根设备上的所有系统文件

Android 如何向fileinputstream对象授予超级用户权限并读取根设备上的所有系统文件,android,Android,我有一个根设备,我正在尝试使用FileInputStream从特定文件夹/SD卡/视频读取文件,并成功为该文件夹创建了校验和值,现在,我想读取系统文件夹中的所有文件,并为其创建校验和值,但当我通过文件夹路径(即/system)时,我无法读取少数文件,并出现以下错误: java.io.FileNotFoundException: system/bin/run-as: open failed: EACCES (Permission denied) 如何克服这个问题,如何授予超级用户权限或根用户访

我有一个根设备,我正在尝试使用FileInputStream从特定文件夹/SD卡/视频读取文件,并成功为该文件夹创建了校验和值,现在,我想读取系统文件夹中的所有文件,并为其创建校验和值,但当我通过文件夹路径(即/system)时,我无法读取少数文件,并出现以下错误:

 java.io.FileNotFoundException: system/bin/run-as: open failed: EACCES (Permission denied)
如何克服这个问题,如何授予超级用户权限或根用户访问权限来读取所有与系统相关的文件

简化:在根设备上使用fileinputstream以编程方式从SD卡/系统文件夹读取文件

 Process p = Runtime.getRuntime().exec(new String[]{"su", "-c", "system/bin/sh"});
DataOutputStream stdin = new DataOutputStream(p.getOutputStream());
//from here all commands are executed with su permissions
stdin.writeBytes("md5sum filepath"); 
   /* executes the md5sum binary command,replace with installation path of md5sum after you install busybox */
InputStream stdout = p.getInputStream();
byte[] buffer = new byte[BUFF_LEN];
int read;
String out = new String();
//read method will wait forever if there is nothing in the stream
//so we need to read it in another way than while((read=stdout.read(buffer))>0)
while(true){
    read = stdout.read(buffer);
    out += new String(buffer, 0, read);
    if(read<BUFF_LEN){
        //we have read everything
        break;
    }
}
processp=Runtime.getRuntime().exec(新字符串[]{“su”、“-c”、“system/bin/sh”});
DataOutputStream stdin=新的DataOutputStream(p.getOutputStream());
//从这里开始,所有命令都以su权限执行
标准写入字节(“md5sum文件路径”);
/*执行md5sum二进制命令,在安装busybox后替换为md5sum的安装路径*/
InputStream stdout=p.getInputStream();
字节[]缓冲区=新字节[BUFF_LEN];
int-read;
String out=新字符串();
//如果流中没有任何内容,read方法将永远等待
//所以我们需要用另一种方式来读取它,而不是while((read=stdout.read(buffer))>0)
while(true){
read=stdout.read(缓冲区);
out+=新字符串(缓冲区,0,读取);

if(read)没有不复制的方法,因为我每五分钟执行一次此操作,并将校验和值发送到服务器,所以我想这不是一个好主意