关于这个问题的一个早期问题解释说,你可以要求适当重启权限,但该操作系统可能会取消它。我想一个植根手机上设备管理应用程序执行在如关闭最大密码尝试失败,而不是数据擦除。因为这是一个安全问题,有关关机/重启不是通过电源管理提供的强大的保障将是很好的。
An earlier question on the subject explains that you can request a reboot with proper permissions, but that the OS may cancel it. I would like a Device Administration application on a rooted phone to perform a shutdown on e.g. maximum failed password attempts, rather than data wipe. Because this is a security issue, stronger guarantees about the shutdown/reboot than those provided by PowerManager would be nice.
我以前在这里的答案是:Android 2.2:重新启动设备编程
I answered it before here: Android 2.2: Reboot device programmatically
在短,
try {
Runtime.getRuntime().exec("su");
Runtime.getRuntime().exec("reboot");
} catch (IOException e) {
}
这相当于做亚行重新启动
。它的效果是立竿见影的。
It is equivalent to do adb reboot
. Its effect is immediate.