summaryrefslogtreecommitdiff
path: root/common
Commit message (Collapse)AuthorAgeFilesLines
* Allow forward merge on powerwash.Yifan Hong2020-03-273-3/+3
| | | | | | | | | | | | | If package schedules powerwash, snapshots on a Virtual A/B device will be deleted. Tell SnapshotManager to handle this case. Test: apply downgrade package Test: apply package with wipe Test: apply package then manually wipe Bug: 152094219 Change-Id: I8601b661924abcc82956788e2f33cdb70d71f778 (cherry picked from commit 7b3910a58bd0b8d9f0bd316fad5776ef0a8494ba) Merged-In: I8601b661924abcc82956788e2f33cdb70d71f778
* ResetStatus deletes snapshots for VAB.Yifan Hong2020-03-173-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When ResetStatus() is called, delete snapshots to free up space on VAB devices. On regular A/B, there is no need to cancel the update completely so that the update may be resumed next time. However, on VAB devices, a cancelled update should not occupy previously allocated space. Test: manually call update_engine_client --cancel when an update is in progress, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Test: manually kill update_engine when an update is in progress, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Test: manually apply an update until UPDATED_NEED_REBOOT, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Test: manually apply an update until UPDATED_NEED_REBOOT, then kill update_engine, then call update_engine_client --reset_status, then call snapshotctl dump to check that snapshots are deleted. Then, re-apply the update. Bug: 147696014 Change-Id: Ic7049772091a34e0e666fd7ae361ef474d5a28aa Merged-In: Ic7049772091a34e0e666fd7ae361ef474d5a28aa
* ShouldSkipOperation -> OptimizeOperationYifan Hong2020-03-123-7/+15
| | | | | | | | | | | | | | | | For SOURCE_COPY operations like 563412 -> 123456 OptimizeOperation optimizes it to 5612 -> 1256 and skip writing blocks that does not need to be written for snapshot partitions. Bug: 148623880 Test: update_engine_unittests Test: apply incremental OTA Change-Id: Ifd2c3851f703f272a74c8f0e9a1c9a82dbcce3e3 Merged-In: Ifd2c3851f703f272a74c8f0e9a1c9a82dbcce3e3
* Delete DynamicPartitionControl::CleanupSuccessfulUpdateYifan Hong2020-03-053-14/+0
| | | | | | | | | It is replaced with GetCleanupPreviousUpdateAction now. Test: builds Bug: 147696014 Change-Id: I8cb281bf811052d1dfea6c14c8685a90915cafa8 Merged-In: I8cb281bf811052d1dfea6c14c8685a90915cafa8
* IUpdateEngine.cleanupSuccessfulUpdate is asyncYifan Hong2020-03-051-1/+2
| | | | | | | | | | | | UpdateAttempterAndroid::CleanupSuccessfulUpdate uses CleanupPreviousUpdateAction, which is asynchronous. Hence, the binder function needs to be asynchronous too. Test: update_attempter_android --merge after update Bug: 147696014 Change-Id: I0ce43db6d75a5a13a105c25645824612bd4d6be3 Merged-In: I0ce43db6d75a5a13a105c25645824612bd4d6be3
* [REFACTOR] Split Android and CrOS logging.Yifan Hong2020-03-052-0/+13
| | | | | | | | | | | | | Previously, they are all cramped in main.cc. Split them into their respective files logging.cc, logging_android.cc and provide a common header, logging.h, that main.cc can use. Bug: 147696014 Bug: 148818798 Test: builds Test: build logging.cc in Android Change-Id: Iafdaee6be20e204f4faa1d1d8f81e43670f08d96 Merged-In: Iafdaee6be20e204f4faa1d1d8f81e43670f08d96
* UpdateAttempterAndroid::Init initiates mergeYifan Hong2020-03-054-0/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On update_engine starts, schedule CleanupPreviousUpdateAction that calls CleanupSuccessfulUpdate to do necessary cleanup as soon as possible. In the good case, update_engine initiates merge when sys.boot_completed, and clean up snapshots. If the update is rolled back or partitions are flashed, the following happens (on a Virtual A/B device): - UpdateAttempterAndroid::CleanupSuccessfulUpdate is called - DynamicPartitionControlAndroid::CleanupSuccessfulUpdate is called - SnapshotManager::InitiateMergeAndWait is called - SnapshotManager::RemoveAllUpdateState(before_cancel) is called - before_cancel is called, DeltaPerformer::ResetUpdateProgress is called - All update states in update_engine is reset. - SnapshotManager proceeds to delete snapshots - All update states in SnapshotManager is reset. Hence, on an VAB device, when an update is rolled back or partitions are flashed, the whole update needs to be re-applied (while in A/B, it skips writing and directly start verifying hashes of the target partitions because the update markers are still there). Bug: 147696014 Test: apply OTA then reboot, inspect logs and do `snapshotctl dump` Change-Id: I0fc5e7768dfb53e4fd474f2d8d85d2a1b615a88b Merged-In: I0fc5e7768dfb53e4fd474f2d8d85d2a1b615a88b
* Add CleanupPreviousUpdateAction.Yifan Hong2020-03-051-0/+32
| | | | | | | | | | | | This is an asynchronous implementation of DynamicPartitionControlAndroid::CleanupSuccessfulUpdate, which can be used in UpdateAttempterAndroid later. Bug: 147696014 Test: apply OTA Change-Id: I61ecbf5d28fdc5d2baa8cc8308135a8c7e49ba99 Merged-In: I61ecbf5d28fdc5d2baa8cc8308135a8c7e49ba99
* BootControl: is slot marked successfulYifan Hong2020-03-054-0/+16
| | | | | | | | Test: update_engine_unittests Bug: 147696014 Change-Id: I316efda7a0936e2dee0f766efb5c18ff30790274 Merged-In: I316efda7a0936e2dee0f766efb5c18ff30790274
* Add DynamicPartitionControlInterface::CleanupSuccessfulUpdateYifan Hong2020-01-223-0/+14
| | | | | | | | | | This is a wrapper over SnapshotManager::WaitForMerge. It waits until the previous update is merged, then return. Bug: 138808328 Test: manual with update_engine_client Change-Id: If44854810f37dd959ffdf3f62f26528867a71fc8
* DynamicPartitionControl: Add required_size to PrepareYifan Hong2020-01-163-3/+10
| | | | | | | | | | | Add out parameter required_size to PreparePartitionsForUpdate to indicate the total size required on /userdata in order to apply the update. Bug: 138808058 Test: update_engine_unittests Change-Id: I2768d13671e212fd24a1a22811b50c9738834459
* DynamicPartitionControl: document FinishUpdateYifan Hong2020-01-151-0/+2
| | | | | Test: none Change-Id: I05d38e913671b120bc804a867cc82a442e8dd379
* Allow update_engine to skip post-installTianjie Xu2020-01-141-2/+1
| | | | | | | | | | | | The postinstall steps take long time to finish, even though most of them are optional. Therefore, reuse the flag run_post_install in InstallPlan to allow skipping optional postinstalls. Bug: 136185424 Test: cancel the update during post-install, apply again with the header "RUN_POST_INSTALL=0", check the optional post-installs are skipped Change-Id: Ic5ab89b079dfd547714fd3d1664e044900f9eebe
* Add ErrorCode::kDeviceCorrupted.Yifan Hong2020-01-022-0/+3
| | | | | | | | | | | | This error code indicates the device is corrupted in a way that it can no longer receive any future updates. Specifically, if a device encounters a merge error, there is no way we can recover that device. Test: pass Bug: 138808328 Change-Id: Idbd9d1bc5bc02bbba157f17f31b2c5ace839243c
* Add ErrorCode::kNotEnoughSpace.Yifan Hong2019-12-132-0/+3
| | | | | | | | | | Virtual A/B now requires space in userdata, which may not be enough during OTA. A kNotEnoughSpace error code is added to indicate such case. Bug: 138808328 Test: builds Change-Id: I6bf7964911c8eb3b9df9b8752018925a99876d0f
* Sync with CrOS error codes.Yifan Hong2019-12-132-0/+9
| | | | | | | | | | | Add to ErrorCode and metrics::DownloadErrorCode: - kInternalLibCurlError - kUnresolvedHostError - kUnresolvedHostRecovered Test: builds Change-Id: Ibe11c02137860aed583b00b7e05b089ef84edb03
* Switch to use libdm to bind loop devicesTianjie Xu2019-12-101-36/+60
| | | | | | | | | | | | | | | | | This is a speculative fix of the flaky unit test. There used to be a race condition when the test tries to find a free loop device and binds to it. Switch to libdm in android to address the race. In the local test, the device gets into a state where kernel fails to open the loop device returned by LOOP_CTL_GET_FREE. This cl tries to prevent the device from entering the erroneous state. Though it's not clear if the test itself put the device into such state. It's still worth trying if there'is less flakiness after this cl. Bug: 145706147 Test: unit tests pass Change-Id: I3abbba2ef801d787c575696f5d0ce553c43545ca
* Only skip operation on snapshot partitionsYifan Hong2019-12-043-4/+9
| | | | | | | | | On Virtual A/B devices, don't skip SOURCE_COPY on static partitions. Test: update_engine_unittest Test: incremental update to self Change-Id: I5c93b501e09f50f559151eb77d83052373c90d0d
* SkipInstallOperation placeholdersAlessio Balsini2019-11-273-0/+9
| | | | | | | | | | | | | | For some devices, some InstallOperations can be skipped during the update process. An example is the SOURCE_COPY operation with same source and destination locations for Virtual A/B devices. This patch extents the DynamicPartitionControl interface with the ShouldSkipOperation() method to query if given operation should be skipped or not. Bug: 141207436 Test: build Change-Id: I94dbf1d33d531944e04cb2ffcba274106e866d5d Signed-off-by: Alessio Balsini <balsini@google.com>
* Schedule a warm_reset after an OTATianjie Xu2019-11-152-0/+7
| | | | | | | | | | The property is set to inform kernel to do a warm_reset on the next reboot. This is useful to persist the logs to debug device boot failures. More details in http://go/rvc-ota-persist-logs. Bug: 143489994 Test: check the property sets after an update Change-Id: I776a6996e3b3ef77514da0acc91585d28e5cdf15
* Remove BootControlInterface::CleanupYifan Hong2019-11-134-10/+0
| | | | | | | | | It is just a wrapper around GetDynamicPartitionControl()->Cleanup(). Delete it and let callers call it instead. Test: update_engine_unittests Change-Id: I068228a43dac122828c28bbc49a0f6f77e5b6ff2
* Remove BootControlInterface::PreparePartitionsForUpdateYifan Hong2019-11-134-26/+4
| | | | | | | | Replace with GetDynamicPartitionControl()->PreparePartitionsForUpdate( GetCurrentSlot(), ...). Test: update_engine_unittests Change-Id: Ib03ee97a25727a9292cbb0c9aab5dbe75a2b6913
* BootControl exposes DynamicPartitionControl.Yifan Hong2019-11-136-1/+121
| | | | | | | | | | | | | | | | | | | | Add BootControlInterface::GetDynamicPartitionControl, which exposes the internal DynamicPartitionControlInterface object. BootControlStub / FakeBootControl / BootControlChromeOS uses DynamicPartitionControlStub (all functions succeeds). BootControlAndroid uses DynamicPartitionControlAndroid. GetPartitionDevice is exposed so that BootControlAndroid can use it. Follow-up CLs delete duplicated PreparePartitionsForUpdate and Cleanup from BootControlInterface so that BootControlAndroid remains a thin wrapper of the HAL (+GetPartitionDevice, which exists before dynamic partitions.) Test: update_engine_unittests Change-Id: Ifc2aa2ee8a63ef581c8ebc562ec158794ac51dfd
* Move DynamicPartitionControlInterface to common/Yifan Hong2019-11-131-0/+70
| | | | | Test: builds Change-Id: Iae63dee2e2c4f768690d27261347f56b90bdf2c5
* Allow skipping timestamp check in certain debug conditionsTianjie Xu2019-10-312-0/+6
| | | | | | | | | | | As proposed in go/ota-downgrade, the android auto team wants to install a full OTA with the older timestamp. We will only allow it on devices with userdebug build, and has the property "ro.ota.allow_downgrade" set. Data wipe is almost inevitable due to the probability of security patch level and database rollback. Test: set the property and install a full payload with older timestamp. Change-Id: I897bbb19bfec820340f791abf3c6d8138995fa90
* Allow update engine read public keys from otacerts.zipTianjie Xu2019-10-153-2/+7
| | | | | | | | | | | | | | | The android build system installs both otacerts.zip and update-payload-key.pub.pem on the device. And the latter is converted from the X509 certificates inside the otacerts.zip during the build time. We can consolidate these two by letting update engine to parse the public keys from otacerts.zip directly. This also allows update engine to use multiple keys to verify the payload. Bug: 116660991 Test: unittests pass Change-Id: I0a499405f2835e1ff8b7916452cb3123046306a7
* [REFACTOR] Pass DeltaArchiveManifest to DynamicPartitionControlYifan Hong2019-09-234-31/+17
| | | | | | | | | | | | | | 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
* Enable update_engine to access OTA package via file descriptorKyeongkab.Nam2019-07-134-9/+39
| | | | | | | | | | | | | Due to the restriction of Treble, update_engine cannot access to OTA packages located on non-core domain area. (e.g. /data/vendor/upgrade/xxx.zip) To solve such problem, update_engine needs to have a new interface which accepts a file descriptor (FD) of OTA package file instead of its URI and to read package file while updating via FD. Test: Manual update Bug: 130209137 Change-Id: Ieb7173dc958ba3eb21af708e616ef7078cd17b3e
* Support signing payload with 4096 bits RSA keysxunchang2019-04-021-0/+3
| | | | | | | | | | | | | | | | | | | The 32 bytes sha256 hash was padded to 256 bytes before payload signing and verification. During the padding, we appended a hard coded header according to RFC3447 spec. As we want to support signing with 4096 bits keys, the format of the padding doesn't change but the length needs adjustion. Now callers will pass in the RSA size in bytes in the padding function. And the verification function will now take the raw 32 bytes sha256 hash instead of the padded value. The new key for unittest is generated by: openssl genrsa -out unittest_key_RSA4096.pem 4096 Bug: 129163830 Test: unit tests pass, create and install an update signed by 4096 bits key. Change-Id: I8e0d02ddb1472e22976c0f170e8bf2b8b094c7d4
* update_engine: Add support for enterprise rollback powerwashZentaro Kavanagh2019-01-222-3/+11
| | | | | | | | | | | | | | | - Adds the additional flag "rollback" to the powerwash file - This flag allows additional data to be preserved over a powerwash - Adds tests BUG=chromium:881341 TEST=unittests Change-Id: I4487f4de856ea8d2d0255e8de4cd1ba0762a8e53 Reviewed-on: https://chromium-review.googlesource.com/1412683 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zentaro Kavanagh <zentaro@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* update_engine: Run clang-format on common/Amin Hassani2019-01-1640-562/+484
| | | | | | | | | | | BUG=none TEST=unittest Change-Id: Icdaf5017e03a197bc576f08f4b8dcdd00cff217c Reviewed-on: https://chromium-review.googlesource.com/1407541 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* Remove utils::TimeFromStructTimespec().Sen Jiang2019-01-113-29/+0
| | | | | | | Use base::Time::FromTimeSpec() instead. Test: mma Change-Id: I0f2244b52188e8964a3eebc7f6188706105b850f
* Remove unused functions in test_utils.Sen Jiang2019-01-101-20/+1
| | | | | | | Also cleaned up unused includes. Test: mma Change-Id: I8e19648f4d866615de9ae5abeb29d8c8b8f37b36
* Remove utils::SetRootTempDir().Sen Jiang2019-01-092-22/+2
| | | | | | | | | This function was originally added to customize temp dir in recovery, but we are no longer using any temp file during update, so this is not needed anymore. Test: mma Change-Id: I7bfdad4307e4ce7cf3bdbc547e9a2faf1379e50b
* Don't use temp file for public key.Sen Jiang2019-01-093-73/+0
| | | | | | | | | If using public key from Omaha response, we wrote it to a temp file which will be read back, this is unnecessary since we can keep it in memory. Test: update_engine_unittests Change-Id: Ib9f7a9292b71b9d91a0b24c687cc989b79d3812b
* Add MultiRangeHttpFetcherOverFileFetcherTest to HttpFetcherTest.Tao Bao2019-01-082-7/+75
| | | | | | | | | | | | | | | | | | | When fetching a payload in DownloadAction, in addition to using MultiRangeHttpFetcher over LibcurlHttpFetcher, we're also actively using MultiRangeHttpFetcher over FileFetcher in Android, e.g. when installing or verifying a local payload. This CL adds MultiRangeHttpFetcherOverFileFetcherTest into HttpFetcherTest to exercise this path. The test would be helpful in capturing issues addressed by commit 028ea416 (it still requires running with an ASAN build though). It also fixes a bug in MultiRangeHttpFetcher::ReceivedBytes(), which is uncovered while fixing the test. Fixes: 120577143 Test: Run unittest on taimen. Change-Id: I5dddb95e9bdfd842017876017a99c04d6be304db
* Merge aosp/upstream-master into aosp/master.Sen Jiang2019-01-046-2/+160
|\ | | | | | | | | | | | | Added BinderUpdateEngineClient::AttemptInstall(). Test: update_engine_unittests Change-Id: Id6911f49d763b0d572658acb7d66857016bf6969
| * update_engine: check pointer for nullptrXiaochu Liu2018-11-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Member processor_ in ScopedActionCompleter is a raw pointer that is not owned by ScopedActionCompleter. However in ScopedActionCompleter's d'tor, it assumes processor_ is not nullptr and call its ActionComplete function. Add a CHECK() in c'tor making sure the object in the first place is not nullptr. BUG=None TEST=emerge-kefka update_engine, unittest Change-Id: Ifce060667c8b4280d42d1f0fbca3588bcbe89f3d Reviewed-on: https://chromium-review.googlesource.com/1342943 Commit-Ready: Xiaochu Liu <xiaochu@chromium.org> Tested-by: Xiaochu Liu <xiaochu@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
| * Revert "Partially Revert 2b9d241"Hidehiko Abe2018-11-213-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 71818c8409812c5a08124627c19aa8ea0625a72e. This patch was created because the upstream update_engine was using the new version of libchrome and the Chrome OS one was not. Now that we are upreving libchrome on Chrome OS we can revert this. BUG=b:37434548 TEST=Build CQ-DEPEND=CL:1240033 Change-Id: I98b7d124212087292500701782de08b3d3ecc559 Reviewed-on: https://chromium-review.googlesource.com/1239818 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Hidehiko Abe <hidehiko@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
| * update_engine: support DLC updateXiaochu Liu2018-11-154-0/+156
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All DLC update related code is hide behind USE_dlc flag so platform update never touches this new code path unless enabled later. In CheckForUpdate, update_engine calls dlcservice to get a list of DLC module and set 'dlc_ids_' accordingly. BUG=chromium:900653 TEST=unittest Change-Id: I654e37effa7c1b70b25147a027f2b16abe6bf9e1 Reviewed-on: https://chromium-review.googlesource.com/1321009 Commit-Ready: Xiaochu Liu <xiaochu@chromium.org> Tested-by: Xiaochu Liu <xiaochu@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
| * update_engine: Change the default autest Omaha URLAmin Hassani2018-10-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Change the default autest command's default URL to: https://omaha-qa.sandbox.google.com/service/update2 BUG=chromium:887004 TEST=none Change-Id: Ib2414162a7f3221b6959b701e83fef27e9cc7e8f Reviewed-on: https://chromium-review.googlesource.com/1257820 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
* | Call InitPartitionMetadata when resuming an update.Tao Bao2019-01-046-16/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | BootControlAndroid::InitPartitionMetadata() should always be called when starting / resuming an update that uses dynamic partitions. This allows updating the metadata for the target slot, as well as setting up the internal state for accessing the dynamic partitions in the target slot. Bug: 122097567 Test: Run update_engine_unittests on taimen and blueline. Test: Apply a payload that uses dynamic partitions. Reboot before it finishes, then resume the update. Change-Id: I1353f7460a61c0183654b6349689beaa9bf12129
* | MultiRangeHttpFetcher::ReceivedBytes should signal the caller correctly.Tao Bao2018-12-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HttpFetcherDelegate::ReceivedBytes requires a delegate to return false to signal the caller to terminate. However, the overload in MultiRangeHttpFetcher::ReceivedBytes missed that and wrongly returned true instead. As a result, we observed the following crash while running an ASAN build. FileFetcher::OnReadDoneCallback() | | called its delegate of MultiRangeHttpFetcher | -- MultiRangeHttpFetcher::ReceivedBytes() | | requested fetchers to terminate | -- fetcher->TerminateTransfer() | |-- MultiRangeHttpFetcher::TerminateTransfer() | -- FileFetcher::TerminateTransfer() | -- MultiRangeHttpFetcher::TransferTerminated() | |-- DownloadAction::TransferTerminated() | |-- ActionProcessor::ActionComplete() | | DownloadAction / MultiRangeHttpFetcher / | FileFetcher all destroyed | | (but it didn't signal the caller to terminate) | | FileFetcher proceeded to call FileFetcher::ScheduleRead() that accessed | already freed memory While fixing the above issue, a separate bug in LibcurlHttpFetcher::LibcurlWrite was uncovered, where in_write_callback_ wasn't properly reset. Bug: 120577143 Test: Build and flash an ASAN build on taimen. Applying a payload with file:// no longer crashes with tag-mismatch. Test: Run update_engine_unittests. Change-Id: I66c862ae40accbfaddc41fb8590b152c2169eea6
* | Revert "Remove kPrefsDynamicPartitionMetadataInitialized."Yifan Hong2018-12-132-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 09f6e0f8f5340e2e8f6bf14e08adf25798eab360. Reason for revert: Should not re-initialize metadata when resuming from an update. Bug: 120465293 Bug: 120775936 Test: manual OTA, interrupt and resume Change-Id: Ib1626dfa4a766e9a5ffaf2d9d74ec2b04c76052d
* | Remove kPrefsDynamicPartitionMetadataInitialized.Tao Bao2018-12-052-3/+0
| | | | | | | | | | | | | | | | | | | | DeltaPerformer::InitPartitionMetadata() should always happen when populating the InstallPlan on each update attempt. Persisting the value across attempts would wrongly skip the initialization on resuming. Bug: 120465293 Test: Cancel and resume an update that uses dynamic partitions. Change-Id: Ia41c65bc26aa438f92edf5a8dff08d691afa64db
* | Use /dev/block/loop* for loop devices in Android.Sen Jiang2018-11-201-5/+11
| | | | | | | | | | | | | | | | | | In Android ueventd creates /dev/block/loop*, we should use that instead of creating our own. Fix: 119624750 Test: update_engine_unittests Change-Id: If6eadbd32b2b8c7aa7a17987b6eb51c93787f95a
* | Support updateable groups.Yifan Hong2018-10-261-5/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds updateable group support to OTA. * DeltaPerformer combines partition sizes with dynamic_partition_metadata to BootControlInterface::PartitionMetadata. * BootControlAndroid::InitPartitionMetadata: * Copy all groups / partitions from source metadata slot * Remove all groups / partitions mentioned in the manifest (of the target slot) * Re-add all groups / partitions mentioned in the manifest. * BootControlAndroid::InitPartitionMetadata can check the incoming PartitionMetadata to see if a partition is dynamic or not. The guessing logic is completely removed. * Because a partition is removed then re-added, there is no need for preserving the entry with size 0 to indicate that a partition is removed. When update_engine sees a partition in a group "foo" on the device, but manifest contains group "foo" without the partition, it removes the partition. * Hence, Removing a partition does NOT require keeping the entry (i.e. RemovePartition is used instead of ShrinkPartition(0) ). This makes retrofitting dynamic partitions on older devices easier. The following is now allowed: - Adding / removing / resizing partitions - Adding / resizing groups It is not allowed to remove a group, but a group can always be resized to zero to deprecate it. Test: update_engine_unittests Bug: 117182932 Change-Id: I39d77f1d1d1fc52fc245f3de699635e6a429015e
* | Fix false negative NeedResizeYifan Hong2018-10-262-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BootControlAndroid did not call ResizePartitions when the sizes were all correct to avoid storing metadata more than once (after resuming from an update), and potentially writing to incorrect extents. But, when the update starts, the target metadata slot may contain metadata that happen to exactly matches the size requirements, but have extents that maps to currently running devices. To do this correctly, DeltaPerformer uses PrefsInterface to avoid calling into InitPartitionMetadata again when it is initialized. Hence, BootControlAndroid::InitPartitionMetadata ALWAYS write metadata to the target slot. Also removed tests to reflect this. Test: manual OTA Test: update_engine_unittests Bug: 117182932 Change-Id: I488ab369e42d582c94974791fdb988d12e695bc2
* | PartitionSizes -> PartitionMetadataYifan Hong2018-10-264-9/+9
| | | | | | | | | | | | | | | | | | In a following CL, InitPartiitonMetadata not only takes sizes but also group of each partition. Rename the struct to a more generic name. Test: builds Change-Id: Ie8a7e58b0cccc45e533de368e24f5a73d556de65
* | Uprev libchrome to r576279 (1/multiple)Jakub Pawlowski2018-10-131-0/+2
| | | | | | | | | | | | | | | | | | | | * StatisticsRecorder no longer need call to Initialize() * tracked_objects::Location -> base::Location * base::*ToString replaced with base::NumberToString Test: compilation Change-Id: I5f912bd15f7cb26df3edc1ad7f4479122ffb6d7a Merged-In: I5f912bd15f7cb26df3edc1ad7f4479122ffb6d7a