private void RunAsRooter()
{
try {
Process process = Runtime.getRuntime().exec("su");
process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
private void CopyAppToSystem() throws IOException
{
Process process = Runtime.getRuntime().exec("su");
DataOutputStream out = new DataOutputStream(process.getOutputStream());
out.writeBytes("mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system\n");
out.writeBytes("cat /sdcard/myApp.adk > /system/app/myApp.adk\n");
out.writeBytes("mount -o remount,ro -t yaffs2 /dev/block/mtdblock3 /system\n");
out.writeBytes("exit\n");
out.flush();
try {
process.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
]
//关机方法
private void shutDown(){
Intent intent = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN");
intent.putExtra("android.intent.extra.KEY_CONFIRM", false);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
网友评论