summaryrefslogtreecommitdiff
path: root/aosp/dynamic_partition_control_android.cc
AgeCommit message (Collapse)Author
2021-05-05Rename postinstall_mount_device to readonly_target_pathKelvin Zhang
When postinstall_mount_device is initially introduced, it's only intended to be used by postinstall action, hence the name. Now we plan to use it for fs verification purpose as well, rename for better clarity. Test: th Change-Id: Iff996f2f513bb44694e39d758a69851793b9a565
2021-04-28Check for VAB flag before calling UpdateUsesCompressionKelvin Zhang
On a device which doen't support VAB, calligng UpdateUsesCompression directly will cause libsnapshot to print error logs. Therefore check for VAB support first. Test: th Change-Id: Icfbf848908939069493f6c10f6a69f022b9b8350
2021-04-16DynamicPartitions: Check precondition for non-snapshot updates properly.Yifan Hong
This is a revision to I29af8aa653a8e. I29af8aa653a8e disables the check temporarily for secondary OTA. Re-enable the check properly. Test: pass Bug: 185552745 Change-Id: Ie4e52b8d374c6b3624a2fd4f1576390a37189ff0
2021-04-16CheckSuperPartitionAllocatableSpace: based on device propYifan Hong
Check allocatable space in super based on whether VAB is enabled on the device, instead of basing on whether snapshot is used for this update. On VAB devices where snapshot is not used, e.g. secondary update, we don't want to divide allocatable space by half. The logic changes from: if (!retrofit DAP && ! update uses snapshot && !sideload) allocatable_space /= 2 to if (!retrofit DAP && ! VAB enabled) allocatable_space /= 2 All other changes are cosmetic. Test: pass Bug: 185552745 Change-Id: If182da4fdbc4b39160347205ccfa50642afc5511
2021-03-27Check the super partiton size in VAB caseTianjie
When the snapshot is used, we should check that the maximum size of all dynamic partition groups doesn't exceed the super partition size. Bug: 182431975 Test: primary payload fails as expected Pixel21 Change-Id: I5df8976e6b7e011284b29fd554dda80e31305698
2021-03-24Make dynamic partition control android return a writable fdKelvin Zhang
We can return a FileDescriptor object, which encapsulates logic needed to write to a COW. This way, filesystem verfication action can use the turend value directly for computing verity and hash the partition. Test: th Change-Id: Iafe9699ef0cc15961641fc94f8ad2820230a56e1
2021-03-22Unmap all partitions after postinstall finishesKelvin Zhang
If we don't unmap partitions, snapuserd will keep running in the background and do nothing. Unmap partitions so that memory associated with daemon can be freed. Test: th, apply an OTA, verify that _b partitions in /dev/block/mapper are gone Change-Id: I4a75f4abe3e69f9ad2a67a78472b61cfbd77b0eb Change-Id: Icacf1699a32bf045c2b832f7c1f021d90805d676
2021-03-16Pass in source slot to ctor of dynamic controlKelvin Zhang
When DynamicPartitionControlAndroid is constructed, it initializes both source and target slot to -1. These values get updated during PreparePartitionsForUpdate call. And we only PreparePartitionsForUpdate() when applying an OTA or applocating space for an OTA(not when verifying OTA metadata). Which means if VerifyPayloadApplicable() is called before any call two other APIs, we could be using an "Uninitialiazed" dynamic partition control. To mitigate this problem, we pass in source_slot at ctor of DynamicPartitionControl, also make IsDynamicPartition() api take in a slot number to avoid reading uninitialized member fields. Bug: 181643302 Test: apply an OTA, abort, restart update_engine, verify a payload Change-Id: I9a8a0fe8a9aca48e91241e15bdec33a1c1228553
2021-03-11Emit a warning instead of abortingKelvin Zhang
When applying a secondary payload, we might call UpdatePartitionMetadata without VAB, so don't abort Bug: 182310095 Test: th Change-Id: I29af8aa653a8e3ccb37df2651883c6da09f727c7
2021-03-10Verify that dynamic partitions have a usable size after resizing.David Anderson
Bug: 174881019 Change-Id: I24197f86e3fa832029db6aaaf186468600748b40
2021-03-02Fix incorrect mountable device path for VABCKelvin Zhang
Test: serve an OTA with postinstall, make sure postinstall works Bug: 181182967 Change-Id: Ifd44bb700c4bca28a391c64fbc9888c79612f26f
2021-02-17Use UpdateUsesSnapshotCompression to determine if VABC is usedKelvin Zhang
Test: th Change-Id: Ia04f92d46da34fcd28d7e97c24b6e02fd676e1c7
2021-02-16Don't list dynamic if a slot doesn't support DAPTianjie
If a slot doesn't support dynamic partitions, it's impossible to list dynamic partitions on that slot. And we should just fall back to the regular A/B in this case. Bug: 180025432 Test: apply a retrofit package Change-Id: I16c457b591e8c1d0cf1077a7be50dd9d8f61b8eb
2021-02-10Add DynamicPartitionControlInterface::UpdateUsesSnapshotCompressionYifan Hong
This function returns whether Virtual A/B compression is enabled for the ongoing update. Test: TH Bug: 178732971 Change-Id: I781802443afd1d8deac046a8da198658220f7ba0
2021-01-25Correctly propagate not_in_payload flagKelvin Zhang
When mapping partitions, not_in_payload flag decides if the partition needs to be mapped as a snapshot backed by COW, propagate this flag. Test: treehugger Change-Id: I9f0073fb91067410978927e59bf51c4f2cd152e6
2021-01-22Don't use VABC in recoveryKelvin Zhang
Test: boot into recovery, make sure OTA works Change-Id: I672d18806b2dbaf259ede406ef49f9baed2d0c6e
2020-11-23Do not map dynamic partitions on VABC devicesKelvin Zhang
With VABC, we no longer need to map all partitions before reading/writing, so don't try to map them. 1. modify GetPartitionDevice to return empty path for target partitions on VABC 2. Add a separate GetMountableTargetDevice for obtaining a mountable device path, specifically for postinstall Test: treehugger Change-Id: Ib1f608914fc49c677ce7389140ca79b028171191
2020-11-17Use FileDescriptorPtr to implement async reads in verify stageKelvin Zhang
During FileSystemVerify stage, update_engine needs to read from source or target partition to verify hashes && write verity. Previously we use brillow's file stream to implement async reads. WIth Virtual AB Compression, reading from target partition must go through libsnapshot's interface(FileDescriptorPtr). So we replace brillo::FileStream with FileDescriptorPtr for ease of integrating with VABC. Test: serve an OTA update, verify: slot switch resume, regular resume Change-Id: Id8531757468f60e3e21667b7761b83f7c2af2dbf
2020-11-17Add IsDynamicPartition API to easily check if a partition is dynamicKelvin Zhang
Test: treehugger Change-Id: I655e4d6114a25c58857679985cd5e08581c0faab
2020-11-16Add OpenCowReader interface method to dynamic partition controlKelvin Zhang
Test: treehugger Change-Id: I393fc36372f9e979da1a6c7e49c7782a7372a5b9
2020-11-13Add timeout to OpenCowWriterKelvin Zhang
Without a timeout, update_engine might observe race conditions where a device is mapped but it doesn't appear on filesystem yet. Bug: 168554689 Test: treehugger Change-Id: I91f7cd82f5a10a8d60bdb157a57bfcbbc5c9f964
2020-11-03Merge remote-tracking branch 'aosp/upstream-master' into mergeTianjie
git merge aosp/upstream-master --commit -s recursive Test: treehugger Change-Id: Ifab9f47e1c5bea3898e78df0139d10842b41a44f
2020-11-03update_engine: Create cros vs. aosp boundary clearAmin Hassani
Its time to make the boundary between Chrome OS and Android code more clear. This CL moves all CrOS only code to "chromeos" directory and the same for Android (in "android" directory). This way we would easily know which code is uses in which project and can keep the code cleaner and more maintainable. One big remaining problem is download_action* files. It seems like DownloadAction class does a lot of things that chrome OS needs and it depends on a lot of Chrome OS stuff, but Android is also using thie Action in a way that circumvent the Chrome OS stuff. For example Android checks for SystemState to be nullptr to not do things. This is really fragile and needs to change. Probably Android Team has to implement their own DownloadAction of some sort and not re use the Chrome OS one in a very fragile way. Removed a few android files that have not been used anywhere. Changed some clang-format and lint issues in order to pass preupload. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_engine Change-Id: I3fff1d4a100a065a5c1484a845241b5521614d9f Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2508965 Tested-by: Amin Hassani <ahassani@chromium.org> Auto-Submit: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Tianjie Xu <xunchang@google.com> Reviewed-by: Kelvin Zhang <zhangkelvin@google.com> Commit-Queue: Amin Hassani <ahassani@chromium.org>