Commit Graph

124 Commits

Author SHA1 Message Date
Captain Throwback
e331b8a1b7 tw_crypto_pwtype: move default setting to data.cpp
Change-Id: Id3dda3bc2c32ad286b1ec67595f482f84b5077d7
2022-01-10 21:21:16 +00:00
bigbiff
ab76bd7324 vab: correct default properties when vab is enabled
- do not show vab options in advanced
- do not perform merges when vab is disabled

Change-Id: I20997eca515600cb07fe896305b861ee9418c326
2021-10-16 16:29:46 +00:00
bigbiff
b640d972a6 readonly: fix condition showing readonly checkbox
Non dynamic partition devices need this if accidentally
turned off.

Change-Id: I0a212a8fc6446dfa6d82cf1103f4e4e80e680f89
2021-10-13 17:35:31 +00:00
bigbiff
13017c6e35 version: don't show as error if we cannot write the version string
Change-Id: I0f90337b22f1c3392eb5bc7b846d60df82a4af8b
2021-10-01 22:35:58 +00:00
Captain Throwback
bc2cfa36ec Add exclusion criteria for "Fix Recovery Bootloop"
Should only be included on devices that use initramfs,
i.e. legacy SAR, recovery-in-boot

Change-Id: I2408fcd993e1e381f49b3d5ae860694b2fade4d2
2021-09-16 10:42:06 -04:00
Captain Throwback
529789380b copy log: add option to include logcat
Change-Id: I9689df4560d5209f385fbbc3e233859754b3ebbd
2021-09-07 03:03:16 +00:00
nebrassy
ac29e691d8 Add an option to one click flash current booted TWRP ramdisk
Change-Id: I12303696698a5feaa43401bcac9e30d5b3b99a0c
2021-08-09 23:05:14 +00:00
bigbiff
cfa875c4d4 vab support: merges and unmapping super devices
- check for merges before formatting data
- add advanced option for unmapping super devices

Change-Id: I38d4d3bbdfa071969016c3e000c86a4d03c71e45
2021-08-09 23:04:33 +00:00
epicX
9597b840bc Normalized digest check before installing zip
Change-Id: I5a3e82f103e7a80800be7790f1c8dc33c76413da
(cherry picked from commit 646f4f0c66a918f12e12784b22e7dc9a89837c37)
2021-06-06 13:54:41 +00:00
epicX
8f52c0a73d Added support for flash image in both slots
Change-Id: Iafda62a5f77f7c1f564f1a2ec0a59aefaf5e1266
2021-03-07 18:34:03 -05:00
epicX
a721f955f7 Add support to change TWRP Folder
Change-Id: Id3b3b46d492bf83d1d9d3f535c880ea9d15b4107
2021-03-03 20:04:57 -05:00
Captain Throwback
16dd81b500 nano: Add File Manager option to edit selected file
Change-Id: Ie7d940545569e6de976d2a51666b692f3fc23798
2021-03-03 20:00:51 -05:00
bigbiff
df8436b51a fastboot: implement fastbootd in twrp
fastbootd is a userspace daemon that runs in the recovery
ramdisk. It allows writing single partitions to the super
partition via fastboot CLI. When TWRP sees the fastboot option
in the misc partition during startup, it will start with
the fastbootd page and fastbootd running. Otherwise it will
run recovery normally.

Change-Id: Id7b12d29ef21dbd5950dc884dd1cd788f25357f0
2020-10-21 17:47:27 -04:00
bigbiff
ad58e1bfae repack: move sbin to /system ramdisk and update repacking
for android-10

This will support updating the ramdisk to a different
compression format and co-exist with magisk.

We are also cleaning up and removing non android-10
api makefile actions.

We are also moving twrp repacking to its own class. We
check the new ramdisk format and if it's different
we have magisk compress using the new ramdisk format.

Change-Id: I770030aae7797e75817178b2f0fccd9f39dc23af
2020-09-08 10:08:33 -04:00
bigbiff
aac58612ea persist logs: remove persist from available log directories in
partitions.

Too many problems have been reported for TWRP attempting to store
logs in the persist partition. Selinux denials have caused issues
booting Android, and filling up persist has caused IMEI issues.

This patchset will remove persist from the list of available log
directories by default in order to avoid these and other possible
issues.

Change-Id: I29889d69f76270a8fbb764a79be3523821d8579c
2020-08-30 18:16:35 -04:00
bigbiff
25d25b9e67 log storage: change AB device log storage to /data/recovery
This patchset is now exlcuding /data/cache from backup, and removing it
from the wipe exclusion list to prevent errors on restore and wiping
/data.

This patchset changes the directory from /data/cache to /data/recovery for TWRP
to store logs and other file information. This will help with AB
devices that don't want recovery to mess with /data/cache.

This patchset will make ORS use /data/cache for AB devices.

Remove policy code because we don't need to set a policy for the
recovery directory.

Change-Id: I1d140276314fd34804a72297d6e25a52e58210a0
2020-07-07 00:55:42 +00:00
bigbiff
7ba7500953 decrypt: AOSP 10 requires the use of fscrypt
fscrypt aosp doc: https://source.android.com/security/encryption/file-based
kernel fscrypt doc: https://www.kernel.org/doc/html/v4.18/filesystems/fscrypt.html

This commit implements the ability for TWRP to use fscrypt to decrypt
files on the fscrypt implementation. It has been implemented mostly
in a new successor library to e4crypt called libtwrpfscrypt. Most of the
code was ported from AOSP vold.

Notable updates include:
 - updated policy storage by libtar
 - lookup of fbe policies by libtwrpfscrypt
 - threaded keystore operations

Big thanks to Dees_Troy for the initial trailblazing
of encryption in TWRP.

Change-Id: I69cd2eba3693a9914e00213d4943229635d0cdae
2020-06-22 12:17:22 +02:00
Mohd Faraz
f9ded0665b fix flashing issue after restore policy issue
* since commit: a2bd7b7758
   after factory reset /data/recovery doesn't recreates in A-only devices.

 * so fixes issue flashing newer roms need access to /data/recovery

Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
Change-Id: I02cb67f7161571b1aa02784049231d42872a3587
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
(cherry picked from commit bcbe94e2b5ef83fe65a5c9767287802365b5ee4e)
2020-06-10 14:24:25 +00:00
bigbiff
ee7b7ffba4 super partition: mount super partitions using fs_mgr
We are now requiring fstab v2 for android-10+ trees. You can
specify twrp flags using /etc/twrp.flags to label and
annotate partitions.

This patchset uses fs_mgr to load the super partition and build
device mapper blocks off vendor and system depending on the slot
in use. These are mapped to partitions in TWRP and allowed to
be mounted read-only. The super partition is also mapped into a
TWRP partition in order to backup the entire partition. You cannot
backup individual device mapper blocks due to the device can only
be read-only. Therefore you cannot write back to the device mapper.

Change-Id: Icc1d895dcf96ad5ba03989c9bf759419d83673a3
2020-06-08 20:37:29 +00:00
Chaosmaster
d5364a0b21 Rework progressbar logic, implement scoped/split progressbar
Rework progressbar according to AOSP, this should fix various
issues with progressbar.

From AOSP:

   progress <frac> <secs>
       fill up the next <frac> part of of the progress bar over <secs> seconds. If <secs> is
       zero, use `set_progress` commands to manually control the progress of this segment of the
       bar.

   set_progress <frac>
       <frac> should be between 0.0 and 1.0; sets the progress bar within the segment defined by
       the most recent progress command.

Change-Id: I7f92359046288f3529cb2e98e6d54d410a248f1d
(cherry picked from commit ab16437de14fd9f1203b7e0ce82ea18eb56cae78)
2020-05-19 14:45:22 +00:00
Chaosmaster
ff4f958182 Add option to automatically unmount system before installing ZIP
This adds the option to automatically unmount the system partition
before installing a ZIP-file.
This option is enabled by default, This is usefull on SAR-devices
where system is mounted as system_root and ZIPs (i.e. Magisk)
try to unmount system instead of system_root and fail to install.

Change-Id: Id94ae658964679e23aa7fa137e07edf74ee073df
2020-05-10 15:43:55 -04:00
Ethan Yonker
76bbd3a11a Add option to uninstall TWRP app from /system
Change-Id: Ibe372a372333c357810be2afcb3796723ca370cb
2019-05-16 19:07:06 +02:00
Ethan Yonker
53796e7333 Use magiskboot to repack the boot partition
Set TW_INCLUDE_REPACKTOOLS := true

Must also have:
AB_OTA_UPDATER := true

Use magiskboot and provide GUI options to allow users to repack
their existing boot image to install TWRP (or kernels) so we can
stop having to provide installation zips for AB devices. There is
also an option to try to fix a recovery bootloop if the kernel
has been patched to always boot the ramdisk for root, etc.

You will need to pull the below repo into external/magisk-prebuilt
https://github.com/TeamWin/external_magisk-prebuilt

Change-Id: I74196cc6f095a7576d61886dc96cbc18deba9b04
2019-04-03 16:44:00 -05:00
bigbiff bigbiff
e4bdb15a5f AB Cache dir: If device doesn't have /data/cache for FBE, we should
try /persist if in the fstab.

Change-Id: I70dd19538b7f9b8cf61c46f6c8167057eec3342b
2019-04-03 02:08:39 +02: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
bigbiff bigbiff
3ed778ad63 Vibration: allow BoardConfig to disable vibration for a device.
Change-Id: Ibd2f67391ce6d7774498839829e0de9391508781
2019-03-17 22:39:00 -05:00
big biff
cbd8cc5e06 Merge "Add option to use ro.serialno for generating device id" into android-9.0 2018-12-24 01:45:46 +01:00
lambdadroid
fc0b16df8b Add option to use ro.serialno for generating device id
On some devices (e.g. ASUS Zenfone) the serial number of the device
is stored in a file in the /factory partition. Consequently, the only
way to load it is using a user space application during the init
process, and to update the ro.serialno system property.

In most places, TWRP already uses the system property to get the
serial number of the device. However, when generating the device ID
used for the backup folder name it checks the boot command line
directly. On these devices, the serialno is not included on the
command line.

Add a TW_USE_SERIALNO_PROPERTY_FOR_DEVICE_ID option that enables
usage of ro.serialno for generating the device id. It is disabled
by default to avoid changing the device id on existing ports.

Change-Id: I4a2eeca883f38fdaeb1209507fd8ebe44b1b04a0
2018-09-26 23:53:28 +02:00
bigbiff bigbiff
9ee4a8577e Fix sha2 generation persistence.
Change-Id: I8342ee36f996a0305632bdb6eb8b20ae4e93873b
2018-09-19 19:15:06 -04:00
nkk71
98fc399c26 Use /persist as Qualcomm time fix source during early boot
* /persist can be mounted early while TWRP is parsing the fstab so
  as soon as the partition is parsed, mount and adjust the time
  accordingly.

* Store a backup settings file on /persist. Having a 2nd copy of
  the settings file in the /persist partition allows for early
  reading of the file and adjust timezone and brightness to user
  preference while still on TWRP splash.

* Add the qcom ats time offset in TWRP settings file and use it
  if no better ats file is found. This will also allow devices
  with a persist partition, but no ats files in it, to adjust
  the time offset during early boot.

* Use /persist/time/ as Qualcomm time fix source, based on
  Xuefer <xuefer@gmail.com> patch:
  https://gerrit.omnirom.org/c/27265/
  https://gerrit.omnirom.org/c/24384/

Change-Id: I6c21538eec58d87edfb639d9ce3871f33b886c1d
2018-01-17 20:42:17 +01:00
jason972000
adae336c1c Default to device backup/restore vs. adb backup/restore
Change-Id: I81bfea1e9978dd003e96a48f399d259a878ddc44
2017-12-08 09:12:11 -06:00
nkk71
b4c3591306 Auto detect possible use of legacy props
* Revert: Make legacy props an option disabled by default
  (reverted from commit 75aa615767)

* Instead check for ANDROID_PROPERTY_WORKSPACE in the updater-
  binary to determine whether legacy property service can be
  used

Change-Id: If68d5cca9a2b56edcb1c73db0474668cf46d8c91
2017-11-17 23:49:11 +01:00
Ethan Yonker
75aa615767 Make legacy props an option disabled by default
Change-Id: Id0bb17ebd11e120b4676c41d6553e6a830ac7ee9
2017-09-08 12:17:53 -05:00
bigbiff bigbiff
56cf564658 twrpDigest refactor
This patch is to refactor twrpDigest using polymorphism
and inheritance to use the same call patterns for creating and
reading a digest. Now a library.
Use SHA2 from libcrypto. SHA2 is default if device has libcrypto.

Change string MD5 everywhere to use digest or Digest instead. Updated
string tags to digest. Translation will be required.

Switch out digest code into a driver class from partitionmanager.

SHA2 is better for digest creation due to decreased collision space
compared to MD5 and SHA1.

See https://en.wikipedia.org/wiki/SHA-2

Change-Id: I74b5546789990b12aa4ce2e389d25f80a3fe213f
2017-06-17 07:05:45 -05: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
b4bff5e9d1 Add TWRP app install via TWRP recovery
Note: I will have to add a build flag for excluding the app later for
watches and maybe Android TV. I will also have to add support in the
tablet and watch layouts later. I will merge this for the initial roll out
to select devices and finish up later.

Change-Id: Ia4ce5522fae542afa1539b10c0691315392a19ab
2016-12-16 17:02:16 +01:00
Ethan Yonker
1b190166eb Add boot slot support
Change-Id: I7eaf80e327985f53791f90fbdebad022a9650d31
2016-12-13 14:04:48 -06: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
34ae483e02 Update to 7.0
Change-Id: I621cc47352f7ac552d9602485825ae3a6f9ae516
2016-08-24 15:32:18 -05:00
Matt Mower
8dc25b7984 Fixup reboot after install variables
* Create correctly named data manager variable 'tw_install_reboot'
* Make configurable through Settings
* Remove closing tag space in theme files (not personal preference,
  but should match surrounding code style)
* Fix the "two presses needed to enable" issue for the checkbox on the
  install screen

Change-Id: I0ceb60b4888a672e2f0ecb5672b03cc86615621a
2016-08-19 11:09:01 -05:00
Matt Mower
9a2a20503c GUI: Add countdown & cancel to install auto-reboot
Provide a countdown from 5 sec for the automated reboot after install.
Include a cancel button to interrupt the process.

Change-Id: Ib5e1447918adfde45eba361c088800812b690890
2016-08-19 11:06:34 -05:00
Matt Mower
bfccfb8822 Finish creating disable_free_space_check variable
* Create data manager variable for 'tw_disable_free_space'
* Make configurable through Settings
* Fix the "two presses needed to enable" issue for the checkbox on the
  backup screen
* No need to capitalize every word, but do specify precedes backup

Change-Id: Id436cef13e4ca9349618420aac03862ec4e3c35e
2016-08-19 10:35:10 -05:00
Ethan Yonker
fe91611cb1 DataManager Updates
The goal of this change is to make DataManager use InfoManager to reduce
code duplication.

Change-Id: Ia4f4c4324453a192995e0f442db0a03628c13e46
2016-03-31 15:43:53 +01:00
Ethan Yonker
eadfd2eb68 Fix storage selection with adopted storage
Change-Id: Ifcba4e668579c3684df9e47e1c3faf5f4d1f3e83
2016-02-18 22:04:18 -06:00
James Christopher Adduono
09f380dbcd Remove inexplicable checks for enabling/disabled UMS support
Removing these lines allows UMS to be enabled for devices with storage lun.
The checks don't seem to make sense as they are referencing always defined strings.

Change-Id: I75df9b7db5a790807fc2b5c946b271b103326b39
2016-02-15 21:47:41 +01:00
that
7a36a8c33c data: fix setting brightness at startup
Change-Id: Ibc4c4cc209c5f5f1a332fddcb450f983dc1a666a
2016-01-29 00:01:43 +01:00
Ethan Yonker
fbb4353a24 Update minuitwrp graphics in line with latest minui
Note: events.cpp is still old code renamed to cpp to make it
easier to call functions like gr_fb_width().

I had to modify AOSP fbdev code to provide a separate memory
surface for drawing to as drawing directly to the framebuffer
resulted in rendering taking about 5 times longer.

I also modified AOSP adf code to provide a separate memory surface
for drawing for the same performance reasons. The Nexus 9 supports
adf graphics.

Overlay graphics work on at least one device. Overlay provides a
separate memory buffer already so performance is good.

I do not have a drm device yet that I know of. I made some attempt
to update the drm code to determine the correct pixel format based
on the drm graphics format, but what is available in pixel flinger
and what is available in drm do not line up all that well. Reports
are that the Pixel C is using drm graphics, but performance is
slow, likely due to the use of a mmap instead of a memory buffyer.

Change-Id: Ibd45bccca6ac2cb826037aa9b2aa5065cf683eed
2016-01-27 10:53:13 -06:00
Ethan Yonker
66a1949df9 Adopted Storage support
-Detects, decrypts, and mounts an adopted SD card if a
  secondary block device is defined (usually mmcblk1)
 -Handles unified storage
 -Displays the adopted storage in MTP along with internal
 -Factory Reset - wiped just like a data media device, we
  retain the keys folder and the storage.xml during a
  factory reset
 -Backup / Restore
 -Disable mass storage when adopted storage is present
 -Read storage nickname from storage.xml and apply it to
  display names in the GUI
 -Read storage.xml and determine what storage location is in
  use for /sdcard and remap accordingly

libgpt_twrp is source code mostly kanged from an efimanager
project. It is GPL v2 or higher, so we will opt for GPL v3.

Change-Id: Ieda0030bec5155ba8d2b9167dc0016cebbf39d55
2016-01-25 23:59:17 +01:00