From: Yunhee Seo Date: Wed, 6 Sep 2023 07:36:49 +0000 (+0900) Subject: battery: Move changed_battery_cf() from plugin to core X-Git-Tag: accepted/tizen/unified/20231122.172543~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8ea66c6d294551e64f621d2a62bcfd0bd45ae9c;p=platform%2Fcore%2Fsystem%2Fdeviced.git battery: Move changed_battery_cf() from plugin to core changed_battery_cf() was used to notify with system popup when the battery is disconnected. Notifying battery connection status is a general function. Thus, move changed_battery_cf() to the core battery module and name is replaced by inform_changed_battery_connection(). Change-Id: I17ccd437be55551f8501606dbe50ddf4461d688d Signed-off-by: Yunhee Seo --- diff --git a/plugins/mobile/battery/battery-notification.c b/plugins/mobile/battery/battery-notification.c index 63c3bdd6..3c248e55 100644 --- a/plugins/mobile/battery/battery-notification.c +++ b/plugins/mobile/battery/battery-notification.c @@ -49,7 +49,6 @@ #define METHOD_CRITICAL_NOTI_OFF "BatteryCriticalNotiOff" #define REMOVE_POPUP "remove_battery_popups" -#define DISCONNECT_POPUP "battdisconnect" enum event_noti_type { NOTI_NONE = -1, @@ -291,13 +290,6 @@ static void clean_lowbat_noti(const char *prev, const char *str) _D("Noti_crit(%d) noti_low(%d).", noti_crit, noti_low); } -static int changed_battery_cf(int status) -{ - if (status == PRESENT_ABNORMAL) - return launch_system_app(APP_ABNORMAL, 2, APP_KEY_TYPE, DISCONNECT_POPUP); - return launch_system_app(APP_REMOVE, 2, APP_KEY_TYPE, REMOVE_POPUP); -} - static void remove_health_popup(void) { int ret; @@ -375,7 +367,6 @@ static void battery_notification_init(void *data) plugin->lowbat_noti_launch = launch_lowbat_noti; plugin->lowbat_noti_clean = clean_lowbat_noti; - plugin->changed_battery_cf = changed_battery_cf; plugin->remove_health_popup = remove_health_popup; plugin->check_power_supply_noti = check_power_supply_noti; plugin->update_ovp = update_ovp; diff --git a/src/battery/battery-ops.h b/src/battery/battery-ops.h index 37efd0d3..e4f8e9c6 100644 --- a/src/battery/battery-ops.h +++ b/src/battery/battery-ops.h @@ -38,7 +38,6 @@ struct battery_plugin { int (*lowbat_noti_launch) (int capacity, int option); void (*lowbat_noti_clean) (const char *prev, const char *str); - int (*changed_battery_cf) (int status); void (*remove_health_popup) (void); void (*launch_health_popup_by_display_state) (int display_state); diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c index 6014a6fd..64589af4 100644 --- a/src/battery/power-supply.c +++ b/src/battery/power-supply.c @@ -84,6 +84,9 @@ #define METHOD_FULL_NOTI_OFF "BatteryFullNotiOff" #define METHOD_CHARGE_NOTI_ON "BatteryChargeNotiOn" +#define REMOVE_POPUP "remove_battery_popups" +#define DISCONNECT_POPUP "battdisconnect" + #define CHARGER_CHARGE_ON_NODE "/sys/class/power_supply/battery/chg_on" #define RETRY_MAX 5 @@ -409,6 +412,13 @@ static void charger_state_send_system_event(int state) event_system_send(SYS_EVENT_BATTERY_CHARGER_STATUS, EVT_KEY_BATTERY_CHARGER_STATUS, str); } +static int inform_changed_battery_connection(int status) +{ + if (status == PRESENT_ABNORMAL) + return launch_system_app(APP_ABNORMAL, 2, APP_KEY_TYPE, DISCONNECT_POPUP); + return launch_system_app(APP_REMOVE, 2, APP_KEY_TYPE, REMOVE_POPUP); +} + static void update_present(enum battery_noti_status status) { @@ -424,8 +434,7 @@ static void update_present(enum battery_noti_status status) syscommon_notifier_emit_notify(DEVICED_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present); display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_DIM, PM_SLEEP_MARGIN); } - if (battery_plgn->changed_battery_cf) - battery_plgn->changed_battery_cf(battery.present); + inform_changed_battery_connection(battery.present); } static void launch_health_popup(void)