android执行shell 组件源码 v1.0
本帖最后由 djwdj 于 2017-12-16 20:13 编辑public String su(String su){
String s=;
try{
java.lang.Process p = Runtime.getRuntime().exec("su");
BufferedWriter w = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
w.write(su+"\nexit\n");
w.flush();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
StringBuilder i = new StringBuilder();
while (( s= r.readLine()) != null)
{
i.append(s+"\n");
}
r.close();
w.close();
p.destroy();
s=i.toString().trim();
}catch (IOException e){}
return s;
} 哈 这是个啥 Seven_2017 发表于 2017-12-16 15:22
哈 这是个啥
android开发 执行shell时调用的组件
页:
[1]