Commit Graph

83 Commits

Author SHA1 Message Date
Noah Jacobson
0b25b1d79b Add support for multi-user decryption
* Add CLI support using the command "twrp decrypt <PASSWORD> [USER ID]"
* Add GUI support using the menu Advanced --> Decrypt User

Change-Id: Id2681bc2b1012a0571417f7a6e0b980b1b25c61c
(cherry picked from commit 5a79f67a1b1bd1bcadeca0a4896a871646652534)
2020-05-20 19:11:15 -04:00
bigbiff
437b93a087 Merge remote-tracking branch 'origin/android-9.0' into android-10.0
Change-Id: Ie850f431f0d2c39c86b9c10701676a24770ab447
2020-05-10 20:06:41 -04:00
Mohd Faraz
0d9a62e409 Remove Extra spaces occured while using multiline string variable
* On multiline string variable it adds spaces

Change-Id: I0f9140f3840b0238009af2271ac67b25754f76c9
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
2020-05-10 21:24:00 +00:00
Chaosmaster
01a17998da Add flag for overwriting properties with system values
This adds the flag TW_OVERRIDE_SYSTEM_PROPS which can contain
a ";" separated list of properties that should be overriden.

A different source property can be defined by separating
target and source using "="

Example:

TW_OVERRIDE_SYSTEM_PROPS := "ro.build.product;ro.build.fingerprint=ro.system.build.fingerprint"

This will override ro.build.product with the value of ro.build.product from system/build.prop.
And also override ro.build.fingerprint with the value of ro.system.build.fingerprint.

with their corresponding values from the system partition.

Change-Id: Ibcd3e6ed51fa7f7195ad524e606a2b9542687e55
2020-05-10 21:19:32 +00:00
Chaosmaster
f6e42ce390 Implement autodetection for SAR, based on the installed system
This will detect whether SAR is present in the currently installed
OS and set the property ro.twrp.sar accordingly.
After setting the property it will call the bootscript
/sbin/sarsetup.sh (if present) to give device maintainers the
option to do setup operations depending on SAR-status, such
as modifiyng the fstab.

If no system is detected and AB_OTA_UPDATER is defined or built with
Android 10 and upwards, it will fallback to using SAR, otherwise it
will use ro.build.system_root_image as basis for deciding whether SAR
is required or not.

The property ro.twrp.sar will also be used by
TWPartitionManager::Get_Android_Root_Path()

This allows maintaining a single TWRP-build for devices switching
to SAR for Android 10.

The default behavior (when no system is installed)
is determined by the build-flags AB_OTA_UPDATER and
BOARD_BUILD_SYSTEM_ROOT_IMAGE

Change-Id: I2a48c6c81a6ea6fad6e452c06bfbe4d9da0f1e5c
2020-05-10 15:43:56 -04:00
bigbiff
d58ba18272 AOSP10 TWRP Merge: fix conflicts and update libraries needed
This allows flame to boot TWRP. Still will need to work on
super partition for vendor and system access.

The plan will be to cherry-pick any updates to android-9.0
through gerrit.twrp.me to this branch as a WIP.
2020-03-23 11:18:29 -04:00
Captain Throwback
f8d0e2156e openrecoveryscript: do not skip decryption even if using block.map
- Allows addon.d scripts to run that require access
  to decrypted /data (e.g. Magisk). Seems to also affect
  GApps addon.d script, resulting in non-booting system
- If decryption prompt is canceled, installation will
  still proceed (i.e. on devices where TWRP doesn't
  support encryption)
- Should resolve
  https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1478
  and possibly
  https://github.com/TeamWin/Team-Win-Recovery-Project/issues/1459

Change-Id: Idcd397aa145577c409d5174ae3f9c48474e5734b
2020-03-08 00:31:54 +00:00
mauronofrio
e9a49efe75 Adding Edl button in reboot menu
Edl mode is available only on qualcomm devices and it used to fully
restore the bricked devices. I made the button available only if
TW_HAS_EDL_MODE := true like the download button. I set the edl
button to the right of the download button, so devices can support
edl button and download button. I also added the translation for
all languages.

Change-Id: I69d1058b8c050b722395c7b3da6dce1ccfbe7a91
2019-03-20 10:57:07 -05:00
bigbiff bigbiff
19874f1469 AB/Non AB Devices: updates for moving cache
This patchset updates all the places we touch cache on AB devices
and non AB devices so that we can write to the appropriate
location. AB devices removed the cache partition and moved it to
/data/cache.

Change-Id: I485ec205a604f1f07ceb7700ae9c4e720fd55c3e
2019-03-18 04:49:38 +01:00
Captain Throwback
9d6feb5311 twrp: use ANDROID_ROOT environment variable
instead of hard-coded /system path

I updated most of the references I found,
but there might be more

For devices that have to mount system at /system_root,
this allows system to be bind mounted to /system
and detected properly by TWRP

Change-Id: I9f142fd8cec392f5b88e95476258dab9c21a9aac
2018-08-24 12:47:45 -04:00
Ethan Yonker
a344ac6f26 Fix installing OTAs without decrypting
Change-Id: Ica0c4033bc7148b1313b1671e91c5b92b09064c6
2018-07-27 19:03:09 +02:00
Ethan Yonker
fa67cbf18b Remove SuperSU
Change-Id: I2ca7580bbde5a8903b9ba5c1513ddba887e8d49e
2018-07-20 13:45:16 -05:00
Gabriele M
72638b6437 Skip decryption when installing mapped zips
Decrypting userdata is not needed when installing zips if we have
a map of blocks to read, so skip the decryption. This allows to
install zips with no user interaction and, more importantly, it
allows to install zips on devices where TWRP can't properly decrypt
userdata.

Remove also the unneeded Mount_All_Storage() call, Install_Command()
already mounts the needed partition.

Change-Id: I91c69f84ecc2fe41c9567c40649e501af1cfb64a
2018-05-25 18:13:47 +02:00
Ethan Yonker
53273ecce9 Don't rename twrp.fstab to recovery.fstab
update_engine_sideload reads /etc/recovery.fstab during its install
process and the twrp.fstab format may not be appropriate for what
fs_mgr expects.

Change-Id: I059ef22c0e862e60a3bffe5259f70c714fe33ec6
2018-03-09 11:22:57 -06:00
bigbiff bigbiff
19fb79c722 ADB Backup: add ability for TWRP GUI to restore
Restore adb backup files that TWRP made to your PC.
Put files in your backup directory to see them.

e.g. /sdcard/TWRP/BACKUPS/<sn>

Change-Id: I2c57970d77b64c39a302159041456e761c185259
2017-11-27 09:32:30 -06:00
Ethan Yonker
8373cfe28c Update to AOSP 8.0 base
Change-Id: I29fe722b4eb9718765327902779046840a01433e
2017-09-08 07:14:59 -05:00
Ethan Yonker
84d61ce31c Update TWRP to AOSP 7.1.2
Change-Id: I19c1546efb4182aac62c690e3cc05b04e3a9a32e
2017-05-10 16:11:35 -05:00
Matt Mower
653a170935 Tweak MTP startup routine
* As a precaution, (non-permanently) disable MTP if TWRP crashes.
* Remove a duplicate logging of 'Starting MTP'.
* Combine and improve readability of conditions before MTP starts.
* Remove unnecessary Disable_MTP() call if conditions unsatisfied.

Change-Id: I61ac772fc123da5b84c3061fbcf2116531bc4e2f
2017-02-24 03:10:17 +01:00
Matt Mower
e07f010963 Fix handling of USB config during MTP switching
The property set of sys.usb.config was not part of the original 'Only
change USB mode to mtp when ready for MTP' commit. Further, it adds an
additional USB off/on toggle to the MTP startup routine, potentially
confusing the host computer. The default init.recovery.usb.rc already
sets the usb functions to 'adb' during 'on fs'.

It is possible that devices could run into issues with MTP startup due
to sys.usb.config not yet being set. This is actually due to a poor
design decision in Enable_MTP(), where sys.usb.config would not be
configured for mtp if sys.usb.config had never been set. It is not
necessary to check for a previous value, just set it.

Fix the USB PID for adb-only mode in Disable_MTP().

Change-Id: I21b5e64c9bdcd3104372a8b4eb8ea50cf4561892
2017-02-23 19:21:33 -06:00
Matt Mower
a8e6d83155 Do not unconditionally remove MTP storage on unmount
* It is not necessary to Remove_MTP_Storage() for a partition if an
  MTP_Storage_ID has not been assigned.
* The hack to force-set tw_mtp_enabled=1 should no longer be necessary
  now that we're checking whether MTP really needs to be disabled for
  a volume before running Disable_MTP().

Change-Id: I1b7233eedd9da7c6be0c67fc60243f3837105173
2017-02-23 19:42:48 +01:00
Matt Mower
84830ce015 Only change USB mode to mtp when ready for MTP
Commit 'Do not toggle USB ID during MTP startup if not needed' changed
the default USB mode to 'mtp,adb'. Depending on the device, this can
result in an unfortunate side effect of crashing an ORS sideload
midway through the process (it's not clear to me whether the kernel or
the connected computer is responsible). Only put USB into mtp mode
when MTP storage is starting-up.

The hack to change the USB mode to adb when a user compiles TWRP
without MTP support is no longer necessary now that 'adb' is the
startup mode.

Change-Id: I8ed13d6ab8e85621533997b8c37ef7ebec0fcf85
2017-02-23 12:30:59 -06:00
Matt Mower
3626bdc800 bldrmsg: Only emmc /misc is supported
Change-Id: Ic0716557a87ec0638e2dbed1c3f743231e8b2f8e
2017-01-18 21:10:34 +01:00
Matt Mower
874136434a SELinux can be assumed for Android 4.4+
Change-Id: I7410a0c8e439eec90a955ee9201efd9a92bb9635
2017-01-18 12:40:26 -06:00
Matt Mower
23d8aaef29 Unused variable cleanup
Change-Id: I2397d0bd221dcf5c9d0f971ba157519bcf014a70
2017-01-18 17:50:05 +01:00
Matt Mower
a8a89d1961 Whitespace cleanup
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
2017-01-18 17:41:17 +01:00
Ethan Yonker
ff2b7881c9 Change handling of /cache due to AB devices not having cache
Change-Id: Ia9b97ed19eb3d400d9d399255108cac79361bca4
2016-12-13 21:26:57 +01:00
Ethan Yonker
3fdcda4662 Improve backup & wipe exclusion handling
Rename twrpDU.* to exclude.*
Remove global variable for du and replace with partition specific
variables.
Use separate exclusion lists for backups and wiping.
Clean up some includes
Fix some parenthesis in twrp.cpp that I messed up.

Note: twrpTarMain command line utility compiles but probably does
not work correctly yet due to not properly setting part_settings

Change-Id: Idec9c3e6a8782ba53f3420fa79ba33394f4f85fb
2016-11-30 13:19:08 -06:00
Ethan Yonker
b523650c8e Update to android-7.1 2016-11-29 21:27:39 -06:00
Ethan Yonker
534d4e0612 Fix compatibility across the board
Change-Id: I6376920775ddabb4d4af505fffd86e404403a64a
2016-08-26 10:05:03 -05:00
Ethan Yonker
f117962eb2 Make it backwards compatible with 4.4
Change-Id: I668604cddc8e8afbf78709f3f872bea4e9f4aa06
2016-08-25 15:36:13 -05:00
Ethan Yonker
34ae483e02 Update to 7.0
Change-Id: I621cc47352f7ac552d9602485825ae3a6f9ae516
2016-08-24 15:32:18 -05:00
that
0e2140e931 Add git revision to startup message in recovery.log
This should make it easier to find the exact source for
a specific version of the binary.

Change-Id: I7e04dd9a3205cc643150a588b69b4bd691212ecb
2016-08-22 16:46:09 +02:00
Ethan Yonker
051f47601b Check sdk version for M before offering to root
Change-Id: I269618510d2e6e360c1e9f72ed371729a1f2a76b
2016-01-18 16:47:35 +01:00
Ethan Yonker
3aa66be4f2 Append AOSP recovery commands inline
Appending the AOSP recovery commands to the ORS command file as
we process the commands will allow us to do things such as install
multiple zip files, wipe cache, etc and do the actions in the
order that those actions were originally requested.

Change-Id: I375c1ccd3976123b818f1f492e971e615ec28c91
2015-12-22 12:30:21 -06:00
Ethan Yonker
74db157b94 Multiple Language Support
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
2015-12-19 08:31:01 -06:00
Matt Mower
954601904a Fix short circuit on tw_mount_system_ro
Before mounting /system to check if supersu should be installed (a
feature which really needs to be stripped from TWRP), check if
tw_mount_system_ro is set to zero, not the other way around.

Change-Id: I38386b4c88fab112de5b6b752ecd4eed308efa5a
2015-12-02 06:10:40 +02:00
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