summaryrefslogtreecommitdiffstats
path: root/updater/updater.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Retry the update if ApplyBSDiffPatch | ApplyImagePatch failsTianjie Xu2017-05-241-0/+4
| | | | | | | | | | | | | | | We have seen one case when bspatch failed likely due to patch corruption. Since the package has passed verification before, we want to reboot and retry the patch command again since there's no alternative for users. We won't delete the stash before reboot, and the src has passed SHA1 check. If there's an error on the patch, it will fail the package verification during retry. Bug: 37855643 Test: angler reboots and retries the update when bspatch fails. Change-Id: I2ebac9621bd1f0649bb301b9a28a0dd079ed4e1d
* Merge "Add a default error code when updater script aborts"Tianjie Xu2017-05-031-7/+9
|\
| * Add a default error code when updater script abortsTianjie Xu2017-05-031-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | We didn't report error/cause codes unless there's an explict "Abort()" call inside the updater script. As a result, some cause codes set by ErrorAbort() didn't show up in last_install. To fix the issue, add a default error code when the script terminates abnormally (i.e. with non zero status). Bug: 37912405 Test: error/cause code shows up in last_install when argument parsing fails Change-Id: Ic6d3bd1855b853aeaa0760071e593a00cf6f0209
* | Move sysMapFile and sysReleaseMap into MemMapping class.Tao Bao2017-05-021-2/+1
|/ | | | | | | Test: recovery_component_test Test: recovery_unit_test Test: Apply an OTA on angler. Change-Id: I7170f03e4ce1fe06184ca1d7bcce0a695f33ac4d
* Fixed scanf modifierMikhail Lappo2017-03-231-1/+1
| | | | | | Scanf expectation is to have same type of pointer to store parsed value and modifier in format string
* Remove malloc in edify functionsTianjie Xu2017-03-221-1/+1
| | | | | | | | And switch them to std::vector & std::unique_ptr Bug: 32117870 Test: recovery tests passed on sailfish Change-Id: I5a45951c4bdf895be311d6d760e52e7a1b0798c3
* Print with newline for ui_print.Tao Bao2017-01-221-1/+0
| | | | | | | | | | | | | | | | | | | Currently the ui_print command between the recovery and updater doesn't append newline. Updater has to send an extra "ui_print" command without any argument to get the line break. This looks unnecessary. And not all the callers (including the ones in bootable/recovery) are following this protocol when sending the ui_print command. This CL simplifies the protocol to always print with a newline for ui_print command. When updating from an old recovery with the new updater, all the ui_print'd strings would appear in one line as a side effect. But a) it would only affect the text-mode UI, which won't be shown to users; b) log files won't be affected. Bug: 32305035 Test: Apply an update with the new updater on top of an old and new recovery image respectively. Change-Id: I305a0ffc6f180daf60919cf99d24d1495d68749b
* Do not inject I/O fault on a retryTianjie Xu2017-01-091-1/+1
| | | | | | | | | | We could inject I/O faults during an OTA update for test purpose. But we should skip the injection if the update is an retry. Otherwise the update test will simply keeps failing. Bug: 34159970 Test: Apply the same package on angler and the update succeeds on the 2nd try. Change-Id: Id274e5475e3bc8d25d50a8cf61a77d2e32c569d6
* updater: Switch to libbase logging.Tao Bao2016-12-011-152/+157
| | | | | Test: Build an updater into a package and apply it on device. Change-Id: I289b5768e9b1e44ef78e0479c64dbaa36fb1a685
* Replace minzip with libziparchiveTianjie Xu2016-10-181-20/+33
| | | | | | | | | | | Clean up the duplicated codes that handle the zip files in bootable/recovery; and rename the library of the remaining utility functions to libotautil. Test: Update package installed successfully on angler. Bug: 19472796 Change-Id: Iea8962fcf3004473cb0322b6bb3a9ea3ca7f679e
* Change StringValue to use std::stringTianjie Xu2016-10-151-4/+4
| | | | | | | | | | | Changing the field of 'Value' in edify to std::string from char*. Meanwhile cleaning up the users of 'Value' and switching them to cpp style. Test: compontent tests passed. Bug: 31713288 Change-Id: Iec5a7d601b1e4ca40935bf1c70d325dafecec235
* edify: Some clean-ups to libedify.Tao Bao2016-10-131-1/+0
| | | | | | | | | | | | - Remove dead declarations in expr.h: SetError(), GetError(), ClearError(). - Remove the declaration of Build() out of expr.h. - Use std::unordered_map to implement RegisterFunction() and FindFunction(); kill FinishRegistration(). - Add a testcase for calling unknown functions. Test: mmma bootable/recovery; recovery_component_test passes. Change-Id: I9af6825ae677f92b22d716a4a5682f58522af03b
* Refactor libupdater into a seperate module.Tao Bao2016-10-111-4/+4
| | | | | | | | | So that we can write native tests for updater functions. This CL adds a testcase for getprop() function. Test: mmma bootable/recovery; Run recovery_component_test on device. Change-Id: Iff4c1ff63c5c71aded2f9686fed6b71cc298c228
* edify: Move State.script and State.errmsg to std::string.Tao Bao2016-10-041-20/+17
| | | | | | | | | | | This way we kill a few strdup() and free() calls. Test: 1. recovery_component_test still passes; 2. Applying an update with the new updater works; 3. The error code in a script with abort("E310: xyz") is recorded into last_install correctly. Change-Id: Ibda4da5937346e058a0d7cc81764d6f02920010a
* resolve merge conflicts of 7ce287d to nyc-dev-plus-aospTianjie Xu2016-06-041-1/+9
|\ | | | | | | Change-Id: I2194d1170281f58eb508f2ef63b39c8729125f76
| * Call ioctl before each write on retryTianjie Xu2016-06-031-1/+9
| | | | | | | | | | | | | | | | If the update is a retry, ioctl(BLKDISCARD) the destination blocks before writing to these blocks. Bug: 28990135 Change-Id: I1e703808e68ebb1292cd66afd76be8fd6946ee59
* | resolve merge conflicts of 50f6417 to nyc-dev-plus-aospTianjie Xu2016-05-231-0/+17
|\| | | | | | | Change-Id: I42c127f7946e678acf6596f6352f090abc0ca019
| * Allow recovery to return error codesTianjie Xu2016-05-201-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Write error code, cause code, and retry count into last_install. So we can have more information about the reason of a failed OTA. Example of new last_install: @/cache/recovery/block.map package name 0 install result retry: 1 retry count (new) error: 30 error code (new) cause: 12 error cause (new) Details in: go/android-ota-errorcode Bug: 28471955 Change-Id: I00e7153c821e7355c1be81a86c7f228108f3dc37
| * Control fault injection with config files instead of build flagsJed Estep2016-03-191-0/+2
| | | | | | | | | | Bug: 27724259 Change-Id: I65bdefed10b3fb85fcb9e1147eaf0687d7d438f4
| * Revert "DO NOT MERGE Control fault injection with config files instead of build flags"Tao Bao2016-03-171-2/+0
| | | | | | | | | | | | | | This reverts commit f73abf36bcfd433a3fdd1664a77e8e531346c1b1. Bug: 27724259 Change-Id: I1301fdad15650837d0b1febd0c3239134e2b94fb
| * DO NOT MERGE Control fault injection with config files instead of build flagsJed Estep2016-03-161-0/+2
| | | | | | | | | | Bug: 26570379 Change-Id: I76109d09276d6e3ed3a32b6fedafb2582f545c0c
| * Reboot and retry on I/O errorsTianjie Xu2016-03-101-0/+7
| | | | | | | | | | | | | | | | | | When I/O error happens, reboot and retry installation two times before we abort this OTA update. Bug: 25633753 Change-Id: Iba6d4203a343a725aa625a41d237606980d62f69 (cherry picked from commit 3c62b67faf8a25f1dd1c44dc19759c3997fdfd36)
| * recovery: Switch applypatch/ and updater/ to cpp.Tao Bao2015-07-141-0/+169
| | | | | | | Mostly trivial changes to make cpp compiler happy. Change-Id: I1b0481465c67c3bbca35a839d0764190d84ff34e (cherry picked from commit ba9a42aa7e10686de186636fe9fecbf8c4cc7c19)
* Move selinux dependencies out of header files.Elliott Hughes2016-04-021-0/+3
| | | | | Bug: http://b/27764900 Change-Id: Ib62a59edcb13054f40f514c404d32b87b14ed5f1
* Reboot and retry on I/O errorsTianjie Xu2016-03-031-0/+7
| | | | | | | | When I/O error happens, reboot and retry installation two times before we abort this OTA update. Bug: 25633753 Change-Id: Iba6d4203a343a725aa625a41d237606980d62f69
* Control fault injection with config files instead of build flagsJed Estep2016-02-231-0/+2
| | | | | | Bug: 26570379 Change-Id: I76109d09276d6e3ed3a32b6fedafb2582f545c0c (cherry picked from commit d940887dde23597dc358b16d96ca48dd7480fee6)
* recovery: Switch applypatch/ and updater/ to cpp.Tao Bao2015-07-141-0/+169
Mostly trivial changes to make cpp compiler happy. Change-Id: I69bd1d96fcccf506007f6144faf37e11cfba1270