Sync with 2.4 04/47804/1 tizen_3.0.m1_mobile accepted/tizen/mobile/20150909.141028 submit/tizen_mobile/20150909.102031 tizen_3.0.m1_mobile_release
authorkj7.sung <kj7.sung@samsung.com>
Wed, 9 Sep 2015 04:28:39 +0000 (13:28 +0900)
committerkj7.sung <kj7.sung@samsung.com>
Wed, 9 Sep 2015 04:28:39 +0000 (13:28 +0900)
Change-Id: I336e4f2937e80ecd3d20c2b2b9f9c63a6d4c156b
Signed-off-by: kj7.sung <kj7.sung@samsung.com>
15 files changed:
CMakeLists.txt
location/CMakeLists.txt
location/manager/location-boundary.c
location/manager/location-common-util.c
location/manager/location-common-util.h
location/manager/location-gps.c
location/manager/location-hybrid-mobile.c
location/manager/location-privacy.c
location/manager/location-privacy.h
location/manager/location-setting.c
location/manager/location-setting.h
location/manager/location-signaling-util.c
location/manager/location-wps.c
location/manager/location.c
packaging/liblbs-location.spec

index 6781178..0860703 100755 (executable)
@@ -8,9 +8,26 @@ SET(EXEC_PREFIX "\${prefix}")
 
 # Set required packages
 INCLUDE(FindPkgConfig)
+
+IF(FEATURE_PROFILE_TV)
+        MESSAGE("<<< TV Profile >>>")
+        ADD_DEFINITIONS("-DTIZEN_PROFILE_TV")
+       SET(PRIVACY_PKG "")
+ELSE(FEATURE_PROFILE_TV)
+       SET(PRIVACY_PKG "privacy-manager-client")
+
+       IF(FEATURE_PROFILE_WEARABLE)
+               MESSAGE("<<< Wearable Profile >>>")
+       ELSE(FEATURE_PROFILE_WEARABLE)
+               MESSAGE("<<< Mobile Profile >>>")
+               #This is for OSP deamon. We don't need it any more.
+               #ADD_DEFINITIONS("-DTIZEN_PROFILE_MOBILE")
+       ENDIF(FEATURE_PROFILE_WEARABLE)
+ENDIF(FEATURE_PROFILE_TV)
+
 pkg_check_modules(pkgs REQUIRED glib-2.0 gthread-2.0 gobject-2.0 gmodule-2.0
                capi-appfw-app-manager capi-appfw-package-manager pkgmgr-info
-               privacy-manager-client dlog vconf json-glib-1.0 lbs-dbus bundle eventsystem)
+               dlog vconf json-glib-1.0 bundle eventsystem ${PRIVACY_PKG})
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index 3010fe8..d0d6830 100644 (file)
@@ -6,6 +6,12 @@ SET(INC_DIR "include")
 SET(MANAGER_DIR "manager")
 SET(MODULE_DIR "module")
 
+IF(FEATURE_PROFILE_TV)
+       SET (PRIVACY_SRC "")
+ELSE(FEATURE_PROFILE_TV)
+       SET (PRIVACY_SRC "${MANAGER_DIR}/location-privacy.c")
+ENDIF(FEATURE_PROFILE_TV)
+
 IF(FEATURE_PROFILE_WEARABLE)
        MESSAGE("<<< Wearable Profile >>>")
 ELSE(FEATURE_PROFILE_WEARABLE)
@@ -37,7 +43,7 @@ SET(SRCS
        ${MANAGER_DIR}/location-common-util.c
        ${MANAGER_DIR}/location-gps.c
        ${MANAGER_DIR}/location-wps.c
-       ${MANAGER_DIR}/location-privacy.c
+       ${PRIVACY_SRC}
 
        ${MODULE_DIR}/module-internal.c
 )
index 7f4a163..6a94ea9 100644 (file)
@@ -237,7 +237,7 @@ location_boundary_if_inside(LocationBoundary *boundary,
                case LOCATION_BOUNDARY_POLYGON: {
 
                                double interval_x = 0.0, interval_y = 0.0;
-                               double x0, y0;
+                               double x0=0.0, y0=0.0;
                                gboolean edge_area;
                                int crossing_num = 0;
                                GList *position_list = boundary->polygon.position_list;
@@ -259,6 +259,8 @@ location_boundary_if_inside(LocationBoundary *boundary,
                                         * Case 2. longitude2 - longitude1 < -180               : interval_y = longitude2 - longitude1 + 360
                                         * Case 3. longitude2 - longitude1 > 180                : intreval_y = longitude2 - longitude1 - 360
                                         */
+
+                                       LOCATION_LOGD("edge_area = %d, interval_y = %lf, interval_x = %lf", edge_area,interval_y, interval_x);
                                        if (interval_y > 180) {
                                                interval_y = interval_y - 360;
                                                edge_area = TRUE;
index 0b533a2..e9496a2 100644 (file)
@@ -32,6 +32,7 @@
 #include "location-common-util.h"
 #include "location-setting.h"
 #include "location-log.h"
+#include <app_manager.h>
 
 
 int location_application_get_authority(void)
@@ -208,3 +209,52 @@ void free_boundary_list(gpointer data)
        location_boundary_free(priv->boundary);
        g_slice_free(LocationBoundaryPrivate, priv);
 }
+
+int location_get_app_type(char *target_app_id)
+{
+        int ret = 0;
+        pid_t pid = 0;
+        char *app_id = NULL;
+        app_info_h app_info;
+        char *type = NULL;
+
+        if (target_app_id == NULL) {
+                pid = getpid();
+                ret = app_manager_get_app_id(pid, &app_id);
+                if (ret != APP_MANAGER_ERROR_NONE) {
+                        LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
+                        return LOCATION_ERROR_NONE;
+                }
+        } else {
+                app_id = g_strdup(target_app_id);
+        }
+
+        ret = app_info_create(app_id, &app_info);
+        if (ret != APP_MANAGER_ERROR_NONE) {
+                LOCATION_LOGE("Fail to get app_info. Err[%d]", ret);
+                g_free(app_id);
+                return LOCATION_ERROR_NONE;
+        }
+
+        ret = app_info_get_type(app_info, &type);
+        if (ret != APP_MANAGER_ERROR_NONE) {
+                LOCATION_LOGE("Fail to get type. Err[%d]", ret);
+                g_free(app_id);
+                app_info_destroy(app_info);
+                return LOCATION_ERROR_NONE;
+        }
+
+        if (strcmp(type, "c++app") == 0) {
+                ret = CPPAPP;
+        } else if (strcmp(type, "webapp") == 0) {
+                ret = WEBAPP;
+        } else {
+                ret = CAPP;
+        }
+
+        g_free(type);
+        g_free(app_id);
+        app_info_destroy(app_info);
+
+        return ret;
+}
index 58adc7d..93308ff 100644 (file)
@@ -61,6 +61,9 @@ int set_prop_boundary(GList **prev_boundary_list, GList *new_boundary_list);
 int set_prop_removal_boundary(GList **prev_boundary_list, LocationBoundary *boundary);
 void free_boundary_list(gpointer data);
 
+int location_get_app_type(char *app_id);
+
+
 G_END_DECLS
 
 #endif
index 8b26c06..6f04bec 100755 (executable)
@@ -211,6 +211,8 @@ __reset_pos_data_from_priv(LocationGpsPrivate *priv)
        priv->vel_updated_timestamp = 0;
        priv->sat_updated_timestamp = 0;
        priv->loc_updated_timestamp = 0;
+
+       priv->signal_type = 0;
 }
 
 static gboolean
@@ -351,8 +353,6 @@ location_setting_search_cb(keynode_t *key, gpointer self)
        g_return_if_fail(self);
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
-       g_return_if_fail(priv->mod);
-       g_return_if_fail(priv->mod->handler);
 
        if (location_setting_get_key_val(key) == VCONFKEY_LOCATION_GPS_SEARCHING) {
                if (!priv->pos_searching_timer) priv->pos_searching_timer = g_timeout_add(priv->pos_interval * 1000, _position_timeout_cb, self);
@@ -404,7 +404,7 @@ location_setting_gps_cb(keynode_t *key,
 static int
 location_gps_start(LocationGps *self)
 {
-       LOCATION_LOGD("location_gps_start");
+       LOCATION_LOGD("ENTER >>>");
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
        g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
@@ -431,12 +431,14 @@ location_gps_start(LocationGps *self)
 
        if (priv->app_type != CPPAPP && priv->set_noti == FALSE) {
                location_setting_add_notify(VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb, self);
+
 #ifdef TIZEN_PROFILE_MOBILE
-               location_setting_add_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb, self);
+               location_state_add_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb, self);
 #endif
                priv->set_noti = TRUE;
        }
 
+       LOCATION_LOGD("EXIT <<<");
        return ret;
 }
 
@@ -472,7 +474,7 @@ location_gps_stop(LocationGps *self)
        if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
                location_setting_ignore_notify(VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
 #ifdef TIZEN_PROFILE_MOBILE
-               location_setting_ignore_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+               location_state_ignore_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
 #endif
                priv->set_noti = FALSE;
        }
@@ -550,16 +552,16 @@ location_gps_dispose(GObject *gobject)
 #ifdef TIZEN_PROFILE_MOBILE
        if (priv->pos_searching_timer) g_source_remove(priv->pos_searching_timer);
        if (priv->vel_searching_timer) g_source_remove(priv->vel_searching_timer);
-       if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
        priv->pos_searching_timer = 0;
        priv->vel_searching_timer = 0;
-       priv->loc_timeout = 0;
 #endif
+       if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
+       priv->loc_timeout = 0;
 
        if (priv->app_type != CPPAPP && priv->set_noti == TRUE) {
                location_setting_ignore_notify(VCONFKEY_LOCATION_ENABLED, location_setting_gps_cb);
 #ifdef TIZEN_PROFILE_MOBILE
-               location_setting_ignore_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
+               location_state_ignore_notify(VCONFKEY_LOCATION_GPS_STATE, location_setting_search_cb);
 #endif
                priv->set_noti = FALSE;
        }
@@ -636,13 +638,17 @@ location_gps_set_property(GObject *object,
                case PROP_POS_INTERVAL: {
                                guint interval = g_value_get_uint(value);
                                LOCATION_LOGD("Set prop>> PROP_POS_INTERVAL: %u", interval);
+                               /* We don't need to set interval when new one is same as the previous one */
+                               if (interval == priv->pos_interval) break;
+
                                if (interval > 0) {
                                        if (interval < LOCATION_UPDATE_INTERVAL_MAX)
                                                priv->pos_interval = interval;
                                        else
                                                priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
-                               } else
+                               } else {
                                        priv->pos_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+                               }
 
 #ifdef TIZEN_PROFILE_MOBILE
                                if (priv->pos_searching_timer) {
@@ -662,6 +668,8 @@ location_gps_set_property(GObject *object,
                case PROP_VEL_INTERVAL: {
                                guint interval = g_value_get_uint(value);
                                LOCATION_LOGD("Set prop>> PROP_VEL_INTERVAL: %u", interval);
+                               if (interval == priv->vel_interval) break;
+
                                if (interval > 0) {
                                        if (interval < LOCATION_UPDATE_INTERVAL_MAX)
                                                priv->vel_interval = interval;
@@ -854,11 +862,8 @@ location_gps_get_position(LocationGps *self,
 
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
-       g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
-
        if (__get_started(self) != TRUE) {
                LOCATION_LOGE("location is not started");
                return LOCATION_ERROR_NOT_AVAILABLE;
@@ -884,7 +889,6 @@ location_gps_get_position_ext(LocationGps *self,
 
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
        if (__get_started(self) != TRUE) {
@@ -952,9 +956,7 @@ location_gps_get_velocity(LocationGps *self,
 
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
-       g_return_val_if_fail(priv->mod->handler, LOCATION_ERROR_NOT_AVAILABLE);
 
        if (__get_started(self) != TRUE) {
                LOCATION_LOGE("location is not started");
@@ -1007,7 +1009,7 @@ static gboolean __single_location_timeout_cb(void *data)
        if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
        priv->loc_timeout = 0;
 
-       g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NOT_AVAILABLE, 0, pos, vel, acc);
+       g_signal_emit(self, signals[LOCATION_UPDATED], 0, LOCATION_ERROR_NOT_AVAILABLE, pos, vel, acc);
        location_gps_stop(self);
 
        return FALSE;
@@ -1030,7 +1032,7 @@ gps_single_location_cb(gboolean enabled,
        LocationGpsPrivate *priv = GET_PRIVATE(obj);
        g_return_if_fail(priv);
 
-       g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NONE, 0, pos, vel, acc);
+       g_signal_emit(self, signals[LOCATION_UPDATED], 0, LOCATION_ERROR_NONE, pos, vel, acc);
        if (priv->loc_timeout) {
                g_source_remove(priv->loc_timeout);
                priv->loc_timeout = 0;
@@ -1123,7 +1125,6 @@ location_gps_get_satellite(LocationGps *self,
 
        LocationGpsPrivate *priv = GET_PRIVATE(self);
        g_return_val_if_fail(priv, LOCATION_ERROR_NOT_AVAILABLE);
-       g_return_val_if_fail(priv->mod, LOCATION_ERROR_NOT_AVAILABLE);
        setting_retval_if_fail(VCONFKEY_LOCATION_ENABLED);
 
        if (__get_started(self) != TRUE) {
@@ -1204,10 +1205,10 @@ location_gps_init(LocationGps *self)
        priv->enabled = FALSE;
        priv->signal_type = 0;
 
-       priv->pos_interval = LOCATION_UPDATE_INTERVAL_NONE;
-       priv->vel_interval = LOCATION_UPDATE_INTERVAL_NONE;
-       priv->sat_interval = LOCATION_UPDATE_INTERVAL_NONE;
-       priv->loc_interval = LOCATION_UPDATE_INTERVAL_NONE;
+       priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       priv->sat_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       priv->loc_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
        priv->batch_interval = LOCATION_UPDATE_INTERVAL_NONE;
        priv->batch_period = LOCATION_BATCH_PERIOD_DEFAULT;
        priv->min_interval = LOCATION_UPDATE_INTERVAL_NONE;
@@ -1227,8 +1228,8 @@ location_gps_init(LocationGps *self)
 #ifdef TIZEN_PROFILE_MOBILE
        priv->pos_searching_timer = 0;
        priv->vel_searching_timer = 0;
-       priv->loc_timeout = 0;
 #endif
+       priv->loc_timeout = 0;
 
        priv->app_type = location_get_app_type(NULL);
        if (priv->app_type == 0) {
@@ -1283,7 +1284,6 @@ location_gps_class_init(LocationGpsClass *klass)
                                                G_TYPE_POINTER,
                                                G_TYPE_POINTER);
 
-#ifdef TIZEN_PROFILE_MOBILE
        signals[LOCATION_UPDATED] = g_signal_new("location-updated",
                                                 G_TYPE_FROM_CLASS(klass),
                                                 G_SIGNAL_RUN_FIRST |
@@ -1296,7 +1296,6 @@ location_gps_class_init(LocationGpsClass *klass)
                                                 G_TYPE_POINTER,
                                                 G_TYPE_POINTER,
                                                 G_TYPE_POINTER);
-#endif
 
        signals[BATCH_UPDATED] = g_signal_new("batch-updated",
                                              G_TYPE_FROM_CLASS(klass),
index 0c4c5d2..8e62ef0 100644 (file)
@@ -295,7 +295,7 @@ hybrid_location_updated(GObject *obj,
        LocationHybridPrivate *priv = GET_PRIVATE((LocationHybrid *)self);
        g_return_if_fail(priv);
 
-       g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NONE, 0, pos, vel, acc);
+       g_signal_emit(self, signals[LOCATION_UPDATED], 0, error, pos, vel, acc);
 }
 
 static void
@@ -465,23 +465,13 @@ location_hybrid_start(LocationHybrid *self)
        if (priv->gps) ret_gps = location_start(priv->gps);
        if (priv->wps) ret_wps = location_start(priv->wps);
 
-       if (ret_gps != LOCATION_ERROR_NONE) {
+       if ((ret_gps != LOCATION_ERROR_NONE) && (ret_wps != LOCATION_ERROR_NONE)) {
                LOCATION_LOGD("ret_gps = %d, ret_wps = %d", ret_gps, ret_wps);
-               if (ret_gps == LOCATION_ERROR_SECURITY_DENIED) {
+               if (ret_gps == LOCATION_ERROR_SECURITY_DENIED || ret_wps == LOCATION_ERROR_SECURITY_DENIED) {
                        return LOCATION_ERROR_SECURITY_DENIED;
-               } else if (ret_gps == LOCATION_ERROR_SETTING_OFF) {
+               } else if (ret_gps == LOCATION_ERROR_SETTING_OFF || ret_wps == LOCATION_ERROR_SETTING_OFF) {
                        return LOCATION_ERROR_SETTING_OFF;
-               } else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED) {
-                       return LOCATION_ERROR_NOT_ALLOWED;
-               } else {
-                       return LOCATION_ERROR_NOT_AVAILABLE;
-               }
-       } else if (ret_wps != LOCATION_ERROR_NONE) {
-               if (ret_wps == LOCATION_ERROR_SECURITY_DENIED) {
-                       return LOCATION_ERROR_SECURITY_DENIED;
-               } else if (ret_wps == LOCATION_ERROR_SETTING_OFF) {
-                       return LOCATION_ERROR_SETTING_OFF;
-               } else if (ret_wps == LOCATION_ERROR_NOT_ALLOWED) {
+               } else if (ret_gps == LOCATION_ERROR_NOT_ALLOWED || ret_wps == LOCATION_ERROR_NOT_ALLOWED) {
                        return LOCATION_ERROR_NOT_ALLOWED;
                } else {
                        return LOCATION_ERROR_NOT_AVAILABLE;
index 0fc56ae..625d9bb 100644 (file)
@@ -39,55 +39,7 @@ typedef struct _location_privilege_s {
        bool found;
 } location_privilege_s;
 
-int
-location_get_app_type(char *target_app_id)
-{
-       int ret = 0;
-       pid_t pid = 0;
-       char *app_id = NULL;
-       app_info_h app_info;
-       char *type = NULL;
-
-       if (target_app_id == NULL) {
-               pid = getpid();
-               ret = app_manager_get_app_id(pid, &app_id);
-               if (ret != APP_MANAGER_ERROR_NONE) {
-                       LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
-                       return LOCATION_ERROR_NONE;
-               }
-       } else {
-               app_id = g_strdup(target_app_id);
-       }
-
-       ret = app_info_create(app_id, &app_info);
-       if (ret != APP_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get app_id. Err[%d]", ret);
-               g_free(app_id);
-               return 0;
-       }
-
-       ret = app_info_get_type(app_info, &type);
-       if (ret != APP_MANAGER_ERROR_NONE) {
-               LOCATION_LOGE("Fail to get type. Err[%d]", ret);
-               g_free(app_id);
-               app_info_destroy(app_info);
-               return 0;
-       }
 
-       if (strcmp(type, "c++app") == 0) {
-               ret = CPPAPP;
-       } else if (strcmp(type, "webapp") == 0) {
-               ret = WEBAPP;
-       } else {
-               ret = CAPP;
-       }
-
-       g_free(type);
-       g_free(app_id);
-       app_info_destroy(app_info);
-
-       return ret;
-}
 
 void
 location_privacy_initialize(void)
index d32f6a5..8393d0a 100644 (file)
@@ -24,7 +24,6 @@
 
 void location_privacy_initialize(void);
 void location_privacy_finalize(void);
-int location_get_app_type(char *app_id);
 int location_get_privacy(const char *privilege_name);
 int location_check_privilege(const char *privilege_name);
 
index 1dba9d4..191ef10 100644 (file)
@@ -29,6 +29,8 @@
 #include "location-log.h"
 #include "location-setting.h"
 
+static unsigned int g_event_req_id;
+
 
 gint location_setting_get_key_val(keynode_t *key)
 {
@@ -37,7 +39,7 @@ gint location_setting_get_key_val(keynode_t *key)
        switch (vconf_keynode_get_type(key)) {
                case VCONF_TYPE_INT:
                        val = vconf_keynode_get_int(key);
-                       LOCATION_SECLOG("Setting changed [%s]:[%d]", vconf_keynode_get_name(key), val);
+                       LOCATION_SECLOG("changed [%s]:[%d]", vconf_keynode_get_name(key), val);
                        break;
                default:
                        LOCATION_LOGW("Unused type(%d)", vconf_keynode_get_type(key));
@@ -48,21 +50,20 @@ gint location_setting_get_key_val(keynode_t *key)
 
 gint location_setting_get_int(const gchar *path)
 {
-       g_return_val_if_fail(path, -1);
-       int val = -1;
+       g_return_val_if_fail(path, 0);
+       int val = 0;
        if (vconf_get_int(path, &val)) {
-               LOCATION_SECLOG("vconf_get_int: failed [%s]", path);
-       } else if (val == 0)
-               LOCATION_SECLOG("vconf_get_int: [%s]:[%d]", path, val);
+               LOCATION_SECLOG("failed [%s]", path);
+       }
        return val;
 }
 
 gboolean location_setting_get_bool(const gchar *path)
 {
-       g_return_val_if_fail(path, -1);
+       g_return_val_if_fail(path, FALSE);
        gboolean val = FALSE;
        if (vconf_get_bool(path, &val)) {
-               LOCATION_SECLOG("vconf_get_int: failed [%s]", path);
+               LOCATION_SECLOG("failed [%s]", path);
        }
        return val;
 }
@@ -73,22 +74,71 @@ gchar *location_setting_get_string(const gchar *path)
        return vconf_get_str(path);
 }
 
-static unsigned int event_req_id;
-
-static char *convert_event_from_key(const char *key)
+static char *__convert_event_from_vconf(const char *vconf)
 {
        char *event = NULL;
-       if (g_strcmp0(key, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
+       if (g_strcmp0(vconf, VCONFKEY_LOCATION_USE_MY_LOCATION) == 0) {
                event = g_strdup(SYS_EVENT_LOCATION_ENABLE_STATE);
-       } else if (g_strcmp0(key, VCONFKEY_LOCATION_ENABLED) == 0) {
+       } else if (g_strcmp0(vconf, VCONFKEY_LOCATION_ENABLED) == 0) {
                event = g_strdup(SYS_EVENT_GPS_ENABLE_STATE);
-       } else if (g_strcmp0(key, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
+       } else if (g_strcmp0(vconf, VCONFKEY_LOCATION_NETWORK_ENABLED) == 0) {
                event = g_strdup(SYS_EVENT_NPS_ENABLE_STATE);
        }
 
        return event;
 }
 
+static char *__convert_key_from_event(const char *event)
+{
+       char *key = NULL;
+       if (g_strcmp0(event, SYS_EVENT_LOCATION_ENABLE_STATE) == 0) {
+               key = g_strdup(EVT_KEY_LOCATION_ENABLE_STATE);
+       } else if (g_strcmp0(event, SYS_EVENT_GPS_ENABLE_STATE) == 0) {
+               key = g_strdup(EVT_KEY_GPS_ENABLE_STATE);
+       } else if (g_strcmp0(event, SYS_EVENT_NPS_ENABLE_STATE) == 0) {
+               key = g_strdup(EVT_KEY_NPS_ENABLE_STATE);
+       }
+       return key;
+}
+
+static char *__convert_event_value(const int val)
+{
+       char *value = NULL;
+       if (val == 1) {
+               value = g_strdup(EVT_VAL_GPS_ENABLED);
+       } else {
+               value = g_strdup(EVT_VAL_GPS_DISABLED);
+       }
+       return value;
+}
+
+gint location_setting_send_system_event(const char *path, const int val)
+{
+       g_return_val_if_fail(path, -1);
+
+       int ret = 0;
+       char *event = NULL;
+       char *key = NULL;
+       char *value = NULL;
+       bundle *b = NULL;
+
+       event = __convert_event_from_vconf(path);
+       key = __convert_key_from_event(event);
+       value = __convert_event_value(val);
+
+       b = bundle_create();
+       bundle_add_str(b, key, value);
+       ret = eventsystem_request_sending_system_event(event, b);
+       bundle_free(b);
+
+       LOCATION_SECLOG("[%s: %s]", key, value);
+
+       g_free(event);
+       g_free(key);
+       g_free(value);
+       return ret;
+}
+
 static void __event_handler(const char *event_name, bundle *data, void *self)
 {
        const char *value = NULL;
@@ -101,7 +151,7 @@ static void __event_handler(const char *event_name, bundle *data, void *self)
                value = bundle_get_val(data, EVT_KEY_NPS_ENABLE_STATE);
        }
 
-       LOCATION_SECLOG("get event state [%s]", value);
+       LOCATION_SECLOG("[%s: %s]", event_name, value);
 }
 
 gint location_setting_add_notify(const gchar *path, SettingCB setting_cb, gpointer self)
@@ -110,10 +160,10 @@ gint location_setting_add_notify(const gchar *path, SettingCB setting_cb, gpoint
        g_return_val_if_fail(self, -1);
 
        const char *event_name = NULL;
-       event_name = convert_event_from_key(path);
+       event_name = __convert_event_from_vconf(path);
 
        if (eventsystem_register_event(event_name,
-                                      &event_req_id,
+                                      &g_event_req_id,
                                       (eventsystem_handler) __event_handler, NULL) != ES_R_OK) {
 
                LOCATION_SECLOG("eventsystem_register_event failed");
@@ -133,7 +183,7 @@ gint location_setting_ignore_notify(const gchar *path, SettingCB setting_cb)
        g_return_val_if_fail(path, -1);
        g_return_val_if_fail(setting_cb, -1);
 
-       if (eventsystem_unregister_event(event_req_id) != ES_R_OK) {
+       if (eventsystem_unregister_event(g_event_req_id) != ES_R_OK) {
                LOCATION_SECLOG("eventsystem_unregister_event failed");
                return -1;
        }
@@ -145,3 +195,29 @@ gint location_setting_ignore_notify(const gchar *path, SettingCB setting_cb)
        LOCATION_SECLOG("vconf notify removed [%s]", path);
        return 0;
 }
+
+gint location_state_add_notify(const gchar *path, SettingCB setting_cb, gpointer self)
+{
+       g_return_val_if_fail(path, -1);
+       g_return_val_if_fail(self, -1);
+
+       if (vconf_notify_key_changed(path, setting_cb, self)) {
+               LOCATION_SECLOG("vconf notify add failed [%s]", path);
+               return -1;
+       }
+       LOCATION_SECLOG("vconf notify added [%s]", path);
+       return 0;
+}
+
+gint location_state_ignore_notify(const gchar *path, SettingCB setting_cb)
+{
+       g_return_val_if_fail(path, -1);
+       g_return_val_if_fail(setting_cb, -1);
+
+       if (vconf_ignore_key_changed(path, setting_cb)) {
+               LOCATION_SECLOG("vconf notify remove failed [%s]", path);
+               return -1;
+       }
+       LOCATION_SECLOG("vconf notify removed [%s]", path);
+       return 0;
+}
index 376e9c3..20f29fb 100644 (file)
@@ -15,7 +15,7 @@
  * 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
+ * See the License for the specific language governing permissions and "1
  * limitations under the License.
  */
 
 
 typedef void (*SettingCB)(keynode_t *key, gpointer data);
 
+
+gint location_setting_send_system_event(const char *path, const int val);
 gint location_setting_get_key_val(keynode_t *key);
 gint location_setting_get_int(const gchar *path);
 gboolean location_setting_get_bool(const gchar *path);
 gchar *location_setting_get_string(const gchar *path);
 gint location_setting_add_notify(const gchar *path, SettingCB setting_cb, gpointer self);
 gint location_setting_ignore_notify(const gchar *path, SettingCB setting_cb);
+gint location_state_add_notify(const gchar *path, SettingCB setting_cb, gpointer self);
+gint location_state_ignore_notify(const gchar *path, SettingCB setting_cb);
+
 
 #define setting_retval_if_fail(path) {\
                int val = location_setting_get_int(path);\
index ffb5512..fa67b0e 100644 (file)
@@ -97,10 +97,6 @@ position_velocity_signaling(LocationObject *obj,
                }
        }
 
-       if ((pos_interval == 0) && (vel_interval == 0) && (loc_interval == 0)) {
-               signal_type |= POSITION_UPDATED;
-       }
-
        if (signal_type != 0) {
                g_signal_emit(obj, signals[SERVICE_UPDATED], 0, signal_type, pos, vel, acc);
        }
@@ -124,7 +120,6 @@ position_velocity_signaling(LocationObject *obj,
                        index++;
                }
        }
-
 }
 
 void
index b3c749f..4690d37 100644 (file)
@@ -71,6 +71,7 @@ enum {
     PROP_LAST_POSITION,
     PROP_POS_INTERVAL,
     PROP_VEL_INTERVAL,
+    PROP_LOC_INTERVAL,
     PROP_BOUNDARY,
     PROP_REMOVAL_BOUNDARY,
     PROP_MIN_INTERVAL,
@@ -394,6 +395,19 @@ location_wps_set_property(GObject *object,
                                }
                                break;
                        }
+               case PROP_LOC_INTERVAL: {
+                               guint interval = g_value_get_uint(value);
+                               LOCATION_LOGD("Set prop>> PROP_LOC_INTERVAL: %u", interval);
+                               if (interval > 0) {
+                                       if (interval < LOCATION_UPDATE_INTERVAL_MAX)
+                                               priv->loc_interval = interval;
+                                       else
+                                               priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_MAX;
+                               } else
+                                       priv->loc_interval = (guint)LOCATION_UPDATE_INTERVAL_DEFAULT;
+
+                               break;
+                       }
                case PROP_MIN_INTERVAL: {
                                guint interval = g_value_get_uint(value);
                                LOCATION_LOGD("Set prop>> update-min-interval: %u", interval);
@@ -454,6 +468,9 @@ location_wps_get_property(GObject *object,
                case PROP_VEL_INTERVAL:
                        g_value_set_uint(value, priv->vel_interval);
                        break;
+               case PROP_LOC_INTERVAL:
+                       g_value_set_uint(value, priv->loc_interval);
+                       break;
                case PROP_MIN_INTERVAL:
                        g_value_set_uint(value, priv->min_interval);
                        break;
@@ -627,12 +644,13 @@ static gboolean __single_location_timeout_cb(void *data)
        if (priv->loc_timeout) g_source_remove(priv->loc_timeout);
        priv->loc_timeout = 0;
 
-       g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NOT_AVAILABLE, 0, pos, vel, acc);
+       g_signal_emit(self, signals[LOCATION_UPDATED], 0, LOCATION_ERROR_NOT_AVAILABLE, pos, vel, acc);
        location_wps_stop(self);
 
        return FALSE;
 }
 
+
 static void
 wps_single_location_cb(gboolean enabled,
                        LocationPosition *pos,
@@ -649,7 +667,7 @@ wps_single_location_cb(gboolean enabled,
        LocationWpsPrivate *priv = GET_PRIVATE(self);
        g_return_if_fail(priv);
 
-       g_signal_emit(self, signals[LOCATION_UPDATED], LOCATION_ERROR_NONE, 0, pos, vel, acc);
+       g_signal_emit(self, signals[LOCATION_UPDATED], 0, LOCATION_ERROR_NONE, pos, vel, acc);
        if (priv->loc_timeout) {
                g_source_remove(priv->loc_timeout);
                priv->loc_timeout = 0;
@@ -753,10 +771,12 @@ location_wps_init(LocationWps *self)
 
        priv->pos_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
        priv->vel_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
-       priv->min_interval = 0;
+       priv->loc_interval = LOCATION_UPDATE_INTERVAL_DEFAULT;
+       priv->min_interval = LOCATION_UPDATE_INTERVAL_NONE;
 
        priv->pos_updated_timestamp = 0;
        priv->vel_updated_timestamp = 0;
+       priv->loc_updated_timestamp = 0;
 
        priv->pos = NULL;
        priv->vel = NULL;
@@ -811,9 +831,10 @@ location_wps_class_init(LocationWpsClass *klass)
                                                G_SIGNAL_NO_RECURSE,
                                                G_STRUCT_OFFSET(LocationWpsClass, updated),
                                                NULL, NULL,
-                                               location_VOID__UINT_POINTER_POINTER,
-                                               G_TYPE_NONE, 3,
-                                               G_TYPE_UINT,
+                                               location_VOID__INT_POINTER_POINTER_POINTER,
+                                               G_TYPE_NONE, 4,
+                                               G_TYPE_INT,
+                                               G_TYPE_POINTER,
                                                G_TYPE_POINTER,
                                                G_TYPE_POINTER);
 
@@ -890,6 +911,14 @@ location_wps_class_init(LocationWpsClass *klass)
                                                          LOCATION_UPDATE_INTERVAL_DEFAULT,
                                                          G_PARAM_READWRITE);
 
+       properties[PROP_LOC_INTERVAL] = g_param_spec_uint("loc-interval",
+                                                         "gps location interval prop",
+                                                         "gps location interval data",
+                                                         LOCATION_UPDATE_INTERVAL_MIN,
+                                                         LOCATION_UPDATE_INTERVAL_MAX,
+                                                         LOCATION_UPDATE_INTERVAL_DEFAULT,
+                                                         G_PARAM_READWRITE);
+
        properties[PROP_MIN_INTERVAL] = g_param_spec_uint("min-interval",
                                                          "wps distance-based interval prop",
                                                          "wps distance-based interval data",
index 896e896..b7b5918 100644 (file)
 #include "location-gps.h"
 #include "location-wps.h"
 #include "location-position.h"
-#include "location-privacy.h"
 #include "module-internal.h"
 #include "location-common-util.h"
+#ifndef TIZEN_PROFILE_TV
+#include "location-privacy.h"
+#endif
 
 #define LOCATION_PRIVILEGE     "http://tizen.org/privilege/location"
 #define LOCATION_ENABLE_PRIVILEGE      "http://tizen.org/privilege/location.enable"
@@ -98,7 +100,6 @@ static void __location_setting_cb(keynode_t *key, gpointer data)
        }
 }
 
-
 EXPORT_API
 int location_init(void)
 {
@@ -112,7 +113,9 @@ int location_init(void)
        if (FALSE == module_init())
                return LOCATION_ERROR_NOT_AVAILABLE;
 
+#ifndef TIZEN_PROFILE_TV
        location_privacy_initialize();
+#endif
 
        return LOCATION_ERROR_NONE;
 }
@@ -145,7 +148,10 @@ EXPORT_API int
 location_free(LocationObject *obj)
 {
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
+
+#ifndef TIZEN_PROFILE_TV
        location_privacy_finalize();
+#endif
        g_object_unref(obj);
        return LOCATION_ERROR_NONE;
 }
@@ -156,11 +162,14 @@ location_request_single_location(LocationObject *obj, int timeout)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_request_single_location(LOCATION_IELEMENT(obj), timeout);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to request single location. Error [%d]", ret);
@@ -174,11 +183,14 @@ location_start(LocationObject *obj)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_start(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to start. Error [%d]", ret);
@@ -191,11 +203,14 @@ location_stop(LocationObject *obj)
 {
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_stop(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to stop. Error [%d]", ret);
@@ -208,11 +223,14 @@ location_start_batch(LocationObject *obj)
 {
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_start_batch(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch start. Error [%d]", ret);
@@ -226,11 +244,13 @@ location_stop_batch(LocationObject *obj)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_stop_batch(LOCATION_IELEMENT(obj));
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to Batch stop. Error [%d]", ret);
@@ -276,11 +296,11 @@ location_is_enabled_method(LocationMethod method, int *is_enabled)
 
        vconf_ret = vconf_get_int(_key, &vconf_val);
        if (vconf_ret != VCONF_OK) {
-               LOCATION_SECLOG("vconf_get_int: failed [%s], error [%d]", _key, vconf_ret);
+               LOCATION_SECLOG("failed [%s], error [%d]", _key, vconf_ret);
                g_free(_key);
                return LOCATION_ERROR_NOT_AVAILABLE;
        } else {
-               LOCATION_SECLOG("vconf_get_int: [%s]:[%d]", _key, vconf_val);
+               LOCATION_SECLOG("[%s]:[%d]", _key, vconf_val);
        }
 
        *is_enabled = vconf_val;
@@ -293,59 +313,86 @@ EXPORT_API int
 location_enable_method(const LocationMethod method, const int enable)
 {
        int ret = 0;
-       int i = 0;
        char *_key = NULL;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_check_privilege(LOCATION_ENABLE_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
-       if (method == LOCATION_METHOD_HYBRID) {
-               for (i = LOCATION_METHOD_HYBRID; i < LOCATION_METHOD_MAX; i++) {
-                       _key = __convert_setting_key(i);
-                       if (!_key) {
-                               LOCATION_LOGE("Invalid method[%d]", method);
-                               return LOCATION_ERROR_NOT_SUPPORTED;
-                       }
-
-                       ret = vconf_set_int(_key, enable);
-                       if (ret != VCONF_OK) {
-                               LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
-                               return LOCATION_ERROR_NOT_ALLOWED;
-                       } else {
-                               LOCATION_SECLOG("vconf_set_int: [%s]:[%d]", _key, ret);
-                       }
-                       g_free(_key);
-               }
+       /* for itself */
+       _key = __convert_setting_key(method);
+       if (!_key) {
+               LOCATION_LOGE("Invalid method[%d]", method);
+               return LOCATION_ERROR_NOT_SUPPORTED;
+       }
+       ret = vconf_set_int(_key, enable);
+       if (ret != VCONF_OK) {
+               LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
+               g_free(_key);
+               return LOCATION_ERROR_NOT_ALLOWED;
        } else {
-               _key = __convert_setting_key(method);
-               if (!_key) {
-                       LOCATION_LOGE("Invalid method[%d]", method);
-                       return LOCATION_ERROR_NOT_SUPPORTED;
+               ret = location_setting_send_system_event(_key, enable);
+               if (ret != LOCATION_ERROR_NONE) {
+                       LOCATION_SECLOG("Fail to send system event [%s], ret=[%d]", _key, ret);
+                       g_free(_key);
+                       return LOCATION_ERROR_NOT_ALLOWED;
                }
+       }
+       g_free(_key);
+
+       /* for hybrid */
+       _key = __convert_setting_key(LOCATION_METHOD_HYBRID);
+       if (!_key) {
+               LOCATION_LOGE("Invalid method[%d]", LOCATION_METHOD_HYBRID);
+               return LOCATION_ERROR_NOT_SUPPORTED;
+       }
+
+       if (enable) {
                ret = vconf_set_int(_key, enable);
                if (ret != VCONF_OK) {
-                       LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
+                       LOCATION_SECLOG("vconf_set_int failed [%s], ret=[%d]", _key, ret);
+                       g_free(_key);
                        return LOCATION_ERROR_NOT_ALLOWED;
                } else {
-                       LOCATION_SECLOG("vconf_set_int: [%s]:[%d]", _key, ret);
+                       ret = location_setting_send_system_event(_key, enable);
+                       if (ret != LOCATION_ERROR_NONE) {
+                               LOCATION_SECLOG("Fail to send system event [%s], ret=[%d]", _key, ret);
+                               g_free(_key);
+                               return LOCATION_ERROR_NOT_ALLOWED;
+                       }
                }
-               g_free(_key);
+       }
+       else {
+               int i = 0;
+               int enabled_state = 0;
 
-               _key = __convert_setting_key(LOCATION_METHOD_HYBRID);
-               if (!_key) {
-                       LOCATION_LOGE("Invalid method[%d]", LOCATION_METHOD_HYBRID);
-                       return LOCATION_ERROR_NOT_SUPPORTED;
+               for (i = LOCATION_METHOD_GPS; i < LOCATION_METHOD_MAX; i++) {
+                       _key = __convert_setting_key(i);
+                       enabled_state |= location_setting_get_int(_key);
+                       g_free(_key);
                }
-               ret = vconf_set_int(_key, enable);
-               if (ret != VCONF_OK) {
-                       LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
-                       return LOCATION_ERROR_NOT_ALLOWED;
-               } else {
-                       LOCATION_SECLOG("vconf_set_int: [%s]:[%d]", _key, ret);
+               if (!enabled_state) {
+                       _key = __convert_setting_key(LOCATION_METHOD_HYBRID);
+                       ret = vconf_set_int(_key, enable);
+                       if (ret != VCONF_OK) {
+                               LOCATION_SECLOG("vconf_set_int failed [%s], error [%d]", _key, ret);
+                               g_free(_key);
+                               return LOCATION_ERROR_NOT_ALLOWED;
+                       } else {
+                               LOCATION_SECLOG("[%s]:[%d]", _key, ret);
+                               ret = location_setting_send_system_event(_key, enable);
+                               if (ret != LOCATION_ERROR_NONE) {
+                                       g_free(_key);
+                                       LOCATION_SECLOG("Fail to send system event [%s], error [%d]", _key, ret);
+                                       return LOCATION_ERROR_NOT_ALLOWED;
+                               }
+                       }
+                       g_free(_key);
                }
-               g_free(_key);
        }
 
        return ret;
@@ -400,11 +447,14 @@ location_get_position(LocationObject *obj,
        g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_position(LOCATION_IELEMENT(obj), position, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position. Error [%d]", ret);
@@ -424,11 +474,14 @@ location_get_position_ext(LocationObject *obj,
        g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_position_ext. Error [%d]", ret);
@@ -446,11 +499,14 @@ location_get_last_position(LocationObject *obj,
        g_return_val_if_fail(accuracy, LOCATION_ERROR_PARAMETER);
 
        int ret = LOCATION_ERROR_NONE;
+
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_last_position(LOCATION_IELEMENT(obj), position, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position. Error [%d]", ret);
@@ -471,11 +527,13 @@ location_get_last_position_ext(LocationObject *obj,
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_last_position_ext(LOCATION_IELEMENT(obj), position, velocity, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_position_ext. Error [%d]", ret);
@@ -491,11 +549,13 @@ location_get_nmea(LocationObject *obj, char **nmea)
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_nmea(LOCATION_IELEMENT(obj), nmea);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_nmea. Error [%d]", ret);
@@ -512,11 +572,13 @@ location_get_satellite(LocationObject *obj, LocationSatellite **satellite)
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_satellite(LOCATION_IELEMENT(obj), satellite);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_satellite. Error [%d]", ret);
@@ -532,11 +594,13 @@ location_get_batch(LocationObject *obj, LocationBatch **batch)
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_batch(LOCATION_IELEMENT(obj), batch);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_batch. Error [%d]", ret);
@@ -552,11 +616,13 @@ location_get_last_satellite(LocationObject *obj, LocationSatellite **satellite)
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_last_satellite(LOCATION_IELEMENT(obj), satellite);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_satellite. Error [%d]", ret);
@@ -575,11 +641,13 @@ location_get_velocity(LocationObject *obj,
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_velocity. Error [%d]", ret);
@@ -598,11 +666,13 @@ location_get_last_velocity(LocationObject *obj,
 
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_get_last_velocity(LOCATION_IELEMENT(obj), velocity, accuracy);
        if (ret != LOCATION_ERROR_NONE) LOCATION_LOGE("Fail to get_last_velocity. Error [%d]", ret);
@@ -668,11 +738,13 @@ location_set_option(LocationObject *obj, const char *option)
        g_return_val_if_fail(obj, LOCATION_ERROR_PARAMETER);
        int ret = LOCATION_ERROR_NONE;
 
+#ifndef TIZEN_PROFILE_TV
        ret = location_get_privacy(LOCATION_PRIVILEGE);
        if (ret != LOCATION_ERROR_NONE) {
                LOCATION_LOGE("Cannot use location service for privacy[%d]", ret);
                return LOCATION_ERROR_NOT_ALLOWED;
        }
+#endif
 
        ret = location_ielement_set_option(LOCATION_IELEMENT(obj), option);
        if (ret != LOCATION_ERROR_NONE)
index b7312c9..930b5a6 100755 (executable)
@@ -1,10 +1,10 @@
 Name: liblbs-location
-Summary:       Location Based Service Library
-Version:       0.12.0
-Release:       1
-Group:         Location/Libraries
-License:       Apache-2.0
-Source0:       %{name}-%{version}.tar.gz
+Summary: Location Based Service Library
+Version: 0.12.0
+Release: 1
+Group: Location/Libraries
+License: Apache-2.0
+Source0:  %{name}-%{version}.tar.gz
 Source1001: %{name}.manifest
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
@@ -16,7 +16,9 @@ BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(capi-appfw-package-manager)
 BuildRequires:  pkgconfig(pkgmgr-info)
+%if "%{profile}" != "tv"
 BuildRequires:  pkgconfig(privacy-manager-client)
+%endif
 BuildRequires:  pkgconfig(json-glib-1.0)
 BuildRequires:  pkgconfig(lbs-dbus)
 BuildRequires:  pkgconfig(bundle)
@@ -48,15 +50,17 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 
 # Call make instruction with smp support
 MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
-#cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
 cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DBUILD_PKGTYPE=rpm -DLIBDIR=%{_libdir} -DINCLUDEDIR=%{_includedir} \
 -DFULLVER=%{version} -DMAJORVER=${MAJORVER} \
 %if "%{profile}" == "wearable"
-       -DFEATURE_PROFILE_WEARABLE:BOOL=ON
-%else
-       -DFEATURE_PROFILE_WEARABLE:BOOL=OFF
+       -DFEATURE_PROFILE_WEARABLE:BOOL=ON \
+%endif
+%if "%{profile}" == "tv"
+       -DFEATURE_PROFILE_TV:BOOL=ON
 %endif
 
+
+
 make %{?jobs:-j%jobs}