Skip to content

Commit

Permalink
fix(core): rework 'too many PIN attempts' RSOD
Browse files Browse the repository at this point in the history
Also, allow multi-line title in model TR `ErrorScreen`.

Co-authored-by: Roman Zeyde <[email protected]>
  • Loading branch information
bieleluk and romanz committed Jan 9, 2025
1 parent a81850c commit 9f1f56c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions core/.changelog.d/3324.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[T2B1, T3B1] Fix "PIN attempts exceeded" screen
6 changes: 3 additions & 3 deletions core/embed/rtl/error_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ void __attribute__((noreturn)) show_wipe_code_screen(void) {
}

void __attribute__((noreturn)) show_pin_too_many_screen(void) {
error_shutdown_ex("TOO MANY PIN ATTEMPTS",
"All data has been erased from the device",
"PLEASE RECONNECT\nTHE DEVICE");
error_shutdown_ex("PIN ATTEMPTS\nEXCEEDED",
"All data has been\nerased from the device",
"Please reconnect the\ndevice");
}

void __attribute__((noreturn)) show_install_restricted_screen(void) {
Expand Down
14 changes: 7 additions & 7 deletions core/embed/rust/src/ui/model_tr/component/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ impl Component for ErrorScreen<'_> {
fn place(&mut self, _bounds: Rect) -> Rect {
self.bg.place(screen());

let title_area = Rect::new(screen().top_left(), screen().top_right() + Offset::y(11));
self.title.place(title_area);

let text_width = self.title.inner().max_size().x;

if text_width > title_area.width() - 2 * TITLE_AREA_HEIGHT {
if text_width > screen().width() - 2 * TITLE_AREA_HEIGHT {
// if the title is too long, don't show the icons
self.show_icons = false;
}

let title_area = self.title.place(screen());
let top_offset = if self.show_icons {
Offset::y(11)
// show warning icons when the title fits a single line
Offset::y(TITLE_AREA_HEIGHT)
} else {
Offset::y(8)
// longer titles will be split and rendered without icons
Offset::y(title_area.height())
};

let message_area = Rect::new(
Expand Down

0 comments on commit 9f1f56c

Please sign in to comment.