MCPcopy Create free account
hub / github.com/afkT/DevUtils / shutdown

Method shutdown

lib/DevApp/src/main/java/dev/utils/app/ADBUtils.java:1727–1737  ·  view source on GitHub ↗

关机 ( 需要 root 权限 ) @return true success, false fail

()

Source from the content-addressed store, hash-verified

1725 * @return {@code true} success, {@code false} fail
1726 */
1727 public static boolean shutdown() {
1728 try {
1729 ShellUtils.execCmd("reboot -p", true);
1730 Intent intent = new Intent("android.intent.action.ACTION_REQUEST_SHUTDOWN");
1731 intent.putExtra("android.intent.extra.KEY_CONFIRM", false);
1732 return AppUtils.startActivity(intent);
1733 } catch (Exception e) {
1734 LogPrintUtils.eTag(TAG, e, "shutdown");
1735 }
1736 return false;
1737 }
1738
1739 /**
1740 * 重启设备 ( 需要 root 权限 )

Callers 1

shutdownMethod · 0.95

Calls 3

execCmdMethod · 0.95
startActivityMethod · 0.95
eTagMethod · 0.95

Tested by

no test coverage detected