Add partition writer class.
Previously, delta_performer assumes that each InstallOp can be processed
independently, and therefore it creates an ExntentWriter instance for
every operation. It also assumes that source/target partition can be
read/written using raw system file descriptors.
With the introduction of Virtual Ab Compression, both assumptions fall
apart. We need to process all SOURCE_COPY operations and reorder them
according to merge sequence, which means InstallOperations are no
longer independent of each other. Also, VABC requires us to perform
writes using their ICowWriter interface, as opposed to read/write
syscall.
We can add extra logic to handle these cases, but that will make the
already huge delta_performer.cc even bigger. It's 2000 lines right now.
So instead, we plan to add an additional class called PartitionWriter.
Which is supposed to perform partition level initialization, such as
performing SOURCE_COPY ahead of time according to merge sequence,
setting up snapshot devices, etc. This will make our code more
maintainable.
The purpose of this CL is to refactor DeltaPerformer, and move some of
the logic into PartitionWriter. Future CLs will add a PartitionWriter
for VABC.
Test: treehugger, generate && serve an OTA
Bug: 168554689
Change-Id: I305fe479b22d829dde527ee01df0e48e4dcb7b46
diff --git a/Android.bp b/Android.bp
index c5e66e3..acd3633 100644
--- a/Android.bp
+++ b/Android.bp
@@ -690,6 +690,7 @@
"payload_consumer/certificate_parser_android_unittest.cc",
"payload_consumer/delta_performer_integration_test.cc",
"payload_consumer/delta_performer_unittest.cc",
+ "payload_consumer/partition_writer_unittest.cc",
"payload_consumer/download_action_android_unittest.cc",
"payload_consumer/extent_reader_unittest.cc",
"payload_consumer/extent_writer_unittest.cc",