Add payload prop to set custom proxy URL am: 98cb8f7aef
Original change: https://android-review.googlesource.com/c/platform/system/update_engine/+/2172130
Change-Id: I1999d3f0ec3a805dae1800dbd095f46d41007a0f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
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);
diff --git a/common/constants.h b/common/constants.h
index 53c5bba..b862549 100644
--- a/common/constants.h
+++ b/common/constants.h
@@ -172,6 +172,10 @@
// This can be used to zero-rate OTA traffic by sending it over the correct
// network.
static constexpr const auto& kPayloadPropertyNetworkId = "NETWORK_ID";
+
+// Proxy URL to use for downloading OTA. This will be forwarded to libcurl
+static constexpr const auto& kPayloadPropertyNetworkProxy = "NETWORK_PROXY";
+
// 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 =