Add payload prop to set custom proxy URL
Partners are asking for a way to set custom proxy. This allows partners
to implement custom download logic in their own proxy servers, for
example, networking preferences, download speed throttling, etc.
Test: partner verification
Bug: 235816007
Change-Id: Ia3645e36f677db62b918f3246bcbff82d7e72bc4
diff --git a/aosp/update_attempter_android.cc b/aosp/update_attempter_android.cc
index 9c16329..b95da94 100644
--- a/aosp/update_attempter_android.cc
+++ b/aosp/update_attempter_android.cc
@@ -339,6 +339,12 @@
if (!headers[kPayloadPropertyUserAgent].empty())
fetcher->SetHeader("User-Agent", headers[kPayloadPropertyUserAgent]);
+ if (!headers[kPayloadPropertyNetworkProxy].empty()) {
+ LOG(INFO) << "Using proxy url from payload headers: "
+ << headers[kPayloadPropertyNetworkProxy];
+ fetcher->SetProxies({headers[kPayloadPropertyNetworkProxy]});
+ }
+
BuildUpdateActions(fetcher);
SetStatusAndNotify(UpdateStatus::UPDATE_AVAILABLE);