update_engine: Allow deprecation of DLC(s)
Currently, platform updates would block if any supported DLC(s) are
installed on the device and later CrOS version deprecates any of the
installed DLC(s).
[INFO:omaha_request_action.cc(501)] Request: <?xml version="1.0" encoding="UTF-8"?>
<request requestid="b59a48ec-6364-4a11-9400-860a35c1d85e" sessionid="" protocol="3.0" updater="ChromeOSUpdateEngine" updaterversion="0.1.0.0" installsource="scheduler" ismachine="1">
<os version="Indy" platform="Chrome OS" sp="service_pack"></os>
<app appid="test-app-id" version="0.1.0.0" track="" from_track="unittest" board="x86-generic" hardware_class="OEM MODEL 09235 7471" delta_okay="true" installdate="14" lang="en-US" fw_version="ChromeOSFirmware.1.0" ec_version="0X0A1" >
<ping active="1" a="-1" r="-1"></ping>
<updatecheck></updatecheck>
<event eventtype="54" eventresult="1" previousversion="0.0.0.0"></event>
</app>
<app appid="test-app-id_dlc-id-1" version="0.1.0.0" track="" from_track="unittest" board="x86-generic" hardware_class="OEM MODEL 09235 7471" delta_okay="true" installdate="14" >
<updatecheck></updatecheck>
</app>
<app appid="test-app-id_dlc-id-2" version="0.1.0.0" track="" from_track="unittest" board="x86-generic" hardware_class="OEM MODEL 09235 7471" delta_okay="true" installdate="14" >
<updatecheck></updatecheck>
</app>
</request>
[INFO:omaha_request_action.cc(903)] Omaha request response: <?xml version="1.0" encoding="UTF-8"?><response protocol="3.0"><daystart elapsed_seconds="100" elapsed_days="42"/><app appid="test-app-id" status="ok"><ping status="ok"/><updatecheck status="ok" _firmware_version_0="" _kernel_version_0=""><urls><url codebase="http://code/base/"/></urls><manifest version="1.2.3.4"><packages><package hash="not-used" name="file.signed" size="123" hash_sha256="4841534831323334"/></packages><actions><action event="postinstall" MetadataSize="11" MoreInfo="http://more/info" Prompt="true" IsDeltaPayload="true" MaxDaysToScatter="7" sha256="not-used" /></actions></manifest></updatecheck></app><app appid="test-app-id_dlc-id-1" status="ok"><updatecheck status="ok"><urls><url codebase="http://code/base/"/></urls><manifest version="1.2.3.4"><packages><package name="package3" size="333" hash_sha256="hash3"/></packages><actions><action event="install" run=".signed"/><action event="postinstall" MetadataSize="33"/></actions></manifest></updatecheck></app><app appid="test-app-id_dlc-id-2"><updatecheck status="noupdate"/></app></response>
...
[INFO:omaha_request_action.cc(706)] Found 3 <app>.
[INFO:omaha_request_action.cc(811)] Update for <app> test-app-id
[INFO:omaha_request_action.cc(811)] Update for <app> test-app-id_dlc-id-1
[INFO:omaha_request_action.cc(794)] No update for <app> test-app-id_dlc-id-2 but update continuing since a DLC.
...
BUG=chromium:1050777
TEST=# update_engine unittest
Change-Id: I43640f3463aa74c67465a2027bc530794eb73210
Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2053077
Tested-by: Jae Hoon Kim <kimjae@chromium.org>
Commit-Queue: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/omaha_request_params.h b/omaha_request_params.h
index b984002..14f3eaf 100644
--- a/omaha_request_params.h
+++ b/omaha_request_params.h
@@ -225,9 +225,12 @@
// download channel.
virtual std::string GetAppId() const;
- // Returns the DLC app ID corresponding to the current value of the
- // download channel.
- virtual std::string GetDlcAppId(std::string dlc_id) const;
+ // Returns the DLC app ID.
+ virtual std::string GetDlcAppId(const std::string& dlc_id) const;
+
+ // Returns true if the App ID is a DLC App ID that is currently part of the
+ // request parameters.
+ virtual bool IsDlcAppId(const std::string& app_id) const;
// Suggested defaults
static const char kOsVersion[];
@@ -404,7 +407,7 @@
// The metadata/prefs root path for DLCs.
std::string dlc_prefs_root_;
- // A list of DLC modules to install.
+ // A list of DLC modules to install. A mapping from DLC App ID to |AppParams|.
std::map<std::string, AppParams> dlc_apps_params_;
// This variable defines whether the payload is being installed in the current