CleanupPreviousUpdateAction: refactor and add StopActionInternal am: d506deef54 am: bbbb012280 am: 1e29b681f0 am: 5faa1a2f0b am: 33bd2cff75
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/1439792
Change-Id: I54abba074db36a84c97536c93884002e0ee370d0
diff --git a/cleanup_previous_update_action.cc b/cleanup_previous_update_action.cc
index 1a2476f..3a7a750 100644
--- a/cleanup_previous_update_action.cc
+++ b/cleanup_previous_update_action.cc
@@ -68,29 +68,23 @@
merge_stats_(nullptr) {}
void CleanupPreviousUpdateAction::PerformAction() {
- ResumeAction();
+ StartActionInternal();
}
void CleanupPreviousUpdateAction::TerminateProcessing() {
- SuspendAction();
+ StopActionInternal();
}
void CleanupPreviousUpdateAction::ResumeAction() {
- CHECK(prefs_);
- CHECK(boot_control_);
-
- LOG(INFO) << "Starting/resuming CleanupPreviousUpdateAction";
- running_ = true;
StartActionInternal();
}
void CleanupPreviousUpdateAction::SuspendAction() {
- LOG(INFO) << "Stopping/suspending CleanupPreviousUpdateAction";
- running_ = false;
+ StopActionInternal();
}
void CleanupPreviousUpdateAction::ActionCompleted(ErrorCode error_code) {
- running_ = false;
+ StopActionInternal();
ReportMergeStats();
metadata_device_ = nullptr;
}
@@ -103,7 +97,17 @@
return "CleanupPreviousUpdateAction";
}
+void CleanupPreviousUpdateAction::StopActionInternal() {
+ LOG(INFO) << "Stopping/suspending/completing CleanupPreviousUpdateAction";
+ running_ = false;
+}
+
void CleanupPreviousUpdateAction::StartActionInternal() {
+ CHECK(prefs_);
+ CHECK(boot_control_);
+
+ LOG(INFO) << "Starting/resuming CleanupPreviousUpdateAction";
+ running_ = true;
// Do nothing on non-VAB device.
if (!boot_control_->GetDynamicPartitionControl()
->GetVirtualAbFeatureFlag()
diff --git a/cleanup_previous_update_action.h b/cleanup_previous_update_action.h
index 6f6ce07..1d8d3d7 100644
--- a/cleanup_previous_update_action.h
+++ b/cleanup_previous_update_action.h
@@ -75,6 +75,7 @@
unsigned int last_percentage_{0};
android::snapshot::ISnapshotMergeStats* merge_stats_;
+ void StopActionInternal();
void StartActionInternal();
void ScheduleWaitBootCompleted();
void WaitBootCompletedOrSchedule();