summaryrefslogtreecommitdiffstats
path: root/twrp.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-08-24twrp: use ANDROID_ROOT environment variableCaptain Throwback1-1/+1
instead of hard-coded /system path I updated most of the references I found, but there might be more For devices that have to mount system at /system_root, this allows system to be bind mounted to /system and detected properly by TWRP Change-Id: I9f142fd8cec392f5b88e95476258dab9c21a9aac
2018-07-27Fix installing OTAs without decryptingEthan Yonker1-1/+1
Change-Id: Ica0c4033bc7148b1313b1671e91c5b92b09064c6
2018-07-20Remove SuperSUEthan Yonker1-18/+0
Change-Id: I2ca7580bbde5a8903b9ba5c1513ddba887e8d49e
2018-05-25Skip decryption when installing mapped zipsGabriele M1-5/+13
Decrypting userdata is not needed when installing zips if we have a map of blocks to read, so skip the decryption. This allows to install zips with no user interaction and, more importantly, it allows to install zips on devices where TWRP can't properly decrypt userdata. Remove also the unneeded Mount_All_Storage() call, Install_Command() already mounts the needed partition. Change-Id: I91c69f84ecc2fe41c9567c40649e501af1cfb64a
2018-03-09Don't rename twrp.fstab to recovery.fstabEthan Yonker1-10/+6
update_engine_sideload reads /etc/recovery.fstab during its install process and the twrp.fstab format may not be appropriate for what fs_mgr expects. Change-Id: I059ef22c0e862e60a3bffe5259f70c714fe33ec6
2017-11-27ADB Backup: add ability for TWRP GUI to restorebigbiff bigbiff1-0/+6
Restore adb backup files that TWRP made to your PC. Put files in your backup directory to see them. e.g. /sdcard/TWRP/BACKUPS/<sn> Change-Id: I2c57970d77b64c39a302159041456e761c185259
2017-02-24Tweak MTP startup routineMatt Mower1-11/+11
* As a precaution, (non-permanently) disable MTP if TWRP crashes. * Remove a duplicate logging of 'Starting MTP'. * Combine and improve readability of conditions before MTP starts. * Remove unnecessary Disable_MTP() call if conditions unsatisfied. Change-Id: I61ac772fc123da5b84c3061fbcf2116531bc4e2f
2017-02-24Fix handling of USB config during MTP switchingMatt Mower1-1/+0
The property set of sys.usb.config was not part of the original 'Only change USB mode to mtp when ready for MTP' commit. Further, it adds an additional USB off/on toggle to the MTP startup routine, potentially confusing the host computer. The default init.recovery.usb.rc already sets the usb functions to 'adb' during 'on fs'. It is possible that devices could run into issues with MTP startup due to sys.usb.config not yet being set. This is actually due to a poor design decision in Enable_MTP(), where sys.usb.config would not be configured for mtp if sys.usb.config had never been set. It is not necessary to check for a previous value, just set it. Fix the USB PID for adb-only mode in Disable_MTP(). Change-Id: I21b5e64c9bdcd3104372a8b4eb8ea50cf4561892
2017-02-23Do not unconditionally remove MTP storage on unmountMatt Mower1-7/+0
* It is not necessary to Remove_MTP_Storage() for a partition if an MTP_Storage_ID has not been assigned. * The hack to force-set tw_mtp_enabled=1 should no longer be necessary now that we're checking whether MTP really needs to be disabled for a volume before running Disable_MTP(). Change-Id: I1b7233eedd9da7c6be0c67fc60243f3837105173
2017-02-23Only change USB mode to mtp when ready for MTPMatt Mower1-2/+1
Commit 'Do not toggle USB ID during MTP startup if not needed' changed the default USB mode to 'mtp,adb'. Depending on the device, this can result in an unfortunate side effect of crashing an ORS sideload midway through the process (it's not clear to me whether the kernel or the connected computer is responsible). Only put USB into mtp mode when MTP storage is starting-up. The hack to change the USB mode to adb when a user compiles TWRP without MTP support is no longer necessary now that 'adb' is the startup mode. Change-Id: I8ed13d6ab8e85621533997b8c37ef7ebec0fcf85
2017-01-18bldrmsg: Only emmc /misc is supportedMatt Mower1-4/+2
Change-Id: Ic0716557a87ec0638e2dbed1c3f743231e8b2f8e
2017-01-18SELinux can be assumed for Android 4.4+Matt Mower1-7/+1
Change-Id: I7410a0c8e439eec90a955ee9201efd9a92bb9635
2017-01-18Unused variable cleanupMatt Mower1-1/+1
Change-Id: I2397d0bd221dcf5c9d0f971ba157519bcf014a70
2017-01-18Whitespace cleanupMatt Mower1-2/+2
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
2016-12-13Change handling of /cache due to AB devices not having cacheEthan Yonker1-2/+2
Change-Id: Ia9b97ed19eb3d400d9d399255108cac79361bca4
2016-11-30Improve backup & wipe exclusion handlingEthan Yonker1-7/+5
Rename twrpDU.* to exclude.* Remove global variable for du and replace with partition specific variables. Use separate exclusion lists for backups and wiping. Clean up some includes Fix some parenthesis in twrp.cpp that I messed up. Note: twrpTarMain command line utility compiles but probably does not work correctly yet due to not properly setting part_settings Change-Id: Idec9c3e6a8782ba53f3420fa79ba33394f4f85fb
2016-08-26Fix compatibility across the boardEthan Yonker1-0/+2
Change-Id: I6376920775ddabb4d4af505fffd86e404403a64a
2016-08-25Make it backwards compatible with 4.4Ethan Yonker1-1/+1
Change-Id: I668604cddc8e8afbf78709f3f872bea4e9f4aa06
2016-08-22Add git revision to startup message in recovery.logthat1-2/+2
This should make it easier to find the exact source for a specific version of the binary. Change-Id: I7e04dd9a3205cc643150a588b69b4bd691212ecb
2016-01-18Check sdk version for M before offering to rootEthan Yonker1-1/+7
Change-Id: I269618510d2e6e360c1e9f72ed371729a1f2a76b
2015-12-22Append AOSP recovery commands inlineEthan Yonker1-30/+17
Appending the AOSP recovery commands to the ORS command file as we process the commands will allow us to do things such as install multiple zip files, wipe cache, etc and do the actions in the order that those actions were originally requested. Change-Id: I375c1ccd3976123b818f1f492e971e615ec28c91
2015-12-19Multiple Language SupportEthan Yonker1-8/+13
This is similar to https://gerrit.omnirom.org/#/c/14014 A lot of the features built in the older patch set have been split out into separate patches, most of which have already been merged. The remaining functionality here should all be directly related to language selection and loading. We always load English as a base before loading other languages over the top of the base. The idea is that if another language is missing a translation, then we will still display the English. Maybe still to do: read the /cache/recovery/last_locale file and load a language based on that. For me, this file contains just: en_US We probably won't bother with region specific translations so we would have to look at either trimming off the _US or using some other method like perhaps a symlink or a combination of the two. Thanks to _that for twmsg.cpp class Change-Id: I9647a22e47883a3ddd2de1da51f64aab7c328f74
2015-12-02Fix short circuit on tw_mount_system_roMatt Mower1-1/+1
Before mounting /system to check if supersu should be installed (a feature which really needs to be stripped from TWRP), check if tw_mount_system_ro is set to zero, not the other way around. Change-Id: I38386b4c88fab112de5b6b752ecd4eed308efa5a
2015-11-05Treat /vendor like /system for read onlyEthan Yonker1-0/+5
The vendor partition is verity checked just like system so we should treat vendor as read only same as system. Change-Id: Ida65c9f44d8610e52fcdcef0b4a50faf5c7110d2
2015-10-14Fix minor interface bug: No-SU prompt after no-OS promptDavis Mosenkovs1-1/+1
When /system is wiped in TWRP and afterwards Reboot -> Recovery is selected the "No OS is installed, are you sure you want to reboot?" prompt appears. After swiping to "Reboot anyway" the "Current ROM is not rooted, do you wish to install SuperSU?" prompt appears. This change removes "Do you wish to install SuperSU" prompt after "No OS installed" prompt. Change-Id: Ie1157afdf5cf1cb81d6647269172d6e63af9f4b0
2015-08-26Fix up some TW_OEM_BUILD thingsEthan Yonker1-0/+4
Fix factory reset now properly formats data as expected Change text for ORS processing Disable system read only check, SuperSU, and patch system Stop copying fstab and version to cache Change-Id: I20f5cae390afbb8d2d88e01b8d9b9bf4ff0fdea1
2015-07-14Make system read only show no matter what on first TWRP bootEthan Yonker1-9/+8
Initial value for tw_mount_system_ro is now 2. If the value of tw_mount_system_ro is 2 during boot, then we will show the system read only prompt and ignore the value from the lifetime writes check. Note: Changed the value of FILE_VERSION which will trigger the data manager to throw out previous settings and start with default values so that existing TWRP users will get the prompt at least once. Change-Id: I447767b64617f855156a19a5dc15c4ece6dff7b8
2015-06-09Fix system read only behavior during bootEthan Yonker1-8/+14
Change-Id: I90dbdd06465e2ddaaade86b930beff91991432eb
2015-05-27Mount system as read-only by defaultEthan Yonker1-1/+15
Mounting system as rw can prevent future OTA updates. The purpose of this patch set is to prevent TWRP from mounting sytem as rw on the first boot. Device maintainers should update their twrp.fstab files on these devices to include an additional line: /system_image emmc /dev/block/../system This line will allow TWRP to create a raw system image backup to ensure that the user can return to an original state for future OTA updates. Change-Id: I8929d85bc3a5b96cc564bc7f734b58d5612ec833
2015-05-18bootloader: align with AOSP codethat1-4/+2
- Define a minimal Volume structure so that AOSP code for handling /misc works in TWRP without major changes. - Remove set/get_bootloader_message_*_name Change-Id: Ifcee59568141a184adebb94b8ef8beca072a7942
2015-03-25Fix reboot for some devicesEthan Yonker1-5/+0
Change-Id: I06caac2e80bd7eb311778796f974846e9ce844fa
2015-02-02Disable stock recovery replacing TWRP during ORSEthan Yonker1-5/+2
-Create a separate function to disable stock recovery flashing -Add a call to that function to the reboot section of the ORS action so that an OTA update will not inadvertantly replace TWRP Change-Id: I43eae81e0e76971b6e8d34c38785dc73772242d2
2015-01-22Hide some non critical error messagesEthan Yonker1-1/+1
Change-Id: I6e43242e44ce63cea9472c75a9f7fedf1b34fbbe
2015-01-22Move ORS command line into main threadEthan Yonker1-2/+2
Also eliminate the mostly similar runPage function in favor of using a single runPages function to avoid code duplication. Change-Id: I46ef414beb4009fee16d4de13d8a5ab2b9678409
2015-01-13Fix handling of custom themes after decryptEthan Yonker1-0/+3
Loading a custom theme from the decrypt action was preventing the runPage function from exiting. This moves the loading of a custom theme out of the action. Change-Id: I86904b63a67a25ded56e3e1e569fe906264dc055
2015-01-04fix adb sideloadthat1-1/+2
- "Cancel" button handling requires another thread - simplify handling of child pid - merge duplicated code for reinjecting TWRP after installation - fix error that showed on host PC after sideload finished - fix problem where adbd sometimes does not stop correctly Change-Id: I536877f024b606756c6a3289c6ddfdba423a60d6
2015-01-02Do not toggle USB ID during MTP startup if not neededEthan Yonker1-9/+6
In most cases MTP is enabled so it is better to start our init.rc with MTP enabled and try not to toggle USB IDs during TWRP boot so that we can keep adb running to make debugging easier. Change-Id: Idf122c5ad4deeef7e1ed775d495989c502ddfb19
2014-12-29Ingore SIGPIPE errorsEthan Yonker1-0/+3
If MTP exits unexpectedly, sending messages to add or remove a storage device via Add_Remove_MTP_Storage was causing a crash. Ignoring SIGPIPE allows us to more gracefully handle the error instead of a total crash of TWRP. Change-Id: I0a3f770f8b0f4bdbe10aa0ba857209b22b8668f7
2014-12-18Update SuperSU to 2.40Ethan Yonker1-4/+0
The SuperSU install process is getting rather complicated, so we will modify the install script slightly and use it to install all the things and stop trying to check to see if root permissions have been lost like we used to do. Change-Id: Ibdb64c909d2bd16e12bb35b4f31f572cc29add47
2014-12-12Attempt to set the proper uid/gid/contexts on new files and dirsEthan Yonker1-0/+7
Files and folders that we create during backups, copy log, or MTP operations often do not have the proper uid/gid/contexts assigned. We will attempt to read the proper contexts from the settings storage path and assign those same contexts to any files or dirs that we create. Change-Id: I769f9479854122b49b499de2175e6e2d026f8afd
2014-11-20Fix process to disable stock recovery flashingDees Troy1-1/+1
/system/etc/install-recovery.sh no longer exists on AOSP devices so we will stop checking for it. Change-Id: I9074dfc443371a27b909faa8f66998683cfb6171
2014-09-20Attempt to automatically identify data/media devicesEthan Yonker1-0/+5
Change-Id: Ia3007fbced9ce3bc94efdb3dacc582a5e68a49a4
2014-09-04Properly set mtp enable variable if disabled during bootEthan Yonker1-0/+1
Change-Id: Iedf08419a1fd46908e5b9186a769a0497ce62ca8
2014-09-04Prevent MTP enable on startup if crash detectedEthan Yonker1-8/+18
Change-Id: Ie1388a8acadf714a29721dd90c7f9a8aa38a860d
2014-09-03Ensure that MTP is enabled by defaultEthan Yonker1-0/+7
Change-Id: Ibd644509935cde1e52b3d368060fdcb6e16f4a99
2014-09-03add mtp responder to TWRP.bigbiff bigbiff1-0/+19
Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
2014-08-09Add command line capabilitiesEthan Yonker1-2/+0
Allows sending openrecoveryscript commands to TWRP via shell. This may be handy for visually impaired users, for various one click utilities to drive TWRP commands from a computer, for using TWRP when a catastrophic hardware failure like a shattered screen prevents you from being able to use touch, or even on devices like a TV stick where touch and USB mouse input is unavailable. This patch also includes a few minor changes to openrecoveryscript including proper support for rebooting via the script and for decrypting the device via the command line. Change-Id: I796ad168efdd2da9c25334ac93d1079daaa7b0bc
2014-07-25Only disable recovery flash if it is truly "stock" recoverydhacker291-1/+1
Some roms need the recovery-from-boot.p for auto update of recovery. Typically the use install-[romname]-recovery.sh. So only disable if install-recovery.sh is present. Change-Id: I01f89afc87b9d375d67b44b8b5e9228868a47d69
2014-07-09Check the crash counter instead of date in TWFunc::Fixup_Time_On_Boot()Vojtech Bocek1-1/+2
* Some devices (Sony) have RTC counting up from year 2009, Change-Id: I2cf1928e1b05c7e8b184963f8130582e0319ddc4 Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-07-09Change ro.twrp.boot boolean to twrp.crash_counterVojtech Bocek1-4/+11
Change-Id: If1ef25fee5a138a90ccb4f0a70b20b55698e0d0d Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-07-09Color in the consoleEthan Yonker1-2/+2
Allow each gui_print command to specify a color Change LOGERR to use the error color Theme should specify colors for error, warning, and highlight Change-Id: Ie8ece34111f604e25fcb79e5b731cd4e61038ff9
2014-03-11Run TWFunc::Fixup_Time_On_Boot() before OpenRecoveryScriptVojtech Bocek1-2/+4
* Fixes possible issues with names of backups made with ORS Change-Id: If8da1b3abb0960e527bb0eb3dd8a04d184aaea4d Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-02-04Load RTC offset on Qualcomm Krait chips, fixes the broken time & dateVojtech Bocek1-0/+3
Signed-off-by: Vojtech Bocek <vbocek@gmail.com> Change-Id: I04ad07f3e6be961003e063be8c648e191e2f9431
2013-12-19Improve SELinux support checkDees Troy1-1/+11
If the kernel does not use SELinux security then the ramdisk contents will not have contexts set on the files, however we may still have everything we need in recovery if the kernel supports EXT4 security labels, so we try to check /cache/recovery if it exists first. Change-Id: I96a4ae16418e07b0a2e83cd56e19893898d0b394
2013-12-19Create a TWRP Disk Usage Class to retain state about a directory and whether we should skip it in other classes like twrpTar.bigbiff bigbiff1-13/+14
Moved Get_Folder_Size to this new class. Change-Id: If0a0220f900eb109581f2eeaf7b76e3f7d6886f1
2013-11-26Add check during boot for SELinux supportDees Troy1-0/+12
Change-Id: Ib02867c403d1baa665dfb1d4f3137204e64a813c
2013-10-24Skip the = or \n before grabbing Zip_File.android-4.3Kevin Steck1-0/+3
Change-Id: I0454f8fc3cbe037fac63ef5861f8f373e4654d49
2013-10-23fix getting and setting contexts in selinuxbigbiff bigbiff1-1/+9
recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-10-22Skip the = or \n before grabbing Zip_File.Kevin Steck1-0/+3
Change-Id: I0454f8fc3cbe037fac63ef5861f8f373e4654d49
2013-10-17fix getting and setting contexts in selinuxbigbiff bigbiff1-1/+9
recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-09-12Add TWFunc::Exec_Cmd() with no 'result' agrumentVojtech Bocek1-3/+2
Signed-off-by: Vojtech Bocek <vbocek@gmail.com> Change-Id: Id8acff1ac9b3c7e4b562c80562a8ff42a1d132b9
2013-09-12Make fixing su perms automaticDees Troy1-5/+3
In 4.3+ with SELinux, su perms will be lost on every reboot so users will get the prompt to fix su perms in TWRP every time. Make fixing the su perms automatic instead of nagging the user. Change-Id: Ia8a2652018db5e1f6ffc5fec2a4ac0db3a8f32bb
2013-09-12Pull ROM info from build.prop for backup namesDees Troy1-1/+1
Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768
2013-08-29Use twrp.fstab if presentDees_Troy1-0/+8
2013-08-24Unify indentation and little clean-up in TWRP filesVojtech Bocek1-6/+6
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-24Add SELinux supportDees_Troy1-0/+16
Change-Id: I11e1a3d018d921d96ba08915925b14bf633be6ed
2013-04-08Fix handling of AOSP recovery commandsDees_Troy1-241/+252
2013-04-05Fix handling of subpartitionsDees_Troy1-1/+1
2013-04-04Move all AOSP code out of recovery binaryDees_Troy1-0/+241
Improves license compatibility between GPL and Apache Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0