From 6f4e4db4f9e0911a07c6393d01e4380e844f7891 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Mon, 20 May 2019 10:36:16 -0700 Subject: recovery: report compliant reboot reason shutdown and reboot should have a corresponding sub-reason. Adding: "reboot,fastboot_menu" "reboot,recovery_menu" "reboot,recovery_ui" "shutdown,fastboot" "shutdown,recovery" "reboot,unknown#" Test: none Change-Id: Icf1ab0d462ec2de2272914a36994a095998d6186 --- otautil/include/otautil/sysutil.h | 4 ++-- otautil/sysutil.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'otautil') diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h index 48e9011e5..326db8644 100644 --- a/otautil/include/otautil/sysutil.h +++ b/otautil/include/otautil/sysutil.h @@ -102,11 +102,11 @@ class MemMapping { }; // Reboots the device into the specified target, by additionally handling quiescent reboot mode. -// 'target' can be an empty string, which indicates booting into Android. +// All unknown targets reboot into Android. bool Reboot(std::string_view target); // Triggers a shutdown. -bool Shutdown(); +bool Shutdown(std::string_view target); // Returns a null-terminated char* array, where the elements point to the C-strings in the given // vector, plus an additional nullptr at the end. This is a helper function that facilitates diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp index 420db4cac..a8829858d 100644 --- a/otautil/sysutil.cpp +++ b/otautil/sysutil.cpp @@ -229,9 +229,9 @@ bool Reboot(std::string_view target) { return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); } -bool Shutdown() { - // "shutdown" doesn't need a "reason" arg nor a comma. - return android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown"); +bool Shutdown(std::string_view target) { + std::string cmd = "shutdown," + std::string(target); + return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); } std::vector StringVectorToNullTerminatedArray(const std::vector& args) { -- cgit v1.2.3