From 91e3aee9bdc1a503affdd925dd4da352a198abca Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 23 Sep 2016 15:30:55 -0700 Subject: Switch to . Bug: http://b/23102347 Test: boot into recovery. Change-Id: Ib2ca560f1312961c21fbaa294bb068de19cb883e --- recovery.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'recovery.cpp') diff --git a/recovery.cpp b/recovery.cpp index d3f9c47ae..e0f5a2ee3 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -43,12 +43,13 @@ #include #include #include +#include #include #include #include #include #include -#include +#include /* for property_list */ #include #include /* private pmsg functions */ #include @@ -213,8 +214,7 @@ static void check_and_fclose(FILE *fp, const char *name) { } bool is_ro_debuggable() { - char value[PROPERTY_VALUE_MAX+1]; - return (property_get("ro.debuggable", value, NULL) == 1 && value[0] == '1'); + return android::base::GetBoolProperty("ro.debuggable", false); } static void redirect_stdio(const char* filename) { @@ -1264,15 +1264,12 @@ prompt_and_wait(Device* device, int status) { break; case Device::MOUNT_SYSTEM: - char system_root_image[PROPERTY_VALUE_MAX]; - property_get("ro.build.system_root_image", system_root_image, ""); - // For a system image built with the root directory (i.e. // system_root_image == "true"), we mount it to /system_root, and symlink /system // to /system_root/system to make adb shell work (the symlink is created through // the build system). // Bug: 22855115 - if (strcmp(system_root_image, "true") == 0) { + if (android::base::GetBoolProperty("ro.build.system_root_image", false)) { if (ensure_path_mounted_at("/", "/system_root") != -1) { ui->Print("Mounted /system.\n"); } @@ -1694,8 +1691,7 @@ int main(int argc, char **argv) { ui->Print("Retry attempt %d\n", retry_count); // Reboot and retry the update - int ret = property_set(ANDROID_RB_PROPERTY, "reboot,recovery"); - if (ret < 0) { + if (!android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,recovery")) { ui->Print("Reboot failed\n"); } else { while (true) { @@ -1775,17 +1771,17 @@ int main(int argc, char **argv) { switch (after) { case Device::SHUTDOWN: ui->Print("Shutting down...\n"); - property_set(ANDROID_RB_PROPERTY, "shutdown,"); + android::base::SetProperty(ANDROID_RB_PROPERTY, "shutdown,"); break; case Device::REBOOT_BOOTLOADER: ui->Print("Rebooting to bootloader...\n"); - property_set(ANDROID_RB_PROPERTY, "reboot,bootloader"); + android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,bootloader"); break; default: ui->Print("Rebooting...\n"); - property_set(ANDROID_RB_PROPERTY, "reboot,"); + android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,"); break; } while (true) { -- cgit v1.2.3