summaryrefslogtreecommitdiffstats
path: root/partition.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* wait for cryptfs device node to come upKjell Braden2016-08-221-5/+6
| | | | | | | | | | | this is to prevent a race condition to occur when mounting an adopted storage volume just after it was decrypted. After setting up the decrypted volume using cryptfs_setup_ext_volume(), Decrypt_Adopted() immediately calls Mount(), which will call Check_FS_Type(), which will fail in blkid_new_probe_from_filename, as the device node was not created yet. Change-Id: Ic5a274c2066ab278c9b7f1c8b83b820e552ca344
* ADB: Add adb backup for TWRP.bigbiff2016-08-011-101/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Wait to mount until after fstab processedMatt Mower2016-05-031-52/+78
| | | | | | | | 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
* Remove char/string conversions in fstab processingMatt Mower2016-05-031-7/+7
| | | | | | | | 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
* Rewrite FS fstab flag processingMatt Mower2016-05-031-25/+28
| | | | | | | | | | * 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
* Rewrite TWRP fstab flag processingMatt Mower2016-05-031-162/+258
| | | | | | | | | | * Do not flip/flop between std::string and char* when no std::string specific functions are applied. * Remove the need to manually count flag string lengths * Move checks for Display_Name, Storage_Name, and Backup_Display_Name out of flag processing Change-Id: I24d432c222124012b2a98d27598e42d0944f7da2
* Partition: Fix parsing of several twrp fstab flagsGordon Freeman2016-04-281-10/+15
| | | | | | | | fix parsing when using storagename=, backupname= and userdataencryptbackup= in twrp.fstab also split encryptable= and forceencrypt= into seperate blocks and make storage=Y working Change-Id: I674f7ffe7f9e4ff121c4dccf79096360e044535c
* Improve progress bar handling for backup / restore / image flashEthan Yonker2016-03-311-91/+140
| | | | | | | | | | | | | | | | | 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
* DataManager UpdatesEthan Yonker2016-03-311-1/+0
| | | | | | | The goal of this change is to make DataManager use InfoManager to reduce code duplication. Change-Id: Ia4f4c4324453a192995e0f442db0a03628c13e46
* Allow restoring to read-only file systemJames Christopher Adduono2016-03-291-1/+39
| | | | | | | | | | | | | | This allows the restoration of firmware or modems on read-only mounted file systems. If the user is able to make a backup of these partitions, it would only make sense they be allowed to restore that backup. The current handling is dangerous in that it happily wipes, but refuses to restore. :) Note that it would be preferable to use the backup=emmc flag instead in most cases, added by change: https://gerrit.omnirom.org/#/c/17183 Change-Id: I32d47c8928dee61595c15a9db16d3c5b9a6d7183
* Change to dd for wiping crypto partitionsEthan Yonker2016-03-171-2/+6
| | | | | | | flash_image was spitting an error. We are also specifying a size so that we do not risk writing beyond the partition. Change-Id: Ie3a0d77db96e54357238595934c3df0e3b680823
* Fix adopted storage when andsec flag is presentEthan Yonker2016-02-181-0/+11
| | | | Change-Id: If903d838abc920f952f243482338188c15bb1dbf
* partitions: Mount storage for MTP after wipeMatt Mower2016-02-051-3/+3
| | | | | | | | | | | | | | Conditionally run Add_MTP_Storage() after wipe if: 1) is wiped successfully 2) is storage (already implemented) 3) mount succeeds Previous to this commit, Add_MTP_Storage() was called before mounting storage, which fails. Mounting storage right after wipe should not be a problem since Update_System_Details() does it anyways (and doesn't complain if already mounted). Change-Id: I8a5a78d5ac9181f3a9464dfe6b77284458f9868b
* allow flashing sparse imagesHashBang2016-02-031-3/+21
| | | | | | | | | | if the image has the right magic bytes to be a sparse image, use simg2img to flash the image create a rule to make a fully dynamic simg2img which results in a much smaller increase in gzip ramdisk size (2KB vs 40KB) Change-Id: I1b0f6bc127da46103888b1154a9bddd8ac02c01d
* partition.cpp: fix build, add missing includethat2016-01-291-0/+1
| | | | Change-Id: I5b4c3b90d579573536e9de2df5127160cdc9a10f
* Replace fix permissions with fix contexts for emulated storageEthan Yonker2016-01-291-1/+0
| | | | | | | | | | 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
* Reduce format f2fs timeGreg Wallace2016-01-291-1/+1
| | | | | | | | | | | Secure block discard/trim was fixed by: https://github.com/CyanogenMod/android_external_f2fs-tools/commit/6b39b93d83ab4ccb1913ecbc7a5a3e16766a011f Once fixed, formatting using discard/trim takes a LONG time. Other TWRP formatting methods are already insecure. It doesn't make sense for this one type of partition to have secure wipe when none of the others do. Change-Id: Ib5ad5a722895b0e0c7aa4e3af98b705e2574b762
* Adopted Storage supportEthan Yonker2016-01-251-36/+201
| | | | | | | | | | | | | | | | | | | | | -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
* Fix a bunch of messagesMatt Mower2016-01-221-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
* Improve sdcard partitioning processEthan Yonker2016-01-141-16/+2
| | | | | | | | | | | | | | | | | -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
* gui: Fix partition repair messageGreg Wallace2016-01-041-5/+5
| | | | | | | The message was named something non-existent. Fix the spelling error and add the default message into the language files. Change-Id: I4e9e10d2705b1edf75b185d3badba59eb86ffb8b
* gui: Fix typo of formatting_using messageGreg Wallace2016-01-041-8/+8
| | | | Change-Id: I6df4937658815350366ed3dd2cf92156f98c96c4
* ntfs-3g: Fix cm-13 compatibilityGreg Wallace2016-01-041-21/+39
| | | | | | | | | | | CM-13 tree completely changes the names of the binaries that are created for ntfs-3g. If we are using a CM-13 tree (CM SDK 4) make sure the dependencies and relinking are adjusted accordingly. Also, adapt partition code so it can make use of whichever set of binaries are present. Change-Id: I810caafa818f18281fd29dcf8f31b3053133b5ed
* Use ioctl to get block device sizeEthan Yonker2015-12-191-15/+29
| | | | | | | | | | AMLogic based device uses paths like /dev/block/recovery and the stock init binary either deletes or does not create mmcblk0p12 which breaks TWRP because TWRP cannot match up the path / name. The ioctl method is probably more reliable anyway and certainly should be faster. Change-Id: I73f981dcec637cdf5b189bdefa00ea15b924b500
* Multiple Language SupportEthan Yonker2015-12-191-92/+96
| | | | | | | | | | | | | | | | | | | | | | | 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
* Fix broken fsflags supportKetut Putu Kumajaya2015-11-261-1/+1
| | | | | | | | | Process_FS_Flags Flags parameter is just a copy not a reference, not get updated, Mount_Flags always 0 - fix it now. Thanks to SHM @ XDA-Developers Change-Id: Ib044db905febfedefee493cfc04fd1cad6f61f8e
* Update dosfstoolsMatt Mower2015-11-261-8/+8
| | | | | | | | | | | | | * Version 3.0.28 * Update filenames in source * Remove unnecessary symlink to fsck * Commit "Recode short filenames from DOS codepage (default 437)." has been reverted since we do not have access to iconv * Commits cherry-picked on top of 3.0.28: - mkfs.fat: fix incorrect int type - Prevent out of bound array read in date_dos2unix() Change-Id: I50310235c62ec2e6bc90afcd10f2814d3afb5113
* Free some memory allocationsMatt Mower2015-11-121-0/+1
| | | | Change-Id: Ifb6c186e43e1eb068e8075def16924ced04bb23d
* Treat /vendor like /system for read onlyEthan Yonker2015-11-051-0/+10
| | | | | | | The vendor partition is verity checked just like system so we should treat vendor as read only same as system. Change-Id: Ida65c9f44d8610e52fcdcef0b4a50faf5c7110d2
* Fix a bunch of warningsEthan Yonker2015-10-251-1/+0
| | | | | | Mostly adding __unused where needed. Change-Id: Ia4f675b9b360782728c361ed1699db0cc277c3a5
* Wipe crypto key when formatting dataEthan Yonker2015-08-091-0/+42
| | | | Change-Id: I032fabb383b4063e3b31b6044ce39966b8c617d0
* Add ntfs-3g supportEthan Yonker2015-07-141-0/+60
| | | | | | | Add support for mounting ntfs via ntfs-3g and support for wiping and repairing ntfs partitions. Change-Id: I82dc4626f459bb93b86eb9ebba64ad3a6560781b
* fix settingsstorage markXuefer2015-06-181-0/+1
| | | | Change-Id: I60755ca66f048d1484c3d55dc60099679ba987f6
* partition: recreate tw_internal_path(/data/media/0), after wipe media from data or format /data.xiaolu2015-06-171-5/+12
| | | | Change-Id: I3671d7a5759260a4e74952168483a6816eb28f5d
* Add resize2fs and ability to run resize2fs via GUIEthan Yonker2015-05-281-2/+75
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Mount system as read-only by defaultEthan Yonker2015-05-271-4/+52
| | | | | | | | | | | | | | 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
* partition: support texfat modulethat2015-05-191-1/+9
| | | | Change-Id: I21d0498fc16fdb29d09d6e6fe715e57d1f35e72b
* Backup: fix 'out of memory' issue when backing up large partition as imagecodelover2015-05-191-6/+15
| | | | | | | | | Restore: improve image restoration speed * Workaround for devices that need to backup partition as image, eg: dm-verity * Increased block size used for partition restore, now using 8M instead of 4K Change-Id: Ie7e7ff3283d71a7e459d76f72caea9f57e71c628
* Support Qualcomm hardware decryptDees Troy2015-05-151-0/+1
| | | | Change-Id: I121ef0f5da209be48f6d87559d539c7fc6d85336
* Fix TWRP not mounting /data/media type storage if built with toolbox utilscodelover2015-03-191-1/+1
| | | | | | | | | * ONLY Applicable when building with 'TW_USE_TOOLBOX := true' * toolbox's 'mount' expects the first argument to be a block device, but /data/media is a dir. * Technically we don't 'mount' a dir to another, we 'bind' it instead. * So we define the mount option explicitly with '-o bind'. (supported by busybox 'mount' too) Change-Id: If97c9096167fb723150b949f4336005b3313a174
* Add UI for entering pattern for device decryptionVojtech Bocek2015-03-131-0/+1
| | | | | Change-Id: Ia2d3268a96423e9ca3846500c57e674c4f8fa60b Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
* Address a few compiler warningsMatt Mower2015-03-051-1/+1
| | | | Change-Id: I6e063fba8d58c8c53da6bca6292c84e3392aee50
* Allow wiping f2fs to reserve space for a crypto footerdhacker292015-02-021-1/+12
| | | | | | | | We will convert a -16384 to 16384 if needed because mkfs.f2fs does not like negative numbers like make_ext4fs does. Also enable trim by default on f2fs. Change-Id: I8b41e65d1ff894433665c65d0569a51803c67891
* Add cancel backup capability.bigbiff2015-01-271-5/+6
| | | | | | | | | | | 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
* Fix restore of images for mtd and bml nandEthan Yonker2015-01-091-3/+1
| | | | Change-Id: I843ddf7a5bca3ca7670dd6f19644b37cf017e5b1
* Allow flashing of images via the GUIEthan Yonker2015-01-091-44/+79
| | | | | | | | | | | - 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
* Update blkid to 2.25.0bigbiff2015-01-051-1/+2
| | | | | | | | Break libblkid into 4 libraries: libblkid, libuuid, libutil-linux and libfdisk. This should help in later patch updates. Change-Id: I680d9a7feb031e5c29a603e9c58aff4b65826262
* Fix else if and maxFileSize initializer.bigbiff2014-12-221-13/+12
| | | | Change-Id: Iac7852a4fb2add5744d5ea424d6ad5a82828f102
* fixPermissions: simplify code, fix bugsthat2014-12-221-7/+6
| | | | | | | | | | | | | | | | | | | | | | | - 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
* Allow non datamedia devices to wipe encryptionEthan Yonker2014-12-211-0/+10
| | | | | | | | | | | | | With 5.0 L, we decrypt automatically if the default_password is used. Non datamedia devices do not get the format data button so they cannot wipe encryption off the device. This patch add a wipe encryption button where the format data button would normally be located on the Wipe page. This patch also attempts to remove / delete the dm-crypt block device before formatting. Change-Id: I100d5d154d6c49254fd48e23279df973db5f23ae
* MTP add/remove storage instead of disabling MTPEthan Yonker2014-12-191-12/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Attempt to set the proper uid/gid/contexts on new files and dirsEthan Yonker2014-12-121-0/+3
| | | | | | | | | | 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
* Fix png graphics load / display on AArch64Ethan Yonker2014-12-091-1/+1
| | | | | | | | | This is mostly kang from AOSP resources.c for loading png files into RAM, but for ease of compatibility we retained the older gr_surface data types throughout and ensured that we retain support for alpha blended png files. Change-Id: Ieea552173d3bfe885460407be73088bbad75663f
* add function to partition.cpp to return max file size to mtp responderbigbiff2014-12-041-0/+25
| | | | Change-Id: If8114b5eac741db6c512fb35cb48e3825c2ff098
* Reduce libs needed for decrypt and clean up old decypt filesEthan Yonker2014-12-041-77/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Tweak 5.0 L decryptEthan Yonker2014-11-181-15/+0
| | | | | | | | | 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
* Add lollipop decrypt supportEthan Yonker2014-11-121-1/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | 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
* fix some compiler warningsthat2014-11-041-3/+3
| | | | Change-Id: I23c490e6228b0fcf656c76ac314c69508ba2329d
* Do not set contexts during a factory resetEthan Yonker2014-10-201-6/+2
| | | | | | | | We should not need to set or change the contexts of the media folder when doing a factory reset. We should only do this when we need to recreate the media folder. Change-Id: I9f9918743d687b0aa0eb1e50747677f883037047
* Fix wiping crash when block device is not presentEthan Yonker2014-10-141-0/+5
| | | | | | | | Especially with /sd-ext, trying to wipe when the device is not present causes a seg fault in the make_ext4fs function. Check to make sure that the block device is present before trying to wipe. Change-Id: I91973b5b832c9edbce81d61a271e84363c19e6c5
* mtp: cleanup, fixes and performance improvementsthat2014-10-081-13/+3
| | | | | | | | | | | - 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
* Attempt to fix md5 issue with backupsCaptain Throwback2014-10-081-0/+2
| | | | | | thanks @bigbiff for the suggestion Change-Id: Ie9b55537b7fa300461b015d2b9523d4250e755a9
* Attempt to automatically identify data/media devicesEthan Yonker2014-09-201-27/+35
| | | | Change-Id: Ia3007fbced9ce3bc94efdb3dacc582a5e68a49a4
* add mtp responder to TWRP.bigbiff bigbiff2014-09-031-6/+28
| | | | | | Big thanks to Dees_Troy for helping with the implementation. Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
* Track backup and restore progressEthan Yonker2014-07-091-22/+82
| | | | | | | | 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
* Do not restore file system on data/media devicesEthan Yonker2014-06-131-3/+17
| | | | Change-Id: I600e7e9ce89621400531bceb472387aafc0d6ed8
* Whitespace and minor code cleanupMatt Mower2014-06-041-4/+4
| | | | | | This is by no means comprehensive, but is quite a bit better already. Change-Id: Ibc8654a5dfb0eec39cbd0b64bdb52bb4fbfe2f7e
* Add options to repair or change file systemEthan Yonker2014-06-041-1/+95
| | | | Change-Id: I9043e98e1e1ed4722f05c13a60b43d2d0bf739f6
* Support alternative .android_secure locationMatt Mower2014-04-161-0/+2
| | | | | | | | | | | | | | | | 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
* Allow building of an OEM friendly TWRPEthan Yonker2014-04-041-0/+7
| | | | | | | | Disable theming Disable creating the TWRP folder for the settings file Change factory reset on data/media devices to a full wipe Change-Id: I3104282b5dd3f55dfff7c8cf39c72750af08563d
* Stop printing Unable to mount to console if storage is removable. We will still print tobigbiff bigbiff2014-04-031-1/+1
| | | | | | recovery.log Change-Id: I19e3df2e977e09e222733f13324051334982b05d
* Remove deprecated tar exclude functionalityMatt Mower2014-03-311-5/+1
| | | | | | | | | twrpDU::check_skip_dirs() handles skipped folders now. Everywhere twrpTar::setexcl() is being used to exclude files eventually calls createTarFork(), which in turn calls Generate_TarList(), which checks check_skip_dirs(). Change-Id: Ibbc4eb2eb89863ccb2a15f5a3b5092fb10fcbcc0
* Fix /data backup size if contains media subdirsMatt Mower2014-03-301-2/+0
| | | | | | | | /data/*/media directories are mistakenly being excluded from the size calculation. Change to absolute dir exclude so that only /data/media is excluded. Change-Id: I6e97604d44e6ea2bdf7dfd8c68a2f90ba6d44415
* Check to ensure that selinux_handle is populated before usingDees Troy2014-03-101-1/+1
| | | | Change-Id: I6de4c5db3e3183229d7029fc72b957c7ef61f23a
* Restore capabilities to run-as binaryDees Troy2014-02-281-2/+29
| | | | Change-Id: I9e2b8e9b69c94b94c57143c04b950530490ec33e
* Check crypto footer before offering to decryptEthan Yonker2014-02-261-8/+40
| | | | | | | | | 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
* Remove unneeded loggingEthan Yonker2014-02-251-1/+0
| | | | Change-Id: I5c7d104689ed2b578b463a6be55b3688dcc4c01a
* Merge "Move DataManager functions out of twrpTar.cpp" into android-4.4Ethan Yonker2014-02-121-31/+15
|\
| * Move DataManager functions out of twrpTar.cppEthan Yonker2014-02-101-31/+15
| | | | | | | | Change-Id: I943318afe787ff4ede724fa0bc77ebc6a3ba0c8b
* | Fix ext4 wiping when no SELinux contexts are definedEthan Yonker2014-02-091-3/+12
|/ | | | Change-Id: I900f42892d47f54b573cc1dbfb551ed2a8f9e8b9
* Merge "Additional mount function call without mount options" into android-4.4Dees Troy2014-02-071-1/+1
|\
| * Additional mount function call without mount optionsDees Troy2014-02-071-1/+1
| | | | | | | | | | | | | | | | Example: f2fs on Moto G needs fsflags="inline_xattr" in the stock ROM but the Google Edition uses ext4 which fails to mount with that option. Change-Id: I01bce214e7f15e43e66ac35729fd3521609ffad3
* | Restore contexts when doing mkdierhier in libtarbigbiff bigbiff2014-02-071-0/+15
|/ | | | | | Do a restore of loaded file contexts to /data/media directory. This will help denials to be prevented when internal storage is wiped. Change-Id: Ie49bbfa48d2f3ee4f08376d9c1877b92c051017c
* Merge "Improve android secure handling" into android-4.4Ethan Yonker2014-02-061-12/+1
|\
| * Improve android secure handlingEthan Yonker2014-02-031-12/+1
| | | | | | | | Change-Id: I9e1c7f4a8353b7be51e1a54bf5d506c9dce70da2
* | Fix error message on split backupsEthan Yonker2014-02-051-6/+0
|/ | | | Change-Id: I9effd57c2b4d28c3bd9ca1045a0bb0ac8c958245
* Refactor twrpTar to use TarListDees Troy2014-02-031-28/+11
| | | | | | | | Eliminate the use of tarDirs and Generate_MultipleArcives in favor of Generate_TarList so that we have one method for backup creation instead of three. Change-Id: I267937b6e40b32d43fbac8b4cca82f7468d4f94c
* Clear the relative directory before passing on to twrpTar with the static du object. Otherwise we will not backup /system/media etcbigbiff bigbiff2014-02-031-2/+4
| | | | Change-Id: Ib62af6ad8596aa18bf48cb750e2ecf442dadc627
* Add option to set flag for storage=0Ethan Yonker2014-02-031-2/+14
| | | | Change-Id: I46b94d55fc649a2abf27569ccf99aabb2822d663
* ifdef some file system options that are not available in older treesDees Troy2014-02-031-0/+8
| | | | Change-Id: I11a7e441f7fe4e556a5349822150493de90095f1
* Create a TWRP Disk Usage Class to retain state about a directory and whether we should skip it in other classes like twrpTar.bigbiff bigbiff2013-12-191-14/+14
| | | | | | Moved Get_Folder_Size to this new class. Change-Id: If0a0220f900eb109581f2eeaf7b76e3f7d6886f1
* add support for fsflags= option in twrp.fstab fileHashcode2013-12-191-2/+70
| | | | | | | | | 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
* Update licenses to all matchDees Troy2013-10-221-21/+17
|
* Fix spelling errorDees Troy2013-10-181-2/+2
|
* fix getting and setting contexts in selinuxbigbiff bigbiff2013-10-171-0/+9
| | | | | | recreate lost+found with selinux contexts Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
* Add TWFunc::Exec_Cmd() with no 'result' agrumentVojtech Bocek2013-09-121-24/+22
| | | | | | Signed-off-by: Vojtech Bocek <vbocek@gmail.com> Change-Id: Id8acff1ac9b3c7e4b562c80562a8ff42a1d132b9
* Add more args to make_ext4fs commandDees_Troy2013-09-061-1/+4
|
* Initialize TWPartition::User_Rm_Rf to false in constructorVojtech Bocek2013-08-301-0/+1
| | | | Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
* implement "usermrf" fstab flag to force rm -rf * deletion on specific partitionsHashcode2013-08-301-1/+3
| | | | Change-Id: I58f4a8cedf31e6b6efd88f96a43ed525603ae311
* Better compatibility by fixing up ext4 & selinux flagsDees_Troy2013-08-301-5/+1
|
* Initial f2fs supportDees_Troy2013-08-291-0/+29
| | | | | | | Need to add this to your source tree: https://github.com/razrqcom-dev-team/android_external_f2fs-tools Change-Id: I3ee9ebbb617259655518f8ea356ce7b8c246cd4d
* skip checking size on linksbigbiff bigbiff2013-08-281-0/+2
| | | | | | skip google music cache Change-Id: I75d6fd0e17140d12cb2c6d335e8ff73a6f871aa2
* Unify indentation and little clean-up in TWRP filesVojtech Bocek2013-08-241-25/+25
| | | | Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
* Add SELinux supportDees_Troy2013-08-241-1/+19
| | | | Change-Id: I11e1a3d018d921d96ba08915925b14bf633be6ed
* Fix AOSP decrypt when TouchWiz code is presentDees_Troy2013-08-231-1/+3
|
* Properly free blkid_probe in TWPartition::Check_FS_Type()Vojtech Bocek2013-07-011-1/+3
| | | | Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
* Fix MTD MountingDees_Troy2013-07-011-15/+36
| | | | | | | Pulled part of change from kokotas in this patch set: http://review.teamw.in/#/c/586/ Change-Id: If1c5b1563df16f9c561c94f61010f6a99f36efa0
* Fix some issues with wipe partition listDees_Troy2013-07-011-1/+4
| | | | Change-Id: Ie7d5878faf86b8fa824b72211be7fd3596b471d7
* Support encrypted backup filesDees_Troy2013-06-221-18/+49
| | | | | | | | | | | | | | | 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
* Improve backup list resultsDees_Troy2013-04-081-1/+0
|
* Improve automated handlidling of partitionsDees_Troy2013-04-081-3/+5
|
* Move all AOSP code out of recovery binaryDees_Troy2013-04-041-120/+120
| | | | | | Improves license compatibility between GPL and Apache Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
* Add partition list GUI elementDees_Troy2013-03-301-22/+101
| | | | | | | | | | | | 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
* trying to fix md5bigbiff bigbiff2013-03-171-3/+19
| | | | Change-Id: I4ec037f76aa965bc818afe924942adbe9a080b36
* use md5.c for computation of md5sumsbigbiff bigbiff2013-03-071-3/+7
| | | | | | create a framework for computing digests and reading digests in TWRP add space for backwards compatibility with bb md5sum Change-Id: Ia18e3f430eed5eba22e5052d39b9b8d88ecd4536
* use libblkid to get filesystem typebigbiff bigbiff2013-02-251-58/+14
| | | | we can now use libblkid to detect exfat
* Add MTK6575/6577 EMMC partitions backup supportigoriok2013-02-191-3/+29
| | | | | | | | taken from https://github.com/mrjavum/Team-Win-Recovery-Project/commit/140ff0cde8ad2236caf7bcd480d257d74d8b85bc "sorocean.gor@gmail.com" Change-Id: I1a97160c73c7a0bab0535e938d6b35dc09585037
* change libtar to fork instead of pthreadbigbiff bigbiff2013-02-181-5/+5
| | | | | | Conflicts: twrpTar.cpp
* Add write buffer for tar writesDees_Troy2013-02-071-1/+1
| | | | | | | update fuse to 2.9.2 catch return from unlink so that we don't print error messages when things work Change-Id: I1115039a0fa5d9d73f78ef1abd79755d7ffd9d96
* Fix fail over to vfat from exfatDees_Troy2013-02-011-33/+60
| | | | | | | Fix issues with MD5 checking using chdir and leaving the working dir in a subfolder that prevented unmounting sometimes. Change-Id: I01a563d722f474297ed3f7a30064c3a61748ade3
* exFAT improvements, fixesDees_Troy2013-01-281-3/+11
| | | | | | | | | Move Exec_Cmd to libcrecovery __popen Provide opt out build flag for exFAT Default fstype to exfat on external storage if exfat support is present and fstype is vfat or auto Fix invalid unmount errors Improve handling of unencrypted sdcards on Samsung devices
* Fix subpartitionof flagDees_Troy2013-01-281-1/+1
|
* change tar create to pthreadbigbiff bigbiff2013-01-241-8/+18
| | | | Change-Id: I5a33d207ec6683de20da37e6f4f174c67785fc52
* Remove sockets and FIFOS when removing filesbigbiff bigbiff2013-01-201-1/+1
|
* Fix handling of blkid outputDees_Troy2013-01-181-15/+14
| | | | | Fixed handling of blkid output when the output spans multiple lines and the TYPE field ended up on next line.
* Save version to cacheDees_Troy2013-01-171-0/+3
|
* ORS engine fixesDees_Troy2013-01-171-1/+3
| | | | | | | | 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.
* Add flag for retaining layout versionDees_Troy2013-01-151-38/+50
| | | | | | | 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.
* Check to ensure that external is encryptedDees_Troy2013-01-141-1/+3
|
* More Samsung sdcard crypto fixesDees_Troy2013-01-101-1/+14
|
* Fix wiping problems and save ecrypt keyDees_Troy2013-01-091-2/+30
| | | | | | Fix problems with the wiping of data/media devices Save and restore the ecryptfs key for external sdcard on Samsung encrypted devices.
* Improve remounting sdcard with ecryptfsDees_Troy2013-01-091-2/+20
|
* Add libtar to TWRP instead of using busybox tarbigbiff bigbiff2013-01-091-131/+130
| | | | | | | Add proper mkdosfs tool Add fuse to TWRP Add experimental exfat-fuse to TWRP Convert all system() functions to use new Exec_Cmd function
* Improve handling of undecrypted encrypted /dataGary Peck2012-12-211-4/+15
| | | | | | | | | | - 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
* Reset partition flags when the partition is wipedGary Peck2012-12-211-21/+34
| | | | Change-Id: I6c4cee5b038fd0c39c8723412dd8f421f7794a00
* check backup image size before restoringGary Peck2012-12-181-1/+14
| | | | Change-Id: I206d34936388c1b072eaaec50e0492710cb80f2e
* Fix handling of MTD partitions during mountDees_Troy2012-12-181-1/+19
|
* Add ignore blkid flag for TransformersDees_Troy2012-12-121-2/+6
| | | | Change-Id: I8f2b5b68a8c3ede74858d53002efab997174ee65
* Restore text display during restoreDees_Troy2012-12-121-0/+2
|
* restore based on backup type, not destination typeGary Peck2012-11-221-40/+49
| | | | Change-Id: Ie44958a148d00cadd2ba3c51255f7fd9d8a651e7
* Fixes for multi-user in 4.2Dees_Troy2012-11-151-9/+17
| | | | | | Also fixed inability to delete backups with a space in the name. Change-Id: I2f6639d33caa3c4542960f76adbd59b25ab64f5d
* add exfat to partitions.cppbigbiff bigbiff2012-11-141-0/+1
|
* Initial BML support (ext4 only)Dees_Troy2012-10-161-4/+11
|
* Handle storage devices that are slow to mountDees_Troy2012-10-141-0/+15
|
* Remove unneeded duplicate codeDees_Troy2012-10-131-41/+0
|
* Track whether a partition is mounted during refresh sizesDees_Troy2012-10-131-5/+18
| | | | and leave it mounted or unmount based on prior mounting status
* Change backup size check for ddDees_Troy2012-10-121-2/+2
|
* Fix restore of multiple archivesDees_Troy2012-10-121-1/+1
|
* Fix derp with alternate storageDees_Troy2012-10-081-1/+1
|
* Fix error message on encrypted devicesDees_Troy2012-10-011-1/+8
|
* Revert busybox for CM7 compatibility, add exclamation point to format dataDees_Troy2012-09-281-3/+5
|
* Update sdcard partitioning to C++Dees_Troy2012-09-271-9/+1
|
* Port reboot functions to C++Dees_Troy2012-09-271-1/+0
|
* Handle mountable boot partitionsDees_Troy2012-09-271-2/+10
|
* Backup size for special partitions that are imagesDees_Troy2012-09-261-0/+24
|
* Fix problems with MTD devicesDees_Troy2012-09-261-7/+2
| | | | Also improve handling of MTD names
* Add backup size checkingDees_Troy2012-09-261-7/+20
| | | | | Converted bootloader.cpp to TWRP and removed AOSP fstab parsing from startup
* Convert makelist to C++Dees_Troy2012-09-261-2/+3
|
* Unify portrait layouts againDees_Troy2012-09-261-1/+13
|
* Update tablet layouts with ADB sideloadDees_Troy2012-09-241-0/+1
|
* Fix special partition handlingDees_Troy2012-09-211-2/+2
|
* Add android_secure supportDees_Troy2012-09-211-17/+82
|
* Various fixesDees_Troy2012-09-201-0/+7
| | | | | | 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.
* Cleanup extra-functionsDees_Troy2012-09-181-4/+31
|
* Improve backup and restoreDees_Troy2012-09-181-13/+50
| | | | Add in archive splitting support
* Update backup and restore code, adb sideloadDees_Troy2012-09-171-88/+178
| | | | | | | 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.
* Add wipe functions, compiles in CM7, text shows in UI, zips installDees_Troy2012-09-141-98/+353
| | | | | | | | 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
* Zip install works againDees_Troy2012-09-111-6/+26
|
* More Partition Manager functionalityDees_Troy2012-09-101-9/+19
|
* Improve storage size code, mount, unmountDees_Troy2012-09-101-62/+197
| | | | Add flag parsing from recovery.fstab
* Add processing of fstab, mounting, and decryptDees_Troy2012-09-071-12/+510
|
* TWRP-ify AOSP codeDees_Troy2012-09-051-0/+193
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