summaryrefslogtreecommitdiffstats
path: root/common.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Clean up some global variables in common.hTianjie Xu2019-07-241-13/+0
| | | | | | | | | | | | | | Some global variables are only used for recovery.cpp and recovery_main.cpp, remove them from common.h and handle their usage accordingly. Variables include: static constexpr int kRecoveryApiVersion; extern struct selabel_handle* sehandle; extern RecoveryUI* ui; extern bool has_cache; bool is_ro_debuggable(); Test: unit tests pass, boot into recovery mode and run graphic tests Change-Id: If83a005786c9b38412731da97aaf85af69a3b917
* recovery: Remove SetUsbConfig() out of common.h.Tao Bao2019-03-291-2/+0
| | | | | | | libinstall now has its own copy. Test: mmma -j bootable/recovery Change-Id: Ibbe7084e15baeb7e744f2175d5944477092acc9e
* Remove ui_print().Tao Bao2019-03-291-8/+1
| | | | | | | | | | This used to be a helper function that allows printing message to UI. We no longer have any active user in bootable/recovery. Device-specific code can achieve the same functionality by calling GetUI()->Print() instead. Test: mmma -j bootable/recovery Change-Id: If584fc8a51d1af466f1d94d8ea5faa262603a784
* Move install to separate modulexunchang2019-03-291-1/+0
| | | | | | | | Build libinstall as a shared library. Also drop the dependency on the global variables in common.h. Test: unit tests pass, sideload an OTA Change-Id: I30a20047768ce00689fc0e7851c1c5d712a365a0
* Fix sideload for user devices by adding a new sideload configHridya Valsaraju2018-09-081-0/+1
| | | | | | | | Bug: 113563995 Test: Tested the 'adb sideload' command on marlin user/userdebug builds and walleye user/userdebug builds Change-Id: I00d565547b85f2db87012e4a08316609e03395ac
* recovery: Refactor common setup into main()Jerry Zhang2018-05-161-0/+1
| | | | | | | | | | | | | | Move more common setup into the main function. Main() handles all 1 time setup, such as ui, logging, and secontext. Recovery_main() takes in command line arguments, does any necessary recovery work, and can be called multiple times from main(). Test: Recovery works Bug: 78793464 Change-Id: I2d2595fc342b4ddfa80f4e06b30e44263132acd9 Merged-In: I2d2595fc342b4ddfa80f4e06b30e44263132acd9
* recovery: Refactor logging code into logging.cppJerry Zhang2018-05-071-7/+2
| | | | | | | | | | Move common logging related functions to rotate_logs.cpp, and rename that to logging.cpp. Test: Recovery works Bug: 78793464 Merged-In: I00f20a79a296680122b8437d54a87897c5cb2fc7 Change-Id: I00f20a79a296680122b8437d54a87897c5cb2fc7
* Move reboot() from common.h into otautil/sysutil.h.Tao Bao2018-05-041-2/+0
| | | | | | | | | | | | This breaks the dependency on common.h (which belongs to recovery/librecovery) from librecovery_ui. reboot() is now owned by libotautil, which is expected to be a leaf node to be depended on. With the change, recovery and updater also share the same reboot() code now. Test: mmma -j bootable/recovery Change-Id: I1cc5d702cfe49302048db33d31c9c87ddc97ac71
* recovery: Split main() into recovery_main.cpp.Tao Bao2018-05-011-1/+5
| | | | | | | | | | | | | | This prepares for moving more codes from recovery into librecovery, so that they will become more easily testable. recovery_main.cpp will be the source code for recovery module, with the rest moved into librecovery. recovery_main.cpp mainly does the initializations, such as setting up the logger. Test: mmma -j bootable/recovery Test: recovery_component_test Test: Build and boot into recovery image on marlin. Change-Id: I8e846524546b6f3f0e32ed869e851f62261eef23 Merged-In: I8e846524546b6f3f0e32ed869e851f62261eef23
* Mark ui_print with __printflike.Tao Bao2018-04-261-1/+1
| | | | | | | | And fix an issue as a result of the change. Test: mmma -j bootable/recovery Change-Id: I94e6384a1f39e9c37a8ed029d235142738d6e5d3 Merged-In: I94e6384a1f39e9c37a8ed029d235142738d6e5d3
* Rename CacheLocation to Paths.Tao Bao2018-04-261-2/+2
| | | | | | | | | | We have a general need for overriding more paths (e.g. "/tmp"), mostly for testing purpose. Rename CacheLocation to Paths, and use that to manage TEMPORARY_{INSTALL,LOG}_FILE. Test: mmma -j bootable/recovery Test: recovery_component_test Change-Id: Ia8ce8e5695df37ca434f13ac4d3206de1e8e9396
* Remove EXPAND/STRINGIFY macros.Tao Bao2017-09-131-2/+3
| | | | | | | | | | | | | | | | | | | This reverts commit 8be0f39fec7f26164fd0791ff6d15bde65fc849c to reland the change that removes EXPAND/STRINGIFY macros. It's error-prone by putting anything into a string (e.g. EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we forgot to pass -DRECOVERY_API_VERSION=3). The initial attempt put RECOVERY_API_VERSION into common.h, which might be included by device-specific codes but without defining that when compiling the module. This CL avoids the issue by using a constant in the header, with a static_assert in recovery.cpp that guards the consistency. Test: recovery_component_test Test: Sideload OTAs on bullhead and sailfish respectively. Change-Id: I12af3f73392a85554ba703f04970ec9d984ccbaa
* Revert "Remove EXPAND/STRINGIFY macros."Tao Bao2017-05-041-2/+2
| | | | | | | | | | This reverts commit ec9706738f35a859f66fd0758b73381055804f63. Reason for revert: It's not a good idea to put RECOVERY_API_VERSION in common.h, which might be included by device-specific codes (but with RECOVERY_API_VERSION undefined). Change-Id: I9feb9c64a5af3e9165164622a59b043aa28a8b8c
* Remove EXPAND/STRINGIFY macros.Tao Bao2017-05-031-2/+2
| | | | | | | | | | | | | | | | They are error-prone by putting anything into a string (e.g. EXPAND(RECOVERY_API_VERSION) would become "RECOVER_API_VERSION" if we forgot to pass -DRECOVERY_API_VERSION=3). RECOVERY_API_VERSION is the only user (in bootable/recovery) that gets stringified. Assign it to a typed var and sanity check the value. Don't see other reference to the macros from device-specific recovery directories (they can still define that locally if really needed). Test: recovery_component_test Test: Sideload an OTA on angler and marlin respectively. Change-Id: I358bbdf8f0a99db5ce4c7bc2fdcafe8013501b64
* Adding support for quiescent reboot to recoveryDmitri Plotnikov2017-04-191-0/+2
| | | | | | Bug: 37401320 Test: build and push OTA and hit adb reboot recovery,quiescent. The screen should remain off throughout the upgrade process. Change-Id: Ibed3795c09e26c4fa73684d40b94e40c78394d3f
* recovery: Add the missing #include.Tao Bao2017-03-071-0/+2
| | | | | | | | | Although I checked there's no reference to 'stage' in device-specific recovery codes (for commit a8d72bc3b4087632e8cdad95e8355a2495e15690), it's insufficient to capture the missing #include issue. Test: lunch aosp_dragon-userdebug; mmma bootable/recovery Change-Id: I4c5dbe9acf38918491c3aa776ce358be03f9ecca
* recovery: Drop the "--stages" / '-g' argument.Tao Bao2017-03-071-1/+1
| | | | | | | | | | | | | This was introduced in commit c87bab101893e8322b49d7c8600e3367b20ab50a. But the stage info should be passed through BCB only (there's a dedicated field in struct bootloader_message). This CL removes it from recovery arguments, and also moves 'stage' variable to std::string. Test: 'stage' variable is not used by any device-specific recovery code. Test: Code search shows no hit of '--stages' use. Change-Id: Iccbde578a13255f2b55dd4a928e9ecf487f16b97
* Revert "Revert "Some cleanups to recovery.""Tao Bao2016-11-031-2/+9
| | | | | | | | | | | | | | This reverts commit 8584fcf677dd45b30121bd0490b06297e6be1871. This CL re-lands commit c0319b60f56d445c2d1c74f551e01f069b028fe6. The "stage" and "reason" variables are now declared as global by dropping the static qualifier, because they may be used by vendor recovery libraries. Test: lunch aosp_angler-userdebug; mmma bootable/recovery Test: lunch aosp_dragon-userdebug; mmma bootable/recovery Change-Id: I252c346f450079478cff22bbff01590b8ab2e2b3
* Revert "Some cleanups to recovery."Dan Albert2016-10-271-3/+2
| | | | | | | | This reverts commit c0319b60f56d445c2d1c74f551e01f069b028fe6. Reason for revert: Broke builds. Change-Id: I82aa880b83de5ae6c36fd7567cb001920559a972
* Some cleanups to recovery.Tao Bao2016-10-261-2/+3
| | | | | | | | | | | | - Remove the duplicate gCurrentUI variable in recovery.cpp; - Refactor the load/save of locale functions; - Clean up ui_print() to get rid of 256-byte buffer limit; - Declare ui in common.h; - Move the typedef of Volume into roots.h. Test: Build and boot into recovery image. Change-Id: Ia28c116858ca754133127a5ff9c722af67ad55b7
* Switch recovery to libbase loggingTianjie Xu2016-09-011-12/+0
| | | | | | | | Clean up the recovery image and switch to libbase logging. Bug: 28191554 Change-Id: Icd999c3cc832f0639f204b5c36cea8afe303ad35 Merged-In: Icd999c3cc832f0639f204b5c36cea8afe303ad35
* updater: Clean up char* with std::string.Tao Bao2015-08-061-8/+0
| | | | | | | So we can remove a few free()s. And also replace a few pointers with references. Change-Id: I4b6332216704f4f9ea4a044b8d4bb7aa42a7ef26
* Rotate logs only when there are actual operationsTao Bao2015-04-081-0/+1
| | | | | | | | | | Currently it rotates the log files every time it boots into the recovery mode. We lose useful logs after ten times. This CL changes the rotation condition so that it will rotate only if it performs some actual operations that modify the flash (installs, wipes, sideloads and etc). Bug: 19695622 Change-Id: Ie708ad955ef31aa500b6590c65faa72391705940
* recovery: Properly detect userdebug or eng buildsElliott Hughes2015-02-101-0/+3
| | | | | | | | | | | | | | | The recovery system behaves a little bit differently on userdebug or eng builds by presenting error reports to the user in the ui. This is controlled by checking the build fingerprint for the string :userdebug/ or :eng/. But with AOSP version numbers most AOSP builds blows the 92 char limit of ro.build.fingerprint and therefore the property is not set, so this condition will always be evaluated to false, for most builds. Instead of depending on the flaky ro.build.fingerprint this change uses ro.debuggable. Change-Id: I74bc00c655ac596aaf4b488ecea58f0a8de9c26b
* recovery: turn on text display for install errors in debug buildsDoug Zongker2013-05-161-2/+4
| | | | | | | | | | | Hopefully this will reduce the number of OTA "bugs" reported that are really just someone having changed their system partition, invalidating future incremental OTAs. Also fixes a longstanding TODO about putting LOGE() output in the on-screen display. Change-Id: I44e5be65b2dee7ebce2cce28ccd920dc3d6e522e
* Move to using the new unified fstab in recovery.Ken Sumrall2013-02-201-18/+1
| | | | | | | Instead of reading it's own fstab, have recovery invoke fs_mgr to read the unified fstab. Change-Id: I80c75d2c53b809ac60a4a69f0ef7ebfa707c39e9
* move key processing to RecoveryUIDoug Zongker2011-11-041-19/+0
| | | | | | | | | Move the key for handling keys from ScreenRecoveryUI to RecoveryUI, so it can be used by devices without screens. Remove the UIParameters struct and replace it with some new member variables in ScreenRecoveryUI. Change-Id: I70094ecbc4acbf76ce44d5b5ec2036c36bdc3414
* turn recovery into a C++ binaryDoug Zongker2011-10-311-55/+10
| | | | Change-Id: I423a23581048d451d53eef46e5f5eac485b77555
* save a last_install file with the result of the last package install attemptDoug Zongker2011-04-121-0/+3
| | | | | | | | | | | When installing a package, create /cache/recovery/last_install, which contains the filename of the package and a 1 or 0 for success or failure. Also, don't mount ext4 and vfat filesystems as read-only (on devices where /cache is ext4, we need it to be read-write). Change-Id: I0cf2a1921bbd65e06343aa74e2006577fac77c2c
* make recovery UI images more general; allow for installation animationDoug Zongker2011-03-011-0/+19
| | | | | | | | | | | Change some of the UI parameters (# of indeterminate progress bar frames, fps, etc.) from #defined constants to variables that can be set by the device-specific recovery_ui code (via a new function). Support overlaying different images on top of the base installation icon to animate it. Make the FPS control more accurate. Change-Id: I9268b389b7ea6b3ed9e0c7eae37baf4272e60edd
* store partition length in recovery.fstabDoug Zongker2011-02-181-0/+6
| | | | | | Don't hardcode magical partition behavior in roots.c. Change-Id: I587fc2c066575b51c11efd2e45a50f5b864df484
* make recovery reboot after 2 minutes of no activityDoug Zongker2011-01-251-0/+1
| | | | | | | | | | | | | | | If recovery sits for 2 minutes in prompt_and_wait(), and you've never turned the screen on via the magic keypress, go ahead and reboot. (We used to assume that the user could pull the battery to get out of this state, but on devices with nonremovable batteries...) If you've ever enabled display of the log/menu since recovery started, we assume you know what you're doing and will stay in recovery until you choose to reboot. Bug: 3387873 Bug: 3387274 Change-Id: I041621e5db132df9a925e6808845a7c45e1b427a
* remove the notion of "root path"; support mixed flash typesDoug Zongker2010-09-211-0/+13
| | | | | | | | | | | | Remove the wacky notion of "roots" and "root paths" (those things that look like "FOO:some/path" instead of just "/foo/some/path"). Let each device specify its own table of available partitions and how to mount them (needed for devices that use both MTD/yaffs2 and EMMC/ext4 partitions). (Cherrypicked from gingerbread w/slight edits.) Change-Id: I2479ce76b13e73f1d12035c89386c3a82b3edf51
* am 28cae98c: am 4bc98062: add --show_text option to recoveryDoug Zongker2010-09-031-0/+1
|\ | | | | | | | | | | | | Merge commit '28cae98c834fb4bc47588b34dc3fe19811d5162b' * commit '28cae98c834fb4bc47588b34dc3fe19811d5162b': add --show_text option to recovery
| * add --show_text option to recoveryDoug Zongker2010-09-031-0/+1
| | | | | | | | Change-Id: Ie6c6c920260dfa759fbb15b1f352d6bb0fa7146c
* | support for ext4/EMMC filesystems in updater binaryDoug Zongker2010-07-021-4/+4
| | | | | | | | | | | | | | | | | | Make the mount and format functions take extra parameters describing the filesystem type and add support for mounting and formatting ext4 filesystems on EMMC. Change recovery to consistently use stdout for status messages instead of mixing stdout and stderr.
* | am 21b97ed5: Add __attribute__((format(printf, a, b))) to printf like functions.Nick Kralevich2010-06-251-1/+1
|\| | | | | | | | | | | | | Merge commit '21b97ed5693d039e8b9dea57a160d3307f412682' * commit '21b97ed5693d039e8b9dea57a160d3307f412682': Add __attribute__((format(printf, a, b))) to printf like functions.
| * Add __attribute__((format(printf, a, b))) to printf like functions.Nick Kralevich2010-06-251-1/+1
| | | | | | | | | | | | Fix potential string format bug. Change-Id: Ie05aac53b2c45a48bd68e340b76ccb21edfd28b7
* | support installing any .zip file on the sdcardDoug Zongker2010-04-081-1/+1
|/ | | | | | | | Replaces the "install sdcard:update zip" menu option with one that displays a menu of zip files (and subdirs) on the sdcard and lets you pick which one to install. Change-Id: I85c94c0e9bc8e05ca52031fc29ca2624c2695ced
* bump updater API version to 3; deprecate firmware update commandDoug Zongker2010-02-031-7/+0
| | | | | | | | | Remove support for the HTC-specific "firmware" update command and the corresponding edify function write_firmware_update(). This functionality is now done by an edify extension library that lives in vendor/htc. Change-Id: I80858951ff10ed8dfff98aefb796bef009e05efb
* reduce fraction of progress bar for verificationDoug Zongker2009-09-201-1/+1
| | | | | | | | | | Reduce the fraction of the progress bar used for package verification from 50% to 25%: - verification is faster than before due to sha1 improvements - in eclair we're now verifying the compressed data rather than decompressing it - incremental packages (which is what most installs use) write more data than is contained in the package.
* let the "firmware" command take the file straight from the packageDoug Zongker2009-06-181-0/+3
| | | | | | | | To do a firmware-install-on-reboot, the update binary tells recovery what file to install before rebooting. Let this file be specified as "PACKAGE:<foo>" to indicate taking the file out of the OTA package, avoiding an extra copy to /tmp. Bump the API version number to reflect this change.
* AI 144082: Remove the unused "unpacking" recovery icon.Doug Zongker2009-04-011-1/+0
| | | | Automated import of CL 144082
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-041-0/+94
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-041-94/+0
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-111-0/+12
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+82