display: Add silent booting check logic during display initialization 94/316894/9
authorYunhee Seo <yuni.seo@samsung.com>
Fri, 30 Aug 2024 05:09:09 +0000 (14:09 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Wed, 11 Sep 2024 06:13:29 +0000 (15:13 +0900)
There are times when the display brightness surges
while silent booting is in progress.
To avoid above situation, defensive code has been added
to display initialization.
To support that logic, below static function is added.

static bool is_on_silent_booting(void);

Change-Id: Iee062c84c6d82b5a9ffae4e3a99c58989989c118
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
src/display/display.c

index 9187bac3c5e7bf4ad365df887267441bf7157be5..9a31f1f37713129ccd379ebd28cca206c4cb25cb 100644 (file)
@@ -49,6 +49,7 @@ static enum syscommon_deviced_display_orientation g_display_init_direction;
 static bool g_display_hal_backend_available = false;
 static GList *display_dependent_device_ops;
 static enum device_ops_status display_ops_status = DEVICE_OPS_STATUS_UNINIT;
+static bool is_on_silent_booting(void);
 extern void init_save_userlock(void);
 
 inline unsigned int get_pm_status_flag(void)
@@ -336,7 +337,8 @@ void display_set_initial_brightness(void)
        }
        _I("Set brightness(%d) from setting app.", brightness);
        display_backlight_set_default_brightness(brightness);
-       display_backlight_set_brightness(brightness);
+       if (!is_on_silent_booting())
+               display_backlight_set_brightness(brightness);
 }
 
 /* FIXME: This function should be moved to battery module after battery plguin/module refactoring */
@@ -446,16 +448,24 @@ static int delayed_init_done(void *data)
        return done;
 }
 
-int display_is_lcdon_blocked(void)
+static bool is_on_silent_booting(void)
 {
        bool silent_boot = false;
        int ret = 0;
 
+       if (delayed_init_done(NULL))
+               return false;
+
        ret = power_boot_get_silent_boot(&silent_boot);
        if (ret < 0)
                _W("Cannot get silent_boot please check function parameter, ret(%d)", ret);
 
-       if (silent_boot && !delayed_init_done(NULL))
+       return silent_boot;
+}
+
+int display_is_lcdon_blocked(void)
+{
+       if (is_on_silent_booting())
                return LCDON_BLOCK_DURING_SILENT_BOOT;
 
        return LCDON_BLOCK_NONE;