From: Youngjae Cho Date: Mon, 7 Aug 2023 11:00:59 +0000 (+0900) Subject: Replace INTERNAL_LOCK_* with deviced_event of the libsyscommon X-Git-Tag: accepted/tizen/unified/20230818.183532~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b9fa7fd568e5242e17fe4fd1c5fbabb29a218a0d;p=platform%2Fcore%2Fsystem%2Fdeviced.git Replace INTERNAL_LOCK_* with deviced_event of the libsyscommon Most of INTERNAL_LOCK_XXX has changed to the same name, DEVICED_EVENT_XXX. A few of them, mostly INTERNAL_LOCK_PM, has changed to the best matching name that reflects its context. Change-Id: I4574e82985defed2578338b6c2bb3cbd34f023ea Signed-off-by: Youngjae Cho --- diff --git a/plugins/iot-headed/display/key-filter.c b/plugins/iot-headed/display/key-filter.c index 8585da3..b17c7bb 100644 --- a/plugins/iot-headed/display/key-filter.c +++ b/plugins/iot-headed/display/key-filter.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "ambient-mode.h" @@ -135,7 +136,7 @@ static void longkey_pressed(void) if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { /* change state - LCD on */ - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL); display_state_transition_do_state_transition_by_input_poll_event(); } @@ -390,7 +391,7 @@ static int lcdoff_powerkey(void) display_lock_release_lock_all(S_NORMAL); display_lock_release_lock_all(S_LCDDIM); display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; diff --git a/plugins/mobile/battery/battery-notification.c b/plugins/mobile/battery/battery-notification.c index be771f6..b42ec4c 100644 --- a/plugins/mobile/battery/battery-notification.c +++ b/plugins/mobile/battery/battery-notification.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core/log.h" #include "battery.h" @@ -162,7 +163,7 @@ static int launch_lowbat_noti(int capacity, int option) noti_type = METHOD_LOW_NOTI_UPDATE; else { noti_type = METHOD_LOW_NOTI_ON; - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_BATTERY_CAPACITY_LOW, LCD_NORMAL); } prev_level = battery_info.warning; if (battery->charge_now) @@ -202,7 +203,7 @@ static int launch_lowbat_noti(int capacity, int option) noti_type = METHOD_CRITICAL_NOTI_UPDATE; else { noti_type = METHOD_CRITICAL_NOTI_ON; - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_BATTERY_CAPACITY_LOW, LCD_NORMAL); } prev_level = battery_info.critical; if (battery->charge_now) @@ -308,9 +309,9 @@ static int check_power_supply_noti(void) static void update_ovp(enum battery_noti_status status) { if (status == DEVICE_NOTI_ON) - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_DIM); else - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); } static void health_timer_reset(void) @@ -327,9 +328,9 @@ static gboolean health_timer_cb(void *data) CRITICAL_LOG("Popup: Battery health status is not good, %s.", battery->health_s); syscommon_notifier_emit_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery->health); - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM); - display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN); - display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_DIM); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_DIM, STAY_CUR_STATE, 0); if (battery->health == HEALTH_LOW) battery_charge_err_low_act(NULL); else if (battery->health == HEALTH_HIGH) diff --git a/plugins/mobile/display/key-filter.c b/plugins/mobile/display/key-filter.c index 0ab4bee..d4948ad 100644 --- a/plugins/mobile/display/key-filter.c +++ b/plugins/mobile/display/key-filter.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "ambient-mode.h" @@ -127,7 +128,7 @@ static void longkey_pressed(void) if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { /* change state - LCD on */ - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL); display_state_transition_do_state_transition_by_input_poll_event(); } @@ -380,7 +381,7 @@ static int lcdoff_powerkey(void) display_lock_release_lock_all(S_NORMAL); display_lock_release_lock_all(S_LCDDIM); display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; diff --git a/plugins/tv/display/key-filter.c b/plugins/tv/display/key-filter.c index 29c96fd..2341906 100644 --- a/plugins/tv/display/key-filter.c +++ b/plugins/tv/display/key-filter.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "ambient-mode.h" @@ -134,7 +135,7 @@ static void longkey_pressed(void) if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { /* change state - LCD on */ - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL); display_state_transition_do_state_transition_by_input_poll_event(); } @@ -389,7 +390,7 @@ static int lcdoff_powerkey(void) display_lock_release_lock_all(S_NORMAL); display_lock_release_lock_all(S_LCDDIM); display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; diff --git a/plugins/wearable/battery/battery-notification.c b/plugins/wearable/battery/battery-notification.c index 19701ca..7b69283 100644 --- a/plugins/wearable/battery/battery-notification.c +++ b/plugins/wearable/battery/battery-notification.c @@ -18,6 +18,7 @@ #include #include +#include #include "core.h" #include "core/log.h" @@ -58,7 +59,7 @@ static int check_power_supply_noti(void) static void update_ovp(enum battery_noti_status status) { - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); } static void battery_notification_init(void *data) diff --git a/plugins/wearable/display/bezel.c b/plugins/wearable/display/bezel.c index ce0a02d..2868f07 100644 --- a/plugins/wearable/display/bezel.c +++ b/plugins/wearable/display/bezel.c @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +#include #include #include #include @@ -60,7 +61,7 @@ static void bezel_changed_cb(keynode_t *key_nodes, void *data) bezel_wakeup = vconf_keynode_get_bool(key_nodes); _I("Bezel wakeup condition: %d", bezel_wakeup); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_BEZEL, LCD_NORMAL); syscommon_notifier_emit_notify(DEVICE_NOTIFIER_BEZEL_WAKEUP, (void *)((intptr_t)bezel_wakeup)); } @@ -122,7 +123,7 @@ static void bezel_rotary_event_cb(keynode_t *key_nodes, void *data) ret = hal_device_bezel_set_sw_state(bezel_state); if (ret == 0) { _I("Bezel rotary event condition is %d", bezel_state); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_BEZEL, LCD_NORMAL); } else { _E("Failed to set bezel rotary event condition."); } diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index 53e84b0..eba2be7 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include "ambient-mode.h" @@ -126,7 +127,7 @@ static void longkey_pressed(void) if (display_has_caps(caps, DISPLAY_CAPA_LCDON)) { /* change state - LCD on */ - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_NORMAL); display_state_transition_do_state_transition_by_input_poll_event(); } @@ -388,7 +389,7 @@ static int lcdoff_powerkey(void) display_lock_release_lock_all(S_NORMAL); display_lock_release_lock_all(S_LCDDIM); display_state_transition_update_lcdoff_reason(VCONFKEY_PM_LCDOFF_BY_POWERKEY); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POWERKEY, LCD_OFF); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_INPUT_POWERKEY, LCD_OFF); } else { ignore = false; skip_combination = false; diff --git a/plugins/wearable/display/swim.c b/plugins/wearable/display/swim.c index f5f3cd1..27642b2 100644 --- a/plugins/wearable/display/swim.c +++ b/plugins/wearable/display/swim.c @@ -29,6 +29,7 @@ #include "shared/log.h" #include +#include #define DBUS_COREAPPS_SWIMMODE_PATH "/Org/Tizen/Coreapps/home/swimmode" #define DBUS_COREAPPS_SWIMMODE_INTERFACE "org.tizen.coreapps.home.swimmode" @@ -95,14 +96,14 @@ static void swimmode_signal_handler(GDBusConnection *conn, _I("Request swim mode state %d by %d", val, pid); if (display_panel_get_dpms_cached_state() != DPMS_ON) { - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_SWIM, S_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_SWIMMODE, S_NORMAL); lcd_state = true; } swim_execute((void *)((intptr_t)val)); if (lcd_state) { - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_SWIM, S_LCDOFF); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_SWIMMODE, S_LCDOFF); } } diff --git a/src/battery/lowbat-handler.c b/src/battery/lowbat-handler.c index dedc659..8a75bc4 100644 --- a/src/battery/lowbat-handler.c +++ b/src/battery/lowbat-handler.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "lowbat-handler.h" #include "battery-ops.h" @@ -256,9 +257,9 @@ direct_launch: if (lowbat_popup_option == BAT_OPT_ERR_TEMP_LOW || lowbat_popup_option == BAT_OPT_ERR_TEMP_HIGH || lowbat_popup_option == BAT_OPT_ERR_CF_OPEN) { - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_DIM); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_BATTERY_CAPACITY_LOW, LCD_DIM); } else { - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_LOWBAT, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_BATTERY_CAPACITY_LOW, LCD_NORMAL); } if (lowbat_popup_option == BAT_OPT_ERR_TEMP_LOW || lowbat_popup_option == BAT_OPT_ERR_TEMP_HIGH || @@ -304,14 +305,14 @@ int battery_charge_err_cf_act(void *data) int battery_charge_err_low_act(void *data) { - display_lock_request_lock_with_option(INTERNAL_LOCK_OVERCOOL, LCD_OFF, STAY_CUR_STATE, 60000); + display_lock_request_lock_with_option(DEVICED_EVENT_BATTERY_HEALTH_OVERCOOL, LCD_OFF, STAY_CUR_STATE, 60000); return lowbat_popup(BAT_OPT_ERR_TEMP_LOW); } int battery_charge_err_high_act(void *data) { - display_lock_request_lock_with_option(INTERNAL_LOCK_OVERHEAT, LCD_OFF, STAY_CUR_STATE, 60000); + display_lock_request_lock_with_option(DEVICED_EVENT_BATTERY_HEALTH_OVERHEAT, LCD_OFF, STAY_CUR_STATE, 60000); return lowbat_popup(BAT_OPT_ERR_TEMP_HIGH); } diff --git a/src/battery/power-supply.c b/src/battery/power-supply.c index 5c87a1c..85de74d 100644 --- a/src/battery/power-supply.c +++ b/src/battery/power-supply.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "shared/devices.h" #include "shared/device-notifier.h" @@ -164,7 +165,7 @@ static void pm_check_and_change(int bInserted) if (old == bInserted) return; old = bInserted; - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); } static void health_status_broadcast(void) @@ -367,7 +368,7 @@ static void noti_batt_full(void) bat_full_noti = 1; /* turn on LCD, if battery is fully charged */ if (battery_plgn->check_power_supply_noti && battery_plgn->check_power_supply_noti()) { - battery_pm_change_internal(INTERNAL_LOCK_BATTERY_FULL, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_BATTERY_CAPACITY_FULL, LCD_NORMAL); } else _I("Block LCD."); @@ -413,13 +414,13 @@ static void update_present(enum battery_noti_status status) old_battery.present = battery.present; if (status == DEVICE_NOTI_ON) { - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_DIM); syscommon_notifier_emit_notify(DEVICE_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present); - display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_DIM, STAY_CUR_STATE, 0); } else { - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); syscommon_notifier_emit_notify(DEVICE_NOTIFIER_BATTERY_PRESENT, (void *)&battery.present); - display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN); + 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); @@ -433,10 +434,10 @@ static void launch_health_popup(void) launching_health_popup = true; syscommon_notifier_emit_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery.health); - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_DIM); - display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN); - display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_DIM); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH); if (battery.health == HEALTH_LOW) battery_charge_err_low_act(NULL); else if (battery.health == HEALTH_HIGH) @@ -450,7 +451,7 @@ static void launch_health_popup(void) static gboolean health_popup_cb(void *data) { launch_health_popup(); - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); return G_SOURCE_CONTINUE; } @@ -465,10 +466,10 @@ static void update_health(enum battery_noti_status status) if (!abnormal_health_popup_timer) abnormal_health_popup_timer = g_timeout_add_seconds(ABNORMAL_CHECK_TIMER_INTERVAL, health_popup_cb, NULL); } else { - battery_pm_change_internal(INTERNAL_LOCK_POPUP, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); syscommon_notifier_emit_notify(DEVICE_NOTIFIER_BATTERY_HEALTH, (void *)&battery.health); - display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, PM_SLEEP_MARGIN); - display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_DIM, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_OFF, PM_SLEEP_MARGIN); health_status_broadcast(); if (abnormal_health_popup_timer) { CRITICAL_LOG("Battery health returned to normal. Stop abnormal popup."); @@ -490,8 +491,8 @@ void relaunch_health_popup(void) if (abnormal_health_popup_timer) g_source_remove(abnormal_health_popup_timer); - display_lock_request_unlock_with_option(INTERNAL_LOCK_POPUP, LCD_OFF, PM_SLEEP_MARGIN); - display_lock_request_lock_with_option(INTERNAL_LOCK_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_POPUP, LCD_DIM, STAY_CUR_STATE, LCD_DIM_TIME_IN_BATTERY_HEALTH); if (battery.health == HEALTH_LOW) battery_charge_err_low_act(NULL); else if (battery.health == HEALTH_HIGH) @@ -676,7 +677,7 @@ static void process_power_supply(void *data) int ret_lock = -1; int ret_val; - ret_lock = display_lock_request_lock_with_option(INTERNAL_LOCK_BATTERY, LCD_OFF, STAY_CUR_STATE, 0); + ret_lock = display_lock_request_lock_with_option(DEVICED_EVENT_BATTERY, LCD_OFF, STAY_CUR_STATE, 0); if (old_battery.charge_now != battery.charge_now || battery.charge_now == CHARGER_ABNORMAL) { ret_val = vconf_set_int(VCONFKEY_SYSMAN_BATTERY_CHARGE_NOW, battery.charge_now); @@ -689,7 +690,7 @@ static void process_power_supply(void *data) if (!strcmp(old_battery.status_s, CHARGEFULL_NAME) && !strcmp(battery.status_s, CHARGENOW_NAME)) { - battery_pm_change_internal(INTERNAL_LOCK_BATTERY, LCD_NORMAL); + battery_pm_change_internal(DEVICED_EVENT_BATTERY, LCD_NORMAL); } if (old_battery.charge_full != battery.charge_full) @@ -788,7 +789,7 @@ static void process_power_supply(void *data) } if (ret_lock == 0) { - display_lock_request_unlock_with_option(INTERNAL_LOCK_BATTERY, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_BATTERY, LCD_OFF, PM_SLEEP_MARGIN); } } diff --git a/src/display/ambient-mode.c b/src/display/ambient-mode.c index 8b6d8f0..34ce691 100644 --- a/src/display/ambient-mode.c +++ b/src/display/ambient-mode.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "core.h" #include "display.h" @@ -91,7 +92,7 @@ static void ambient_set_condition(keynode_t *key_nodes, void *data) val = vconf_keynode_get_bool(key_nodes); if (val != ambient_condition) { if (display_panel_get_dpms_cached_state() != DPMS_ON) - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_DISPLAY_AMBIENT, LCD_NORMAL); } ambient_condition = val; @@ -119,7 +120,7 @@ int ambient_set_state(int on) * So at that time deviced should turn off display to match the pair. */ if (on) { - display_lock_request_lock_with_option(INTERNAL_LOCK_AMBIENT, + display_lock_request_lock_with_option(DEVICED_EVENT_DISPLAY_AMBIENT, LCD_OFF, STAY_CUR_STATE, AMBIENT_CLOCK_WAITING_TIME); } else ambient_pid = 0; @@ -135,7 +136,7 @@ int ambient_set_state(int on) void ambient_check_invalid_state(pid_t pid) { - if (pid != INTERNAL_LOCK_AMBIENT) + if (pid != DEVICED_EVENT_DISPLAY_AMBIENT) return; if (syscommon_is_emulator()) { @@ -168,7 +169,7 @@ static void ambient_start_clock(void) (ambient_state == false)) return; - display_lock_request_lock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, STAY_CUR_STATE, + display_lock_request_lock_with_option(DEVICED_EVENT_DISPLAY_AMBIENT, LCD_OFF, STAY_CUR_STATE, AMBIENT_CLOCK_WAITING_TIME); } @@ -184,7 +185,7 @@ static void ambient_end_clock(pid_t pid) display_panel_set_panel_state_by_off_state(NORMAL_MODE); broadcast_lcd_off_late(LCD_OFF_LATE_MODE); - display_lock_request_unlock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_DISPLAY_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN); } update_count++; @@ -243,7 +244,7 @@ static void ambient_lcdoff_signal_handler(GDBusConnection *conn, return; } - display_lock_request_lock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, GOTO_STATE_NOW, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_DISPLAY_AMBIENT, LCD_OFF, GOTO_STATE_NOW, 0); _I("Display off in suspend state."); @@ -251,7 +252,7 @@ static void ambient_lcdoff_signal_handler(GDBusConnection *conn, lcd_direct_control(DPMS_OFF, NORMAL_MODE); broadcast_lcd_off_late(LCD_OFF_LATE_MODE); - display_lock_request_unlock_with_option(INTERNAL_LOCK_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_DISPLAY_AMBIENT, LCD_OFF, PM_SLEEP_MARGIN); } static void ambient_init(void *data) diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index 82ebc7e..a24eac7 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -103,7 +104,7 @@ static GVariant *dbus_stop(GDBusConnection *conn, if (NOT_SUPPORT_OPS(display_device_ops)) goto out; - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_DISPLAY, LCD_NORMAL); display_device_ops->stop(CORE_LOGIC_MODE); out: @@ -860,11 +861,11 @@ static GVariant *dbus_dumpmode(GDBusConnection *conn, if (!strcmp(on, "on")) { pm_save_logdump(); - display_lock_request_lock_with_option(INTERNAL_LOCK_DUMPMODE, LCD_OFF, + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_DUMPMODE, LCD_OFF, STAY_CUR_STATE, DUMP_MODE_WATING_TIME); display_backlight_unset_blink(); } else if (!strcmp(on, "off")) { - display_lock_request_unlock_with_option(INTERNAL_LOCK_DUMPMODE, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_DUMPMODE, LCD_OFF, PM_SLEEP_MARGIN); display_backlight_set_blink(0); } else if (!strcmp(on, "blink")) { display_backlight_set_blink(500); diff --git a/src/display/display-lock.c b/src/display/display-lock.c index ed2a572..7c98250 100644 --- a/src/display/display-lock.c +++ b/src/display/display-lock.c @@ -22,6 +22,7 @@ * */ #include +#include #include "shared/common.h" #include "ambient-mode.h" @@ -358,7 +359,7 @@ static gboolean lock_expired_callback(gpointer data) display_plugin_state_get_name(dl->state, &stname); _I("Display lock expired, state=%s pid=%d", stname, dl->pid); - if (dl->pid == INTERNAL_LOCK_AMBIENT) + if (dl->pid == DEVICED_EVENT_DISPLAY_AMBIENT) ambient_check_invalid_state(dl->pid); if (dl->state == S_LCDOFF) @@ -400,7 +401,7 @@ int display_lock_request_lock(enum state_t state, pid_t pid, unsigned int timeou dl->broadcast_warning = true; if (state == S_NORMAL || state == S_LCDDIM) dl->background = is_app_background(pid); - if (pid < INTERNAL_LOCK_BASE) + if (pid < DEVICED_EVENT_BASE) dl->warning_id = g_timeout_add_seconds(LOCK_WATCHDOG_PERIOD_SEC, lock_watchdog_callback, dl); add_lock(dl); @@ -472,7 +473,7 @@ static void print_display_lock(gpointer data, gpointer udata) buf[strlen(buf) - 1] = 0; if (diff > LOCK_TIME_WARNING) { - if (diff > LOCK_TIME_WARNING * 60 && dl->pid < INTERNAL_LOCK_BASE && dl->broadcast_warning) { + if (diff > LOCK_TIME_WARNING * 60 && dl->pid < DEVICED_EVENT_BASE && dl->broadcast_warning) { ret = gdbus_signal_emit(NULL, DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, @@ -599,7 +600,7 @@ static void proc_condition_lock(PMMsg *data) if ((state == S_LCDOFF) && (get_pm_cur_state() == S_SLEEP) && (pm_get_power_lock() == POWER_UNLOCK)) - display_state_transition_do_proc_change_state(data->cond, INTERNAL_LOCK_PM); + display_state_transition_do_proc_change_state(data->cond, DEVICED_EVENT_DISPLAY_LOCK); ret = display_lock_request_lock(state, pid, data->timeout); if (ret == -EALREADY) @@ -616,7 +617,7 @@ static void proc_condition_lock(PMMsg *data) display_plugin_state_get_name(state, &state_name); _I("[%s] locked by %5d with %u ms", state_name, pid, data->timeout); - if (pid < INTERNAL_LOCK_BASE) { + if (pid < DEVICED_EVENT_BASE) { /* for debug */ if (state == S_LCDOFF) lock_type = PM_LCDOFF_STR; @@ -669,7 +670,7 @@ static void proc_condition_unlock(PMMsg *data) display_plugin_state_get_name(state, &state_name); _I("[%s] unlocked by %5d", state_name, pid); - if (pid < INTERNAL_LOCK_BASE) { + if (pid < DEVICED_EVENT_BASE) { /* for debug */ if (state == S_LCDOFF) lock_type = PM_LCDOFF_STR; diff --git a/src/display/display-misc.c b/src/display/display-misc.c index 6505db5..612a6d0 100644 --- a/src/display/display-misc.c +++ b/src/display/display-misc.c @@ -22,6 +22,7 @@ #include #include +#include #include "battery/power-supply.h" #include "shared/device-notifier.h" @@ -59,7 +60,7 @@ void display_misc_get_process_name(pid_t pid, char *pname) char buf[PATH_MAX]; int cmdline, r; - if (pid >= INTERNAL_LOCK_BASE) + if (pid >= DEVICED_EVENT_BASE) snprintf(buf, PATH_MAX, "/proc/%d/cmdline", getpid()); else snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid); @@ -85,7 +86,7 @@ void display_misc_set_stay_touchscreen_off(bool on) _I("Stay touch screen off: %d", on); stay_touchscreen_off = on; - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_TOUCHSCREEN, LCD_NORMAL); } void display_misc_get_stay_touchscreen_off(bool *on) @@ -258,4 +259,4 @@ void display_misc_set_battery_charging_status_flag(void) if ((get_charging_status(&charging_status) == 0) && (charging_status > 0)) set_pm_status_flag(CHRGR_FLAG); -} \ No newline at end of file +} diff --git a/src/display/display-panel.c b/src/display/display-panel.c index 32a8b01..7c09fae 100644 --- a/src/display/display-panel.c +++ b/src/display/display-panel.c @@ -204,7 +204,7 @@ void display_panel_set_lcd_paneloff_mode(bool on) _I("Lcd paneloff mode: %d", on); lcd_paneloff_mode = on; - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_PM, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_DISPLAY, LCD_NORMAL); } /* FIXME: This function is temporary, it can be redefined or not */ diff --git a/src/display/display-signal.c b/src/display/display-signal.c index 78df910..33502dc 100644 --- a/src/display/display-signal.c +++ b/src/display/display-signal.c @@ -16,6 +16,8 @@ * limitations under the License. */ +#include + #include "display-signal.h" #include "display-util.h" #include "poll.h" @@ -110,7 +112,7 @@ void set_process_active(bool flag, pid_t pid) { int ret; - if (pid >= INTERNAL_LOCK_BASE) + if (pid >= DEVICED_EVENT_BASE) return; /* Send dbus signal to resourced */ diff --git a/src/display/display.c b/src/display/display.c index dd2a599..86d6f56 100644 --- a/src/display/display.c +++ b/src/display/display.c @@ -434,8 +434,8 @@ static int delayed_init_done(void *data) return done; _I("Booting done, release booting lock."); - display_lock_request_unlock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN); - display_lock_request_unlock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_BOOTING, LCD_NORMAL, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_BOOTING, LCD_OFF, PM_SLEEP_MARGIN); return done; } @@ -606,7 +606,7 @@ static void display_init(void *data) * deviced guarantees all booting script is executing. * Last script of booting unlocks this suspend blocking state. */ - display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_OFF, + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_BOOTING, LCD_OFF, STAY_CUR_STATE, DELAYED_INIT_WATING_TIME); /* Initial display state right after the booting done */ @@ -625,7 +625,7 @@ static void display_init(void *data) if (timeout < SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT)) { timeout = SEC_TO_MSEC(DEFAULT_NORMAL_TIMEOUT); } - display_lock_request_lock_with_option(INTERNAL_LOCK_BOOTING, LCD_NORMAL, + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_BOOTING, LCD_NORMAL, STAY_CUR_STATE, timeout); } } diff --git a/src/display/lock-detector.c b/src/display/lock-detector.c index 673665e..d57f643 100644 --- a/src/display/lock-detector.c +++ b/src/display/lock-detector.c @@ -33,6 +33,7 @@ #include #include #include +#include #include "core.h" #include "display-misc.h" @@ -137,7 +138,7 @@ int set_lock_time(pid_t pid, const char *pname, int state) } info->hash = val; - if (pid < INTERNAL_LOCK_BASE) + if (pid < DEVICED_EVENT_BASE) info->name = strndup(pname, strlen(pname)); else { char internal_case[25]; diff --git a/src/display/poll.h b/src/display/poll.h index 262e224..e506e53 100644 --- a/src/display/poll.h +++ b/src/display/poll.h @@ -39,33 +39,6 @@ enum { PM_CONTROL_EVENT, }; -enum { - INTERNAL_LOCK_BASE = 100000, - INTERNAL_LOCK_AMBIENT, - INTERNAL_LOCK_BATTERY, - INTERNAL_LOCK_BATTERY_FULL, - INTERNAL_LOCK_BOOTING, - INTERNAL_LOCK_DUMPMODE, - INTERNAL_LOCK_HDMI, - INTERNAL_LOCK_ODE, - INTERNAL_LOCK_POPUP, - INTERNAL_LOCK_SOUNDDOCK, - INTERNAL_LOCK_TIME, - INTERNAL_LOCK_USB, - INTERNAL_LOCK_USB_HOST, - INTERNAL_LOCK_POWEROFF, - INTERNAL_LOCK_SUSPEND, - INTERNAL_LOCK_COOL_DOWN, - INTERNAL_LOCK_LOWBAT, - INTERNAL_LOCK_CRADLE, - INTERNAL_LOCK_EARJACK, - INTERNAL_LOCK_POWERKEY, - INTERNAL_LOCK_PM, - INTERNAL_LOCK_SWIM, - INTERNAL_LOCK_OVERHEAT, - INTERNAL_LOCK_OVERCOOL, -}; - #define SIGNAL_NAME_LCD_CONTROL "lcdcontol" #define LCD_NORMAL 0x01 /**< NORMAL state */ diff --git a/src/extcon/cradle.c b/src/extcon/cradle.c index 45730a1..b6d2c5d 100644 --- a/src/extcon/cradle.c +++ b/src/extcon/cradle.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "core/log.h" #include "shared/device-notifier.h" @@ -62,7 +63,7 @@ static int cradle_update(const char *index, int status) int ret; _I("Cradle changed. status=%d", status); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_CRADLE, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_EXTCON_CRADLE, LCD_NORMAL); cradle_send_broadcast(status); ret = vconf_set_int(VCONFKEY_SYSMAN_CRADLE_STATUS, status); if (ret < 0) { @@ -71,9 +72,9 @@ static int cradle_update(const char *index, int status) } if (status == DOCK_SOUND) { - display_lock_request_lock_with_option(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_EXTCON_CRADLE, LCD_DIM, STAY_CUR_STATE, 0); } else if (status == DOCK_NONE) { - display_lock_request_unlock_with_option(INTERNAL_LOCK_CRADLE, LCD_DIM, PM_SLEEP_MARGIN); + display_lock_request_unlock_with_option(DEVICED_EVENT_EXTCON_CRADLE, LCD_DIM, PM_SLEEP_MARGIN); } return 0; @@ -93,7 +94,7 @@ static int display_changed(void *data) cradle = cradle_extcon_ops.status; if (cradle == DOCK_SOUND) { - display_lock_request_lock_with_option(INTERNAL_LOCK_CRADLE, LCD_DIM, STAY_CUR_STATE, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_EXTCON_CRADLE, LCD_DIM, STAY_CUR_STATE, 0); _I("Sound dock is connected. Dim lock is on."); } diff --git a/src/extcon/earjack.c b/src/extcon/earjack.c index ae9f96d..14b38f0 100644 --- a/src/extcon/earjack.c +++ b/src/extcon/earjack.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "core/log.h" #include "poll.h" @@ -97,7 +98,7 @@ static int earjack_update(const char *index, int status) earjack_send_broadcast(status); earjack_send_system_event(status); if (status != EARJACK_DISCONNECTED) { - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_EARJACK, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_EXTCON_EARJACK, LCD_NORMAL); } old_status = status; diff --git a/src/shared/apps.c b/src/shared/apps.c index 2a97507..1727922 100644 --- a/src/shared/apps.c +++ b/src/shared/apps.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "core/log.h" #include "shared/common.h" @@ -104,7 +105,7 @@ int launch_system_app(char *type, int num, ...) va_end(args); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POPUP, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); return ret; } @@ -123,7 +124,7 @@ int launch_message_post(char *type) g_variant_new("(s)", type), __cb, -1, NULL); - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_POPUP, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_MISC_POPUP, LCD_NORMAL); return ret; } diff --git a/src/time/time-handler.c b/src/time/time-handler.c index 786706f..63040b2 100644 --- a/src/time/time-handler.c +++ b/src/time/time-handler.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "core/log.h" @@ -191,11 +192,11 @@ int set_datetime_action(int argc, char **argv) else pm_state = 0x4; - display_lock_request_lock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_TIME, pm_state, STAY_CUR_STATE, 0); ret = handle_date(argv[0]); - display_lock_request_unlock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_TIME, pm_state, STAY_CUR_STATE); return ret; } @@ -218,11 +219,11 @@ int set_timezone_action(int argc, char **argv) else pm_state = 0x4; - display_lock_request_lock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_MISC_TIME, pm_state, STAY_CUR_STATE, 0); ret = handle_timezone(argv[0]); - display_lock_request_unlock_with_option(INTERNAL_LOCK_TIME, pm_state, STAY_CUR_STATE); + display_lock_request_unlock_with_option(DEVICED_EVENT_MISC_TIME, pm_state, STAY_CUR_STATE); return ret; } diff --git a/src/usb-gadget/usb-gadget.c b/src/usb-gadget/usb-gadget.c index 0ccfb25..d6c42c7 100644 --- a/src/usb-gadget/usb-gadget.c +++ b/src/usb-gadget/usb-gadget.c @@ -19,6 +19,7 @@ #include #include +#include #include "core/log.h" #include "core/udev.h" @@ -105,7 +106,7 @@ static int usb_connected(void) int ret; unsigned int mode = usb_state_get_selected_mode(); - display_lock_request_lock_with_option(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE, 0); + display_lock_request_lock_with_option(DEVICED_EVENT_EXTCON_USB, LCD_OFF, STAY_CUR_STATE, 0); usb_state_set_connection(USB_CONNECTED); send_usb_state_changed_event(VCONFKEY_SYSMAN_USB_CONNECTED); @@ -133,7 +134,7 @@ static int usb_disconnected(void) /* Important: You have to keep going to unlock display_lock_request_unlock_with_option */ } - display_lock_request_unlock_with_option(INTERNAL_LOCK_USB, LCD_OFF, STAY_CUR_STATE); + display_lock_request_unlock_with_option(DEVICED_EVENT_EXTCON_USB, LCD_OFF, STAY_CUR_STATE); return ret; } diff --git a/src/usb-host/usb-host.c b/src/usb-host/usb-host.c index d60813e..377d0d1 100644 --- a/src/usb-host/usb-host.c +++ b/src/usb-host/usb-host.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include "core/log.h" @@ -245,7 +246,7 @@ static int add_usbhost_list(struct udev_device *dev, const char *devpath) broadcast_usbhost_signal(USB_HOST_ADDED, usbhost); if (display_on_usb_conn_changed) - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_USB_HOST, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_EXTCON_USBHOST, LCD_NORMAL); /* for debugging */ _I("USB HOST Added."); @@ -274,7 +275,7 @@ static int remove_usbhost_list(const char *devpath) broadcast_usbhost_signal(USB_HOST_REMOVED, usbhost); if (display_on_usb_conn_changed) - display_state_transition_request_state_transition_with_option(INTERNAL_LOCK_USB_HOST, LCD_NORMAL); + display_state_transition_request_state_transition_with_option(DEVICED_EVENT_EXTCON_USBHOST, LCD_NORMAL); /* for debugging */ _I("USB HOST Removed.");