summaryrefslogtreecommitdiffstats
path: root/install.h
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-10-25 19:39:01 +0200
committerTianjie Xu <xunchang@google.com>2018-10-31 19:03:58 +0100
commit93b5bf261ca984dcebdb538b7691fe47576069eb (patch)
treeab26271f7a86709192850d60bd569ceda83852e2 /install.h
parentMerge "Add description for the new translation" (diff)
downloadandroid_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.tar
android_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.tar.gz
android_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.tar.bz2
android_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.tar.lz
android_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.tar.xz
android_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.tar.zst
android_bootable_recovery-93b5bf261ca984dcebdb538b7691fe47576069eb.zip
Diffstat (limited to 'install.h')
-rw-r--r--install.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/install.h b/install.h
index 1d3d0cd27..c6db1d1d9 100644
--- a/install.h
+++ b/install.h
@@ -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_