summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-01-09 07:45:47 +0100
committerTao Bao <tbao@google.com>2017-01-13 21:08:34 +0100
commitefc35594dd2d0df9923877646863fe438cf5b316 (patch)
treee67d1332fe1116c8ffc7e111a6c3d5ef92f06dea /recovery.cpp
parentMerge changes from topic 'host_suffix_cleanup' (diff)
downloadandroid_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.tar
android_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.tar.gz
android_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.tar.bz2
android_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.tar.lz
android_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.tar.xz
android_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.tar.zst
android_bootable_recovery-efc35594dd2d0df9923877646863fe438cf5b316.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/recovery.cpp b/recovery.cpp
index fac241d63..25d3546e3 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -892,8 +892,8 @@ static bool check_wipe_package(size_t wipe_package_size) {
// Extract metadata
ZipArchiveHandle zip;
- int err = OpenArchiveFromMemory(reinterpret_cast<void*>(&wipe_package[0]),
- wipe_package.size(), "wipe_package", &zip);
+ int err = OpenArchiveFromMemory(static_cast<void*>(&wipe_package[0]), wipe_package.size(),
+ "wipe_package", &zip);
if (err != 0) {
LOG(ERROR) << "Can't open wipe package : " << ErrorCodeString(err);
return false;
@@ -916,13 +916,11 @@ static bool check_wipe_package(size_t wipe_package_size) {
ota_type_matched = true;
} else if (android::base::StartsWith(line, "pre-device=")) {
std::string device_type = line.substr(strlen("pre-device="));
- char real_device_type[PROPERTY_VALUE_MAX];
- property_get("ro.build.product", real_device_type, "");
+ std::string real_device_type = android::base::GetProperty("ro.build.product", "");
device_type_matched = (device_type == real_device_type);
} else if (android::base::StartsWith(line, "serialno=")) {
std::string serial_no = line.substr(strlen("serialno="));
- char real_serial_no[PROPERTY_VALUE_MAX];
- property_get("ro.serialno", real_serial_no, "");
+ std::string real_serial_no = android::base::GetProperty("ro.serialno", "");
has_serial_number = true;
serial_number_matched = (serial_no == real_serial_no);
}
@@ -1361,15 +1359,15 @@ static void set_retry_bootloader_message(int retry_count, int argc, char** argv)
}
static bool bootreason_in_blacklist() {
- char bootreason[PROPERTY_VALUE_MAX];
- if (property_get("ro.boot.bootreason", bootreason, nullptr) > 0) {
- for (const auto& str : bootreason_blacklist) {
- if (strcasecmp(str.c_str(), bootreason) == 0) {
- return true;
- }
- }
+ std::string bootreason = android::base::GetProperty("ro.boot.bootreason", "");
+ if (!bootreason.empty()) {
+ for (const auto& str : bootreason_blacklist) {
+ if (strcasecmp(str.c_str(), bootreason.c_str()) == 0) {
+ return true;
+ }
}
- return false;
+ }
+ return false;
}
static void log_failure_code(ErrorCode code, const char *update_package) {