TizenRefApp-7066 [Call UI] Refactor lock manager for future modification 43/86943/1
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 5 Sep 2016 13:55:39 +0000 (16:55 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 5 Sep 2016 13:58:19 +0000 (16:58 +0300)
Change-Id: If2d7eeefb9d1f3584d7f21376e4c2ec8f2cb2e88

21 files changed:
inc/callui-common.h
inc/callui-lock-manager-priv.h [new file with mode: 0644]
inc/callui-lock-manager.h
inc/callui-proximity-lock-manager.h
inc/callui-touch-lock-manager.h [moved from inc/callui-view-lock-screen.h with 66% similarity]
inc/callui.h
src/callui-common.c
src/callui-keypad.c
src/callui-lock-manager.c
src/callui-proximity-lock-manager.c
src/callui-touch-lock-manager.c [new file with mode: 0755]
src/callui-view-callend.c
src/callui-view-dialing.c
src/callui-view-elements.c
src/callui-view-incoming-call.c
src/callui-view-lock-screen.c [deleted file]
src/callui-view-manager.c
src/callui-view-multi-call-split.c
src/callui-view-quickpanel.c
src/callui-view-single-call.c
src/callui.c

index 3788b29..0ce7c87 100644 (file)
@@ -183,20 +183,6 @@ callui_result_e _callui_common_get_last_msg_data(void *appdata, const char *tel_
 callui_result_e _callui_common_send_reject_msg(void *appdata, const char *reject_msg);
 
 /**
- * @brief Gets audio mode
- *
- * @return @c true when call is on handsfree mode, otherwise false
- */
-bool _callui_is_on_handsfree_mode();
-
-/**
- * @brief Gets background state
- *
- * @return @c true when call is on background, otherwise false
- */
-bool _callui_is_on_background();
-
-/**
  * @brief Set call duration time into text part of Evas object
  *
  * @param[in] cur_time         source time data
@@ -259,4 +245,11 @@ char *_callui_common_get_date_string_representation(time_t last_update_time);
  */
 void _callui_common_process_accept_incoming_call(void *appdata);
 
+/**
+ * @brief Get the support status of proximity sensor
+ *
+ * @return true when proximity sensor is supported, otherwise false
+ */
+bool _callui_common_is_proximity_sensor_supported();
+
 #endif /*__CALLUI_COMMON_H_ */
diff --git a/inc/callui-lock-manager-priv.h b/inc/callui-lock-manager-priv.h
new file mode 100644 (file)
index 0000000..c9898f0
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  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.
+ *
+ */
+
+#ifndef __CALLUI_LOCK_MANAGER_PRIV_H__
+#define __CALLUI_LOCK_MANAGER_PRIV_H__
+
+#include "callui-lock-manager.h"
+#include "callui-common-types.h"
+
+typedef struct appdata callui_app_data_t;
+
+/**
+ * @brief Called when lock manager creates
+ */
+typedef callui_result_e (*lock_create) (callui_lock_manager_h lock_h, callui_app_data_t *ad);
+
+/**
+ * @brief Called when lock manager starts
+ */
+typedef void (*lock_start) (callui_lock_manager_h lock_h);
+
+/**
+ * @brief Called when need lock status
+ */
+typedef bool (*lock_is_started) (callui_lock_manager_h lock_h);
+
+/**
+ * @brief Called when lock manager stops
+ */
+typedef void (*lock_stop) (callui_lock_manager_h lock_h, bool force);
+
+/**
+ * @brief Called when need lcd status
+ */
+typedef bool (*lock_is_lcd_off) (callui_lock_manager_h lock_h);
+
+/**
+ * @brief Called when need set unlock callback
+ */
+typedef void (*lock_set_unlock_cb) (callui_lock_manager_h lock_h, unlock_cb_t callback, void *data);
+
+/**
+ * @brief Called when lock manager destroys
+ */
+typedef void (*lock_destroy) (callui_lock_manager_h lock_h);
+
+struct __lock_manager {
+       lock_create create;
+       lock_start start;
+       lock_stop stop;
+       lock_is_started is_started;
+       lock_is_lcd_off is_lcd_off;
+       lock_set_unlock_cb set_unlock_cb;
+       lock_destroy destroy;
+       callui_app_data_t *ad;
+};
+typedef struct __lock_manager _callui_lock_manager_t;
+
+#endif /* __CALLUI_LOCK_MANAGER_PRIV_H__ */
index 18fc8b6..56e3c3e 100644 (file)
 
 #include <stdbool.h>
 
-/**
- * @brief The lock handle
- */
-typedef struct lock_data lock_data_t;
-
+typedef struct appdata callui_app_data_t;
 /**
  * @brief Called when lcd unlock
  */
 typedef void (*unlock_cb_t)(void *data);
 
 /**
- * @brief Called when lock manager creates
- */
-typedef void *(*lock_create) ();
-
-/**
- * @brief Called when lock manager starts
- */
-typedef void (*lock_start) (void *lock_h);
-
-/**
- * @brief Called when need lock status
- */
-typedef bool (*lock_is_started) (void *lock_h);
-
-/**
- * @brief Called when lock manager stops
- */
-typedef void (*lock_stop) (void *lock_h, bool force);
-
-/**
- * @brief Called when need lcd status
- */
-typedef bool (*lock_is_lcd_off) (void *lock_h);
-
-/**
- * @brief Called when need set unlock callback
- */
-typedef void (*lock_set_unlock_cb) (void *lock_h, unlock_cb_t callback, void* data);
-
-/**
- * @brief Called when lock manager destroys
+ * @brief The lock manager handle
+ *
+ * @param[in]  ad      Application data
  */
-typedef void (*lock_destroy) (void *lock_h);
+typedef struct __lock_manager *callui_lock_manager_h;
 
-struct lock_data {
-       lock_create create;
-       lock_start start;
-       lock_stop stop;
-       lock_is_started is_started;
-       lock_is_lcd_off is_lcd_off;
-       lock_set_unlock_cb set_unlock_cb;
-       lock_destroy destroy;
-       void *handle;
-};
-
-/**
- * @brief Create lock manager
- * @return The lock handle
- * @see lock_data_t
- */
-lock_data_t *_callui_lock_manager_create();
+callui_lock_manager_h _callui_lock_manager_create(callui_app_data_t *ad);
 
 /**
  * @brief Starts lock manager
- * @param[in]   lock_h The lock handle
- * @see lock_data_t
+ *
+ * @param[in]  lock_h  The lock manager handle
  */
-void _callui_lock_manager_start(lock_data_t *lock_h);
+void _callui_lock_manager_start(callui_lock_manager_h lock_h);
 
 /**
  * @brief Stops lock manager
- * @param[in]   lock_h The lock handle
- * @see lock_data_t
+ *
+ * @param[in]  lock_h  The lock manager handle
  */
-void _callui_lock_manager_stop(lock_data_t *lock_h);
+void _callui_lock_manager_stop(callui_lock_manager_h lock_h);
 
 /**
  * @brief Force stops lock manager
- * @param[in]   lock_h The lock handle
- * @see lock_data_t
+ *
+ * @param[in]   lock_h The lock manager handle
  */
-void _callui_lock_manager_force_stop(lock_data_t *lock_h);
+void _callui_lock_manager_force_stop(callui_lock_manager_h lock_h);
 
 /**
  * @brief Gets lock status
- * @param[in]   lock_h The lock handle
+ *
+ * @param[in]  lock_h  The lock manager handle
+ *
  * @return true when proximity lock manager is started, otherwise false
- * @see lock_data_t
  */
-bool _callui_lock_manager_is_started(lock_data_t *lock_h);
+bool _callui_lock_manager_is_started(callui_lock_manager_h lock_h);
 
 /**
  * @brief Destroy lock manager
- * @param[in]   lock_h The lock handle
- * @see lock_data_t
+ *
+ * @param[in]  lock_h  The lock manager handle
  */
-void _callui_lock_manager_destroy(lock_data_t *lock_h);
+void _callui_lock_manager_destroy(callui_lock_manager_h lock_h);
 
 /**
  * @brief Gets proximity lcd status
- * @param[in]   lock_h The lock handle
+ *
+ * @param[in]  lock_h  The lock manager handle
+ *
  * @return true when proximity manager turned off lcd, otherwise false
- * @see proximity_lock_t
  */
-bool _callui_lock_manager_is_lcd_off(lock_data_t *lock_h);
+bool _callui_lock_manager_is_lcd_off(callui_lock_manager_h lock_h);
 
 /**
  * @brief Sets callback to be run on unlock
- * @param[in]   lock_h     The lock handle
- * @param[in]   callback   The callback function to run on unlock
- * @param[in]   data       The user data to be passed to the callback function
- * @see lock_data_t
+ *
+ * @param[in]  lock_h          The lock manager handle
+ * @param[in]  callback        The callback function to run on unlock
+ * @param[in]  data            The user data to be passed to the callback function
+ *
  * @see unlock_cb_t
  */
-void _callui_lock_manager_set_callback_on_unlock(lock_data_t *lock_h, unlock_cb_t callback, void *data);
+void _callui_lock_manager_set_callback_on_unlock(callui_lock_manager_h lock_h, unlock_cb_t callback, void *data);
 
 #endif /** __CALLUI_LOCK_MANAGER_H_ */
index c9ec25e..190df77 100644 (file)
 #ifndef __CALLUI_PROXIMITY_LOCK_MANAGER_H__
 #define __CALLUI_PROXIMITY_LOCK_MANAGER_H__
 
-#include "callui-lock-manager.h"
-
-/**
- * @brief Gets proximity sensor supported status
- *
- * @return true when proximity sensor is supported, otherwise false
- */
-bool _callui_proximity_lock_manager_is_supported();
+typedef struct __proximity_lock_manager *_callui_proximity_lock_manager_h;
 
 /**
  * @brief Create proximity lock manager
  *
- * @param[in] lock_h The lock handle
- *
- * @see lock_data_t
+ * @return Proximity lock manager instance
  */
-void _callui_proximity_lock_manager_init(lock_data_t *lock_h);
+_callui_proximity_lock_manager_h _callui_proximity_lock_manager_new();
 
 #endif /* __CALLUI_PROXIMITY_LOCK_MANAGER_H__ */
similarity index 66%
rename from inc/callui-view-lock-screen.h
rename to inc/callui-touch-lock-manager.h
index 609d1cd..06c6df3 100755 (executable)
  *
  */
 
-#ifndef _VCUI_VIEW_LOCK_SCREEN_H_
-#define _VCUI_VIEW_LOCK_SCREEN_H_
+#ifndef __CALLUI_TOUCH_LOCK_MANAGER_H__
+#define __CALLUI_TOUCH_LOCK_MANAGER_H__
 
-#include "callui-lock-manager.h"
+typedef struct __touch_lock_manager *_callui_touch_lock_manager_h;
 
 /**
- * @brief Create lock screen manager
+ * @brief Create touch lock manager
  *
- * @param[in] lock_h The lock handle
- *
- * @see lock_data_t
+ * @return Touch lock manager instance
  */
-void _callui_lock_screen_init(lock_data_t *lock_h);
-
-#endif //_VCUI_VIEW_LOCK_SCREEN_H_
+_callui_touch_lock_manager_h _callui_touch_lock_manager_new();
 
+#endif /* __CALLUI_TOUCH_LOCK_MANAGER_H__ */
index b6a0059..bc35ce2 100755 (executable)
@@ -50,7 +50,8 @@ struct appdata {
 
        callui_vm_h view_manager;
 
-       lock_data_t *lock_handle;
+       callui_lock_manager_h lock_manager;
+
        bool start_lock_manager_on_resume;
        bool on_background;
 
@@ -86,6 +87,4 @@ struct appdata {
        app_control_h delayed_app_control;
 };
 
-callui_app_data_t *_callui_get_app_data();
-
 #endif// __CALLUI_H__
index 9936ffa..e0f66b8 100755 (executable)
@@ -28,6 +28,7 @@
 #include <utils_i18n_ulocale.h>
 #include <utils_i18n.h>
 #include <glib.h>
+#include <sensor.h>
 
 #include "callui-common.h"
 #include "callui-debug.h"
@@ -167,8 +168,8 @@ void _callui_common_unlock_swipe_lock(void)
  */
 static void __try_to_stop_lock_manager(callui_app_data_t *ad)
 {
-       if (_callui_lock_manager_is_started(ad->lock_handle)) {
-               _callui_lock_manager_stop(ad->lock_handle);
+       if (_callui_lock_manager_is_started(ad->lock_manager)) {
+               _callui_lock_manager_stop(ad->lock_manager);
                ad->start_lock_manager_on_resume = true;
        }
 }
@@ -185,7 +186,7 @@ static void __app_launch_reply_cb(app_control_h request, app_control_h reply, ap
                ad->on_background = true;
        } else if (result == APP_CONTROL_RESULT_FAILED) {
                if (ad->start_lock_manager_on_resume && type != CALLUI_LOCK_TYPE_SECURITY_LOCK) {
-                       _callui_lock_manager_start(ad->lock_handle);
+                       _callui_lock_manager_start(ad->lock_manager);
                        ad->start_lock_manager_on_resume = false;
                }
        }
@@ -889,30 +890,6 @@ callui_result_e _callui_common_send_reject_msg(void *appdata, const char *reject
 }
 
 /**
- * @brief Gets audio mode
- *
- * @return @c true when call is on handsfree mode, otherwise false
- */
-bool _callui_is_on_handsfree_mode()
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-
-       callui_audio_state_type_e type = _callui_sdm_get_audio_state(ad->sound_manager);
-       return (type != CALLUI_AUDIO_STATE_RECEIVER && type != CALLUI_AUDIO_STATE_NONE);
-}
-
-/**
- * @brief Gets background state
- *
- * @return @c true when call is on background, otherwise false
- */
-bool _callui_is_on_background()
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-       return ad->on_background;
-}
-
-/**
  * @brief Set call duration time into text part of Evas object
  *
  * @param[in] cur_time         source time data
@@ -1243,3 +1220,10 @@ void _callui_common_process_accept_incoming_call(void *appdata)
                }
        }
 }
+
+bool _callui_common_is_proximity_sensor_supported()
+{
+       bool is_supported = false;
+       sensor_is_supported(SENSOR_PROXIMITY, &is_supported);
+       return is_supported;
+}
index 9fb7266..5dda844 100755 (executable)
@@ -277,7 +277,7 @@ static void __on_hide_completed(void *data, Evas_Object *obj, const char *emissi
        callui_app_data_t *ad = keypad->ad;
        Evas_Object *main_ly = _callui_vm_get_main_ly(ad->view_manager);
 
-       _callui_lock_manager_start(ad->lock_handle);
+       _callui_lock_manager_start(ad->lock_manager);
 
        eext_object_event_callback_del(main_ly, EEXT_CALLBACK_BACK, __back_button_click_cb);
 
@@ -472,7 +472,7 @@ void _callui_keypad_show(callui_keypad_h keypad)
 
        keypad->is_keypad_show = EINA_TRUE;
 
-       _callui_lock_manager_stop(ad->lock_handle);
+       _callui_lock_manager_stop(ad->lock_manager);
 
        eext_object_event_callback_add(main_ly, EEXT_CALLBACK_BACK, __back_button_click_cb, keypad);
 
index 954b510..2b954ac 100644 (file)
  *
  */
 
+#include <callui-touch-lock-manager.h>
 #include "callui-lock-manager.h"
+#include "callui-lock-manager-priv.h"
 #include "callui-debug.h"
 #include "callui-proximity-lock-manager.h"
-#include "callui-view-lock-screen.h"
 #include "callui-common.h"
+#include "callui-common-defines.h"
+#include "callui-sound-manager.h"
 
-lock_data_t *_callui_lock_manager_create()
+callui_lock_manager_h _callui_lock_manager_create(callui_app_data_t *ad)
 {
        dbg("..");
-       lock_data_t *lock_h;
-       lock_h = calloc(1, sizeof(lock_data_t));
-       CALLUI_RETURN_NULL_IF_FAIL(lock_h);
-       bool proximity_supported = _callui_proximity_lock_manager_is_supported();
-       if (proximity_supported) {
-               _callui_proximity_lock_manager_init(lock_h);
+       CALLUI_RETURN_NULL_IF_FAIL(ad);
+
+       callui_lock_manager_h lock_h = NULL;
+       if (_callui_common_is_proximity_sensor_supported()) {
+               lock_h = (callui_lock_manager_h)_callui_proximity_lock_manager_new(ad);
        } else {
-               _callui_lock_screen_init(lock_h);
+               lock_h = (callui_lock_manager_h)_callui_touch_lock_manager_new(ad);
        }
-       lock_h->handle = lock_h->create();
-       if (!lock_h->handle) {
-               free(lock_h);
-               return NULL;
+       CALLUI_RETURN_NULL_IF_FAIL(lock_h);
+
+       if (lock_h->create(lock_h, ad) == CALLUI_RESULT_FAIL) {
+               FREE(lock_h);
        }
        return lock_h;
 }
 
-void _callui_lock_manager_start(lock_data_t *lock_h)
+void _callui_lock_manager_start(callui_lock_manager_h lock_h)
 {
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_h);
-       if (_callui_is_on_handsfree_mode() || _callui_lock_manager_is_started(lock_h) || _callui_is_on_background()) {
+
+       callui_audio_state_type_e type = _callui_sdm_get_audio_state(lock_h->ad->sound_manager);
+       bool is_on_handsfree_mode = (type != CALLUI_AUDIO_STATE_RECEIVER && type != CALLUI_AUDIO_STATE_NONE);
+
+       if (is_on_handsfree_mode || _callui_lock_manager_is_started(lock_h) || lock_h->ad->on_background) {
                return;
        }
-       lock_h->start(lock_h->handle);
+
+       lock_h->start(lock_h);
 }
 
-void _callui_lock_manager_stop(lock_data_t *lock_h)
+void _callui_lock_manager_stop(callui_lock_manager_h lock_h)
 {
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_h->stop(lock_h->handle, false);
+       lock_h->stop(lock_h, false);
 }
 
-void _callui_lock_manager_force_stop(lock_data_t *lock_h)
+void _callui_lock_manager_force_stop(callui_lock_manager_h lock_h)
 {
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_h->stop(lock_h->handle, true);
+       lock_h->stop(lock_h, true);
 }
 
-bool _callui_lock_manager_is_started(lock_data_t *lock_h)
+bool _callui_lock_manager_is_started(callui_lock_manager_h lock_h)
 {
        dbg("..");
        CALLUI_RETURN_VALUE_IF_FAIL(lock_h, false);
-       return lock_h->is_started(lock_h->handle);
+       return lock_h->is_started(lock_h);
 }
 
-void _callui_lock_manager_destroy(lock_data_t *lock_h)
+void _callui_lock_manager_destroy(callui_lock_manager_h lock_h)
 {
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_h->destroy(lock_h->handle);
-       free(lock_h);
+       lock_h->destroy(lock_h);
 }
 
-bool _callui_lock_manager_is_lcd_off(lock_data_t *lock_h)
+bool _callui_lock_manager_is_lcd_off(callui_lock_manager_h lock_h)
 {
        dbg("..");
        CALLUI_RETURN_VALUE_IF_FAIL(lock_h, false);
-       return lock_h->is_lcd_off(lock_h->handle);
+       return lock_h->is_lcd_off(lock_h);
 }
 
-void _callui_lock_manager_set_callback_on_unlock(lock_data_t *lock_h, unlock_cb_t callback, void* data)
+void _callui_lock_manager_set_callback_on_unlock(callui_lock_manager_h lock_h, unlock_cb_t callback, void* data)
 {
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_h->set_unlock_cb(lock_h->handle, callback, data);
+       lock_h->set_unlock_cb(lock_h, callback, data);
 }
index 784b2a8..c56d682 100644 (file)
 
 #include <sensor.h>
 
+#include "callui-lock-manager-priv.h"
 #include "callui-proximity-lock-manager.h"
 #include "callui-debug.h"
 #include "callui-common.h"
+#include "callui-common-defines.h"
 
 #define CALLUI_SENSOR_INTERVAL 100
 #define CALLUI_LCD_TURN_ON_DELAY_INTERVAL 0.1
@@ -37,123 +39,69 @@ typedef enum {
        CALLUI_PLM_STATE_STOPPED
 } callui_plm_run_state_e;
 
-typedef struct proximity_lock {
+struct __proximity_lock_manager {
+       _callui_lock_manager_t base;
        sensor_h sensor;
        sensor_listener_h sensor_listener;
        callui_plm_lcd_state_e lcd_state;
        callui_plm_run_state_e run_state;
        unlock_cb_t unlock_cb;
        void *cb_data;
-
        Ecore_Timer *lcd_turn_on_timer;
-
-} _callui_proximity_lock_t;
-
-/**
- * @brief Create proximity lock manager
- *
- * @return The proximity lock handle as void pointer
- *
- * @see _callui_proximity_lock_t
- */
-static void *__callui_proximity_lock_manager_create();
-
-/**
- * @brief Starts proximity sensor listener
- *
- * @param[in]   lock_h The proximity lock handle
- *
- * @see _callui_proximity_lock_t
- */
-static void __callui_proximity_lock_manager_start(void *lock_h);
-
-/**
- * @brief Stops proximity sensor listener
- *
- * @param[in]   lock_h The proximity lock handle
- * @param[in]   force  force stops when true, otherwise just stops
- *
- * @see _callui_proximity_lock_t
- */
-static void __callui_proximity_lock_manager_force_stop(void *lock_h, bool force);
-
-/**
- * @brief Stops proximity sensor listener
- *
- * @param[in]   lock_h The proximity lock handle
- *
- * @see _callui_proximity_lock_t
- */
-static void __callui_proximity_lock_manager_stop(void *lock_h);
-
-/**
- * @brief Gets proximity lock status
- *
- * @param[in]   lock_h The proximity lock handle
- *
- * @return true when proximity lock manager is started, otherwise false
- *
- * @see _callui_proximity_lock_t
- */
-static bool __callui_proximity_lock_manager_is_started(void *lock_h);
-
-/**
- * @brief Destroy proximity lock manager
- *
- * @param[in]   proximity_h The proximity lock handle
- *
- * @see _callui_proximity_lock_t
- */
-static void __callui_proximity_lock_manager_destroy(void *lock_h);
-static bool __callui_proximity_lock_manager_is_lcd_off(void *lock_h);
-static void __callui_proximity_lock_manager_set_callback_on_unlock(void *lock_h, unlock_cb_t callback, void *data);
-
-static int __callui_proximity_lock_manager_create_listener(_callui_proximity_lock_t *proximity_h);
+};
+typedef struct __proximity_lock_manager __callui_proximity_lock_manager_t;
+
+static callui_result_e __callui_proximity_lock_manager_create(callui_lock_manager_h lock_h, callui_app_data_t *ad);
+static void __callui_proximity_lock_manager_start(callui_lock_manager_h lock_h);
+static void __callui_proximity_lock_manager_force_stop(callui_lock_manager_h lock_h, bool force);
+static void __callui_proximity_lock_manager_stop(callui_lock_manager_h lock_h);
+static bool __callui_proximity_lock_manager_is_started(callui_lock_manager_h);
+static void __callui_proximity_lock_manager_destroy(callui_lock_manager_h lock_h);
+static bool __callui_proximity_lock_manager_is_lcd_off(callui_lock_manager_h lock_h);
+static void __callui_proximity_lock_manager_set_callback_on_unlock(callui_lock_manager_h lock_h, unlock_cb_t callback, void *data);
+
+static int __callui_proximity_lock_manager_create_listener(_callui_proximity_lock_manager_h plm_h);
 static void __callui_proximity_lock_manager_cb(sensor_h sensor, sensor_event_s *sensor_data, void *user_data);
-
-static void __callui_proximity_lock_manager_turn_lcd_on(_callui_proximity_lock_t *proximity_h);
+static void __callui_proximity_lock_manager_turn_lcd_on(_callui_proximity_lock_manager_h plm_h);
 static Eina_Bool __callui_proximity_lock_manager_turn_lcd_on_timer_cb(void *data);
 
-static int __callui_proximity_lock_manager_create_listener(_callui_proximity_lock_t *proximity_h)
+static int __callui_proximity_lock_manager_create_listener(_callui_proximity_lock_manager_h plm_h)
 {
        dbg("..");
        int ret = SENSOR_ERROR_NONE;
-       CALLUI_RETURN_VALUE_IF_FAIL(proximity_h, SENSOR_ERROR_INVALID_PARAMETER);
-       ret = sensor_create_listener(proximity_h->sensor, &proximity_h->sensor_listener);
+       CALLUI_RETURN_VALUE_IF_FAIL(plm_h, SENSOR_ERROR_INVALID_PARAMETER);
+       ret = sensor_create_listener(plm_h->sensor, &plm_h->sensor_listener);
        if (ret != SENSOR_ERROR_NONE) {
                err("sensor_create_listener() failed(%d)", ret);
                return ret;
        }
-       sensor_listener_set_option(proximity_h->sensor_listener, SENSOR_OPTION_ALWAYS_ON);
-       sensor_listener_set_event_cb(proximity_h->sensor_listener, CALLUI_SENSOR_INTERVAL, __callui_proximity_lock_manager_cb, proximity_h);
+       sensor_listener_set_option(plm_h->sensor_listener, SENSOR_OPTION_ALWAYS_ON);
+       sensor_listener_set_event_cb(plm_h->sensor_listener, CALLUI_SENSOR_INTERVAL, __callui_proximity_lock_manager_cb, plm_h);
        return ret;
 }
 
-static void __callui_proximity_lock_manager_turn_lcd_on(_callui_proximity_lock_t *proximity_h)
+static void __callui_proximity_lock_manager_turn_lcd_on(_callui_proximity_lock_manager_h plm_h)
 {
-       callui_app_data_t *ad = _callui_get_app_data();
-
        dbg("Turn display [ON]");
-       _callui_display_set_control_state(ad->display, CALLUI_DISPLAY_CONTROL_ON);
-       proximity_h->lcd_state = CALLUI_PLM_LCD_ON;
+       _callui_display_set_control_state(plm_h->base.ad->display, CALLUI_DISPLAY_CONTROL_ON);
+       plm_h->lcd_state = CALLUI_PLM_LCD_ON;
 
-       if (proximity_h->unlock_cb) {
-               proximity_h->unlock_cb(proximity_h->cb_data);
-               proximity_h->unlock_cb = NULL;
-               proximity_h->cb_data = NULL;
+       if (plm_h->unlock_cb) {
+               plm_h->unlock_cb(plm_h->cb_data);
+               plm_h->unlock_cb = NULL;
+               plm_h->cb_data = NULL;
        }
 }
 
 static Eina_Bool __callui_proximity_lock_manager_turn_lcd_on_timer_cb(void *data)
 {
-       _callui_proximity_lock_t *proximity_h = data;
+       _callui_proximity_lock_manager_h plm_h = data;
 
        /* Unlock indicator color change mechanism */
-       callui_app_data_t *ad = _callui_get_app_data();
-       _callui_indicator_set_locked(ad->indicator, false);
+       _callui_indicator_set_locked(plm_h->base.ad->indicator, false);
 
-       __callui_proximity_lock_manager_turn_lcd_on(proximity_h);
-       proximity_h->lcd_turn_on_timer = NULL;
+       __callui_proximity_lock_manager_turn_lcd_on(plm_h);
+       plm_h->lcd_turn_on_timer = NULL;
 
        return ECORE_CALLBACK_DONE;
 }
@@ -163,37 +111,36 @@ static void __callui_proximity_lock_manager_cb(sensor_h sensor, sensor_event_s *
        CALLUI_RETURN_IF_FAIL(user_data);
        CALLUI_RETURN_IF_FAIL(sensor_data);
 
-       _callui_proximity_lock_t *proximity_h = user_data;
-       if (proximity_h->run_state == CALLUI_PLM_STATE_STOPPED) {
+       _callui_proximity_lock_manager_h plm_h = user_data;
+       if (plm_h->run_state == CALLUI_PLM_STATE_STOPPED) {
                dbg("Ignored. Proximity Lock Manager is stopped.");
                return;
        }
 
        float value = sensor_data->values[0];
        dbg("Proximity sensor value [%.1f]. Sensor state [%s]", value, (value > 0) ? "OPENED" : "CLOSED");
-       callui_app_data_t *ad = _callui_get_app_data();
 
        if (value > 0) {
-               if (proximity_h->lcd_state == CALLUI_PLM_LCD_OFF) {
+               if (plm_h->lcd_state == CALLUI_PLM_LCD_OFF) {
                        dbg("Make request on turn display [ON] with delay");
-                       DELETE_ECORE_TIMER(proximity_h->lcd_turn_on_timer);
-                       proximity_h->lcd_turn_on_timer = ecore_timer_add(CALLUI_LCD_TURN_ON_DELAY_INTERVAL, __callui_proximity_lock_manager_turn_lcd_on_timer_cb, proximity_h);
+                       DELETE_ECORE_TIMER(plm_h->lcd_turn_on_timer);
+                       plm_h->lcd_turn_on_timer = ecore_timer_add(CALLUI_LCD_TURN_ON_DELAY_INTERVAL, __callui_proximity_lock_manager_turn_lcd_on_timer_cb, plm_h);
                }
        } else {
 
                callui_display_state_e state;
-               if (_callui_display_get_state(ad->display, &state) == CALLUI_RESULT_OK && state != CALLUI_DISPLAY_OFF) {
-                       if (proximity_h->lcd_turn_on_timer) {
+               if (_callui_display_get_state(plm_h->base.ad->display, &state) == CALLUI_RESULT_OK && state != CALLUI_DISPLAY_OFF) {
+                       if (plm_h->lcd_turn_on_timer) {
                                dbg("Cancel request on turn display [ON] with delay");
-                               DELETE_ECORE_TIMER(proximity_h->lcd_turn_on_timer);
+                               DELETE_ECORE_TIMER(plm_h->lcd_turn_on_timer);
                        } else {
                                dbg("Turn display [OFF]");
 
                                /* Lock indicator to not change its color while proximity sensor is turn display off */
-                               _callui_indicator_set_locked(ad->indicator, true);
+                               _callui_indicator_set_locked(plm_h->base.ad->indicator, true);
 
-                               _callui_display_set_control_state(ad->display, CALLUI_DISPLAY_CONTROL_OFF);
-                               proximity_h->lcd_state = CALLUI_PLM_LCD_OFF;
+                               _callui_display_set_control_state(plm_h->base.ad->display, CALLUI_DISPLAY_CONTROL_OFF);
+                               plm_h->lcd_state = CALLUI_PLM_LCD_OFF;
                        }
                } else {
                        dbg("Ignored. Display already turned off");
@@ -201,49 +148,55 @@ static void __callui_proximity_lock_manager_cb(sensor_h sensor, sensor_event_s *
        }
 }
 
-static void *__callui_proximity_lock_manager_create()
+static callui_result_e __callui_proximity_lock_manager_create(callui_lock_manager_h lock_h, callui_app_data_t *ad)
 {
-       dbg("..");
-       _callui_proximity_lock_t *proximity_h = calloc(1, sizeof(_callui_proximity_lock_t));
-       CALLUI_RETURN_NULL_IF_FAIL(proximity_h);
-       proximity_h->run_state = CALLUI_PLM_STATE_UNDEFINED;
-       proximity_h->lcd_state = CALLUI_PLM_LCD_UNDEFINED;
-       proximity_h->unlock_cb = NULL;
-       proximity_h->cb_data = NULL;
+       debug_enter();
+
+       CALLUI_RETURN_VALUE_IF_FAIL(lock_h, CALLUI_RESULT_INVALID_PARAM);
+       CALLUI_RETURN_VALUE_IF_FAIL(ad, CALLUI_RESULT_INVALID_PARAM);
+
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
+       plm_h->base.ad = ad;
+
+       plm_h->run_state = CALLUI_PLM_STATE_UNDEFINED;
+       plm_h->lcd_state = CALLUI_PLM_LCD_UNDEFINED;
+       plm_h->unlock_cb = NULL;
+       plm_h->cb_data = NULL;
 
        int ret = SENSOR_ERROR_NONE;
-       ret = sensor_get_default_sensor(SENSOR_PROXIMITY, &proximity_h->sensor);
+       ret = sensor_get_default_sensor(SENSOR_PROXIMITY, &plm_h->sensor);
        if (ret != SENSOR_ERROR_NONE) {
                err("sensor_get_default_sensor() failed(%d)", ret);
-               free(proximity_h);
-               return NULL;
+               free(plm_h);
+               return CALLUI_RESULT_FAIL;
        }
-       ret = __callui_proximity_lock_manager_create_listener(proximity_h);
+       ret = __callui_proximity_lock_manager_create_listener(plm_h);
        if (ret != SENSOR_ERROR_NONE) {
                err("create listener failed(%d)", ret);
-               free(proximity_h);
-               return NULL;
+               free(plm_h);
+               return CALLUI_RESULT_FAIL;
        }
-       return proximity_h;
+       return CALLUI_RESULT_OK;
 }
 
-static void __callui_proximity_lock_manager_start(void *lock_h)
+static void __callui_proximity_lock_manager_start(callui_lock_manager_h lock_h)
 {
-       dbg("..");
+       debug_enter();
+
        CALLUI_RETURN_IF_FAIL(lock_h);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
 
-       switch (proximity_h->run_state) {
+       switch (plm_h->run_state) {
        case CALLUI_PLM_STATE_STARTED:
                dbg("Already started");
                return;
        case CALLUI_PLM_STATE_SUSPENDED:
-               proximity_h->unlock_cb = NULL;
-               proximity_h->cb_data = NULL;
+               plm_h->unlock_cb = NULL;
+               plm_h->cb_data = NULL;
                break;
        default:
        {
-               int ret = sensor_listener_start(proximity_h->sensor_listener);
+               int ret = sensor_listener_start(plm_h->sensor_listener);
                if (ret != SENSOR_ERROR_NONE) {
                        err("sensor_listener_start() failed. res[%d]", ret);
                }
@@ -251,92 +204,105 @@ static void __callui_proximity_lock_manager_start(void *lock_h)
        }
        }
 
-       callui_app_data_t *ad = _callui_get_app_data();
 #ifdef _DBUS_DISPLAY_DEVICE_TIMEOUT_
-       _callui_display_set_timeout(ad->display, CALLUI_DISPLAY_TIMEOUT_SET);
+       _callui_display_set_timeout(plm_h->base.ad->display, CALLUI_DISPLAY_TIMEOUT_SET);
 #endif
-       proximity_h->run_state = CALLUI_PLM_STATE_STARTED;
-       proximity_h->lcd_state = CALLUI_PLM_LCD_UNDEFINED;
+       plm_h->run_state = CALLUI_PLM_STATE_STARTED;
+       plm_h->lcd_state = CALLUI_PLM_LCD_UNDEFINED;
 }
 
-static void __callui_proximity_lock_manager_force_stop(void *lock_h, bool force)
+static void __callui_proximity_lock_manager_on_unlock_cb(void *data)
 {
-       dbg("..");
+       __callui_proximity_lock_manager_stop((callui_lock_manager_h)data);
+}
+
+static void __callui_proximity_lock_manager_force_stop(callui_lock_manager_h lock_h, bool force)
+{
+       debug_enter();
+
        CALLUI_RETURN_IF_FAIL(lock_h);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
-       if (!force && __callui_proximity_lock_manager_is_lcd_off(proximity_h)) {
-               proximity_h->run_state = CALLUI_PLM_STATE_SUSPENDED;
-               __callui_proximity_lock_manager_set_callback_on_unlock(proximity_h, __callui_proximity_lock_manager_stop, proximity_h);
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
+
+       if (!force && __callui_proximity_lock_manager_is_lcd_off((callui_lock_manager_h)plm_h)) {
+               plm_h->run_state = CALLUI_PLM_STATE_SUSPENDED;
+               __callui_proximity_lock_manager_set_callback_on_unlock((callui_lock_manager_h)plm_h, __callui_proximity_lock_manager_on_unlock_cb, plm_h);
        } else {
-               __callui_proximity_lock_manager_stop(proximity_h);
+               __callui_proximity_lock_manager_stop((callui_lock_manager_h)plm_h);
        }
 }
 
-static void __callui_proximity_lock_manager_stop(void *lock_h)
+static void __callui_proximity_lock_manager_stop(callui_lock_manager_h lock_h)
 {
        debug_enter();
+
        CALLUI_RETURN_IF_FAIL(lock_h);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
-       int ret = sensor_listener_stop(proximity_h->sensor_listener);
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
+
+       int ret = sensor_listener_stop(plm_h->sensor_listener);
        if (ret != SENSOR_ERROR_NONE) {
                err("sensor_listener_stop() failed(%d)", ret);
        }
-       proximity_h->run_state = CALLUI_PLM_STATE_STOPPED;
-       proximity_h->lcd_state = CALLUI_PLM_LCD_UNDEFINED;
+       plm_h->run_state = CALLUI_PLM_STATE_STOPPED;
+       plm_h->lcd_state = CALLUI_PLM_LCD_UNDEFINED;
 }
 
-static bool __callui_proximity_lock_manager_is_started(void *lock_h)
+static bool __callui_proximity_lock_manager_is_started(callui_lock_manager_h lock_h)
 {
-       dbg("..");
+       debug_enter();
+
        CALLUI_RETURN_VALUE_IF_FAIL(lock_h, false);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
-       return (proximity_h->run_state == CALLUI_PLM_STATE_STARTED);
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
+
+       return (plm_h->run_state == CALLUI_PLM_STATE_STARTED);
 }
 
-static void __callui_proximity_lock_manager_destroy(void *lock_h)
+static void __callui_proximity_lock_manager_destroy(callui_lock_manager_h lock_h)
 {
-       dbg("..");
+       debug_enter();
+
        CALLUI_RETURN_IF_FAIL(lock_h);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
 
-       DELETE_ECORE_TIMER(proximity_h->lcd_turn_on_timer);
-       sensor_listener_unset_event_cb(proximity_h->sensor_listener);
-       sensor_destroy_listener(proximity_h->sensor_listener);
-       free(proximity_h);
+       DELETE_ECORE_TIMER(plm_h->lcd_turn_on_timer);
+       sensor_listener_unset_event_cb(plm_h->sensor_listener);
+       sensor_destroy_listener(plm_h->sensor_listener);
+       free(plm_h);
 }
 
-static bool __callui_proximity_lock_manager_is_lcd_off(void *lock_h)
+static bool __callui_proximity_lock_manager_is_lcd_off(callui_lock_manager_h lock_h)
 {
-       dbg("..");
+       debug_enter();
+
        CALLUI_RETURN_VALUE_IF_FAIL(lock_h, false);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
-       dbg("Proximity lock manager LCD state [%s]", (proximity_h->lcd_state == CALLUI_PLM_LCD_OFF) ? "OFF":"ON");
-       return (proximity_h->lcd_state == CALLUI_PLM_LCD_OFF);
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
+
+       dbg("Proximity lock manager LCD state [%s]", (plm_h->lcd_state == CALLUI_PLM_LCD_OFF) ? "OFF":"ON");
+       return (plm_h->lcd_state == CALLUI_PLM_LCD_OFF);
 }
 
-static void __callui_proximity_lock_manager_set_callback_on_unlock(void *lock_h, unlock_cb_t callback, void *data)
+static void __callui_proximity_lock_manager_set_callback_on_unlock(callui_lock_manager_h lock_h, unlock_cb_t callback, void *data)
 {
-       dbg("..");
+       debug_enter();
+
        CALLUI_RETURN_IF_FAIL(lock_h || callback || data);
-       _callui_proximity_lock_t *proximity_h = (_callui_proximity_lock_t *)lock_h;
-       proximity_h->unlock_cb = callback;
-       proximity_h->cb_data = data;
-}
+       _callui_proximity_lock_manager_h plm_h = (_callui_proximity_lock_manager_h)lock_h;
 
-bool _callui_proximity_lock_manager_is_supported()
-{
-       bool is_supported = false;
-       sensor_is_supported(SENSOR_PROXIMITY, &is_supported);
-       return is_supported;
+       plm_h->unlock_cb = callback;
+       plm_h->cb_data = data;
 }
 
-void _callui_proximity_lock_manager_init(lock_data_t *lock_h)
+_callui_proximity_lock_manager_h _callui_proximity_lock_manager_new()
 {
-       lock_h->create = __callui_proximity_lock_manager_create;
-       lock_h->start = __callui_proximity_lock_manager_start;
-       lock_h->stop = __callui_proximity_lock_manager_force_stop;
-       lock_h->is_started = __callui_proximity_lock_manager_is_started;
-       lock_h->is_lcd_off = __callui_proximity_lock_manager_is_lcd_off;
-       lock_h->set_unlock_cb = __callui_proximity_lock_manager_set_callback_on_unlock;
-       lock_h->destroy = __callui_proximity_lock_manager_destroy;
+       _callui_proximity_lock_manager_h plm_h = calloc(1, sizeof(__callui_proximity_lock_manager_t));
+       CALLUI_RETURN_NULL_IF_FAIL(plm_h);
+
+       plm_h->base.create = __callui_proximity_lock_manager_create;
+       plm_h->base.start = __callui_proximity_lock_manager_start;
+       plm_h->base.stop = __callui_proximity_lock_manager_force_stop;
+       plm_h->base.is_started = __callui_proximity_lock_manager_is_started;
+       plm_h->base.is_lcd_off = __callui_proximity_lock_manager_is_lcd_off;
+       plm_h->base.set_unlock_cb = __callui_proximity_lock_manager_set_callback_on_unlock;
+       plm_h->base.destroy = __callui_proximity_lock_manager_destroy;
+
+       return plm_h;
 }
diff --git a/src/callui-touch-lock-manager.c b/src/callui-touch-lock-manager.c
new file mode 100755 (executable)
index 0000000..5baeb12
--- /dev/null
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  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 "callui-lock-manager-priv.h"
+#include "callui-touch-lock-manager.h"
+#include "callui-debug.h"
+#include "callui.h"
+#include "callui-view-dialing.h"
+#include "callui-view-single-call.h"
+#include "callui-view-multi-call-conf.h"
+#include "callui-view-multi-call-split.h"
+#include "callui-view-layout.h"
+#include "callui-keypad.h"
+#include "callui-view-manager.h"
+#include "callui-view-elements.h"
+#include "callui-common.h"
+#include "callui-sound-manager.h"
+
+struct __touch_lock_manager {
+       _callui_lock_manager_t base;
+       Evas_Object *layout;
+       Evas_Object *hit_rect;
+       Ecore_Timer *no_lock_timer;
+       bool is_locked;
+};
+
+typedef struct __touch_lock_manager __callui_touch_lock_manager_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)
+{
+       debug_enter();
+
+       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;
+       }
+
+       evas_object_raise(tlm_h->layout);
+       evas_object_show(tlm_h->layout);
+
+#ifdef _DBUS_DISPLAY_DEVICE_TIMEOUT_
+       if (_callui_vm_get_cur_view_type(tlm_h->base.ad->view_manager) != CALLUI_VIEW_DIALLING) {
+               dbg("lcd show");
+               _callui_display_set_timeout(tlm_h->base.ad->display, CALLUI_DISPLAY_TIMEOUT_LS_SET);
+       }
+#endif
+
+       tlm_h->is_locked = true;
+       return;
+}
+
+static void __callui_touch_lock_manager_hide_layout(_callui_touch_lock_manager_h tlm_h)
+{
+       debug_enter();
+
+       CALLUI_RETURN_IF_FAIL(tlm_h);
+
+       evas_object_hide(tlm_h->layout);
+       tlm_h->is_locked = false;
+
+#ifdef _DBUS_DISPLAY_DEVICE_TIMEOUT_
+       if (_callui_vm_get_cur_view_type(tlm_h->base.ad->view_manager) != CALLUI_VIEW_DIALLING) {
+               dbg("lcd hide");
+               _callui_display_set_timeout(tlm_h->base.ad->display, CALLUI_DISPLAY_TIMEOUT_SET);
+       }
+#endif
+
+}
+
+static Eina_Bool __lock_timeout_cb(void *data)
+{
+       debug_enter();
+
+       _callui_touch_lock_manager_h tlm_h = data;
+
+       tlm_h->no_lock_timer = NULL;
+
+       callui_view_type_e type = _callui_vm_get_cur_view_type(tlm_h->base.ad->view_manager);
+       if (type >= CALLUI_VIEW_MULTICALL_LIST) {
+               return ECORE_CALLBACK_CANCEL;
+       } else if (type == CALLUI_VIEW_INCOMING_CALL || type == CALLUI_VIEW_INCOMING_CALL_NOTI) {
+               return ECORE_CALLBACK_RENEW;
+       }
+
+       __callui_touch_lock_manager_show_layout(tlm_h);
+       return ECORE_CALLBACK_CANCEL;
+}
+
+static void __callui_touch_lock_manager_icon_double_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source)
+{
+       debug_enter();
+
+       _callui_touch_lock_manager_h tlm_h = data;
+
+       __callui_touch_lock_manager_hide_layout(tlm_h);
+       tlm_h->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, tlm_h);
+}
+
+static void __callui_touch_lock_manager_user_action_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
+{
+       debug_enter();
+
+       _callui_touch_lock_manager_h tlm_h = data;
+
+       DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+       tlm_h->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, tlm_h);
+}
+
+static bool __callui_touch_lock_manager_create_layout(_callui_touch_lock_manager_h tlm_h)
+{
+       debug_enter();
+
+       callui_app_data_t *ad = tlm_h->base.ad;
+       Evas_Object *layout = NULL;
+       Evas_Object *hit_rect = NULL;
+       CALLUI_RETURN_VALUE_IF_FAIL(tlm_h, false);
+
+       /* Make Hit rectangle to refresh lock timer */
+       hit_rect = evas_object_rectangle_add(evas_object_evas_get(_callui_window_get_eo(ad->window)));
+       evas_object_color_set(hit_rect, 0, 0, 0, 0);
+       evas_object_resize(hit_rect, ad->root_w, ad->root_h);
+       evas_object_move(hit_rect, 0, 0);
+       evas_object_repeat_events_set(hit_rect, EINA_TRUE);
+       evas_object_propagate_events_set(hit_rect, EINA_FALSE);
+       evas_object_event_callback_add(hit_rect, EVAS_CALLBACK_MOUSE_DOWN, __callui_touch_lock_manager_user_action_cb, tlm_h);
+       evas_object_show(hit_rect);
+       tlm_h->hit_rect = hit_rect;
+
+       layout = _callui_load_edj(_callui_vm_get_main_ly(ad->view_manager), CALLUI_CALL_EDJ_PATH, "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");
+
+       edje_object_signal_callback_add(_EDJ(layout), "mouse,down,1,double", "lock-icon", __callui_touch_lock_manager_icon_double_clicked_cb, tlm_h);
+
+       tlm_h->layout = layout;
+
+       __callui_touch_lock_manager_show_layout(tlm_h);
+
+       return true;
+}
+
+static void __callui_touch_lock_manager_start_timer(_callui_touch_lock_manager_h tlm_h)
+{
+       CALLUI_RETURN_IF_FAIL(tlm_h);
+
+       DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+       tlm_h->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, tlm_h);
+}
+
+static void __callui_touch_lock_manager_stop_timer(_callui_touch_lock_manager_h tlm_h)
+{
+       CALLUI_RETURN_IF_FAIL(tlm_h);
+
+       DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+}
+
+static void __callui_touch_lock_manager_destroy(callui_lock_manager_h lock_h)
+{
+       debug_enter();
+
+       CALLUI_RETURN_IF_FAIL(lock_h);
+
+       _callui_touch_lock_manager_h tlm_h = (_callui_touch_lock_manager_h)lock_h;
+
+       evas_object_del(tlm_h->layout);
+       evas_object_del(tlm_h->hit_rect);
+
+       DELETE_ECORE_TIMER(tlm_h->no_lock_timer);
+
+       free(tlm_h);
+}
+
+static bool __callui_touch_lock_manager_is_lockscreen_shown(callui_lock_manager_h tlm_h)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(tlm_h, false);
+
+       return ((_callui_touch_lock_manager_h)tlm_h)->is_locked;
+}
+
+static callui_result_e __callui_touch_lock_manager_create(callui_lock_manager_h lock_h, callui_app_data_t *ad)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(lock_h, CALLUI_RESULT_INVALID_PARAM);
+       CALLUI_RETURN_VALUE_IF_FAIL(ad, CALLUI_RESULT_INVALID_PARAM);
+
+       _callui_touch_lock_manager_h tlm_h = (_callui_touch_lock_manager_h)lock_h;
+       tlm_h->base.ad = ad;
+
+       if (!__callui_touch_lock_manager_create_layout(tlm_h)) {
+               free(tlm_h);
+               return CALLUI_RESULT_FAIL;
+       }
+       __callui_touch_lock_manager_hide_layout(tlm_h);
+
+       return CALLUI_RESULT_OK;
+}
+
+static void __callui_touch_lock_manager_start(callui_lock_manager_h lock_h)
+{
+       CALLUI_RETURN_IF_FAIL(lock_h);
+
+       __callui_touch_lock_manager_show_layout((_callui_touch_lock_manager_h)lock_h);
+       __callui_touch_lock_manager_start_timer((_callui_touch_lock_manager_h)lock_h);
+}
+
+static void __callui_touch_lock_manager_stop(callui_lock_manager_h lock_h, bool force)
+{
+       CALLUI_RETURN_IF_FAIL(lock_h);
+
+       __callui_touch_lock_manager_hide_layout((_callui_touch_lock_manager_h)lock_h);
+       __callui_touch_lock_manager_stop_timer((_callui_touch_lock_manager_h)lock_h);
+}
+
+static bool __callui_touch_lock_manager_is_lcd_off(callui_lock_manager_h lock_h)
+{
+       return false;
+}
+
+_callui_touch_lock_manager_h _callui_touch_lock_manager_new()
+{
+       _callui_touch_lock_manager_h tlm_h = calloc(1, sizeof(__callui_touch_lock_manager_t));
+       CALLUI_RETURN_NULL_IF_FAIL(tlm_h);
+
+       tlm_h->base.create = __callui_touch_lock_manager_create;
+       tlm_h->base.start = __callui_touch_lock_manager_start;
+       tlm_h->base.stop = __callui_touch_lock_manager_stop;
+       tlm_h->base.is_started = __callui_touch_lock_manager_is_lockscreen_shown;
+       tlm_h->base.is_lcd_off = __callui_touch_lock_manager_is_lcd_off;
+       tlm_h->base.set_unlock_cb = __callui_touch_lock_manager_set_callback_on_unlock;
+       tlm_h->base.destroy = __callui_touch_lock_manager_destroy;
+
+       return tlm_h;
+}
index a62a687..ad6d8ec 100644 (file)
@@ -135,7 +135,7 @@ static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *vie
        vd->base_view.ad = appdata;
 
        vd->base_view.ad->start_lock_manager_on_resume = false;
-       _callui_lock_manager_stop(vd->base_view.ad->lock_handle);
+       _callui_lock_manager_stop(vd->base_view.ad->lock_manager);
 
        callui_result_e res = __create_main_content(vd, parent);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
index 35cc5a8..e61ce19 100644 (file)
@@ -68,7 +68,7 @@ static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *vie
        callui_result_e res = __create_main_content(vd, parent);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, CALLUI_RESULT_FAIL);
 
-       _callui_lock_manager_start(ad->lock_handle);
+       _callui_lock_manager_start(ad->lock_manager);
 
        return __update_displayed_data(vd);
 }
index 97e8840..2e2d2a6 100755 (executable)
@@ -345,10 +345,10 @@ void _callui_load_more_option(void *data)
        callui_app_data_t *ad = (callui_app_data_t *)data;
        bool is_lcd_locked = false;
 
-       if (_callui_proximity_lock_manager_is_supported()) {
-               is_lcd_locked = _callui_lock_manager_is_lcd_off(ad->lock_handle);
+       if (_callui_common_is_proximity_sensor_supported()) {
+               is_lcd_locked = _callui_lock_manager_is_lcd_off(ad->lock_manager);
        } else {
-               is_lcd_locked = _callui_lock_manager_is_started(ad->lock_handle);
+               is_lcd_locked = _callui_lock_manager_is_started(ad->lock_manager);
        }
 
        if (is_lcd_locked) {
index c06a152..d8bfc98 100644 (file)
@@ -122,8 +122,8 @@ static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_
 
        vd->base_view.ad = ad;
 
-       if (_callui_lock_manager_is_started(ad->lock_handle)) {
-               _callui_lock_manager_force_stop(ad->lock_handle);
+       if (_callui_lock_manager_is_started(ad->lock_manager)) {
+               _callui_lock_manager_force_stop(ad->lock_manager);
        }
 
        _callui_window_set_size_type(ad->window, CALLUI_WIN_SIZE_FULLSCREEN);
diff --git a/src/callui-view-lock-screen.c b/src/callui-view-lock-screen.c
deleted file mode 100755 (executable)
index ce70ef2..0000000
+++ /dev/null
@@ -1,319 +0,0 @@
-/*
- * Copyright (c) 2009-2016 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  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 "callui-view-lock-screen.h"
-#include "callui-debug.h"
-#include "callui.h"
-#include "callui-view-dialing.h"
-#include "callui-view-single-call.h"
-#include "callui-view-multi-call-conf.h"
-#include "callui-view-multi-call-split.h"
-#include "callui-view-layout.h"
-#include "callui-keypad.h"
-#include "callui-view-manager.h"
-#include "callui-view-elements.h"
-#include "callui-common.h"
-#include "callui-sound-manager.h"
-
-typedef struct _lock_sccreen_data {
-       Evas_Object *layout;
-       Evas_Object *hit_rect;
-
-       Ecore_Timer *no_lock_timer;
-       bool is_locked;
-
-} lock_screen_data_t;
-
-static bool __callui_lock_screen_create_layout(lock_screen_data_t *priv);
-
-/**
- * @brief Start timer
- *
- * @param[in] lock_screen_priv      Lock screen
- *
- */
-static void __callui_lock_screen_start_timer(lock_screen_data_t *lock_screen_priv);
-
-/**
- * @brief Stop Timer
- *
- * @param[in] lock_screen_priv      Lock screen
- *
- */
-static void __callui_lock_screen_stop_timer(lock_screen_data_t *lock_screen_priv);
-
-/**
- * @brief Delete screen layout
- *
- * @param[in] lock_h      Lock screen handle
- *
- */
-static void __callui_lock_screen_delete_layout(void *lock_h);
-
-/**
- * @brief Check if lock screen is shown
- *
- * @param[in] lock_h      Lock screen handle
- *
- * @return Lock screen state
- *
- */
-static bool __callui_lock_screen_is_lockscreen_shown(void *lock_h);
-
-/**
- * @brief Show lock screen layout
- *
- * @param[in]    lock_screen_priv      Lock screen
- *
- */
-static void __callui_lock_screen_show_layout(lock_screen_data_t *lock_screen_priv);
-
-/**
- * @brief Hide lock screen layout
- *
- * @param[in]    lock_screen_priv      Lock screen
- *
- */
-static void __callui_lock_screen_hide_layout(lock_screen_data_t *lock_screen_priv);
-static void *__callui_lock_screen_create();
-static void __callui_lock_screen_start(void *lock_h);
-static void __callui_lock_screen_stop(void *lock_h, bool force);
-static bool __callui_lock_screen_is_lcd_off(void *lock_h);
-static void __callui_lock_screen_set_callback_on_unlock(void *lock_h, unlock_cb_t callback, void* data){};
-
-static void __callui_lock_screen_show_layout(lock_screen_data_t *lock_screen_priv)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(lock_screen_priv);
-       callui_app_data_t *ad = _callui_get_app_data();
-
-       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(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(ad->keypad)) {
-               dbg("Keypad is ON. Do not display lockscreen.");
-               return;
-       }
-
-       evas_object_raise(lock_screen_priv->layout);
-       evas_object_show(lock_screen_priv->layout);
-
-#ifdef _DBUS_DISPLAY_DEVICE_TIMEOUT_
-       if (_callui_vm_get_cur_view_type(ad->view_manager) != CALLUI_VIEW_DIALLING) {
-               dbg("lcd show");
-               callui_app_data_t *ad = _callui_get_app_data();
-               _callui_display_set_timeout(ad->display, CALLUI_DISPLAY_TIMEOUT_LS_SET);
-       }
-#endif
-
-       lock_screen_priv->is_locked = true;
-       return;
-}
-
-static void __callui_lock_screen_hide_layout(lock_screen_data_t *lock_screen_priv)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(lock_screen_priv);
-       callui_app_data_t *ad = _callui_get_app_data();
-       CALLUI_RETURN_IF_FAIL(ad);
-
-       evas_object_hide(lock_screen_priv->layout);
-       lock_screen_priv->is_locked = false;
-
-#ifdef _DBUS_DISPLAY_DEVICE_TIMEOUT_
-       if (_callui_vm_get_cur_view_type(ad->view_manager) != CALLUI_VIEW_DIALLING) {
-               dbg("lcd hide");
-               callui_app_data_t *ad = _callui_get_app_data();
-               _callui_display_set_timeout(ad->display, CALLUI_DISPLAY_TIMEOUT_SET);
-       }
-#endif
-
-}
-
-static Evas_Object *__callui_lock_screen_create_contents(Evas_Object *parent, char *grpname)
-{
-       Evas_Object *eo = NULL;
-
-       /* load edje */
-       eo = _callui_load_edj(parent, CALLUI_CALL_EDJ_PATH, grpname);
-       if (eo == NULL)
-               return NULL;
-       return eo;
-}
-
-static Eina_Bool __lock_timeout_cb(void *data)
-{
-       dbg("__lock_timeout_cb");
-       lock_screen_data_t *priv = (lock_screen_data_t *)data;
-       callui_app_data_t *ad = _callui_get_app_data();
-
-       priv->no_lock_timer = NULL;
-
-       callui_view_type_e type = _callui_vm_get_cur_view_type(ad->view_manager);
-       if (type >= CALLUI_VIEW_MULTICALL_LIST) {
-               return ECORE_CALLBACK_CANCEL;
-       } else if (type == CALLUI_VIEW_INCOMING_CALL || type == CALLUI_VIEW_INCOMING_CALL_NOTI) {
-               return ECORE_CALLBACK_RENEW;
-       }
-
-       __callui_lock_screen_show_layout(priv);
-       return ECORE_CALLBACK_CANCEL;
-}
-
-static void __callui_lock_screen_icon_double_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source)
-{
-       dbg("__callui_lock_screen_icon_double_clicked_cb");
-       lock_screen_data_t *priv = (lock_screen_data_t *)data;
-
-       __callui_lock_screen_hide_layout(priv);
-       priv->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, priv);
-       return;
-}
-
-static void __callui_lock_screen_user_action_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info)
-{
-       dbg("__callui_lock_screen_user_action_cb");
-       lock_screen_data_t *priv = (lock_screen_data_t *)data;
-       DELETE_ECORE_TIMER(priv->no_lock_timer);
-       priv->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, priv);
-
-       return;
-}
-
-static bool __callui_lock_screen_create_layout(lock_screen_data_t *priv)
-{
-       dbg( "lock screen create!!");
-       callui_app_data_t *ad = _callui_get_app_data();
-       Evas_Object *layout = NULL;
-       Evas_Object *hit_rect = NULL;
-       CALLUI_RETURN_VALUE_IF_FAIL(priv, false);
-
-       /* Make Hit rectangle to refresh lock timer */
-       hit_rect = evas_object_rectangle_add(evas_object_evas_get(_callui_window_get_eo(ad->window)));
-       evas_object_color_set(hit_rect, 0, 0, 0, 0);
-       evas_object_resize(hit_rect, ad->root_w, ad->root_h);
-       evas_object_move(hit_rect, 0, 0);
-       evas_object_repeat_events_set(hit_rect, EINA_TRUE);
-       evas_object_propagate_events_set(hit_rect, EINA_FALSE);
-       evas_object_event_callback_add(hit_rect, EVAS_CALLBACK_MOUSE_DOWN, __callui_lock_screen_user_action_cb, priv);
-       evas_object_show(hit_rect);
-       priv->hit_rect = hit_rect;
-
-       layout = __callui_lock_screen_create_contents(_callui_vm_get_main_ly(ad->view_manager), "lock-screen");
-       if (NULL == layout) {
-               warn("layout NULL!!!");
-       }
-
-       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");
-
-       edje_object_signal_callback_add(_EDJ(layout), "mouse,down,1,double", "lock-icon", __callui_lock_screen_icon_double_clicked_cb, priv);
-
-       priv->layout = layout;
-
-       __callui_lock_screen_show_layout(priv);
-
-       return true;
-}
-
-static void __callui_lock_screen_start_timer(lock_screen_data_t *lock_screen_priv)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(lock_screen_priv);
-
-       DELETE_ECORE_TIMER(lock_screen_priv->no_lock_timer);
-
-       lock_screen_priv->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, lock_screen_priv);
-       return;
-}
-
-static void __callui_lock_screen_stop_timer(lock_screen_data_t *lock_screen_priv)
-{
-       CALLUI_RETURN_IF_FAIL(lock_screen_priv);
-
-       DELETE_ECORE_TIMER(lock_screen_priv->no_lock_timer);
-       return;
-}
-
-static void __callui_lock_screen_delete_layout(void *lock_h)
-{
-       dbg("lock screen delete!!");
-       CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_screen_data_t *lock_screen_handle = (lock_screen_data_t *)lock_h;
-       evas_object_del(lock_screen_handle->layout);
-       evas_object_del(lock_screen_handle->hit_rect);
-       DELETE_ECORE_TIMER(lock_screen_handle->no_lock_timer);
-       free(lock_screen_handle);
-
-       return;
-}
-
-static bool __callui_lock_screen_is_lockscreen_shown(void *lock_h)
-{
-       dbg("..");
-       CALLUI_RETURN_VALUE_IF_FAIL(lock_h, false);
-       lock_screen_data_t *lock_screen_handle = (lock_screen_data_t *)lock_h;
-       return lock_screen_handle->is_locked;
-}
-
-static void *__callui_lock_screen_create()
-{
-       lock_screen_data_t *lock_screen_handle = calloc(1, sizeof(lock_screen_data_t));
-       CALLUI_RETURN_NULL_IF_FAIL(lock_screen_handle);
-       bool ret = __callui_lock_screen_create_layout(lock_screen_handle);
-       if (!ret) {
-               free(lock_screen_handle);
-               return NULL;
-       }
-       __callui_lock_screen_stop(lock_screen_handle, true);
-       return lock_screen_handle;
-}
-
-static void __callui_lock_screen_start(void *lock_h)
-{
-       CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_screen_data_t *lock_screen_handle = (lock_screen_data_t *)lock_h;
-       __callui_lock_screen_show_layout(lock_screen_handle);
-       __callui_lock_screen_start_timer(lock_screen_handle);
-}
-
-static void __callui_lock_screen_stop(void *lock_h, bool force)
-{
-       CALLUI_RETURN_IF_FAIL(lock_h);
-       lock_screen_data_t *lock_screen_handle = (lock_screen_data_t *)lock_h;
-       __callui_lock_screen_hide_layout(lock_screen_handle);
-       __callui_lock_screen_stop_timer(lock_screen_handle);
-}
-
-static bool __callui_lock_screen_is_lcd_off(void *lock_h)
-{
-       return false;
-}
-
-void _callui_lock_screen_init(lock_data_t *lock_h)
-{
-       lock_h->create = __callui_lock_screen_create;
-       lock_h->start = __callui_lock_screen_start;
-       lock_h->stop = __callui_lock_screen_stop;
-       lock_h->is_started = __callui_lock_screen_is_lockscreen_shown;
-       lock_h->is_lcd_off = __callui_lock_screen_is_lcd_off;
-       lock_h->set_unlock_cb = __callui_lock_screen_set_callback_on_unlock;
-       lock_h->destroy = __callui_lock_screen_delete_layout;
-}
index 64ed06a..ecd4a69 100644 (file)
@@ -174,10 +174,10 @@ static callui_result_e __auto_change_view(callui_vm_h vm, callui_call_data_t *ca
                        memcpy(ad->end_call_data, call_data, sizeof(callui_call_data_t));
                        ad->end_call_sim_slot = sim_slot;
 
-                       if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
-                               _callui_lock_manager_set_callback_on_unlock(ad->lock_handle, _lock_manager_unlock_cb, ad);
+                       if (_callui_lock_manager_is_lcd_off(ad->lock_manager)) {
+                               _callui_lock_manager_set_callback_on_unlock(ad->lock_manager, _lock_manager_unlock_cb, ad);
                        } else {
-                               _callui_lock_manager_stop(ad->lock_handle);
+                               _callui_lock_manager_stop(ad->lock_manager);
                                res = __change_view(vm, CALLUI_VIEW_ENDCALL);
                        }
                } else {
index a4ca979..bd26b62 100755 (executable)
@@ -137,7 +137,7 @@ static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_bas
        callui_result_e res = __create_main_content(vd, parent);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
-       _callui_lock_manager_start(ad->lock_handle);
+       _callui_lock_manager_start(ad->lock_manager);
 
        return __update_displayed_data(vd);
 }
@@ -148,7 +148,7 @@ static callui_result_e _callui_view_multi_call_split_onupdate(call_view_data_bas
 
        callui_view_mc_split_h vd = (callui_view_mc_split_h)view_data;
 
-       _callui_lock_manager_start(vd->base_view.ad->lock_handle);
+       _callui_lock_manager_start(vd->base_view.ad->lock_manager);
 
        callui_result_e res = CALLUI_RESULT_FAIL;
        if (vd->base_view.update_flags & CALLUI_UF_DATA_REFRESH) {
index 7bb14bf..bffa7b2 100755 (executable)
@@ -33,6 +33,8 @@
 
 #define CALLUI_ON_HOLD_CALL_COUNT      1
 
+static callui_app_data_t *_g_ad = NULL;
+
 typedef enum {
        CALLUI_QP_BTN_CALL = 0,
        CALLUI_QP_BTN_RESUME,
@@ -281,7 +283,7 @@ static void __main_layout_mouse_up_cb(void *data, Evas *evas, Evas_Object *obj,
                err("app_control_send_launch_request() is failed. ret[%d]", ret);
        } else {
                callui_app_data_t *ad = qp->ad;
-               _callui_lock_manager_start(ad->lock_handle);
+               _callui_lock_manager_start(ad->lock_manager);
                __hide_minicontrol(qp);
        }
        if (app_control) {
@@ -516,7 +518,7 @@ static void __minicontrol_provider_cb(minicontrol_viewer_event_e event_type, bun
                bundle_get_str(event_arg, "angle", &angle);
        }
 
-       callui_app_data_t *ad = _callui_get_app_data();
+       callui_app_data_t *ad = _g_ad;
        CALLUI_RETURN_IF_FAIL(ad);
 
        callui_qp_mc_h qp = ad->qp_minicontrol;
@@ -558,6 +560,8 @@ static callui_result_e __activate(callui_qp_mc_h qp)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(qp, CALLUI_RESULT_INVALID_PARAM);
 
+       _g_ad = qp->ad;
+
        if (!qp->win_quickpanel) {
                qp->win_quickpanel = __create_window(qp->ad);
                if (qp->win_quickpanel == NULL) {
index 0cda6b2..a4b5503 100644 (file)
@@ -74,7 +74,7 @@ static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t
        callui_result_e res = __create_main_content(vd, parent);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
-       _callui_lock_manager_start(ad->lock_handle);
+       _callui_lock_manager_start(ad->lock_manager);
 
        return __update_displayed_data(vd);
 }
index 75ea953..455c2b2 100755 (executable)
@@ -40,6 +40,8 @@
 #define CALLUI_APP_STATE_TIMEOUT_SEC                           0.3
 #define CALLUI_POWERKEY_PRESS_TIME_LIMIT_SEC           0.1
 
+static callui_app_data_t _g_ad;
+
 int g_callui_sig_to_handle[] = {SIGILL, SIGABRT, SIGFPE, SIGSEGV};
 #define APP_SIG_COUNT ((int)(sizeof(g_callui_sig_to_handle) / sizeof(g_callui_sig_to_handle[0])))
 
@@ -82,8 +84,6 @@ static void __process_home_key_up(callui_app_data_t *ad);
 static void __init_signals_handling();
 static void __app_signal_handler(int signum, siginfo_t *info, void *context);
 
-static callui_app_data_t g_ad;
-
 static void __set_main_power_key_grab(callui_app_data_t *ad)
 {
        callui_result_e res = CALLUI_RESULT_FAIL;
@@ -199,10 +199,10 @@ static void __audio_state_changed_cb(void *user_data, callui_audio_state_type_e
                case CALLUI_AUDIO_STATE_SPEAKER:
                case CALLUI_AUDIO_STATE_EARJACK:
                case CALLUI_AUDIO_STATE_BT:
-                       _callui_lock_manager_force_stop(ad->lock_handle);
+                       _callui_lock_manager_force_stop(ad->lock_manager);
                        break;
                case CALLUI_AUDIO_STATE_RECEIVER:
-                       _callui_lock_manager_start(ad->lock_handle);
+                       _callui_lock_manager_start(ad->lock_manager);
                        break;
                default:
                        break;
@@ -223,7 +223,7 @@ static void __call_state_change_cb(void *user_data,
 
        switch (call_event_type) {
        case CALLUI_CALL_EVENT_ACTIVE:
-               if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
+               if (_callui_lock_manager_is_lcd_off(ad->lock_manager)) {
                        _callui_display_set_control_state(ad->display, CALLUI_DISPLAY_CONTROL_UNLOCK);
                } else {
                        _callui_display_set_control_state(ad->display, CALLUI_DISPLAY_CONTROL_ON_UNLOCK);
@@ -236,7 +236,7 @@ static void __call_state_change_cb(void *user_data,
 #endif
                break;
        case CALLUI_CALL_EVENT_END:
-               if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
+               if (_callui_lock_manager_is_lcd_off(ad->lock_manager)) {
                        _callui_display_set_control_state(ad->display, CALLUI_DISPLAY_CONTROL_UNLOCK);
                } else {
                        _callui_display_set_control_state(ad->display, CALLUI_DISPLAY_CONTROL_ON_UNLOCK);
@@ -435,8 +435,8 @@ static bool __app_init(callui_app_data_t *ad)
 
        _callui_display_add_display_state_change_cb(ad->display, __display_state_changed_cb, ad);
 
-       ad->lock_handle = _callui_lock_manager_create();
-       CALLUI_RETURN_VALUE_IF_FAIL(ad->lock_handle, false);
+       ad->lock_manager = _callui_lock_manager_create(ad);
+       CALLUI_RETURN_VALUE_IF_FAIL(ad->lock_manager, false);
 
        ad->indicator = _callui_indicator_create(ad);
        if (!ad->indicator) {
@@ -520,9 +520,9 @@ static void __app_deinit(callui_app_data_t *ad)
                ad->indicator = NULL;
        }
 
-       if (ad->lock_handle) {
-               _callui_lock_manager_destroy(ad->lock_handle);
-               ad->lock_handle = NULL;
+       if (ad->lock_manager) {
+               _callui_lock_manager_destroy(ad->lock_manager);
+               ad->lock_manager = NULL;
        }
 
        if (ad->display) {
@@ -593,8 +593,8 @@ static void __app_pause(void *data)
 
        ad->on_background = true;
 
-       if (_callui_lock_manager_is_started(ad->lock_handle)) {
-               _callui_lock_manager_stop(ad->lock_handle);
+       if (_callui_lock_manager_is_started(ad->lock_manager)) {
+               _callui_lock_manager_stop(ad->lock_manager);
                ad->start_lock_manager_on_resume = true;
        }
 
@@ -632,7 +632,7 @@ static void __app_resume(void *data)
                                        && type != CALLUI_VIEW_INCOMING_CALL
                                        && type != CALLUI_VIEW_INCOMING_CALL_NOTI)) {
                ad->start_lock_manager_on_resume = false;
-               _callui_lock_manager_start(ad->lock_handle);
+               _callui_lock_manager_start(ad->lock_manager);
        }
 
        dbg("******  RESUME END  ******");
@@ -734,7 +734,7 @@ static void __process_power_key_up(callui_app_data_t *ad)
 
        if (_callui_common_is_powerkey_ending_call_mode_on()) {
 
-               if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
+               if (_callui_lock_manager_is_lcd_off(ad->lock_manager)) {
                        dbg("Lock Manager LCD status [OFF]. Ignore Power key ending call mode");
                        return;
                }
@@ -813,7 +813,7 @@ static void __process_home_key_up(callui_app_data_t *ad)
                }
        } else if (view_type == CALLUI_VIEW_ENDCALL) {
                _callui_common_exit_app();
-       } else if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
+       } else if (_callui_lock_manager_is_lcd_off(ad->lock_manager)) {
                dbg("Lock Manager LCD status [OFF]. Return");
                return;
        } else {
@@ -893,15 +893,10 @@ static void __app_signal_handler(int signum, siginfo_t *info, void *context)
 {
        err("Received [%d] signal", signum);
 
-       _callui_indicator_force_deativate(g_ad.indicator);
+       _callui_indicator_force_deativate(_g_ad.indicator);
        raise(signum);
 }
 
-callui_app_data_t *_callui_get_app_data()
-{
-       return &g_ad;
-}
-
 CALLUI_EXPORT_API int main(int argc, char *argv[])
 {
        dbg("..");
@@ -913,9 +908,9 @@ CALLUI_EXPORT_API int main(int argc, char *argv[])
        event_callback.resume = __app_resume;
        event_callback.app_control = __app_service;
 
-       memset(&g_ad, 0x0, sizeof(callui_app_data_t));
+       memset(&_g_ad, 0x0, sizeof(callui_app_data_t));
 
-       int res = ui_app_main(argc, argv, &event_callback, &g_ad);
+       int res = ui_app_main(argc, argv, &event_callback, &_g_ad);
        if (res != APP_ERROR_NONE) {
                err("ui_app_main() is failed. res[%d]", res);
        }