plugin: mobile: battery: Remove check_power_supply_noti() from mobile plugin 49/312849/1
authorYunhee Seo <yuni.seo@samsung.com>
Thu, 23 May 2024 06:41:44 +0000 (15:41 +0900)
committerYunhee Seo <yuni.seo@samsung.com>
Mon, 17 Jun 2024 02:22:25 +0000 (11:22 +0900)
check_power_supply_noti() decides whether to notify battery full or not.
Previously, while separating the plugin,
the deletion part was inevitably reflected late due to the work sequence.
However, since the plugin-backend/deviced-mobile separation worked well,
and there is no need for it to exist in deviced project any longer,
deleting it is appropriate.

However, since this function exists in the wearable, function pointer initialization is only deleted from the mobile plugin.
And that part is replaced with a syscommon_plugin_deviced_battery_is_possible_to_notify_battery_full().
It calls plugin-backend/deviced-mobile function.

In order to delete the dependency on mobile plugins, this deletion is necessary.

Change-Id: I3edfef59f3c42285c50b603fdbd9b8b068f22902
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
plugins/mobile/battery/battery-notification.c
src/battery/power-supply.c

index 1278242d1964f1bf6cbc0e6196d639ae16ad7ebb..6f4a7cf31b32b27879dcd9f29a6ae226516ebff5 100644 (file)
@@ -46,11 +46,6 @@ static struct display_plugin *disp_plgn;
 static struct battery_status *battery;
 static guint abnormal_timer;
 
-static int check_power_supply_noti(void)
-{
-       return 1;
-}
-
 static void health_timer_reset(void)
 {
        abnormal_timer = 0;
@@ -103,7 +98,6 @@ static void battery_notification_init(void *data)
                return;
 
        _D("Add plugins for battery notification.");
-       plugin->check_power_supply_noti = check_power_supply_noti;
 
        ret = gdbus_signal_subscribe(NULL, DEVICED_PATH_SYSNOTI,
                DEVICED_INTERFACE_SYSNOTI, SIGNAL_CHARGEERR_RESPONSE, abnormal_popup_dbus_signal_handler, NULL, NULL);
index 1ee162b38cbdf8fe9bb16c3532a6158faf2adba3..071083856a29a280c867418835374b92016bfa55 100644 (file)
@@ -222,9 +222,12 @@ static int send_full_noti(enum charge_full_type state)
        int ret = 0;
        int noti = 0;
        int retry;
+       bool is_possible_battery_full_noti;
 
        if (battery_plgn->check_power_supply_noti)
                noti = battery_plgn->check_power_supply_noti();
+       else if (syscommon_plugin_deviced_battery_is_possible_to_notify_battery_full(&is_possible_battery_full_noti) == 0)
+               noti = (int)is_possible_battery_full_noti;
 
        if (!noti)
                return ret;
@@ -362,6 +365,7 @@ int power_supply_broadcast(char *sig, int status)
 static void noti_batt_full(void)
 {
        static int bat_full_noti;
+       bool is_possible_battery_full_noti;
 
        if (!battery.charge_full && bat_full_noti == 1) {
                power_supply_noti(DEVICE_NOTI_BATT_FULL, DEVICE_NOTI_OFF);
@@ -375,8 +379,13 @@ static void noti_batt_full(void)
                /* turn on LCD, if battery is fully charged */
                if (battery_plgn->check_power_supply_noti && battery_plgn->check_power_supply_noti()) {
                        battery_pm_change_internal(DEVICED_EVENT_BATTERY_CAPACITY_FULL, LCD_NORMAL);
-               } else
+               } else if (syscommon_plugin_deviced_battery_is_possible_to_notify_battery_full(&is_possible_battery_full_noti) == 0) {
+                       if (is_possible_battery_full_noti) {
+                               battery_pm_change_internal(DEVICED_EVENT_BATTERY_CAPACITY_FULL, LCD_NORMAL);
+                       }
+               } else {
                        _I("Block LCD.");
+               }
 
                /* on the full charge state */
                syscommon_notifier_emit_notify(DEVICED_NOTIFIER_FULLBAT, (void *)&bat_full_noti);