Merge "init: delete code that sets ro.recovery_id" am: 8a5943b37d
am: 9684bccca1
Change-Id: I98d9a632a2274aa5be2b9e3c7d4e848425bacb07
diff --git a/init/property_service.cpp b/init/property_service.cpp
index 3199d45..91b7ddd 100644
--- a/init/property_service.cpp
+++ b/init/property_service.cpp
@@ -49,8 +49,6 @@
#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
-#include <bootimg.h>
-#include <fs_mgr.h>
#include <property_info_parser/property_info_parser.h>
#include <property_info_serializer/property_info_serializer.h>
#include <selinux/android.h>
@@ -79,8 +77,6 @@
using android::properties::PropertyInfoAreaFile;
using android::properties::PropertyInfoEntry;
-#define RECOVERY_MOUNT_POINT "/recovery"
-
namespace android {
namespace init {
@@ -732,37 +728,6 @@
property_set("ro.persistent_properties.ready", "true");
}
-void load_recovery_id_prop() {
- std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> fstab(fs_mgr_read_fstab_default(),
- fs_mgr_free_fstab);
- if (!fstab) {
- PLOG(ERROR) << "unable to read default fstab";
- return;
- }
-
- fstab_rec* rec = fs_mgr_get_entry_for_mount_point(fstab.get(), RECOVERY_MOUNT_POINT);
- if (rec == NULL) {
- LOG(ERROR) << "/recovery not specified in fstab";
- return;
- }
-
- int fd = open(rec->blk_device, O_RDONLY | O_CLOEXEC);
- if (fd == -1) {
- PLOG(ERROR) << "error opening block device " << rec->blk_device;
- return;
- }
-
- boot_img_hdr hdr;
- if (android::base::ReadFully(fd, &hdr, sizeof(hdr))) {
- std::string hex = bytes_to_hex(reinterpret_cast<uint8_t*>(hdr.id), sizeof(hdr.id));
- property_set("ro.recovery_id", hex);
- } else {
- PLOG(ERROR) << "error reading /recovery";
- }
-
- close(fd);
-}
-
void property_load_boot_defaults() {
// TODO(b/117892318): merge prop.default and build.prop files into one
// TODO(b/122864654): read the prop files from all partitions and then
@@ -783,7 +748,6 @@
load_properties_from_file("/odm/build.prop", NULL);
load_properties_from_file("/vendor/build.prop", NULL);
load_properties_from_file("/factory/factory.prop", "ro.*");
- load_recovery_id_prop();
update_sys_usb_config();
}
diff --git a/init/util.cpp b/init/util.cpp
index 3781141..80fb03d 100644
--- a/init/util.cpp
+++ b/init/util.cpp
@@ -34,7 +34,6 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
-#include <android-base/stringprintf.h>
#include <android-base/strings.h>
#include <android-base/unique_fd.h>
#include <cutils/sockets.h>
@@ -269,16 +268,6 @@
}
/*
- * 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;
-}
-
-/*
* Returns true is pathname is a directory
*/
bool is_dir(const char* pathname) {
diff --git a/init/util.h b/init/util.h
index 53f4547..2b57910 100644
--- a/init/util.h
+++ b/init/util.h
@@ -51,7 +51,6 @@
void import_kernel_cmdline(bool in_qemu,
const std::function<void(const std::string&, const std::string&, bool)>&);
bool make_dir(const std::string& path, mode_t mode);
-std::string bytes_to_hex(const uint8_t *bytes, size_t bytes_len);
bool is_dir(const char* pathname);
bool expand_props(const std::string& src, std::string* dst);