return done;
}
-static int battery_health_changed(void *data)
-{
- int health = DATA_VALUE_INT(data);
-
- _I("battery health change %d", health);
-
- if (health == HEALTH_GOOD) {
- clear_pm_status_flag(BATTERY_FLAG);
- clear_pm_status_flag(DIMSTAY_FLAG);
- } else if (health == HEALTH_LOW || health == HEALTH_HIGH || health == HEALTH_OVP) {
- set_pm_status_flag(BATTERY_FLAG);
- set_pm_status_flag(DIMSTAY_FLAG);
- }
-
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_backlight_update_by_default_brightness();
-
- return 0;
-}
-
static gboolean delayed_dpms_init_done(gpointer data)
{
int timeout;
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- register_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
register_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
register_notifier(DEVICE_NOTIFIER_POWEROFF_TRIGGERED, poweroff_triggered_callback);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- unregister_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
unregister_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
break;
return done;
}
-static int battery_health_changed(void *data)
-{
- int health = DATA_VALUE_INT(data);
-
- _I("battery health change %d", health);
-
- if (health == HEALTH_GOOD) {
- clear_pm_status_flag(BATTERY_FLAG);
- clear_pm_status_flag(DIMSTAY_FLAG);
- } else if (health == HEALTH_LOW || health == HEALTH_HIGH || health == HEALTH_OVP) {
- set_pm_status_flag(BATTERY_FLAG);
- set_pm_status_flag(DIMSTAY_FLAG);
- }
-
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_backlight_update_by_default_brightness();
-
- return 0;
-}
-
static gboolean delayed_dpms_init_done(gpointer data)
{
int timeout;
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- register_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
register_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
register_notifier(DEVICE_NOTIFIER_POWEROFF_TRIGGERED, poweroff_triggered_callback);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- unregister_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
unregister_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
break;
return done;
}
-static int battery_health_changed(void *data)
-{
- int health = DATA_VALUE_INT(data);
-
- _I("battery health change %d", health);
-
- if (health == HEALTH_GOOD) {
- clear_pm_status_flag(BATTERY_FLAG);
- clear_pm_status_flag(DIMSTAY_FLAG);
- } else if (health == HEALTH_LOW || health == HEALTH_HIGH || health == HEALTH_OVP) {
- set_pm_status_flag(BATTERY_FLAG);
- set_pm_status_flag(DIMSTAY_FLAG);
- }
-
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_backlight_update_by_default_brightness();
-
- return 0;
-}
-
static gboolean delayed_dpms_init_done(gpointer data)
{
int timeout;
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- register_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
register_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
register_notifier(DEVICE_NOTIFIER_POWEROFF_TRIGGERED, poweroff_triggered_callback);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- unregister_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
unregister_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
break;
return done;
}
-static int battery_health_changed(void *data)
-{
- int health = DATA_VALUE_INT(data);
-
- _I("battery health change %d", health);
-
- if (health == HEALTH_GOOD) {
- clear_pm_status_flag(BATTERY_FLAG);
- clear_pm_status_flag(DIMSTAY_FLAG);
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- auto_brightness_restore();
- } else if (health == HEALTH_LOW || health == HEALTH_HIGH || health == HEALTH_OVP) {
- set_pm_status_flag(BATTERY_FLAG);
- set_pm_status_flag(DIMSTAY_FLAG);
- if (display_panel_get_dpms_cached_state() == DPMS_ON)
- display_backlight_update_by_default_brightness();
- }
-
- return 0;
-}
-
static int powerlock_load_config(struct parse_result *result, void *user_data)
{
char *name = NULL;
register_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
register_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
register_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- register_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
register_notifier(DEVICE_NOTIFIER_LCD_AUTOBRT_SENSING, display_auto_brightness_sensing);
register_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
register_notifier(DEVICE_NOTIFIER_POWEROFF_TRIGGERED, poweroff_triggered_callback);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_BACKGROUND, display_app_background);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_FOREGROUND, display_app_foreground);
unregister_notifier(DEVICE_NOTIFIER_APPLICATION_TERMINATED, display_app_terminated);
- unregister_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, battery_health_changed);
unregister_notifier(DEVICE_NOTIFIER_POWER_RESUME_FROM_ECHO_MEM, power_resume_from_echomem_callback);
break;
*/
#include <stdio.h>
+#include <stdbool.h>
#include <vconf-keys.h>
+#include "battery/power-supply.h"
+#include "shared/device-notifier.h"
#include "shared/log.h"
+#include "display.h"
+#include "display-backlight.h"
#include "display-misc.h"
+#include "display-panel.h"
#include "display-plugin.h"
#include "poll.h"
}
*on = stay_touchscreen_off;
+}
+
+/* FIXME: This fucntion should be relocated under the battery module or redefined */
+static int changed_battery_health(void *data)
+{
+ int health = DATA_VALUE_INT(data);
+
+ _I("battery health change %d", health);
+
+ if (health == HEALTH_GOOD) {
+ clear_pm_status_flag(BATTERY_FLAG);
+ clear_pm_status_flag(DIMSTAY_FLAG);
+ } else if (health == HEALTH_LOW || health == HEALTH_HIGH || health == HEALTH_OVP) {
+ set_pm_status_flag(BATTERY_FLAG);
+ set_pm_status_flag(DIMSTAY_FLAG);
+ }
+
+ if (display_panel_get_dpms_cached_state() == DPMS_ON)
+ display_backlight_update_by_default_brightness();
+
+ return 0;
+}
+
+void display_misc_register_battery_health_notifier(void)
+{
+ register_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, changed_battery_health);
+}
+
+void display_misc_unregister_battery_health_notifier(void)
+{
+ unregister_notifier(DEVICE_NOTIFIER_BATTERY_HEALTH, changed_battery_health);
}
\ No newline at end of file
void display_misc_get_process_name(pid_t pid, char *pname);
void display_misc_set_stay_touchscreen_off(bool on);
void display_misc_get_stay_touchscreen_off(bool *on);
+void display_misc_register_battery_health_notifier(void);
+void display_misc_unregister_battery_health_notifier(void);
#endif /* __DISPLAY_MISC_H__ */
\ No newline at end of file
#include "display.h"
#include "display-plugin.h"
#include "display-config.h"
+#include "display-misc.h"
#include "display-signal.h"
static const struct device_ops *display_plugin_device_ops;
display_plugin_device_ops->init(data);
display_signal_register_display_brightness_notifier();
+ display_misc_register_battery_health_notifier();
}
static void display_exit(void *data)
display_plugin_device_ops->exit(data);
display_signal_unregister_display_brightness_notifier();
+ display_misc_unregister_battery_health_notifier();
}
static int display_start(enum device_flags flags)