Resume multiple payloads.

DownloadAction will first go through all the already applied payload
and only downloading the manifest and filling in partitions info in
install plan without applying or downloading any operations.
And then resume the partially applied payload using states in prefs.

Moved constuction of MultiRangeHttpFetcher from UpdateAttempter to
DownloadAction, because we now need to setup the range for every
payload, also reduced code duplication.

Also fixed download progress for multi payload.

Bug: 36252799
Test: stop an update during second payload and resume the update
Change-Id: I9ee54a87d15d88c7a14a13575965b19c1773340b
(cherry picked from commit 7162b666318cdd6c75b73fa6a0b06b23559de3e5)
diff --git a/payload_state.h b/payload_state.h
index 56e32fd..699fc74 100644
--- a/payload_state.h
+++ b/payload_state.h
@@ -153,13 +153,7 @@
     return attempt_error_code_;
   }
 
-  bool NextPayload() override {
-    if (payload_index_ + 1 >= candidate_urls_.size())
-      return false;
-    payload_index_++;
-    url_index_ = 0;
-    return true;
-  }
+  bool NextPayload() override;
 
  private:
   enum class AttemptType {
@@ -280,6 +274,11 @@
   // of a process restart.
   void SetFullPayloadAttemptNumber(int payload_attempt_number);
 
+  // Sets the current payload index to the given value. Also persists the value
+  // being set so that we resume from the same value in case of a process
+  // restart.
+  void SetPayloadIndex(size_t payload_index);
+
   // Initializes the current URL index from the persisted state.
   void LoadUrlIndex();