Loading install.cpp +61 −66 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ #include "common.h" #include "error_code.h" #include "minui/minui.h" #include "otautil/SysUtil.h" #include "otautil/ThermalUtil.h" #include "roots.h" Loading @@ -57,15 +56,11 @@ using namespace std::chrono_literals; #define PUBLIC_KEYS_FILE "/res/keys" static constexpr const char* METADATA_PATH = "META-INF/com/android/metadata"; static constexpr const char* UNCRYPT_STATUS = "/cache/recovery/uncrypt_status"; // Default allocation of progress bar segments to operations static constexpr int VERIFICATION_PROGRESS_TIME = 60; static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25; static constexpr float DEFAULT_FILES_PROGRESS_FRACTION = 0.4; static constexpr float DEFAULT_IMAGE_PROGRESS_FRACTION = 0.1; static std::condition_variable finish_log_temperature; Loading Loading @@ -621,10 +616,8 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount, return result; } int install_package(const char* path, bool* wipe_cache, const char* install_file, bool needs_mount, int retry_count) { int install_package(const char* path, bool* wipe_cache, const char* install_file, bool needs_mount, int retry_count) { modified_flash = true; auto start = std::chrono::system_clock::now(); Loading @@ -648,6 +641,7 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, bool has_cache = volume_for_path("/cache") != nullptr; // Skip logging the uncrypt_status on devices without /cache. if (has_cache) { static constexpr const char* UNCRYPT_STATUS = "/cache/recovery/uncrypt_status"; if (ensure_path_mounted(UNCRYPT_STATUS) != 0) { LOG(WARNING) << "Can't mount " << UNCRYPT_STATUS; } else { Loading Loading @@ -682,8 +676,8 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, log_buffer.push_back("temperature_max: " + std::to_string(max_temperature)); } std::string log_content = android::base::Join(log_header, "\n") + "\n" + android::base::Join(log_buffer, "\n") + "\n"; std::string log_content = android::base::Join(log_header, "\n") + "\n" + android::base::Join(log_buffer, "\n") + "\n"; if (!android::base::WriteStringToFile(log_content, install_file)) { PLOG(ERROR) << "failed to write " << install_file; } Loading @@ -695,6 +689,7 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, } bool verify_package(const unsigned char* package_data, size_t package_size) { static constexpr const char* PUBLIC_KEYS_FILE = "/res/keys"; std::vector<Certificate> loadedKeys; if (!load_keys(PUBLIC_KEYS_FILE, loadedKeys)) { LOG(ERROR) << "Failed to load keys"; Loading Loading
install.cpp +61 −66 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ #include "common.h" #include "error_code.h" #include "minui/minui.h" #include "otautil/SysUtil.h" #include "otautil/ThermalUtil.h" #include "roots.h" Loading @@ -57,15 +56,11 @@ using namespace std::chrono_literals; #define PUBLIC_KEYS_FILE "/res/keys" static constexpr const char* METADATA_PATH = "META-INF/com/android/metadata"; static constexpr const char* UNCRYPT_STATUS = "/cache/recovery/uncrypt_status"; // Default allocation of progress bar segments to operations static constexpr int VERIFICATION_PROGRESS_TIME = 60; static constexpr float VERIFICATION_PROGRESS_FRACTION = 0.25; static constexpr float DEFAULT_FILES_PROGRESS_FRACTION = 0.4; static constexpr float DEFAULT_IMAGE_PROGRESS_FRACTION = 0.1; static std::condition_variable finish_log_temperature; Loading Loading @@ -621,10 +616,8 @@ really_install_package(const char *path, bool* wipe_cache, bool needs_mount, return result; } int install_package(const char* path, bool* wipe_cache, const char* install_file, bool needs_mount, int retry_count) { int install_package(const char* path, bool* wipe_cache, const char* install_file, bool needs_mount, int retry_count) { modified_flash = true; auto start = std::chrono::system_clock::now(); Loading @@ -648,6 +641,7 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, bool has_cache = volume_for_path("/cache") != nullptr; // Skip logging the uncrypt_status on devices without /cache. if (has_cache) { static constexpr const char* UNCRYPT_STATUS = "/cache/recovery/uncrypt_status"; if (ensure_path_mounted(UNCRYPT_STATUS) != 0) { LOG(WARNING) << "Can't mount " << UNCRYPT_STATUS; } else { Loading Loading @@ -682,8 +676,8 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, log_buffer.push_back("temperature_max: " + std::to_string(max_temperature)); } std::string log_content = android::base::Join(log_header, "\n") + "\n" + android::base::Join(log_buffer, "\n") + "\n"; std::string log_content = android::base::Join(log_header, "\n") + "\n" + android::base::Join(log_buffer, "\n") + "\n"; if (!android::base::WriteStringToFile(log_content, install_file)) { PLOG(ERROR) << "failed to write " << install_file; } Loading @@ -695,6 +689,7 @@ install_package(const char* path, bool* wipe_cache, const char* install_file, } bool verify_package(const unsigned char* package_data, size_t package_size) { static constexpr const char* PUBLIC_KEYS_FILE = "/res/keys"; std::vector<Certificate> loadedKeys; if (!load_keys(PUBLIC_KEYS_FILE, loadedKeys)) { LOG(ERROR) << "Failed to load keys"; Loading