Add a sysprop to delay merge by fix duration
Merge is a power consuming process, some products might want to delay
merge after boot by some amount of time. Add a sysprop to configure how
many seconds the merge should be delayed. To prevent the device from
delaying merge indefinitely, this sysprop is capped at 10 minutes.
Bug: 311515963
Test: set ro.virtual_ab.merge_delay_seconds by PRODUCT_PROPERTY_OVERRIDES in mk files and run OTA
Change-Id: I2361dd47221552dbc774c00412c65a22f40bc11d
diff --git a/aosp/cleanup_previous_update_action.h b/aosp/cleanup_previous_update_action.h
index b93c557..1d701b1 100644
--- a/aosp/cleanup_previous_update_action.h
+++ b/aosp/cleanup_previous_update_action.h
@@ -31,6 +31,7 @@
#include "update_engine/common/cleanup_previous_update_action_delegate.h"
#include "update_engine/common/error_code.h"
#include "update_engine/common/prefs_interface.h"
+#include "update_engine/common/scoped_task_id.h"
namespace chromeos_update_engine {
@@ -76,7 +77,7 @@
bool cancel_failed_{false};
unsigned int last_percentage_{0};
android::snapshot::ISnapshotMergeStats* merge_stats_;
- brillo::MessageLoop::TaskId scheduled_task_{brillo::MessageLoop::kTaskIdNull};
+ ScopedTaskId scheduled_task_;
// Helpers for task management.
void AcknowledgeTaskExecuted();
@@ -88,6 +89,8 @@
void WaitBootCompletedOrSchedule();
void ScheduleWaitMarkBootSuccessful();
void CheckSlotMarkedSuccessfulOrSchedule();
+ void CheckForMergeDelay();
+ void StartMerge();
void ScheduleWaitForMerge();
void WaitForMergeOrSchedule();
void InitiateMergeAndWait();