Commit Graph

47 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
Davis Mosenkovs
b909aae78f Fix minor interface bug: No-SU prompt after no-OS prompt
When /system is wiped in TWRP and afterwards Reboot -> Recovery is selected the "No OS is installed, are you sure you want to reboot?" prompt appears. After swiping to "Reboot anyway" the "Current ROM is not rooted, do you wish to install SuperSU?" prompt appears.
This change removes "Do you wish to install SuperSU" prompt after "No OS installed" prompt.

Change-Id: Ie1157afdf5cf1cb81d6647269172d6e63af9f4b0
2015-10-14 21:19:08 +02: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
Ethan Yonker
89583ef00f Fix up some TW_OEM_BUILD things
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-08-26 22:36:16 +02:00
Ethan Yonker
961d20e09c Make system read only show no matter what on first TWRP boot
Initial value for tw_mount_system_ro is now 2. If the value of
tw_mount_system_ro is 2 during boot, then we will show the system
read only prompt and ignore the value from the lifetime writes
check.

Note: Changed the value of FILE_VERSION which will trigger the
data manager to throw out previous settings and start with default
values so that existing TWRP users will get the prompt at least
once.

Change-Id: I447767b64617f855156a19a5dc15c4ece6dff7b8
2015-07-14 16:53:43 +02:00
Ethan Yonker
0e2c657cc8 Fix system read only behavior during boot
Change-Id: I90dbdd06465e2ddaaade86b930beff91991432eb
2015-06-09 21:45:07 +02: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
that
4e0e3fcfdb bootloader: align with AOSP code
- Define a minimal Volume structure so that AOSP code for handling /misc
  works in TWRP without major changes.
- Remove set/get_bootloader_message_*_name

Change-Id: Ifcee59568141a184adebb94b8ef8beca072a7942
2015-05-18 21:02:47 +02:00
Ethan Yonker
bc2bc6bb67 Fix reboot for some devices
Change-Id: I06caac2e80bd7eb311778796f974846e9ce844fa
2015-03-25 03:54:12 +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
Ethan Yonker
d9ff3c5dd0 Hide some non critical error messages
Change-Id: I6e43242e44ce63cea9472c75a9f7fedf1b34fbbe
2015-01-22 17:57:29 +01:00
Ethan Yonker
fd0439ed59 Move ORS command line into main thread
Also eliminate the mostly similar runPage function in favor of
using a single runPages function to avoid code duplication.

Change-Id: I46ef414beb4009fee16d4de13d8a5ab2b9678409
2015-01-22 17:51:57 +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
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
df7abac1a6 Do not toggle USB ID during MTP startup if not needed
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
2015-01-02 10:22:58 -06:00
Ethan Yonker
f9f99bcb62 Ingore SIGPIPE errors
If MTP exits unexpectedly, sending messages to add or remove a
storage device via Add_Remove_MTP_Storage was causing a crash.
Ignoring SIGPIPE allows us to more gracefully handle the error
instead of a total crash of TWRP.

Change-Id: I0a3f770f8b0f4bdbe10aa0ba857209b22b8668f7
2014-12-29 16:25:00 +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
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
Dees Troy
c8f58997e2 Fix process to disable stock recovery flashing
/system/etc/install-recovery.sh no longer exists on AOSP devices
so we will stop checking for it.

Change-Id: I9074dfc443371a27b909faa8f66998683cfb6171
2014-11-20 15:29:17 +00:00
Ethan Yonker
a167416289 Merge in lollipop and attempt to fix merge conflicts
This will probably not compile and may need additional work.
For tracking purposes so we know what might still need looking at
as none of this has been compiled and tested, here is a list of
the merge conflicts that I attempted to fix before pushing this
set of changes:

git pull aosp lollipop-release
remote: Finding sources: 100% (992/992)
remote: Total 992 (delta 473), reused 992 (delta 473)
Receiving objects: 100% (992/992), 1.51 MiB | 516.00 KiB/s, done.
Resolving deltas: 100% (473/473), completed with 42 local objects.
From https://android.googlesource.com/platform/bootable/recovery
 * branch            lollipop-release -> FETCH_HEAD
 * [new branch]      lollipop-release -> aosp/lollipop-release
Auto-merging verifier_test.cpp
CONFLICT (content): Merge conflict in verifier_test.cpp
Auto-merging verifier.h
CONFLICT (content): Merge conflict in verifier.h
Auto-merging verifier.cpp
CONFLICT (content): Merge conflict in verifier.cpp
Auto-merging updater/updater.c
Auto-merging updater/install.c
CONFLICT (content): Merge conflict in updater/install.c
Auto-merging updater/Android.mk
CONFLICT (content): Merge conflict in updater/Android.mk
Auto-merging uncrypt/Android.mk
CONFLICT (content): Merge conflict in uncrypt/Android.mk
Auto-merging ui.cpp
CONFLICT (content): Merge conflict in ui.cpp
Auto-merging screen_ui.cpp
Auto-merging roots.cpp
CONFLICT (content): Merge conflict in roots.cpp
CONFLICT (rename/delete): res-hdpi/images/progress_fill.png deleted
in HEAD and renamed in cddb68b5ea.
Version cddb68b5ea of
res-hdpi/images/progress_fill.png left in tree.
CONFLICT (rename/delete): res-hdpi/images/progress_empty.png deleted
in HEAD and renamed in cddb68b5ea.
Version cddb68b5ea of
res-hdpi/images/progress_empty.png left in tree.
CONFLICT (rename/delete): res-hdpi/images/icon_error.png deleted
in HEAD and renamed in cddb68b5ea.
Version cddb68b5ea of
res-hdpi/images/icon_error.png left in tree.
Auto-merging recovery.cpp
CONFLICT (content): Merge conflict in recovery.cpp
Auto-merging minui/resources.c
CONFLICT (content): Merge conflict in minui/resources.c
Auto-merging minui/minui.h
CONFLICT (content): Merge conflict in minui/minui.h
Auto-merging minui/graphics.c
CONFLICT (content): Merge conflict in minui/graphics.c
Auto-merging minui/Android.mk
CONFLICT (content): Merge conflict in minui/Android.mk
Removing minelf/Retouch.h
Removing minelf/Retouch.c
Auto-merging minadbd/usb_linux_client.c
CONFLICT (content): Merge conflict in minadbd/usb_linux_client.c
Auto-merging minadbd/adb.h
CONFLICT (content): Merge conflict in minadbd/adb.h
Auto-merging minadbd/adb.c
CONFLICT (content): Merge conflict in minadbd/adb.c
Auto-merging minadbd/Android.mk
CONFLICT (content): Merge conflict in minadbd/Android.mk
Removing make-overlay.py
Auto-merging install.h
CONFLICT (content): Merge conflict in install.h
Auto-merging etc/init.rc
CONFLICT (content): Merge conflict in etc/init.rc
Auto-merging bootloader.h
Auto-merging applypatch/applypatch.c
Auto-merging applypatch/Android.mk
CONFLICT (content): Merge conflict in applypatch/Android.mk
Auto-merging adb_install.cpp
CONFLICT (content): Merge conflict in adb_install.cpp
Auto-merging Android.mk
CONFLICT (content): Merge conflict in Android.mk
Automatic merge failed; fix conflicts and then commit the result.

Change-Id: I3e0e03e48ad8550912111c7a5c9a140ed0267e2c
2014-11-06 08:35:13 -06:00
Ethan Yonker
6277c79727 Attempt to automatically identify data/media devices
Change-Id: Ia3007fbced9ce3bc94efdb3dacc582a5e68a49a4
2014-09-19 22:34:09 -05:00
Ethan Yonker
12055fac83 Properly set mtp enable variable if disabled during boot
Change-Id: Iedf08419a1fd46908e5b9186a769a0497ce62ca8
2014-09-04 08:06:53 -05:00
Ethan Yonker
6f49e11d8a Prevent MTP enable on startup if crash detected
Change-Id: Ie1388a8acadf714a29721dd90c7f9a8aa38a860d
2014-09-03 21:42:49 -05:00
Ethan Yonker
73da42cb6e Ensure that MTP is enabled by default
Change-Id: Ibd644509935cde1e52b3d368060fdcb6e16f4a99
2014-09-03 11:30:33 -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
03a42f6c6a Add command line capabilities
Allows sending openrecoveryscript commands to TWRP via shell.
This may be handy for visually impaired users, for various one
click utilities to drive TWRP commands from a computer, for using
TWRP when a catastrophic hardware failure like a shattered screen
prevents you from being able to use touch, or even on devices like
a TV stick where touch and USB mouse input is unavailable.

This patch also includes a few minor changes to openrecoveryscript
including proper support for rebooting via the script and for
decrypting the device via the command line.

Change-Id: I796ad168efdd2da9c25334ac93d1079daaa7b0bc
2014-08-09 07:49:35 -05:00
dhacker29
30f100e3bc Only disable recovery flash if it is truly "stock" recovery
Some roms need the recovery-from-boot.p for auto update
 of recovery. Typically the use install-[romname]-recovery.sh.
 So only disable if install-recovery.sh is present.

Change-Id: I01f89afc87b9d375d67b44b8b5e9228868a47d69
2014-07-25 23:54:10 +02:00
Vojtech Bocek
67351dca66 Check the crash counter instead of date in TWFunc::Fixup_Time_On_Boot()
* Some devices (Sony) have RTC counting up from year 2009,

Change-Id: I2cf1928e1b05c7e8b184963f8130582e0319ddc4
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-07-09 15:57:59 +02:00
Vojtech Bocek
0fc1573730 Change ro.twrp.boot boolean to twrp.crash_counter
Change-Id: If1ef25fee5a138a90ccb4f0a70b20b55698e0d0d
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-07-09 15:57:09 +02:00
Ethan Yonker
bf2cb1c4d8 Color in the console
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-07-09 15:46:35 +02:00
Vojtech Bocek
2005a84b24 Run TWFunc::Fixup_Time_On_Boot() before OpenRecoveryScript
* Fixes possible issues with names of backups made with ORS

Change-Id: If8da1b3abb0960e527bb0eb3dd8a04d184aaea4d
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-03-11 19:40:34 +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
Dees Troy
8d0eb1361e Improve SELinux support check
If the kernel does not use SELinux security then the ramdisk
contents will not have contexts set on the files, however we may
still have everything we need in recovery if the kernel supports
EXT4 security labels, so we try to check /cache/recovery if it
exists first.

Change-Id: I96a4ae16418e07b0a2e83cd56e19893898d0b394
2013-12-19 19:06:06 +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
995e88cfbe Add check during boot for SELinux support
Change-Id: Ib02867c403d1baa665dfb1d4f3137204e64a813c
2013-11-26 21:39:14 +00:00
Kevin Steck
7b69e9d111 Skip the = or \n before grabbing Zip_File.
Change-Id: I0454f8fc3cbe037fac63ef5861f8f373e4654d49
2013-10-22 14:03:30 +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
f193f88e6d Make fixing su perms automatic
In 4.3+ with SELinux, su perms will be lost on every reboot so
users will get the prompt to fix su perms in TWRP every time. Make
fixing the su perms automatic instead of nagging the user.

Change-Id: Ia8a2652018db5e1f6ffc5fec2a4ac0db3a8f32bb
2013-09-12 09:11:32 -05:00
Dees Troy
b21cc64ca8 Pull ROM info from build.prop for backup names
Change-Id: I7847fca22b5d4f0a35da41625b15bd677a1e9768
2013-09-12 09:11:13 -05:00
Dees_Troy
1669f89dd2 Update to latest AOSP master
Merge in latest commits from AOSP master and fix merge conflicts
2013-09-04 19:00:58 +00:00
Dees_Troy
329383e593 Use twrp.fstab if present 2013-08-29 14:16:06 +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
a449a6f504 Fix handling of AOSP recovery commands 2013-04-07 17:53:34 -05:00
Dees_Troy
91862e618e Fix handling of subpartitions 2013-04-04 23:48:21 +00: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