summaryrefslogtreecommitdiffstats
path: root/client_library/include
Commit message (Collapse)AuthorAgeFilesLines
* update_engine: fix englishXiaochu Liu2018-11-271-5/+6
| | | | | | | | | | | | | Fix the english for accuracy regarding DLC. BUG=chromium:897882 TEST=None Change-Id: I72ab9ecb7903bb5fb35597222cd7c8b1f4244cfc Reviewed-on: https://chromium-review.googlesource.com/1351359 Commit-Ready: Xiaochu Liu <xiaochu@chromium.org> Tested-by: Xiaochu Liu <xiaochu@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org>
* update_engine: support downloading DLCXiaochu Liu2018-10-121-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DLC (Downloadable Content) is a new concept that best can be described as pieces of programs that are considered extensions of the rootfs. Each DLC resides in the stateful partition and there are two slots for each DLC (A and B, same as root and kernel partitions.) Each slot is treated much like the root and kernel partitions themselves. This patch adds initial support for installing and updating one or multiple DLCs. Each DLC has a unique APP ID which is constructed such as ${PLATFORM_APPID}_${DLC_ID} where: PLATFORM_APPID: Is the APP ID currently used for system updates (release or canary) DLC_ID: Is a unique ID given to a DLC for its lifetime. The combination of these two unique IDs will generate a unique APP ID that can be used for fetching update payloads for DLCs for each board. Update engine traditionally is used for updating a system to a newer one using the A/B slots. However, with DLCs residing in the stateful partition, there is a chance that the stateful partition gets wiped or a new DLC is required to be installed in the current slot. To solve this problem, there is a new "Install" operation that allows downloading an update payload for the current slot with the same version as we are now. This CL adds AttemptInstall Dbus signal to be used for attempting an DLC install operation. Furthermore, two new flags are added to the update_engine_client utility: --dlc_ids: A colon separated list of DLC IDs. --install: Requests an install operation rather than an update. BUG=chromium:879313 TEST=unittest, manual test CQ-DEPEND=1266235 Change-Id: Ia9c9b702dc9d1bd47fbb10b30969baa0322993f6 Reviewed-on: https://chromium-review.googlesource.com/1195593 Commit-Ready: Xiaochu Liu <xiaochu@chromium.org> Tested-by: Xiaochu Liu <xiaochu@chromium.org> Reviewed-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Xiaochu Liu <xiaochu@chromium.org>
* Merge remote-tracking branch 'cros/upstream' into cros/masterAmin Hassani2018-06-041-3/+3
|\ | | | | | | | | | | | | | | | | BUG=chromium:815356 TEST=unittest TEST=precq TEST=cros flash Change-Id: I8d9c37411708d0cae61613b285123a090ce6deb1
| * Turn on build/header_guard in cpplint.Sen Jiang2018-05-091-3/+3
| | | | | | | | | | | | | | Set the correct root path in CPPLINT.cfg and fix existing violations. Test: tools/repohooks/tools/cpplint.py --quiet system/update_engine/**/*.h Change-Id: I37812854a68116c69bcef28f8b15856b89a07c4d
* | update_engine: Reorder enum values in UpdateStatusAmin Hassani2018-03-261-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A new enum NEED_PERMISSION_TO_UPDATE was added in the middle of UpdateStatus enum and this caused problems with Java interfaces in Android. This patch does these things: - Eliminates range based comparisons on UpdateStatus in the code. - Moves the newly added NEED_PERMISSION_TO_UPDATE to the end of the enum. - Assigns explicit values enum values in UpdateStatus. Original CL: aosp/647793 BUG=b:62842358 TEST=unit tests Change-Id: I1fd3ef0171e46250c68cf2ceada06ec815b725a6 Reviewed-on: https://chromium-review.googlesource.com/978676 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Tianjie Xu <xunchang@google.com> Reviewed-by: Nicolas Norvez <norvez@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
* | Reland update over cellular changesWeidong Guo2018-03-191-0/+3
|/ | | | | | | | | | | | | | | | | | | | This merge cherrypicks two commits that was reverted in an AOSP git merge. 4b0d6032cbb86ce488c03b31936cda31283f97e3 Add functions to allow update over cellular (including tethered connection) 840703a4cc77228e2606f45665ae3a4bd75ff7dd Fix update over cellular network on guest account Handled multi-package response. Ran clang-format which fixed a lot of issues in those two CLs. BUG=chromium:815356 TEST=unittests, precq Change-Id: I54b6763c4c54755272531b558ed7628ceb0fc6c7 Reviewed-on: https://chromium-review.googlesource.com/965267 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
* Correct variable name for last update check timeAaron Wood2017-12-111-2/+3
| | | | | | | | | | Align the name of the last update check time variable to the units within it (seconds since epoch). Bug: 70178109 Test: unit-tests Change-Id: Ic06890f0e234528d80dc1bcd053e8b602c6f9309 (cherry picked from commit 4adf279cecb8b6c5f85d66e504b9c847b72e0e4c)
* Use new bitwise operators for UpdateAttemptFlagsAaron Wood2017-12-081-15/+4
| | | | | | | | | | Switch the bitwise operator overloads to the new standardized ones from libbrillo. Test: unit-tests Test: manual exercising of update_engine via APIs Change-Id: Ia8bd7d90adc9469826a906c127c87bfac8272f6c (cherry picked from commit 931b955fc5c8427b90a123859e1dab22baae7f7d)
* Add flag for restricting downloadsAaron Wood2017-12-061-0/+26
| | | | | | | | | | | | | This adds a flag that can be used to turn off the ability to download and apply updates from the API. This value applies to all future update checks that the update_engine performs. Changing this value during an update check has no effect on the current update check. Bug: 66016687 Test: unit-tests, manual OTA Change-Id: I655adf23cae44c63079bfa9dc18ba8ca65d7a304 (cherry picked from commit e22f2ddfec92623d38efbf17c17917f68e52907a)
* Update API: initial supportAaron Wood2017-09-191-0/+21
| | | | | | | | | | | | | | | | | | | | Initial pieces of the Update API callback framework. - move the status callback params to a new object, UpdateEngineStatus to allow for the easier addition of new params in the future. - switch the IUpdateEngineStatusCallback to provide a ParcelableUpdateEngineStatus instead of a series of individual params - move the various GetStatus() methods to use the UpdateEngineStatus object instead of a series of params (which will need future expansion) - Add current and new product/os versions to both the UpdateEngineStatus and the ParcelableUpdateEngineStatus. Bug: 64808702 Test: unit tests, and performing OTAs via a test app calling IUpdateEngine::AttemptUpdate() via UpdateManager::performUpdateNow() Change-Id: I53f66f3511049f0809855814e1e758023cd8cc08 (cherry picked from commit 4f96ebf85022837603f2e10100a044d234b7d86f)
* Revert "Add functions to allow update over cellular (including tethered ↵Tao Bao2017-06-061-3/+0
| | | | | | | | | | connection)" This reverts commit 4b0d6032cbb86ce488c03b31936cda31283f97e3. Bug: 62366504 Test: GmsCore sees the old status code (i.e. UPDATED_NEED_REBOOT == 6). Change-Id: I9185614a41bd621ad85e7f773b0f96919b0f70d5
* Add functions to allow update over cellular (including tethered connection)Weidong Guo2017-05-311-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add an update state NEED_PERMISSION_TO_UPDATE which is broadcasted along with the update info (version and size) when |OmahaRequestAction| aborts update due to cellular connection. So the state transition will be: IDLE->CHECKING_FOR_UPDATE->NEED_PERMISSION_TO_UPDATE->REPORTING_ERROR_EVENT ->IDLE (The Chrome UI prompts an alert window showing update size and asks user whether to proceed upon receiving this state.) - Add a dbus interface to set update over cellular target (kPrefsUpdateOverCellularTargetVersion and kPrefsUpdateOverCellularTargetSize). The target is the one received by Chrome UI in NEED_PERMISSION_TO_UPDATE broadcast. By sending the target back with the dbus call, update engine can double check the target with the server to make sure there's no new server push after NEED_PERMISSION_TO_UPDATE is broadcasted to Chrome UI. (This dbus call is invoked when the user chooses to proceed to update at the alert window. The dbus call is followed by another dbus call |AttemptUpdate|) - So, the the decision tree as to whether to allow update over cellular connection has changed to: IF (device policy DeviceUpdateAllowedConnectionTypes set) follow device policy's decision ELSE IF (kPrefsUpdateOverCellularPermission set to true) allow update ELSE IF (Either kPrefsUpdateOverCellularTargetVersion or kPrefsUpdateOverCellularTargetSize is not set, or they are set but do not match the version and size in |OmahaResponse| retrieved by |OmahaRequestAction|) disallow update, and broadcast NEED_PERMISSION_TO_UPDATE ELSE allow update ENDIF - This decision making happens at |OmahaRequestAction| after |OmahaResponse| is retrieved. Since we want to separate the device policy check with the user preferences check which depends on |OmahaResponse| during checking for update, we modify ConnectionManager::IsUpdateAllowedOver by moving the user preferences check to |OmahaRequestAction|. Thus, the function by default returns true for cellular connection if device policy is not set. - Corner case: Adding kPrefsUpdateOverCellularPermission and kPrefsUpdateOverCellularTargetSize seems to complicate the logic here. But they could effectively solve a corner case where the target does not match |OmahaResponse| due to new server push after broadcasting NEED_PERMISSION_TO_UPDATE. In that case, we simply broadcast NEED_PERMISSION_TO_UPDATE again along with new update info. CQ-DEPEND=CL:481102 BUG=chromium:691108 TEST='FEATURES=test emerge-link update_engine' (cherry picked from commit 70063d9f7e229db8c5b42443ca96ac23a971a6dd) Cherry-pick updated to compile on Android. Reviewed-on: https://chromium-review.googlesource.com/479467 Commit-Ready: Weidong Guo <weidongg@chromium.org> Tested-by: Weidong Guo <weidongg@chromium.org> Reviewed-by: Weidong Guo <weidongg@chromium.org> Reviewed-by: Andrew de los Reyes <adlr@chromium.org> Reviewed-by: Ben Chan <benchan@chromium.org>
* Add {Get,Set}CohortHint interface.Alex Deymo2016-10-061-0/+4
| | | | | | | | | | | | | | Export the "cohort hint" getter and setter in the client interfaces (D-Bus and Binder). The cohort hint is sent to Omaha on every update check request but can be ignored and/or reset by Omaha on every response. Other minor linter fixes to the affected files. Bug: 31740109 Test: Build with D-Bus and with Binder. Change-Id: I93214f6ffb8662c238b3351e52bf2bdf23e46a9c
* Parse and expose end-of-life flag.Alex Deymo2016-05-031-0/+3
| | | | | | | | | | | | | | Omaha update or noupdate response can include _key=value pairs with arbitrary data. One of those key can be "_eol" with the one of the values "supported", "security-only" or "eol" which notifies the device the end-of-life status of the device with respect to updates. This information is now exposed via GetEolStatus() to the client so it can be properly displayed in the UI. Bug: 27924505 TEST=Added unittest. Run `update_engine_client --eol_status` on link. Change-Id: Icc15f25b4d0b19cc894f5afc52ac7c43c7818982
* Add a feature to get the last UpdateAttempt ErrorCode from update_engineShuqian Zhao2016-02-101-0/+3
| | | | | | | | | | | | | | | For autotest, update_engine test failures are always hard to debug, since the error message is not clear. Add a new flag 'last_attempt_error' to get the last UpdateAttempt ErrorCode from update_engine. Bug:25598547 Test:emerge-peppy update_engine emerge-peppy update_engine_client cros flash a test image to DUT. (on the DUT):update_engine_client --last_attempt_error Compare the results with the update_engine logs, matched. Change-Id: Id12681097ed30b0826cad68809f17f934a07e5b2
* Properly handle handler registering and unregisteringCasey Dahlin2016-01-291-4/+8
| | | | | | | | | | | In addition to now supporting unregistering, we now correctly support multiple handlers under DBus, and correctly send initial events under binder. TEST=Verified update_engine_client still works as expected Bug: None Change-Id: I60955d4d9ca61dfe7857b9fc78f77fa4292ed218
* Make client use binder interface on brilloCasey Dahlin2016-01-271-1/+1
| | | | | | | TEST=Verified status and update commands Bug: 25908638 Change-Id: I7994de41001b4e116bffa539f23f1344ab1deae9
* Initialize DBus in CreateInstanceCasey Dahlin2016-01-131-7/+7
| | | | | | | | | | We now expect the bus to be ready to go as soon as CreateInstance is finished. The downside is that CreateInstance can now fail when the bus isn't available, so we must handle nullptr returns. Change-Id: I1e8d20f8d85d93e7e8b5e93ee1e5ba6043a347c4 Test: Verified commands continue to work Bug: 26233663
* Introduce status handlers and use them in clientCasey Dahlin2016-01-122-0/+55
| | | | | | | | | | | We introduce a StatusUpdateHandler class which can be overridden to provide a method with which to react to status updates. This replaces manual dbus logic in several places in update_engine_client with a consistent interface for asynchronously handling status updates. Change-Id: Idca4229de82074fb7a87a315b45dd0292c1b1f16 Test: Confirmed --update blocks and resumes correctly Bug: 26233663
* Move all blocking client calls to libupdate_engine_clientCasey Dahlin2015-12-171-0/+21
| | | | | | | Change-Id: I27bc86ad2eef3a573c60fde1bb10b6b37af81c1c Test: Affected commands continue to work Bug: 26233663 Signed-off-by: Casey Dahlin <sadmac@google.com>
* Port all available calls to libupdate_engine_clientCasey Dahlin2015-12-171-1/+2
| | | | | | | | This is as far as the port can go without improving the library itself. Change-Id: I5d5dbf14b62746786364b2a7e1a9131d8ef7bfb1 Test: All affected commands still signal the daemon on dragonboard Bug: 26233663
* Port update_engine_client ResetStatus command to libCasey Dahlin2015-12-161-0/+3
| | | | | | | | | | | | This is the first step in getting update_engine_client completely off of direct DBus calls Test: Ran --reset_status command and verified update_engine received the signal. Bug: 26233663 Signed-off-by: Casey Dahlin <sadmac@google.com> Change-Id: Iac54d890fd796f91a7813755d6061cf468255347
* Split payload application code into a subdirectory.Alex Deymo2015-11-122-6/+6
| | | | | | | | | | | | | | | | | | | | This patch splits from the main libupdate_engine code the part that is strictly used to download and apply a payload into a new static library, moving the code to subdirectories. The new library is divided in two subdirectories: common/ and payload_consumer/, and should not depend on other update_engine files outside those two subdirectories. The main difference between those two is that the common/ tools are more generic and not tied to the payload consumer process, but otherwise they are both compiled together. There are still dependencies from the new libpayload_consumer library into the main directory files and DBus generated files. Those will be addressed in follow up CLs. Bug: 25197634 Test: FEATURES=test emerge-link update_engine; `mm` on Brillo. Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23
* Add DBus hiding client libraryChristopher Wiley2015-10-071-0/+89
| | | | | | | | | | This library hides update_engine's legacy DBus dependencies until we can remove them completely. Bug: 24547247 Test: mmm system/update_engine; emerge-panther update_engine Change-Id: I7f87f2a7c31d0940c376ef43368e53b0f3bc3407
* Move UpdateStatus and helpers to dedicated filesChristopher Wiley2015-10-051-0/+37
This allows us to easily share it between the update_engine proper and a forthcoming client library. Bug: 24547247 Test: mmm system/update_engine; emerge-panther update_engine Change-Id: I8c0db7a0f95dd6368bfc886f1b0d1a9d2efb461f