Loading adb_install.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -26,13 +26,14 @@ #include <fcntl.h> #include "ui.h" #include "cutils/properties.h" #include "install.h" #include "common.h" #include "adb_install.h" #include "minadbd/fuse_adb_provider.h" #include "fuse_sideload.h" #include <android-base/properties.h> static void set_usb_driver(RecoveryUI* ui, bool enabled) { int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY); if (fd < 0) { Loading @@ -49,7 +50,7 @@ static void set_usb_driver(RecoveryUI* ui, bool enabled) { static void stop_adbd(RecoveryUI* ui) { ui->Print("Stopping adbd...\n"); property_set("ctl.stop", "adbd"); android::base::SetProperty("ctl.stop", "adbd"); set_usb_driver(ui, false); } Loading @@ -57,7 +58,7 @@ static void maybe_restart_adbd(RecoveryUI* ui) { if (is_ro_debuggable()) { ui->Print("Restarting adbd...\n"); set_usb_driver(ui, true); property_set("ctl.start", "adbd"); android::base::SetProperty("ctl.start", "adbd"); } } Loading bootloader_message/bootloader_message.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -19,25 +19,24 @@ #include <errno.h> #include <fcntl.h> #include <string.h> #include <sys/system_properties.h> #include <string> #include <vector> #include <android-base/file.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/unique_fd.h> #include <fs_mgr.h> static struct fstab* read_fstab(std::string* err) { // The fstab path is always "/fstab.${ro.hardware}". std::string fstab_path = "/fstab."; char value[PROP_VALUE_MAX]; if (__system_property_get("ro.hardware", value) == 0) { std::string ro_hardware = android::base::GetProperty("ro.hardware", ""); if (ro_hardware.empty()) { *err = "failed to get ro.hardware"; return nullptr; } fstab_path += value; // The fstab path is always "/fstab.${ro.hardware}". std::string fstab_path = "/fstab." + ro_hardware; struct fstab* fstab = fs_mgr_read_fstab(fstab_path.c_str()); if (fstab == nullptr) { *err = "failed to read " + fstab_path; Loading recovery.cpp +8 −12 Original line number Diff line number Diff line Loading @@ -43,12 +43,13 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <bootloader_message/bootloader_message.h> #include <cutils/android_reboot.h> #include <cutils/properties.h> #include <cutils/properties.h> /* for property_list */ #include <healthd/BatteryMonitor.h> #include <private/android_logger.h> /* private pmsg functions */ #include <selinux/label.h> Loading Loading @@ -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) { Loading Loading @@ -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"); } Loading Loading @@ -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) { Loading Loading @@ -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) { Loading screen_ui.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -32,9 +32,9 @@ #include <vector> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/strings.h> #include <android-base/stringprintf.h> #include <cutils/properties.h> #include "common.h" #include "device.h" Loading Loading @@ -293,8 +293,8 @@ void ScreenRecoveryUI::draw_screen_locked() { int y = 0; if (show_menu) { char recovery_fingerprint[PROPERTY_VALUE_MAX]; property_get("ro.bootimage.build.fingerprint", recovery_fingerprint, ""); std::string recovery_fingerprint = android::base::GetProperty("ro.bootimage.build.fingerprint", ""); SetColor(INFO); DrawTextLine(TEXT_INDENT, &y, "Android Recovery", true); Loading Loading @@ -460,7 +460,7 @@ void ScreenRecoveryUI::Init() { RecoveryUI::Init(); InitTextParams(); density_ = static_cast<float>(property_get_int32("ro.sf.lcd_density", 160)) / 160.f; density_ = static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f; // Are we portrait or landscape? layout_ = (gr_fb_width() > gr_fb_height()) ? LANDSCAPE : PORTRAIT; Loading ui.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ #include <time.h> #include <unistd.h> #include <cutils/properties.h> #include <android-base/properties.h> #include <cutils/android_reboot.h> #include "common.h" Loading Loading @@ -175,7 +175,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) { case RecoveryUI::REBOOT: if (reboot_enabled) { property_set(ANDROID_RB_PROPERTY, "reboot,"); android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,"); while (true) { pause(); } } break; Loading Loading
adb_install.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -26,13 +26,14 @@ #include <fcntl.h> #include "ui.h" #include "cutils/properties.h" #include "install.h" #include "common.h" #include "adb_install.h" #include "minadbd/fuse_adb_provider.h" #include "fuse_sideload.h" #include <android-base/properties.h> static void set_usb_driver(RecoveryUI* ui, bool enabled) { int fd = open("/sys/class/android_usb/android0/enable", O_WRONLY); if (fd < 0) { Loading @@ -49,7 +50,7 @@ static void set_usb_driver(RecoveryUI* ui, bool enabled) { static void stop_adbd(RecoveryUI* ui) { ui->Print("Stopping adbd...\n"); property_set("ctl.stop", "adbd"); android::base::SetProperty("ctl.stop", "adbd"); set_usb_driver(ui, false); } Loading @@ -57,7 +58,7 @@ static void maybe_restart_adbd(RecoveryUI* ui) { if (is_ro_debuggable()) { ui->Print("Restarting adbd...\n"); set_usb_driver(ui, true); property_set("ctl.start", "adbd"); android::base::SetProperty("ctl.start", "adbd"); } } Loading
bootloader_message/bootloader_message.cpp +5 −6 Original line number Diff line number Diff line Loading @@ -19,25 +19,24 @@ #include <errno.h> #include <fcntl.h> #include <string.h> #include <sys/system_properties.h> #include <string> #include <vector> #include <android-base/file.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/unique_fd.h> #include <fs_mgr.h> static struct fstab* read_fstab(std::string* err) { // The fstab path is always "/fstab.${ro.hardware}". std::string fstab_path = "/fstab."; char value[PROP_VALUE_MAX]; if (__system_property_get("ro.hardware", value) == 0) { std::string ro_hardware = android::base::GetProperty("ro.hardware", ""); if (ro_hardware.empty()) { *err = "failed to get ro.hardware"; return nullptr; } fstab_path += value; // The fstab path is always "/fstab.${ro.hardware}". std::string fstab_path = "/fstab." + ro_hardware; struct fstab* fstab = fs_mgr_read_fstab(fstab_path.c_str()); if (fstab == nullptr) { *err = "failed to read " + fstab_path; Loading
recovery.cpp +8 −12 Original line number Diff line number Diff line Loading @@ -43,12 +43,13 @@ #include <android-base/file.h> #include <android-base/logging.h> #include <android-base/parseint.h> #include <android-base/properties.h> #include <android-base/stringprintf.h> #include <android-base/strings.h> #include <android-base/unique_fd.h> #include <bootloader_message/bootloader_message.h> #include <cutils/android_reboot.h> #include <cutils/properties.h> #include <cutils/properties.h> /* for property_list */ #include <healthd/BatteryMonitor.h> #include <private/android_logger.h> /* private pmsg functions */ #include <selinux/label.h> Loading Loading @@ -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) { Loading Loading @@ -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"); } Loading Loading @@ -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) { Loading Loading @@ -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) { Loading
screen_ui.cpp +4 −4 Original line number Diff line number Diff line Loading @@ -32,9 +32,9 @@ #include <vector> #include <android-base/logging.h> #include <android-base/properties.h> #include <android-base/strings.h> #include <android-base/stringprintf.h> #include <cutils/properties.h> #include "common.h" #include "device.h" Loading Loading @@ -293,8 +293,8 @@ void ScreenRecoveryUI::draw_screen_locked() { int y = 0; if (show_menu) { char recovery_fingerprint[PROPERTY_VALUE_MAX]; property_get("ro.bootimage.build.fingerprint", recovery_fingerprint, ""); std::string recovery_fingerprint = android::base::GetProperty("ro.bootimage.build.fingerprint", ""); SetColor(INFO); DrawTextLine(TEXT_INDENT, &y, "Android Recovery", true); Loading Loading @@ -460,7 +460,7 @@ void ScreenRecoveryUI::Init() { RecoveryUI::Init(); InitTextParams(); density_ = static_cast<float>(property_get_int32("ro.sf.lcd_density", 160)) / 160.f; density_ = static_cast<float>(android::base::GetIntProperty("ro.sf.lcd_density", 160)) / 160.f; // Are we portrait or landscape? layout_ = (gr_fb_width() > gr_fb_height()) ? LANDSCAPE : PORTRAIT; Loading
ui.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ #include <time.h> #include <unistd.h> #include <cutils/properties.h> #include <android-base/properties.h> #include <cutils/android_reboot.h> #include "common.h" Loading Loading @@ -175,7 +175,7 @@ void RecoveryUI::ProcessKey(int key_code, int updown) { case RecoveryUI::REBOOT: if (reboot_enabled) { property_set(ANDROID_RB_PROPERTY, "reboot,"); android::base::SetProperty(ANDROID_RB_PROPERTY, "reboot,"); while (true) { pause(); } } break; Loading