Process Process=null;
BufferedReader reader=null;
InputStreamReader is=null;
DataOutputStream OS=null;
Try {
The process=Runtime. GetRuntime (). The exec (" su ");
Is=new InputStreamReader (process. GetInputStream ());
Reader=new BufferedReader (is);
OS=new DataOutputStream (process. GetOutputStream ());
OS. WriteBytes (" mount -o rw, remount/system \ n ");
OS. The flush ();
OS. WriteBytes (" cp/sdcard/test/system/app/yry. The apk \ n ");
OS. The flush ();
OS. WriteBytes (" chmod 644./system/app/yry apk \ n ");
OS. The flush ();
OS. WriteBytes (" exit \ n ");
OS. The flush ();
Int read;
Char [] buffer=new char [4096].
The StringBuilder output=new StringBuilder ();
While ((read=reader. Read (buffer)) & gt; 0 {
Output. Append (buffer, 0, read);
}
Process. The waitFor ();
Return the output. The toString ();
} the catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
} the finally {
Try {
if (os !=null) {
os.close();
}
If (reader!=null) {
Reader. The close ();
}
If (is!=null) {
Is the close ();
}
If (the process!=null) {
Process. The destroy ();
}
} the catch (IOException e) {
e.printStackTrace();
}
}
}

CodePudding user response:
Mobile phones have root, these commands in MT manager I use can perform is written in my shell no effect if the SHLL I wrote