45 Commits

Author SHA1 Message Date
nkk71
a52bf2b906 Merge remote-tracking branch 'upstream/android-6.0' into android-6.0-mrom
Conflicts:
	gui/action.cpp
	partitions.hpp
	twrp-functions.hpp

Change-Id: Ib0fcd4095d2e2cc57eb15037ff4f6c8052c193eb
2016-09-10 14:01:45 +03:00
bigbiff
ce8f83c48d ADB: Add adb backup for TWRP.
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-07-31 22:20:18 -05:00
nkk71
bd8477b815 Merge remote-tracking branch 'upstream/android-6.0' into android-6.0-mrom
Conflicts:
	partition.cpp

Change-Id: I8e5ed103b406fe36eeb5bf6a80efbf698d8bdb40
2016-06-30 21:07:45 +03:00
Matt Mower
2416a50b5a Rewrite TWRP fstab flag processing
* 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
2016-05-03 18:20:57 +01:00
Captain Throwback
c6763a0e69 Merge branch 'android-6.0-twrp' into android-6.0
Conflicts:
	data.cpp
	twrp-functions.cpp
	variables.h

Change-Id: I8db6ab10dd86d950f152a051d62b16ebe1ea573b
2016-04-01 11:07:34 -04:00
Ethan Yonker
472f506817 Improve progress bar handling for backup / restore / image flash
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-31 15:44:24 +01:00
nkk71
09e430816b Add MultiROM support to standard TWRP tree
Squashed commit that allows MultiROM TWRP to be built from
within the standard TWRP environment.

MultiROM build flags and TARGET_RECOVERY_IS_MULTIROM
must be defined in device tree.

-------------------------------------

MultiROM-support:
- Move files to separate folder
  * Move primary multirom files to /recovery/multirom
  * Move multirom prebuilt files to /recovery/multirom/prebuilt
  * Move cp_xattrs folder used by multirom to /recovery/multirom/cp_xattrs
- Add Android.mk for mrom-prebuilt files
- Add Android.mk for mrom-cp_xattrs files
- Fix include paths
  * fix includes in multirom.h/c/hpp/cpp files to go to parent (main recovery folder)
- Add read_data function
  * Add read_data function used by multirom
  * Don't append to minzip, use a seperate file
- Remove deprecated 'flags' variable
  * Remove deprecated 'flags' in function call to mzExtractRecursive
  * Ref: 9c0f5d6b34
- gui: Add multirom functions
  * objects.hpp - Add multirom action definitions
  * action.cpp - Add multirom actions and functions
    Note: TW_ORS_IS_SECONDARY_ROM code moved to openrecoveryscript.cpp
  * Add TARGET_RECOVERY_IS_MULTIROM flag to Android.mk
  * Reorder code changes for easier merging
- twrp-functions
  * Add functions needed by multirom
  * Reorder code changes for easier merging
- partition.cpp and partitionmanager.cpp
  * Add and embed multirom specific code
  * Reorder code changes for easier merging
- twrp.cpp
  * Add and embed multirom specific code
- variables.h
  * Add multirom specific defines
- Android.mk
  * update Android.mk for compartmentalized multirom
- gui: Update fileselector
  * Add <excludes> tag
  * Add support for multiple file extensions
- gui: Update listbox
  * Add support for dynamic <items> tag

Thanks @CaptainThrowback and @z31s1g for your help
2016-02-06 15:33:15 +02:00
Ethan Yonker
483e9f45b7 Improve sdcard partitioning process
-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-14 17:40:43 +01:00
Ethan Yonker
9132d91253 Disable stock recovery replacing TWRP during ORS
-Create a separate function to disable stock recovery flashing
-Add a call to that function to the reboot section of the ORS
 action so that an OTA update will not inadvertantly replace TWRP

Change-Id: I43eae81e0e76971b6e8d34c38785dc73772242d2
2015-02-02 18:23:25 +01:00
that
fcdb76dd05 twrp-functions: remove unused functions
Change-Id: I3d072be9ef28f21ade466bc4c42caca8848f7c2a
2014-12-29 17:11:59 +01:00
Ethan Yonker
e3e8829e40 Update SuperSU to 2.40
The SuperSU install process is getting rather complicated, so we
will modify the install script slightly and use it to install
all the things and stop trying to check to see if root permissions
have been lost like we used to do.

Change-Id: Ibdb64c909d2bd16e12bb35b4f31f572cc29add47
2014-12-18 21:17:26 +01:00
Jenkins
1710bf2547 display cpu temperature in twrp
use TW_NO_CPU_TEMP := true to disable display
use TW_CPU_CUSTOM_PATH := path to set custom path

Change-Id: Id260ecbb4ec36a78442387329944f67003d0f6a0
2014-10-14 15:08:11 +02:00
Tom Hite
5a9267283c performance profile support
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-08 19:35:32 +02: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
xNUTx
e85f02dd91 Support reading since_epoch and secondary brightness files
TWFunc::Fixup_Time_On_Boot: Will now try to read
/sys/class/rtc/rtc0/since_epoch to correct time, if that fails
it will try to use the ats files to correct time.

TWFunc::Set_Brightness: One single function to set brightness
from both the automated functions and the gui actions. It is
able to set a second brightness path if present, it will set
them both the same value. Many Sony devices have 2 brightness
files in the sysfs that must be set to properly set the
brightness.

Change-Id: I7ca582109085dfbcb46b8de73ad031e4b7903fca
2014-08-10 08:57:14 -05:00
Vojtech Bocek
03fd6c56fe Implement "take a screenshot" feature
* Like in android - press power+volume down, screenshots are saved
  in /sdcard/Pictures/Screenshots (if /sdcard is mounted) or /tmp

Change-Id: Iaefa15b11a1d5fdfac57d77388db1621f378a8d4
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-07-09 17:35:36 +02: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
Vojtech Bocek
0b7fe504dc Add support for actions triggered by key combination
Change-Id: I9dfa7de40229f00412d63fc9c1eb3a809a6eb2e6
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-04-16 17:51:17 +02:00
Vojtech Bocek
05f87d6cca Fix skipping of relative paths and lost+found in twrpDU
Change-Id: Ib79029fd6237502338b041a6bc2f9e539536d6ad
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-03-13 14:55:12 +01:00
Ethan Yonker
a869eddeb9 Remove unused functions
Change-Id: I3230412e6aad7aab0f2fd034cc7b289cd4cd6a97
2014-02-12 15:12:06 +00:00
Ethan Yonker
af2897c4c2 ifdef some functions that depend on other TWRP parts
End goal is to create a twrpTar binary that can run from the
command line.

Change-Id: I14f07a425b7755bd09dbce95a5918da1430964fc
2014-02-12 15:08:31 +00:00
Ethan Yonker
b555789d44 Separate out function for reading /system/build.prop values
Change-Id: I9e398aa3f4f5be0728435ffdab333d4090cdab22
2014-02-07 21:43:20 -06:00
Vojtech Bocek
e5ffcd1af2 Add option to print render time of each frame to log file
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: Id158a6375fbadf4cdf0a8c7d143759e602419e7f
2014-02-06 21:18:08 +01:00
Vojtech Bocek
d0e38bc2f4 Load RTC offset on Qualcomm Krait chips, fixes the broken time & date
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: I04ad07f3e6be961003e063be8c648e191e2f9431
2014-02-04 18:27:05 +01: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
Dees Troy
3be70a897e Update licenses to all match 2013-10-22 14:25:12 +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
b21cc64ca8 Pull ROM info from build.prop for backup names
Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768
2013-09-12 09:11:13 -05:00
Vojtech Bocek
37aeb8d678 Really fix TWFunc::tw_chmod() for 3-character mode string
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: I8f03d46235e1c71e8ee510309c9418cde802f50b
2013-08-29 21:35:02 -05: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
83bd483f3d Support encrypted backup files
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-06-22 16:16:55 -05:00
Dees_Troy
2673cec07a Move all AOSP code out of recovery binary
Improves license compatibility between GPL and Apache

Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
2013-04-04 18:57:34 +00:00
bigbiff bigbiff
cdcfee48b9 use md5.c for computation of md5sums
create a framework for computing digests and reading digests in TWRP
add space for backwards compatibility with bb md5sum
Change-Id: Ia18e3f430eed5eba22e5052d39b9b8d88ecd4536
2013-03-07 08:07:34 -05:00
Dees_Troy
6ef6635ad3 Check for root and root perms and offer to install/fix
Also fix sort order for file selector by date and file sizes

Change-Id: Idff9fe4232c19d4ed1082e78fabe6f921aa0a114
2013-02-21 18:23:43 +00:00
bigbiff bigbiff
8a68c31ffc This adds a 60 second screen timeout for TWRP. Might consider making this configurable in the future.
Will also set overlay to lockscreen so we don't have inadvetent screen selections.
Touching the screen will bring the display back up.
add back check script for poweroff
move diff time function to twrp-functions.cpp
make sure we chmod after copy_file
add read_file and write_file functions to twrp-functions.cpp
make single thread
try to force update screen
add forceRender
drop caches after tar processing

Change-Id: I3c5c509dd39dbb05451bbfe5d8b56d53c90d8d1b
2013-02-13 13:16:03 -06:00
Vojtech Bocek
2e97ec58b9 Use only std::string in TWFunc::Get_Folder_Size
* Fixes crash which could occur with too deep path because
  of too much memory allocated on stack
2013-02-02 13:22:42 +01:00
Dees_Troy
3ee47bc2ab file manager updates for exFAT
Change-Id: I06fa6120a975cbc3d4eef9bc2ca034ec716740ee
2013-01-28 15:20:03 +00:00
bigbiff bigbiff
9c754053b0 Add libtar to TWRP instead of using busybox tar
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-09 09:09:08 -05:00
Dees_Troy
01a9b7a7f8 Fix output of version number 2012-10-01 09:01:03 -04:00
Dees_Troy
3477d7163e Save version number to storage 2012-09-27 15:44:01 -04:00
Dees_Troy
a58beade0a Port reboot functions to C++ 2012-09-27 09:50:56 -04:00
Dees_Troy
7c2dec8020 Add backup size checking
Converted bootloader.cpp to TWRP and removed AOSP fstab parsing
from startup
2012-09-26 09:50:10 -04:00
Dees_Troy
b46a684971 Unify portrait layouts again 2012-09-26 09:00:46 -04:00
Dees_Troy
43d8b00770 Update backup and restore code, adb sideload
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-17 16:06:12 -04:00
Dees_Troy
38bd760b58 Add wipe functions, compiles in CM7, text shows in UI, zips install
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-14 13:36:32 -04:00