summaryrefslogtreecommitdiffstats
path: root/partitionmanager.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2019-09-01Encryption: try wrapped key if the first time decryption failsbigbiff bigbiff1-1/+8
Change-Id: I108b7aeea41c6b85c851f40c1c4a7e25012e2463
2019-05-18Digest: Create digest for each subpartition and not just the first.bigbiff bigbiff1-0/+1
Change-Id: I408382e83aa0ac1106ff7198adf9787c0a0877cd
2019-05-16Add option to uninstall TWRP app from /systemEthan Yonker1-0/+1
Change-Id: Ibe372a372333c357810be2afcb3796723ca370cb
2019-05-16Flash both A/B partitions when flashing recovery ramdiskEthan Yonker1-0/+31
Change-Id: Ib4017943be91f6b2030094d73daa826a4a1555d4
2019-04-04Fix "Install Recovery Ramdisk" of a file which contains a space in the nameMauronofrio Matarrese1-1/+1
Change-Id: Ib2b1deee7427d9ac565676068b11982171f7a98d
2019-04-03Use magiskboot to repack the boot partitionEthan Yonker1-14/+176
Set TW_INCLUDE_REPACKTOOLS := true Must also have: AB_OTA_UPDATER := true Use magiskboot and provide GUI options to allow users to repack their existing boot image to install TWRP (or kernels) so we can stop having to provide installation zips for AB devices. There is also an option to try to fix a recovery bootloop if the kernel has been patched to always boot the ramdisk for root, etc. You will need to pull the below repo into external/magisk-prebuilt https://github.com/TeamWin/external_magisk-prebuilt Change-Id: I74196cc6f095a7576d61886dc96cbc18deba9b04
2019-04-03AB Cache dir: If device doesn't have /data/cache for FBE, we shouldbigbiff bigbiff1-1/+7
try /persist if in the fstab. Change-Id: I70dd19538b7f9b8cf61c46f6c8167057eec3342b
2019-04-02ADB Backup: Ignore creating backup folder for phonesbigbiff bigbiff1-4/+12
not decrypted. This allows you to continue without error. Also we should not set restore path for images in adb backup. Change-Id: Ia75a70377b8e1364fefc82ad41ccf74fa3b7a3c3
2019-03-21Fix the long broken format functiondianlujitao1-1/+1
* For EXT2/3: * Align mke2fs options with Android 9.0 fs_mgr_format.cpp. * For EXT4: * Note that make_ext4fs is still in use on Android 8.1 to workaround a FDE encryption bug even though mke2fs has become the default choice. The bug is fixed in Android 9.0+. * For F2FS: * Drop the broken "-r" option, it's never ported to O, explicitly pass number of sectors instead. * Keep all options aligned with Pie fs_mgr. * Check existence before start wiping, as Wipe_EXT4 does. * For all: * Calculate block size at runtime, and reserve the space specified via negative "length" option from fstab. Note that positive length will be ignored. * If the partition has crypto footer, and "length" is not specified in fstab, automatically reverse CRYPT_FOOTER_OFFSET (16384). * Remove the default crypto key location: footer, this is a bad assumption since most partitions don't use encryption! We need to know the real situation to decide whether to reserve crypto footer on format. * If the current action is "wipe" or "change filesystem", wipe crypto footer or block device after mkfs if the partition is unencrypted or undecrypted (e.g., wrong password). * If the current action is "format data", unconditionally wipe crypto footer or block device. Change-Id: I7304a8ee703131ea4a08ab7c60334af28cac28b3
2019-03-20Update FDE decrypt to pie from CAFEthan Yonker1-1/+1
cryptfs.cpp based on CAF tag LA.UM.7.3.r1-05900-sdm845.0 Used CAF because AOSP no longer contains code for qcom's hardware crypto. Change-Id: I921cbe9bed70989f91449e23b5ac3ec1037b7b97
2019-03-20MTP FFS updates:bigbiff bigbiff1-3/+10
This update splits old MTP code and new MTP code from Google into two trees, legacy and ffs. Depending on the SDK level, the build system will select the correct version. The reason for separating the versions out are due to older android trees not supporting the updated MTP code from Google. Most MTP code is from Google, with additions needed from implementing the Java functions in C++ for TWRP and FFS. We assume if you are in android-9.0 or above, your kernel has support for FFS over MTP. Verify that your init.rc is mounting the MTP FFS driver to the proper location. Change-Id: I4b107b239bd9bc5699527f9c8c77d9079f264a7e
2019-03-18AB/Non AB Devices: updates for moving cachebigbiff bigbiff1-7/+24
This patchset updates all the places we touch cache on AB devices and non AB devices so that we can write to the appropriate location. AB devices removed the cache partition and moved it to /data/cache. Change-Id: I485ec205a604f1f07ceb7700ae9c4e720fd55c3e
2019-01-17Add metadata decrypt support for FBEEthan Yonker1-0/+26
Change-Id: Ie0292f4ffea5993a4ae74fa04fc5c8252ca2cfcf
2018-08-24twrp: use ANDROID_ROOT environment variableCaptain Throwback1-3/+10
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-05-25partitionmanager: signal when Mount_To_Decrypt partitions are mountedoshmoun1-0/+2
Enable a property when mounting partitions required for decryption, and disable when they are unmounted. This helps init scripts to react to such an event appropriately, for example by starting services critical for decryption that reside on said partitions. Change-Id: Ib6fa1e5c903d9c800fb145d582ced6cc7e0ab5b9
2017-11-28vold_decrypt: FDE Keymaster 3.0 supportnkk711-0/+10
* HTC U11 Oreo is using keymaster3 FDE encryption which requires the new services: 1- /system/bin/hwservicemanager 2- /vendor/bin/hw/android.hardware.keymaster@3.0-service 3- /vendor/bin/qseecomd (instead of /system/bin/qseecomd) So in addition to /vendor/lib and /vendor/lib64 also symlink /system/vendor/bin to /vendor/bin. * vold_decrypt services now have separate prefixes: 1- 'sys_' referring to /system/bin 2- 'ven_' referring to /vendor/bin * The additional (hwservicemanager, keymaster-3-0) and modified (qseecomd) .rc files have been updated in the vold_decrypt directory. Comments were added directly in the .rc files, please check them. * /etc/recovery.fstab needs to be temporarily moved since vold will use it if it finds the '/sbin/recovery' file (refer to fs_mgr for the fstab load code https://goo.gl/8KaZyf). Since fs_mgr cannot parse TWRP style fstab, we 'hide' it and attempt to create a symlink to /fstab.{ro.hardware}. Also remove shell dependencies, code cleanup, new error codes: * Critical sections of vold_decrypt should not rely on the external shell (and the available binaries) provided by TWFunc::Exec_Cmd. Doing so may lead to failures resulting from different shell provided binaries not working properly, especially since busybox can be inconsistent across different trees. In particular the following functions have been changed: * run_vdc() no longer uses daisy chained commands, instead it now forks and executes vdc directly including a 30 second built in timeout. * Symlink_Firmware_Files() no longer relies on the shell 'find' command to retrieve the list of firmware/vendor files and instead uses a built in function, Find_Firmware_Files(), which traverses the system partition to retrieve the list of files. * The code has also been cleaned up a little for better consistency, and vold_decrypt will now return various error codes for the different failures, as defined in vold_decrypt.h, which allows the gui_msg to be moved back to partitionmanager.cpp. Notes regarding pre Android 8.0 builds: * Service names in .rc files cannot exceed 16 characters (including the prepended 'sys_' or 'ven_') in Android 7.1 and below, so a service name such as 'sys_hwservicemanager' is out of the question for 7.1 and below. * hwservicemanager will check ACLs on 'hwservicemanager' and 'ITokenManager' if they are even allowed to run, otherwise the interfaces will fail. The policies have only been introduced in 8.0, and although it is possible to manually add them to the 7.1 policies it's not recommended. * Therefore the best course of action is to build in 8.0. * SIDE NOTE: On the HTC U11 we are actually using omni-7.1 with some changes in the device tree to support both Nougat and Oreo decryption, please refer to: 1- https://gerrit.twrp.me/c/2756/ for the necessary sepolicy and BoardConfig changes. 2- The Android.mk file for vold_decrypt was modified to truncate greater than 16 character service names (as mentioned therein) Other changes: * TW_CRYPTO_SYSTEM_VOLD_DISABLE_TIMEOUT is now deprecated due to built- in fork and timeout. * Output_dmesg_to_recovery_log() is also deprecated so upon a failed decryption the recovery.log will no longer append it, instead you can just use 'adb shell dmesg' to check it. Nonetheless if a true debug build is needed use the original TW_CRYPTO_SYSTEM_VOLD_DEBUG flag as outlined in the original commit message (see below). Usage info: This is an update to the initial vold_decrypt, for more info refer to https://github.com/omnirom/android_bootable_recovery/commit/71c6c50d0da1f32dd18a749797e88de2358c5ba1 Change-Id: Id7129d125ae7f5dcba0779489825add718022ba3
2017-11-28FBE for Pixel 2Ethan Yonker1-2/+4
Includes various minor fixes for building in Android 8 trees with r23+ tag Update FBE extended header in libtar to version 2 and include the entire ext4_encryption_policy structure now after translating the policy. See this post for more details: https://plus.google.com/u/1/+DeesTroy/posts/i33ygUi7tiu Change-Id: I2af981e51f459b17fcd895fb8c2d3f6c8200e24b
2017-11-28Support v2 fstab formatEthan Yonker1-19/+344
Auto detect and support both the v1 and v2 fstab formats Support putting TWRP style flags in a separate /etc/twrp.flags file twrp.flags format is the same as twrp.fstab (v1 with TWRP flags) Support using a wildcard in a block device and find all partitions: /usb-otg vfat /dev/block/sda* Support using sysfs entries (voldmanaged) and read uevents and scan for wildcard partitions from uevent data. (twvold?) May not be complete for some of the newer flags found in fstabs in newer build trees and there is a slim chance of a crash if the user removes a removable device while TWRP is performing actions. May need to add some kind of mutex to prevent the 2 threads from causing this crash. We need to start somewhere though and this change is pretty innocuous when not using a v2 fstab. Change-Id: I617d97c7db332cbe671a9d2b8ad98b3d9c4f03cc
2017-11-27ADB Backup: add ability for TWRP GUI to restorebigbiff bigbiff1-82/+109
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-11-17Fix 'No OS' on System_Image restore after wipenkk711-0/+1
* When you format the system partition, it will remain in a mounted state. * Subsequently restoring a system_image (even though successfully) the Update_System_Details() function will not correctly update the system partition details. * Reproducible by: 1- Advanced wipe: System 2- Restore: System_Image 3- Reboot -> No OS prompt * eg: [ ~ # twrp get tw_min_system tw_min_system = 50 ~ # twrp get tw_backup_system_size tw_backup_system_size = 8 ~ # mount -o ro /system ~ # du -sh /system 3.5G /system ] Change-Id: I99f75274816788dd38eccdd387f7ac691e1f3fab
2017-07-06backup: fix return handling when no digest is being createdEthan Yonker1-22/+14
If the user selects to skip digest creation, Backup_Partition always returned false. This patch fixes this problem and somewhat cleans up the error handling. Change-Id: I1db0e285cd5ed2bd93756cd27c6f56b8415ffa86
2017-06-17twrpDigest refactorbigbiff bigbiff1-83/+42
This patch is to refactor twrpDigest using polymorphism and inheritance to use the same call patterns for creating and reading a digest. Now a library. Use SHA2 from libcrypto. SHA2 is default if device has libcrypto. Change string MD5 everywhere to use digest or Digest instead. Updated string tags to digest. Translation will be required. Switch out digest code into a driver class from partitionmanager. SHA2 is better for digest creation due to decreased collision space compared to MD5 and SHA1. See https://en.wikipedia.org/wiki/SHA-2 Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f
2017-06-04Improve decrypted partition loggingnkk711-3/+4
* Partition information should be updated after successful decryption (both userdata and adopted) and then logged * Fix adopted storage nickname being "" Change-Id: Idcdab84f339e932e62880089bad36e206920dd70
2017-04-23ADB Backup: fix adb restore issuesbigbiff bigbiff1-0/+4
Set Backup_FileName on adb backup to fix restore. Set read_from_adb after EOF to return properly from newer adb client prompt. Create setter and getter for Backup_FileName for openrecoveryscript.cpp which is not a friend class. Fix condition for twrpTar::Get_Size() and adb backup. Change-Id: I7eb8168fa3416366b996e220cecbc0e1bcec5e8e
2017-03-06crypto: Use system's vold for decryptionnkk711-0/+9
If TWRP crypto fails to decrypt partition, mount the system partition and use system's own vold to attempt decryption. This provides a fallback for proprietary OEM encryption as well as encryption methods which TWRP hasn't been updated for. Requirements in device tree: * fstab.{ro.hardware} in device/recovery/root The fstab does not need to be complete, but it does need the data partition and the encryption entries. * 'TW_CRYPTO_USE_SYSTEM_VOLD := true' in BoardConfig or * 'TW_CRYPTO_USE_SYSTEM_VOLD := <list of services>' Notes: * Setting the flag to 'true' will just use system's vdc+vold or * Setting the flag with additional services, will also start them prior to attempting vdc+vold decryption, eg: for qualcomm based devices you usually need 'TW_CRYPTO_USE_SYSTEM_VOLD := qseecomd' * For each service listed an additional import will be automatically added to the vold_decrypt.rc file in the form of init.recovery.vold_decrypt.{service}.rc You will need to add any not already existing .rc files in your device/recovery/root folder. * The service names specified in the vold_decrypt.{service}.rc files have to be named 'sys_{service}' eg: 'service sys_qseecomd /system/bin/qseecomd' * Any service already existing in TWRP as {service} or sbin{service} will be stopped and restarted as needed. * You can override the default init.recovery.vold_decrypt.rc file(s) by placing same named ones in your device/recovery/root folder. If you do, you'll need to manually add the needed imports. * If /vendor and /firmware folders are temporarily moved and symlinked to the folders and files in the system partition, the properties 'vold_decrypt.symlinked_vendor' and 'vold_decrypt.symlinked_firmware' will be set to 1. This allows for additional control in the .rc files for any extra actions (symlinks, cp files, etc) that may be needed for decryption by using: on property:vold_decrypt.symlinked_vendor=1 and/or on property:vold_decrypt.symlinked_firmware=1 triggers. Debug mode: 'TW_CRYPTO_SYSTEM_VOLD_DEBUG := true' in BoardConfig * Specifying this flag, will enable strace on init and vdc, which will create separate log files in /tmp for every process created, allowing for detailed analysis of which services and files are being accessed. * Note that enabling strace will expose the password in the logs!! * You need to manually add strace to your build. Thanks to @Captain_Throwback for co-authoring and testing. Tested successfully on HTC devices: M8 (KK through MM), M9 (MM and N), A9 (N), 10 (N), Bolt (N), Desire 626s (MM), U Ultra (N) HTC One X9 (MTK device) And by Nikolay Jeliazkov on: Xiaomi Mi Max Change-Id: I4d22ab55baf6a2a50adde2e4c1c510c142714227
2017-03-01Timeout for decryptEthan Yonker1-3/+20
Sometimes, usually because of proprietary binaries related to keymaster, decrypt will hang waiting for the keymaster to initialize forever. This patch enables a timeout so that we don't get stuck trying to decrypt forever. A timeout is especially important when dealing with the default password because the user has no option to cancel when TWRP tries to decrypt. NOTE: This patch only adds a timeout for FDE. FBE will require some special handling because we need access to some static data and that data is not available across a fork. Special thanks to nkk71 for cleaning up some issues in my patch set. Change-Id: Iccf2fe769ac27a7dcd6bfebfe7d2e9eddd034308
2017-02-24Tweak MTP startup routineMatt Mower1-3/+1
* 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-4/+4
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-16Partition: Remove unused has_data_media variableMatt Mower1-2/+0
Change-Id: Ic1a3aa2b57db5539ce6f6740a63bfe6d33890d70
2017-02-08Improve backup display names with emulated storageEthan Yonker1-4/+22
-Change backup display name to say that we are excluding storage -Add warning message during backup of any partition with data media -Also eliminate unused variable from twrpTar class Maybe this will make the people in issue 276 happy, but probably not because they already lost their data, or because the warning text is yellow instead of red. https://github.com/TeamWin/Team-Win-Recovery-Project/issues/276 Change-Id: I98303fe7f6b7a25fea029637c90145258d41ee46
2017-01-18Restore TW_BACKUP_AVG_IMG_RATE handlingMatt Mower1-0/+1
Preserving the average BPS across partitions appears to have been wiped out by the adb backup patch set. Restore it. Change-Id: Id05c12ff61260b642ee7acd979132a2cba026d87
2017-01-18SELinux can be assumed for Android 4.4+Matt Mower1-5/+0
Change-Id: I7410a0c8e439eec90a955ee9201efd9a92bb9635
2017-01-18Do not disable performance mode too early for backupMatt Mower1-2/+2
Include SetPerformanceMode(false) just before every "return", and not sooner. Change-Id: Iefd5546865347dbd08cc9baeb98d58d26b7f4a3b
2017-01-18Unused variable cleanupMatt Mower1-12/+8
Change-Id: I2397d0bd221dcf5c9d0f971ba157519bcf014a70
2017-01-18Very minor code cleanupMatt Mower1-4/+2
Change-Id: Ie0b97da2cce7bb93307ed49b1138bc2f36df34d0
2017-01-18Whitespace cleanupMatt Mower1-7/+3
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
2016-12-13Change handling of /cache due to AB devices not having cacheEthan Yonker1-13/+13
Change-Id: Ia9b97ed19eb3d400d9d399255108cac79361bca4
2016-12-13Support File Based EncryptionEthan Yonker1-32/+73
Change-Id: Ib688ddd0c32d3999590cacd86b6d9b18eac336e9
2016-12-13Add boot slot supportEthan Yonker1-1/+63
Change-Id: I7eaf80e327985f53791f90fbdebad022a9650d31
2016-11-30Improve backup & wipe exclusion handlingEthan Yonker1-4/+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-11-30Fix image flashingEthan Yonker1-9/+18
PS2: full_filename is not a dir PS3: use a consistent format of always assuming directory is missing the trailing / + fix whitespace alignment Change-Id: Ib963473ae10571b3d069b326d024ca04c7224dda (cherry picked from commit fa4ff144374474c541351d153549ad11d4396614)
2016-09-13Clean up PartitionSettingsEthan Yonker1-25/+20
The PartitionSettings struct contains some data elements that are duplicates of data elements in the TWPartition class that is contained within the PartitionsSettings.Part element. We will eliminate this duplication to help reduce the chances for programming bugs. Specifically, this fixes problems where the current file system does not match the backed up file system. Change-Id: I02f236e72093362050556a2e53a09d1dbb9a269d
2016-09-02Fix restore of subpartitionsEthan Yonker1-1/+2
Change-Id: If76cd08cdac7e2af4e0f5f00d420eed1f30897d3
2016-08-31MD5 checking: fix issues introduced with adb backup patchsetbigbiff bigbiff1-13/+22
This patchset will fix issues with creating and checking md5 checksums with single partitions and subpartitions. Change-Id: Iddfaf46412e95635af958094726cf9e3eb5a4cc8
2016-08-19Finish creating disable_free_space_check variableMatt Mower1-1/+1
* Create data manager variable for 'tw_disable_free_space' * Make configurable through Settings * Fix the "two presses needed to enable" issue for the checkbox on the backup screen * No need to capitalize every word, but do specify precedes backup Change-Id: Id436cef13e4ca9349618420aac03862ec4e3c35e
2016-08-19Allow running of a custom script after factory resetEthan Yonker1-0/+1
Change-Id: I33e6d72bf93103052551f33da51ba4af9a5f88c9
2016-08-09Fix md5 creation from adb backup patch.bigbiff bigbiff1-8/+8
Change-Id: Id90da89c4eb50ed695a88f29859d1276ed8d032b
2016-08-04Add typecode to sgdisk for proper detection in AndroidCaptain Throwback1-1/+1
- Fixes the "Unsupported SD Card" error when partitioning w/TWRP PS2: Use hex code instead of GUID to make code more succinct Update typecode for Linux swap to be consistent PS3: Revert PS2 changes Change-Id: I5aec780aa4dfb7bd9025ae8cbceda13bfaaa0b03
2016-08-01ADB: Add adb backup for TWRP.bigbiff1-104/+178
Functionality for client side to backup tar and image streams over adbd to the client under backup.ab. Using adb backup on the client side you can backup the partitions TWRP knows about. On the client side you can do the following: adb backup -f <filename> --twrp <options> where options are --compress: compress data system: backup system cache: backup cache data: backup data boot: backup boot etc for each partition. You can string multiple options, i.e. adb backup -f <filename> --twrp --compress cache system data adb backup in TWRP will take any option corresponding to TWRP fstab partitions, e.g. efs boot as well. If you do not specify the filename with the -f option, adb will backup your data to a filename backup.ab on the client. You can then rename the file and encrypt it with desktop tools. If you don't want to use command line arguments: adb backup --twrp will bring up the gui and allow you to choose partitions from the backup page. To restore the backup use the following convention: adb restore <filename> Structures are used to store metadata in binary inside of the file itself. If the metadata structure is modified, update the adb version so that it will invalidate older backups and not cause issues on restore. When restoring, we currently do not support picking specific partitions. It's all or nothing. Change-Id: Idb92c37fc9801dc8d89ed2a4570e9d12e76facf8
2016-05-03Wait to mount until after fstab processedMatt Mower1-18/+23
The necessity to process fstab twice stems from mounting partitions while still processing. Instead, wait to finish setup of /data, /cache and storage parameters until after fstab has been processed (once). Change-Id: Id77e1edbab5eb68a7cd4a1f34953d819a043d47a
2016-05-03Remove char/string conversions in fstab processingMatt Mower1-4/+4
There a few char->string conversions between functions which handle different parts of fstab line processing, but there are no uses of string functions. Pass char arrays/pointers around instead. Change-Id: I976a9a54ee8dcfb6194cadcac6a34e467602003b
2016-05-03Rewrite FS fstab flag processingMatt Mower1-1/+1
* If 'ro' fsflag detected, set Mount_Read_Only = true * Only output human readable Mount_Options to log * Match fsflags identically (not just first n chars) since there are no fs_flags which take arguments * Match new processing method introduced in TW fstab flag processing Change-Id: Iefdb76016be90a131b0d627d0cd3f18d2eb1a008
2016-04-02Really remove all old SP* flags and codeEthan Yonker1-36/+0
Change-Id: I5ece02a8721e1b7541fb5182366a55fd0f037a7a
2016-03-31Improve progress bar handling for backup / restore / image flashEthan Yonker1-34/+22
The progress bar will now be updated during image backups, restores and during image flashing (except for sparse images which will require significant changes to libsparse, and except for mtd nand using flash_utils). The progress bar will now be updated mid-file for file systems (tar) so the user will see changes even during large file backup / restore. Add a new progress tracking class to simplify handling of progress bar updates. The class will only update the progress bar 5 times a second to reduce the CPU load from updating the GUI frequently which does affect backup times. Change-Id: Iff382faef3df1f86604af336c1a8ce8993cd12c5
2016-03-31DataManager UpdatesEthan Yonker1-1/+0
The goal of this change is to make DataManager use InfoManager to reduce code duplication. Change-Id: Ia4f4c4324453a192995e0f442db0a03628c13e46
2016-03-03Don't add subpartitions to restore listJames Christopher Adduono1-1/+2
Their parents will take care of them. Good parents. Fixes double restoration of subpartitions when they are also set to backup in the recovery fstab. Change-Id: I876c179135e0cb00754e9a8cfc8eac164c4b7fd4
2016-02-24partitions: Fix path based Find_Next_StorageMatt Mower1-1/+1
If a path is specified for Find_Next_Storage() and datamedia is excluded, the function currently runs to the end of available partitions and reports no other storage is available. Fix this by restoring the original mount_point == search_path check to break the loop. The subsequent partitions loop will skip data-media storage as needed. Change-Id: I92baed866cd36f13d851bd58ba5346e47edb142e
2016-02-18Fix adopted storage when andsec flag is presentEthan Yonker1-0/+13
Change-Id: If903d838abc920f952f243482338188c15bb1dbf
2016-02-05partitions: Avoid duplicate UMS mountsMatt Mower1-1/+1
If a device has several LUN but only one storage volume TWRP recognizes (e.g. lun0 for microsd and lun1 for emulated cdrom), then avoid mounting the same partition twice by checking the mount point. Change-Id: Ie23b88acca1818873792e9f65b73b125a15e4a5d
2016-02-05gui: add german translationz31s1g1-1/+1
also correct typo in all language files also remove dummy language files for ES and FI german translation was done on omni crowdin by multiple translators: https://crowdin.com/project/OmniROM/de# result was updated in line with latest changes (as of 02032016) to en.xml Change-Id: Iddd8dbee7e050833a4dc61174288514d408267f7 Signed-off-by: z31s1g <z31s1g@googlemail.com>
2016-01-29Replace fix permissions with fix contexts for emulated storageEthan Yonker1-17/+16
Fix permissions rarely fixed anything on more recent versions of Android and usually made things worse. Instead we will replace it with a more dumbed down option that should fix contexts on /data/media with a few improvements to ensure that contexts get fixed for multiple users and on adopted storage. Change-Id: If5523781936a0b04196e2ad871cae767ebae2583
2016-01-25Adopted Storage supportEthan Yonker1-12/+120
-Detects, decrypts, and mounts an adopted SD card if a secondary block device is defined (usually mmcblk1) -Handles unified storage -Displays the adopted storage in MTP along with internal -Factory Reset - wiped just like a data media device, we retain the keys folder and the storage.xml during a factory reset -Backup / Restore -Disable mass storage when adopted storage is present -Read storage nickname from storage.xml and apply it to display names in the GUI -Read storage.xml and determine what storage location is in use for /sdcard and remap accordingly libgpt_twrp is source code mostly kanged from an efimanager project. It is GPL v2 or higher, so we will opt for GPL v3. Change-Id: Ieda0030bec5155ba8d2b9167dc0016cebbf39d55
2016-01-22Fix (Auto Generate) handling for backup namesEthan Yonker1-3/+3
Change-Id: I29f3823d03c005fb55a0e0a98818d40bd1eb039d
2016-01-22Fix a bunch of messagesMatt Mower1-5/+5
* Find and rename/remove duplicate string variable names * Add missing string variables to en language file * Fix display of some strings missing @ in front of variable name * Fix several %s --> {1} * Be consistent in usage of cancelled vs. canceled (both spellings acceptable) Tip for finding strings missing from language files: 1) Find all messages: egrep -hr "gui_msg.+=" > /tmp/msgs.txt 2) Regex replace to trim them down WHAT: ^\s+gui_msg(?:[^"]+)"([a-zA-Z0-9_]+)=([^"]+).+ WITH: $1 Note that $2 can be used to retain the message 3) Find missing strings: for i in $(cat /tmp/msgs.txt); do if ! grep -q $i gui/theme/common/languages/en.xml; then echo $i; fi done Change-Id: Ic193162e4b5468bf027472928a370be39840ea1d
2016-01-18Improve flash image handling of mountingEthan Yonker1-2/+9
Flashing an image does not always require storage to be mounted. Change-Id: I9d2a69cee9053f7829e51486d727e2e0b522c5da
2016-01-14Improve sdcard partitioning processEthan Yonker1-75/+90
-Improve code for partitioning sdcards -Allow user to select a device for partitioning (must be removable) -Use sgdisk to partition sdcards -Set default sizes for ext and swap to 0 -Change increments for ext to 256MB and swap to 64MB Note: sgdisk is included in 6.0. I have included a static prebuilt sgdisk for trees that do not have sgdisk, however the prebuilt sgdisk is a decent bit larger than the old parted binary. The old parted binary is quite old at this point and we only have it for armv7a. sgdisk should be maintained by AOSP and can be built from source so it should work across architectures. Change-Id: Ib80882d9b5776e5e9358b11340fba392e6f1ae09
2016-01-04Generate new format /etc/fstabdianlujitao1-1/+1
* Toybox's mount can't work with the old-fashioned fstab. * Busybox mount is compatible with the new one. Change-Id: I16b7d6424a4424c2a92d82846a706733bf58f8e1 Signed-off-by: dianlujitao <dianlujitao@gmail.com>
2015-12-22Remove dead code: TW_HAS_DUAL_STORAGEMatt Mower1-28/+2
Nothing sets TW_HAS_DUAL_STORAGE. Remove this dead code. Change-Id: Id5d10c9ee3883dad6beef69e09d16b0f1350c91d
2015-12-21Fix gui_msg %s to {1} callEthan Yonker1-1/+1
Change-Id: I39f032e0cad5d482d11e0e8d1c4c7c3e7ec6d041
2015-12-19Multiple Language SupportEthan Yonker1-104/+153
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-11-05Minor update to decrypt device routine for Nexus 6P decryptEthan Yonker1-3/+8
Move property setting of ro.crypto.state to after mounting any needed partitions so that we can use this property as a trigger for running services in init. Check to see if the property is already set so that we do not set it and sleep multiple times if the user enters an incorrect password. Change-Id: I55558c5e227377381101b6305569d9eb31040790
2015-10-15Properly set sys.usb.config when ums is enabled.HandyMenny1-0/+2
Use sys.usb.config also for ums, but leave sys.storage.ums.enabled for compatibility with custom init.rc that use it. PS2: Rebased - moved updates to init.recovery.usb.rc Change-Id: Iad3441d23ac37612e58f63e4038d05c5c1a37b25
2015-08-26Fix up some TW_OEM_BUILD thingsEthan Yonker1-2/+11
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-06-17partition: recreate tw_internal_path(/data/media/0), after wipe media from data or format /data.xiaolu1-10/+1
Change-Id: I3671d7a5759260a4e74952168483a6816eb28f5d
2015-05-28Add resize2fs and ability to run resize2fs via GUIEthan Yonker1-0/+28
Note: Only works on ext2/3/4 partitions. Only tested on ext4. We can use this in some cases to resize the data partition if an incorrect fstab caused recovery to not reserve the 16KB for a crypto footer. Sometimes the BoardConfig for a custom ROM does not have the correct size for the system partition and if the ROM flashes a raw system image, that image will not take up the full block device. Running resize2fs can fix the size and may allow more room in the system partition for customizations like busybox or a larger gapps package. Sometimes flashing a factory image may flash userdata with an image with a file system that does not take up the full size of the block device (e.g. factory images for the Nexus 6 will flash userdata with a ~24GB userdata image, wasting ~30GB of space). Using resize2fs we can easily fix this issue without having to do a full format data. Change-Id: I631f5c6f567bbc6a9241e5dd95f1e435820a1b13
2015-05-27Mount system as read-only by defaultEthan Yonker1-1/+5
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-19partitionmanager: remove broken and unused progress calculation codethat1-28/+3
img_bps and file_bps were uninitialized (the values are only calculated at the end of the backup), and occasionally could be 0. Don't divide by zero, it's bad for the program's health. Change-Id: I3f6f5a144c24f32508ca25de49491261c7f6e674
2015-03-05Address a few compiler warningsMatt Mower1-2/+2
Change-Id: I6e063fba8d58c8c53da6bca6292c84e3392aee50
2015-02-23Theme: Add ability to disable size checking before backupbigbiff1-5/+46
(for compressed backup users with low space). Clean up backup folder and copy only recovery.log for debugging. Conflicts: gui/devices/watch/res/watch.xml Change-Id: If8aa3580dbc082d0fe4882d4af8dc3cdb362a8b5
2015-02-02MTP: make MTP work even if unplugged and repluggedEthan Yonker1-24/+26
Set up a loop to keep trying to open / read the MTP device so that MTP will work even if the device is unplugged during boot or unplugged and replugged in. Change-Id: I0d3a3b7c91ce84a8cbed16caa4b15efee35b3641
2015-01-27Add cancel backup capability.bigbiff1-3/+33
This will stop the iteration of the partition objects, kill the current twrpTar thread and remove the backup directory. Implement TWAtomicInt class to give us a wrapper that automatically uses mutexes before the read and write to help ensure that the reads and writes will be atomic based on documentation. Change-Id: I645b22bc980a292e9c7202acb24ffd22ebe68c63
2015-01-22Hide some non critical error messagesEthan Yonker1-8/+8
Change-Id: I6e43242e44ce63cea9472c75a9f7fedf1b34fbbe
2015-01-09Allow flashing of images via the GUIEthan Yonker1-0/+63
- Use the Images... button in the lower right of the zip install page - Unify image flashing functions between restore and image flash - boot and recovery partitions are flashable by default - use fstab flag flashimg=1 or 0 to override defaults - file system partitions are currently not flashable Change-Id: I822dc446030543c55d2153e219d67a1292374ffc
2015-01-02Do not toggle USB ID during MTP startup if not neededEthan Yonker1-24/+31
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-29Move sleep during MTP startup to MTP threadEthan Yonker1-1/+0
Some devices are very slow to respond to the sysfs requests. To prevent delaying the main GUI from booting during TWRP startup, we move the sleep delay to just before we open the MTP device and into the MTP thread so that it does not hold up the main TWRP thread. Change-Id: Ic931ef317d0fb7ef4dfdef46a32f68a014ff62c0
2014-12-29Check for valid MTP_Storage_ID before adding or removingEthan Yonker1-0/+2
Attempting to add a storage ID of 0 was causing a seg fault. Change-Id: If8797186405be36ee70dbca63bd1063a62ba2812
2014-12-22Fix else if and maxFileSize initializer.bigbiff1-1/+1
Change-Id: Iac7852a4fb2add5744d5ea424d6ad5a82828f102
2014-12-22fixPermissions: simplify code, fix bugsthat1-0/+4
- avoid parsing permission strings - fix memory leaks, a fix new/free mismatch and a compiler warning - fix that only first updated-package was processed - fix a potential stack overflow if packages.xml is huge - minor refactoring for reducing duplicated code - don't process packages without codePath - fix path for deleting app data (currently unused anyway) - fix file ownership on libs - try not to mess up Android 5.0 app permissions Patch set 4 - make fixing SELinux contexts an option with a check box - add some notes / text to the themes Patch set 6 - decouple "fix permissions" from "fix contexts" Change-Id: Icc77ecc581befc5ce6e419b1f3b8ca189208c234
2014-12-19MTP add/remove storage instead of disabling MTPEthan Yonker1-15/+148
Implement a pipe between TWRP and MTP to allow TWRP to tell MTP to remove storage partitions as they become unavailable (e.g. during a wipe, unmount, etc) instead of disabling MTP completely. This includes some fixes and improvements in destructors to properly remove / delete various items. This also means that we will not be toggling adb off and on quite as often. I do not like that we had to add another thread, but we were unable to use select() on the mtp_usb character device because this device does not support polling. Select always returned indicating that the mtp file descriptor was ready to be read and the resulting read would block. The read block prevented us from being able to include reading of the pipe between TWRP and MTP in the main MTP thread. We might want to add a return pipe letting TWRP know if the removal of the storage device was successful, but I am not sure how we want to implement this. It would invovle timeouts in both TWRP and MTP to ensure that we returned a failure indicator in a timely manner to TWRP and prevent deleting the storage device in the case of a failure. Right now we make no attempt to ensure that an MTP operation is underway like a large file transfer, but we were not doing anything like this in the past. In some respects we have limited control over what happens. If the user installs a zip that unmounts a storage partition, we will not know about the change in storage status anyway. Regular Android does not have these troubles because partitions rarely get unmounted like in recovery. At some point, we have to hold the user accountable for performing actions that may remove a storage partition while they are using MTP anyway. Ideally we do not want to toggle the USB IDs and thus toggle adb off and on during early boot, but I am not sure what the best way to handle that at this time. Change-Id: I9343e5396bf6023d3b994de1bf01ed91d129bc14
2014-12-12Attempt to set the proper uid/gid/contexts on new files and dirsEthan Yonker1-0/+2
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-12-12Revert "Fix USB Mass Storage on some devices"Matt Mower1-3/+1
This reverts commit 9eb1cd47520498e181a2d9fb2f3b464ae5327bd8. Change-Id: I66d3d6bb5633e6df3e8f7db250fc6d62817a5489
2014-12-12This fixes kernel panic on find7 when disabling MTP before flashing zips.bigbiff1-0/+1
Change-Id: Id11a0fb1a88424d9dd70190c313781607bad3bb8
2014-12-10Fix occasional MTP kernel panicEthan Yonker1-0/+1
Add a short sleep between setting up the sysfs entries for MTP and actually sending MTP data to the MTP device. In some cases a kernel panic was happening because we were sending data too soon. Change-Id: Ie5e05690846fc84f161c91829de448bc049f87e2
2014-12-04add function to partition.cpp to return max file size to mtp responderbigbiff1-1/+1
Change-Id: If8114b5eac741db6c512fb35cb48e3825c2ff098
2014-12-04Reduce libs needed for decrypt and clean up old decypt filesEthan Yonker1-85/+19
Trim cryptfs.c to remove functions that TWRP does not use for decrypt and remove the need for libfs_mgr from cryptfs.c by passing some items to cryptfs.c from the partition manager. Add support for new fstab flags: encryptable and forceencrypt=/path/to/cryptokey For example: flags=forceencrypt=/dev/block/platform/sdhci-tegra.3/by-name/MD1 Note that "footer" is the default, so you do not need to set this flag on devices that use the footer for the crypto key. Also add mounttodecrypt if you need to mount a partition during the decrypt cycle for firmware of proprietary libs. Clean up decrypt and only support one version Android 5.0 lollipop decrypt should be backwards compatible with older versions so we will only support one version, 1.3 that came with 5.0 lollipop. Remove support for Samsung TouchWiz decrypt. It does not work with the latest versions of Samsung encryption anyway and it has not been updated to work with any AOSP decryption higher than 1.1 Change-Id: I2d9c6e31df50268c91ee642c2fa090f901d9d5c9
2014-11-20Properly set tw_settings_path after decrypt on data media devicesEthan Yonker1-0/+1
When tw_settings_path is not set correctly for /data/media/0 when present, custom themes will not load (and who knows what else may also be broken) so set it properly after decrypting the device. Change-Id: Id3dff04f62cf9c953c8a2ca07fe9ac597dcda20f
2014-11-19Add /firmware to the mount list for L decryptEthan Yonker1-0/+1
Needed by Nexus 6 and possibly others Change-Id: I3309e2141a21a94dce90e34cced16450b591a92c
2014-11-18Tweak 5.0 L decryptEthan Yonker1-0/+21
Mount the vendor partition if it exists so we can use any proprietary files we may need. Relocate auto decrypt when default_password is in use to after all partitions are added so that we can mount the vendor partition. Change-Id: I93455a35695779f53ef57a82d3d45c7216c13639
2014-11-12Add lollipop decrypt supportEthan Yonker1-1/+3
Kang in cryptfs.c and cryptfs.h from vold. Use TW_INCLUDE_L_CRYPTO := true to enable. Ramdisk must contain the normal fstab file in the root in the usual format of: fstab.{ro.hardware} For examble for Nexus 5: fstab.hammerhead Or on many Qualcomm devices: fstab.qcom Tested against Android 5.0 lollipop on Nexus 7 2012 grouper. Not sure if or how this will work when we are dealing with a device with a hardware keystore. Long term we need to add a GUI element to allow entering a pattern. For now you can decrypt a pattern unlock by converting the dots to numbers in the following format: 123 456 789 So an upper-case L would translate to 14789 as a password entered on the keyboard. Change-Id: I02c29e1f1c2eb29bf002c9fe0fc118357300b5b3
2014-11-04Fix USB Mass Storage on some devicesEthan Yonker1-1/+3
On some devices we need to set the sys.storage.ums_enabled property before we write to the lun file. Also sleep for a bit after setting the propery before writing to the lun file. Change-Id: I77ac853fde14ffc3adf20571c132f91ed85196df
2014-11-04add "done" after "Updating partition details..."that1-0/+1
This addresses a usability problem. Some users are confused when they switch to the console and see this message, thinking they have to wait. Examples: http://forum.xda-developers.com/showthread.php?t=2498492 http://androidforums.com/verizon-galaxy-s3-all-things-root/718376-twrp-recovery-update-question.html Change-Id: Ib44773998c2ef1b8b821f3b8876218e11a7de357
2014-11-04partitionmanager: remove unused By_Block and By_Name methodsthat1-253/+0
Change-Id: Ia6eefd23f6671428221e35642f01534bc9fff6ad
2014-10-08performance profile supportTom Hite1-5/+21
Many device trees support the recovery.perf.mode property to set various core frequencies and online/offline mode. TWRP is highly threaded, and support for multiple cores on many operations dramatically recudes the time, e.g., backups, zip flashes, etc. p2: removed user notifications Change-Id: I957b8ca40b241c0af0471327eeb329cce1816017
2014-10-08mtp: cleanup, fixes and performance improvementsthat1-7/+6
- use std::map instead of linked list - read directories on demand - fix writing zip files to storage root - fix creating directories - lots of minor fixes - simplify generation of storage IDs and make them spec compliant Change-Id: I2137c27549ddbdc58466f2e3aeda464fac70a3c5
2014-09-20Attempt to automatically identify data/media devicesEthan Yonker1-10/+21
Change-Id: Ia3007fbced9ce3bc94efdb3dacc582a5e68a49a4
2014-09-15Additional checks to prevent partitioning internal storageEthan Yonker1-1/+1
Change-Id: I9fcd7e0169fbdd52405c0c86aafbef091f69411e
2014-09-11Fix handling of MTP fork/child processEthan Yonker1-1/+6
Change-Id: Iacd8a38d21e9c8b0dfafefbeb646f46cd3ba02a1
2014-09-05MTP: Use fork instead of pthreadEthan Yonker1-7/+12
Change-Id: I95cf6f4def0c86f40c775738f0712323f0a0f146
2014-09-03Allow toggle of MTP debugEthan Yonker1-1/+4
Via command line in TWRP: twrp set tw_mtp_debug 1 This will enable debugging for MTP. You will need to disable and re-enable MTP in order to see the debug logging. Change-Id: Ia7bb0c584e10a4322b65ecf80a67ed7ee836b38e
2014-09-03add mtp responder to TWRP.bigbiff bigbiff1-11/+104
Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
2014-07-09Track backup and restore progressEthan Yonker1-9/+26
Track backup and restore progress based on the sizes of the files as they are being added to the tar backup file. Update the progress bar based on the sizes of the files. Change-Id: Idf649efa1db3e91830b4b2add86203a3f30042ff
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-06-04Whitespace and minor code cleanupMatt Mower1-16/+16
This is by no means comprehensive, but is quite a bit better already. Change-Id: Ibc8654a5dfb0eec39cbd0b64bdb52bb4fbfe2f7e
2014-06-04Add options to repair or change file systemEthan Yonker1-0/+135
Change-Id: I9043e98e1e1ed4722f05c13a60b43d2d0bf739f6
2014-05-31Fix crash while loading config due to incorrect tw_storage_pathVojtech Bocek1-0/+16
Change-Id: Ia5957efe616defa4272501cd8f31d26d394077bb Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-05-31Fix multiple lun file USB mountingMatt Mower1-2/+2
Both the incorrect mount point and the incorrect lun file were being passed as the second storage volume. Change-Id: If9c7d92d1992ec022a2c89a82b2ea05c9150d635
2014-04-16Only setup settings,andsec partitions if availableMatt Mower1-4/+7
Change-Id: Iafedcec9e6ba368e29e32ab7a92d774cdd3f64e1
2014-04-16Support alternative .android_secure locationMatt Mower1-3/+20
Some devices (jewel, m8) have .android_secure at a non-standard location. Allow a different partition to be specified as the home of .android_secure using the fstab flag 'andsec'. Using the /data/media variant of jewel as an example, recovery.fstab or twrp.fstab could be edited like follows: /external_sd vfat /dev/block/mmcblk1p1 flags=display="MicroSD";andsec Note, this is NOT a method to move .android_secure in your ROM. Your ROM must already write to this alternative location. Change-Id: I3a6e4e63aaddb35870b79e80938b0f9c2c902443
2014-04-02Fix display of .android_secure size in BackupMatt Mower1-1/+1
Setup_Settings_Storage_Partition() needs to be called before Update_System_Details() in order for the /and-sec mount point to be setup and size read correctly. Change-Id: Id5394c90b6d095027c1b852764676dc6080a871d
2014-04-01Improve USB Storage handlingEthan Yonker1-30/+61
Change-Id: I5743d9b967a8227c4bb87da01a9c67c574bf9876
2014-03-30if md5 check is not selected for subpartitions, don't check it.bigbiff bigbiff1-1/+1
Change-Id: I7248c75f17c6f82e098831c297c0662ef6ea289f
2014-03-19Re-arrange handling of settings storage partitionDees Troy1-7/+7
Sometimes we received an error about being unable to locate storage partition because the DataManager would attempt to access the PartitionManager before we finished adding the storage partitions to the vector. Change-Id: I0ce1778938d308b1eb17de46a192ecd52489cad3
2014-03-13Improve handling of settings storage and android secureEthan Yonker1-13/+12
Change-Id: I8af92543c2f0c201e7220267c417d74e4561038d
2014-02-28Restore capabilities to run-as binaryDees Troy1-1/+1
Change-Id: I9e2b8e9b69c94b94c57143c04b950530490ec33e
2014-02-26Check crypto footer before offering to decryptEthan Yonker1-3/+3
Verify that we have a valid footer with proper magic before setting things up for decryption to help prevent user confusion when dealing with data partitions that fail to mount. Also check to make sure that the block device for /data is present. Change-Id: Ie87818fe4505a8bf71df7d3934c114e7328ef3ca
2014-02-12Allow recovery to be restored if backup=1 flag is present in recovery.fstabbigbiff bigbiff1-1/+1
Change-Id: I426c8da8ae586004011ec4a103e1d7a1f23b3599
2014-02-03Improve android secure handlingEthan Yonker1-0/+3
Change-Id: I9e1c7f4a8353b7be51e1a54bf5d506c9dce70da2
2014-01-23Fix include of cutilsDees Troy1-1/+4
Change-Id: I9868298908ce501d3043326862057e8a637544af
2014-01-21Fix handling of storage after decryptionDees Troy1-2/+1
Change-Id: I0c2614f841a225699be9d4a52c60e9456241659b
2014-01-21Set listener properties for UMS mount/unmountMatt Mower1-0/+2
Some kernels require the usb functions be defined before UMS mounting of storage partitions will work. This sets the sys.storage.ums_enabled property upon mount/unmount which can be listened for in init.rc. Example routines to include in init.rc: on property:sys.storage.ums_enabled=1 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/functions adb,mass_storage write /sys/class/android_usb/android0/enable 1 on property:sys.storage.ums_enabled=0 write /sys/class/android_usb/android0/enable 0 write /sys/class/android_usb/android0/functions adb write /sys/class/android_usb/android0/enable ${service.adb.root} Change-Id: I8a8ad4b392abbaa173d402714bcb4049ba84ccca
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-1/+5
Moved Get_Folder_Size to this new class. Change-Id: If0a0220f900eb109581f2eeaf7b76e3f7d6886f1
2013-12-19add support for fsflags= option in twrp.fstab fileHashcode1-0/+2
example userdata line (as needed by MotoX): /data f2fs /dev/block/platform/msm_sdcc.1/by-name/userdata flags=fsflags="inline_xattr" Code for parsing flags/options originally based on AOSP fs_mgr sources. Change-Id: I5fb2b5d5cdd08137e6bf71f0085a3f8aebd889a8
2013-10-24Update licenses to all matchDees Troy1-21/+17
Change-Id: I3be70a897e563658736b2dec3a9ea2697b69b225
2013-10-23fix getting and setting contexts in selinuxbigbiff bigbiff1-1/+0
recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-10-22Update licenses to all matchDees Troy1-21/+17
2013-10-17fix getting and setting contexts in selinuxbigbiff bigbiff1-1/+0
recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-09-12Add TWFunc::Exec_Cmd() with no 'result' agrumentVojtech Bocek1-7/+7
Signed-off-by: Vojtech Bocek <vbocek@gmail.com> Change-Id: Id8acff1ac9b3c7e4b562c80562a8ff42a1d132b9
2013-09-12Pull ROM info from build.prop for backup namesDees Troy1-4/+5
Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768
2013-08-30implement "usermrf" fstab flag to force rm -rf * deletion on specific partitionsHashcode1-0/+2
Change-Id: I58f4a8cedf31e6b6efd88f96a43ed525603ae311
2013-08-24Unify indentation and little clean-up in TWRP filesVojtech Bocek1-8/+8
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-23Fix AOSP decrypt when TouchWiz code is presentDees_Troy1-0/+1
2013-08-14Fix problem with not waiting for pigz to exitDees_Troy1-0/+2
In some cases compressed backups would not wait for pigz to finish leading to backup files that were 0 bytes or MD5 mismatches.
2013-07-032.6.0.0Dees_Troy1-1/+23
Also copy recovery.fstab to cache and create a storage.fstab in cache for app/apk use.
2013-07-01Fix backup of datadataDees_Troy1-3/+4
Change-Id: Ib0098542599283787592ba08caa070dc818d6111
2013-07-01Fix some issues with wipe partition listDees_Troy1-0/+11
Change-Id: Ie7d5878faf86b8fa824b72211be7fd3596b471d7
2013-06-22Support encrypted backup filesDees_Troy1-12/+30
Also includes features merged from: Update twrpTar by kokotas Revised function entryExists(). Added function to get archive's uncompressed size. Added option to exclude item(s) from the archive. Revised forks() http://review.teamw.in/#/c/590/ Change-Id: I01fa2c81643161984eff2625247af75990684bd9
2013-04-08Improve backup list resultsDees_Troy1-3/+13
2013-04-05Fix handling of subpartitionsDees_Troy1-8/+8
2013-04-04Move all AOSP code out of recovery binaryDees_Troy1-163/+140
Improves license compatibility between GPL and Apache Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
2013-03-30Add partition list GUI elementDees_Troy1-390/+249
Add partition list GUI element and update backup, restore, mount, storage selection, and wipe sections of GUI and partition manager code to reflect the new GUI element. Update ORS engine to handle new backup and restore setup. Fix a bug with decrypt. Add 1080x1920 layout. Change-Id: Iaa2f44cb707167e66f935452f076ba00e68a2aa4
2013-03-17trying to fix md5bigbiff bigbiff1-5/+1
Change-Id: I4ec037f76aa965bc818afe924942adbe9a080b36
2013-03-07use md5.c for computation of md5sumsbigbiff bigbiff1-13/+24
create a framework for computing digests and reading digests in TWRP add space for backwards compatibility with bb md5sum Change-Id: Ia18e3f430eed5eba22e5052d39b9b8d88ecd4536
2013-02-19support devices without bootpartitionChampionSwimmer1-0/+4
if device has no /boot partition, then add the following flag in BoardConfig.mk TW_HAS_NO_BOOT_PARTITION Signed-off-by: ChampionSwimmer <android@championswimmer.tk> Change-Id: I92b36b2e6ca690e2422b36004ae9bb315d24a7c2
2013-02-19convert file_bps to be unsigned long longbigbiff bigbiff1-5/+8
Change-Id: Ib5d9ca8f9a2a4e27d9798665b312376a7d9c571c
2013-02-01Fix fail over to vfat from exfatDees_Troy1-5/+5
Fix issues with MD5 checking using chdir and leaving the working dir in a subfolder that prevented unmounting sometimes. Change-Id: I01a563d722f474297ed3f7a30064c3a61748ade3
2013-01-24Disable USB Mass Storage if the USB lun file does not exist.Dees_Troy1-4/+0
Change-Id: I185edb4538fa84c17fc2b9a803557bb7a622f880
2013-01-18Move backup folder creation to after free space calcDees_Troy1-8/+8
Also fix free space calculation
2013-01-17ORS engine fixesDees_Troy1-28/+29
Fix backup to not error when a non-existant partition is given. Fix restore to run when no partition parameters are given. Ensure that ORS runs after decryption and that zips install. Fix a problem with the fake internal sdcard not mounting to /sdcard on data media devices.
2013-01-15Add flag for retaining layout versionDees_Troy1-0/+2
Needed on Sony mint (Xperia T) as the /data/media folder is a separate partition and normal data media wiping is not appropriate for this device but the layout version file needs to be retained for Android 4.2 multi-user.
2013-01-14Check to ensure that external is encryptedDees_Troy1-0/+7
2013-01-10More Samsung sdcard crypto fixesDees_Troy1-1/+1
2013-01-10Fix ifdefs for Samsung encryptionDees_Troy1-0/+4
2013-01-09Improve remounting sdcard with ecryptfsDees_Troy1-5/+12
2013-01-09Add libtar to TWRP instead of using busybox tarbigbiff bigbiff1-31/+42
Add proper mkdosfs tool Add fuse to TWRP Add experimental exfat-fuse to TWRP Convert all system() functions to use new Exec_Cmd function
2013-01-08Add Samsung TouchWiz decryptiona39552691-1/+52
Change-Id: I418680e59372160dabfe3e2d5f0208229aa151ae
2012-12-21Improve handling of undecrypted encrypted /dataGary Peck1-0/+3
- Until the encrypted partition is decrypted, treat it as a disk image instead of a filesystem so that it is properly backed up using dd. - Make Partition::Wipe() use the filesystem from fstab for disk images so that wiping an undecrypted /data makes it a plain unencrypted partition again. Change-Id: I78db977d6348cfa66b0cfbc492fb5776f84db48d
2012-12-12Add ignore blkid flag for TransformersDees_Troy1-0/+2
Change-Id: I8f2b5b68a8c3ede74858d53002efab997174ee65
2012-11-22print partition details independent of whether its mountableGary Peck1-61/+61
Change-Id: Ibbc3bf3d3264fb9852f8312ece0567950aace496
2012-11-15Fixes for multi-user in 4.2Dees_Troy1-0/+9
Also fixed inability to delete backups with a space in the name. Change-Id: I2f6639d33caa3c4542960f76adbd59b25ab64f5d
2012-10-20Unmount main partitions after fixing permissionsDees_Troy1-0/+1
2012-10-15Update and improve USB storage codeDees_Troy1-82/+39
2012-10-14Handle single lun file for USB storageDees_Troy1-34/+60
2012-10-13Fix problem with sizes of images after reset defaultDees_Troy1-0/+37
2012-10-12Unmount main partitions after USB storage disableDees_Troy1-0/+1
2012-10-12Unmount system after boot, backup, and restoreDees_Troy1-0/+19
2012-10-10redo fix permissions in c++ for faster changesbigbiff bigbiff1-1/+18
2012-09-27Update sdcard partitioning to C++Dees_Troy1-0/+144
2012-09-27Port backup name checking to Partition ManagerDees_Troy1-1/+53
2012-09-27Handle mountable boot partitionsDees_Troy1-1/+9
2012-09-26Add option to wipe android secureDees_Troy1-0/+20
2012-09-26Fix permissions updatesDees_Troy1-13/+0
Also redirect stderr output on terminal commands for display in GUI console
2012-09-26Fix problems with MTD devicesDees_Troy1-2/+5
Also improve handling of MTD names
2012-09-26Unify portrait layouts againDees_Troy1-0/+3
2012-09-24Fix skip MD5 setting during backupDees_Troy1-4/+6
2012-09-21Add progress bar support to backup and restoreDees_Troy1-25/+89
2012-09-21Fix special partition handlingDees_Troy1-17/+38
2012-09-21Add android_secure supportDees_Troy1-20/+35
2012-09-20Various fixesDees_Troy1-3/+1
Modify AOSP mount and wipe functions to use Partition Manager. Update wipe code to reset the log file index when wiping cache. Add ADB sideload to 540x960 theme.
2012-09-20Fix fstab and unmount problemsDees_Troy1-1/+5
Fix a problem parsing some recovery.fstab files. Fixed a problem with MD5 checking that prevented unmounting after md5 checking.
2012-09-20Add and improve OpenRecoveryScript supportDees_Troy1-0/+9
Improve zip finding in ORS engine Add support for restoring with just a backup name
2012-09-18Cleanup extra-functionsDees_Troy1-20/+287
2012-09-18Improve backup and restoreDees_Troy1-177/+160
Add in archive splitting support
2012-09-17Update backup and restore code, adb sideloadDees_Troy1-22/+449
Fixed a problem with using make_ext4fs by making its lib a dynamic lib. Added ADB sideload zip install feature - no way to cancel it yet. Improve backup and restore code.
2012-09-14Add wipe functions, compiles in CM7, text shows in UI, zips installDees_Troy1-30/+126
Zip install works, had to move mincrypt code into TWRP to prevent a crash when checking the zip signature. Added wipe functions Made it compile in CM7 Made text show up in console and logging
2012-09-12Make text appear in GUI console, Zip install works.Dees_Troy1-2/+2
Move TW zip install code to C++ so that it can use the ui->functions. Bring in mincrypt code to fix a crash during signature checking.
2012-09-11Zip install works againDees_Troy1-4/+4
2012-09-10More Partition Manager functionalityDees_Troy1-13/+277
2012-09-10Improve storage size code, mount, unmountDees_Troy1-50/+192
Add flag parsing from recovery.fstab
2012-09-07Add processing of fstab, mounting, and decryptDees_Troy1-16/+190
2012-09-05TWRP-ify AOSP codeDees_Troy1-0/+147
Pull in most TWRP sources Stub out partition management code Make it compile -- probably will not boot Kind of a mess but have to start somewhere