_D("Registering the Account Provider.");
int ret = ACCOUNT_ERROR_NONE;
-
int ret2 = ACCOUNT_ERROR_NONE;
account_type_h account_type_handle = NULL;
ret = account_type_create(&account_type_handle);
- if(ret != ACCOUNT_ERROR_NONE || account_type_handle == NULL) {
+ if (ret != ACCOUNT_ERROR_NONE || account_type_handle == NULL) {
_E("[%d]Memory allocation failed.", ret);
return ret;
}
// Node: <account>
xmlNodePtr cur_ptr = xmlFirstElementChild(xmlDocGetRootElement(docPtr));
- if(cur_ptr == NULL) {
+ if (cur_ptr == NULL) {
ret = -1;
_E("Failed to get the element.");
goto CATCH;
// Get the children nodes
cur_ptr = cur_ptr->xmlChildrenNode;
- if(cur_ptr == NULL) {
+ if (cur_ptr == NULL) {
ret = -1;
_E("Failed to get the child element.");
goto CATCH;
}
- while(cur_ptr != NULL) {
+ while (cur_ptr != NULL) {
_SECURE_D("Node: %s", cur_ptr->name);
// Node: <account-provider>
- if((!xmlStrcmp(cur_ptr->name, _NODE_ACCOUNT_PROVIDER))) {
+ if ((!xmlStrcmp(cur_ptr->name, _NODE_ACCOUNT_PROVIDER))) {
// Attribute: appid
xmlChar* attribute_app_id = xmlGetProp(cur_ptr, _ATTRIBUTE_APP_ID);
- if(attribute_app_id == NULL) {
+ if (attribute_app_id == NULL) {
ret = -1;
_E("Failed to get the attribute.");
goto CATCH;
_SECURE_D("Attribute: appid - %s", attribute_app_id);
ret = account_type_set_app_id(account_type_handle, (char*)attribute_app_id);
- if(ret != ACCOUNT_ERROR_NONE) {
+ 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) {
+ 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) {
+ 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) {
+ if (multiple_accounts_support == NULL) {
ret = -1;
_E("Failed to get the attribute.");
goto CATCH;
_SECURE_D("Attribute: multiple-accounts-support - %s", multiple_accounts_support);
- if((!xmlStrcmp(multiple_accounts_support, _VALUE_TRUE))) {
+ if ((!xmlStrcmp(multiple_accounts_support, _VALUE_TRUE))) {
ret = account_type_set_multiple_account_support(account_type_handle, true);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the multiple accounts support.");
goto CATCH;
}
} else {
ret = account_type_set_multiple_account_support(account_type_handle, false);
- if (ret != ACCOUNT_ERROR_NONE)
- {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the multiple accounts support.");
goto CATCH;
}
// Get the children nodes
cur_ptr = cur_ptr->xmlChildrenNode;
- if(cur_ptr == NULL) {
+ if (cur_ptr == NULL) {
ret = -1;
_E("Failed to get the child element.");
goto CATCH;
}
- while(cur_ptr != NULL) {
+ while (cur_ptr != NULL) {
_SECURE_D("Node: %s", cur_ptr->name);
// Node: <icon>
- if((!xmlStrcmp(cur_ptr->name, _NODE_ICON))) {
+ if ((!xmlStrcmp(cur_ptr->name, _NODE_ICON))) {
// Attribute: section
xmlChar* section = xmlGetProp(cur_ptr, _ATTRIBUTE_SECTION);
- if(section == NULL) {
+ if (section == NULL) {
ret = -1;
_E("Failed to get the attribute.");
goto CATCH;
_SECURE_D("Attribute: section - %s", section);
char *resource_path = NULL;
- if((!xmlStrcmp(section, _VALUE_ACCOUNT))) {
+ if ((!xmlStrcmp(section, _VALUE_ACCOUNT))) {
xmlChar* account_icon = xmlNodeListGetString(docPtr, cur_ptr->xmlChildrenNode, 1);
- if(account_icon == NULL) {
+ if (account_icon == NULL) {
ret = -1;
_E("Failed to get the value.");
goto CATCH;
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) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the icon path.");
goto CATCH;
}
} else {
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) {
+ if (icon_path == NULL) {
_E("icon_path is NULL.");
free(resource_path);
goto CATCH;
_D("icon_path[%s]", icon_path);
ret = account_type_set_icon_path(account_type_handle, icon_path);
- if(ret != ACCOUNT_ERROR_NONE) {
+ 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((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) {
+ if (icon_path == NULL) {
_E("icon_path is NULL.");
free(resource_path);
goto CATCH;
_D("icon_path[%s]", icon_path);
ret = account_type_set_icon_path(account_type_handle, icon_path);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the icon path.");
g_free(icon_path);
goto CATCH;
}
ret = aul_get_usr_app_shared_resource_path_by_appid((char*)attribute_app_id, &resource_path, uid);
- if(ret != APP_MANAGER_ERROR_NONE) {
+ if (ret != APP_MANAGER_ERROR_NONE) {
_E("Failed to get the shared resource path. app_manager ret=[%d]", ret);
goto CATCH;
}
char *icon_path = g_strdup_printf("%s%s", resource_path, (char*)account_icon);
- if(icon_path == NULL) {
+ if (icon_path == NULL) {
_E("icon_path is NULL.");
free(resource_path);
goto CATCH;
_D("icon_path[%s]", icon_path);
ret = account_type_set_icon_path(account_type_handle, icon_path);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the icon path.");
g_free(icon_path);
goto CATCH;
g_free(icon_path);
}
}
- } else if((!xmlStrcmp(section, _VALUE_ACCOUNT_SMALL))) {
+ } else if ((!xmlStrcmp(section, _VALUE_ACCOUNT_SMALL))) {
xmlChar* account_small_icon = xmlNodeListGetString(docPtr, cur_ptr->xmlChildrenNode, 1);
- if(account_small_icon == NULL) {
+ if (account_small_icon == NULL) {
ret = -1;
_E("Failed to get the value.");
goto CATCH;
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) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the small icon path.");
goto CATCH;
}
} else {
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) {
+ if (small_icon_path == NULL) {
_E("small_icon_path is NULL.");
free(resource_path);
goto CATCH;
_D("small_icon_path[%s]", small_icon_path);
ret = account_type_set_small_icon_path(account_type_handle, (char*)small_icon_path);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the small icon path.");
g_free(small_icon_path);
goto CATCH;
}
ret = aul_get_usr_app_shared_resource_path_by_appid((char*)attribute_app_id, &resource_path, uid);
- if(ret != APP_MANAGER_ERROR_NONE) {
+ if (ret != APP_MANAGER_ERROR_NONE) {
_E("Failed to get the shared resource path.");
goto CATCH;
}
char *small_icon_path = g_strdup_printf("%s%s", resource_path, (char*)account_small_icon);
- if(small_icon_path == NULL) {
+ if (small_icon_path == NULL) {
_E("small_icon_path is NULL.");
free(resource_path);
goto CATCH;
_D("small_icon_path[%s]", small_icon_path);
ret = account_type_set_small_icon_path(account_type_handle, (char*)small_icon_path);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to set the small icon path.");
g_free(small_icon_path);
goto CATCH;
}
}
}
- } else if((!xmlStrcmp(cur_ptr->name, _NODE_LABEL))) {
+ } else if ((!xmlStrcmp(cur_ptr->name, _NODE_LABEL))) {
// Node: <label>
_SECURE_D("Node: %s", cur_ptr->name);
// Attribute: xml:lang
xmlChar* xml_lang = xmlNodeGetLang(cur_ptr);
- if(xml_lang != NULL) {
+ if (xml_lang != NULL) {
_SECURE_D("Attribute: xml:lang - %s", xml_lang);
char* lang = (char*)xml_lang;
char* converted_lang = NULL;
gchar** tokens = g_strsplit(lang, "-", 2);
- if(tokens == NULL) {
+ if (tokens == NULL) {
ret = -1;
_E("Failed to get token.");
goto CATCH;
}
char* upper_token = g_ascii_strup(tokens[1], strlen(tokens[1]));
- if(upper_token == NULL) {
+ if (upper_token == NULL) {
ret = -1;
g_strfreev(tokens);
_E("Failed to convert to upper case.");
converted_lang = g_strdup_printf("%s_%s", tokens[0], upper_token);
free(upper_token);
- if(converted_lang == NULL) {
+ if (converted_lang == NULL) {
ret = -1;
g_strfreev(tokens);
_E("Failed to convert to upper case.");
g_strfreev(tokens);
xmlChar* xml_label = xmlNodeListGetString(docPtr, cur_ptr->xmlChildrenNode, 1);
- if(xml_label == NULL) {
+ if (xml_label == NULL) {
ret = -1;
g_free(converted_lang);
_E("Failed to get the value.");
_SECURE_D("Node: label - %s", xml_label);
ret = account_type_set_label(account_type_handle, (char*)xml_label, converted_lang);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
g_free(converted_lang);
_E("[%d]Failed to set the display name.", ret);
goto CATCH;
g_free(converted_lang);
} else {
xmlChar* xml_label = xmlNodeListGetString(docPtr, cur_ptr->xmlChildrenNode, 1);
- if(xml_label == NULL) {
+ if (xml_label == NULL) {
ret = -1;
_E("Failed to get the value.");
goto CATCH;
_SECURE_D("Node: label - %s", xml_label);
ret = account_type_set_label(account_type_handle, (char*)xml_label, _DEFAULT_LOCALE);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("[%d]Failed to set the display name.", ret);
goto CATCH;
}
}
- } else if((!xmlStrcmp(cur_ptr->name, _NODE_CAPABILITY))) {
+ } else if ((!xmlStrcmp(cur_ptr->name, _NODE_CAPABILITY))) {
// Node: <capability>
_SECURE_D("Node: %s", cur_ptr->name);
xmlChar* xml_capability = xmlNodeListGetString(docPtr, cur_ptr->xmlChildrenNode, 1);
- if(xml_capability == NULL) {
+ if (xml_capability == NULL) {
ret = -1;
_E("Failed to get the value.");
goto CATCH;
_SECURE_D("Node: capability - %s", xml_capability);
ret = account_type_set_provider_feature(account_type_handle, (char*)xml_capability);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("[%d]Failed to set the capability.", ret);
goto CATCH;
}
goto CATCH;
}
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
ret = account_type_insert_to_db_offline(account_type_handle, &account_type_db_id);
- } else {
+ else
ret = account_type_insert_to_db(account_type_handle, &account_type_db_id);
- }
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("[%d]Failed to perform account_type_insert_to_db().", ret);
goto CATCH;
}
}
ret = account_type_destroy(account_type_handle);
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("[%d]Failed to perform account_type_destroy().", ret);
goto CATCH;
}
}
//To Do : delete accounts of this app from all user db.
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
ret = account_delete_from_db_by_package_name_offline((char*)app_id);
- }else {
+ else
ret = account_delete_from_db_by_package_name((char*)app_id);
- }
- if((ret != ACCOUNT_ERROR_NONE) && (ret != ACCOUNT_ERROR_RECORD_NOT_FOUND)) {
+
+ if ((ret != ACCOUNT_ERROR_NONE) && (ret != ACCOUNT_ERROR_RECORD_NOT_FOUND)) {
_E("Failed to perform account_delete_from_db_by_package_name_offline().");
goto CATCH;
}
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
ret = account_type_delete_by_app_id_offline((char*)app_id);
- } else {
+ else
ret = account_type_delete_by_app_id((char*)app_id);
- }
- if(ret != ACCOUNT_ERROR_NONE) {
+ if (ret != ACCOUNT_ERROR_NONE) {
_E("Failed to perform account_type_delete_by_app_id().");
goto CATCH;
}
return -1;
}
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
ret = account_type_delete_by_app_id_offline((char*)app_id);
- } else {
+ else
ret = account_type_delete_by_app_id((char*)app_id);
- }
- if(ret == ACCOUNT_ERROR_NONE) {
+ 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);
return -1;
}
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
- } else {
+ else
ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(packageId, uid, &package_info_handle);
- }
retvm_if(ret != PMINFO_R_OK, ret, "[%d]Failed to pkgmgrinfo_pkginfo_get_pkginfo().", ret);
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
- ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_ALL_APP, _unregister_account_provider, NULL);
- } else {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
+ ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_ALL_APP, _unregister_account_provider, NULL);
+ else
ret = pkgmgrinfo_appinfo_get_usr_list(package_info_handle, PMINFO_ALL_APP, _unregister_account_provider, NULL, uid);
- }
- if(ret != PMINFO_R_OK) {
+ if (ret != PMINFO_R_OK) {
_D("Failed to get the application information list.");
pkgmgrinfo_pkginfo_destroy_pkginfo(package_info_handle);
return -1;
}
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
ret = pkgmgrinfo_pkginfo_get_pkginfo(packageId, &package_info_handle);
- } else {
+ else
ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(packageId, uid, &package_info_handle);
- }
retvm_if(ret != PMINFO_R_OK, ret, "[%d]Failed to pkgmgrinfo_pkginfo_get_pkginfo().", ret);
- if (uid == OWNER_ROOT || uid == GLOBAL_USER) {
- ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_ALL_APP, _on_package_app_list_received_cb, NULL);
- } else {
+ if (uid == OWNER_ROOT || uid == GLOBAL_USER)
+ ret = pkgmgrinfo_appinfo_get_list(package_info_handle, PMINFO_ALL_APP, _on_package_app_list_received_cb, NULL);
+ else
ret = pkgmgrinfo_appinfo_get_usr_list(package_info_handle, PMINFO_ALL_APP, _on_package_app_list_received_cb, NULL, uid);
- }
- if(ret != PMINFO_R_OK) {
+ if (ret != PMINFO_R_OK) {
_D("Failed to get the application information list.");
pkgmgrinfo_pkginfo_destroy_pkginfo(package_info_handle);
retvm_if(ret != 0, ret, "[%d]Failed to register the account provider.", ret);
ret = account_query_account_by_package_name(_on_account_received_cb, __old_account_provider_app_id, (void*)account_provider_app_id);
- if((ret != ACCOUNT_ERROR_NONE) && (ret != ACCOUNT_ERROR_RECORD_NOT_FOUND)) {
+ if ((ret != ACCOUNT_ERROR_NONE) && (ret != ACCOUNT_ERROR_RECORD_NOT_FOUND)) {
_E("Failed to perform account_query_account_by_package_name().");
goto CATCH;
}