From 589575e8064eb90e7c0f0461eb1a3f3184f293bb Mon Sep 17 00:00:00 2001 From: "jiseob.jang" Date: Mon, 6 Jul 2015 20:31:20 +0900 Subject: [PATCH] merge from tizen 2.4 Change-Id: I1cdaca47e2d7ec22b32cbcb584af263489e1452f Signed-off-by: jiseob.jang --- CMakeLists.txt | 3 +- NOTICE | 0 account-parser.pc.in | 2 +- packaging/account-parser.spec | 9 ++++-- src/account-dlog.h | 0 src/account.c | 65 ++++++++++++++++++++++++++----------------- 6 files changed, 49 insertions(+), 30 deletions(-) mode change 100755 => 100644 CMakeLists.txt mode change 100755 => 100644 NOTICE mode change 100755 => 100644 account-parser.pc.in mode change 100755 => 100644 src/account-dlog.h mode change 100755 => 100644 src/account.c diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100755 new mode 100644 index 57fc332..0e5fc00 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ PROJECT(account C) INCLUDE(FindPkgConfig) pkg_check_modules(account_pkgs REQUIRED dlog + capi-base-common libxml-2.0 pkgmgr-info glib-2.0 @@ -38,4 +39,4 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${account_pkgs_LDFLAGS} ) #CONFIGURE_FILE(account-parser.pc.in ${CMAKE_SOURCE_DIR}/account-parser.pc @ONLY) #INSTALL(FILES ${CMAKE_SOURCE_DIR}/account-parser.pc DESTINATION lib/pkgconfig) -INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "etc/package-manager/parserlib") +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${SYSCONFDIR}/package-manager/parserlib) diff --git a/NOTICE b/NOTICE old mode 100755 new mode 100644 diff --git a/account-parser.pc.in b/account-parser.pc.in old mode 100755 new mode 100644 index e44d772..82f4b18 --- a/account-parser.pc.in +++ b/account-parser.pc.in @@ -2,7 +2,7 @@ prefix=@PREFIX@ exec_prefix=/usr -libdir=/usr/etc/package-manager/parserlib +libdir=/etc/package-manager/parserlib includedir= Name: @PC_NAME@ diff --git a/packaging/account-parser.spec b/packaging/account-parser.spec index 74b7d78..4567b7e 100644 --- a/packaging/account-parser.spec +++ b/packaging/account-parser.spec @@ -7,6 +7,7 @@ License: Apache-2.0 Source0: %{name}-%{version}.tar.gz BuildRequires: cmake +BuildRequires: pkgconfig(capi-base-common) BuildRequires: pkgconfig(accounts-svc) BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(libxml-2.0) @@ -29,9 +30,9 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE" %endif MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'` %ifarch %{ix86} -CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_SECURE_LOG -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +CXXFLAGS="$CXXFLAGS -D_OSP_DEBUG_ -D_SECURE_LOG -D_OSP_X86_ -D_OSP_EMUL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSYSCONFDIR=%{_sysconfdir} %else -CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_SECURE_LOG -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} +CXXFLAGS="-O2 -g -pipe -Wall -fno-exceptions -Wformat -Wformat-security -Wl,--as-needed -fmessage-length=0 -march=armv7-a -mtune=cortex-a8 -mlittle-endian -mfpu=neon -mfloat-abi=softfp -D__SOFTFP__ -mthumb -Wa,-mimplicit-it=thumb -funwind-tables -D_OSP_DEBUG_ -D_SECURE_LOG -D_OSP_ARMEL_" cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER} -DSYSCONFDIR=%{_sysconfdir} %endif # Call make instruction with smp support @@ -42,6 +43,8 @@ rm -rf %{buildroot} mkdir -p %{buildroot}/usr/share/license cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2 %{buildroot}/usr/share/license/%{name} +mkdir -p %{buildroot}/lib + %make_install %post -p /sbin/ldconfig @@ -51,4 +54,4 @@ cp %{_builddir}/%{name}-%{version}/LICENSE.APLv2 %{buildroot}/usr/share/license %files %manifest account-parser.manifest /usr/share/license/%{name} -/usr/etc/package-manager/parserlib/libaccount.so* +%{_sysconfdir}/package-manager/parserlib/libaccount.so* diff --git a/src/account-dlog.h b/src/account-dlog.h old mode 100755 new mode 100644 diff --git a/src/account.c b/src/account.c old mode 100755 new mode 100644 index 4517c64..48487be --- a/src/account.c +++ b/src/account.c @@ -40,6 +40,7 @@ static const xmlChar _NODE_CAPABILITY[] = "capability"; static const xmlChar _ATTRIBUTE_APP_ID[] = "appid"; static const xmlChar _ATTRIBUTE_MULTIPLE_ACCOUNTS_SUPPORT[] = "multiple-accounts-support"; +static const xmlChar _ATTRIBUTE_SERVICE_PROVIDER_ID[] = "providerid"; static const xmlChar _ATTRIBUTE_SECTION[] = "section"; static const xmlChar _ATTRIBUTE_TYPE[] = "type"; static const xmlChar _ATTRIBUTE_XML_LANG[] = "xml:lang"; @@ -129,12 +130,26 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Attribute: appid - %s", attribute_app_id); - ret = account_type_set_app_id_internal(account_type_handle, (char*)attribute_app_id); + ret = account_type_set_app_id(account_type_handle, (char*)attribute_app_id); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the app ID."); goto CATCH; } + // Attribute: providerid + xmlChar* attribute_provider_id = xmlGetProp(cur_ptr, _ATTRIBUTE_SERVICE_PROVIDER_ID); + if(attribute_provider_id != NULL) { + ret = -1; + _E("Failed to get the attribute(providerid)."); + + _SECURE_D("Attribute: appid - %s", attribute_provider_id); + + ret = account_type_set_service_provider_id(account_type_handle, (char*)attribute_provider_id); + if(ret != ACCOUNT_ERROR_NONE) { + _E("Failed to set the service provider id."); + } + } + // Attribute: multiple-accounts-support xmlChar* multiple_accounts_support = xmlGetProp(cur_ptr, _ATTRIBUTE_MULTIPLE_ACCOUNTS_SUPPORT); if(multiple_accounts_support == NULL) { @@ -146,13 +161,13 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Attribute: multiple-accounts-support - %s", multiple_accounts_support); if((!xmlStrcmp(multiple_accounts_support, _VALUE_TRUE))) { - ret = account_type_set_multiple_account_support_internal(account_type_handle, true); + ret = account_type_set_multiple_account_support(account_type_handle, true); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the multiple accounts support."); goto CATCH; } } else { - ret = account_type_set_multiple_account_support_internal(account_type_handle, false); + ret = account_type_set_multiple_account_support(account_type_handle, false); if (ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the multiple accounts support."); @@ -194,15 +209,15 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Node: icon - %s", account_icon); - if (!strncmp(account_icon, "/usr/share/icons", 16)) { - ret = account_type_set_icon_path_internal(account_type_handle, (char*)account_icon); + if (!strncmp((const char*)account_icon, "/usr/share/icons", 16)) { + ret = account_type_set_icon_path(account_type_handle, (char*)account_icon); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the icon path."); goto CATCH; } } else { - if (!strcmp(attribute_app_id, "com.samsung.samsungaccount")) { - char *icon_path = g_strdup_printf("%s%s", "/usr/apps/com.samsung.samsungaccount/shared/res/", (char*)account_icon); + if (!strcmp((const char*)attribute_app_id, "com.samsung.samsungaccount")) { + char *icon_path = g_strdup_printf("%s%s", "/usr/apps/com.samsung.samsungaccount/shared/res/", (const char*)account_icon); if(icon_path == NULL) { _E("icon_path is NULL."); free(resource_path); @@ -210,14 +225,14 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) } _D("icon_path[%s]", icon_path); - ret = account_type_set_icon_path_internal(account_type_handle, icon_path); + ret = account_type_set_icon_path(account_type_handle, icon_path); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the icon path."); g_free(icon_path); goto CATCH; } g_free(icon_path); - } else if (!strcmp(attribute_app_id, "com.samsung.tizenaccount")) { + } else if (!strcmp((const char*)attribute_app_id, "com.samsung.tizenaccount")) { char *icon_path = g_strdup_printf("%s%s", "/usr/apps/com.samsung.tizenaccount/shared/res/", (char*)account_icon); if(icon_path == NULL) { _E("icon_path is NULL."); @@ -226,7 +241,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) } _D("icon_path[%s]", icon_path); - ret = account_type_set_icon_path_internal(account_type_handle, icon_path); + ret = account_type_set_icon_path(account_type_handle, icon_path); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the icon path."); g_free(icon_path); @@ -236,7 +251,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) } else { ret = app_manager_get_shared_resource_path((char*)attribute_app_id, &resource_path); if(ret != APP_MANAGER_ERROR_NONE) { - _E("Failed to get the shared resource path."); + _E("Failed to get the shared resource path. app_manager ret=[%d]", ret); goto CATCH; } @@ -250,7 +265,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) free(resource_path); _D("icon_path[%s]", icon_path); - ret = account_type_set_icon_path_internal(account_type_handle, icon_path); + ret = account_type_set_icon_path(account_type_handle, icon_path); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the icon path."); g_free(icon_path); @@ -269,14 +284,14 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Node: icon (small) - %s", account_small_icon); - if (!strncmp(account_small_icon, "/usr/share/icons", 16) || !strcmp(account_small_icon, "/usr/apps/com.samsung.tizenaccount/shared/res/TizenAccount.png")) { - ret = account_type_set_small_icon_path_internal(account_type_handle, (char*)account_small_icon); + if (!strncmp((const char*)account_small_icon, "/usr/share/icons", 16) || !strcmp((const char*)account_small_icon, "/usr/apps/com.samsung.tizenaccount/shared/res/TizenAccount.png")) { + ret = account_type_set_small_icon_path(account_type_handle, (char*)account_small_icon); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the small icon path."); goto CATCH; } } else { - if (!strcmp(attribute_app_id, "com.samsung.samsungaccount")) { + if (!strcmp((const char*)attribute_app_id, "com.samsung.samsungaccount")) { char *small_icon_path = g_strdup_printf("%s%s", "/usr/apps/com.samsung.samsungaccount/shared/res/", (char*)account_small_icon); if(small_icon_path == NULL) { _E("small_icon_path is NULL."); @@ -285,7 +300,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) } _D("small_icon_path[%s]", small_icon_path); - ret = account_type_set_small_icon_path_internal(account_type_handle, (char*)small_icon_path); + ret = account_type_set_small_icon_path(account_type_handle, (char*)small_icon_path); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the small icon path."); g_free(small_icon_path); @@ -309,7 +324,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) free(resource_path); _D("small_icon_path[%s]", small_icon_path); - ret = account_type_set_small_icon_path_internal(account_type_handle, (char*)small_icon_path); + ret = account_type_set_small_icon_path(account_type_handle, (char*)small_icon_path); if(ret != ACCOUNT_ERROR_NONE) { _E("Failed to set the small icon path."); g_free(small_icon_path); @@ -371,7 +386,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Node: label - %s", xml_label); - ret = account_type_set_label_internal(account_type_handle, (char*)xml_label, converted_lang); + ret = account_type_set_label(account_type_handle, (char*)xml_label, converted_lang); if(ret != ACCOUNT_ERROR_NONE) { g_free(converted_lang); _E("[%d]Failed to set the display name.", ret); @@ -389,7 +404,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Node: label - %s", xml_label); - ret = account_type_set_label_internal(account_type_handle, (char*)xml_label, _DEFAULT_LOCALE); + ret = account_type_set_label(account_type_handle, (char*)xml_label, _DEFAULT_LOCALE); if(ret != ACCOUNT_ERROR_NONE) { _E("[%d]Failed to set the display name.", ret); goto CATCH; @@ -409,7 +424,7 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) _SECURE_D("Node: capability - %s", xml_capability); - ret = account_type_set_provider_feature_internal(account_type_handle, (char*)xml_capability); + ret = account_type_set_provider_feature(account_type_handle, (char*)xml_capability); if(ret != ACCOUNT_ERROR_NONE) { _E("[%d]Failed to set the capability.", ret); goto CATCH; @@ -428,9 +443,9 @@ int _register_account_provider(xmlDocPtr docPtr, char* account_provider_app_id) // Insert the account type to the account DB { int account_type_db_id = 0; - ret = account_type_insert_to_db_internal(account_type_handle, &account_type_db_id); + ret = account_type_insert_to_db_offline(account_type_handle, &account_type_db_id); if(ret != ACCOUNT_ERROR_NONE) { - _E("[%d]Failed to perform account_type_insert_to_db_internal().", ret); + _E("[%d]Failed to perform account_type_insert_to_db().", ret); goto CATCH; } } @@ -479,9 +494,9 @@ int _unregister_account_provider(pkgmgrinfo_appinfo_h package_info_handle, void* goto CATCH; } - ret = account_type_delete_by_app_id_internal((char*)app_id); + ret = account_type_delete_by_app_id_offline((char*)app_id); if(ret != ACCOUNT_ERROR_NONE) { - _E("Failed to perform account_type_delete_by_app_id_internal()."); + _E("Failed to perform account_type_delete_by_app_id()."); goto CATCH; } @@ -509,7 +524,7 @@ int _on_package_app_list_received_cb(pkgmgrinfo_appinfo_h handle, void *user_dat int ret = account_connect(); retvm_if(ret != ACCOUNT_ERROR_NONE, ret, "[%d]Failed to account_connect().", ret); - ret = account_type_delete_by_app_id_internal((char*)app_id); + ret = account_type_delete_by_app_id_offline((char*)app_id); if(ret == ACCOUNT_ERROR_NONE) { _D("PKGMGR_PARSER_PLUGIN_PRE_UPGRADE: app ID - %s", app_id); strncpy(__old_account_provider_app_id, app_id, 128); -- 2.7.4