Add snapshot_enabled field to DeltaArchiveManifest.
When this field is set, OTA client should try to use snapshots
during updates. If it is not set, OTA client MUST NOT use snapshots.
This field is set iff the target build has Virtual A/B feature enabled
/ retrofitted (except for secondary OTAs, where system_other should
be written directly).
In follow-up CLs, DynamicPartitionControlAndroid only maps partitions
as snapshots if this flag is set. DeltaPerformer may skip in-place
SOURCE_COPY operations if snapshots are created.
Note that:
- On retrofit Virtual A/B devices, this field is always set. If
updating from a non Virtual A/B build to a Virtual A/B build, the OTA
client on the device would simply ignore this field and perform a
regular A/B OTA.
- When downgrading a retrofit Virtual A/B device back to a regular A/B
build, this field is NOT set, and the OTA client will create the
target slot partitions as usual.
- When sideloading a full OTA in recovery, OTA client cannot create
any snapshots. This field is effectively ignored (as if it were set to
false).
Fixes: 141720569
Test: build OTA
Test: update_engine_unittests
Test: apply Virtual A/B OTA
Change-Id: I1939b24f6687f66a682cd6b7ae826f27acf98e2f
diff --git a/payload_generator/payload_generation_config.cc b/payload_generator/payload_generation_config.cc
index 648fe8b..2dd2626 100644
--- a/payload_generator/payload_generation_config.cc
+++ b/payload_generator/payload_generation_config.cc
@@ -160,6 +160,11 @@
}
}
}
+
+ bool snapshot_enabled = false;
+ store.GetBoolean("virtual_ab", &snapshot_enabled);
+ metadata->set_snapshot_enabled(snapshot_enabled);
+
dynamic_partition_metadata = std::move(metadata);
return true;
}
diff --git a/update_metadata.proto b/update_metadata.proto
index 7e8e7d4..1657a7e 100644
--- a/update_metadata.proto
+++ b/update_metadata.proto
@@ -302,6 +302,12 @@
// - If an updatable group is in the manifest but not on the device, the group
// is added to the device.
repeated DynamicPartitionGroup groups = 1;
+
+ // Whether dynamic partitions have snapshots during the update. If this is
+ // set to true, the update_engine daemon creates snapshots for all dynamic
+ // partitions if possible. If this is unset, the update_engine daemon MUST
+ // NOT create snapshots for dynamic partitions.
+ optional bool snapshot_enabled = 2;
}
message DeltaArchiveManifest {