summaryrefslogtreecommitdiffstats
path: root/install/package.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-06-14 04:34:47 +0200
committerandroid-build-merger <android-build-merger@google.com>2019-06-14 04:34:47 +0200
commitf7498516cae7ea7c1e6c907666c281ed1f015e90 (patch)
treea140b3170452f8d029d38f3dfa57aedc704759b6 /install/package.cpp
parentMerge "Use the new ziparchive Next std::string_view overload." am: 053ea111a7 (diff)
parentMerge "InstallPackage now takes a package as parameter" (diff)
downloadandroid_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.tar
android_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.tar.gz
android_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.tar.bz2
android_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.tar.lz
android_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.tar.xz
android_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.tar.zst
android_bootable_recovery-f7498516cae7ea7c1e6c907666c281ed1f015e90.zip
Diffstat (limited to 'install/package.cpp')
-rw-r--r--install/package.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/install/package.cpp b/install/package.cpp
index 4402f4855..86fc0647d 100644
--- a/install/package.cpp
+++ b/install/package.cpp
@@ -40,12 +40,20 @@ class MemoryPackage : public Package {
~MemoryPackage() override;
+ PackageType GetType() const override {
+ return PackageType::kMemory;
+ }
+
// Memory maps the package file if necessary. Initializes the start address and size of the
// package.
uint64_t GetPackageSize() const override {
return package_size_;
}
+ std::string GetPath() const override {
+ return path_;
+ }
+
bool ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) override;
ZipArchiveHandle GetZipArchiveHandle() override;
@@ -82,10 +90,18 @@ class FilePackage : public Package {
~FilePackage() override;
+ PackageType GetType() const override {
+ return PackageType::kFile;
+ }
+
uint64_t GetPackageSize() const override {
return package_size_;
}
+ std::string GetPath() const override {
+ return path_;
+ }
+
bool ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) override;
ZipArchiveHandle GetZipArchiveHandle() override;
@@ -253,7 +269,7 @@ ZipArchiveHandle FilePackage::GetZipArchiveHandle() {
return zip_handle_;
}
- if (auto err = OpenArchiveFd(fd_.get(), path_.c_str(), &zip_handle_); err != 0) {
+ if (auto err = OpenArchiveFd(fd_.get(), path_.c_str(), &zip_handle_, false); err != 0) {
LOG(ERROR) << "Can't open package" << path_ << " : " << ErrorCodeString(err);
return nullptr;
}