update_engine: Clear lingering install indication
When an install for DLC is initiated, the member variable |is_install_|
is set to true, however the issue arises from that fact that it is never
reverted to be false. This can cause periodic updates to still have the
lingering |is_install_| as true from a previous install. The state must
be correctly cleaned up/cleared.
|ProcessingDone()| will be called at the end of an install/update. This
also depends on the fact that |is_install_| will not be changed by the
time |OnUpdateScheduled()| is scheduled periodically or forced up until
|ProcessingDone()| for an install or update is finished.
The new approach is to have |ProcessingDone()| dispatch to two different
methods (|ProcessingDoneInstall()| and |ProcessingDoneUpdate()|) based
on what the action finished on (an install or update indicated by
|is_install_|). Then those dispatched actions will be performed, then
the |is_install_| can be reset.
BUG=chromium:982929
TEST=FEATURES="test" P2_TEST_FILTER="*UpdateAttempterTest.*-*RunAsRoot*" emerge-$BOARD update_engine
TEST=FEATURES="test" emerge-$BOARD update_engine
Change-Id: I1fb9387dd416ed0815964cfcb22a6559ab81fa80
diff --git a/update_attempter.h b/update_attempter.h
index 880e975..3db4097 100644
--- a/update_attempter.h
+++ b/update_attempter.h
@@ -259,6 +259,8 @@
FRIEND_TEST(UpdateAttempterTest, InstallSetsStatusIdle);
FRIEND_TEST(UpdateAttempterTest, MarkDeltaUpdateFailureTest);
FRIEND_TEST(UpdateAttempterTest, PingOmahaTest);
+ FRIEND_TEST(UpdateAttempterTest, ProcessingDoneInstallError);
+ FRIEND_TEST(UpdateAttempterTest, ProcessingDoneUpdateError);
FRIEND_TEST(UpdateAttempterTest, ReportDailyMetrics);
FRIEND_TEST(UpdateAttempterTest, RollbackNotAllowed);
FRIEND_TEST(UpdateAttempterTest, RollbackAfterInstall);
@@ -284,6 +286,11 @@
// parameters used in the current update attempt.
uint32_t GetErrorCodeFlags();
+ // ActionProcessorDelegate methods |ProcessingDone()| internal helpers.
+ void ProcessingDoneInternal(const ActionProcessor* processor, ErrorCode code);
+ void ProcessingDoneUpdate(const ActionProcessor* processor, ErrorCode code);
+ void ProcessingDoneInstall(const ActionProcessor* processor, ErrorCode code);
+
// CertificateChecker::Observer method.
// Report metrics about the certificate being checked.
void CertificateChecked(ServerToCheck server_to_check,