fix for no AppId 54/140154/2 accepted/tizen/unified/20170726.012959 submit/tizen/20170725.110646
authorjomui <jongmun.woo@samsung.com>
Mon, 24 Jul 2017 04:54:43 +0000 (13:54 +0900)
committerjomui <jongmun.woo@samsung.com>
Mon, 24 Jul 2017 05:42:41 +0000 (14:42 +0900)
Signed-off-by: jomui <jongmun.woo@samsung.com>
Change-Id: I5edafd2e2e8a4f9d7c4d36eb24227c6f1a284801

geofence-server/CMakeLists.txt
geofence-server/src/geofence_server.c
module/module_geofence_server.c

index 6d66d70..9f3786d 100644 (file)
@@ -1,5 +1,5 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.0)
-PROJECT(geofence-server) 
+PROJECT(geofence-server)
 
 SET(server_pkgs_LDFLAGS "${server_pkgs_LDFLAGS} -ldl")
 SET(SERVER_EXTRA_CFLAGS "${SERVER_EXTRA_CFLAGS} -D_GNU_SOURCE")
index 2d17c64..2ecba0a 100644 (file)
@@ -412,7 +412,7 @@ static void __check_inout_by_gps(double latitude, double longitude, int fence_id
        geofence_fence_state_e status = GEOFENCE_FENCE_STATE_OUT;
        geocoordinate_info_s *geocoordinate_info = (geocoordinate_info_s *)item_data->priv;
        /* get_current_position/ check_fence_in/out  for geoPoint */
-       location_manager_get_distance(latitude, longitude, geocoordinate_info->latitude, geocoordinate_info->longitude, &distance);
+       location_manager_get_distance(latitude, longitude, geocoordinate_info->latitude, geocoordinate_info->longitude, &distance);
 
        if (distance >= geocoordinate_info->radius) {
                LOGD_GEOFENCE("FENCE_OUT : based on distance. Distance[%f] for fence id: %d at (%f, %f)", distance, fence_id, latitude, longitude);
@@ -2164,7 +2164,7 @@ static void dbus_start_geofence_cb(gint fence_id, const gchar *app_id, gpointer
                        } else if (adapter_state == BT_ADAPTER_ENABLED) {
                                bt_device_info_s *bt_device_info = NULL;
                                if (bt_info != NULL) {
-                                       ret = bt_adapter_get_bonded_device_info(bt_info->bssid, &bt_device_info);
+                                       ret = bt_adapter_get_bonded_device_info(bt_info->bssid, &bt_device_info);
                                        if (ret != BT_ERROR_NONE) {
                                                LOGE_GEOFENCE("Fail to get the bonded device info/ Not bonded with any device. Error[%d]", ret);
                                                /*NEED TO BE DECIDED WHETHER TO REQUEST FOR A SCAN HERE OR JUST EMIT OUT AS STATUS*/
@@ -2172,7 +2172,7 @@ static void dbus_start_geofence_cb(gint fence_id, const gchar *app_id, gpointer
                                                        status_to_be_emitted = GEOFENCE_FENCE_STATE_OUT;
                                        } else {
                                                if (bt_device_info == NULL) {
-                                                       LOGI_GEOFENCE("bt_adapter_get_bonded_device_info [%s] failed.", bt_info->bssid);
+                                                       LOGI_GEOFENCE("bt_adapter_get_bonded_device_info [%s] failed.", bt_info->bssid);
                                                        status_to_be_emitted = GEOFENCE_FENCE_STATE_OUT;
                                                } else {
                                                        if (bt_device_info->is_bonded == TRUE && bt_device_info->is_connected == TRUE) {
@@ -2468,18 +2468,18 @@ static GVariant *dbus_get_geofences_cb(int place_id, const gchar *app_id, int *f
                if ((place_info != NULL) && (place_info->access_type == ACCESS_TYPE_PRIVATE)) {
                        if (g_strcmp0(app_id, place_info->appid) != 0) {
                                LOGI_GEOFENCE("Not authorized to access this private place[%d]", place_id);
-                               g_free(place_info);
                                /* Send ZERO data gvariant*/
                                *errorCode = GEOFENCE_SERVER_ERROR_PLACE_ACCESS_DENIED;
                                *fenceCnt = fence_cnt;
                                g_variant_builder_init(&b, G_VARIANT_TYPE("aa{sv}"));
+                               g_free(place_info);
                                return g_variant_builder_end(&b);
                        }
-                       g_free(place_info);
                }
                ret = geofence_manager_get_fence_list_from_db(&count, &fence_list, place_id);
        }
        LOGI_GEOFENCE("count = %d", count);
+       g_free(place_info);
 
        if (ret != FENCE_ERR_NONE) {
                LOGI_GEOFENCE("get list failed");
index 0a1cc92..ff80d10 100644 (file)
@@ -491,7 +491,8 @@ static void __get_caller_app_id(void *handle)
        pid = getpid();
        ret = app_manager_get_app_id(pid, &app_id);
        if (ret != APP_MANAGER_ERROR_NONE) {
-               MOD_LOGE("Fail to get app_id from module_geofence_server. Err[%d]", ret);
+               MOD_LOGE("No app_id. Set app_id to RequestbyFramework");
+               geofence_manager->app_id = g_strdup("RequestbyFramework");
        } else {
                MOD_LOGD("app_id: %s", app_id);
                geofence_manager->app_id = app_id;