Prevent autolock based on RPC too --nobuild

This commit is contained in:
Willy-JL
2025-02-05 01:58:19 +00:00
parent 8553132b71
commit 69e9423712
3 changed files with 9 additions and 4 deletions

View File

@@ -138,8 +138,13 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) {
} else if(event == DesktopGlobalAutoLock) {
if(!desktop->app_running && !desktop->locked) {
// Disable AutoLock if usb_inhibit_autolock option enabled and device have active USB session.
if((desktop->settings.usb_inhibit_auto_lock) && (furi_hal_usb_is_locked())) {
return true;
if(desktop->settings.usb_inhibit_auto_lock) {
Rpc* rpc = furi_record_open(RECORD_RPC);
bool inhibit_auto_lock = furi_hal_usb_is_locked() || rpc_get_sessions_count(rpc);
furi_record_close(RECORD_RPC);
if(inhibit_auto_lock) {
return true;
}
}
desktop_lock(desktop, desktop->settings.auto_lock_with_pin);
}

View File

@@ -124,7 +124,7 @@ void desktop_settings_scene_start_on_enter(void* context) {
// USB connection Inhibit autolock OFF|ON|with opened RPC session
item = variable_item_list_add(
variable_item_list,
"Auto Lock disarm by active USB session",
"Prevent Auto Lock with USB/RPC session",
USB_INHIBIT_AUTO_LOCK_DELAY_COUNT,
desktop_settings_scene_start_usb_inhibit_auto_lock_delay_changed,
app);