Commit Graph

28 Commits

Author SHA1 Message Date
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
that
a9dd9f0374 gui: preserve order of gui_print vs gui_msg
- rename __gui_print to internal_gui_print (__* is reserved for compiler)
- translate outstanding messages in internal_gui_print
- add locking because background thread could print while we render
- minor cleanup

Change-Id: Ib687d2cfb4763ad08ad4d4b76daf5b129d61d2e2
2017-03-01 22:38:25 +01:00
Matt Mower
a8a89d1961 Whitespace cleanup
Change-Id: I93c65973679894bb8587da4b38b410d38036b8bd
2017-01-18 17:41:17 +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
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
Ethan Yonker
44925ad190 GUI TextBox
Allows the GUI to create a scrollable text box for long text that
may not all fit on the screen. Also includes code to allow the
console to wrap on spaces and other such characters instead of
wrapping in the middle of a word.

To see an example of how to add a text box to the XML, see:
https://gerrit.omnirom.org/#/c/14183/

Change-Id: Ifd139172ede290046b58ea3fe526e2e06da1d4ef
2015-10-26 11:54:16 -05: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
b7a54a3016 Allow text to scale to fit
Change-Id: Iacd4bb78f551b51d092ecde09521b5541e7dadcd
2015-10-16 22:57:35 +02:00
Ethan Yonker
591b920536 Reduce themes to 5 and rely on scaling
This will significantly reduce theme maintainence and should be a
lot more sustainable over time. Eliminate most themes leaving only
5 remaining in 3 categores:
 * watch_mdpi: 320x320
 * portrait_mdpi: 480x800
 * portrait_hdpi: 1080x1920
 * landscape_mdpi: 800x480
 * landscape_hdpi: 1920x1200

Add handling to map the old DEVICE RESOLUTION to the new TW_THEME
build flag. New devices should specify a theme using the new
TW_THEME build flag using one of the 5 values from the list above.
Long term we will eliminate the use of the DEVICE_RESOLUTION flag
in favor of the new flag.

Change the way sliders render so that they completely follow the
placement="5". This will probably break some custom themes but is
necessary so that we can retain the aspect ratio on slider images
and still have them rendered at the center of the screen.

Add code to the console slideout button so that it can be centered.
Centering the slideout button allows us to keep the button at the
center of the screen when retaining aspect ratios on the image.

Add more retain aspect ratios for home, back, slideout, folder,
file, and lock screen images.

Change the way we build the top bar in TWRP. It is now mostly
drawn using fill objects and the TWRP logo is a separate image so
that we can retain its aspect ratio during scaling. Thanks to Mark
Norelus for providing the TWRP logo.

Change-Id: I801a7b3163cad9ef353461f4c327690a9ccbb3aa
2015-03-12 18:41:34 -05:00
that
8d46c09ccf gui: kinetic scrolling for console
- Rebase console on ScrollList
- Add fastscroll bar to console
- ScrollList now has a mode that ignores selections
- Increase kinetic scrolling speed for lists showing many items

Change-Id: I6298d717d2e403f3e85e2c633d53c4284a066012
2015-03-05 04:50:33 +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
that
f6ed8fc1f5 gui: make resources type safe
- add string, int, color and resource loading helpers
- use typed resource classes, and some cleanup in loading code
- remove abstract GetResource() to enforce type safe access
- add height and width query methods to resources and use them
- minor cleanup
- simplify LoadPlacement

Change-Id: I9b81785109a80b3806ad6b50cba4d893b87b0db1
2015-02-15 20:36:40 +01:00
that
05360ba6b0 gui: fix console lockup when scrolling
Apparently fixing all the signed/unsigned warnings was good. :)

Change-Id: I62faa23179e8b2436fe0d24d2152af341cd42fe9
2015-02-06 00:58:16 +01:00
that
f8194e2924 gui: fix IsInRegion
(0,0) was inside the region of "locationless" action objects,
leading to all kinds of strange behavior when clicking in the
upper left corner.

Change-Id: I222db4ff499f3c30605b05267f005accb2e0dc99
2015-01-29 21:00:41 +01:00
Vojtech Bocek
76ee903d84 Add support for TrueType fonts
* Keeps original font system in place
* Uses the same API as original font system:
   - You can render only one line at a time
   - You can only use one font and color for one gr_text* call
* Caches all rendered text, with a string cache limited to 400
  entries, then it trucates to 250, which results in memory
  usage hovering around 5-10MB

Change-Id: I36107b9dcd8d57bae4486fce8b8f64e49ef3d906
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-10-14 15:06:56 +02: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
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
Ethan Yonker
6b4276f760 Remove size parameter from substr call
Change-Id: I2745bcf8f242fe4a1992aa547efaccf33db0fb5b
2014-03-07 06:48:45 -06:00
Vojtech Bocek
d5b26d61e7 Fix "\n\n" string in gui_print(), remove unused gui_print_overwrite()
Change-Id: Ib23354a706013c8cee6665c720fa3b890f3fb3de
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-03-06 22:59:22 +01:00
Vojtech Bocek
c58846b200 Fix wordwrap in console eating last char if str.size() == max_line_len
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
Change-Id: I4a23cd78bd63d63f4d6ec8f34dcc6eced824123b
2014-03-04 19:58:01 +01:00
Dees Troy
31218ec952 Add word wrap to console output and fix scrolling in console
Change-Id: Ibcf89952ee1391350c715f1ec82cf0cdb9b0ca7d
2014-02-26 08:52:05 -06: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
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
gordon1337
1035509376 Console Render Bug caused by touch drag event
With starting the console the touch drag event is active without even touching the display.
This causes to render the console at any time it is displayed, which consumes alot of battery and heats up the device.
What the patch does is resetting the touch drag state to ensure it is only re-rendering the console when it it really needed.
2013-06-08 14:15:32 +02: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
Dees_Troy
293d727152 Fix a problem with scrolling in the console 2012-09-26 10:43:46 -04:00
Dees_Troy
32c8eb81af Make text appear in GUI console, Zip install works.
Move TW zip install code to C++ so that it can use the
ui->functions.
Bring in mincrypt code to fix a crash during signature
checking.
2012-09-12 15:14:38 -04:00
Dees_Troy
51a0e82eb2 TWRP-ify AOSP code
Pull in most TWRP sources
Stub out partition management code
Make it compile -- probably will not boot
Kind of a mess but have to start somewhere
2012-09-05 15:24:31 -04:00