summaryrefslogtreecommitdiff
path: root/dynamic_partition_control_interface.h
AgeCommit message (Collapse)Author
2019-11-13Move DynamicPartitionControlInterface to common/Yifan Hong
Test: builds Change-Id: Iae63dee2e2c4f768690d27261347f56b90bdf2c5
2019-11-13Proper split of BootControl and DynamicPartitionControl.Yifan Hong
All dynamic/static partitions stuff are moved to DynamicPartitionControlAndroid. After this patch: (1) BootControl remains a simple shim over the boot control HAL. (BootControl still have two calls that is a delegate to DynamicPartitionControl, which will be cleaned up in follow up CLs.) (2) DynamicPartitionControlInterface API is minimized. All libdm and other Android specific details are hidden from the API surface now. Also move tests from boot_control_unittest to dynamic_partition_control_unittest because functionalities are moved. Test: update_engine_unittests Change-Id: I6ed902197569f9f0ef40e02703634e9078a4b060
2019-10-23Sanity check that no downgrade package on launch VAB device.Yifan Hong
If the OTA server were misconfigured, OTA client can reject the OTA if the current device launches with VAB but is trying to update to a build that does not support VAB. This operation is only permitted on retrofit devices. Bug: 138258570 Test: pass Change-Id: I159ff2edc81555fee8bfa6296e0c6c969f2f4f6d
2019-10-17DynamicPartitionControl: only create snapshot when snapshot_enabledYifan Hong
Do not create snapshot when applying downgrade to non-Virtual-A/B packages and secondary OTAs. Test: apply downgrade OTA on Virtual A/B devices Bug: 138733621 (secondary OTA) Fixes: 138258570 (downgrades) Change-Id: I13318f57613d6bd60a5b7e81ebb3e35b3c225a0c
2019-09-23Call SnapshotManager::FinishedSnapshotWritesYifan Hong
... when the update has finished. This allows SnapshotManager to conclude the update and prepare for reboot. Test: builds Test: apply OTA on Virtual A/B device, then check /metadata/ota/snapshot-boot exists, then reboot Bug: 138816109 Change-Id: I2a4699865b09358ef018313bed64e34617a78e3c
2019-09-23[REFACTOR] Pass DeltaArchiveManifest to DynamicPartitionControlYifan Hong
DynamicPartitionControl need the list of operations to calculate COW sizes. - Remove BootControlInterface::PartitionMetadata. Replace all references with DeltaArchiveManifest. DeltaArchiveManifest has all information that PartitionMetadata has. - Rename all InitPartitionMetadata to PreparePartitionsForUpdate - Change all PreparePartitionsForUpdate to use new signature Bug: 138816109 Test: update_enigne_unittests --gtest_filter=*BootControl*:*Dynamic* Change-Id: I4389ba2b1801addf8c3bc8395e2ea6a9a3ed27a0
2019-08-29DynamicPartitionsControl: Add Virtual A/B feature flag.Yifan Hong
Test: unittest Bug: 138816109 Change-Id: I7ae65ba0bf36a6ca5085bc4ec2c46245288b4703
2019-07-31[REFACTOR] DynamicPartitionControl: Add GetSuperPartitionNameYifan Hong
fs_mgr_get_super_partition_name() should be mocked because it is an external dependency to libfs_mgr. In tests, deliberately make GetSuperDevice() to return "fake_super" instead of "super" to make sure it is mocked properly. Test: run unittests Test: manually apply OTA Change-Id: I0f05d99bf168b6e658052b4bd67dc1e82ab36471
2019-07-31[REFACTOR] DynamicPartitionControl: combine DAP feature flag APIsYifan Hong
Combine IsDynamicPartitionsEnabled/Retrofit into one API that returns a FeatureFlag struct instead. This allows us to add new feature flags more easily. Test: unittest Change-Id: I32f0f0c4d5c636d2eac3bf99d6f92fcc6b71c7a9
2019-07-31[REFACTOR] DynamicPartitionControl: minimize APIYifan Hong
- Move UpdatePartitionMetadata in boot_control_android.cc to DynamicPartitionControlAndroid::PreparePartitionsForUpdate to reflect code ownership better. - Minimize the API by removing unused functions now that we have PreparePartitionsForUpdate - Fix tests: replace MockDynamicPartitionControl to MockDynamicPartitionControlAndroid because it tests DynamicPartitionControlAndroid. Test: unit test Test: manually apply full OTA Change-Id: I2959270bd89c4f8ddaa45cf45ba93acdec850f67
2019-07-13Fix build for API change to DestroyLogicalPartition().David Anderson
This method no longer uses a timeout parameter. Bug: 135771280 Test: update_engine and update_engine_unittests build Change-Id: If4764bf2d60c6b3aac1e8052c7fbb013c7b3349d
2018-11-20Retrofit devices do not do allocatable space / 2.Yifan Hong
Retrofit devices have two supers, so the allocatable space does not need to be halved. Test: manual OTA Bug: 118506262 Change-Id: I31c77b9318e7c0b6bc6d1a8ae6efa70a3383b05f
2018-11-15DynamicPartitionControl: support retrofit devicesYifan Hong
On retrofit devices: * The retrofit update includes block devices at source slot (for example, system_a, vendor_a, product_a). This is done automatically because the retrofit update does not look different from regular updates in OTA client's perspective. * The first update after the retrofit update includes the rest of the block devices (in the above example, system_b, vendor_b and product_b). In order to do the second, * use NewForUpdate() API from liblp to automatically include block devices at the target slot when the metadata is loaded. * Use FlashPartitionTable() API to flash metadata to system_b directly without reading existing metadata from it. Test: manual OTA on retrofit devices Bug: 118506262 Change-Id: Ib2c15b8a1a04271320bfef408813723a5b2a7bd7
2018-10-30Add force_writable to MapPartitionOnDeviceMapperYifan Hong
In sideloading we will map source partitions with force_writable = false. Test: manual sideloading Bug: 117101719 Change-Id: I7629b8ecce07a9bd2c9e24ac6b64617386067ca5
2018-09-28update_engine resize dynamic partitions during OTA.Yifan Hong
update_engine uses device mapper to resize dynamic partitions before opening the devices to apply the update. * DeltaPerformer calls BootControlInterface::InitPartitionMetadata when parsing the update manifest. The implementation for BootControlAndroid::InitPartitionMetadata does the following if sizes for dynamic partitions are incorrect (assuming updating from slot A to B): * Load metadata from metadata slot A * Delete all extents of partitions at slot B (with _b suffix) * Add extents for partitions at slot B * Write metadata to metadata slot B * Re-map all partitions at slot B using metadata slot B with force_writable = true * BootControlAndroid::GetPartitionDevice() checks device-mapper before returning static partitions. * PostinstallRunnerAction::Cleanup calls BootControlInterface::Cleanup which unmaps all partitions at slot B. A partition "foo" is considered dynamic if foo_a exists as a dynamic partition OR foo_b does NOT exist as a static partition. Bug: 110717529 Test: manual ota Test: update_engine_unittests --gtest_filter=*BootControlAndroid* Change-Id: I50f410b486a874242663624801c3694151bdda18