From 2c52639d01cb2ff9f0a805e0dda72d39a5487d88 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Thu, 3 May 2018 23:01:13 -0700 Subject: Move reboot() from common.h into otautil/sysutil.h. This breaks the dependency on common.h (which belongs to recovery/librecovery) from librecovery_ui. reboot() is now owned by libotautil, which is expected to be a leaf node to be depended on. With the change, recovery and updater also share the same reboot() code now. Test: mmma -j bootable/recovery Change-Id: I1cc5d702cfe49302048db33d31c9c87ddc97ac71 --- otautil/sysutil.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'otautil/sysutil.cpp') diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp index e6385c4e9..ab1513088 100644 --- a/otautil/sysutil.cpp +++ b/otautil/sysutil.cpp @@ -28,8 +28,10 @@ #include #include +#include #include #include +#include bool MemMapping::MapFD(int fd) { struct stat sb; @@ -201,3 +203,11 @@ MemMapping::~MemMapping() { }; ranges_.clear(); } + +bool reboot(const std::string& command) { + std::string cmd = command; + if (android::base::GetBoolProperty("ro.boot.quiescent", false)) { + cmd += ",quiescent"; + } + return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); +} -- cgit v1.2.3