update_engine: Skip post DownloadAction exclusions
Post |DownloadAction| don't have direct reference to |Payload|s held
within the |PayloadState|. Hence it's required to halt exclusions for
|Action|s post |DownloadAction|.
This is done by setting the |payload_index_| within |PayloadState| >= to
the |candidate_urls_|/|response_.packages| size.
DCHECKs added where |payload_index_| is used as usage may cause out of
bounds indexing.
This change removes the dangling reference to the last |Payload|, as
previously |NextPayload()| kept |payload_index_| pointing to the last
|Payload| within |PayloadState|.
BUG=chromium:928805
TEST=FEATURES=test emerge-$B update_engine
Change-Id: I3f6a9a3cc26bb84f94506e45e1d6e906624e5dd7
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2261292
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Auto-Submit: Jae Hoon Kim <kimjae@chromium.org>
diff --git a/payload_state.h b/payload_state.h
index d13c642..5713a54 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -161,6 +161,8 @@
FRIEND_TEST(PayloadStateTest, ExcludeNoopForNonExcludables);
FRIEND_TEST(PayloadStateTest, ExcludeOnlyCanExcludables);
FRIEND_TEST(PayloadStateTest, IncrementFailureExclusionTest);
+ FRIEND_TEST(PayloadStateTest, HaltExclusionPostPayloadExhaustion);
+ FRIEND_TEST(PayloadStateTest, NonInfinitePayloadIndexIncrement);
// Helper called when an attempt has begun, is called by
// UpdateResumed(), UpdateRestarted() and Rollback().