diff --git a/applications/main/xtreme_app/scenes/xtreme_app_scene_interface_lockscreen.c b/applications/main/xtreme_app/scenes/xtreme_app_scene_interface_lockscreen.c index 0fc1e1e9c..5ae21cb3f 100644 --- a/applications/main/xtreme_app/scenes/xtreme_app_scene_interface_lockscreen.c +++ b/applications/main/xtreme_app/scenes/xtreme_app_scene_interface_lockscreen.c @@ -10,6 +10,14 @@ void xtreme_app_scene_interface_lockscreen_var_item_list_callback(void* context, view_dispatcher_send_custom_event(app->view_dispatcher, index); } +static void xtreme_app_scene_interface_lockscreen_lock_on_boot_changed(VariableItem* item) { + XtremeApp* app = variable_item_get_context(item); + bool value = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, value ? "ON" : "OFF"); + XTREME_SETTINGS()->lock_on_boot = value; + app->save_settings = true; +} + static void xtreme_app_scene_interface_lockscreen_bad_pins_format_changed(VariableItem* item) { XtremeApp* app = variable_item_get_context(item); bool value = variable_item_get_current_value_index(item); @@ -64,6 +72,15 @@ void xtreme_app_scene_interface_lockscreen_on_enter(void* context) { VariableItemList* var_item_list = app->var_item_list; VariableItem* item; + item = variable_item_list_add( + var_item_list, + "Lock on Boot", + 2, + xtreme_app_scene_interface_lockscreen_lock_on_boot_changed, + app); + variable_item_set_current_value_index(item, xtreme_settings->lock_on_boot); + variable_item_set_current_value_text(item, xtreme_settings->lock_on_boot ? "ON" : "OFF"); + item = variable_item_list_add( var_item_list, "Format on 10 bad PINs", diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index f62e2e800..a9640699e 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "animations/animation_manager.h" #include "desktop/scenes/desktop_scene.h" @@ -463,7 +464,7 @@ int32_t desktop_srv(void* p) { scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain); - if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) { + if(XTREME_SETTINGS()->lock_on_boot || furi_hal_rtc_is_flag_set(FuriHalRtcFlagLock)) { desktop_lock(desktop, true); } else { if(!loader_is_locked(desktop->loader)) { diff --git a/lib/xtreme/settings.c b/lib/xtreme/settings.c index fbcc24218..aeab97e8a 100644 --- a/lib/xtreme/settings.c +++ b/lib/xtreme/settings.c @@ -12,6 +12,7 @@ XtremeSettings xtreme_settings = { .unlock_anims = false, // OFF .fallback_anim = true, // ON .wii_menu = true, // ON + .lock_on_boot = false, // OFF .bad_pins_format = false, // OFF .lockscreen_time = true, // ON .lockscreen_seconds = false, // OFF @@ -57,6 +58,8 @@ void XTREME_SETTINGS_LOAD() { flipper_format_rewind(file); flipper_format_read_bool(file, "bad_pins_format", &x->bad_pins_format, 1); flipper_format_rewind(file); + flipper_format_read_bool(file, "lock_on_boot", &x->lock_on_boot, 1); + flipper_format_rewind(file); flipper_format_read_bool(file, "lockscreen_time", &x->lockscreen_time, 1); flipper_format_rewind(file); flipper_format_read_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1); @@ -107,6 +110,7 @@ void XTREME_SETTINGS_SAVE() { flipper_format_write_bool(file, "fallback_anim", &x->fallback_anim, 1); flipper_format_write_bool(file, "wii_menu", &x->wii_menu, 1); flipper_format_write_bool(file, "bad_pins_format", &x->bad_pins_format, 1); + flipper_format_write_bool(file, "lock_on_boot", &x->lock_on_boot, 1); flipper_format_write_bool(file, "lockscreen_time", &x->lockscreen_time, 1); flipper_format_write_bool(file, "lockscreen_seconds", &x->lockscreen_seconds, 1); flipper_format_write_bool(file, "lockscreen_date", &x->lockscreen_date, 1); diff --git a/lib/xtreme/xtreme.h b/lib/xtreme/xtreme.h index 5cadc5ad9..b1eb408bf 100644 --- a/lib/xtreme/xtreme.h +++ b/lib/xtreme/xtreme.h @@ -20,6 +20,7 @@ typedef struct { bool unlock_anims; bool fallback_anim; bool wii_menu; + bool lock_on_boot; bool bad_pins_format; bool lockscreen_time; bool lockscreen_seconds;