From: Young-Ae Kang Date: Tue, 13 Oct 2015 07:18:50 +0000 (+0900) Subject: Removed privacy_checker API because it is for API checking privacy. X-Git-Tag: submit/tizen/20151019.102917^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=efab35e8c35a5945fee7e9209411edd585419a30;p=platform%2Fcore%2Fapi%2Fmaps-service.git Removed privacy_checker API because it is for API checking privacy. Change-Id: Ie8f936a07acd1ea08207679b9c368b5485d8bf79 --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 6a19606..cd25cbe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,7 +16,7 @@ SET(INTERNAL_INC_DIR INCLUDE_DIRECTORIES(${INC_DIR} ${INTERNAL_INC_DIR}) #SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common security-privilege-checker") -SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common capi-appfw-app-manager capi-appfw-package-manager pkgmgr-info privacy-manager-client capi-system-info") +SET(dependents "glib-2.0 gmodule-2.0 dlog capi-base-common") SET(pc_dependents "capi-base-common") diff --git a/packaging/capi-maps-service.spec b/packaging/capi-maps-service.spec index a05ec0f..5acb390 100644 --- a/packaging/capi-maps-service.spec +++ b/packaging/capi-maps-service.spec @@ -13,11 +13,6 @@ BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(dlog) #BuildRequires: pkgconfig(security-privilege-checker) -BuildRequires: pkgconfig(capi-appfw-app-manager) -BuildRequires: pkgconfig(capi-appfw-package-manager) -BuildRequires: pkgconfig(pkgmgr-info) -BuildRequires: pkgconfig(privacy-manager-client) -BuildRequires: pkgconfig(capi-system-info) Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig diff --git a/src/api/maps_service.cpp b/src/api/maps_service.cpp index ad072e9..98bff4e 100755 --- a/src/api/maps_service.cpp +++ b/src/api/maps_service.cpp @@ -28,19 +28,6 @@ #ifdef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ #include -#else - #include - #include - #include - - #include - #include - #include - #include - - #define CAPP 1 - #define WEBAPP 2 - #define CPPAPP 3 #endif /*_SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */ @@ -80,167 +67,6 @@ static bool __maps_provider_supported(maps_service_h maps, return supported; } -#ifndef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ -static bool __is_privacy_initialized = false; - -static int __maps_service_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) { - MAPS_LOGE("Fail to get app_id. Err[%d]", ret); - return MAPS_ERROR_NONE; - } - } else { - app_id = g_strdup(target_app_id); - } - - ret = app_info_create(app_id, &app_info); - if (ret != APP_MANAGER_ERROR_NONE) { - MAPS_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) { - MAPS_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; -} - -static void __maps_service_privacy_initialize(void) -{ - int ret = 0; - pid_t pid = 0; - char *app_id = NULL; - char *package_id = NULL; - pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo; - - pid = getpid(); - ret = app_manager_get_app_id(pid, &app_id); - if (ret != APP_MANAGER_ERROR_NONE) { - MAPS_LOGE("Fail to get app_id. Err[%d]", ret); - return; - } - - ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo); - if (ret != PACKAGE_MANAGER_ERROR_NONE) { - MAPS_LOGE("Fail to get appinfo for [%s]. Err[%d]", app_id, ret); - g_free(app_id); - return; - } - ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id); - if (ret != PACKAGE_MANAGER_ERROR_NONE) { - MAPS_LOGE("Fail to get package_id for [%s]. Err[%d]", - app_id, ret); - pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); - g_free(app_id); - return; - } - - ret = privacy_checker_initialize(package_id); - if (ret != PRIV_MGR_ERROR_SUCCESS) { - MAPS_LOGE("Fail to initialize privacy checker. err[%d]", ret); - pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); - g_free(app_id); - return; - } - - MAPS_LOGD("Success to initialize privacy checker"); - - g_free(app_id); - pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); -} - -static void __maps_service_privacy_finalize(void) -{ - int ret = 0; - ret = privacy_checker_finalize(); - if (ret != PRIV_MGR_ERROR_SUCCESS) { - MAPS_LOGE("Fail to finalize privacy_cehecker. Err[%d]", ret); - return; - } - - MAPS_LOGD("Success to finalize privacy checker"); -} - -static int __maps_service_get_privacy(const char *privilege) -{ - int ret = 0; - pid_t pid = 0; - char *app_id = NULL; - char *package_id = NULL; - int app_type = 0; - pkgmgrinfo_appinfo_h pkgmgrinfo_appinfo; - - pid = getpid(); - ret = app_manager_get_app_id(pid, &app_id); - if (ret != APP_MANAGER_ERROR_NONE) { - MAPS_LOGE("Fail to get app_id. Err[%d]", ret); - return MAPS_ERROR_NONE; - } - - app_type = __maps_service_get_app_type(app_id); - if (app_type == CPPAPP) { - MAPS_LOGE("CPPAPP use location"); - g_free(app_id); - return MAPS_ERROR_NONE; - } - - ret = pkgmgrinfo_appinfo_get_appinfo(app_id, &pkgmgrinfo_appinfo); - if (ret != PACKAGE_MANAGER_ERROR_NONE) { - MAPS_LOGE("Fail to get appinfo of [%s]. Err[%d]", app_id, ret); - g_free(app_id); - return MAPS_ERROR_PERMISSION_DENIED; - } - - ret = pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo, &package_id); - if (ret != PACKAGE_MANAGER_ERROR_NONE) { - MAPS_LOGE("Fail to get package_id of [%s]. Err[%d]", - app_id, ret); - g_free(app_id); - pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); - return MAPS_ERROR_PERMISSION_DENIED; - } - - ret = privacy_checker_check_package_by_privilege(package_id, privilege); - if (ret != PRIV_MGR_ERROR_SUCCESS) { - MAPS_LOGE("Fail to get privilege of [%s] package. Err[%d]", - package_id, ret); - pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); - g_free(app_id); - return MAPS_ERROR_PERMISSION_DENIED; - } - - pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo); - g_free(app_id); - - return MAPS_ERROR_NONE; -} -#endif /* _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */ static bool __has_maps_service_privilege() { @@ -249,13 +75,7 @@ static bool __has_maps_service_privilege() "http://tizen.org/privilege/mapservice") == PRIVILEGE_CHECKER_ERR_NONE); #else - if(!__is_privacy_initialized) { - __maps_service_privacy_initialize(); - __is_privacy_initialized = true; - } - return (__maps_service_get_privacy( - "http://tizen.org/privilege/mapservice") - == MAPS_ERROR_NONE); + return true; #endif /* _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */ } @@ -303,6 +123,7 @@ EXPORT_API int maps_service_create(const char *maps_provider, do { /* 0. Find the plugin, requested by the user */ + const plugin::provider_info info = plugin::find_by_names(string(maps_provider)); @@ -333,6 +154,7 @@ EXPORT_API int maps_service_create(const char *maps_provider, } maps_service->plugin = plugin_h; + MAPS_LOGD("maps_service->plugin:(0x%08x)", maps_service->plugin); /* 4. Initialize an output pointer to maps service */ *maps = maps_service; @@ -360,16 +182,13 @@ EXPORT_API int maps_service_destroy(maps_service_h maps) maps_service_s *maps_service = (maps_service_s *) maps; - if (maps_service->plugin) + if (maps_service->plugin) { + MAPS_LOGD("maps_service->plugin:(0x%08x)", maps_service->plugin); plugin::binary_extractor().shutdown(maps_service->plugin); + } g_slice_free(maps_service_s, maps); - -#ifndef _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ - __maps_service_privacy_finalize(); -#endif /* _SIMPLE_PRIVILEGE_CHECK_AVAILABLE_ */ - return MAPS_ERROR_NONE; } diff --git a/src/maps_util.h b/src/maps_util.h old mode 100644 new mode 100755 diff --git a/src/plugin/discovery.cpp b/src/plugin/discovery.cpp index 9adbb2a..f7ab30e 100755 --- a/src/plugin/discovery.cpp +++ b/src/plugin/discovery.cpp @@ -137,4 +137,4 @@ plugin::provider_info plugin::find_by_names(const string &provider) return v[i]; return provider_info::empty_instance; -} \ No newline at end of file +} diff --git a/src/plugin/module.cpp b/src/plugin/module.cpp index 160ea49..9626cfb 100755 --- a/src/plugin/module.cpp +++ b/src/plugin/module.cpp @@ -85,7 +85,6 @@ maps_plugin_h plugin::binary_extractor::init(const provider_info &info) GMod *plugin = gmod_new(info.file, TRUE); if (!plugin) { MAPS_LOGE("Open Module Failed: %s", info.file.c_str()); - gmod_free(plugin); return NULL; } diff --git a/src/session/thread.cpp b/src/session/thread.cpp old mode 100644 new mode 100755