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);
}