Loading cmds/svc/src/com/android/commands/svc/PowerCommand.java +13 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.os.IPowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; public class PowerCommand extends Svc.Command { public PowerCommand() { Loading Loading @@ -87,7 +88,7 @@ public class PowerCommand extends Svc.Command { // no confirm, wait till device is rebooted pm.reboot(false, mode, true); } catch (RemoteException e) { System.err.println("Failed to reboot."); maybeLogRemoteException("Failed to reboot."); } return; } else if ("shutdown".equals(args[1])) { Loading @@ -95,7 +96,7 @@ public class PowerCommand extends Svc.Command { // no confirm, wait till device is off pm.shutdown(false, null, true); } catch (RemoteException e) { System.err.println("Failed to shutdown."); maybeLogRemoteException("Failed to shutdown."); } return; } Loading @@ -103,4 +104,14 @@ public class PowerCommand extends Svc.Command { } System.err.println(longHelp()); } // Check if remote exception is benign during shutdown. Pm can be killed // before system server during shutdown, so remote exception can be ignored // if it is already in shutdown flow. private void maybeLogRemoteException(String msg) { String powerProp = SystemProperties.get("sys.powerctl"); if (powerProp.isEmpty()) { System.err.println(msg); } } } Loading
cmds/svc/src/com/android/commands/svc/PowerCommand.java +13 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.os.IPowerManager; import android.os.RemoteException; import android.os.ServiceManager; import android.os.SystemClock; import android.os.SystemProperties; public class PowerCommand extends Svc.Command { public PowerCommand() { Loading Loading @@ -87,7 +88,7 @@ public class PowerCommand extends Svc.Command { // no confirm, wait till device is rebooted pm.reboot(false, mode, true); } catch (RemoteException e) { System.err.println("Failed to reboot."); maybeLogRemoteException("Failed to reboot."); } return; } else if ("shutdown".equals(args[1])) { Loading @@ -95,7 +96,7 @@ public class PowerCommand extends Svc.Command { // no confirm, wait till device is off pm.shutdown(false, null, true); } catch (RemoteException e) { System.err.println("Failed to shutdown."); maybeLogRemoteException("Failed to shutdown."); } return; } Loading @@ -103,4 +104,14 @@ public class PowerCommand extends Svc.Command { } System.err.println(longHelp()); } // Check if remote exception is benign during shutdown. Pm can be killed // before system server during shutdown, so remote exception can be ignored // if it is already in shutdown flow. private void maybeLogRemoteException(String msg) { String powerProp = SystemProperties.get("sys.powerctl"); if (powerProp.isEmpty()) { System.err.println(msg); } } }