*In this description, "core" refers to the deviced module below src.
Move function remove_health_popup from mobile plugin to core battery module.
When the battery health status is abnormal, core battery module reuqests launching popup.
The location where it requests to add or remove pop-ups is different.
Actually, battery health management responsibility should be moved to core battery module.
Because overall battery health is manged in core battery moudle not mobile plugin.
Also, remove_health_popup() is used only power-supply in core battery module.
As explained above, it can be seen that shotgun surgery and feature envy code smells
from the remove_health_popup().
Delete the function from the mobile plguin battery module and move it to
the deviced core battery module.
Change-Id: I8ec91780e2b36cf4dee158b126ed94ed24da4371
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
static struct battery_status *battery;
static guint abnormal_timer;
-static void remove_health_popup(void)
-{
- int ret;
-
- ret = launch_system_app(APP_REMOVE, 2, APP_KEY_TYPE, REMOVE_POPUP);
- if (ret < 0)
- _E("Failed to launch remove battery popup(%d)", ret);
-}
-
static int check_power_supply_noti(void)
{
return 1;
return;
_D("Add plugins for battery notification.");
- plugin->remove_health_popup = remove_health_popup;
plugin->check_power_supply_noti = check_power_supply_noti;
ret = gdbus_signal_subscribe(NULL, DEVICED_PATH_SYSNOTI,
struct battery_plugin {
void *handle;
- /* low battery notification */
- void (*remove_health_popup) (void);
void (*launch_health_popup_by_display_state) (int display_state);
int (*check_power_supply_noti) (void);
event_system_send(SYS_EVENT_BATTERY_CHARGER_STATUS, EVT_KEY_BATTERY_CHARGER_STATUS, str);
}
+static void remove_health_popup(void)
+{
+ int ret = 0;
+
+ ret = launch_system_app(APP_REMOVE, 2, APP_KEY_TYPE, REMOVE_POPUP);
+ if (ret < 0)
+ _W("Failed to launch remove battery popup(%d)", ret);
+}
+
static int inform_changed_battery_connection(int status)
{
if (status == PRESENT_ABNORMAL)
g_source_remove(abnormal_health_popup_timer);
abnormal_health_popup_timer = 0;
}
- if (battery_plgn->remove_health_popup)
- battery_plgn->remove_health_popup();
+ remove_health_popup();
}
}