summaryrefslogtreecommitdiffstats
path: root/otautil
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-05-05 11:37:34 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-05-05 11:37:34 +0200
commit1bc48e4463f25ac73c0e5c668d5bcefad18c7693 (patch)
treed1ca1805b021c8e7c19d33f0ccbc50d65f7a488a /otautil
parentSnap for 4762932 from 96106592a2cebb78cc7d2772376cd1caf34ce9a1 to qt-release (diff)
parentMerge changes I1cc5d702,I32ab9854 am: 420f7f8df4 am: c4ba6b738f (diff)
downloadandroid_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.tar
android_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.tar.gz
android_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.tar.bz2
android_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.tar.lz
android_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.tar.xz
android_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.tar.zst
android_bootable_recovery-1bc48e4463f25ac73c0e5c668d5bcefad18c7693.zip
Diffstat (limited to 'otautil')
-rw-r--r--otautil/Android.bp18
-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, 28 insertions, 10 deletions
diff --git a/otautil/Android.bp b/otautil/Android.bp
index 45d119cb5..b058f7b35 100644
--- a/otautil/Android.bp
+++ b/otautil/Android.bp
@@ -17,17 +17,13 @@ cc_library_static {
host_supported: true,
+ // Minimal set of files to support host build.
srcs: [
- "SysUtil.cpp",
- "DirUtil.cpp",
- "ThermalUtil.cpp",
- "mounts.cpp",
"paths.cpp",
"rangeset.cpp",
],
static_libs: [
- "libselinux",
"libbase",
],
@@ -42,9 +38,17 @@ cc_library_static {
],
target: {
- darwin: {
- exclude_srcs: [
+ android: {
+ srcs: [
+ "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>