load ro.recovery_id property from recovery partition
Change-Id: I9dc1f325e353375d9c1c8ed949636e2404601076
diff --git a/init/util.cpp b/init/util.cpp
index 20ce806..d6fd0fc 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -36,6 +36,7 @@
/* for ANDROID_SOCKET_* */
#include <cutils/sockets.h>
+#include <base/stringprintf.h>
#include <private/android_filesystem_config.h>
@@ -464,3 +465,14 @@
{
return selinux_android_restorecon(pathname, SELINUX_ANDROID_RESTORECON_RECURSE);
}
+
+/*
+ * Writes hex_len hex characters (1/2 byte) to hex from bytes.
+ */
+std::string bytes_to_hex(const uint8_t* bytes, size_t bytes_len) {
+ std::string hex("0x");
+ for (size_t i = 0; i < bytes_len; i++)
+ android::base::StringAppendF(&hex, "%02x", bytes[i]);
+ return hex;
+}
+