diff options
author | Tao Bao <tbao@google.com> | 2019-04-29 23:53:41 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-04-29 23:53:41 +0200 |
commit | 189c8f9aebd99c2793f99ed8289cb86efda08261 (patch) | |
tree | c3b9c8facbf2b5cad17e39f8df138c2f8f837e94 /otautil/include | |
parent | Merge "Add install/wipe_device.cpp." (diff) | |
parent | Consolidate the codes that handle reboot/shutdown. (diff) | |
download | android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.tar android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.tar.gz android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.tar.bz2 android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.tar.lz android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.tar.xz android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.tar.zst android_bootable_recovery-189c8f9aebd99c2793f99ed8289cb86efda08261.zip |
Diffstat (limited to 'otautil/include')
-rw-r--r-- | otautil/include/otautil/sysutil.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/otautil/include/otautil/sysutil.h b/otautil/include/otautil/sysutil.h index 692a99e9d..48e9011e5 100644 --- a/otautil/include/otautil/sysutil.h +++ b/otautil/include/otautil/sysutil.h @@ -14,12 +14,12 @@ * limitations under the License. */ -#ifndef _OTAUTIL_SYSUTIL -#define _OTAUTIL_SYSUTIL +#pragma once #include <sys/types.h> #include <string> +#include <string_view> #include <vector> #include "rangeset.h" @@ -101,13 +101,14 @@ class MemMapping { std::vector<MappedRange> ranges_; }; -// Wrapper function to trigger a reboot, by additionally handling quiescent reboot mode. The -// command should start with "reboot," (e.g. "reboot,bootloader" or "reboot,"). -bool reboot(const std::string& command); +// Reboots the device into the specified target, by additionally handling quiescent reboot mode. +// 'target' can be an empty string, which indicates booting into Android. +bool Reboot(std::string_view target); + +// Triggers a shutdown. +bool Shutdown(); // 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 // calling C functions (such as getopt(3)) that expect an array of C-strings. std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args); - -#endif // _OTAUTIL_SYSUTIL |