Moving source class declaration
Moving zipImageSource and localImageSource to header file to be used for
testing purposes
Test: m fastboot
Bug: 194686221
Change-Id: I689e73eb0102d3b2cdd0c4fc232b2b60b9022c47
diff --git a/fastboot/fastboot.h b/fastboot/fastboot.h
index abdf636..4b48d4a 100644
--- a/fastboot/fastboot.h
+++ b/fastboot/fastboot.h
@@ -40,6 +40,7 @@
#include "result.h"
#include "socket.h"
#include "util.h"
+#include "ziparchive/zip_archive.h"
class FastBootTool {
public:
@@ -122,6 +123,22 @@
FlashingPlan* fp_;
};
+class ZipImageSource final : public ImageSource {
+ public:
+ explicit ZipImageSource(ZipArchiveHandle zip) : zip_(zip) {}
+ bool ReadFile(const std::string& name, std::vector<char>* out) const override;
+ unique_fd OpenFile(const std::string& name) const override;
+
+ private:
+ ZipArchiveHandle zip_;
+};
+
+class LocalImageSource final : public ImageSource {
+ public:
+ bool ReadFile(const std::string& name, std::vector<char>* out) const override;
+ unique_fd OpenFile(const std::string& name) const override;
+};
+
bool should_flash_in_userspace(const std::string& partition_name);
bool is_userspace_fastboot();
void do_flash(const char* pname, const char* fname, const bool apply_vbmeta,