Desktop: Fix PIN locked with no PIN set edge case

This commit is contained in:
Willy-JL
2024-09-02 00:45:59 +02:00
parent 9a1372435e
commit dd7cd8f487
2 changed files with 12 additions and 11 deletions

View File

@@ -13,5 +13,6 @@
- Desktop: - Desktop:
- Fix disabling keybinds (by @Willy-JL) - Fix disabling keybinds (by @Willy-JL)
- Sanity check PIN length for good measure (by @Willy-JL) - Sanity check PIN length for good measure (by @Willy-JL)
- Fix PIN locked with no PIN set edge case (by @Willy-JL)
- Settings: Fix duplicates in Power Settings when opening submenus (by @Willy-JL) - Settings: Fix duplicates in Power Settings when opening submenus (by @Willy-JL)
- RGB Backlight: Fix config migration (by @Willy-JL) - RGB Backlight: Fix config migration (by @Willy-JL)

View File

@@ -384,20 +384,20 @@ void desktop_lock(Desktop* desktop, bool with_pin) {
furi_assert(!desktop->locked); furi_assert(!desktop->locked);
with_pin = with_pin && desktop_pin_code_is_set(); with_pin = with_pin && desktop_pin_code_is_set();
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) { if(with_pin) {
furi_hal_rtc_set_flag(FuriHalRtcFlagLock);
} else {
furi_hal_rtc_reset_flag(FuriHalRtcFlagLock);
furi_hal_rtc_set_pin_fails(0); furi_hal_rtc_set_pin_fails(0);
} }
if(with_pin) { if(with_pin && !momentum_settings.allow_locked_rpc_commands) {
furi_hal_rtc_set_flag(FuriHalRtcFlagLock); Cli* cli = furi_record_open(RECORD_CLI);
if(!momentum_settings.allow_locked_rpc_commands) { cli_session_close(cli);
Cli* cli = furi_record_open(RECORD_CLI); furi_record_close(RECORD_CLI);
cli_session_close(cli); Bt* bt = furi_record_open(RECORD_BT);
furi_record_close(RECORD_CLI); bt_close_rpc_connection(bt);
Bt* bt = furi_record_open(RECORD_BT); furi_record_close(RECORD_BT);
bt_close_rpc_connection(bt);
furi_record_close(RECORD_BT);
}
} }
desktop_auto_lock_inhibit(desktop); desktop_auto_lock_inhibit(desktop);