Skip to content

gui2: decrypt, backup, mount and wipe pages, plus input and rendering fixes - #31

Open
lingqiqi5211 wants to merge 20 commits into
TWRP-Test:lvglfrom
lingqiqi5211:lvgl
Open

lingqiqi5211 wants to merge 20 commits into
TWRP-Test:lvglfrom
lingqiqi5211:lvgl

Conversation

@lingqiqi5211

@lingqiqi5211 lingqiqi5211 commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Tested on a Xiaomi SM8750 device (warsaw) running the lvgl branch.

Fixes

A blanked panel permanently degraded the whole session. The GUI keeps
submitting frames while the CRTC is disabled, the non-blocking flip fails with
-EINVAL, and atomic_page_flip was cleared for good — every later frame took
the blocking ALLOW_MODESET path. The flag is only restored by
drm_init()/drm_exit(). Now the backend only leaves the non-blocking path
after repeated consecutive failures, and GUI2 stops presenting while blanked.

Dragging did not follow the finger. Three causes: the read callback
delivered one touch frame per call while the digitizer reports at ~135 Hz and
the loop reads at ~100 Hz, so the queue grew and the UI trailed by several
frames; draggable widgets did not set LV_OBJ_FLAG_PRESS_LOCK, so LVGL
re-resolved the object under the finger each pressing iteration and sent
PRESS_LOST when the touch drifted off a thin control; and both sliders jumped
on grab because the press mapped the touch point onto the knob centre.

Page transitions stacked two headings. The page root was transparent, so the
outgoing page's title and version label showed through the incoming one and
disappeared when it was deleted.

A finished screenshot never reported its path — only the white flash fired,
and the strings for the result were unused.

TwrpPerfManager demoted boost backends permanently. backend_index only
moved forward and was reset in Initialize()/Release(), so once every backend
had refused once, clocks could never be raised again for the rest of the
session.

Opening advanced wipe killed the process. gui_parse_text() and
gui_lookup() dereference PageManager::GetResources(), which is null under
gui2 because the legacy PageManager is never initialised.
Get_Partition_List("wipe", …) reaches it through the {@dalvik} entry of its
list, so the page segfaulted and init restarted recovery every five seconds,
leaving the device on the first frame with nothing in /tmp/recovery.log. Both
helpers now fall back the way twmsg.cpp already does.

The UI ran at 60 Hz on a 165 Hz panel. The mode search took the first entry
matching the boot resolution and the connector lists 60 Hz first. It now keeps
the highest refresh rate offered at that resolution.

The keyboard could not be put away. Nothing handled the close request LVGL
sends for its keyboard glyph, so pressing it did nothing. The decrypt keyboard
also lives on the top layer and page changes only cleared the pointer to it,
leaving it over every later page.

Console output ignored the UI language. Those strings are resolved out of
the loaded theme's resource list, which GUI2 never loads. Loading the legacy
language XML is not an option either: its resource list starts with font
overrides that expect the font stack GUI2 replaced, and walking into it crashes.
The message catalogue now takes a translator hook, and GUI2 installs a table of
its own.

A confirmed swipe was silent while ordinary buttons buzzed, because a
gesture never reaches accept_click().

Features

  • Decrypt page for password, pattern and PIN, following the legacy flow for
    user 0. It takes the page over at startup, so the legacy prompt now only runs
    when GUI2 could not start, and the home page carries a notice back to it while
    data is still locked.
  • Backup page, laid out as tabs over the partition list, options and progress.
  • Mount page.
  • Wipe pages: factory reset, advanced wipe and format data. Formatting confirms
    with a slider that stays disabled until yes is typed, rather than a button
    that is easy to hit by accident, and the warning is drawn from a vector rather
    than a font glyph scaled up until it blurs.
  • One progress page shared by wiping, decrypting and backing up, with the
    embedded console owning its own viewport so long output scrolls instead of
    growing the page past the bar.
  • Console page behind the bottom navigation's console action, which nothing
    handled before. It reads the recovery console the legacy GUI owns through a
    new read-only accessor, so both UIs share one buffer.
  • Screen timeout, now an eight step slider from 15 s to 10 minutes ending in no
    timeout, which replaces the earlier switch and free slider.
  • Console font size.
  • Log export under Advanced, listing the kernel log and logcat.
  • Keyboard layouts with a hide key in both bottom corners, and one on the number
    pad, drawn with a hide arrow rather than a keyboard glyph that reads as
    "show".
  • Multi-select rows use checkboxes rather than switches, since they pick several
    entries at once rather than toggling independent settings.

A single non-blocking flip that returns an error permanently cleared
atomic_page_flip, so every later frame took the blocking
ALLOW_MODESET commit path for the rest of the session. The flag is
only restored by drm_init()/drm_exit(), so the UI stayed pinned to
vblank once anything went wrong.

Blanking the panel is enough to trigger it: the GUI keeps submitting
while the CRTC is disabled and the flip fails with -EINVAL.

Only leave the non-blocking path after several consecutive failures,
reset the counter on success, and stop presenting entirely while the
display is blanked.
backend_index only ever moved forward and was reset in Initialize()
and Release(), so once every backend had refused a boost once the
manager could never raise the clocks again for the rest of the
session.

Start over from the first backend when the list is exhausted so a
transient refusal no longer disables boosting permanently.
Three separate problems made dragging lag or break:

The read callback delivered a single touch frame per call while the
digitizer reports at ~135 Hz and the loop reads at ~100 Hz, so the
queue grew and the UI showed a position from several frames ago.
Set continue_reading so LVGL drains what is pending.

Draggable widgets did not set LV_OBJ_FLAG_PRESS_LOCK, so LVGL
re-resolved the object under the finger on every pressing iteration
and sent PRESS_LOST as soon as the touch drifted off a thin control.

Both sliders jumped when grabbed because the press mapped the touch
point straight onto the knob centre. Track the grab offset instead,
and let the value slider move only when the knob itself is grabbed.

Also give the value slider a disabled state that dims the indicator
and knob and rejects drags.
The page root was transparent, so during a transition the outgoing
page's heading showed through the incoming one: two titles and two
version labels rendered on top of each other, and one vanished when
the old page was finally deleted.

The version label was also sized to exactly its measured text width
while still in wrapping mode, which let the last glyph fall off, and
it was positioned without accounting for the heading's left padding.

Draw each page opaque, and give the label an explicit box with room
to spare, clipping, right alignment and a padding-aware position.

Reserve the bottom inset from the scroll viewport instead of padding
it, so pages with an apply button clip their content at the button
rather than letting it run underneath.
A finished screenshot only triggered the white flash; the saved path
was never shown, and the strings for it were unused. Screenshots
close the panel before capturing, so the result now waits and is
shown the next time the panel is opened, once.

The panel also fired its open callback twice per pull-down, which
cleared that pending result immediately, and a press that dragged
the panel could still be delivered as a button click on release.

Collapse the feedback row when it has nothing to say, widen the gaps
between the brightness slider, the action row and the feedback, and
let the controller resize itself when the row appears.
The bottom navigation already carried a console action that nothing
handled. Add the page behind it, reading the recovery console the
legacy GUI owns through a new read-only accessor so both UIs share
one buffer, and refresh it from the loop while the page is on top.

Add the settings that were still missing: a screen timeout switch and
duration slider writing tw_screen_timeout_secs, a console font size,
and log export under Advanced with switches for the kernel log and
logcat.
@YuKongA
YuKongA requested a balanced review from Copilot September 17, 2026 06:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@YuKongA

YuKongA commented Sep 17, 2026

Copy link
Copy Markdown
Member

@codex review

The connector lists 60 Hz first, so the UI ran at 60 Hz on panels that
also report 144 and 165 Hz.
gui2 never initialises the legacy PageManager, so GetResources() returns
null and gui_parse_text()/gui_lookup() dereferenced it. Get_Partition_List
reaches this through the {@dalvik} entry of its wipe list.
Log export picks several entries at once, which reads as a selection
rather than as a set of switches.
Eight steps from 15 s to 10 minutes, with no timeout at the far right,
so the toggle is no longer needed.
Factory reset, advanced wipe and format data, with progress reported
through an embedded console view.
@lingqiqi5211 lingqiqi5211 changed the title gui2: fix input lag, transitions and screenshot feedback; add console, screen timeout and log export gui2: input and rendering fixes, plus the console, log export and wipe pages Sep 17, 2026
The console lines wasted a card's worth of padding, and the reboot
targets were smaller than every other list on screen.
@YuKongA

YuKongA commented Sep 18, 2026

Copy link
Copy Markdown
Member

啥情况了

Console strings are resolved out of the loaded theme's resource list,
which GUI2 never loads. Give the message catalogue a hook so a UI can
resolve a key itself before the normal lookup runs.
Loading the legacy language XML is not an option: its resource list
starts with font overrides that expect the font stack GUI2 replaced, and
walking into it crashes. Carry the strings in a table of their own and
install it through the new hook.
Wiping was the only thing with a progress page, but decrypt and backup
want the same console-and-bar layout. The embedded console also has to
own its viewport here, so long output scrolls instead of growing the
page past the bar.
A button is too easy to hit by accident for something that erases the
whole data partition. Confirm with a slider that stays disabled until
yes is typed, and draw the warning from a vector rather than scaling a
font glyph up until it blurs.
The three share the same wiring, page state and strings, so they arrive
together. Decryption follows the legacy flow for user 0 with a password,
pattern or PIN, and takes the page over at startup; the legacy prompt now
only runs when GUI2 could not start. Until data is unlocked the home page
carries a notice back to it.
A confirmed gesture never reaches accept_click, so every slide-to-confirm
was silent while ordinary buttons buzzed.
Left behind by the pages that stopped referring to them.
Nothing handled the keyboard's close request, so the decrypt page could
never dismiss it, and because the keyboard lives on the top layer,
clearing only the pointer left it sitting over every later page.

The stock layout offers that key in one corner alone, drawn with a
keyboard glyph that reads as "show". Carry a hide arrow in both bottom
corners and on the number pad instead, and put the keyboard away once a
passphrase is confirmed.
@lingqiqi5211 lingqiqi5211 changed the title gui2: input and rendering fixes, plus the console, log export and wipe pages gui2: decrypt, backup, mount and wipe pages, plus input and rendering fixes Sep 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants