重启
/**
* Reboot the device. Will not return if the reboot is successful.
* Requires the `android.Manifest.permission#REBOOT` permission.
* @param reason code to pass to the kernel (e.g., "recovery") to request special boot modes, or null.
*/
void PowerManager.reboot(String reason)
需要android.Manifest.permission#REBOOT权限
关机
Intent intent = new Intent(Intent.ACTION_REQUEST_SHUTDOWN);
intent.putExtra(Intent.EXTRA_KEY_CONFIRM, false);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivity(intent);