mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-31 18:40:56 +00:00
fix(core): do not autolock when already locked
Gets rid of unnecessary screen redraw.
This commit is contained in:
parent
192d0dcf87
commit
06b9d1314d
@ -216,6 +216,11 @@ def lock_device() -> None:
|
||||
workflow.close_others()
|
||||
|
||||
|
||||
def lock_device_if_unlocked() -> None:
|
||||
if config.is_unlocked():
|
||||
lock_device()
|
||||
|
||||
|
||||
async def unlock_device(ctx: wire.GenericContext = wire.DUMMY_CONTEXT) -> None:
|
||||
"""Ensure the device is in unlocked state.
|
||||
|
||||
@ -267,4 +272,6 @@ def boot() -> None:
|
||||
|
||||
wire.experimental_enabled = storage.device.get_experimental_features()
|
||||
|
||||
workflow.idle_timer.set(storage.device.get_autolock_delay_ms(), lock_device)
|
||||
workflow.idle_timer.set(
|
||||
storage.device.get_autolock_delay_ms(), lock_device_if_unlocked
|
||||
)
|
||||
|
@ -5,7 +5,7 @@ from trezor.messages.Success import Success
|
||||
from trezor.strings import format_duration_ms
|
||||
from trezor.ui.components.tt.text import Text
|
||||
|
||||
from apps.base import lock_device
|
||||
from apps.base import lock_device_if_unlocked
|
||||
from apps.common import safety_checks
|
||||
from apps.common.confirm import require_confirm, require_hold_to_confirm
|
||||
|
||||
@ -101,7 +101,9 @@ async def apply_settings(ctx: wire.Context, msg: ApplySettings):
|
||||
|
||||
|
||||
def reload_settings_from_storage() -> None:
|
||||
workflow.idle_timer.set(storage.device.get_autolock_delay_ms(), lock_device)
|
||||
workflow.idle_timer.set(
|
||||
storage.device.get_autolock_delay_ms(), lock_device_if_unlocked
|
||||
)
|
||||
ui.display.orientation(storage.device.get_rotation())
|
||||
wire.experimental_enabled = storage.device.get_experimental_features()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user