@@ -1704,44 +1704,50 @@ private void handleBootCompletedLocked() {
17041704 }
17051705
17061706 /**
1707- * Reboot the device, passing 'reason' (may be null)
1708- * to the underlying __reboot system call. Should not return.
1707+ * Reboots the device.
1708+ *
1709+ * @param confirm If true, shows a reboot confirmation dialog.
1710+ * @param reason The reason for the reboot, or null if none.
1711+ * @param wait If true, this call waits for the reboot to complete and does not return.
17091712 */
17101713 @ Override // Binder call
17111714 public void reboot (boolean confirm , String reason , boolean wait ) {
17121715 mContext .enforceCallingOrSelfPermission (android .Manifest .permission .REBOOT , null );
17131716
17141717 final long ident = Binder .clearCallingIdentity ();
17151718 try {
1716- rebootInternal (false , confirm , reason , wait );
1719+ shutdownOrRebootInternal (false , confirm , reason , wait );
17171720 } finally {
17181721 Binder .restoreCallingIdentity (ident );
17191722 }
17201723 }
17211724
17221725 /**
1723- * Shutdown the devic, passing 'reason' (may be null)
1724- * to the underlying __reboot system call. Should not return.
1726+ * Shuts down the device.
1727+ *
1728+ * @param confirm If true, shows a shutdown confirmation dialog.
1729+ * @param wait If true, this call waits for the shutdown to complete and does not return.
17251730 */
17261731 @ Override // Binder call
17271732 public void shutdown (boolean confirm , boolean wait ) {
17281733 mContext .enforceCallingOrSelfPermission (android .Manifest .permission .REBOOT , null );
17291734
17301735 final long ident = Binder .clearCallingIdentity ();
17311736 try {
1732- rebootInternal (true , confirm , null , wait );
1737+ shutdownOrRebootInternal (true , confirm , null , wait );
17331738 } finally {
17341739 Binder .restoreCallingIdentity (ident );
17351740 }
17361741 }
17371742
1738- private void rebootInternal (final boolean shutdown , final boolean confirm ,
1743+ private void shutdownOrRebootInternal (final boolean shutdown , final boolean confirm ,
17391744 final String reason , boolean wait ) {
17401745 if (mHandler == null || !mSystemReady ) {
1741- throw new IllegalStateException ("Too early to call reboot()" );
1746+ throw new IllegalStateException ("Too early to call shutdown() or reboot()" );
17421747 }
17431748
17441749 Runnable runnable = new Runnable () {
1750+ @ Override
17451751 public void run () {
17461752 synchronized (this ) {
17471753 if (shutdown ) {
@@ -1789,6 +1795,7 @@ public void crash(String message) {
17891795
17901796 private void crashInternal (final String message ) {
17911797 Thread t = new Thread ("PowerManagerService.crash()" ) {
1798+ @ Override
17921799 public void run () {
17931800 throw new RuntimeException (message );
17941801 }
0 commit comments