summaryrefslogtreecommitdiffstats
path: root/recovery.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2017-01-14 16:43:10 +0100
committerandroid-build-merger <android-build-merger@google.com>2017-01-14 16:43:10 +0100
commit81bffbda89b425e22e944e3aad187d5fe1b7193b (patch)
treeda2cdb6210afe1b5895156e0de5d5ef0a5bfb124 /recovery.cpp
parentMerge "Update background text images in recovery" am: f0af02fea6 (diff)
parentMerge "recovery: Move property_get() to android::base::GetProperty()." (diff)
downloadandroid_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.tar
android_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.tar.gz
android_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.tar.bz2
android_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.tar.lz
android_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.tar.xz
android_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.tar.zst
android_bootable_recovery-81bffbda89b425e22e944e3aad187d5fe1b7193b.zip
Diffstat (limited to 'recovery.cpp')
-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) {