Prevent hacking related backgrounds from being displayed in dummy mode. (#2107)

* Prevent hacking related backgrounds from being displayed in dummy mode.
* Add function call to animation manager to set dummy mode.
* Reboot retains dummy mode background.

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
usiegl00 2022-12-12 21:46:41 +09:00 committed by GitHub
parent d541f142c8
commit 1c12613863
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 1 deletions

View File

@ -52,6 +52,7 @@ struct AnimationManager {
FuriString* freezed_animation_name; FuriString* freezed_animation_name;
int32_t freezed_animation_time_left; int32_t freezed_animation_time_left;
ViewStack* view_stack; ViewStack* view_stack;
bool dummy_mode;
}; };
static StorageAnimation* static StorageAnimation*
@ -93,6 +94,12 @@ void animation_manager_set_interact_callback(
animation_manager->interact_callback = callback; animation_manager->interact_callback = callback;
} }
void animation_manager_set_dummy_mode_state(AnimationManager* animation_manager, bool enabled) {
furi_assert(animation_manager);
animation_manager->dummy_mode = enabled;
animation_manager_start_new_idle(animation_manager);
}
static void animation_manager_check_blocking_callback(const void* message, void* context) { static void animation_manager_check_blocking_callback(const void* message, void* context) {
const StorageEvent* storage_event = message; const StorageEvent* storage_event = message;
@ -363,7 +370,9 @@ static bool animation_manager_is_valid_idle_animation(
static StorageAnimation* static StorageAnimation*
animation_manager_select_idle_animation(AnimationManager* animation_manager) { animation_manager_select_idle_animation(AnimationManager* animation_manager) {
UNUSED(animation_manager); if(animation_manager->dummy_mode) {
return animation_storage_find_animation(HARDCODED_ANIMATION_NAME);
}
StorageAnimationList_t animation_list; StorageAnimationList_t animation_list;
StorageAnimationList_init(animation_list); StorageAnimationList_init(animation_list);
animation_storage_fill_animation_list(&animation_list); animation_storage_fill_animation_list(&animation_list);

View File

@ -157,3 +157,11 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
* @animation_manager instance * @animation_manager instance
*/ */
void animation_manager_load_and_continue_animation(AnimationManager* animation_manager); void animation_manager_load_and_continue_animation(AnimationManager* animation_manager);
/**
* Enable or disable dummy mode backgrounds of animation manager.
*
* @animation_manager instance
* @enabled bool
*/
void animation_manager_set_dummy_mode_state(AnimationManager* animation_manager, bool enabled);

View File

@ -144,6 +144,7 @@ void desktop_unlock(Desktop* desktop) {
void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled) { void desktop_set_dummy_mode_state(Desktop* desktop, bool enabled) {
view_port_enabled_set(desktop->dummy_mode_icon_viewport, enabled); view_port_enabled_set(desktop->dummy_mode_icon_viewport, enabled);
desktop_main_set_dummy_mode_state(desktop->main_view, enabled); desktop_main_set_dummy_mode_state(desktop->main_view, enabled);
animation_manager_set_dummy_mode_state(desktop->animation_manager, enabled);
desktop->settings.dummy_mode = enabled; desktop->settings.dummy_mode = enabled;
DESKTOP_SETTINGS_SAVE(&desktop->settings); DESKTOP_SETTINGS_SAVE(&desktop->settings);
} }
@ -330,6 +331,8 @@ int32_t desktop_srv(void* p) {
view_port_enabled_set(desktop->dummy_mode_icon_viewport, desktop->settings.dummy_mode); view_port_enabled_set(desktop->dummy_mode_icon_viewport, desktop->settings.dummy_mode);
desktop_main_set_dummy_mode_state(desktop->main_view, desktop->settings.dummy_mode); desktop_main_set_dummy_mode_state(desktop->main_view, desktop->settings.dummy_mode);
animation_manager_set_dummy_mode_state(
desktop->animation_manager, desktop->settings.dummy_mode);
scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain); scene_manager_next_scene(desktop->scene_manager, DesktopSceneMain);