diff --git a/core/src/apps/homescreen/lockscreen.py b/core/src/apps/homescreen/lockscreen.py index 64037db2d..68ecd2cc1 100644 --- a/core/src/apps/homescreen/lockscreen.py +++ b/core/src/apps/homescreen/lockscreen.py @@ -1,4 +1,4 @@ -from trezor import res, ui +from trezor import loop, res, ui from . import HomescreenBase @@ -33,6 +33,26 @@ class Lockscreen(HomescreenBase): ) ui.display.icon(45, 202, res.load(ui.ICON_CLICK), ui.TITLE_GREY, ui.BG) + def handle_rendering(self) -> loop.Task: # type: ignore + """Task that is rendering the layout in a busy loop. + + Copy-pasted from ui.Layout.handle_rendering with modification to set the + backlight to a lower level while lockscreen is on, and a longer sleep because + we never do any redrawing.""" + # Before the first render, we dim the display. + ui.backlight_fade(ui.BACKLIGHT_DIM) + # Clear the screen of any leftovers, make sure everything is marked for + # repaint (we can be running the same layout instance multiple times) + # and paint it. + ui.display.clear() + self.on_render() + ui.refresh() + ui.backlight_fade(ui.BACKLIGHT_LOW) + # long sleep + sleep = loop.sleep(1000 * 1000 * 1000) + while True: + yield sleep + def on_render(self) -> None: self.render_homescreen() self.render_lock() diff --git a/core/src/trezor/ui/style.py b/core/src/trezor/ui/style.py index 7955834c4..363898605 100644 --- a/core/src/trezor/ui/style.py +++ b/core/src/trezor/ui/style.py @@ -7,6 +7,7 @@ RADIUS = const(2) # backlight brightness BACKLIGHT_NORMAL = const(150) +BACKLIGHT_LOW = const(70) BACKLIGHT_DIM = const(5) BACKLIGHT_NONE = const(2) BACKLIGHT_MAX = const(255)