InstallPackage now takes a package as parameter

Therefore InstallPackage() doesn't need to worry about the details of a
given Package.

Bug: 127071893
Test: run update from /bin/recovery --update_package=@path, sideload a package
Change-Id: I0caa36785b43924f884ee398e7ea640d7472a92e
This commit is contained in:
Tianjie Xu
2019-06-11 15:43:43 -07:00
parent 533a12c71e
commit 980f92ec00
7 changed files with 83 additions and 53 deletions
+6 -5
View File
@@ -44,11 +44,12 @@ enum class OtaType {
BRICK,
};
// Installs the given update package. This function should also wipe the cache partition after a
// successful installation if |should_wipe_cache| is true or an updater command asks to wipe the
// cache.
InstallResult InstallPackage(const std::string& package, bool should_wipe_cache, bool needs_mount,
int retry_count, RecoveryUI* ui);
// Installs the given update package. The package_id is a string provided by the caller (e.g. the
// package path) to identify the package and log to last_install. This function should also wipe the
// cache partition after a successful installation if |should_wipe_cache| is true or an updater
// command asks to wipe the cache.
InstallResult InstallPackage(Package* package, const std::string_view package_id,
bool should_wipe_cache, int retry_count, RecoveryUI* ui);
// Verifies the package by ota keys. Returns true if the package is verified successfully,
// otherwise returns false.
+9
View File
@@ -28,6 +28,11 @@
#include "verifier.h"
enum class PackageType {
kMemory,
kFile,
};
// This class serves as a wrapper for an OTA update package. It aims to provide the common
// interface for both packages loaded in memory and packages read from fd.
class Package : public VerifierInterface {
@@ -41,6 +46,10 @@ class Package : public VerifierInterface {
virtual ~Package() = default;
virtual PackageType GetType() const = 0;
virtual std::string GetPath() const = 0;
// Opens the package as a zip file and returns the ZipArchiveHandle.
virtual ZipArchiveHandle GetZipArchiveHandle() = 0;