#include "display-signal.h"
#include "display-lock.h"
#include "display-backlight.h"
+#include "display-misc.h"
#include "display-panel.h"
#include "display-config.h"
#include "shared/plugin.h"
disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
}
-int low_battery_state(int val)
-{
- switch (val) {
- case VCONFKEY_SYSMAN_BAT_POWER_OFF:
- case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
- case VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF:
- return true;
- }
- return false;
-}
-
void get_pname(pid_t pid, char *pname)
{
char buf[PATH_MAX];
states[get_pm_cur_state()].trans(EVENT_INPUT);
break;
case SETTING_LOW_BATT:
- if (low_battery_state(val)) {
+ if (display_misc_is_low_battery_state(val)) {
if (!(get_pm_status_flag() & CHRGR_FLAG))
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
}
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
if (!(get_pm_status_flag() & CHRGR_FLAG)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
#include "display-signal.h"
#include "display-lock.h"
#include "display-backlight.h"
+#include "display-misc.h"
#include "display-panel.h"
#include "display-config.h"
#include "shared/plugin.h"
disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
}
-int low_battery_state(int val)
-{
- switch (val) {
- case VCONFKEY_SYSMAN_BAT_POWER_OFF:
- case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
- case VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF:
- return true;
- }
- return false;
-}
-
void get_pname(pid_t pid, char *pname)
{
char buf[PATH_MAX];
states[get_pm_cur_state()].trans(EVENT_INPUT);
break;
case SETTING_LOW_BATT:
- if (low_battery_state(val)) {
+ if (display_misc_is_low_battery_state(val)) {
if (!(get_pm_status_flag() & CHRGR_FLAG))
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
}
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
if (!(get_pm_status_flag() & CHRGR_FLAG)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
#include "display-signal.h"
#include "display-lock.h"
#include "display-backlight.h"
+#include "display-misc.h"
#include "display-panel.h"
#include "display-config.h"
#include "shared/plugin.h"
disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
}
-int low_battery_state(int val)
-{
- switch (val) {
- case VCONFKEY_SYSMAN_BAT_POWER_OFF:
- case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
- case VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF:
- return true;
- }
- return false;
-}
-
void get_pname(pid_t pid, char *pname)
{
char buf[PATH_MAX];
states[get_pm_cur_state()].trans(EVENT_INPUT);
break;
case SETTING_LOW_BATT:
- if (low_battery_state(val)) {
+ if (display_misc_is_low_battery_state(val)) {
if (!(get_pm_status_flag() & CHRGR_FLAG))
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
}
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
if (!(get_pm_status_flag() & CHRGR_FLAG)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
#include "display-signal.h"
#include "display-lock.h"
#include "display-backlight.h"
+#include "display-misc.h"
#include "display-panel.h"
#include "display-config.h"
#include "shared/plugin.h"
disp_plgn->pm_change_internal(INTERNAL_LOCK_PM, LCD_NORMAL);
}
-int low_battery_state(int val)
-{
- switch (val) {
- case VCONFKEY_SYSMAN_BAT_POWER_OFF:
- case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
- case VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF:
- return true;
- }
- return false;
-}
-
void get_pname(pid_t pid, char *pname)
{
char buf[PATH_MAX];
states[get_pm_cur_state()].trans(EVENT_INPUT);
break;
case SETTING_LOW_BATT:
- if (low_battery_state(val)) {
+ if (display_misc_is_low_battery_state(val)) {
if (!(get_pm_status_flag() & CHRGR_FLAG))
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
}
bat_state = VCONFKEY_SYSMAN_BAT_NORMAL;
_E("Failed to get vconf value for battery status low: %d", vconf_get_ext_errno());
}
- if (low_battery_state(bat_state)) {
+ if (display_misc_is_low_battery_state(bat_state)) {
if (!(get_pm_status_flag() & CHRGR_FLAG)) {
power_saving_func(true);
set_pm_status_flag(LOWBT_FLAG);
--- /dev/null
+/*
+ * deviced
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <vconf-keys.h>
+
+#include "display-misc.h"
+
+/* FIXME: This fucntion should be relocated under the battery module */
+bool display_misc_is_low_battery_state(int val)
+{
+ switch (val) {
+ case VCONFKEY_SYSMAN_BAT_CRITICAL_LOW:
+ case VCONFKEY_SYSMAN_BAT_POWER_OFF:
+ case VCONFKEY_SYSMAN_BAT_REAL_POWER_OFF:
+ return true;
+ }
+
+ return false;
+}
--- /dev/null
+/*
+ * deviced
+ *
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file display-misc.h
+ * @brief This is temporary header to devide plugin and core display module.
+ * After refactoring, this file will be removed.
+ */
+#ifndef __DISPLAY_MISC_H__
+#define __DISPLAY_MISC_H__
+
+#include <stdbool.h>
+
+bool display_misc_is_low_battery_state(int val);
+
+#endif /* __DISPLAY_MISC_H__ */
\ No newline at end of file
int display_on_by_reason(const char *reason, int timeout);
int display_off_by_reason(const char *reason);
void update_lcdoff_source(int source);
-int low_battery_state(int val);
int set_lcd_timeout(int on, int dim, int holdkey_block, const char *name);
void save_display_log(const char *path);
int custom_lcdon(int timeout);
#include "display-config.h"
//#include "display/display.h"
#include "display-backlight.h"
+#include "display-misc.h"
#define AUL_APPSTATUS_PATH "/Org/Tizen/Aul/AppStatus"
#define AUL_APPSTATUS_INTERFACE "org.tizen.aul.AppStatus"
brt = ret;
// check dim state
- if (!disp_plgn->auto_brightness_control && low_battery_state(bat) &&
+ if (!disp_plgn->auto_brightness_control && display_misc_is_low_battery_state(bat) &&
charger == VCONFKEY_SYSMAN_CHARGER_DISCONNECTED && !changed) {
_D("batt warning low : brightness is not changed!");
if (brt != 0)