Commit Graph

144 Commits

Author SHA1 Message Date
VDavid003
2034a41934 Fix typo in comment
Change-Id: I9b24d324fd61f2f0d2e85a9d123778557e14d63c
Signed-off-by: VDavid003 <virag.david003@gmail.com>
2019-10-18 22:43:20 +02: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
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
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
fa67cbf18b Remove SuperSU
Change-Id: I2ca7580bbde5a8903b9ba5c1513ddba887e8d49e
2018-07-20 13:45:16 -05:00
Ethan Yonker
6e8c27a52b Support v2 fstab format
Auto detect and support both the v1 and v2 fstab formats
Support putting TWRP style flags in a separate /etc/twrp.flags file

twrp.flags format is the same as twrp.fstab (v1 with TWRP flags)

Support using a wildcard in a block device and find all partitions:
/usb-otg vfat /dev/block/sda*

Support using sysfs entries (voldmanaged) and read uevents and scan for
wildcard partitions from uevent data. (twvold?)

May not be complete for some of the newer flags found in fstabs in newer
build trees and there is a slim chance of a crash if the user removes a
removable device while TWRP is performing actions. May need to add some
kind of mutex to prevent the 2 threads from causing this crash. We need
to start somewhere though and this change is pretty innocuous when not
using a v2 fstab.

Change-Id: I617d97c7db332cbe671a9d2b8ad98b3d9c4f03cc
2017-11-28 00:20:51 +01: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
64c5c0a9ba Add TWRP app install to landscape and watch themes
Change-Id: Id48245218dc3ee3c6506521ce0134e6a579b6f4a
2017-03-06 12:42:54 -06:00
Ethan Yonker
5128d299a5 Fix crash during check for TWRP app
Make sure that opendir succeeds before continuing.

Change-Id: I3c96002ab830f4df2041044d411a7bac42a5b8f4
2017-02-05 23:27:54 -05:00
Matt Mower
0c88b84681 Fill uid/gid for screenshots at compile time
It's not necessary to rely on the success of a call to getpwnam() for
the uid/gid of a file stored to sdcard (or external storage). Use the
definitions in system/core/include/private/android_filesystem_config.h

Change-Id: I979cfa0c74ecc927b88b0967cc56a66da237cc60
2017-02-03 05:32:00 +01:00
Ethan Yonker
5e1a7f932c Fix detection of TWRP app in /data
Change-Id: Icab9db0ceb63edba021cc190eea2ebbc87cf3442
2017-01-18 16:44:54 -06:00
Matt Mower
9472ba1d39 gui: Actions: Toggle backlight on power key
Create GUIAction to handle KEY_POWER with a screen backlight toggle.

Change-Id: Iad0a7923b4a776e0336722db74d6fc46cd0107a2
2017-01-18 19:55:33 +01:00
Matt Mower
23d8aaef29 Unused variable cleanup
Change-Id: I2397d0bd221dcf5c9d0f971ba157519bcf014a70
2017-01-18 17:50:05 +01:00
Matt Mower
029a82db6c Very minor code cleanup
Change-Id: Ie0b97da2cce7bb93307ed49b1138bc2f36df34d0
2017-01-18 17:49:23 +01:00
Matt Mower
a8a89d1961 Whitespace cleanup
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
2017-01-18 17:41:17 +01:00
Ethan Yonker
4767caf1f4 Fix compile error on 4.4 tree
Change-Id: Id85fdf0f4dee02f8ee3ae50ec42423c6a154a3eb
2017-01-11 10:45:04 -06: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
bigbiff bigbiff
bad332a3d1 Copy Kernel Logs
Give user option to copy kernel logs to current storage

Change-Id: I0c61122fb34826ddb08977e6cbf98e3adf477acd
2016-12-01 19:00:02 -05:00
Ethan Yonker
e080c1f8fb Fix image flashing
PS2: full_filename is not a dir

PS3: use a consistent format of always assuming directory
     is missing the trailing / + fix whitespace alignment

Change-Id: Ib963473ae10571b3d069b326d024ca04c7224dda
(cherry picked from commit fa4ff144374474c541351d153549ad11d4396614)
2016-11-30 16:27:07 +01:00
Ethan Yonker
dcf2b674c4 Clean up PartitionSettings
The PartitionSettings struct contains some data elements that are duplicates
of data elements in the TWPartition class that is contained within the
PartitionsSettings.Part element. We will eliminate this duplication to help
reduce the chances for programming bugs.

Specifically, this fixes problems where the current file system does not
match the backed up file system.

Change-Id: I02f236e72093362050556a2e53a09d1dbb9a269d
2016-09-13 14:53:37 -05:00
Ethan Yonker
f117962eb2 Make it backwards compatible with 4.4
Change-Id: I668604cddc8e8afbf78709f3f872bea4e9f4aa06
2016-08-25 15:36:13 -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
786d734a41 Remove curtainClose() remnants
Change-Id: I6ae96b60d34fa4e4b23cd1e5a4fffff3d00451c7
2016-08-01 20:41:37 +02:00
Matt Mower
25036b75ff Remove unused identifier from NotifyTouch
The 'state' parameter in GUIAction::NotifyTouch() is used in the
function.

Change-Id: I0744c7aa1542d771dbd2916638fbdd53e9681f86
2016-08-01 20:40:58 +02:00
Matt Mower
76b8afc4be Move cursor after appending date to backup name
* Send the cursor to the end of the input text

Change-Id: Id4f20717134cd38188cc1107f73dcd6bb995f377
2016-08-01 20:38:36 +02: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
bigbiff
a869fc79bc TWRP Install Reboot Option
This is a simple patch to allow users to reboot
after installation of zip queue. Current timeout
is 5 seconds before reboot.

Change-Id: I1a18cbf7025086e35031ab7241b330babebb8343
2016-03-31 13:34:49 -05:00
Ethan Yonker
b5fab76bea Replace fix permissions with fix contexts for emulated storage
Fix permissions rarely fixed anything on more recent versions of
Android and usually made things worse. Instead we will replace it
with a more dumbed down option that should fix contexts on
/data/media with a few improvements to ensure that contexts get
fixed for multiple users and on adopted storage.

Change-Id: If5523781936a0b04196e2ad871cae767ebae2583
2016-01-29 21:58:33 +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
Ethan Yonker
4adc33ebff Fix (Auto Generate) handling for backup names
Change-Id: I29f3823d03c005fb55a0e0a98818d40bd1eb039d
2016-01-22 16:08:07 -06:00
Xuefer
579e907d60 Android 6.0 needs permission +x to create screenshot files
Change-Id: Id4a6c04712238b86787696337874239591082d39
Signed-off-by: Xuefer <xuefer@gmail.com>
2016-01-22 18:50:07 +01:00
Matt Mower
3c36697b2d Fix a bunch of messages
* Find and rename/remove duplicate string variable names
* Add missing string variables to en language file
* Fix display of some strings missing @ in front of variable name
* Fix several %s --> {1}
* Be consistent in usage of cancelled vs. canceled (both spellings
  acceptable)

Tip for finding strings missing from language files:

1) Find all messages:
egrep -hr "gui_msg.+=" > /tmp/msgs.txt

2) Regex replace to trim them down
WHAT: ^\s+gui_msg(?:[^"]+)"([a-zA-Z0-9_]+)=([^"]+).+
WITH: $1
Note that $2 can be used to retain the message

3) Find missing strings:
for i in $(cat /tmp/msgs.txt); do
    if ! grep -q $i gui/theme/common/languages/en.xml; then
        echo $i;
    fi
done

Change-Id: Ic193162e4b5468bf027472928a370be39840ea1d
2016-01-22 05:29:04 +01:00
that
d4725ca147 gui: fix return value of NotifyKey
Only the last action got its keys and ate all of them (om nom nom).
This fixes the power button action that activates the lock screen.

Change-Id: Ia724568b159090c2c14a282cf3927915b2dc70e7
2016-01-19 00:15:21 +01:00
Ethan Yonker
9598c07d40 Do not require mounting during zip flashing if path exists
Change-Id: Ideb4bb39b5e864a43b62e807c38b6395c56a8466
2016-01-18 16:16:01 +01: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
that
8834a0ffc0 gui: add keyboard support for Ctrl layer and more special keys
- rename NotifyKeyboard to NotifyCharInput
- input: handle arrow keys in NotifyKey with standard KEY_* codes
- fix page handler to return 0 from NotifyKey if key was handled
- fix GUIAction::NotifyKey to not swallow all keys
- change home button code from KEY_HOME to KEY_HOMEPAGE
  (to avoid collision with Home/End, conforms to Android 3.0+)

Change-Id: Ib138afa492df8d0c1975415e8b5334c8778ccc90
2016-01-07 22:30:39 +01:00
that
677b13f74b gui: fix screenshot_saved message
Change-Id: I7d047fe3436100dbe7c7515860a143a97f7ef0d4
2015-12-29 23:46:19 +02:00
that
10ae24ff94 get rid of console thread for OpenRecoveryScript
- CLI commands run in a threaded action "twcmd"
- Console is displayed via "singleaction_page"
- move ORS execution code from GUI action to OpenRecoveryScript class
- remove unused function gui_changePackage
- don't change PageManager package in home action
- fix that /tmp/openrecoveryscript was not deleted after execution

Change-Id: Ic688c0b04647ce09e9db979b0bc5123f47cf4f70
2015-12-29 15:39:57 -06:00
LuK1337
62326f4107 Set twrp.action_complete after completing action
Change-Id: I078f0659696cc57564b5db0076a0ed9aaea822d4
2015-12-23 20:32:19 +02:00
Matt Mower
80f7b361f0 exfat: Build fsck and update path to mkfs
* Usage of fsck.exfat is already included in partition.cpp, but the
  tool is missing.
* Update the path to mkexfatfs so the button is available when changing
  filesystem.

Change-Id: I5f4e27357c6b5a8606043d1bdc2488cc83e55d90
2015-12-22 15:26:01 -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
18794c820f Update dosfstools
* Version 3.0.28
* Update filenames in source
* Remove unnecessary symlink to fsck
* Commit "Recode short filenames from DOS codepage (default 437)." has
  been reverted since we do not have access to iconv
* Commits cherry-picked on top of 3.0.28:
    - mkfs.fat: fix incorrect int type
    - Prevent out of bound array read in date_dos2unix()

Change-Id: I50310235c62ec2e6bc90afcd10f2814d3afb5113
2015-11-26 06:09:55 +02:00
Ethan Yonker
e0f1f3b4d1 Move reloading of theme outside of the action thread
Reloading the GUI while the GUI is running and rendering is very
dangerous as we may be deleting GUI resources before or while we
are trying to render those same items. This change will allow us
to safely load new resources and delete the old ones.

Fixed a double free situation that was causing a crash on every
other theme reload.

Clear parsed xml documents when we are done loading the theme
instead of keeping them in memory for the life of the theme to
help save a little memory.

Store starting page so that if we request a reload, we can enter
the theme at the same starting point, which may come in handy if
we allow for language selection on alternate starting pages such
as the decrypt prompt or the system read only prompt.

Change-Id: I45a7e3fb3daeefac56d70f8d4936938eb1244b99
2015-11-09 14:57:23 -06: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
Ethan Yonker
d0514ba806 Fix a bunch of warnings
Mostly adding __unused where needed.

Change-Id: Ia4f675b9b360782728c361ed1699db0cc277c3a5
2015-10-24 17:36:24 -05:00