diff options
author | Mohammad Samiul Islam <samiul@google.com> | 2021-03-05 10:02:46 +0000 |
---|---|---|
committer | Samiul Islam <samiul@google.com> | 2021-05-17 22:31:18 +0100 |
commit | 56ce23ae3ac59bc21ceaa747742c2a048b0762df (patch) | |
tree | 168784584f7401cb3522307246fb7c5739a506e8 | |
parent | 422e893875d4d1c8cf73db5d39a0eac19bce3065 (diff) |
Clean up reserved space for decompression when OTA cancelled
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)
-rw-r--r-- | aosp/update_attempter_android.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc index 2ffa0da3..4636c430 100644 --- a/aosp/update_attempter_android.cc +++ b/aosp/update_attempter_android.cc @@ -364,6 +364,12 @@ bool UpdateAttempterAndroid::ResetStatus(brillo::ErrorPtr* error) { LOG(INFO) << "Attempting to reset state from " << UpdateStatusToString(status_) << " to UpdateStatus::IDLE"; + if (apex_handler_android_ != nullptr) { + LOG(INFO) << "Cleaning up reserved space for compressed APEX (if any)"; + std::vector<ApexInfo> apex_infos_blank; + apex_handler_android_->AllocateSpace(apex_infos_blank); + } + switch (status_) { case UpdateStatus::IDLE: { if (!boot_control_->GetDynamicPartitionControl()->ResetUpdate(prefs_)) { |