mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 20:58:36 -07:00
Prevent autolock based on RPC too --nobuild
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user