#include <account_err.h>
#include "account-server-db.h"
+#include "lifecycle.h"
#define _PRIVILEGE_ACCOUNT_READ "http://tizen.org/privilege/account.read"
#define _PRIVILEGE_ACCOUNT_WRITE "http://tizen.org/privilege/account.write"
GDBusObjectManagerServer *account_mgr_server_mgr = NULL;
static AccountManager* account_mgr_server_obj = NULL;
+static GMainLoop *mainloop = NULL;
+
static cynara *p_cynara;
//static gboolean has_owner = FALSE;
gboolean account_manager_account_add(AccountManager *obj, GDBusMethodInvocation *invocation, GVariant* account_data, gint uid, gpointer user_data)
{
_INFO("account_manager_account_add start");
+ lifecycle_method_call_active();
+
int db_id = -1;
account_s* account = NULL;
{
account_manager_complete_account_add(obj, invocation, db_id);
}
- _INFO("account_manager_account_add end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_free_account_with_items(account);
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_add end");
return true;
}
gboolean account_manager_account_query_all(AccountManager *obj, GDBusMethodInvocation *invocation, gint uid)
{
_INFO("account_manager_account_query_all start");
+ lifecycle_method_call_active();
GVariant* account_list_variant = NULL;
{
account_manager_complete_account_query_all(obj, invocation, account_list_variant);
}
- _INFO("account_manager_account_query_all end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_query_all end");
return true;
}
gboolean account_manager_account_type_query_all(AccountManager *obj, GDBusMethodInvocation *invocation, gint uid)
{
_INFO("account_manager_account_query_all start");
+ lifecycle_method_call_active();
GVariant* account_type_list_variant = NULL;
guint pid = _get_client_pid(invocation);
{
account_manager_complete_account_type_query_all(obj, invocation, account_type_list_variant);
}
- _INFO("account_manager_account_query_all end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_query_all end");
return true;
}
gboolean account_manager_account_type_add(AccountManager *obj, GDBusMethodInvocation *invocation, GVariant *account_type_data, gint uid, gpointer user_data)
{
+ _INFO("account_manager_account_type_add start");
+ lifecycle_method_call_active();
+
int db_id = -1;
account_type_s* account_type = NULL;
- _INFO("account_manager_account_type_add start");
-
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
{
account_manager_complete_account_type_add(obj, invocation, db_id);
}
- _INFO("account_manager_account_type_add end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
}
_account_type_free_account_type_with_items(account_type);
+
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_type_add end");
return true;
}
gint uid)
{
_INFO("account_manager_account_delete_from_db_by_id start");
+ lifecycle_method_call_active();
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
{
account_manager_complete_account_delete_from_db_by_id(object, invocation);
}
- _INFO("account_manager_account_delete_from_db_by_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_delete_from_db_by_id end");
return true;
}
gint uid)
{
_INFO("account_manager_account_delete_from_db_by_user_name start");
+ lifecycle_method_call_active();
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
{
account_manager_complete_account_delete_from_db_by_id(object, invocation);
}
- _INFO("account_manager_account_delete_from_db_by_user_name end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_delete_from_db_by_user_name end");
return true;
}
gint uid)
{
_INFO("account_manager_account_delete_from_db_by_package_name start");
+ lifecycle_method_call_active();
+
int return_code = _ACCOUNT_ERROR_NONE;
guint pid = _get_client_pid(invocation);
{
account_manager_complete_account_delete_from_db_by_package_name(object, invocation);
}
- _INFO("account_manager_account_delete_from_db_by_package_name end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_delete_from_db_by_package_name end");
return true;
}
gint uid)
{
_INFO("account_manager_account_update_to_db_by_id start");
+ lifecycle_method_call_active();
+
account_s* account = NULL;
guint pid = _get_client_pid(invocation);
{
account_manager_complete_account_update_to_db_by_id(object, invocation);
}
- _INFO("account_manager_account_update_to_db_by_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_free_account_with_items(account);
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_update_to_db_by_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_update_to_db_by_user_name start");
+ lifecycle_method_call_active();
+
account_s* account = NULL;
guint pid = _get_client_pid(invocation);
{
account_manager_complete_account_update_to_db_by_id(object, invocation);
}
- _INFO("account_manager_handle_account_update_to_db_by_user_name end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_free_account_with_items(account);
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_update_to_db_by_user_name end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_query_label_by_locale start");
+ lifecycle_method_call_active();
+
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
{
account_manager_complete_account_type_query_label_by_locale(object, invocation, label_name);
}
- _INFO("account_manager_handle_account_type_query_label_by_locale end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_label_by_locale end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_query_by_provider_feature start");
+ lifecycle_method_call_active();
+
GVariant* account_type_list_variant = NULL;
guint pid = _get_client_pid(invocation);
{
account_manager_complete_account_type_query_by_provider_feature(obj, invocation, account_type_list_variant);
}
- _INFO("account_manager_handle_account_type_query_by_provider_feature end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_by_provider_feature end");
return true;
}
gboolean account_manager_account_get_total_count_from_db(AccountManager *object, GDBusMethodInvocation *invocation, gboolean include_hidden, gint uid)
{
_INFO("account_manager_account_get_total_count_from_db start");
+ lifecycle_method_call_active();
+
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
{
account_manager_complete_account_get_total_count_from_db(object, invocation, count);
}
- _INFO("account_manager_account_get_total_count_from_db end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_account_get_total_count_from_db end");
return true;
}
gint account_db_id, gint uid)
{
_INFO("account_manager_handle_account_query_account_by_account_id start");
+ lifecycle_method_call_active();
+
GVariant* account_variant = NULL;
account_s* account_data = NULL;
{
account_manager_complete_account_query_account_by_account_id(object, invocation, account_variant);
}
- _INFO("account_manager_handle_account_query_account_by_account_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_free_account_with_items(account_data);
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_query_account_by_account_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_query_account_by_user_name start");
+ lifecycle_method_call_active();
GVariant* account_list_variant = NULL;
guint pid = _get_client_pid(invocation);
{
account_manager_complete_account_query_account_by_user_name(obj, invocation, account_list_variant);
}
- _INFO("account_manager_handle_account_query_account_by_user_name end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_query_account_by_user_name end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_query_account_by_package_name start");
+ lifecycle_method_call_active();
GVariant* account_list_variant = NULL;
guint pid = _get_client_pid(invocation);
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_query_account_by_package_name start");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_query_account_by_capability start");
+ lifecycle_method_call_active();
GVariant* account_list_variant = NULL;
{
account_manager_complete_account_query_account_by_capability(obj, invocation, account_list_variant);
}
- _INFO("account_manager_handle_account_query_account_by_capability end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_query_account_by_capability end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_query_account_by_capability_type start");
+ lifecycle_method_call_active();
GVariant* account_list_variant = NULL;
{
account_manager_complete_account_query_account_by_capability(obj, invocation, account_list_variant);
}
- _INFO("account_manager_handle_account_query_account_by_capability_type end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_query_account_by_capability_type end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_query_capability_by_account_id start");
+ lifecycle_method_call_active();
GVariant* capability_list_variant = NULL;
{
account_manager_complete_account_query_capability_by_account_id(obj, invocation, capability_list_variant);
}
- _INFO("account_manager_handle_account_query_capability_by_account_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_query_capability_by_account_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_update_sync_status_by_id start");
+ lifecycle_method_call_active();
+
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
{
account_manager_complete_account_update_sync_status_by_id(object, invocation);
}
- _INFO("account_manager_handle_account_update_sync_status_by_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_update_sync_status_by_id end");
return true;
}
const gchar* app_id,
gint uid)
{
+ _INFO("account_manager_handle_account_type_query_provider_feature_by_app_id start");
+ lifecycle_method_call_active();
+
GSList* feature_record_list = NULL;
GVariant* feature_record_list_variant = NULL;
- _INFO("account_manager_handle_account_type_query_provider_feature_by_app_id start");
-
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
_INFO("Calling account_manager_complete_account_type_query_provider_feature_by_app_id");
account_manager_complete_account_type_query_provider_feature_by_app_id(obj, invocation, feature_record_list_variant);
}
- _INFO("account_manager_handle_account_type_query_provider_feature_by_app_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_provider_feature_by_app_id end");
return true;
}
const gchar* capability,
gint uid)
{
- int is_supported = 0;
-
_INFO("account_manager_handle_account_type_query_supported_feature start");
+ lifecycle_method_call_active();
+
+ int is_supported = 0;
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
_INFO("Calling account_manager_complete_account_type_query_provider_feature_by_app_id");
account_manager_complete_account_type_query_supported_feature(obj, invocation, is_supported);
}
- _INFO("account_manager_handle_account_type_query_supported_feature end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_supported_feature end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_update_to_db_by_app_id start");
+ lifecycle_method_call_active();
+
account_type_s* account_type = NULL;
guint pid = _get_client_pid(invocation);
_INFO("Calling account_manager_complete_account_type_update_to_db_by_app_id");
account_manager_complete_account_type_update_to_db_by_app_id(obj, invocation);
}
- _INFO("account_manager_handle_account_type_update_to_db_by_app_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_type_free_account_type_with_items(account_type);
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_update_to_db_by_app_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_delete_by_app_id start");
+ lifecycle_method_call_active();
guint pid = _get_client_pid(invocation);
_ERR("Calling account_manager_complete_account_type_update_to_db_by_app_id");
account_manager_complete_account_type_delete_by_app_id (obj, invocation);
}
- _INFO("account_manager_handle_account_type_delete_by_app_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_delete_by_app_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_query_label_by_app_id start");
+ lifecycle_method_call_active();
+
GSList* label_list = NULL;
GVariant* label_list_variant = NULL;
_ERR("Calling account_manager_complete_account_type_query_label_by_app_id");
account_manager_complete_account_type_query_label_by_app_id (obj, invocation, label_list_variant);
}
- _INFO("account_manager_handle_account_type_query_label_by_app_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_label_by_app_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_query_by_app_id start");
+ lifecycle_method_call_active();
+
GVariant* account_type_variant = NULL;
guint pid = _get_client_pid(invocation);
_INFO("Calling account_manager_complete_account_type_query_by_app_id");
account_manager_complete_account_type_query_by_app_id (obj, invocation, account_type_variant);
}
- _INFO("account_manager_handle_account_type_query_by_app_id end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_type_free_account_type_with_items(account_type);
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_by_app_id end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_type_query_app_id_exist start");
+ lifecycle_method_call_active();
+
guint pid = _get_client_pid(invocation);
_INFO("client Id = [%u]", pid);
_INFO("Calling account_manager_complete_account_type_query_by_app_id_exist");
account_manager_complete_account_type_query_app_id_exist (obj, invocation);
}
- _INFO("account_manager_handle_account_type_query_app_id_exist end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
return_code = _ACCOUNT_ERROR_NONE;
}
+ lifecycle_method_call_inactive();
+ _INFO("account_manager_handle_account_type_query_app_id_exist end");
return true;
}
gint uid)
{
_INFO("account_manager_handle_account_update_to_db_by_id_ex start");
+ lifecycle_method_call_active();
+
account_s* account = NULL;
guint pid = _get_client_pid(invocation);
_INFO("Calling account_manager_complete_account_update_to_db_by_id_ex");
account_manager_complete_account_update_to_db_by_id_ex (obj, invocation);
}
- _INFO("in account_manager_handle_account_update_to_db_by_id_ex_p end");
return_code = _account_db_close();
if (return_code != _ACCOUNT_ERROR_NONE)
_account_free_account_with_items(account);
+ lifecycle_method_call_inactive();
+ _INFO("in account_manager_handle_account_update_to_db_by_id_ex_p end");
return true;
}
_INFO("on_bus_acquired end [%s]", name);
}
+void terminate_main_loop()
+{
+ if (mainloop)
+ g_main_loop_quit(mainloop);
+ else
+ _ERR("account manager's g_mainloop is NULL");
+}
+
static void
on_name_acquired (GDBusConnection *connection,
const gchar *name,
return true;
}
+static void _terminate_server_by_timeout()
+{
+ lifecycle_method_call_active();
+ lifecycle_method_call_inactive();
+}
+
static void _initialize()
{
#if !GLIB_CHECK_VERSION(2,35,0)
_ERR("CYNARA Initialization fail");
exit(1);
}
+
+ _terminate_server_by_timeout();
}
int main()
{
- GMainLoop *mainloop = NULL;
-
_INFO("Starting Accounts SVC");
mainloop = g_main_loop_new(NULL, FALSE);