Deny BT-RPC commands when locked (Toggle)

This commit is contained in:
ClaraCrazy
2023-07-23 19:26:36 +02:00
parent 7152846c08
commit a7151dc46b
8 changed files with 106 additions and 69 deletions

View File

@@ -242,6 +242,11 @@ void desktop_lock(Desktop* desktop, bool pin_lock) {
Cli* cli = furi_record_open(RECORD_CLI);
cli_session_close(cli);
furi_record_close(RECORD_CLI);
if (!XTREME_SETTINGS()->allow_locked_rpc_commands) {
Bt* bt = furi_record_open(RECORD_BT);
bt_close_rpc_connection(bt);
furi_record_close(RECORD_BT);
}
}
desktop_auto_lock_inhibit(desktop);
@@ -270,6 +275,10 @@ void desktop_unlock(Desktop* desktop) {
furi_record_close(RECORD_CLI);
}
Bt* bt = furi_record_open(RECORD_BT);
bt_open_rpc_connection(bt);
furi_record_close(RECORD_BT);
DesktopStatus status = {.locked = false};
furi_pubsub_publish(desktop->status_pubsub, &status);
}
@@ -435,9 +444,7 @@ bool desktop_api_is_locked(Desktop* instance) {
void desktop_api_unlock(Desktop* instance) {
furi_assert(instance);
if(!furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock) || XTREME_SETTINGS()->pin_unlock_from_app) {
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopLockedEventUnlocked);
}
view_dispatcher_send_custom_event(instance->view_dispatcher, DesktopLockedEventUnlocked);
}
FuriPubSub* desktop_api_get_status_pubsub(Desktop* instance) {