Single

高级重启代码

//关机代码
		try {
			Process p=Runtime.getRuntime().exec("su");
			DataOutputStream out=new DataOutputStream(p.getOutputStream());
			Runtime.getRuntime().exec("reboot -p");
			out.flush();
			p.waitFor();
		} catch (Exception e) {}

		//重启代码
		try {
			Process p=Runtime.getRuntime().exec("su");
			DataOutputStream out=new DataOutputStream(p.getOutputStream());
			Runtime.getRuntime().exec("reboot");
			out.flush();
			p.waitFor();
		} catch (Exception e) {}

		//重启Recovery
		try {
			Process p=Runtime.getRuntime().exec("su");
			DataOutputStream out=new DataOutputStream(p.getOutputStream());
			Runtime.getRuntime().exec("reboot recovery");
			out.flush();
			p.waitFor();
		} catch (Exception e) {}
		
		//重启Bootloader
		try {
			Process p=Runtime.getRuntime().exec("su");
			DataOutputStream out=new DataOutputStream(p.getOutputStream());
			Runtime.getRuntime().exec("reboot bootloader");
			out.flush();
			p.waitFor();
		} catch (Exception e) {}

版权声明:本文为博主原创文章,转载请附上原文出处链接和本声明。
本文链接:https://www.aidemx.cn/?p=157

文章有(1)条网友点评

  • 谢谢大神分享

发表评论