Commit Graph

96 Commits

Author SHA1 Message Date
Ethan Yonker
1673e3d4ea Treat /vendor like /system for read only
The vendor partition is verity checked just like system so we
should treat vendor as read only same as system.

Change-Id: Ida65c9f44d8610e52fcdcef0b4a50faf5c7110d2
2015-11-05 21:07:21 +02:00
Ethan Yonker
d0514ba806 Fix a bunch of warnings
Mostly adding __unused where needed.

Change-Id: Ia4f675b9b360782728c361ed1699db0cc277c3a5
2015-10-24 17:36:24 -05:00
Ethan Yonker
c798c9cd24 Merge up to AOSP marshmallow-release
In order to maintain compatibility with older trees, we now have
minadbd.old and minui.old. I had to use a TARGET_GLOBAL_CFLAG to
handle ifdef issues in minui/minui.d because healthd includes
minui/minui.h and there was no other alternative to make minui.h
compatible with older trees without having to modify healthd rules
which is outside of TWRP.

Note that the new minui does not currently have support for qcom
overlay graphics. Support for this graphics mode will likely be
added in a later patch set. If you are building in a 6.0 tree and
have a device that needs qcom overlay graphics, be warned, as off
mode charging may not work properly. A dead battery in this case
could potentially brick your device if it is unable to charge as
healthd handles charging duties.

Update rules for building toolbox and add rules for making toybox

Use permissive.sh in init.rc which will follow symlinks so we do
not have to worry about what binary is supplying the setenforce
functionality (toolbox, toybox, or busybox).

Fix a few warnings in the main recovery binary source code.

Fix a few includes that were missing that prevented compiling in
6.0

Change-Id: Ia67aa2107d260883da5e365475a19bea538e8b97
2015-10-09 11:15:29 -05:00
Matt Mower
85161af111 ORS: Report success if AOSP script succeeds
When AOSP recovery commands are processed, the GUI reports a failure
just before reboot even when all commands succeeded. Set op_status
before reboot to indicate success.

Change-Id: I09e9357b04cd81f418264bf00a75311f48357414
2015-08-09 17:22:25 +02:00
Dees Troy
28a85d232f Make sure that adbd restarts after sideload
Change-Id: I7d82b95cd8749c6f8569739162708705faa6f1f7
2015-06-17 23:40:25 +02:00
Ethan Yonker
e1abe616f2 Fix ORS scripts displaying an error after completing
Change-Id: I1329705fca870b4e3017607ad7c7875aa00d664b
2015-06-17 23:12:34 +02:00
that
c7b631b7a2 gui: set tw_file to the currently flashed file name without path
To allow themes to show more of the file name on narrow displays.

Change-Id: I4962eed5e4a01f73a3cde126f2ba56428209fccc
2015-06-01 23:36:57 +02:00
Ethan Yonker
d6966f4426 Fix unable to uncheck the mount read only check box
Change-Id: I1bbc25df6f35f79549f1eb06feb4db9ec0475aa5
2015-05-30 14:52:21 -05:00
Xuefer
46bdc96815 remove useless memset and \n
fgets reads up to one byte less than size then with \0 at the end
adding \n after \0 is useless too

Change-Id: I7758d7a8f885bdde2b491a9cb75800f831d77c1f
2015-05-29 17:56:19 +02:00
Ethan Yonker
a2719156c2 Add resize2fs and ability to run resize2fs via GUI
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-28 09:47:25 -05:00
Ethan Yonker
eb32b1ff00 Mount system as read-only by default
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-27 09:22:49 -05:00
xiaolu
e738da5e89 minuitwrp: fix crash issue, when the console use TTF font to display unicode font.
gui: fix terminal command unusual line breaks and missing characters at the end of a read buf.

Change-Id: I8d3d740b6066b1594c5148b2012f0e7bcbecc22b
2015-03-05 04:22:26 +01:00
Matt Mower
5aa29ab3c7 GUI: Terminal command: minor improvements
* Use mono font for terminal command input
* Recognize 'exit' command (go to main page)

Change-Id: I5f383cd8d19959a49d2ae0b18f839b86e4145693
2015-03-05 04:20:53 +01:00
Ethan Yonker
21ff02a693 GUI: Support styles in xml to reduce xml file size
Also allow sliders to have their own text label instead of
requiring a whole separate text object for the label in the xml.

Change-Id: I6e314efb4bb454d496555ff7e003d743063a1308
2015-02-21 08:14:24 -06: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
73a5295f69 gui: run cancel action in another thread
Some actions did not have an operation_end where needed especially
when dealing with cancel actions.

Cancel actions now do not run operation_start or operation_end
and let the original action handle the operation_end so that the
GUI waits until the original action acutally cancels.

Change-Id: I28e6260abb058acb982cecd108c09fc89e0ffeed
2015-01-30 16:12:21 +01:00
Vojtech Bocek
ecd8918634 Use macro to add actions to the action map
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: I283b33087817eb87dae916a3183a9024dd35effd
2015-01-29 15:34:52 +01:00
bigbiff
7abc5fe195 Add cancel backup capability.
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-27 15:07:19 +01:00
Dees Troy
3454ade92d Use /twres instead of /res for theme resources
AOSP and other ROM trees now do a rm -rf of the res folder during
the ramdisk creation process that removes the TWRP resources.
Using /twres instead of /res works around this issue making TWRP
more compatible with AOSP and other build trees.

Change-Id: I0d4c7e06ca381ac5aa0069b6f2b8c47f7dec49e7
2015-01-22 15:21:27 -06:00
Ethan Yonker
d9ff3c5dd0 Hide some non critical error messages
Change-Id: I6e43242e44ce63cea9472c75a9f7fedf1b34fbbe
2015-01-22 17:57:29 +01:00
Ethan Yonker
cf50da5742 Fix handling of custom themes after decrypt
Loading a custom theme from the decrypt action was preventing the
runPage function from exiting. This moves the loading of a custom
theme out of the action.

Change-Id: I86904b63a67a25ded56e3e1e569fe906264dc055
2015-01-12 22:08:35 -06:00
Vojtech Bocek
e979abd6cc Fix some crashes during theme (re)loading
Change-Id: I01405fbe86a48ae79f2cbe633b89f2dcfb1ef266
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2015-01-12 20:23:37 +01:00
Vojtech Bocek
85cfb7d7b7 Fix some actions being incorrectly threaded
Change-Id: Ic8406344994ef2a9972207f9281b52e64e22826b
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2015-01-12 20:11:09 +01:00
that
fb759d45f5 gui: simplify blanktimer
- get rid of separate thread, check timer in rendering thread instead
- use an enum for the blanking state instead of magic integers
- move #ifdefs for TW_NO_SCREEN_TIMEOUT inside blanktimer class
- move some #includes and enum TOUCH_STATE to pages.hpp

Change-Id: Id4b104e3680dc5db41d8ba85e32d722cf4086299
2015-01-11 12:16:53 +01:00
Ethan Yonker
0d47eb5686 Improve GUI handling of zip flashing
- change the page sooner so that users cannot activate the slider
  twice
- improve GUI messaging if a zip requests a cache wipe
- move update of the file count to the end so it is less visible
  to the user (e.g. during a cache wipe the counter should not
  read 0)

Change-Id: I5d478f07effe61ca37f3521a77c9e9243a9cb692
2015-01-09 23:07:25 +01:00
Ethan Yonker
96af84a409 Allow flashing of images via the GUI
- 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-09 23:07:07 +01:00
that
7d3b54f3c2 gui: fix action threading if background thread is busy
When the background thread is already running and we have at least one
threaded action in the list, we should not run any non-threaded actions
before ignoring the threaded action and following ones - it might cause
invalid state variables to be set. Run or ignore the whole list in the
background thread instead.

Change-Id: Ie634105b80f038893898a21539886bd757eb47ce
2015-01-09 22:52:51 +01:00
that
c608548633 Run some actions in a separate thread
Some actions need to be threaded so we will run those in a
separate thread and deny requests to thread more actions if new
requests come in while a thread is already running.

Change-Id: I966c538e67860a6d8fe556e5a2eb7f7d1a987e74
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2015-01-09 22:12:43 +01:00
Ethan Yonker
24e7eb73ce Thread openrecoveryscript action to properly display action page
The action page fails to display properly during ORS processing
unless we thread the ORS action. Based upon the work done in this
patch set by _that:
https://gerrit.omnirom.org/#/c/11226

Change-Id: I6dac790ac26d9b3a02df778516fea011d67aea70
2015-01-04 19:41:10 -06:00
that
cc8ddca9bd fix adb sideload
- "Cancel" button handling requires another thread
- simplify handling of child pid
- merge duplicated code for reinjecting TWRP after installation
- fix error that showed on host PC after sideload finished
- fix problem where adbd sometimes does not stop correctly

Change-Id: I536877f024b606756c6a3289c6ddfdba423a60d6
2015-01-03 22:34:48 -06:00
Ethan Yonker
d83c9ea371 Fix GUIAction::operation_start
We need to set the value of tw_operation_state a little sooner to
make the decrypt page work correctly. Without this change, decrypt
would incorrectly display the main page during the first decrypt
cycle. This fix may also fix ORS and possibly other things that
use the runPage function.

Change-Id: I85ad6e4add6726a2746eeb7116f3eab3f7ff5d84
2015-01-02 21:23:22 -06:00
that
3f7b1aced8 gui: Move action functions to function pointer map.
This allows the functions to be more readable and make
doActions readable.

Patch set 5: gui: remove threading in GUIAction

Multiple actions were started in another thread that was joined
immediately after starting it, so the input thread was blocked anyway.

Selected single actions were started in their own thread, but this
caused bugs like being able to install the same package twice in
parallel by quickly swiping the slider twice.

Change-Id: I28adadaedd032efc7bff3aaa48e659627aa3a3b3
2014-12-30 11:30:13 +01:00
Ethan Yonker
726a020632 MTP add/remove storage instead of disabling MTP
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-19 16:27:34 -06:00
Ethan Yonker
5216bef553 Toggle MTP during ADB sideload
Windows does not do very well if you try to sideload while MTP is
enabled due to drivers. This will toggle MTP off and back on if
MTP is currently enabled before and after a sideload operation.

Change-Id: I022dbedecc97565b50b6ae1fda8922b822f63440
2014-12-18 21:18:15 +01:00
Ethan Yonker
4b94cfd391 Attempt to set the proper uid/gid/contexts on new files and dirs
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-12 09:20:42 -06:00
Ethan Yonker
24813426b9 Update adb sideload feature
Change-Id: Ib503d0e87434e1a28430779302d6565211c26592
2014-11-07 17:25:46 -06:00
Ethan Yonker
57e3587b8e Fix zip install
We never used the feature for running a custom theme during zip
install. We can re-implement this later if we like. For now, we
will remove this feature until we are ready to make it work.

Change-Id: Ice71b0b863c7ef17376e3f973d48b810be567c33
2014-11-07 14:54:20 -06: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
jrior001
aad03116ed Refresh after partition changes
Change-Id: Id16c84f815b1c4b8e95da142648a5a759116ee6e
2014-07-07 20:59:07 +02: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
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
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
Ethan Yonker
45312e551f Allow sideloading from /tmp
Change-Id: I7ba9a8a496536ed55241e45e18297bd824d7e28c
2014-02-26 09:23:53 -06:00
Ethan Yonker
8214f0ae64 Remove some unneeded code
Change-Id: I52b34a316950e92a3aa4c1675475fca8dc08d2c8
2014-02-16 15:15:34 -06:00
Vojtech Bocek
072205626c Cache results of GUIObject::isConditionTrue()
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: Ia50f7c365b2dc0a65ee046bb42972e3594264878
2014-02-12 19:19:32 +01:00
Vojtech Bocek
ede51c528e Conditional -> GUIObject and make all gui objects children of GUIObject
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>

Change-Id: Ic0a7d6354dabe5919b83942f2f1aa0715625e522
2014-02-12 18:30:41 +01:00