battery: Remove update_ovp() from plugins 45/301645/3
authorYunhee Seo <yuni.seo@samsung.com>
Tue, 17 Oct 2023 06:42:54 +0000 (15:42 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Tue, 21 Nov 2023 07:36:34 +0000 (16:36 +0900)
update_ovp() is plugin policy function and it is called
when the battery health state changed to HEALTH_OVP.
However, there is no handling codes for battery health OVP state.
1. There is no subscription code and callback for DEVICED_NOTIFIER_BATTERY_OVP
2. update_ovp() only changes meaningless display state without policy.
Thus, meaningless update_ovp() logic is removed from plugins and replaced by syscommon plugin function.

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

index 3c248e557c4d3ab7e60a0432802942ea6d4dc0fd..b1cf86d844564f325e96266f541551078486a74e 100644 (file)
@@ -304,14 +304,6 @@ static int check_power_supply_noti(void)
        return 1;
 }
 
-static void update_ovp(enum battery_noti_status status)
-{
-       if (status == DEVICE_NOTI_ON)
-               battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_DIM);
-       else
-               battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL);
-}
-
 static void health_timer_reset(void)
 {
        abnormal_timer = 0;
@@ -369,7 +361,6 @@ static void battery_notification_init(void *data)
 
        plugin->remove_health_popup = remove_health_popup;
        plugin->check_power_supply_noti = check_power_supply_noti;
-       plugin->update_ovp = update_ovp;
 
        ret = gdbus_signal_subscribe(NULL, DEVICED_PATH_SYSNOTI,
                DEVICED_INTERFACE_SYSNOTI, SIGNAL_CHARGEERR_RESPONSE, abnormal_popup_dbus_signal_handler, NULL, NULL);
index 4eb6cb67c03a15a2c0f483c63c4d18c1059671e0..ed6bb939817a65c7597882a768794a778ec05be3 100644 (file)
@@ -57,11 +57,6 @@ static int check_power_supply_noti(void)
        return 0;
 }
 
-static void update_ovp(enum battery_noti_status status)
-{
-       battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL);
-}
-
 static void battery_notification_init(void *data)
 {
        struct battery_plugin *plugin = (struct battery_plugin *)data;
@@ -71,7 +66,6 @@ static void battery_notification_init(void *data)
 
        _D("Add plugins for battery notification.");
        plugin->check_power_supply_noti = check_power_supply_noti;
-       plugin->update_ovp = update_ovp;
        plugin->launch_health_popup_by_display_state =
                launch_health_popup_by_display_state;
 }
index e4f8e9c6e3aa7d36bb18d1b18ebef15caa258794..76ed53019d94b7e1be7d964aebf480d40c7c639b 100644 (file)
@@ -42,7 +42,6 @@ struct battery_plugin {
 
        void (*launch_health_popup_by_display_state) (int display_state);
        int (*check_power_supply_noti) (void);
-       void (*update_ovp) (enum battery_noti_status status);
        /* Add plugins here */
 };
 
index 64589af486628157c9095dcccd70386596d1fda9..55b9ff80ef00dfe18ce13d565ae683a6fc5c8e9c 100644 (file)
@@ -27,6 +27,7 @@
 #include <libsyscommon/libgdbus.h>
 #include <libsyscommon/ini-parser.h>
 #include <libsyscommon/resource-manager.h>
+#include <system/syscommon-plugin-deviced-battery.h>
 #include <system/syscommon-plugin-deviced-common-interface.h>
 #include <system/syscommon-plugin-deviced-power-interface.h>
 
@@ -516,8 +517,6 @@ void relaunch_health_popup(void)
 
 static void check_abnormal_status(void)
 {
-       static int notify_status = DEVICE_NOTI_OFF;
-
        if (old_battery.health != HEALTH_LOW && old_battery.health != HEALTH_HIGH &&
            (battery.health == HEALTH_LOW || battery.health == HEALTH_HIGH))
                update_health(DEVICE_NOTI_ON);
@@ -531,33 +530,9 @@ static void check_abnormal_status(void)
                update_present(DEVICE_NOTI_OFF);
 
        if (old_battery.health != HEALTH_OVP && battery.health == HEALTH_OVP) {
-               _I("Charge %d OVP %d(old %d)",
-                       battery.charge_now, battery.health, old_battery.health);
-
-               old_battery.health = battery.health;
-
-               if (notify_status == DEVICE_NOTI_ON)
-                       return;
-               notify_status = DEVICE_NOTI_ON;
-
-               syscommon_notifier_emit_notify(DEVICED_NOTIFIER_BATTERY_OVP, (void *)&battery.health);
-
-               if (battery_plgn->update_ovp)
-                       battery_plgn->update_ovp(DEVICE_NOTI_ON);
+               syscommon_plugin_deviced_battery_update_health_ovp_state(DEVICED_BATTERY_NOTI_ON);
        } else if (battery.health != HEALTH_OVP && old_battery.health == HEALTH_OVP) {
-               _I("Charge %d OVP %d(old %d)",
-                       battery.charge_now, battery.health, old_battery.health);
-
-               old_battery.health = battery.health;
-
-               if (notify_status == DEVICE_NOTI_OFF)
-                       return;
-               notify_status = DEVICE_NOTI_OFF;
-
-               syscommon_notifier_emit_notify(DEVICED_NOTIFIER_BATTERY_OVP, (void *)&battery.health);
-
-               if (battery_plgn->update_ovp)
-                       battery_plgn->update_ovp(DEVICE_NOTI_OFF);
+               syscommon_plugin_deviced_battery_update_health_ovp_state(DEVICED_BATTERY_NOTI_OFF);
        }
 }