diff options
author | Tianjie Xu <xunchang@google.com> | 2018-11-01 18:41:04 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-11-01 18:41:04 +0100 |
commit | 6ba8eb5248f820198fdb5aa206f91125e1f8d5dc (patch) | |
tree | 8c390cfe673d7b299e437db6f270b269d7582eba /install.h | |
parent | Merge "tests: Use FRIEND_TEST in ScreenRecoveryUITest." (diff) | |
parent | Merge "Refactor the code to check the metadata" (diff) | |
download | android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.tar android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.tar.gz android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.tar.bz2 android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.tar.lz android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.tar.xz android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.tar.zst android_bootable_recovery-6ba8eb5248f820198fdb5aa206f91125e1f8d5dc.zip |
Diffstat (limited to '')
-rw-r--r-- | install.h | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -19,6 +19,7 @@ #include <stddef.h> +#include <map> #include <string> #include <ziparchive/zip_archive.h> @@ -33,6 +34,12 @@ enum InstallResult { INSTALL_KEY_INTERRUPTED }; +enum class OtaType { + AB, + BLOCK, + BRICK, +}; + // Installs the given update package. If INSTALL_SUCCESS is returned and *wipe_cache is true on // exit, caller should wipe the cache partition. int install_package(const std::string& package, bool* wipe_cache, bool needs_mount, @@ -42,12 +49,17 @@ int install_package(const std::string& package, bool* wipe_cache, bool needs_mou // otherwise return false. bool verify_package(const unsigned char* package_data, size_t package_size); -// Read meta data file of the package, write its content in the string pointed by meta_data. -// Return true if succeed, otherwise return false. -bool read_metadata_from_package(ZipArchiveHandle zip, std::string* metadata); +// Reads meta data file of the package; parses each line in the format "key=value"; and writes the +// result to |metadata|. Return true if succeed, otherwise return false. +bool ReadMetadataFromPackage(ZipArchiveHandle zip, std::map<std::string, std::string>* metadata); // Verifies the compatibility info in a Treble-compatible package. Returns true directly if the // entry doesn't exist. bool verify_package_compatibility(ZipArchiveHandle package_zip); +// Checks if the the metadata in the OTA package has expected values. Returns 0 on success. +// Mandatory checks: ota-type, pre-device and serial number(if presents) +// AB OTA specific checks: pre-build version, fingerprint, timestamp. +int CheckPackageMetadata(const std::map<std::string, std::string>& metadata, OtaType ota_type); + #endif // RECOVERY_INSTALL_H_ |