summaryrefslogtreecommitdiffstats
path: root/otautil
diff options
context:
space:
mode:
Diffstat (limited to 'otautil')
-rw-r--r--otautil/Android.bp7
-rw-r--r--otautil/dirutil.cpp (renamed from otautil/DirUtil.cpp)2
-rw-r--r--otautil/include/otautil/dirutil.h (renamed from otautil/include/otautil/DirUtil.h)0
-rw-r--r--otautil/include/otautil/sysutil.h (renamed from otautil/include/otautil/SysUtil.h)4
-rw-r--r--otautil/include/otautil/thermalutil.h (renamed from otautil/include/otautil/ThermalUtil.h)0
-rw-r--r--otautil/sysutil.cpp (renamed from otautil/SysUtil.cpp)12
-rw-r--r--otautil/thermalutil.cpp (renamed from otautil/ThermalUtil.cpp)2
7 files changed, 21 insertions, 6 deletions
diff --git a/otautil/Android.bp b/otautil/Android.bp
index 572d8df86..b058f7b35 100644
--- a/otautil/Android.bp
+++ b/otautil/Android.bp
@@ -40,14 +40,15 @@ cc_library_static {
target: {
android: {
srcs: [
- "DirUtil.cpp",
- "SysUtil.cpp",
- "ThermalUtil.cpp",
+ "dirutil.cpp",
"mounts.cpp",
+ "sysutil.cpp",
+ "thermalutil.cpp",
],
static_libs: [
"libselinux",
+ "libcutils",
],
},
},
diff --git a/otautil/DirUtil.cpp b/otautil/dirutil.cpp
index 61c832813..ae1cd5c28 100644
--- a/otautil/DirUtil.cpp
+++ b/otautil/dirutil.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/DirUtil.h"
+#include "otautil/dirutil.h"
#include <dirent.h>
#include <errno.h>
diff --git a/otautil/include/otautil/DirUtil.h b/otautil/include/otautil/dirutil.h
index 85d6c16d1..85d6c16d1 100644
--- a/otautil/include/otautil/DirUtil.h
+++ b/otautil/include/otautil/dirutil.h
diff --git a/otautil/include/otautil/SysUtil.h b/otautil/include/otautil/sysutil.h
index 52f6d20a7..649f8ffae 100644
--- a/otautil/include/otautil/SysUtil.h
+++ b/otautil/include/otautil/sysutil.h
@@ -50,4 +50,8 @@ 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);
+
#endif // _OTAUTIL_SYSUTIL
diff --git a/otautil/include/otautil/ThermalUtil.h b/otautil/include/otautil/thermalutil.h
index 43ab55940..43ab55940 100644
--- a/otautil/include/otautil/ThermalUtil.h
+++ b/otautil/include/otautil/thermalutil.h
diff --git a/otautil/SysUtil.cpp b/otautil/sysutil.cpp
index 48336ad07..ab1513088 100644
--- a/otautil/SysUtil.cpp
+++ b/otautil/sysutil.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/SysUtil.h"
+#include "otautil/sysutil.h"
#include <errno.h> // TEMP_FAILURE_RETRY
#include <fcntl.h>
@@ -28,8 +28,10 @@
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/properties.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
+#include <cutils/android_reboot.h>
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);
+}
diff --git a/otautil/ThermalUtil.cpp b/otautil/thermalutil.cpp
index 5d9bd45c0..4660e057e 100644
--- a/otautil/ThermalUtil.cpp
+++ b/otautil/thermalutil.cpp
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include "otautil/ThermalUtil.h"
+#include "otautil/thermalutil.h"
#include <dirent.h>
#include <stdio.h>