高级重启代码

//关机代码
		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

梦雪

专注于AIDE教程分享

留下你的评论

*评论支持代码高亮<pre class="prettyprint linenums">代码</pre>

相关推荐