Evas_Object *hit_rect;
Ecore_Timer *no_lock_timer;
bool is_locked;
+ bool was_incomming_call;
+ bool was_handsfree_mode;
};
-typedef struct __touch_lock_manager __callui_touch_lock_manager_t;
+typedef struct __touch_lock_manager __callui_tlm_t;
-static callui_result_e __callui_touch_lock_manager_create(callui_lock_manager_h lock_h, callui_app_data_t *ad);
-static void __callui_touch_lock_manager_start(callui_lock_manager_h lock_h);
-static void __callui_touch_lock_manager_stop(callui_lock_manager_h lock_h, bool force);
-static bool __callui_touch_lock_manager_is_lcd_off(callui_lock_manager_h lock_h);
-static void __callui_touch_lock_manager_set_callback_on_unlock(callui_lock_manager_h lock_h, unlock_cb_t callback, void* data){};
-static bool __callui_touch_lock_manager_is_lockscreen_shown(callui_lock_manager_h tlm_h);
-static void __callui_touch_lock_manager_destroy(callui_lock_manager_h lock_h);
-
-static void __callui_touch_lock_manager_start_timer(_callui_touch_lock_manager_h tlm_h);
-static void __callui_touch_lock_manager_stop_timer(_callui_touch_lock_manager_h tlm_h);
-static bool __callui_touch_lock_manager_create_layout(_callui_touch_lock_manager_h tlm_h);
-static void __callui_touch_lock_manager_show_layout(_callui_touch_lock_manager_h tlm_h);
-static void __callui_touch_lock_manager_hide_layout(_callui_touch_lock_manager_h tlm_h);
-
-static void __callui_touch_lock_manager_show_layout(_callui_touch_lock_manager_h tlm_h)
+ #define CALLUI_LY_STYLE_TOUCH_LOCK_SCREEN "touch_lock_screen"
+
-
+static callui_result_e __callui_tlm_create(callui_lock_manager_h lock_h, callui_app_data_t *ad);
+static void __callui_tlm_resume(callui_lock_manager_h lock_h);
+static void __callui_tlm_pause(callui_lock_manager_h lock_h, bool force);
+static bool __callui_tlm_is_running(callui_lock_manager_h lock_h);
+static void __callui_tlm_destroy(callui_lock_manager_h lock_h);
+
+static callui_result_e __callui_tlm_ui_elements(_callui_touch_lock_manager_h tlm_h);
+static void __callui_tlm_lock(_callui_touch_lock_manager_h tlm_h);
+static void __callui_tlm_unlock(_callui_touch_lock_manager_h tlm_h);
+static void __callui_tlm_update_state(_callui_touch_lock_manager_h tlm_h);
+static Eina_Bool __callui_tlm_lock_timeout_cb(void *data);
+static void __callui_tlm_call_state_event_cb(void *user_data, callui_call_event_type_e call_event_type, unsigned int call_id, callui_sim_slot_type_e sim_type, void *event_info);
+static void __callui_tlm_keypad_show_state_change_cd(void *data, Eina_Bool is_visible);
+
+static void __callui_tlm_audio_state_changed_cb(void *user_data, callui_audio_state_type_e audio_state)
{
- debug_enter();
+ CALLUI_RETURN_IF_FAIL(user_data);
+
+ _callui_touch_lock_manager_h tlm_h = user_data;
+ switch (audio_state) {
+ case CALLUI_AUDIO_STATE_SPEAKER:
+ case CALLUI_AUDIO_STATE_EARJACK:
+ case CALLUI_AUDIO_STATE_BT:
+ tlm_h->was_handsfree_mode = true;
+ DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+ if (tlm_h->is_locked) {
+ __callui_tlm_unlock(tlm_h);
+ }
+ break;
+ case CALLUI_AUDIO_STATE_RECEIVER:
+ if (tlm_h->was_handsfree_mode) {
+ tlm_h->was_handsfree_mode = false;
+ __callui_tlm_lock(tlm_h);
+ } else {
+ __callui_tlm_update_state(tlm_h);
+ }
+ break;
+ default:
+ break;
+ }
+}
+static void __callui_tlm_call_state_event_cb(void *user_data, callui_call_event_type_e call_event_type, unsigned int call_id, callui_sim_slot_type_e sim_type, void *event_info)
+{
+ CALLUI_RETURN_IF_FAIL(user_data);
+
+ __callui_tlm_update_state(user_data);
+}
+
+static void __callui_tlm_update_state(_callui_touch_lock_manager_h tlm_h)
+{
CALLUI_RETURN_IF_FAIL(tlm_h);
- callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(tlm_h->base.ad->sound_manager);
- if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
- dbg("Speaker ON. Do not display lockscreen.");
- return;
- }
- if (EINA_TRUE == _callui_keypad_get_show_status(tlm_h->base.ad->keypad)) {
- dbg("Keypad is ON. Do not display lockscreen.");
- return;
+ const callui_call_data_t *active = _callui_stp_get_call_data(tlm_h->base.ad->state_provider, CALLUI_CALL_DATA_ACTIVE);
+ const callui_call_data_t *held = _callui_stp_get_call_data(tlm_h->base.ad->state_provider, CALLUI_CALL_DATA_HELD);
+ const callui_call_data_t *incom = _callui_stp_get_call_data(tlm_h->base.ad->state_provider, CALLUI_CALL_DATA_INCOMING);
+
+ Eina_Bool is_keypad_shown = _callui_keypad_get_show_status(tlm_h->base.ad->keypad);
+
+ dbg("Touch lockscreen [%s]", tlm_h->is_locked? "ON":"OFF");
+
+ if (_callui_stp_is_any_calls_available(tlm_h->base.ad->state_provider)) {
+ dbg("Any calls available");
+ if (tlm_h->base.ad->on_background && !tlm_h->is_locked) {
+ dbg("Ignore. Application is on background");
+ } else if (is_keypad_shown) {
+ dbg("Ignore. Keypad is shown");
+ } else if (_callui_common_is_handsfree_mode_on(tlm_h->base.ad)) {
+ dbg("Ignore. Handsfree mode");
+ } else {
+ DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+ if (incom) {
+ dbg("Incoming call");
+ if (tlm_h->is_locked) {
+ __callui_tlm_unlock(tlm_h);
+ }
+ tlm_h->was_incomming_call = true;
+ return;
+ } else if (active && active->is_dialing) {
+ dbg("Active call. Dialing mode");
+ if (tlm_h->is_locked) {
+ __callui_tlm_unlock(tlm_h);
+ }
+ tlm_h->no_lock_timer = ecore_timer_add(CALLUI_TLM_DURING_CALL_LOCK_TIMEOUT_SEC, __callui_tlm_lock_timeout_cb, tlm_h);
+ } else if (active || held) {
+ dbg("Active or Held call");
+ if (tlm_h->was_incomming_call) {
+ dbg("Incoming call was before");
+ __callui_tlm_lock(tlm_h);
+ } else {
+ tlm_h->no_lock_timer = ecore_timer_add(CALLUI_TLM_DEFAULT_LOCK_TIMEOUT_SEC, __callui_tlm_lock_timeout_cb, tlm_h);
+ }
+ }
+ }
+ tlm_h->was_incomming_call = false;
+ } else {
+ dbg("No calls available");
+ DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+ if (tlm_h->is_locked) {
+ __callui_tlm_unlock(tlm_h);
+ }
}
+}
+
+static void __callui_tlm_lock(_callui_touch_lock_manager_h tlm_h)
+{
+ debug_enter();
+
+ CALLUI_RETURN_IF_FAIL(tlm_h);
- evas_object_raise(tlm_h->layout);
+ elm_object_part_content_set(_callui_vm_get_main_ly(tlm_h->base.ad->view_manager), "elm.swallow.touchlock", tlm_h->layout);
evas_object_show(tlm_h->layout);
+ tlm_h->is_locked = true;
+
#ifdef _DBUS_DISPLAY_DEVICE_TIMEOUT_
if (_callui_vm_get_cur_view_type(tlm_h->base.ad->view_manager) != CALLUI_VIEW_DIALLING) {
- dbg("lcd show");
+ dbg("Update display timeout [Lock]");
_callui_display_set_timeout(tlm_h->base.ad->display, CALLUI_DISPLAY_TIMEOUT_LS_SET);
}
#endif
evas_object_show(hit_rect);
tlm_h->hit_rect = hit_rect;
- /* Touch lockscreen layout */
- Evas_Object *layout = _callui_load_edj(_callui_vm_get_main_ly(ad->view_manager), CALLUI_CALL_EDJ_PATH, "lock-screen");
- CALLUI_RETURN_VALUE_IF_FAIL(layout, CALLUI_RESULT_FAIL);
- layout = _callui_create_layout(_callui_vm_get_main_ly(ad->view_manager), CALLUI_LY_STYLE_TOUCH_LOCK_SCREEN);
++ Evas_Object *layout = _callui_create_layout(_callui_vm_get_main_ly(ad->view_manager), CALLUI_LY_STYLE_TOUCH_LOCK_SCREEN);
+ CALLUI_RETURN_VALUE_IF_FAIL(layout, false);
+
evas_object_resize(layout, ad->root_w, ad->root_h);
evas_object_move(layout, 0, 0);
elm_object_translatable_part_text_set(layout, "lock-text", "IDS_CALL_NPBODY_DOUBLE_TAP_THE_LOCK_ICON_TO_UNLOCK_YOUR_DEVICE");