diff options
-rw-r--r-- | plugins/wearable/display/core.c | 33 | ||||
-rwxr-xr-x | plugins/wearable/display/device-interface.c | 9 | ||||
-rw-r--r-- | plugins/wearable/display/key-filter.c | 6 | ||||
-rw-r--r-- | src/display/device-interface.h | 1 | ||||
-rw-r--r-- | src/display/display-dbus.c | 15 | ||||
-rw-r--r-- | src/display/poll.c | 7 |
6 files changed, 70 insertions, 1 deletions
diff --git a/plugins/wearable/display/core.c b/plugins/wearable/display/core.c index 5821dc9b..fba21c17 100644 --- a/plugins/wearable/display/core.c +++ b/plugins/wearable/display/core.c @@ -498,15 +498,23 @@ void lcd_on_procedure(int state, enum device_flags flag) /* * Display on procedure + * step 0. check if display is detached (only for factory mode) * step 1. broadcast lcd on signal with cause * step 2. set brightness * step 3. set pmstate of vconf * step 4. display on operate * - a. display on * - b. TSP(touch screen) and touchkey enable - * step 5. broadcast lcd on complete siganl + * step 5. broadcast lcd on complete signal * step 6. key backlight enable */ + + /* only for factory mode */ + if (is_display_detached()) { + _W("Turning on display is ignored while the display is detached."); + return; + } + _I("[lcdstep] %lu", flags); if (flags & AMBIENT_MODE) { @@ -1152,6 +1160,13 @@ void lcd_on_direct(enum device_flags flags) power_ops.power_lock(); } + /* only for factory mode */ + if (is_display_detached()) { + _W("Turning on display is ignored while the display is detached."); + return; + } + + pm_old_state = pm_cur_state; pm_cur_state = S_NORMAL; _D("lcd is on directly"); @@ -1976,6 +1991,14 @@ static int default_trans(int evt) } } + /* only for factory mode */ + if (is_display_detached()) { + if (next_state == S_NORMAL || next_state == S_LCDDIM) { + _W("Turning on display is ignored while the display is detached."); + return -1; + } + } + /* state transition */ pm_old_state = pm_cur_state; pm_cur_state = next_state; @@ -2065,6 +2088,14 @@ static int default_action(int timeout) return -EINVAL; } + /* only for facetory mode */ + if (is_display_detached()) { + if (pm_cur_state == S_NORMAL || pm_cur_state == S_LCDDIM) { + _W("Turning on display is ignored while the display is detached."); + return -ENOTSUP; + } + } + if (pm_cur_state != S_SLEEP) { if (pm_cur_state == S_NORMAL && lcdon_tv.tv_sec != 0) { diff --git a/plugins/wearable/display/device-interface.c b/plugins/wearable/display/device-interface.c index b03e5c4c..72322efe 100755 --- a/plugins/wearable/display/device-interface.c +++ b/plugins/wearable/display/device-interface.c @@ -289,6 +289,8 @@ static int get_lcd_power(void) return DPMS_SUSPEND; case DISPLAY_OFF: return DPMS_OFF; + case DISPLAY_DETACH: + return DPMS_DETACH; default: return -EINVAL; } @@ -1020,6 +1022,13 @@ bool vital_mode(void) return vital_sleep; } +bool is_display_detached(void) +{ + int state = backlight_ops.get_lcd_power(); + + return (state == DPMS_DETACH) || (state == -EINVAL); +} + static int vital_state_changed(void *data) { int type; diff --git a/plugins/wearable/display/key-filter.c b/plugins/wearable/display/key-filter.c index 891dadb8..87521ede 100644 --- a/plugins/wearable/display/key-filter.c +++ b/plugins/wearable/display/key-filter.c @@ -190,6 +190,12 @@ static inline void broadcast_lcdoff_by_powerkey(void) static inline bool switch_on_lcd(enum device_flags flags) { + /* only for factory mode */ + if (is_display_detached()) { + _W("Turning on display is ignored while the display is detached."); + return false; + } + if (current_state_in_on()) return false; diff --git a/src/display/device-interface.h b/src/display/device-interface.h index e0fc0890..1cd3d7de 100644 --- a/src/display/device-interface.h +++ b/src/display/device-interface.h @@ -135,6 +135,7 @@ enum mainlock_state { struct display_device *display_dev_get(void); bool display_dimstay_check(void); void dpms_set_running_state(int val); +bool is_display_detached(void); #endif diff --git a/src/display/display-dbus.c b/src/display/display-dbus.c index 9d88cb56..34f63875 100644 --- a/src/display/display-dbus.c +++ b/src/display/display-dbus.c @@ -312,6 +312,15 @@ static GVariant *dbus_changestate(GDBusConnection *conn, goto out; } + /* only for factory mode */ + if (is_display_detached()) { + if (state == LCD_NORMAL || state == LCD_DIM) { + _W("Turning on display is ignored while the display is detached."); + ret = -ENOTSUP; + goto out; + } + } + if (check_dimstay(state, GOTO_STATE_NOW) == true) { _E("LCD state can not be changed to OFF state! by %d", pid); ret = -EBUSY; @@ -775,6 +784,12 @@ static GVariant *dbus_customlcdon(GDBusConnection *conn, g_variant_get(param, "(i)", &timeout); + /* only for factory mode */ + if (is_display_detached()) { + _W("Turning on display is ignored while the display is detached."); + return g_variant_new("(i)", -ENOTSUP); + } + ret = custom_lcdon(timeout); return g_variant_new("(i)", ret); diff --git a/src/display/poll.c b/src/display/poll.c index ee0471d3..7e008d3b 100644 --- a/src/display/poll.c +++ b/src/display/poll.c @@ -144,6 +144,7 @@ static int __pm_unlock_internal(pid_t pid, int s_bits, int flag) static int __pm_change_internal(pid_t pid, int s_bits) { int cond; + const int display_on = LCD_NORMAL | LCD_DIM; if (!pm_callback) return -1; @@ -152,6 +153,12 @@ static int __pm_change_internal(pid_t pid, int s_bits) if (cond < 0) return cond; + /* only for factory mode */ + if (is_display_detached() && (cond & display_on)) { + _W("Turning on display is ignored while the display is detached."); + return -ENOTSUP; + } + if (!state_supported(cond)) return -ENOTSUP; |