Commit Graph

295 Commits

Author SHA1 Message Date
Ethan Yonker 561c58de19 Use unified LoadFileToBuffer function
Create a single function for loading xml files to a memory buffer
to reduce code duplication.

Change-Id: I0ff64463072118f61a2eb8052f74019715020253
2015-10-16 15:23:56 -05:00
Ethan Yonker 88037f476f Remove support for non-TTF fonts
This patch set removes support in TWRP for the old .dat file
format as well as support for the AOSP style fonts in header
files. We need TTF for scaling.

Note that the old AOSP style header font is still supported in
minui which is not used by TWRP.

Change-Id: I6124a3333d479f1fc668138f7e32c4be9b519552
2015-10-15 09:23:39 -05:00
Ketut Putu Kumajaya f13b893c2c Unicode for temperature
Change-Id: Ie86dc63f83ae51e9947debc7191fd91d61b83008
2015-10-15 16:10:26 +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
Matt Mower 85161af111 ORS: Report success if AOSP script succeeds
When AOSP recovery commands are processed, the GUI reports a failure
just before reboot even when all commands succeeded. Set op_status
before reboot to indicate success.

Change-Id: I09e9357b04cd81f418264bf00a75311f48357414
2015-08-09 17:22:25 +02:00
that d16b2ce73e gui: support new theme directory structure
Change-Id: I8622da5ae321ba69a55b38e2f0b878b7ec149d02
2015-07-27 20:39:19 +02:00
Ethan Yonker ffc9174145 Really fix background color on 480x800 theme
Change-Id: I70324ae3e4fffe88bc2b5a02becb7d1f4f0ceab0
2015-07-22 08:22:33 -05: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
that c01391c123 gui: allow listbox to be used as menu and as read-only list
Also enable string insertion for list items.

Example how to make a menu item:
<listitem name="Lights on!">
	<action>
		<action function="setbrightness">255</action>
	</action>
</listitem>

If no <data> element and no actions on any items exist, the list is
read only and no item selection is possible.

Change-Id: Ib2668a982df2514484d44faa0396dd17550f39f3
2015-07-14 16:07:11 +02:00
that f6b2066ff3 gui: keyboard: support longpress label offset, code cleanup
To position the longpress label:
<longpress font="..." textcolor="..." x="5" y="0"/>
x and y is the distance from the upper right corner.

- extract method GUIKeyboard::DrawKey
- clean up handling of currently pressed key
- integrate key highlighting into main key drawing loops

Change-Id: I80ccf2975d30cffa2a48627a74ab3693c84e4fa4
2015-07-14 16:00:35 +02:00
Ethan Yonker 983be2a3fb Fix minor background bug in 480x800 xml
Change-Id: Ib67a356f8d5e6bb0f982c081fc88b6462c7fbd74
2015-07-13 15:04:47 -05:00
that b63e2f9156 gui: allow specifying object type in element name
e.g. '<button ...>' instead of '<object type="button" ...>'

Also get rid of default parameters to make things more explicit.

Change-Id: Ie4d1231b725aeb6cbf0041622c9780c86cf8e1c1
2015-07-13 15:04:11 -05:00
that f256b722f4 [WIP] gui: software drawn keyboard (code only)
Change-Id: I9f05c85f8d43ab012228a78b79220a27876a299d
2015-06-20 22:35:39 +02:00
Dees Troy 28a85d232f Make sure that adbd restarts after sideload
Change-Id: I7d82b95cd8749c6f8569739162708705faa6f1f7
2015-06-17 23:40:25 +02:00
Ethan Yonker e1abe616f2 Fix ORS scripts displaying an error after completing
Change-Id: I1329705fca870b4e3017607ad7c7875aa00d664b
2015-06-17 23:12:34 +02:00
that c7b631b7a2 gui: set tw_file to the currently flashed file name without path
To allow themes to show more of the file name on narrow displays.

Change-Id: I4962eed5e4a01f73a3cde126f2ba56428209fccc
2015-06-01 23:36:57 +02:00
that 5267a21667 gui: move retainaspect handling to the resource ctors
LoadResources should only decide on the resource type,
everything else is handled by the resources themselves.

Change-Id: I30f68293960c23560979f650efc4393992cf5824
2015-06-01 03:03:28 +02:00
Ethan Yonker d6966f4426 Fix unable to uncheck the mount read only check box
Change-Id: I1bbc25df6f35f79549f1eb06feb4db9ec0475aa5
2015-05-30 14:52:21 -05:00
Xuefer 46bdc96815 remove useless memset and \n
fgets reads up to one byte less than size then with \0 at the end
adding \n after \0 is useless too

Change-Id: I7758d7a8f885bdde2b491a9cb75800f831d77c1f
2015-05-29 17:56:19 +02:00
Ethan Yonker a2719156c2 Add resize2fs and ability to run resize2fs via GUI
Note: Only works on ext2/3/4 partitions. Only tested on ext4.

We can use this in some cases to resize the data partition if an
incorrect fstab caused recovery to not reserve the 16KB for a
crypto footer.

Sometimes the BoardConfig for a custom ROM does not have the
correct size for the system partition and if the ROM flashes a
raw system image, that image will not take up the full block
device. Running resize2fs can fix the size and may allow more
room in the system partition for customizations like busybox or
a larger gapps package.

Sometimes flashing a factory image may flash userdata with an
image with a file system that does not take up the full size of
the block device (e.g. factory images for the Nexus 6 will flash
userdata with a ~24GB userdata image, wasting ~30GB of space).
Using resize2fs we can easily fix this issue without having to do
a full format data.

Change-Id: I631f5c6f567bbc6a9241e5dd95f1e435820a1b13
2015-05-28 09:47:25 -05: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
Matt Mower d411f8da8e GUI: Prevent duplicate page overlays
If a page is requested for overlay, ensure it doesn't already exist in
the stack of existing overlays. If it does, erase the existing page
and push_back the new one.

Change-Id: I9feeea06cf7aad2e08a8c3bc567aaa761db2c3bc
2015-05-18 18:51:49 +02:00
that 202e51b1c2 gui: add DST rules to time zones for USA and Europe
This should fix daylight saving time display for most users.
For fully correct time zones we need the tzdata database.

Change-Id: I7b7693ab0abaf20be217bd06d525f03fb89b7217
2015-03-25 03:45:05 +01:00
Ethan Yonker 1c273318c7 Allow multiple overlays
This effectively allows us to support popup dialogs and the like.

Change-Id: Iafb3fa60ed635287cb59dce118f74dc8f2a4e60a
2015-03-19 12:32:39 -05:00
codelover 27b0aee5f1 Fix non-working "Do Not Install" button on "installsu" page.
* Applicable to non-rooted devices running portrait mode only.
* Touching the button has no effect, supposed to reboot/poweroff.

Change-Id: If67649c4c83ddf549c833f94c66829e0877969c5
2015-03-19 17:49:46 +01:00
Vojtech Bocek e8c3927461 Fix GUIPatternPassword when the pattern crosses already visited dots
Change-Id: I59b3f8c5604c036dbc74c020ee21aeeef28132d3
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2015-03-19 16:41:47 +01:00
that d86f49d3f7 gui: keyboard: introduce struct Layout and simplify caps handling
Also minor cleanups:
- move array limits from #defines to a protected enum
- zero fill layouts in ctor

Change-Id: I8fe0f8465ebc646ad3bf3cc3f8490dbdd384f43d
2015-03-15 00:56:57 +01:00
that e79878b7b6 gui: keyboard: add HitTestKey method, minor simplifications
Change-Id: I6cd0251dd9d933e6ebef977a553be7473e2d7034
2015-03-14 23:07:23 +01:00
that 7cec6361a8 gui: fix 1920x1200 keyboard "_", ":", "!" and "?"
"_" was broken due to a bad XML attribute name, and the others
didn't produce the highlighted character in shift mode.

Change-Id: I271fbf4e083ccdb69c469cbdae44101afed4fd1e
2015-03-14 22:52:15 +01:00
that 6db855e1c0 gui: keyboard doesn't need its own action
This was questionable design and is unused anyway.
Also reduced a few redundant #includes.

Change-Id: I65bb01120e6072c5695755920242f6f9d73c816e
2015-03-14 21:31:43 +01:00
Vojtech Bocek 7e11ac5d3c Add UI for entering pattern for device decryption
Change-Id: Ia2d3268a96423e9ca3846500c57e674c4f8fa60b
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2015-03-13 12:12:58 -05:00
Ethan Yonker 30fa335a85 Allow touch to use a key code to sync touch events
This is needed to make touch work on the x86-64 emulator target
though I have seen the key code used on other devices as a way to
synchronize touch events.

Change-Id: I31a3cc56e6470f2c707641b537140e44f5e686aa
2015-03-13 11:37:03 -05:00
Matt Mower 989709a514 GUI: Add monospace TTF
Change-Id: I287722719c1f73cc8f7214549f9a890f03d4a586
2015-03-13 03:59:12 +01: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 b2e8f672f3 gui: support string resources
storing strings in a map (for fast lookup) in resource manager

To define a string resource in <resources>:
<string name="foo">Hello</string>

To use a string, e.g.:
<text>%@foo%</text>

Not yet done: language-specific resources (should be solved not only for
strings, but for all kinds of resources - e.g. for localized images)

Change-Id: I3ba5cf5298c09e0d28a83973e9662f179271b33f
2015-03-11 07:38:37 -05:00
that 0f425069dc gui: allow specifying resource type in element name
e.g. '<image ...>' instead of '<resource type="image" ...>'

Change-Id: I5ce04ae0845351c8a4640d12e36f1aaf32e1ebc9
2015-03-11 07:31:40 -05:00
that 74ac6060cc gui: type safe resources part 2
- separate collections for fonts, images, animations
- no more ugly casts
- fix crash if main ui.xml did not define any resources but include did
- don't stop loading resources if one "type" attribute is missing

Change-Id: I70c1c9ca66ca65d9fba1ba3eded34f3d8a07488e
2015-03-11 07:21:37 -05:00
that 18e13a9063 gui: make scroll bars smaller and transparent
Not all themes tested.

To center the scrollbar horizontally on the line, the width must be
fastscroll_linew + 2 * something.

Change-Id: I3c2878734ffbd2e8ef3bc7c64b2f16d4f61aeda5
2015-03-06 05:18:18 +01: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
that 0af7795690 gui: introduce virtual RenderItem method in ScrollList
- so derived lists can draw whatever they want (multi-line etc.)
- replace GetListItem with RenderItem
- minor cleanup

Change-Id: I062e0a354f1c18ce0a5232b7542c4987b480e232
2015-03-05 04:46:10 +01:00
xiaolu e738da5e89 minuitwrp: fix crash issue, when the console use TTF font to display unicode font.
gui: fix terminal command unusual line breaks and missing characters at the end of a read buf.

Change-Id: I8d3d740b6066b1594c5148b2012f0e7bcbecc22b
2015-03-05 04:22:26 +01:00
Matt Mower 5aa29ab3c7 GUI: Terminal command: minor improvements
* Use mono font for terminal command input
* Recognize 'exit' command (go to main page)

Change-Id: I5f383cd8d19959a49d2ae0b18f839b86e4145693
2015-03-05 04:20:53 +01:00
Matt Mower 829315385f GUI: Use valid XML syntax
Safer handling:
& --> &amp;
> --> &gt;
< --> &lt;

Broken tags:
</function>      --> </action>
<folders="1"...> --> <filter folders="1"...>

Change-Id: Iaddaf9db163e08250cb4deefdfdb814c589ccb47
2015-03-05 04:16:26 +01:00
Matt Mower e057c2b101 GUI: Restore text input field for restore decrypt
The portrait placement was mistakenly removed in commit
I6e314efb4bb454d496555ff7e003d743063a1308

Change-Id: Ida5f908e61df0f99e0f5327c298e6a1a915d0f66
2015-02-25 15:39:22 -06:00
that 72b90e39db gui: fix missing icons in fileselector
Style support was missing.

Change-Id: I9a9a8c6a42e2a3d0dcdee871a639c9842a2ff668
2015-02-23 22:57:14 +01:00
bigbiff bf1d67245e Theme: Add ability to disable size checking before backup
(for compressed backup users with low space).
Clean up backup folder and copy only recovery.log for debugging.

Conflicts:
	gui/devices/watch/res/watch.xml

Change-Id: If8aa3580dbc082d0fe4882d4af8dc3cdb362a8b5
2015-02-23 15:49:02 +01:00
that ba75a0e73b gui: don't truncate values to 0 after scaling
Avoids invisible lines (e.g. input cursor) when scaling down.

Change-Id: I595e8bdb2fa468c30f104867ad77be2423ec287f
2015-02-23 15:39:15 +01:00
Ethan Yonker 72b90ab0d7 Fix reboot system on watch theme
Change-Id: I008664109360d937a31232c8cc15c7c9d3dd0ba5
2015-02-23 08:35:48 -06:00
that a999821ad4 gui: proportional scrollbars
- Attribute "recth" in the <fastscroll> element is now the
*minimum* height for the scrollbar.
- Dragging the scrollbar moves the list.
- Touching outside the scrollbar jumps to the relative position.

Change-Id: Ic1f20b5ec68cf49e5be56be34f0c58c0f474618b
2015-02-21 15:34:19 +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