Commit Graph

114 Commits

Author SHA1 Message Date
Ethan Yonker
5ef301ec95 Do not set contexts during a factory reset
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
2014-10-20 14:42:47 +02:00
Ethan Yonker
25f20c1928 Fix wiping crash when block device is not present
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
2014-10-14 09:04:54 -05:00
that
9e0593eaf6 mtp: cleanup, fixes and performance improvements
- 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-10-08 18:34:39 +02:00
Captain Throwback
ff5935f7ef Attempt to fix md5 issue with backups
thanks @bigbiff for the suggestion

Change-Id: Ie9b55537b7fa300461b015d2b9523d4250e755a9
2014-10-08 18:22:08 +02:00
Ethan Yonker
6277c79727 Attempt to automatically identify data/media devices
Change-Id: Ia3007fbced9ce3bc94efdb3dacc582a5e68a49a4
2014-09-19 22:34:09 -05:00
bigbiff bigbiff
c7eee6fef0 add mtp responder to TWRP.
Big thanks to Dees_Troy for helping with the implementation.

Change-Id: I6c9c522b9c9de5dc139e2ecb0141008182ba07f0
2014-09-02 21:44:49 -04:00
Ethan Yonker
1b7a31bd65 Track backup and restore progress
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-09 08:52:18 -05:00
Ethan Yonker
5eac222cfe Do not restore file system on data/media devices
Change-Id: I600e7e9ce89621400531bceb472387aafc0d6ed8
2014-06-13 08:57:48 -05:00
Matt Mower
fb1c4ffaaf Whitespace and minor code cleanup
This is by no means comprehensive, but is quite a bit better already.

Change-Id: Ibc8654a5dfb0eec39cbd0b64bdb52bb4fbfe2f7e
2014-06-04 09:13:37 -05:00
Ethan Yonker
87c7bac9c9 Add options to repair or change file system
Change-Id: I9043e98e1e1ed4722f05c13a60b43d2d0bf739f6
2014-06-04 15:46:32 +02:00
Matt Mower
bf4efa39e4 Support alternative .android_secure location
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-16 17:30:26 +02:00
Ethan Yonker
83e82578af Allow building of an OEM friendly TWRP
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
2014-04-04 10:59:52 -05:00
bigbiff bigbiff
26774a02f9 Stop printing Unable to mount to console if storage is removable. We will still print to
recovery.log

Change-Id: I19e3df2e977e09e222733f13324051334982b05d
2014-04-02 20:22:31 -04:00
Matt Mower
bb81e5d02d Remove deprecated tar exclude functionality
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
2014-03-31 16:10:28 -05:00
Matt Mower
f77994d270 Fix /data backup size if contains media subdirs
/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
2014-03-30 14:27:28 -04:00
Dees Troy
99c8dbf215 Check to ensure that selinux_handle is populated before using
Change-Id: I6de4c5db3e3183229d7029fc72b957c7ef61f23a
2014-03-10 16:54:21 +00:00
Dees Troy
4159aedfaa Restore capabilities to run-as binary
Change-Id: I9e2b8e9b69c94b94c57143c04b950530490ec33e
2014-02-28 17:59:04 +00:00
Ethan Yonker
71413f4ee9 Check crypto footer before offering to decrypt
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-26 13:37:35 -06:00
Ethan Yonker
c62b34c3ba Remove unneeded logging
Change-Id: I5c7d104689ed2b578b463a6be55b3688dcc4c01a
2014-02-25 11:19:56 -06:00
Ethan Yonker
374cd713d4 Merge "Move DataManager functions out of twrpTar.cpp" into android-4.4 2014-02-12 15:56:02 +01:00
Ethan Yonker
87af56369b Move DataManager functions out of twrpTar.cpp
Change-Id: I943318afe787ff4ede724fa0bc77ebc6a3ba0c8b
2014-02-10 11:56:35 -06:00
Ethan Yonker
f27497f0cc Fix ext4 wiping when no SELinux contexts are defined
Change-Id: I900f42892d47f54b573cc1dbfb551ed2a8f9e8b9
2014-02-09 11:48:33 -06:00
Dees Troy
175cb7b25d Merge "Additional mount function call without mount options" into android-4.4 2014-02-07 19:49:11 +01:00
Dees Troy
216e042be8 Additional mount function call without mount options
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
2014-02-07 03:46:46 +00:00
bigbiff bigbiff
6b600f9644 Restore contexts when doing mkdierhier in libtar
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
2014-02-06 19:56:25 -05:00
Ethan Yonker
a21b052589 Merge "Improve android secure handling" into android-4.4 2014-02-06 20:05:30 +01:00
Ethan Yonker
a1aad1bd8c Fix error message on split backups
Change-Id: I9effd57c2b4d28c3bd9ca1045a0bb0ac8c958245
2014-02-04 21:58:14 -06:00
Ethan Yonker
d4d107388c Improve android secure handling
Change-Id: I9e1c7f4a8353b7be51e1a54bf5d506c9dce70da2
2014-02-03 15:27:52 -06:00
Dees Troy
e0a433a94d Refactor twrpTar to use TarList
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
2014-02-03 19:13:26 +01:00
bigbiff bigbiff
c7360dd263 Clear the relative directory before passing on to twrpTar with the static du object. Otherwise we will not backup /system/media etc
Change-Id: Ib62af6ad8596aa18bf48cb750e2ecf442dadc627
2014-02-03 19:00:58 +01:00
Ethan Yonker
06c3f93d69 Add option to set flag for storage=0
Change-Id: I46b94d55fc649a2abf27569ccf99aabb2822d663
2014-02-03 16:09:33 +01:00
Dees Troy
c4bc30ec43 ifdef some file system options that are not available in older trees
Change-Id: I11a7e441f7fe4e556a5349822150493de90095f1
2014-02-03 15:04:19 +00:00
bigbiff bigbiff
34684ff313 Create a TWRP Disk Usage Class to retain state about a directory and whether we should skip it in other classes like twrpTar.
Moved Get_Folder_Size to this new class.

Change-Id: If0a0220f900eb109581f2eeaf7b76e3f7d6886f1
2013-12-19 18:02:44 +00:00
Hashcode
62bd9e04c7 add support for fsflags= option in twrp.fstab file
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-12-19 17:04:02 +00:00
Dees Troy
3be70a897e Update licenses to all match 2013-10-22 14:25:12 +00:00
Dees Troy
d932ce1b99 Fix spelling error 2013-10-18 17:12:59 +00:00
bigbiff bigbiff
c49d706903 fix getting and setting contexts in selinux
recreate lost+found with selinux contexts

Change-Id: I19e8696d47319dfb641520956c8a27c2a796a0c3
2013-10-17 16:49:49 +00:00
Vojtech Bocek
05534209f1 Add TWFunc::Exec_Cmd() with no 'result' agrument
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: Id8acff1ac9b3c7e4b562c80562a8ff42a1d132b9
2013-09-12 15:36:40 +00:00
Dees_Troy
5295d581a5 Add more args to make_ext4fs command 2013-09-06 15:51:08 +00:00
Vojtech Bocek
1dc3098a5c Initialize TWPartition::User_Rm_Rf to false in constructor
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-30 21:49:30 +02:00
Hashcode
dabfd49bd4 implement "usermrf" fstab flag to force rm -rf * deletion on specific partitions
Change-Id: I58f4a8cedf31e6b6efd88f96a43ed525603ae311
2013-08-30 10:28:15 -07:00
Dees_Troy
b3265ab358 Better compatibility by fixing up ext4 & selinux flags 2013-08-30 02:59:14 +00:00
Dees_Troy
e5017045b5 Initial f2fs support
Need to add this to your source tree:
https://github.com/razrqcom-dev-team/android_external_f2fs-tools

Change-Id: I3ee9ebbb617259655518f8ea356ce7b8c246cd4d
2013-08-29 16:58:38 +00:00
bigbiff bigbiff
86e77bcbb2 skip checking size on links
skip google music cache

Change-Id: I75d6fd0e17140d12cb2c6d335e8ff73a6f871aa2
2013-08-28 16:10:36 +00:00
Vojtech Bocek
fafb0c541b Unify indentation and little clean-up in TWRP files
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-24 07:56:48 -05:00
Dees_Troy
a95f55c3ef Add SELinux support
Change-Id: I11e1a3d018d921d96ba08915925b14bf633be6ed
2013-08-24 07:42:30 -05:00
Dees_Troy
066eb30abf Fix AOSP decrypt when TouchWiz code is present 2013-08-23 17:22:37 +00:00
Vojtech Bocek
4d4b3361f3 Properly free blkid_probe in TWPartition::Check_FS_Type()
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-07-01 15:50:15 -05:00
Dees_Troy
76543db6e6 Fix MTD Mounting
Pulled part of change from kokotas in this patch set:
http://review.teamw.in/#/c/586/

Change-Id: If1c5b1563df16f9c561c94f61010f6a99f36efa0
2013-07-01 15:36:02 -05:00
Dees_Troy
74fb2e94d5 Fix some issues with wipe partition list
Change-Id: Ie7d5878faf86b8fa824b72211be7fd3596b471d7
2013-07-01 20:20:58 +00:00