display: remove standby mode from common profile 52/60052/1
authorTaeyoung Kim <ty317.kim@samsung.com>
Tue, 23 Feb 2016 01:11:52 +0000 (10:11 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Tue, 23 Feb 2016 01:11:52 +0000 (10:11 +0900)
- Standby mode will be added as a separated power state.
  Thus the standby mode of common profile scatterd
  in the codes is removed

Change-Id: I93fd085f7d5d42f6e415d72420f7ffaf034da236
Signed-off-by: Taeyoung Kim <ty317.kim@samsung.com>
src/display/core.c
src/display/core.h
src/display/display-dbus.c
src/display/key-filter.c
src/display/poll.c
src/display/poll.h
src/libdeviced/display.c

index 069ec6b..2da757c 100644 (file)
@@ -89,10 +89,6 @@ static unsigned int custom_dim_timeout = 0;
 static int custom_holdkey_block = false;
 static int custom_change_pid = -1;
 static char *custom_change_name;
-static int standby_mode = false;
-static int standby_state = false;
-static dd_list *standby_mode_list;
-static int (*basic_action) (int);
 static bool hallic_open = true;
 static Ecore_Timer *lock_timeout_id;
 static int lock_screen_timeout = LOCK_SCREEN_INPUT_TIMEOUT;
@@ -152,12 +148,10 @@ static const char *lcdoff_sig_lookup[SIGNAL_MAX] = {
 #define CUSTOM_TIMEOUT_BIT     0x1
 #define CUSTOM_HOLDKEY_BIT     0x2
 #define HOLD_KEY_BLOCK_BIT     0x1
-#define STANDBY_MODE_BIT       0x2
 #define TIMEOUT_NONE           (-1)
 
 #define S_COVER_TIMEOUT                        8000
 #define GET_HOLDKEY_BLOCK_STATE(x) ((x >> SHIFT_LOCK_FLAG) & HOLD_KEY_BLOCK_BIT)
-#define GET_STANDBY_MODE_STATE(x) ((x >> SHIFT_LOCK_FLAG) & STANDBY_MODE_BIT)
 #define BOOTING_DONE_WATING_TIME       60000   /* 1 minute */
 #define LOCK_TIME_WARNING              60      /* 60 seconds */
 
@@ -267,17 +261,6 @@ void change_trans_table(enum state_t state, enum state_t next)
        trans_table[state][EVENT_TIMEOUT] = next;
 }
 
-int get_standby_state(void)
-{
-       return standby_state;
-}
-
-static inline void set_standby_state(bool state)
-{
-       if (standby_state != state)
-               standby_state = state;
-}
-
 static void broadcast_lcd_on(enum signal_type type, enum device_flags flags)
 {
        char *arr[1];
@@ -369,11 +352,6 @@ inline void lcd_off_procedure(void)
        const struct device_ops *ops = NULL;
        unsigned long flags = NORMAL_MODE;
 
-       if (standby_mode) {
-               _D("standby mode! lcd off logic is skipped");
-               return;
-       }
-
        if (lcdon_broadcast) {
                broadcast_lcd_off(SIGNAL_PRE, flags);
                lcdon_broadcast = false;
@@ -872,10 +850,6 @@ static int proc_change_state(unsigned int cond, pid_t pid)
                pm_cur_state = next_state;
                st = &states[pm_cur_state];
 
-               /* pm state is updated to dim because of standby mode */
-               if (standby_mode && (pm_cur_state == S_LCDOFF))
-                       set_setting_pmstate(S_LCDDIM);
-
                /* enter action */
                if (st->action) {
                        st->action(st->timeout);
@@ -907,76 +881,6 @@ static int proc_change_state(unsigned int cond, pid_t pid)
        return 0;
 }
 
-static int standby_action(int timeout)
-{
-       const struct device_ops *ops = NULL;
-
-       if (backlight_ops.standby(false) < 0) {
-               _E("Fail to start standby mode!");
-               return -EIO;
-       }
-       if (CHECK_OPS(keyfilter_ops, backlight_enable))
-               keyfilter_ops->backlight_enable(false);
-
-       ops = find_device("touchkey");
-       if (!check_default(ops) && CHECK_OPS(ops, stop))
-               ops->stop(NORMAL_MODE);
-
-       ops = find_device("touchscreen");
-       if (!check_default(ops) && CHECK_OPS(ops, stop))
-               ops->stop(NORMAL_MODE);
-
-       set_standby_state(true);
-
-       _I("standby mode (only LCD OFF, But phone is working normal)");
-       reset_timeout(timeout);
-
-       return 0;
-}
-
-static void set_standby_mode(pid_t pid, int enable)
-{
-       dd_list *l = NULL;
-       dd_list *l_next = NULL;
-       void *data;
-
-       if (enable) {
-               DD_LIST_FOREACH(standby_mode_list, l, data)
-                       if (pid == (pid_t)((intptr_t)data)) {
-                               _E("%d already acquired standby mode", pid);
-                               return;
-                       }
-               DD_LIST_APPEND(standby_mode_list, (void *)((intptr_t)pid));
-               _I("%d acquire standby mode", pid);
-               if (standby_mode)
-                       return;
-               standby_mode = true;
-               basic_action = states[S_LCDOFF].action;
-               states[S_LCDOFF].action = standby_action;
-               trans_table[S_LCDOFF][EVENT_TIMEOUT] = S_LCDOFF;
-               _I("Standby mode is enabled!");
-       } else {
-               if (!standby_mode)
-                       return;
-               DD_LIST_FOREACH_SAFE(standby_mode_list, l, l_next, data)
-                       if (pid == (pid_t)((intptr_t)data)) {
-                               DD_LIST_REMOVE_LIST(standby_mode_list, l);
-                               _I("%d release standby mode", pid);
-                       }
-               if (standby_mode_list != NULL)
-                       return;
-               set_standby_state(false);
-               standby_mode = false;
-               if (basic_action != NULL) {
-                       states[S_LCDOFF].action = basic_action;
-               }
-               trans_table[S_LCDOFF][EVENT_TIMEOUT] = S_SLEEP;
-               proc_change_state(S_NORMAL << (SHIFT_CHANGE_STATE + S_NORMAL),
-                   getpid());
-               _I("Standby mode is disabled!");
-       }
-}
-
 /* update transition condition for application requrements */
 static int proc_condition(PMMsg *data)
 {
@@ -1107,8 +1011,6 @@ static int proc_condition(PMMsg *data)
                            ecore_timer_add(MSEC_TO_SEC((double)data->timeout),
                                    (Ecore_Task_Cb)del_sleep_cond, (void*)((intptr_t)pid));
                }
-               if (GET_STANDBY_MODE_STATE(val))
-                       set_standby_mode(pid, true);
                tmp = find_node(S_SLEEP, pid);
                if (tmp == NULL) {
                        add_node(S_SLEEP, pid, cond_timeout_id, 0);
@@ -1150,8 +1052,6 @@ static int proc_condition(PMMsg *data)
        if (val & MASK_SLP) {
                tmp = find_node(S_SLEEP, pid);
                del_node(S_SLEEP, tmp);
-               if (standby_mode)
-                       set_standby_mode(pid, false);
                set_process_active(EINA_FALSE, pid);
 
                _SD("[%s] unlocked by pid %d - process %s\n", "S_LCDOFF",
@@ -1197,8 +1097,6 @@ int check_processes(enum state_t prohibit_state)
                                custom_normal_timeout = custom_dim_timeout = 0;
                                custom_change_pid = -1;
                        }
-                       if (standby_mode)
-                               set_standby_mode(t->pid, false);
                        tmp = t;
                        ret = 1;
                }
@@ -1268,9 +1166,6 @@ int delete_condition(enum state_t state)
 
 void update_lcdoff_source(int source)
 {
-       if (standby_mode)
-               return;
-
        switch(source) {
        case VCONFKEY_PM_LCDOFF_BY_TIMEOUT:
                _I("LCD OFF by timeout");
@@ -1363,8 +1258,6 @@ void print_info(int fd)
        char buf[255];
        int i = 1;
        int ret;
-       dd_list *l = NULL;
-       void *data;
        char pname[PATH_MAX];
 
        if (fd < 0)
@@ -1420,22 +1313,6 @@ void print_info(int fd)
                }
        }
 
-       if (standby_mode) {
-               snprintf(buf, sizeof(buf), "\n\nstandby mode is on\n");
-               ret = write(fd, buf, strlen(buf));
-               if (ret < 0)
-                       _E("write() failed (%d)", errno);
-
-               DD_LIST_FOREACH(standby_mode_list, l, data) {
-                       get_pname((pid_t)((intptr_t)data), pname);
-                       snprintf(buf, sizeof(buf),
-                           "  standby mode acquired by pid %d"
-                           " - process %s\n", (pid_t)data, pname);
-                       ret = write(fd, buf, strlen(buf));
-                       if (ret < 0)
-                               _E("write() failed (%d)", errno);
-               }
-       }
        print_lock_info_list(fd);
 
 #ifdef ENABLE_PM_LOG
@@ -1474,7 +1351,6 @@ void save_display_log(void)
                ret = write(fd, buf, strlen(buf));
                if (ret < 0)
                        _E("write() failed (%d)", errno);
-
                print_info(fd);
                close(fd);
        }
@@ -1505,9 +1381,6 @@ int check_lcdoff_direct(void)
        if (pm_cur_state != S_LCDDIM)
                return false;
 
-       if (standby_mode)
-               return false;
-
        lock = get_lock_screen_state();
        if (lock != VCONFKEY_IDLE_LOCK && hallic_open)
                return false;
@@ -1549,11 +1422,6 @@ static int default_trans(int evt)
        /* check conditions */
        while (st->check && !st->check(next_state)) {
                /* There is a condition. */
-               if (standby_mode) {
-                       _I("standby mode, goto next_state %s",
-                           states[next_state].name);
-                       break;
-               }
                _I("%s -> %s : check fail", states[pm_cur_state].name,
                       states[next_state].name);
                if (!check_processes(next_state)) {
@@ -1708,7 +1576,6 @@ static int default_action(int timeout)
 
                if (check_lcd_on() == true)
                        lcd_on_procedure(LCD_NORMAL, NORMAL_MODE);
-               set_standby_state(false);
                break;
 
        case S_LCDDIM:
@@ -1720,7 +1587,6 @@ static int default_action(int timeout)
 
                if (pm_old_state == S_LCDOFF || pm_old_state == S_SLEEP)
                        lcd_on_procedure(LCD_DIM, NORMAL_MODE);
-               set_standby_state(false);
                break;
 
        case S_LCDOFF:
index d3acefe..2029b5f 100644 (file)
@@ -185,7 +185,6 @@ void set_lcd_paneloff_mode(int val);
 void lcd_on_direct(enum device_flags flags);
 void lcd_off_procedure(void);
 int check_holdkey_block(enum state_t state);
-int get_standby_state(void);
 
 /* poll.c */
 int check_dimstay(int next_state, int flag);
index 0788f16..e673e74 100644 (file)
@@ -134,8 +134,6 @@ static DBusMessage *edbus_lockstate(E_DBus_Object *obj, DBusMessage *msg)
 
        if (!strcmp(option2_str, HOLDKEYBLOCK_STR))
                flag |= HOLD_KEY_BLOCK;
-       else if (!strcmp(option2_str, STANDBYMODE_STR))
-               flag |= STANDBY_MODE;
 
        if (flag & GOTO_STATE_NOW) {
                caps = display_get_caps(DISPLAY_ACTOR_API);
index 765f0b6..a8f9d50 100644 (file)
@@ -554,10 +554,6 @@ static int check_key_filter(void *data, int fd)
                 */
                if (pinput->code == BTN_TOUCH && !current_state_in_on())
                        break;
-               if (get_standby_state() && pinput->code != KEY_POWER) {
-                       _D("standby mode,key ignored except powerkey");
-                       break;
-               }
                if (pinput->code == code && pinput->value == value) {
                        _E("Same key(%d, %d) is polled [%d,%d]",
                                code, value, old_fd, fd);
@@ -571,13 +567,9 @@ static int check_key_filter(void *data, int fd)
 
                break;
        case EV_REL:
-               if (get_standby_state())
-                       break;
                ignore = false;
                break;
        case EV_ABS:
-               if (get_standby_state())
-                       break;
                if (current_state_in_on())
                        ignore = false;
                restore_custom_brightness();
index 2369777..f801250 100644 (file)
@@ -34,9 +34,7 @@
 #define SHIFT_CHANGE_TIMEOUT            20
 #define LOCK_FLAG_SHIFT                 16
 #define __HOLDKEY_BLOCK_BIT              0x1
-#define __STANDBY_MODE_BIT               0x2
 #define HOLDKEY_BLOCK_BIT               (__HOLDKEY_BLOCK_BIT << LOCK_FLAG_SHIFT)
-#define STANDBY_MODE_BIT                (__STANDBY_MODE_BIT << LOCK_FLAG_SHIFT)
 
 
 int check_dimstay(int next_state, int flag)
@@ -73,9 +71,6 @@ int pm_lock_internal(pid_t pid, int s_bits, int flag, int timeout)
        if (flag & HOLD_KEY_BLOCK)
                s_bits = s_bits | HOLDKEY_BLOCK_BIT;
 
-       if (flag & STANDBY_MODE)
-               s_bits = s_bits | STANDBY_MODE_BIT;
-
        recv_data.pid = pid;
        recv_data.cond = s_bits;
        recv_data.timeout = timeout;
index a93bffb..93b433f 100644 (file)
@@ -68,7 +68,6 @@ enum {
 #define STAY_CUR_STATE 0x1
 #define GOTO_STATE_NOW 0x2
 #define HOLD_KEY_BLOCK  0x4
-#define STANDBY_MODE    0x8
 
 #define PM_SLEEP_MARGIN        0x0     /**< keep guard time for unlock */
 #define PM_RESET_TIMER 0x1     /**< reset timer for unlock */
index 519dd88..4d9ec5d 100644 (file)
@@ -30,7 +30,6 @@
 #define DISPLAY_DIM_BRIGHTNESS  0
 
 #define HOLDKEY_BLOCK_BIT              0x1
-#define STANDBY_MODE_BIT               0x2
 
 #define METHOD_SET_REFRESH_RATE        "SetRefreshRate"
 #define METHOD_LOCK_STATE              "lockstate"
@@ -54,7 +53,6 @@
 #define STR_GOTOSTATENOW "gotostatenow"
 
 #define STR_HOLDKEYBLOCK "holdkeyblock"
-#define STR_STANDBYMODE  "standbymode"
 #define STR_NULL         "NULL"
 
 #define STR_SLEEP_MARGIN "sleepmargin"
@@ -376,8 +374,6 @@ API int display_lock_state(unsigned int s_bits, unsigned int flag,
 
        if (flag & HOLD_KEY_BLOCK)
                p = STR_HOLDKEYBLOCK;
-       else if (flag & STANDBY_MODE)
-               p = STR_STANDBYMODE;
        else
                p = STR_NULL;
        pa[2] = p;