/bootable/recovery/tests/unit/ |
D | sysutil_test.cpp | 36 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file1.path)); in TEST() 52 ASSERT_TRUE(android::base::WriteStringToFile(content, package.path)); in TEST() 60 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() 68 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() 76 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() 84 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() 97 ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n", temp_file.path)); in TEST() 100 ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n0\n", temp_file.path)); in TEST() 104 ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n1\n", temp_file.path)); in TEST() 107 ASSERT_TRUE(android::base::WriteStringToFile("/somefile\n4096 4096\n2\n0 1\n", temp_file.path)); in TEST() [all …]
|
/bootable/recovery/tests/component/ |
D | uncrypt_test.cpp | 46 ASSERT_TRUE(android::base::SetProperty("ctl.stop", "setup-bcb")); in SetUp() 47 ASSERT_TRUE(android::base::SetProperty("ctl.stop", "clear-bcb")); in SetUp() 48 ASSERT_TRUE(android::base::SetProperty("ctl.stop", "uncrypt")); in SetUp() 52 std::string setup_bcb = android::base::GetProperty(INIT_SVC_SETUP_BCB, ""); in SetUp() 53 std::string clear_bcb = android::base::GetProperty(INIT_SVC_CLEAR_BCB, ""); in SetUp() 54 std::string uncrypt = android::base::GetProperty(INIT_SVC_UNCRYPT, ""); in SetUp() 78 ASSERT_TRUE(android::base::SetProperty("ctl.start", isSetup ? "setup-bcb" : "clear-bcb")); in SetupOrClearBcb() 105 ASSERT_TRUE(android::base::WriteFully(sockfd, &length_out, sizeof(int))) in SetupOrClearBcb() 107 ASSERT_TRUE(android::base::WriteFully(sockfd, message.data(), length)) in SetupOrClearBcb() 113 ASSERT_TRUE(android::base::ReadFully(sockfd, &status, sizeof(int))); in SetupOrClearBcb() [all …]
|
D | update_verifier_test.cpp | 52 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file.path)); in TEST_F() 56 ASSERT_TRUE(android::base::WriteStringToFile("\n" + content + "\n\n", temp_file.path)); in TEST_F() 65 ASSERT_TRUE(android::base::WriteStringToFile("line1", temp_file.path)); in TEST_F() 68 ASSERT_TRUE(android::base::WriteStringToFile("line1\nline2\nline3", temp_file.path)); in TEST_F() 81 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file.path)); in TEST_F() 94 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file.path)); in TEST_F()
|
D | verifier_test.cpp | 65 ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v4.txt"), &testkey_v4)); in TEST() 68 ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v3.txt"), &testkey_v3)); in TEST() 72 ASSERT_TRUE(android::base::WriteStringToFile(keys, key_file1.path)); in TEST() 87 ASSERT_TRUE(android::base::WriteStringToFile("invalid", key_file1.path)); in TEST() 91 ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v4.txt"), &testkey_v4)); in TEST() 97 ASSERT_TRUE(android::base::WriteStringToFile(invalid_key2, key_file2.path)); in TEST() 104 ASSERT_TRUE(android::base::WriteStringToFile(invalid_key3, key_file3.path)); in TEST() 110 ASSERT_TRUE(android::base::WriteStringToFile(invalid_key4, key_file4.path)); in TEST() 116 ASSERT_TRUE(android::base::WriteStringToFile(invalid_key5, key_file5.path)); in TEST() 122 ASSERT_TRUE(android::base::ReadFileToString(from_testdata_base("testkey_v3.txt"), &testkey_v3)); in TEST() [all …]
|
D | imgdiff_test.cpp | 30 using android::base::get_unaligned; 110 ASSERT_TRUE(android::base::WriteStringToFile(src, src_file.path)); in TEST() 114 ASSERT_TRUE(android::base::WriteStringToFile(tgt, tgt_file.path)); in TEST() 124 ASSERT_TRUE(android::base::ReadFileToString(patch_file.path, &patch)); in TEST() 169 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt)); in TEST() 171 ASSERT_TRUE(android::base::ReadFileToString(src_file.path, &src)); in TEST() 173 ASSERT_TRUE(android::base::ReadFileToString(patch_file.path, &patch)); in TEST() 218 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt)); in TEST() 220 ASSERT_TRUE(android::base::ReadFileToString(src_file.path, &src)); in TEST() 222 ASSERT_TRUE(android::base::ReadFileToString(patch_file.path, &patch)); in TEST() [all …]
|
D | updater_test.cpp | 93 expect(android::base::GetProperty("ro.product.device", "").c_str(), in TEST_F() 97 expect(android::base::GetProperty("ro.build.fingerprint", "").c_str(), in TEST_F() 142 ASSERT_TRUE(android::base::ReadFileToString(src_file, &src_content)); in TEST_F() 147 std::string filename = android::base::Join( in TEST_F() 153 std::string filename_bad = android::base::Join( in TEST_F() 162 android::base::Join(std::vector<std::string>{ "EMMC", src_file, std::to_string(src_size - 1), in TEST_F() 194 ASSERT_TRUE(android::base::WriteStringToFile(buffer, temp_file1.path)); in TEST_F() 202 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file2.path)); in TEST_F() 251 ASSERT_TRUE(android::base::ReadFileToString(temp_file1.path, &data)); in TEST_F() 258 ASSERT_TRUE(android::base::ReadFileToString(temp_file1.path, &data)); in TEST_F() [all …]
|
D | applypatch_test.cpp | 44 ASSERT_TRUE(android::base::ReadFileToString(fname, &data)); in sha1sum() 61 ASSERT_TRUE(android::base::WriteStringToFile(content, fname)); in mangle_file() 66 android::base::ReadFileToString(f1, &c1); in file_cmp() 68 android::base::ReadFileToString(f2, &c2); in file_cmp() 83 ASSERT_TRUE(android::base::WriteStringToFile("hello", rand_file)); in SetUpTestCase() 89 bad_sha1_a = android::base::StringPrintf("%040x", rand()); in SetUpTestCase() 90 bad_sha1_b = android::base::StringPrintf("%040x", rand()); in SetUpTestCase() 294 std::string bad_sha1_a = android::base::StringPrintf("%040x", rand()); in TEST() 295 std::string bad_sha1_b = android::base::StringPrintf("%040x", rand()); in TEST()
|
D | install_test.cpp | 137 android::base::ReadFileToString(compatibility_zip_file.path, &compatibility_zip_content)); in TEST() 165 android::base::ReadFileToString(system_manifest_xml_path, &system_manifest_xml_content)); in TEST() 182 android::base::ReadFileToString(compatibility_zip_file.path, &compatibility_zip_content)); in TEST() 214 std::string device = android::base::GetProperty("ro.product.device", ""); in TEST() 216 std::string timestamp = android::base::GetProperty("ro.build.date.utc", ""); in TEST() 218 std::string metadata = android::base::Join( in TEST() 299 std::string device = android::base::GetProperty("ro.product.device", ""); in TEST() 301 std::string timestamp = android::base::GetProperty("ro.build.date.utc", ""); in TEST() 303 std::string metadata = android::base::Join( in TEST()
|
/bootable/recovery/uncrypt/ |
D | uncrypt.cpp | 146 if (!android::base::WriteFully(wfd, buffer, size)) { in write_at_offset() 191 if (android::base::GetProperty("ro.crypto.state", "") == "encrypted") { in find_block_device() 209 return android::base::WriteFully(socket, &status_out, sizeof(int)); in write_status_to_socket() 216 if (!android::base::ReadFileToString(uncrypt_path_file, &uncrypt_path)) { in find_uncrypt_package() 222 *package_name = android::base::Trim(uncrypt_path); in find_uncrypt_package() 249 if (!android::base::RemoveFileIfExists(map_file, &err)) { in produce_block_map() 254 android::base::unique_fd mapfd(open(tmp_map_file.c_str(), in produce_block_map() 280 std::string s = android::base::StringPrintf("%s\n%" PRId64 " %" PRId64 "\n", in produce_block_map() 283 if (!android::base::WriteStringToFd(s, mapfd)) { in produce_block_map() 295 android::base::unique_fd fd(open(path, O_RDONLY)); in produce_block_map() [all …]
|
/bootable/recovery/update_verifier/ |
D | update_verifier.cpp | 68 if (android::base::StartsWith(de->d_name, "dm-")) { in dm_name_filter() 101 if (!android::base::ReadFileToString(path, &content)) { in read_blocks() 104 std::string dm_block_name = android::base::Trim(content); in read_blocks() 132 std::vector<std::string> ranges = android::base::Split(range_str, ","); in read_blocks() 134 bool status = android::base::ParseUint(ranges[0], &range_count); in read_blocks() 152 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(dm_block_device.c_str(), O_RDONLY))); in read_blocks() 161 bool parse_status = android::base::ParseUint(ranges[i], &range_start); in read_blocks() 162 parse_status = parse_status && android::base::ParseUint(ranges[i + 1], &range_end); in read_blocks() 176 if (!android::base::ReadFully(fd.get(), buf.data(), to_read)) { in read_blocks() 208 android::base::unique_fd care_map_fd(TEMP_FAILURE_RETRY(open(care_map_name.c_str(), O_RDONLY))); in verify_image() [all …]
|
/bootable/recovery/bootloader_message/ |
D | bootloader_message.cpp | 58 *err += android::base::StringPrintf("failed to stat %s try %d: %s\n", in wait_for_device() 65 *err += android::base::StringPrintf("failed to stat %s\n", blk_device.c_str()); in wait_for_device() 75 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_RDONLY)); in read_misc_partition() 77 *err = android::base::StringPrintf("failed to open %s: %s", misc_blk_device.c_str(), in read_misc_partition() 82 *err = android::base::StringPrintf("failed to lseek %s: %s", misc_blk_device.c_str(), in read_misc_partition() 86 if (!android::base::ReadFully(fd, p, size)) { in read_misc_partition() 87 *err = android::base::StringPrintf("failed to read %s: %s", misc_blk_device.c_str(), in read_misc_partition() 96 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_WRONLY)); in write_misc_partition() 98 *err = android::base::StringPrintf("failed to open %s: %s", misc_blk_device.c_str(), in write_misc_partition() 103 *err = android::base::StringPrintf("failed to lseek %s: %s", misc_blk_device.c_str(), in write_misc_partition() [all …]
|
/bootable/recovery/ |
D | adb_install.cpp | 41 if (android::base::GetBoolProperty("sys.usb.configfs", false)) { in set_usb_driver() 46 android::base::unique_fd fd(open(USB_DRIVER_CONTROL, O_WRONLY)); in set_usb_driver() 54 if (!android::base::WriteStringToFd(enabled ? "1" : "0", fd)) { in set_usb_driver() 61 android::base::SetProperty("ctl.stop", "adbd"); in stop_adbd() 69 android::base::SetProperty("ctl.start", "adbd"); in maybe_restart_adbd()
|
D | install.cpp | 72 return android::base::Trim(str.substr(pos+1)); in parse_build_number() 109 std::vector<std::string> lines = android::base::Split(metadata, "\n"); in read_source_target_build() 111 std::string str = android::base::Trim(line); in read_source_target_build() 112 if (android::base::StartsWith(str, "pre-build-incremental")) { in read_source_target_build() 117 } else if (android::base::StartsWith(str, "post-build-incremental")) { in read_source_target_build() 137 for (const std::string& line : android::base::Split(metadata_str, "\n")) { in check_newer_ab_build() 144 std::string value = android::base::GetProperty("ro.product.device", ""); in check_newer_ab_build() 153 value = android::base::GetProperty("ro.serialno", ""); in check_newer_ab_build() 166 value = android::base::GetProperty("ro.build.version.incremental", ""); in check_newer_ab_build() 173 value = android::base::GetProperty("ro.build.fingerprint", ""); in check_newer_ab_build() [all …]
|
D | rotate_logs.cpp | 77 if (!android::base::ParseUint(number, &i)) { in logrotate() 100 std::string old_log = android::base::StringPrintf("%s", last_log_file); in rotate_logs() 104 std::string new_log = android::base::StringPrintf("%s.%d", last_log_file, i+1); in rotate_logs() 108 std::string old_kmsg = android::base::StringPrintf("%s", last_kmsg_file); in rotate_logs() 112 std::string new_kmsg = android::base::StringPrintf("%s.%d", last_kmsg_file, i+1); in rotate_logs()
|
D | recovery.cpp | 210 return android::base::GetBoolProperty("ro.debuggable", false); in is_ro_debuggable() 215 if (android::base::GetBoolProperty("ro.boot.quiescent", false)) { in reboot() 218 return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); in reboot() 339 std::vector<std::string> tokens = android::base::Split(boot_recovery, "\n"); in get_args() 355 android::base::ReadFileToString(COMMAND_FILE, &content)) { in get_args() 356 std::vector<std::string> tokens = android::base::Split(content, "\n"); in get_args() 403 android::base::WriteStringToFile(buffer, destination); in save_kernel_log() 414 android::base::ReadFileToString(source, &content); in copy_log_file_to_pmsg() 491 } else if (!android::base::WriteStringToFile(locale, LOCALE_FILE)) { in finish_recovery() 543 std::string path = android::base::StringPrintf("%s/%s", CACHE_LOG_DIR, de->d_name); in erase_volume() [all …]
|
D | ui.cpp | 111 if (!android::base::ReadFileToString(MAX_BRIGHTNESS_FILE, &content)) { in InitScreensaver() 117 if (!android::base::ParseUint(android::base::Trim(content), &max_value)) { in InitScreensaver() 124 if (!android::base::WriteStringToFile(std::to_string(brightness_normal_value_), in InitScreensaver() 153 if (android::base::ReadFileToString("/proc/cmdline", &cmdline)) { in Init() 437 if (android::base::WriteStringToFile(std::to_string(brightness_dimmed_value_), in WaitKey() 444 if (android::base::WriteStringToFile("0", BRIGHTNESS_FILE)) { in WaitKey() 458 if (android::base::WriteStringToFile(std::to_string(brightness_normal_value_), in WaitKey()
|
D | recovery-persist.cpp | 95 android::base::ReadFileToString(destination, &content); in logsave() 109 return android::base::WriteStringToFile(buffer, destination.c_str()); in logsave()
|
/bootable/recovery/otautil/ |
D | ThermalUtil.cpp | 34 if (android::base::StartsWith(de->d_name, "thermal_zone")) { in thermal_filter() 66 if (!android::base::ReadFileToString(path, &content)) { in GetMaxValueFromThermalZone() 72 if (!android::base::ParseInt(android::base::Trim(content), &temperature)) { in GetMaxValueFromThermalZone()
|
D | SysUtil.cpp | 67 if (!android::base::ReadFileToString(filename, &content)) { in MapBlockFile() 72 std::vector<std::string> lines = android::base::Split(android::base::Trim(content), "\n"); in MapBlockFile() 110 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(block_dev.c_str(), O_RDONLY))); in MapBlockFile() 181 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn.c_str(), O_RDONLY))); in MapFile()
|
/bootable/recovery/updater/include/updater/ |
D | rangeset.h | 53 std::vector<std::string> pieces = android::base::Split(range_text, ","); in Parse() 57 CHECK(android::base::ParseUint(pieces[0], &num, static_cast<size_t>(INT_MAX))) in Parse() 67 CHECK(android::base::ParseUint(pieces[i + 1], &first, static_cast<size_t>(INT_MAX))); in Parse() 69 CHECK(android::base::ParseUint(pieces[i + 2], &second, static_cast<size_t>(INT_MAX))); in Parse()
|
/bootable/recovery/updater/ |
D | updater.cpp | 53 static void UpdaterLogger(android::base::LogId /* id */, android::base::LogSeverity /* severity */, in UpdaterLogger() 69 android::base::InitLogging(argv, &UpdaterLogger); in main() 183 const std::vector<std::string> lines = android::base::Split(state.errmsg, "\n"); in main()
|
D | blockimg.cpp | 438 android::base::unique_fd fd; 569 static std::string GetStashFileName(const std::string& base, const std::string& id, in GetStashFileName() argument 571 if (base.empty()) { in GetStashFileName() 576 fn += "/" + base + "/" + id + postfix; in GetStashFileName() 616 static void DeleteStash(const std::string& base) { in DeleteStash() argument 617 if (base.empty()) return; in DeleteStash() 619 LOG(INFO) << "deleting stash " << base; in DeleteStash() 621 std::string dirname = GetStashFileName(base, "", ""); in DeleteStash() 676 android::base::unique_fd fd(TEMP_FAILURE_RETRY(ota_open(fn.c_str(), O_RDONLY))); in LoadStash() 706 static int WriteStash(const std::string& base, const std::string& id, int blocks, in WriteStash() argument [all …]
|
D | install.cpp | 74 std::vector<std::string> lines = android::base::Split(buffer, "\n"); in uiPrint() 92 android::base::StringAppendV(&error_msg, format, ap); in uiPrintf() 299 if (!android::base::ParseInt(fs_size, &size)) { in FormatFn() 374 if (!android::base::ParseDouble(frac_str.c_str(), &frac)) { in ShowProgressFn() 379 if (!android::base::ParseInt(sec_str.c_str(), &sec)) { in ShowProgressFn() 402 if (!android::base::ParseDouble(frac_str.c_str(), &frac)) { in SetProgressFn() 508 std::string value = android::base::GetProperty(key, ""); in GetPropFn() 558 std::vector<std::string> lines = android::base::Split(buffer, "\n"); in FileGetPropFn() 560 std::string line = android::base::Trim(lines[i]); in FileGetPropFn() 572 std::string str = android::base::Trim(line.substr(0, equal_pos)); in FileGetPropFn() [all …]
|
/bootable/recovery/boot_control/ |
D | boot_control.cpp | 36 boot_control_module_t base; member 95 android::base::unique_fd fd(open(misc_device, O_RDONLY)); in LoadBootloaderControl() 104 if (!android::base::ReadFully(fd.get(), buffer, sizeof(bootloader_control))) { in LoadBootloaderControl() 113 android::base::unique_fd fd(open(misc_device, O_WRONLY | O_SYNC)); in UpdateAndSaveBootloaderControl() 122 if (!android::base::WriteFully(fd.get(), buffer, sizeof(bootloader_control))) { in UpdateAndSaveBootloaderControl() 216 std::string suffix_prop = android::base::GetProperty("ro.boot.slot_suffix", ""); in BootControl_lazyInitialization() 375 .base =
|
/bootable/recovery/applypatch/ |
D | imgdiff.cpp | 148 using android::base::get_unaligned; 155 return android::base::WriteFully(fd, &value, sizeof(int64_t)); in Write8() 161 return android::base::WriteFully(fd, &value, sizeof(int32_t)); in Write4() 374 if (!android::base::WriteFully(fd, patch.data(), patch.size())) { in WriteHeaderToFd() 498 android::base::unique_fd fd(open(filename, O_RDONLY)); in ReadZip() 511 if (!android::base::ReadFully(fd, zip_file->data(), sz)) { in ReadZip() 615 android::base::unique_fd fd(open(filename, O_RDONLY)); in ReadImage() 628 if (!android::base::ReadFully(fd, img->data(), sz)) { in ReadImage() 778 android::base::unique_fd patch_fd(open(ptemp, O_RDONLY)); in MakePatch() 799 if (!android::base::ReadFully(patch_fd, patch_data->data(), sz)) { in MakePatch() [all …]
|