summaryrefslogtreecommitdiff
path: root/update_manager
AgeCommit message (Collapse)Author
2020-12-01update_engine: Add restricted intervals monitorSaurabh Nijhara
This CL introduces class UpdateTimeRestrictionsMonitor responsible for tracking the restricted time intervals from DeviceAutoUpdateTimeRestrictions policy during which update download is not allowed. It reads the policy, chooses the next interval according to current time and notifies the delegate when it starts. UpdateTimeRestrictionsMonitor is also able to detect and handle changes in restricted intervals during its lifetime. This monitor would be used in a follow up CL to cancel the download process during a restricted interval. This class would be short lived with its lifetime restricted to during the DownloadAction so that it can notify the delegate when restricted interval starts which would then cancel the update process. Resuming the update process when interval ends would be handled by the next auto update after interval end as update engine checkpoints the download progress. BUG=chromium:1117450 TEST=FEATURES=test emerge-${BOARD} update_engine Change-Id: Ia7190a488efecf1de53c6396ff67a2b7ef10aa57 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2560619 Tested-by: Saurabh Nijhara <snijhara@google.com> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Saurabh Nijhara <snijhara@google.com>
2020-11-24update_engine: Use PrefsInterface from SystemStateAmin Hassani
There is no need to pass the Pref class around (at least not in cros) since we have the SystemState as the global context and we can get the pref from there. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_engine Change-Id: I9f5fb8a118fab2ef0e188c42f746dafb1094972c Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2548740 Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
2020-11-24update_engine: Use clock and fake clock from SystemStateAmin Hassani
No need to pass clock and fake clock anywhere anymore. This CL makes it to just use those objects available from SystemState and FakeSystemState. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_engine Change-Id: I9a3cf6dd2057620c11b862d3317b83489c76f3ca Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2546625 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Jae Hoon Kim <kimjae@chromium.org>
2020-11-17update_engine: add variable for DeviceQuickFixBuildToken policySaurabh Nijhara
This CL makes DeviceQuickFixBuildToken policy visible in update_manager which would be used in a follow up CL to skip applying DeviceAutoUpdateTimeRestrictions when a quick fix build token is set. This CL also adds quick fix token in UpdateCheckParams which is used by UpdateAttempter to pass the token in OmahaRequestParams. BUG=chromium:1117450 TEST=FEATURES=test emerge-${BOARD} update_engine Change-Id: If43ad8cd2955bbeb1cbd1dcacac79742fa0a6a20 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2521189 Commit-Queue: Saurabh Nijhara <snijhara@google.com> Tested-by: Saurabh Nijhara <snijhara@google.com> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
2020-11-16update_engine: Add enterprise rollback update policy implSaurabh Nijhara
This CL adds a new rollback update policy which checks if the update to be downloaded is a rollback by checking the value of InstallPlan::is_rollback which is set in omaha_response_handler_action. The intent is to consult this policy in a later CL in ChromeOSPolicy::UpdateCanBeApplied as download time restrictions will not be applied if current update being downloaded is a rollback. BUG=chromium:1117450 TEST=FEATURES=test emerge-${BOARD} update_engine Change-Id: Ib3a23a57fb60d4d0e983688f78941cdbd587718e Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2532793 Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Tested-by: Saurabh Nijhara <snijhara@google.com> Commit-Queue: Saurabh Nijhara <snijhara@google.com>
2020-11-14update_engine: Make SystemState accessible from everywhereAmin Hassani
SystemState is supposed to be a global context and is used lamost everywhere. So instead of passing it to functions and keeping multiple pointers to it, its better to do what we did in dlcservice and make it a singleton class with a getter that can be get from everywhere. BUG=b:171829801 TEST=unittests Change-Id: I3b2de9394b7769b3911195ca52d61dbe49afd4dd Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2521792 Commit-Queue: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
2020-11-12update_engine: Add minimum version policy implSaurabh Nijhara
This CL adds minimum version policy handler which checks if the current Chrome OS version is less than the highest version specified in the DeviceMinimumVersion policy. The intent is to consult this policy in a later CL in ChromeOSPolicy::UpdateCanBeApplied as download time restrictions will not be applied if current Chrome OS version is less than version provided by DeviceMinimumVersion policy. BUG=chromium:1117450 TEST=FEATURES=test emerge-${BOARD} update_engine Change-Id: I06ce66c4c85ac2718d9256c944160d63a6ac7e31 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2530630 Commit-Queue: Saurabh Nijhara <snijhara@google.com> Tested-by: Saurabh Nijhara <snijhara@google.com> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-11-11update_engine: Turn on Shill by defaultAmin Hassani
This flag is always true in Chorme OS and android's code doesn't compile this. So the flag can be removed and be turned on by default. BUG=b:171829801 TEST=cros_workon_make --board reef --test Change-Id: I3520cd4313bf3bff0d6f3f3775e35f8cf29f6322 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2529870 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-11-11update_engine: Turn on Chrome Kiosk app by defaultAmin Hassani
This flag is always true in Chorme OS and android's code doesn't compile this. So the flag can be removed and be turned on by default. BUG=b:171829801 TEST=cros_workon_make --board reef --test Change-Id: Ibb7423196f24793adf85ef5bfe7da7b1edef012a Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2528758 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-11-04update_engine: Delete android things policyJae Hoon Kim
Android things policy not used. BUG=b:171829801 TEST=none Change-Id: Ibf14e72ac9061dcad7c4b291474834529681c395 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2518384 Tested-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-11-04update_engine: Delete UpdateDownloadAllowed PolicyJae Hoon Kim
Unused policy in update_engine code. |UpdateDownloadAllowed| was a work in progress that was left over. Network connection is checked in a different flow. BUG=b:171829801 TEST=FEATURES=test emerge-$B update_engine Change-Id: Ic726efd066c270be7ca0b594d5627ee884893c27 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2518383 Tested-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-11-03update_engine: Create cros vs. aosp boundary clearAmin Hassani
Its time to make the boundary between Chrome OS and Android code more clear. This CL moves all CrOS only code to "chromeos" directory and the same for Android (in "android" directory). This way we would easily know which code is uses in which project and can keep the code cleaner and more maintainable. One big remaining problem is download_action* files. It seems like DownloadAction class does a lot of things that chrome OS needs and it depends on a lot of Chrome OS stuff, but Android is also using thie Action in a way that circumvent the Chrome OS stuff. For example Android checks for SystemState to be nullptr to not do things. This is really fragile and needs to change. Probably Android Team has to implement their own DownloadAction of some sort and not re use the Chrome OS one in a very fragile way. Removed a few android files that have not been used anywhere. Changed some clang-format and lint issues in order to pass preupload. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_engine Change-Id: I3fff1d4a100a065a5c1484a845241b5521614d9f Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2508965 Tested-by: Amin Hassani <ahassani@chromium.org> Auto-Submit: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Tianjie Xu <xunchang@google.com> Reviewed-by: Kelvin Zhang <zhangkelvin@google.com> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-10-28update_engine: Make policy UpdateCheckParams processing easierAmin Hassani
Currently there are a ton of arguments from UpdateCheckParams that is passed around in the udpate_attampter.cc. With this CL UpdateCheckParams is directy passed and this simplies the logic. BUG=b:171829801 TEST=cros_workon_make --board reef --test update_enigne Change-Id: If454f6393fc6e28d41fa5d14d184f0db32e8bd19 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2504453 Commit-Queue: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
2020-09-29update_engine: Fall back to DeviceMinimumVersionMiriam Polzer
If the kiosk's required Chrome OS version can not be read several times and DeviceMinimumVersionis set, update only if the current version is below the DeviceMinimumVersion. This a very conservative approach at preventing kiosks from updating randomly: - It only affects kiosk devices. - It only affects devices that have DeviceMinimumVersion set, others will still simply update once the kiosk version could not be fetched several times. BUG=chromium:1084453 TEST=FEATURES=test emerge-amd64-generic update_engine TEST=Set policies on DUT and check behavior Change-Id: I82caf4bf4969959e461a218a916f057ea73946ad Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2416628 Tested-by: Miriam Polzer <mpolzer@google.com> Commit-Queue: Miriam Polzer <mpolzer@google.com> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-09-28update_engine: Enterprise channel downgradeMiriam Polzer
Powerwash and roll back when an enrolled user downgrades the channel: - If the admin downgrades channel, check for ChannelDowngradebehavior policy. - If the user downgrades the channel, powerwash based on given boolean. Add the "rollback" flag to the powerwash file to try to preserve some data. Note that this change is not affecting users yet: The ChannelDowngradeBehavior policy is not available in DPanel and the UI does not support chosing powerwash on channel downgrade for enrolled users. BUG=chromium:1122531 TEST=FEATURES=test emerge-amd64-generic update_engine TEST=Set policy with YAPS and test on device Change-Id: I2f02a6e752eed083b57484766f8e7ecc2eed7aca Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2397890 Tested-by: Miriam Polzer <mpolzer@google.com> Commit-Queue: Miriam Polzer <mpolzer@google.com> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org>
2020-09-28update_engine: Kiosk version test and commentMiriam Polzer
The required Chrome OS version (target version prefix) variable for kiosks is set to an empty string instead of a null pointer after 5 failed retrieval attempts. Omaha treats an empty target version prefix the same as no target version prefix. This resulted in kiosks updating to versions greater than their set version prefix would allow. Document that an empty string as result means the version could not be read and add a test for this behavior. The behavior for empty kiosk version is changed in crrev.com/c/2416628. BUG=chromium:1084453 TEST=FEATURES=test emerge-amd64-generic update_engine Change-Id: Ia121882a9d1099e63ae87705b082cb25eaacc14a Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2218314 Tested-by: Miriam Polzer <mpolzer@google.com> Commit-Queue: Miriam Polzer <mpolzer@google.com> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-09-17update_engine: Merge remote-tracking branch 'cros/upstream' into cros/masterAmin Hassani
Done with: git merge cros/upstream --commit -s recursive - Added EC key support and its unittests. - Resolved a conlict on error codes. Since Android versions are not uploading any UMA metrics, I gave the priority to the Android version Since they can't be changed. - Changed the openssl functions to get1 version (from get0) version because of a current issue with gale. Once the issue is resolved we need to change them back. - Some remaining styling issues fixed by clang-format BUG=b:163153182 TEST=CQ passes TEST=unittests Change-Id: Ib95034422b92433ce26e28336bc4806b34910d38
2020-09-15Add CleanupPreviousUpdate in a few missing placesAmin Hassani
Bug: 163153182 Test: FEATURES=test emerge-reef update_engine Change-Id: I99ac444eda38974838ff5867b9f86bea01d61500
2020-09-11update_engine: Add minimum version policyMiriam Polzer
Make the minimum version policy available in the update_engine. This policy is set to a minimum Chrome OS version the device must have to run. No-update windows will not apply if the device's version is below minimum version. If during a Kiosk update Chrome is unreachable and we can not determine the required Chrome OS version, we will fall back to minimum device version and update if the device's version is older. BUG=chromium:1117450, chromium:1084453 TEST=cros_run_unit_test --board ${BOARD} --packages update_engine Change-Id: Ie4fc868805718c9a08a562350bfb015a70a190ac Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2388067 Tested-by: Miriam Polzer <mpolzer@google.com> Commit-Queue: Miriam Polzer <mpolzer@google.com> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-09-09update_engine: Add ChannelDowngradeBehaviorMiriam Polzer
Add the ChannelDowngradeBehaviorPolicy to update_engine. It will be used to decide whether to rollback and powerwash or wait until the target channel catches up on a channel downgrade (e.g. beta to stable). BUG=chromium:1122531 TEST=FEATURES=test emerge-amd64-generic update_engine TEST=manual test on device Change-Id: Iad075e1019084fafec8509c23f2bd55e9755b39e Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2379690 Tested-by: Miriam Polzer <mpolzer@google.com> Commit-Queue: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2020-09-06update_engine: Increase periodic update check read allowsAmin Hassani
Delete the periodic update check interval marker file after 6 attempts at reading it instead of the previous 3 so the auto updater tests can do more interesting things with it. BUG=chromium:953471 TEST=sudo FEATURES=test emerge update_engine Change-Id: I1a67fc5dadfd1ae0fde1308e398e6eb21171df05 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2393098 Tested-by: Amin Hassani <ahassani@chromium.org> Auto-Submit: Amin Hassani <ahassani@chromium.org> Reviewed-by: David Haddock <dhaddock@chromium.org> Commit-Queue: David Haddock <dhaddock@chromium.org>
2020-08-28update_engine: Providing testing capability for periodic update checksAmin Hassani
Currently, we are not able to properly test periodic update checks because these update checks are disabled on test images. To solve this problem this CL introduces a new pref test-update-check-interval-timeout that contains the number of seconds between periodic update checks. The tests can put this file in /var/lib/update_engine/prefs and restart the update_engine. The update_engine should start checking for update after the number of seconds identified in the above pref and continue checking for update with that interval. The tests also need to make sure this file is deleted at the end so it doesn't interfere with future device updates. This pref internally is deleted after it has been read/used 3 times so it can't be abused. For the same reason, the maximum value that can be set in the pref is limited to 10 minutes. BUG=chromium:953471 TEST=FEATURES=test emerge-reef update_engine TEST=flashed a device with this new image, put the pref with value of 10 seconds and restarted the update_engine, the update check happened. Change-Id: I3ad0e300f7908f17da26b0eb0d1510348a2d2435 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2333308 Commit-Queue: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Andrew Lassalle <andrewlassalle@chromium.org>
2020-08-18update_engine: Implement ReleaseLtsTagAmin Hassani
LTS (Long Term Support) requires reading the policy ChromeOSReleaseLtsHint() to get the token that is used for defining the LTS channel parameters. The value is sent in "ltstag" attribute of the updatecheck. BUG=chromium:1114784 TEST=sudo FEATURES=test emerge update_engine Cq-Depend: chromium:2345311 Change-Id: I480e7920e9187ebe79cbde6c655252e432842608 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2350580 Reviewed-by: Victor-Gabriel Savu <vsavu@google.com> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Andrew Lassalle <andrewlassalle@chromium.org> Tested-by: Victor-Gabriel Savu <vsavu@google.com> Commit-Queue: Victor-Gabriel Savu <vsavu@google.com> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-08-13update_engine: Remove junk logsAmin Hassani
These logs bear no special meaning and just polute the device's update_engine logs. So it is better to just remove them. BUG=b:163075733 TEST=None Change-Id: I901231152eaadaa16b0d212ab97f691a1decee90 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2350581 Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
2020-08-13update_engine: Fix a lint issueAmin Hassani
For some reason the linter is thinking this line is doing C-Style casting and gives this error: /mnt/host/source/src/aosp/system/update_engine/update_manager/real_device_policy_provider.cc:108: Using C-style cast. Use reinterpret_cast<T*>(...) instead [readability/casting] [4] BUG=None TEST=repo upload doesn't fail anymore. Change-Id: I5d1e0d96a21fdf1080262e8e04237ccfb809c96f Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2350579 Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-07-29Update language to comply with Android's inclusive language guidanceTianjie
More details in: https://source.android.com/setup/contribute/respectful-code Bug: 161896447 Test: build, run unittests Change-Id: I6a7136b01ecce948a3997c60b7dcec848331e8ef
2020-07-29update_engine: Fix non inclusive vocabularyAndrew
Bug: 161896447 Test: build (cherry picked from commit cc6ab9f076694a816fa35f133e98e7737542ddd8) Change-Id: Ic321806ab6029c88723c220f243e2c2c7a9e94f0 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2267058 Tested-by: Andrew Lassalle <andrewlassalle@chromium.org> Auto-Submit: Andrew Lassalle <andrewlassalle@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-07-06Merge remote-tracking branch 'aosp/upstream-master' into mergeTianjie
It's a merge from chrome OS with some reverts. 1. the fd watcher change, because the libbrillo version isn't compatible in aosp. commit 6955bcc4ffe4cc9d62a88186b9a7e75d095a7897 commit 493fecb3f48c8478fd3ef244d631d857730dd14d 2. two libcurl unittest. Because the RunOnce() of the fake message loop seems to have different behavior in aosp. commit d3d84218cafbc1a95e7d6bbb775b495d1bebf4d2 Put preprocessor guards to use the old code in aosp. And we can switch to the new code in the other path after adopting the new libbrillo & libchrome. Test: unit tests pass, apply an OTA Change-Id: Id613599834b0f44f92841dbeae6303601db5490d
2020-06-26update_engine: Fix non inclusive vocabularyAndrew
BUG=None TEST=CQ Passes Change-Id: Ic321806ab6029c88723c220f243e2c2c7a9e94f0 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2267058 Tested-by: Andrew Lassalle <andrewlassalle@chromium.org> Auto-Submit: Andrew Lassalle <andrewlassalle@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2020-06-22update_engine: Update complete event with exclusionsJae Hoon Kim
When updates are complete, currently all the AppIDs within the request parameter are considered to be updated. This however is not true with exclusions as non-critical AppIDs (e.g. DLCs) can be excluded. This change sends the correct event for |kTypeUpdateComplete| event type. BUG=chromium:928805 TEST=FEATURES=test emerge-$B update_engine update_engine-client Change-Id: I8c21721688fb8a6501316cb87bd0a6f8e005b7ae Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2247489 Tested-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Auto-Submit: Jae Hoon Kim <kimjae@chromium.org> Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
2020-03-28update_engine: Fix issues reported by clang-tidyAndrew
Fix uninitialized variables and some other minor issues reported by clang-tidy. BUG=chromium:982837 TEST=cros_workon_make update_engine --test Change-Id: I305dedb058c9b0787ba2f68feff42afe6810a276 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2122683 Reviewed-by: Amin Hassani <ahassani@chromium.org> Tested-by: Andrew Lassalle <andrewlassalle@chromium.org> Commit-Queue: Andrew Lassalle <andrewlassalle@chromium.org>
2020-01-24update_engine: post libchrome uprev clean-uphscham
BUG=chromium:909719 TEST=unit tests Change-Id: I9ec6c6d8cb23fbd49a86734648d95acc08b791e8 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/2009957 Tested-by: Grace Cham <hscham@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Qijiang Fan <fqj@google.com>
2020-01-02Add ErrorCode::kDeviceCorrupted.Yifan Hong
This error code indicates the device is corrupted in a way that it can no longer receive any future updates. Specifically, if a device encounters a merge error, there is no way we can recover that device. Test: pass Bug: 138808328 Change-Id: Idbd9d1bc5bc02bbba157f17f31b2c5ace839243c
2019-12-13Add ErrorCode::kNotEnoughSpace.Yifan Hong
Virtual A/B now requires space in userdata, which may not be enough during OTA. A kNotEnoughSpace error code is added to indicate such case. Bug: 138808328 Test: builds Change-Id: I6bf7964911c8eb3b9df9b8752018925a99876d0f
2019-12-13Sync with CrOS error codes.Yifan Hong
Add to ErrorCode and metrics::DownloadErrorCode: - kInternalLibCurlError - kUnresolvedHostError - kUnresolvedHostRecovered Test: builds Change-Id: Ibe11c02137860aed583b00b7e05b089ef84edb03
2019-09-11update_engine: Add internal error codes that used for metrics.Amin Hassani
Whenever we are dealing with some problem that require defining error codes and sending UMA metrics, we need to define a new ErrorCode enum value. These error codes then will be used to send which UMA metric value to send. Some of the UMA metrics seems to have circumvent this process by introducing their own error codes without adding them to the global list of error codes. This CL introduces three new error codes: - kInternalLibCurlError - kUnresolvedHostError - kUnresolvedHostRecovered (Technically not an error code, but fits the description and use case of it.) That are then translated to the UMA metric values we send for DownloadErrorCode. In addition, this CL moves the responsibility of sending these UMA metrics from LibCurlHttpFetcher to OmahaRequestAction which is the more correct place to send it because that's where the operations are completed (success or failure) and we can safely decide on the value of UMA without risking to send overlapping or duplicated metrics. For example, previously we send kInternalLibCurlError in conjunction with the kUnresolvedHostError. But doing this can hide the fact that these two error codes might be related and caused by the same underlying issue. Same goes for kUnresolvedHostError and kUnresolvedHosRecovered. If we send both these metrics at the same time, then we need to subtract the number of kUnresolvedHosRecovered from kUnresolvedHostError to figure out the number of unresolved host errors that did not recover. By exclusively sending one or another. We can see exactly how many are recovered and how many did not. Although this might change the meaning of kUnresolvedHostError metric, in the long term it will not be an issue as all the results will converge to the new behavior. The enum.xml (chrome) is updated in crrev.com/c/1774101 BUG=None TEST=cros_workon_make --board=amd64-generic --test --noreconf update_engine Change-Id: I3c7bb5f6159a0bc3a37d55666572b9cd6730f3cb Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1759544 Reviewed-by: Nicolas Norvez <norvez@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2019-08-27update_engine: Replace scoped_refptr with shared_ptr in update_managerAmin Hassani
It seems like scoped_refptr was a substitute for shared_ptr before chromium was on C++11: https://www.chromium.org/developers/smart-pointer-guidelines But that is not the case anymore as we are already on C++14. So just replace it in update_manager with shared_ptr. There is still another use case of it for keeping dbus connections but that can't easily be changed because brillo::DBusConnection is still using scoped_refptr. BUG=chromium:994048 TEST=FEATURES=test emerge update_engine Change-Id: I1fab0408399d678d2851731aea40fc02be459295 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1755262 Reviewed-by: Jae Hoon Kim <kimjae@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org>
2019-08-27update_engine: Break instantiating system policies into their own filesAmin Hassani
This removes the use of __ANDROID__ for instantiating system policies (Chrome OS vs. Android) by defining an interface and implementing the interface in each individual code base. BUG=none TEST=FEATURES=test emerge update_engine Did not build the android side, but hopefully it is correct as the code change is minimal and problems can get caught in reviews. Change-Id: I3931a9bed9ee4a9edfba5d712b05d487af1af813 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1755263 Tested-by: Amin Hassani <ahassani@chromium.org> Commit-Queue: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2019-08-15update_engine: Remove references to bluetooth and wimaxAlex Khouderchah
Shill does not support bluetooth (kTypeBluetooth is left over from the flimflam API) and has stopped supporting Wimax. BUG=chromium:954635 TEST=`FEATURES="test" emerge-$BOARD update_engine update_engine-client` Change-Id: I3e7d4f0b0a7625067585b6f9fdeec196b87f7026 Reviewed-on: https://chromium-review.googlesource.com/c/aosp/platform/system/update_engine/+/1752329 Reviewed-by: Amin Hassani <ahassani@chromium.org> Tested-by: Alex Khouderchah <akhouderchah@chromium.org> Commit-Queue: Alex Khouderchah <akhouderchah@chromium.org>
2019-07-12update_engine: Template specialized UpdateManager interface for mockabilityJae Hoon Kim
This change is to create an interface that is for testing |UpdateManager|. Currently the |UpdateMaanger| exists by having two main member functions that are templatized allowing for a generic set of policy methods to be passed in taking a abitrary set of arguments. The downside of this design is the difficulty when testing such a class. Next steps are to refactor |Policy| and |UpdateManager| to exist together without the need for templatized member function within |UpdateManager| as the whole set of policy methods that can be passed in are already determined (UpdateCheckAllowed, UpdateCanBeApplied, UpdateCanStart, UpdateDownloadAllowed, P2PEnabled, P2PEnabledChanged). The issue is that these functions each take a different set of arguments and can probably be combined into one generic set of arguments making the |UpdateManager| much simpler to manage. BUG=chromium:924165 TEST=unittests TEST=FEATURES="test" emerge-${BOARD} update_engine Change-Id: Ia8091495079f9324bccf5e717d5f26ea7ef24514
2019-06-21update_engine: Indicate existence of owner instead of owner's email in log.Jae Hoon Kim
Logging the device owner's email is possibly a PII, so instead log whether the device has a owner as a boolean value. Enterprise devices do not have a device owner. The variable var_has_owner is dependent on DevicePolicy::GetOwner(). BUG=chromium:973108 TEST=unittest Change-Id: I535f664a4fcf75c6102346b8566605710b062255 Reviewed-on: https://chromium-review.googlesource.com/1660911 Tested-by: Jae Hoon Kim <kimjae@chromium.org> Commit-Ready: Jae Hoon Kim <kimjae@chromium.org> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2019-05-30Removed RollbackOnlyIfRestorePossible option from ↵Aya ElAttar
DeviceRollbackToTargetVersion policy As this option was not implemented and won't be launched, so it should be removed from documentation and codebase before feature launch. BUG=chromium:947621 TEST=./build_packages --board=amd64-generic && \ cros_run_unit_tests --board=amd64-generic --packages update_engine Change-Id: I11ffeb7b65f55e9b026bd4673d16900c34627b34 Reviewed-on: https://chromium-review.googlesource.com/1619795 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Aya Elsayed <ayaelattar@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Sergey Poromov <poromov@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2019-04-24update_engine: Place enterprise rollback save marker fileZentaro Kavanagh
- There are now two types of rollback. One that does a full powerwash and one that save some system state. - When an enterprise rollback powerwash is scheduled, place a marker file to tell the shutdown process to save data before rebooting. - This lets rollback preserve additional data over a powerwash that can be restored later. - Change a few places that were using is_rollback to save_rollback_data to be explicit. BUG=chromium:955463 TEST=unittests Change-Id: I9f18319e711e425a6e712dd319e03bcc6ddd0a1b Reviewed-on: https://chromium-review.googlesource.com/1414030 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Zentaro Kavanagh <zentaro@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2019-01-16update_engine: Run clang-format on update_manager/Amin Hassani
BUG=none TEST=unittest Change-Id: I80b56209d757d1156dd5f55bdd758a1ae8388dcc Reviewed-on: https://chromium-review.googlesource.com/1409707 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2019-01-08update_engine: Merge remote-tracking branch 'cros/upstream' into cros/masterAmin Hassani
Since libchrome in AOSP is ahead of CrOS I had to guard against BASE_VER in a few places to satisfy older libchromes. file_fetcher.cc is now needed in delta_generator. A few unittests need to be run as root. BUG=chromium:916593 TEST=unittest TEST=cros_generate_update_payload TEST=cros flash CQ-DEPEND=CL:1399261 Change-Id: If3497549e88e559f8ecc38f414259b9c774f4a44
2019-01-04Merge aosp/upstream-master into aosp/master.Sen Jiang
Added BinderUpdateEngineClient::AttemptInstall(). Test: update_engine_unittests Change-Id: Id6911f49d763b0d572658acb7d66857016bf6969
2018-11-21Revert "Partially Revert 2b9d241"Hidehiko Abe
This reverts commit 71818c8409812c5a08124627c19aa8ea0625a72e. This patch was created because the upstream update_engine was using the new version of libchrome and the Chrome OS one was not. Now that we are upreving libchrome on Chrome OS we can revert this. BUG=b:37434548 TEST=Build CQ-DEPEND=CL:1240033 Change-Id: I98b7d124212087292500701782de08b3d3ecc559 Reviewed-on: https://chromium-review.googlesource.com/1239818 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Hidehiko Abe <hidehiko@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2018-11-18update_engine: Add disconnected network type for metrics reportingColin Howes
On a failed update, correctly report that the network is disconnected rather than reporting an "unknown" network type, which is set when the connection type cannot be determined based on the properties of a given service path. BUG=chromium:660283 TEST=Added relevant unittests. Also tested manually by updating via cros flash, unplugging Ethernet after the transfer, and killing the dev_server. Metrics sends "disconnected" as expected. Change-Id: Ia681b769208b67fb5c14d41a646d816a42ccf33e Reviewed-on: https://chromium-review.googlesource.com/1231700 Commit-Ready: Colin Howes <chowes@google.com> Tested-by: Colin Howes <chowes@google.com> Reviewed-by: Amin Hassani <ahassani@chromium.org>
2018-10-13Uprev libchrome to r576279 (1/multiple)Jakub Pawlowski
* StatisticsRecorder no longer need call to Initialize() * tracked_objects::Location -> base::Location * base::*ToString replaced with base::NumberToString Test: compilation Change-Id: I5f912bd15f7cb26df3edc1ad7f4479122ffb6d7a Merged-In: I5f912bd15f7cb26df3edc1ad7f4479122ffb6d7a
2018-10-01Remove NOLINT.Chih-Hung Hsieh
Test: build with WITH_TIDY=1 Change-Id: I2992ed695d71cdd02e21015639951ea960e5feb5