Fix rollback detection
After OTA finishes, update_engine writes boot id to /data/ to indicate
that a slot switch is scheduled. This is called a slot switch indicator.
After device reboots, update_engine uses value of the slot switch
indicator to determine if a slot switch was attempted for last reboot.
If slot switch was attempted but device is still on the old slot,
update_engine declares that a rollback has happened.
However, the slot switch indactor is only cleared when next OTA starts,
so if the device was rebooted during merge(or before next OTA starts),
update_engine would mistakenly think that a slot switch was attempted.
Test: reboot device during merge, make sure UE did not detect a rollback
Change-Id: Ia557cc14e4f217813fdcb7896b49131898e8bfd3
diff --git a/aosp/update_attempter_android.h b/aosp/update_attempter_android.h
index 3174904..956bd25 100644
--- a/aosp/update_attempter_android.h
+++ b/aosp/update_attempter_android.h
@@ -168,8 +168,8 @@
// |update_completed_marker_| is empty.
[[nodiscard]] bool WriteUpdateCompletedMarker();
- // Returns whether an update was completed in the current boot.
- [[nodiscard]] bool UpdateCompletedOnThisBoot();
+ // Returns whether a slot switch was attempted in the current boot.
+ [[nodiscard]] bool UpdateCompletedOnThisBoot() const;
// Prefs to use for metrics report
// |kPrefsPayloadAttemptNumber|: number of update attempts for the current