重启://发送广播
Intent reboot = new Intent(Intent.ACTION_REBOOT);
reboot.putExtra("nowait",1);
reboot.putExtra("interval",1);
reboot.putExtra("window",0);
sendBroadcast(reboot);
关机://启动 Activity
Intent shutdown = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
shutdown.putExtra(Intent.EXTRA_KEY_CONFIRM,showShutdownDialog);
shotdown.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(shutdown);