summaryrefslogtreecommitdiff
path: root/aosp
AgeCommit message (Collapse)Author
2022-02-05update_engine: Add performance modeHEADsugisawa-mr1sugisawaGabriele M
Author: Gabriele M <moto.falcon.git@gmail.com> Date: Thu Jun 14 01:10:09 2018 +0200 update_engine: Add performance mode Allow to move update_engine from the system-background cgroup to the foreground cgroup to speed up the installation of the updates. Change-Id: Iaa531a925f9e1a26e834d7448c4755151adcfea2 Author: Luca Stefani <luca.stefani.ge1@gmail.com> Date: Mon Mar 4 14:57:28 2019 +0100 Move performance mode to top app Change-Id: I436102b4f8d046b8f3d897882613ec46acf9e2c5 luca020400: Move to TaskProfiles API Change-Id: Id7e27b0c42d80c4a3ce1dc7f8540313a7042db53
2021-07-01Report source and target build fingerprints in SNAPSHOT_MERGE_REPORTED.David Anderson
Bug: 188909957 Test: manual test Change-Id: I108c20cf1e092478be2ae59701514f32d9b0a9f3 Merged-In: I108c20cf1e092478be2ae59701514f32d9b0a9f3
2021-07-01Record the source build fingerprint in SnapshotMergeStats.David Anderson
This also adds a manual call to WriteState(). If update_engine crashes or the device reboots, it's possible that certain stats (such as the COW file stats) will be gone by the time the merge state is recovered. Forcing a write prevents this. Note that the write was previously implicit in set_cow_file_size, but is now explicit before calling InitiateMerge(). Bug: 188909957 Test: manual test Change-Id: I27cdc72272a9fa4ff5df4968e200fc14f63d0146 Merged-In: I27cdc72272a9fa4ff5df4968e200fc14f63d0146
2021-05-17Clean up reserved space for decompression when OTA cancelledMohammad Samiul Islam
OTA can terminate in the following ways: 1) Before reboot, intentionally cancelled. 2) Before reboot, failed due to error 3) After reboot, failed due to error 4) After reboot, success Cleaning up from ResetStatus should cover #1. For #2, there won't be automatic cleanup on failure, as sometimes we resume OTA from where it last failed. So user needs to explicitely call ResetStatus to clean up. for #2. Number #3 and #4 will be dealt in follow up cl. Bug: 172911822 Test: Case #1: Intentionally cancel 1. Allocated space: python3 update_device.py --allocate-only ota.zip 2. Temp file deleted by: adb shell update_engine_client --reset_status Change-Id: Id6844e4ce4f248605b4a9ae07268dea55d629265 Merged-In: Id6844e4ce4f248605b4a9ae07268dea55d629265 (cherry picked from commit b5c07bfe7eae04ce383af4eecb1b1c44bea8333f)
2021-05-13ResetStatus if update_engine boot in different slot but same buildKelvin Zhang
Old behavior: When update_engine starts up after device take OTA and reboot, if device booted into a different build(check build fingerprint), ResetStatus(). When we apply a self-ota, device will boot into the same build, so ResetStatus() is never called. If we apply the same OTA at this point, this OTA will be treated as a "resume", and will fail to install because we never call libsnapshot's API to allocate snapshot for new update. Changed to ResetStatus() if boot slot changed, or build fingerprint changed. Bug: 185019674 Test: apply self-full OTA, reboot, repeat 2 times. Change-Id: Idcc29dc1c02f3b9b2c84ed1978abedb651a3875a
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-29Don't call into apexservice if device uses flattened apexesNikita Ioffe
If device doesn't support updatable apexes (a.k.a. uses flattened apexes), then it won't have compressed apexes, so there is no need calling into apexd. Test: atest update_engine_unittests:ApexHandlerAndroidTest Test: build and flash aosp_cf_x86_phone_noapex-userdebug Test: m dist Test: python3 system/update_engine/scripts/update_device.py --file out/target/product/vsoc_x86_noapex/aosp_cf_x86_phone_noapex-ota-eng.ioffe.zip Test: checked OTA was successfully staged Bug: 185862111 Change-Id: Ibf9db757f3af37d23fb8248108b2b6d22c95dec7
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-28Report merge failure code from SnapshotMergeReported.David Anderson
Bug: 185290850 Test: statsd_testdrive Change-Id: I743ca357225140635aae7a0b77338d35e64298da
2021-04-28Propagate the merge failure code to SnapshotMergeStats.David Anderson
Bug: 185290850 Test: manual test Change-Id: I094c705a5a275e289eddb8f42e68e08f56975c83
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-04-08Add vabc boot time and COW size metrics.David Anderson
Bug: 180535575 Test: statsd_testdrive Change-Id: I8b40d069ff8c271ea40b3475003058ac6a940f76
2021-04-06Add unittest for CleanupPreviousUpdateActionKelvin Zhang
We had a severe bug in CleanupPreviousUpdateAction, undetected for a while. Added unittest to cover the bug so we don't regress. Bug: 169436297 Bug: 178637306 Test: th Change-Id: I40fc97a5c771ec001896ecd8f6d46b551cc7724c
2021-04-02Fix a potential wild pointer error when markSlotSuccessful comes lateKelvin Zhang
Bug: 178637306 Bug: 169436297 Test: make boot control's IsSlotMarkedSuccessful always return false, launch update_engine Change-Id: I12c01c5f062ec4b41718f2cada817f6557eb2b0e
2021-03-31Report metrics on whether verity is usedKelvin Zhang
Test: th Change-Id: Ide00028036b8b382a233b52716795a5c5c8da4e6
2021-03-30Allow /postinstall files to have custom contextsAlex Light
We were mounting /postinstall with a 'context=...' option. This forces all files within /postinstall to have a single selinux context, limiting the possible granularity of our policies. Here we change it to simply default to the 'postinstall_file' context for the 'system' partition but allow individual files to have their own custom contexts defined by /system/sepolicy. Other partitions retain the single 'postinstall_file' context. The sample_images were updated to manually add a selinux label for testing FS contexts. Test: Manual OTA of blueline Test: atest update_engine_unittests Bug: 181182967 Change-Id: I0b8c2b2228fa08afecb64da9c276737eb9ae3631 Merged-In: I0b8c2b2228fa08afecb64da9c276737eb9ae3631
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-17Make update_engine reserve space for decompression via apexdMohammad Samiul Islam
Bug: 172911822 Test: atest ApexHandlerAndroidTest (checked that file was created) Change-Id: I8024695ebba1a9c1796c05b27a0eec3da3b3d1bc
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-12Record VAB boot time metrics.David Anderson
Bug: 180535575 Test: apply OTA, snapshotctl dump Change-Id: Iedd761b2f6923a56b11f9d6868d6baf569ad38d0
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-10Actually abort update_engine for CHECK failureTianjie
__android_log_write won't abort the program by itself. Since we are not using libchrome's aborter, call __android_log_assert explicitly on FATAL errors. Bug: 182310095 Test: check update_engine aborts for CHECK failure Change-Id: I41805f2b8294bba696e713100088dd720dd66356
2021-03-10Verify that dynamic partitions have a usable size after resizing.David Anderson
Bug: 174881019 Change-Id: I24197f86e3fa832029db6aaaf186468600748b40
2021-03-09Collect more COW size data in SnapshotMergeReport.David Anderson
Bug: 180535575 Test: manual test Change-Id: Ie35aad243ed57406a963e136ddf91fc67f20d6ca
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-03-01Add a util for converting ota payload to cow imageKelvin Zhang
VAB team can use this tool to understand what real world COW images look like, and perhaps write unittests How to use this tool: 1. mm -j cow_converter 2. `unzip your_ota.zip payload.bin` 3. `unzip target_file.zip "IMAGES/*" -d /tmp/target_file 4. `cow_converter payload.bin /tmp/target_file/IMAGES` 5. inspect generated cow images `ls -l /tmp/target_file/IMAGES/*.cow` Test: cow_converter payload.bin /tmp/target_file/IMAGES Change-Id: I2c9d1ea566378e3350a048c40ff05a79d14873e8
2021-02-23Allow update_engine to communicate with apexd for size calculationMohammad Samiul Islam
In this CL, we created a ApexHandlerAndroid that can communicate with apexd via binders to get better estimate for how much space the update_engine should reserve for capex decompression. The size check is placed in update_attempter_android, which is also used in binary for sideloading OTA. Sideloading binary runs during recovery when binder calls, apexd and data parition are all not available. As such, it doesn't make sense to reserve space when sideloading. Bug: 172911822 Test: atest ApexHandlerAndroidTest Test: atest UpdateAttempterAndroidTest Test: manually served ota using `update_engine_client --allocate` and observed full.tmp was written in /data/apex/ota_reserved Change-Id: Iccf3d8c2db24e8d8f3406d0aaa65cbf707c9ae51
2021-02-23Reserve space for apex by creating a file and write 0sKelvin Zhang
For first version, we let update_engine compute size requirements by adding up decompressed sizes. Then update_engine creates a file at a fixed path and write 0s to that file to reserve space. Test: treehugger, serve an OTA, make sure /data/apex/ota_reserved is present Bug: 172911822 Change-Id: I2f44289711b1daa064af8ead66cc1293dad89dc7
2021-02-17Detect if update is already running when updating with file descriptorHÃ¥kan Kvist
If update_engine is triggered with file descriptor when an update is already running, the running update will be aborted. Update will be aborted due that existing file descriptor is reset. Check if update_engine is already running before resetting/closing file descriptor. Test: manual, make multiple calls rapidly to java api UpdateEngine.applyPayload with package in file descriptor Bug: 178895193 Change-Id: I9c575870b435d2221787eb29d95279328e20fdbe
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-11Add vabc flag to UpdateAttemptReported / SnapshotMergeReported.Yifan Hong
Test: statsd_testdrive Bug: 178732971 Change-Id: I1a3614244ec0cded17ba2423122e0505f079ef25
2021-02-11MetricsReporter gets DynamicPartitionControl.Yifan Hong
Test: TH Bug: 178732971 Change-Id: If434927b7abdecb8093db1462dae196cd744331a
2021-02-10UpdateAttempterAndroidTest: Fix field init orderYifan Hong
The module under test, UpdateAttempterAndroid, must be initialized after all dependencies have been initalized. Test: no more segfault Change-Id: I4524ee59ebe6194b5e07b2f9edb702ce07ad14d7
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-02-08Propagate the update compression status into SnapshotMergeStats.David Anderson
Test: apply update, then statsd_testdrive Bug: 178732971 Change-Id: Idf4b1d5fe3283c0cf659c7660d658a758b62b740
2021-01-28Calculate vbmetadigest of inactive slotTianjie
We want to improve the security of the keystore encryption key for resume on reboot. One AI is to create the key with the vbmeta digest of the next slot to boot into. After reboot, the decryption will fail if ro.boot.vbmeta.digest of the new slot doesn't match the calculated value before reboot. Since update_engine manages the slot switch, let it calculate the digest as well. Bug: 177625570 Test: do a update, check that the sysprop is set. Change-Id: I74b20fca72f6946d980b93d76990f1c8b8f246a9
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-12-05Merge remote-tracking branch 'aosp/upstream-master' into mergeKelvin Zhang
Test: treehugger Change-Id: I4984f03fa95a753fb17779451eb458f177432d4f
2020-12-03update_engine: Make InstallPlan's dump nicerAmin Hassani
Its really hard to read anything out of the current InstallPlan's logs. This CL makes it a bit more structured so it can be read easier. Also added a few other properties of InstallPlan that were missing in the Dump(). Added unittest for it too. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_engine Change-Id: Iaa327e875877e9645ef8f0af875c280e11ee485d Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2558933 Tested-by: Amin Hassani <ahassani@chromium.org> Auto-Submit: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
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-16Rename mock_dynamic_partition_control toKelvin Zhang
mock_dynamic_partition_control_android The mock contains android specific behaviors, so appending the filename with "android" Test: treehugger Change-Id: Ic6e53e07a4645e4f854c1fb22e0fa9f7f911bef3
2020-11-16Add OpenCowReader interface method to dynamic partition controlKelvin Zhang
Test: treehugger Change-Id: I393fc36372f9e979da1a6c7e49c7782a7372a5b9
2020-11-14update_engine: Make SystemState accessible from everywhereAmin Hassani
SystemState is supposed to be a global context and is used lamost everywhere. So instead of passing it to functions and keeping multiple pointers to it, its better to do what we did in dlcservice and make it a singleton class with a getter that can be get from everywhere. BUG=b:171829801 TEST=unittests Change-Id: I3b2de9394b7769b3911195ca52d61dbe49afd4dd Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2521792 Commit-Queue: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>