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.cc b/omaha_request_params.cc
index e6d96a4..1cfbc9c 100644
--- a/omaha_request_params.cc
+++ b/omaha_request_params.cc
@@ -249,10 +249,14 @@
                                                : image_props_.product_id;
 }
 
-string OmahaRequestParams::GetDlcAppId(std::string dlc_id) const {
+string OmahaRequestParams::GetDlcAppId(const std::string& dlc_id) const {
   // Create APP ID according to |dlc_id| (sticking the current AppID to the
   // DLC module ID with an underscode).
   return GetAppId() + "_" + dlc_id;
 }
 
+bool OmahaRequestParams::IsDlcAppId(const std::string& app_id) const {
+  return dlc_apps_params().find(app_id) != dlc_apps_params().end();
+}
+
 }  // namespace chromeos_update_engine