/bootable/recovery/otautil/ |
D | parse_install_logs.cpp | 48 std::string num_string = android::base::Trim(line.substr(num_index + 1)); in ParseRecoveryUpdateMetrics() 50 if (!android::base::ParseInt(num_string, &parsed_num)) { in ParseRecoveryUpdateMetrics() 55 if (android::base::StartsWith(line, "bytes_written")) { in ParseRecoveryUpdateMetrics() 57 } else if (android::base::StartsWith(line, "bytes_stashed")) { in ParseRecoveryUpdateMetrics() 59 } else if (android::base::StartsWith(line, "time")) { in ParseRecoveryUpdateMetrics() 61 } else if (android::base::StartsWith(line, "uncrypt_time")) { in ParseRecoveryUpdateMetrics() 63 } else if (android::base::StartsWith(line, "source_build")) { in ParseRecoveryUpdateMetrics() 65 } else if (android::base::StartsWith(line, "temperature_start")) { in ParseRecoveryUpdateMetrics() 67 } else if (android::base::StartsWith(line, "temperature_end")) { in ParseRecoveryUpdateMetrics() 69 } else if (android::base::StartsWith(line, "temperature_max")) { in ParseRecoveryUpdateMetrics() [all …]
|
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 | logging.cpp | 122 if (!android::base::ParseUint(number, &i)) { in logrotate() 145 std::string old_log = android::base::StringPrintf("%s", last_log_file); in rotate_logs() 149 std::string new_log = android::base::StringPrintf("%s.%d", last_log_file, i + 1); in rotate_logs() 153 std::string old_kmsg = android::base::StringPrintf("%s", last_kmsg_file); in rotate_logs() 157 std::string new_kmsg = android::base::StringPrintf("%s.%d", last_kmsg_file, i + 1); in rotate_logs() 170 android::base::ReadFileToString(source, &content); in copy_log_file_to_pmsg() 257 android::base::WriteStringToFile(buffer, destination); in save_kernel_log() 275 std::string path = android::base::StringPrintf("%s/%s", CACHE_LOG_DIR, de->d_name); in ReadLogFilesToMemory() 286 android::base::unique_fd log_fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY))); in ReadLogFilesToMemory() 287 if (log_fd == -1 || !android::base::ReadFully(log_fd, data.data(), read_size)) { in ReadLogFilesToMemory() [all …]
|
D | sysutil.cpp | 40 if (!android::base::ReadFileToString(block_map_path, &content)) { in ParseBlockMapFile() 45 std::vector<std::string> lines = android::base::Split(android::base::Trim(content), "\n"); in ParseBlockMapFile() 141 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(block_map_data.path().c_str(), O_RDONLY))); in MapBlockFile() 194 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(fn.c_str(), O_RDONLY))); in MapFile() 219 if (android::base::GetBoolProperty("ro.boot.quiescent", false)) { in reboot() 222 return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd); in reboot()
|
/bootable/recovery/tests/unit/ |
D | sysutil_test.cpp | 39 ASSERT_TRUE(android::base::WriteStringToFile(android::base::Join(content, '\n'), temp_file.path)); in TEST() 59 ASSERT_TRUE(android::base::WriteStringToFile(android::base::Join(content, '\n'), temp_file.path)); in TEST() 74 ASSERT_TRUE(android::base::WriteStringToFile(android::base::Join(content, '\n'), temp_file.path)); in TEST() 82 ASSERT_TRUE(android::base::WriteStringToFile(android::base::Join(content, '\n'), temp_file.path)); in TEST() 87 ASSERT_TRUE(android::base::WriteStringToFile(android::base::Join(content, '\n'), temp_file.path)); in TEST() 95 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file1.path)); in TEST() 111 ASSERT_TRUE(android::base::WriteStringToFile(content, package.path)); in TEST() 119 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() 127 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() 135 ASSERT_TRUE(android::base::WriteStringToFile(block_map_content, block_map_file.path)); in TEST() [all …]
|
/bootable/recovery/uncrypt/ |
D | uncrypt.cpp | 150 if (!android::base::WriteFully(wfd, buffer, size)) { in write_at_offset() 180 if (android::base::StartsWith(path, entry.mount_point + "/")) { in FindBlockDevice() 185 if (android::base::GetProperty("ro.crypto.state", "") == "encrypted") { in FindBlockDevice() 206 return android::base::WriteFully(socket, &status_out, sizeof(int)); in write_status_to_socket() 213 if (!android::base::ReadFileToString(uncrypt_path_file, &uncrypt_path)) { in FindUncryptPackage() 219 *package_name = android::base::Trim(uncrypt_path); in FindUncryptPackage() 246 if (!android::base::RemoveFileIfExists(map_file, &err)) { in ProductBlockMap() 251 android::base::unique_fd mapfd(open(tmp_map_file.c_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR)); in ProductBlockMap() 276 std::string s = android::base::StringPrintf("%s\n%" PRId64 " %" PRId64 "\n", blk_dev.c_str(), in ProductBlockMap() 279 if (!android::base::WriteStringToFd(s, mapfd)) { in ProductBlockMap() [all …]
|
/bootable/recovery/tests/component/ |
D | install_test.cpp | 118 BuildZipArchive({ { "recovery.wipe", android::base::Join(partition_list, '\n') } }, in TEST() 121 ASSERT_TRUE(android::base::ReadFileToString(temp_file.path, &wipe_package)); in TEST() 145 android::base::ReadFileToString(compatibility_zip_file.path, &compatibility_zip_content)); in TEST() 170 android::base::ReadFileToString(system_manifest_xml_path, &system_manifest_xml_content)); in TEST() 178 android::base::ReadFileToString(compatibility_zip_file.path, &compatibility_zip_content)); in TEST() 254 std::string device = android::base::GetProperty("ro.product.device", ""); in VerifyAbUpdateCommands() 256 std::string timestamp = android::base::GetProperty("ro.build.date.utc", ""); in VerifyAbUpdateCommands() 264 std::string metadata_string = android::base::Join(meta, "\n"); in VerifyAbUpdateCommands() 306 std::string device = android::base::GetProperty("ro.product.device", ""); in TEST() 308 std::string timestamp = android::base::GetProperty("ro.build.date.utc", ""); in TEST() [all …]
|
D | uncrypt_test.cpp | 42 ASSERT_TRUE(android::base::SetProperty("ctl.stop", "setup-bcb")); in StopService() 43 ASSERT_TRUE(android::base::SetProperty("ctl.stop", "clear-bcb")); in StopService() 44 ASSERT_TRUE(android::base::SetProperty("ctl.stop", "uncrypt")); in StopService() 48 std::string setup_bcb = android::base::GetProperty(INIT_SVC_SETUP_BCB, ""); in StopService() 49 std::string clear_bcb = android::base::GetProperty(INIT_SVC_CLEAR_BCB, ""); in StopService() 50 std::string uncrypt = android::base::GetProperty(INIT_SVC_UNCRYPT, ""); in StopService() 84 ASSERT_TRUE(android::base::SetProperty("ctl.start", isSetup ? "setup-bcb" : "clear-bcb")); in SetupOrClearBcb() 111 ASSERT_TRUE(android::base::WriteFully(sockfd, &length_out, sizeof(int))) in SetupOrClearBcb() 113 ASSERT_TRUE(android::base::WriteFully(sockfd, message.data(), length)) in SetupOrClearBcb() 119 ASSERT_TRUE(android::base::ReadFully(sockfd, &status, sizeof(int))); in SetupOrClearBcb() [all …]
|
D | updater_test.cpp | 186 ASSERT_TRUE(android::base::RemoveFileIfExists(last_command_file_)); in TearDown() 191 ASSERT_TRUE(android::base::RemoveFileIfExists(updated_marker)); in TearDown() 205 expect(android::base::GetProperty("ro.product.device", "").c_str(), in TEST_F() 209 expect(android::base::GetProperty("ro.build.fingerprint", "").c_str(), in TEST_F() 224 ASSERT_TRUE(android::base::ReadFileToString(source_file, &source_content)); in TEST_F() 231 ASSERT_TRUE(android::base::ReadFileToString(target_file, &target_content)); in TEST_F() 273 ASSERT_TRUE(android::base::WriteStringToFile(buffer, temp_file1.path)); in TEST_F() 281 ASSERT_TRUE(android::base::WriteStringToFile(content, temp_file2.path)); in TEST_F() 330 ASSERT_TRUE(android::base::ReadFileToString(temp_file1.path, &data)); in TEST_F() 337 ASSERT_TRUE(android::base::ReadFileToString(temp_file1.path, &data)); in TEST_F() [all …]
|
D | imgdiff_test.cpp | 36 using android::base::get_unaligned; 121 ASSERT_TRUE(android::base::WriteStringToFile(src, src_file.path)); in TEST() 125 ASSERT_TRUE(android::base::WriteStringToFile(tgt, tgt_file.path)); in TEST() 135 ASSERT_TRUE(android::base::ReadFileToString(patch_file.path, &patch)); in TEST() 180 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt)); in TEST() 182 ASSERT_TRUE(android::base::ReadFileToString(src_file.path, &src)); in TEST() 184 ASSERT_TRUE(android::base::ReadFileToString(patch_file.path, &patch)); in TEST() 234 ASSERT_TRUE(android::base::ReadFileToString(tgt_file.path, &tgt)); in TEST() 236 ASSERT_TRUE(android::base::ReadFileToString(src_file.path, &src)); in TEST() 238 ASSERT_TRUE(android::base::ReadFileToString(patch_file.path, &patch)); in TEST() [all …]
|
D | update_verifier_test.cpp | 37 std::string verity_mode = android::base::GetProperty("ro.boot.veritymode", ""); in SetUp() 38 verity_supported = android::base::EqualsIgnoreCase(verity_mode, "enforcing"); in SetUp() 47 fingerprint_ = android::base::GetProperty(property_id_, ""); in SetUp() 109 ASSERT_TRUE(android::base::WriteStringToFile(content, care_map_txt_)); in TEST_F() 135 ASSERT_TRUE(android::base::WriteStringToFile(proto, care_map_pb_)); in TEST_F() 156 ASSERT_TRUE(android::base::WriteStringToFile(proto, care_map_pb_)); in TEST_F() 177 ASSERT_TRUE(android::base::WriteStringToFile(proto, care_map_pb_)); in TEST_F() 196 ASSERT_TRUE(android::base::WriteStringToFile(proto, care_map_pb_)); in TEST_F() 217 ASSERT_TRUE(android::base::WriteStringToFile(proto, care_map_pb_)); in TEST_F()
|
/bootable/recovery/minadbd/ |
D | fuse_adb_provider_test.cpp | 31 android::base::unique_fd device_socket; in TEST() 32 android::base::unique_fd host_socket; in TEST() 34 ASSERT_TRUE(android::base::Socketpair(AF_UNIX, SOCK_STREAM, 0, &device_socket, &host_socket)); in TEST() 71 android::base::unique_fd device_socket; in TEST() 72 android::base::unique_fd host_socket; in TEST() 74 ASSERT_TRUE(android::base::Socketpair(AF_UNIX, SOCK_STREAM, 0, &device_socket, &host_socket)); in TEST()
|
D | minadbd_services.cpp | 70 android::base::put_unaligned(message + strlen(kMinadbdStatusPrefix), cmd); in WriteCommandToFd() 72 if (!android::base::WriteFully(fd, message, kMinadbdMessageSize)) { in WriteCommandToFd() 83 if (!android::base::ReadFully(fd, buffer, kMinadbdMessageSize)) { in WaitForCommandStatus() 89 if (!android::base::StartsWith(message, kMinadbdStatusPrefix)) { in WaitForCommandStatus() 94 *status = android::base::get_unaligned<MinadbdCommandStatus>( in WaitForCommandStatus() 101 auto pieces = android::base::Split(args, ":"); in RunAdbFuseSideload() 104 if (pieces.size() != 2 || !android::base::ParseInt(pieces[0], &file_size) || file_size <= 0 || in RunAdbFuseSideload() 105 !android::base::ParseInt(pieces[1], &block_size) || block_size <= 0) { in RunAdbFuseSideload() 131 if (!android::base::WriteFully(sfd, kMinadbdServicesExitSuccess, in RunAdbFuseSideload() 136 if (!android::base::WriteFully(sfd, kMinadbdServicesExitFailure, in RunAdbFuseSideload() [all …]
|
D | minadbd_services_test.cpp | 48 android::base::Socketpair(AF_UNIX, SOCK_STREAM, 0, &minadbd_socket_, &recovery_socket_)); in SetUp() 67 ASSERT_TRUE(android::base::ReadFully(fd, received.data(), kMinadbdMessageSize)); in ReadAndCheckCommandMessage() 106 android::base::WriteFully(recovery_socket_, status_message.data(), kMinadbdMessageSize)); in WriteMinadbdCommandStatus() 115 android::base::unique_fd minadbd_socket_; 116 android::base::unique_fd recovery_socket_; 154 ASSERT_TRUE(android::base::WriteStringToFd("12345678", recovery_socket_)); in TEST_F() 170 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(package_path_.c_str(), O_RDONLY))); in TEST_F() 178 if (!android::base::ReadFully(fd, content_from_fuse.data(), 4096)) { in TEST_F() 195 ASSERT_TRUE(android::base::ReadFully(fd, adb_message.data(), 8)); in TEST_F() 196 ASSERT_EQ(android::base::StringPrintf("%08u", 0), adb_message); in TEST_F() [all …]
|
D | minadbd.cpp | 37 android::base::InitLogging(argv, &android::base::StderrLogger); in main() 46 if (!android::base::ParseInt(argv[2], &socket_fd)) { in main()
|
/bootable/recovery/install/ |
D | install.cpp | 92 for (const std::string& line : android::base::Split(metadata_string, "\n")) { in ReadMetadataFromPackage() 95 metadata->emplace(android::base::Trim(line.substr(0, eq)), in ReadMetadataFromPackage() 96 android::base::Trim(line.substr(eq + 1))); in ReadMetadataFromPackage() 144 auto device_pre_build = android::base::GetProperty("ro.build.version.incremental", ""); in CheckAbSpecificMetadata() 152 auto device_fingerprint = android::base::GetProperty("ro.build.fingerprint", ""); in CheckAbSpecificMetadata() 162 android::base::GetIntProperty("ro.build.date.utc", std::numeric_limits<int64_t>::max()); in CheckAbSpecificMetadata() 168 !android::base::ParseInt(pkg_post_timestamp_string, &pkg_post_timestamp) || in CheckAbSpecificMetadata() 200 auto device = android::base::GetProperty("ro.product.device", ""); in CheckPackageMetadata() 212 auto device_serial_no = android::base::GetProperty("ro.serialno", ""); in CheckPackageMetadata() 214 for (const auto& number : android::base::Split(pkg_serial_no, "|")) { in CheckPackageMetadata() [all …]
|
D | adb_install.cpp | 58 android::base::SetProperty("sys.usb.config", state); in SetUsbConfig() 59 return android::base::WaitForProperty("sys.usb.state", state); in SetUsbConfig() 64 if (!android::base::StartsWith(message, kMinadbdCommandPrefix)) { in ParseMinadbdCommand() 70 auto cmd_code = android::base::get_unaligned<uint32_t>(cmd_code_string.c_str()); in ParseMinadbdCommand() 82 android::base::put_unaligned(message + strlen(kMinadbdStatusPrefix), status); in WriteStatusToFd() 84 if (!android::base::WriteFully(fd, message, kMinadbdMessageSize)) { in WriteStatusToFd() 155 if (!android::base::ReadFully(socket_fd, buffer, kMinadbdMessageSize)) { in HandleMessageFromMinadbd() 167 << android::base::get_unaligned<unsigned int>( in HandleMessageFromMinadbd() 185 RecoveryUI* ui, pid_t minadbd_pid, android::base::unique_fd&& socket_fd, in ListenAndExecuteMinadbdCommands() 187 android::base::unique_fd epoll_fd(epoll_create1(O_CLOEXEC)); in ListenAndExecuteMinadbdCommands() [all …]
|
/bootable/recovery/ |
D | recovery_main.cpp | 73 static void UiLogger(android::base::LogId /* id */, android::base::LogSeverity severity, in UiLogger() 77 if (severity >= android::base::ERROR && ui != nullptr) { in UiLogger() 121 std::vector<std::string> tokens = android::base::Split(boot_recovery, "\n"); in get_args() 137 android::base::ReadFileToString(COMMAND_FILE, &content)) { in get_args() 138 std::vector<std::string> tokens = android::base::Split(content, "\n"); in get_args() 175 if (!android::base::ReadFileToString(LOCALE_FILE, &content)) { in load_locale_from_cache() 180 return android::base::Trim(content); in load_locale_from_cache() 185 android::base::SetProperty("sys.usb.config", state); in SetUsbConfig() 186 return android::base::WaitForProperty("sys.usb.state", state); in SetUsbConfig() 190 android::base::unique_fd sock_fd(android_get_control_socket("recovery")); in ListenRecoverySocket() [all …]
|
/bootable/recovery/fastboot/ |
D | fastboot.cpp | 43 title_lines.push_back("Product name - " + android::base::GetProperty("ro.product.device", "")); in StartFastboot() 44 title_lines.push_back("Bootloader version - " + android::base::GetProperty("ro.bootloader", "")); in StartFastboot() 46 android::base::GetProperty("ro.build.expect.baseband", "")); in StartFastboot() 47 title_lines.push_back("Serial number - " + android::base::GetProperty("ro.serialno", "")); in StartFastboot() 49 ((android::base::GetProperty("ro.secure", "") == "1") ? "yes" : "no")); in StartFastboot() 50 title_lines.push_back("HW version - " + android::base::GetProperty("ro.revision", "")); in StartFastboot()
|
/bootable/recovery/bootloader_message/ |
D | bootloader_message.cpp | 73 *err += android::base::StringPrintf("failed to stat %s try %d: %s\n", in wait_for_device() 80 *err += android::base::StringPrintf("failed to stat %s\n", blk_device.c_str()); in wait_for_device() 90 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_RDONLY)); in read_misc_partition() 92 *err = android::base::StringPrintf("failed to open %s: %s", misc_blk_device.c_str(), in read_misc_partition() 97 *err = android::base::StringPrintf("failed to lseek %s: %s", misc_blk_device.c_str(), in read_misc_partition() 101 if (!android::base::ReadFully(fd, p, size)) { in read_misc_partition() 102 *err = android::base::StringPrintf("failed to read %s: %s", misc_blk_device.c_str(), in read_misc_partition() 111 android::base::unique_fd fd(open(misc_blk_device.c_str(), O_WRONLY)); in write_misc_partition() 113 *err = android::base::StringPrintf("failed to open %s: %s", misc_blk_device.c_str(), in write_misc_partition() 118 *err = android::base::StringPrintf("failed to lseek %s: %s", misc_blk_device.c_str(), in write_misc_partition() [all …]
|
/bootable/recovery/update_verifier/ |
D | update_verifier_main.cpp | 27 std::string s = android::base::GetProperty("ro.boot.slot_suffix", ""); in main() 35 android::base::InitLogging(argv, &android::base::KernelLogger); in main()
|
D | update_verifier.cpp | 79 if (android::base::StartsWith(de->d_name, "dm-")) { in dm_name_filter() 87 property_reader_([](const std::string& id) { return android::base::GetProperty(id, ""); }) {} in UpdateVerifier() 111 if (!android::base::ReadFileToString(path, &content)) { in FindDmPartitions() 114 std::string dm_block_name = android::base::Trim(content); in FindDmPartitions() 118 } else if (android::base::EndsWith(dm_block_name, "-verity")) { in FindDmPartitions() 121 } else if (!android::base::GetProperty("ro.boot.avb_version", "").empty()) { in FindDmPartitions() 148 android::base::unique_fd fd(TEMP_FAILURE_RETRY(open(dm_block_device.c_str(), O_RDONLY))); in ReadBlocks() 167 if (!android::base::ReadFully(fd.get(), buf.data(), to_read)) { in ReadBlocks() 221 android::base::unique_fd care_map_fd(TEMP_FAILURE_RETRY(open(care_map_name.c_str(), O_RDONLY))); in ParseCareMap() 231 if (!android::base::ReadFdToString(care_map_fd.get(), &file_content)) { in ParseCareMap() [all …]
|
/bootable/recovery/updater/ |
D | commands.cpp | 109 if (!android::base::ParseUint(token, &src_blocks)) { in ParseTargetInfoAndSourceInfo() 134 android::base::StringPrintf("mismatching block count: %zu (%s) vs %zu", result.blocks(), in ParseTargetInfoAndSourceInfo() 155 std::vector<std::string> pairs = android::base::Split(tokens[pos++], ":"); in ParseTargetInfoAndSourceInfo() 170 *err = android::base::StringPrintf("mismatching block count: %zu (%s) vs %zu", result.blocks(), in ParseTargetInfoAndSourceInfo() 180 std::vector<std::string> tokens = android::base::Split(line, " "); in Parse() 197 *err = android::base::StringPrintf("invalid number of args: %zu (expected 1)", in Parse() 210 *err = android::base::StringPrintf("invalid number of args: %zu (expected 2)", in Parse() 224 *err = android::base::StringPrintf("invalid number of args: %zu (expected 1)", in Parse() 244 *err = android::base::StringPrintf("invalid number of args: %zu (expected 4+)", in Parse() 250 if (!android::base::ParseUint(tokens[pos++], &offset) || in Parse() [all …]
|
/bootable/recovery/applypatch/ |
D | freecache.cpp | 51 if (!android::base::ParseUint(de->d_name, &pid)) { in EliminateOpenFiles() 54 std::string path = android::base::StringPrintf("/proc/%s/fd/", de->d_name); in EliminateOpenFiles() 69 if (android::base::StartsWith(link, dirname)) { in EliminateOpenFiles() 206 return android::base::StartsWith(file_name, "last_log") || in RemoveFilesInDirectory() 207 android::base::StartsWith(file_name, "last_kmsg"); in RemoveFilesInDirectory() 214 unsigned int index1 = GetLogIndex(android::base::Basename(name1)); in RemoveFilesInDirectory() 215 unsigned int index2 = GetLogIndex(android::base::Basename(name2)); in RemoveFilesInDirectory()
|
D | applypatch.cpp | 54 if (android::base::StartsWith(filename, "EMMC:")) { in LoadFileContents() 59 if (!android::base::ReadFileToString(filename, &data)) { in LoadFileContents() 78 android::base::unique_fd dev(open(partition.name.c_str(), O_RDONLY)); in ReadPartitionToBuffer() 83 if (!android::base::ReadFully(dev, buffer.data(), buffer.size())) { in ReadPartitionToBuffer() 110 android::base::unique_fd fd( in SaveFileContents() 117 if (!android::base::WriteFully(fd, file->data.data(), file->data.size())) { in SaveFileContents() 142 android::base::unique_fd fd(open(partition.name.c_str(), O_RDWR)); in WriteBufferToPartition() 153 if (!android::base::WriteFully(fd, data + start, len - start)) { in WriteBufferToPartition() 176 if (!android::base::WriteStringToFile("3\n", drop_cache)) { in WriteBufferToPartition() 197 if (!android::base::ReadFully(fd, buffer, to_read)) { in WriteBufferToPartition() [all …]
|