Add forced reboot option to screen 24/153524/5
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 29 Sep 2017 07:50:28 +0000 (09:50 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 29 Sep 2017 10:32:51 +0000 (12:32 +0200)
Forced reboot by longrpressing confirm button can be now allowed for single screen in its configuration.

Change-Id: I2d1ce0ceafbb84be190bc5c4ffad2784319e0439
Signed-off-by: Paweł Szewczyk <p.szewczyk@samsung.com>
[ Removed no longer used recovery_rui_screen_id enum ]
Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
src/librui/rui.h
src/system-recovery/recovery-rui.c
src/system-recovery/system-recovery.cfg.m4.in

index 11cef76..765092b 100644 (file)
@@ -55,6 +55,7 @@ typedef struct {
        rui_screen_on_enter     on_enter;
        rui_screen_draw         draw;
        int                     screen_back;
+       int                     allow_force_reboot;
 } rui_screen;
 
 bool rui_init(rui_screen *screens, int screens_num, int current_screen,
index 837d054..50521b8 100644 (file)
 
 bool volatile running = true;
 
-typedef enum {
-       RECOVERY_RUI_SCREEN_FACTORY_RUN = 4,
-} recovery_rui_screen_id;
-
 void recovery_rui_input_callback(user_action action, user_action_type action_type)
 {
        int need_repaint = 1;
@@ -59,7 +55,7 @@ void recovery_rui_input_callback(user_action action, user_action_type action_typ
                rui_menu_cursor_down(cs->menu);
        else if (action == ACTION_UP && cs->menu)
                rui_menu_cursor_up(cs->menu);
-       else if (get_current_screen_id() == RECOVERY_RUI_SCREEN_FACTORY_RUN &&
+       else if (cs->allow_force_reboot &&
                 action == ACTION_CONFIRM &&
                 action_type == ACTION_TYPE_LONGPRESS)
                sys_power_reboot();
@@ -424,6 +420,7 @@ static int screen_entry_parse(config_setting_t *root, void *data)
                          rui_config_labels.rui_animations);
 
        screen->screen_back = get_screen_id(root, "screen_back");
+       config_setting_lookup_int(root, "allow_force_reboot", &screen->allow_force_reboot);
 
        /*
          screen->progress_bar = NULL;
index 105d3aa..d1134aa 100644 (file)
@@ -281,5 +281,6 @@ screens = {
         images = ("background_default", "menu_title");
         animations = ("working");
         screen_back = "main";
+        allow_force_reboot = 1;
     };
 };