Add a header value for configure max downlaod retry count

Allow partners to set a custom retry count.

Test: th
Bug: 242902308
Change-Id: Idc04b7149d1f91e0108c947a8e3eed0d4f0e8b5e
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index aab6d2d..9b90030 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -331,6 +331,10 @@
     LOG(FATAL) << "Unsupported sideload URI: " << payload_url;
 #else
     LibcurlHttpFetcher* libcurl_fetcher = new LibcurlHttpFetcher(hardware_);
+    if (!headers[kPayloadDownloadRetry].empty()) {
+      libcurl_fetcher->set_max_retry_count(
+          atoi(headers[kPayloadDownloadRetry].c_str()));
+    }
     libcurl_fetcher->set_server_to_check(ServerToCheck::kDownload);
     fetcher = libcurl_fetcher;
 #endif  // _UE_SIDELOAD
diff --git a/common/constants.h b/common/constants.h
index f27d2db..11be740 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -176,8 +176,13 @@
 // Proxy URL to use for downloading OTA. This will be forwarded to libcurl
 static constexpr const auto& kPayloadPropertyNetworkProxy = "NETWORK_PROXY";
 
+// Set Virtual AB Compression's compression algorithm to "none", but still use
+// userspace snapshots and snapuserd for update installation.
 static constexpr const auto& kPayloadDisableVABC = "DISABLE_VABC";
 
+// Max retry count for download
+static constexpr const auto& kPayloadDownloadRetry = "DOWNLOAD_RETRY";
+
 // Set "SWITCH_SLOT_ON_REBOOT=0" to skip marking the updated partitions active.
 // The default is 1 (always switch slot if update succeeded).
 static constexpr const auto& kPayloadPropertySwitchSlotOnReboot =