Remove and redefine custom_status getter/setter.
These functions are added below display-backlight.
void display_backlight_set_custom_status(bool on)
void display_backlight_get_custom_status(bool *on)
-> With these functions, it is possible to get and set custom status.
Change-Id: I353fd29d0d9fcc00504070f42d472c2bb89f3511
Signed-off-by: Yunhee Seo <yuni.seo@samsung.com>
static time_t last_update_time = 0;
static int last_timeout = 0;
struct timeval now_tv;
+ bool custom_status;
if (status != DEVICE_OPS_STATUS_START) {
_E("Display is not started.");
break;
case S_LCDDIM:
- if ((get_pm_old_state() == S_NORMAL) &&
- backlight_ops->get_custom_status())
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_old_state() == S_NORMAL) && custom_status)
backlight_ops->save_custom_brightness();
/* lcd dim state : dim the brightness */
display_backlight_set_brightness_by_dim_brightness();
break;
case SETTING_POWER_CUSTOM_BRIGHTNESS:
if (val == VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON)
- backlight_ops->set_custom_status(true);
+ display_backlight_set_custom_status(true);
else
- backlight_ops->set_custom_status(false);
+ display_backlight_set_custom_status(false);
break;
default:
#define FREEZER_VITAL_WAKEUP_CGROUP "/sys/fs/cgroup/freezer/vital_wakeup/freezer.state"
static struct _backlight_ops backlight_ops;
-static bool custom_status;
static int custom_brightness;
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
}
}
-static int set_custom_status(bool on)
-{
- custom_status = on;
- return 0;
-}
-
-static bool get_custom_status(void)
-{
- return custom_status;
-}
-
static int save_custom_brightness(void)
{
int ret, brightness;
{
int ret = 0;
int brt;
+ bool custom_status;
- if (get_custom_status()) {
+ display_backlight_get_custom_status(&custom_status);
+ if (custom_status) {
_I("custom brightness mode! brt no updated");
return 0;
}
.update = backlight_update,
.get_lcd_power = dpms_get_cached_state,
.get_lcd_power_node = get_lcd_power_node,
- .set_custom_status = set_custom_status,
- .get_custom_status = get_custom_status,
.save_custom_brightness = save_custom_brightness,
.custom_update = custom_backlight_update,
.set_force_brightness = set_force_brightness,
#include "core.h"
#include "poll.h"
#include "display-actor.h"
+#include "display-backlight.h"
#include "display-ops.h"
#include "shared/common.h"
#include "shared/devices.h"
static inline void restore_custom_brightness(void)
{
- if ((get_pm_cur_state() == S_LCDDIM) &&
- backlight_ops->get_custom_status())
+ bool custom_status;
+
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
backlight_ops->custom_update();
}
static time_t last_update_time = 0;
static int last_timeout = 0;
struct timeval now_tv;
+ bool custom_status;
if (status != DEVICE_OPS_STATUS_START) {
_E("Display is not started.");
break;
case S_LCDDIM:
- if ((get_pm_old_state() == S_NORMAL) &&
- backlight_ops->get_custom_status())
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_old_state() == S_NORMAL) && custom_status)
backlight_ops->save_custom_brightness();
/* lcd dim state : dim the brightness */
display_backlight_set_brightness_by_dim_brightness();
break;
case SETTING_POWER_CUSTOM_BRIGHTNESS:
if (val == VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON)
- backlight_ops->set_custom_status(true);
+ display_backlight_set_custom_status(true);
else
- backlight_ops->set_custom_status(false);
+ display_backlight_set_custom_status(false);
break;
default:
#define UNKNOWN_STR "unknown"
static struct _backlight_ops backlight_ops;
-static bool custom_status;
static int custom_brightness;
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
}
}
-static int set_custom_status(bool on)
-{
- custom_status = on;
- return 0;
-}
-
-static bool get_custom_status(void)
-{
- return custom_status;
-}
-
static int save_custom_brightness(void)
{
int ret, brightness;
{
int ret = 0;
int brt;
+ bool custom_status;
- if (get_custom_status()) {
+ display_backlight_get_custom_status(&custom_status);
+ if (custom_status) {
_I("custom brightness mode! brt no updated");
return 0;
}
.update = backlight_update,
.get_lcd_power = dpms_get_cached_state,
.get_lcd_power_node = get_lcd_power_node,
- .set_custom_status = set_custom_status,
- .get_custom_status = get_custom_status,
.save_custom_brightness = save_custom_brightness,
.custom_update = custom_backlight_update,
.set_force_brightness = set_force_brightness,
#include "core.h"
#include "poll.h"
#include "display-actor.h"
+#include "display-backlight.h"
#include "display-ops.h"
#include "shared/common.h"
#include "shared/devices.h"
static inline void restore_custom_brightness(void)
{
- if ((get_pm_cur_state() == S_LCDDIM) &&
- backlight_ops->get_custom_status())
+ bool custom_status;
+
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
backlight_ops->custom_update();
}
static time_t last_update_time = 0;
static int last_timeout = 0;
struct timeval now_tv;
+ bool custom_status;
if (status != DEVICE_OPS_STATUS_START) {
_E("Display is not started.");
break;
case S_LCDDIM:
- if ((get_pm_old_state() == S_NORMAL) &&
- backlight_ops->get_custom_status())
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_old_state() == S_NORMAL) && custom_status)
backlight_ops->save_custom_brightness();
/* lcd dim state : dim the brightness */
display_backlight_set_brightness_by_dim_brightness();
break;
case SETTING_POWER_CUSTOM_BRIGHTNESS:
if (val == VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON)
- backlight_ops->set_custom_status(true);
+ display_backlight_set_custom_status(true);
else
- backlight_ops->set_custom_status(false);
+ display_backlight_set_custom_status(false);
break;
default:
#define FREEZER_VITAL_WAKEUP_CGROUP "/sys/fs/cgroup/freezer/vital_wakeup/freezer.state"
static struct _backlight_ops backlight_ops;
-static bool custom_status;
static int custom_brightness;
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
}
}
-static int set_custom_status(bool on)
-{
- custom_status = on;
- return 0;
-}
-
-static bool get_custom_status(void)
-{
- return custom_status;
-}
-
static int save_custom_brightness(void)
{
int ret, brightness;
{
int ret = 0;
int brt;
+ bool custom_status;
- if (get_custom_status()) {
+ display_backlight_get_custom_status(&custom_status);
+ if (custom_status) {
_I("custom brightness mode! brt no updated");
return 0;
}
.update = backlight_update,
.get_lcd_power = dpms_get_cached_state,
.get_lcd_power_node = get_lcd_power_node,
- .set_custom_status = set_custom_status,
- .get_custom_status = get_custom_status,
.save_custom_brightness = save_custom_brightness,
.custom_update = custom_backlight_update,
.set_force_brightness = set_force_brightness,
#include "core.h"
#include "poll.h"
#include "display-actor.h"
+#include "display-backlight.h"
#include "display-ops.h"
#include "shared/common.h"
#include "shared/devices.h"
static inline void restore_custom_brightness(void)
{
- if ((get_pm_cur_state() == S_LCDDIM) &&
- backlight_ops->get_custom_status())
+ bool custom_status;
+
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
backlight_ops->custom_update();
}
static time_t last_update_time = 0;
static int last_timeout = 0;
struct timeval now_tv;
+ bool custom_status;
if (status != DEVICE_OPS_STATUS_START) {
_E("Display is not started.");
break;
case S_LCDDIM:
- if ((get_pm_old_state() == S_NORMAL) &&
- backlight_ops->get_custom_status())
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_old_state() == S_NORMAL) && custom_status)
backlight_ops->save_custom_brightness();
/* lcd dim state : dim the brightness */
display_backlight_set_brightness_by_dim_brightness();
break;
case SETTING_POWER_CUSTOM_BRIGHTNESS:
if (val == VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON)
- backlight_ops->set_custom_status(true);
+ display_backlight_set_custom_status(true);
else
- backlight_ops->set_custom_status(false);
+ display_backlight_set_custom_status(false);
break;
default:
static struct _backlight_ops backlight_ops;
static struct battery_plugin *battery_plgn;
-static bool custom_status;
static int custom_brightness;
static int force_brightness;
static int dpms_running_state = DPMS_SETTING_DONE;
}
}
-static int set_custom_status(bool on)
-{
- custom_status = on;
- return 0;
-}
-
-static bool get_custom_status(void)
-{
- return custom_status;
-}
-
static int save_custom_brightness(void)
{
int ret, brightness;
{
int ret = 0;
int brt;
+ bool custom_status;
- if (get_custom_status()) {
+ display_backlight_get_custom_status(&custom_status);
+ if (custom_status) {
_I("custom brightness mode! brt no updated");
return 0;
}
.update = backlight_update,
.get_lcd_power = dpms_get_cached_state,
.get_lcd_power_node = get_lcd_power_node,
- .set_custom_status = set_custom_status,
- .get_custom_status = get_custom_status,
.save_custom_brightness = save_custom_brightness,
.custom_update = custom_backlight_update,
.set_force_brightness = set_force_brightness,
#include "poll.h"
#include "display-actor.h"
#include "display-ops.h"
+#include "display-backlight.h"
#include "shared/common.h"
#include "shared/devices.h"
#include "shared/device-notifier.h"
static inline void restore_custom_brightness(void)
{
- if ((get_pm_cur_state() == S_LCDDIM) &&
- backlight_ops->get_custom_status())
+ bool custom_status;
+
+ display_backlight_get_custom_status(&custom_status);
+ if ((get_pm_cur_state() == S_LCDDIM) && custom_status)
backlight_ops->custom_update();
}
int (*update)(void);
int (*get_lcd_power)(void);
int (*get_lcd_power_node)(void);
- int (*set_custom_status)(bool on);
- bool (*get_custom_status)(void);
int (*save_custom_brightness)(void);
int (*custom_update)(void);
int (*set_force_brightness)(int level);
static struct _backlight_ops *backlight_ops;
static int default_brightness;
+static bool custom_status;
/* FIXME: This function is for temporary use, should be fixed after plugin refactoring */
int display_backlight_get_max_brightness(int *max_brightness)
return ret;
}
+/* FIXME: This custom_status policy can be changed, after plugin refactoting*/
+void display_backlight_set_custom_status(bool on)
+{
+ custom_status = on;
+}
+
+/* FIXME: This custom_status policy can be changed, after plugin refactoting*/
+void display_backlight_get_custom_status(bool *on)
+{
+ *on = custom_status;
+}
+
/* FIXME: This code structure should be changed to plugin api call, after plugin refactoting*/
static void __CONSTRUCTOR__ initialize(void)
{
int display_backlight_set_default_brightness(int brightness);
int display_backlight_get_default_brightness(int *brightness);
int display_backlight_set_brightness_by_dim_brightness(void);
+void display_backlight_set_custom_status(bool on);
+void display_backlight_get_custom_status(bool *on);
#endif /* __DISPLAY_BACKLIGHT_H__ */
\ No newline at end of file
GVariant *param, GDBusMethodInvocation *invocation, gpointer user_data)
{
int status = 0;
+ bool custom_status;
- status = backlight_ops->get_custom_status();
+ display_backlight_get_custom_status(&custom_status);
+ status = custom_status;
return g_variant_new("(i)", status);
}