4 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include "app2sd_internals.h"
24 GMainLoop *app2sd_mainloop = NULL;
26 gboolean __exit_app2sd_server(void *data)
28 _D("exit app2sd_server");
30 g_main_loop_quit(app2sd_mainloop);
35 static int __app2sd_get_sender_unixinfo(GDBusConnection *conn,
36 const char *sender_name, const char *type)
38 GDBusMessage *msg = NULL;
39 GDBusMessage *reply = NULL;
45 msg = g_dbus_message_new_method_call("org.freedesktop.DBus",
46 "/org/freedesktop/DBus", "org.freedesktop.DBus", type);
48 _E("Can't allocate new method call");
52 g_dbus_message_set_body(msg, g_variant_new("(s)", sender_name));
53 reply = g_dbus_connection_send_message_with_reply_sync(conn, msg,
54 G_DBUS_SEND_MESSAGE_FLAGS_NONE, -1, NULL, NULL, &err);
58 _E("Failed to get info [%s]", err->message);
64 body = g_dbus_message_get_body(reply);
65 g_variant_get(body, "(u)", &value);
72 g_object_unref(reply);
78 static int __app2sd_get_sender_pid(GDBusConnection *conn,
79 const char *sender_name)
83 pid = __app2sd_get_sender_unixinfo(conn, sender_name,
84 "GetConnectionUnixProcessID");
86 _E("failed to get pid");
90 _D("sender_name(%s), pid(%d)", sender_name, pid);
96 static int __app2sd_get_sender_uid(GDBusConnection *conn,
97 const char *sender_name)
101 uid = __app2sd_get_sender_unixinfo(conn, sender_name,
102 "GetConnectionUnixUser");
104 _E("failed to get uid");
106 _D("sender_name(%s), uid(%d)", sender_name, uid);
111 static GDBusNodeInfo *introspection_data;
112 static const gchar introspection_xml[] =
114 " <interface name='org.tizen.app2sd'>"
115 " <method name='PreAppInstall'>"
116 " <arg type='s' name='pkgid' direction='in'/>"
117 " <arg type='i' name='size' direction='in'/>"
118 " <arg type='a(si)' name='dir_list' direction='in'/>"
119 " <arg type='i' name='uid' direction='in'/>"
120 " <arg type='i' name='result' direction='out'/>"
122 " <method name='PostAppInstall'>"
123 " <arg type='s' name='pkgid' direction='in'/>"
124 " <arg type='i' name='install_status' direction='in'/>"
125 " <arg type='i' name='uid' direction='in'/>"
126 " <arg type='i' name='result' direction='out'/>"
128 " <method name='PreAppUpgrade'>"
129 " <arg type='s' name='pkgid' direction='in'/>"
130 " <arg type='i' name='size' direction='in'/>"
131 " <arg type='a(si)' name='dir_list' direction='in'/>"
132 " <arg type='i' name='uid' direction='in'/>"
133 " <arg type='i' name='result' direction='out'/>"
135 " <method name='PostAppUpgrade'>"
136 " <arg type='s' name='pkgid' direction='in'/>"
137 " <arg type='i' name='install_status' direction='in'/>"
138 " <arg type='i' name='uid' direction='in'/>"
139 " <arg type='i' name='result' direction='out'/>"
141 " <method name='PreAppUninstall'>"
142 " <arg type='s' name='pkgid' direction='in'/>"
143 " <arg type='i' name='uid' direction='in'/>"
144 " <arg type='i' name='result' direction='out'/>"
146 " <method name='PostAppUninstall'>"
147 " <arg type='s' name='pkgid' direction='in'/>"
148 " <arg type='i' name='uid' direction='in'/>"
149 " <arg type='i' name='result' direction='out'/>"
151 " <method name='OndemandSetupInit'>"
152 " <arg type='s' name='pkgid' direction='in'/>"
153 " <arg type='i' name='uid' direction='in'/>"
154 " <arg type='i' name='result' direction='out'/>"
156 " <method name='OndemandSetupExit'>"
157 " <arg type='s' name='pkgid' direction='in'/>"
158 " <arg type='i' name='uid' direction='in'/>"
159 " <arg type='i' name='result' direction='out'/>"
161 " <method name='PreMoveInstalledApp'>"
162 " <arg type='s' name='pkgid' direction='in'/>"
163 " <arg type='i' name='move_type' direction='in'/>"
164 " <arg type='a(si)' name='dir_list' direction='in'/>"
165 " <arg type='i' name='uid' direction='in'/>"
166 " <arg type='i' name='result' direction='out'/>"
168 " <method name='PostMoveInstalledApp'>"
169 " <arg type='s' name='pkgid' direction='in'/>"
170 " <arg type='i' name='move_type' direction='in'/>"
171 " <arg type='i' name='uid' direction='in'/>"
172 " <arg type='i' name='result' direction='out'/>"
174 " <method name='ForceClean'>"
175 " <arg type='s' name='pkgid' direction='in'/>"
176 " <arg type='i' name='uid' direction='in'/>"
177 " <arg type='i' name='result' direction='out'/>"
179 " <method name='EnableFullPkg'>"
180 " <arg type='i' name='result' direction='out'/>"
182 " <method name='DisableFullPkg'>"
183 " <arg type='i' name='result' direction='out'/>"
188 static void _app2sd_server_return_method_error(GDBusMethodInvocation *invocation, int result)
190 GVariant *param = NULL;
192 param = g_variant_new("(i)", result);
193 g_dbus_method_invocation_return_value(invocation, param);
196 static void _app2sd_server_pre_app_install(GDBusConnection *connection, const gchar *sender,
197 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
199 GVariant *param = NULL;
200 int result = APP2EXT_SUCCESS;
207 uid_t target_uid = -1;
208 GList *dir_list = NULL;
210 app2ext_dir_details *dir_detail = NULL;
212 g_variant_get(parameters, "(&sia(si)i)", &pkgid, &size, &iter, &target_uid);
214 _D("pkgid(%s), size(%d),sender_uid(%d), target_uid(%d)",
215 pkgid, size, sender_uid, target_uid);
217 if (sender_uid != 0 && sender_uid != target_uid) {
218 _E("Not permitted user!");
219 g_variant_iter_free(iter);
220 _app2sd_server_return_method_error(invocation,
221 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
225 while (g_variant_iter_loop(iter, "(si)", &str, &type)) {
227 _D("str(%s), type(%d)", str, type);
229 /* generate dir_list */
230 dir_detail = (app2ext_dir_details *)calloc(1, sizeof(app2ext_dir_details));
231 if (dir_detail == NULL) {
232 _E("memory allocation failed");
233 result = APP2EXT_ERROR_MEMORY_ALLOC_FAILED;
237 dir_detail->name = strdup((char *)str);
238 if (dir_detail->name == NULL) {
241 result = APP2EXT_ERROR_MEMORY_ALLOC_FAILED;
245 dir_detail->type = type;
246 list = g_list_append(list, dir_detail);
249 g_variant_iter_free(iter);
251 dir_list = g_list_first(list);
252 ret = app2sd_usr_pre_app_install(pkgid, dir_list, size, target_uid);
254 _E("error(%d)", ret);
258 param = g_variant_new("(i)", result);
259 g_dbus_method_invocation_return_value(invocation, param);
262 static void _app2sd_server_post_app_install(GDBusConnection *connection, const gchar *sender,
263 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
265 GVariant *param = NULL;
266 int result = APP2EXT_SUCCESS;
268 int install_status = 0;
272 g_variant_get(parameters, "(&sii)", &pkgid, &install_status, &target_uid);
274 _D("pkgid(%s), install_status(%d), sender_uid(%d), target_uid(%d)",
275 pkgid, install_status, sender_uid, target_uid);
277 if (sender_uid != 0 && sender_uid != target_uid) {
278 _E("Not permitted user!");
279 _app2sd_server_return_method_error(invocation,
280 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
284 ret = app2sd_usr_post_app_install(pkgid, install_status, target_uid);
286 _E("error(%d)", ret);
290 param = g_variant_new("(i)", result);
291 g_dbus_method_invocation_return_value(invocation, param);
294 static void _app2sd_server_pre_app_upgrade(GDBusConnection *connection, const gchar *sender,
295 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
297 GVariant *param = NULL;
298 int result = APP2EXT_SUCCESS;
304 uid_t target_uid = -1;
306 GList *dir_list = NULL;
308 app2ext_dir_details *dir_detail = NULL;
310 g_variant_get(parameters, "(&sia(si)i)", &pkgid, &size, &iter, &target_uid);
312 _D("pkgid(%s), size(%d), sender_uid(%d), target_uid(%d)",
313 pkgid, size, sender_uid, target_uid);
315 if (sender_uid != 0 && sender_uid != target_uid) {
316 _E("Not permitted user!");
317 g_variant_iter_free(iter);
318 _app2sd_server_return_method_error(invocation,
319 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
323 while (g_variant_iter_loop(iter, "(si)", &str, &type)) {
325 _D("str(%s), type(%d)", str, type);
327 /* generate dir_list */
328 dir_detail = (app2ext_dir_details *)calloc(1, sizeof(app2ext_dir_details));
329 if (dir_detail == NULL) {
330 _E("memory allocation failed");
331 result = APP2EXT_ERROR_MEMORY_ALLOC_FAILED;
335 dir_detail->name = strdup((char *)str);
336 if (dir_detail->name == NULL) {
339 result = APP2EXT_ERROR_MEMORY_ALLOC_FAILED;
343 dir_detail->type = type;
344 list = g_list_append(list, dir_detail);
347 g_variant_iter_free(iter);
349 dir_list = g_list_first(list);
350 ret = app2sd_usr_pre_app_upgrade(pkgid, dir_list, size, target_uid);
352 _E("error(%d)", ret);
356 param = g_variant_new("(i)", result);
357 g_dbus_method_invocation_return_value(invocation, param);
360 static void _app2sd_server_post_app_upgrade(GDBusConnection *connection, const gchar *sender,
361 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
363 GVariant *param = NULL;
364 int result = APP2EXT_SUCCESS;
366 int install_status = 0;
367 uid_t target_uid = -1;
370 g_variant_get(parameters, "(&sii)", &pkgid, &install_status, &target_uid);
372 _D("pkgid(%s), install_status(%d), sender_uid(%d), target_uid(%d)",
373 pkgid, install_status, sender_uid, target_uid);
375 if (sender_uid != 0 && sender_uid != target_uid) {
376 _E("Not permitted user!");
377 _app2sd_server_return_method_error(invocation,
378 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
382 ret = app2sd_usr_post_app_upgrade(pkgid, install_status, target_uid);
384 _E("error(%d)", ret);
388 param = g_variant_new("(i)", result);
389 g_dbus_method_invocation_return_value(invocation, param);
392 static void _app2sd_server_pre_app_uninstall(GDBusConnection *connection, const gchar *sender,
393 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
395 GVariant *param = NULL;
396 int result = APP2EXT_SUCCESS;
398 uid_t target_uid = -1;
401 g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
403 _D("pkgid(%s), sender_uid(%d), target_uid(%d)",
404 pkgid, sender_uid, target_uid);
406 if (sender_uid != 0 && sender_uid != target_uid) {
407 _E("Not permitted user!");
408 _app2sd_server_return_method_error(invocation,
409 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
413 ret = app2sd_usr_pre_app_uninstall(pkgid, target_uid);
415 _E("error(%d)", ret);
419 param = g_variant_new("(i)", result);
420 g_dbus_method_invocation_return_value(invocation, param);
423 static void _app2sd_server_post_app_uninstall(GDBusConnection *connection, const gchar *sender,
424 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
426 GVariant *param = NULL;
427 int result = APP2EXT_SUCCESS;
429 uid_t target_uid = -1;
432 g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
434 _D("pkgid(%s), sender_uid(%d), target_uid(%d)",
435 pkgid, sender_uid, target_uid);
437 if (sender_uid != 0 && sender_uid != target_uid) {
438 _E("Not permitted user!");
439 _app2sd_server_return_method_error(invocation,
440 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
444 ret = app2sd_usr_post_app_uninstall(pkgid, target_uid);
446 _E("error(%d)", ret);
450 param = g_variant_new("(i)", result);
451 g_dbus_method_invocation_return_value(invocation, param);
454 static void _app2sd_server_ondemand_setup_init(GDBusConnection *connection, const gchar *sender,
455 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
457 GVariant *param = NULL;
458 int result = APP2EXT_SUCCESS;
460 uid_t target_uid = -1;
463 g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
465 _D("pkgid(%s), sender_uid(%d), target_uid(%d)",
466 pkgid, sender_uid, target_uid);
468 if (sender_uid != 0 && sender_uid != target_uid) {
469 _E("Not permitted user!");
470 _app2sd_server_return_method_error(invocation,
471 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
475 ret = app2sd_usr_on_demand_setup_init(pkgid, target_uid);
477 _E("error(%d)", ret);
481 param = g_variant_new("(i)", result);
482 g_dbus_method_invocation_return_value(invocation, param);
485 static void _app2sd_server_ondemand_setup_exit(GDBusConnection *connection, const gchar *sender,
486 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
488 GVariant *param = NULL;
489 int result = APP2EXT_SUCCESS;
491 uid_t target_uid = -1;
494 g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
496 _D("pkgid(%s), sender_uid(%d), target_uid(%d)",
497 pkgid, sender_uid, target_uid);
499 if (sender_uid != 0 && sender_uid != target_uid) {
500 _E("Not permitted user!");
501 _app2sd_server_return_method_error(invocation,
502 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
506 ret = app2sd_usr_on_demand_setup_exit(pkgid, target_uid);
508 _E("error(%d)", ret);
512 param = g_variant_new("(i)", result);
513 g_dbus_method_invocation_return_value(invocation, param);
516 static void _app2sd_server_pre_move_installed_app(GDBusConnection *connection,
517 const gchar *sender, GVariant *parameters,
518 GDBusMethodInvocation *invocation, uid_t sender_uid)
520 GVariant *param = NULL;
521 int result = APP2EXT_SUCCESS;
528 uid_t target_uid = -1;
529 GList *dir_list = NULL;
531 app2ext_dir_details *dir_detail = NULL;
533 g_variant_get(parameters, "(&sia(si)i)", &pkgid, &move_type, &iter, &target_uid);
535 _D("pkgid(%s), move_type(%d),sender_uid(%d), target_uid(%d)",
536 pkgid, move_type, sender_uid, target_uid);
538 if (sender_uid != 0 && sender_uid != target_uid) {
539 _E("Not permitted user!");
540 g_variant_iter_free(iter);
541 _app2sd_server_return_method_error(invocation,
542 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
546 while (g_variant_iter_loop(iter, "(si)", &str, &type)) {
548 _D("str(%s), type(%d)", str, type);
550 /* generate dir_list */
551 dir_detail = (app2ext_dir_details *)calloc(1, sizeof(app2ext_dir_details));
552 if (dir_detail == NULL) {
553 _E("memory allocation failed");
554 result = APP2EXT_ERROR_MEMORY_ALLOC_FAILED;
558 dir_detail->name = strdup((char *)str);
559 if (dir_detail->name == NULL) {
562 result = APP2EXT_ERROR_MEMORY_ALLOC_FAILED;
566 dir_detail->type = type;
567 list = g_list_append(list, dir_detail);
570 g_variant_iter_free(iter);
572 dir_list = g_list_first(list);
573 ret = app2sd_usr_pre_move_installed_app(pkgid, dir_list, move_type, target_uid);
575 _E("pre_move error(%d)", ret);
579 param = g_variant_new("(i)", result);
580 g_dbus_method_invocation_return_value(invocation, param);
583 static void _app2sd_server_post_move_installed_app(GDBusConnection *connection,
584 const gchar *sender, GVariant *parameters,
585 GDBusMethodInvocation *invocation, uid_t sender_uid)
587 GVariant *param = NULL;
588 int result = APP2EXT_SUCCESS;
592 uid_t target_uid = -1;
594 g_variant_get(parameters, "(&sii)", &pkgid, &move_type, &target_uid);
596 _D("pkgid(%s), move_type(%d),sender_uid(%d), target_uid(%d)",
597 pkgid, move_type, sender_uid, target_uid);
599 if (sender_uid != 0 && sender_uid != target_uid) {
600 _E("Not permitted user!");
601 _app2sd_server_return_method_error(invocation,
602 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
606 ret = app2sd_usr_post_move_installed_app(pkgid, move_type, target_uid);
608 _E("post_move error(%d)", ret);
612 param = g_variant_new("(i)", result);
613 g_dbus_method_invocation_return_value(invocation, param);
616 static void _app2sd_server_force_clean(GDBusConnection *connection, const gchar *sender,
617 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
619 GVariant *param = NULL;
620 int result = APP2EXT_SUCCESS;
622 uid_t target_uid = -1;
625 g_variant_get(parameters, "(&si)", &pkgid, &target_uid);
627 _D("pkgid(%s), sender_uid(%d), target_uid(%d)",
628 pkgid, sender_uid, target_uid);
630 if (sender_uid != 0 && sender_uid != target_uid) {
631 _E("Not permitted user!");
632 _app2sd_server_return_method_error(invocation,
633 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
637 ret = app2sd_usr_force_clean(pkgid, target_uid);
639 _E("error(%d)", ret);
643 param = g_variant_new("(i)", result);
644 g_dbus_method_invocation_return_value(invocation, param);
647 static void _app2sd_server_enable_full_pkg(GDBusConnection *connection, const gchar *sender,
648 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
650 GVariant *param = NULL;
651 int result = APP2EXT_SUCCESS;
654 _D("sender_uid(%d)", sender_uid);
656 if (sender_uid >= REGULAR_USER) {
657 _E("Not permitted user!");
658 _app2sd_server_return_method_error(invocation,
659 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
663 ret = app2sd_enable_full_pkg();
665 _E("error(%d)", ret);
669 param = g_variant_new("(i)", result);
670 g_dbus_method_invocation_return_value(invocation, param);
673 static void _app2sd_server_disable_full_pkg(GDBusConnection *connection, const gchar *sender,
674 GVariant *parameters, GDBusMethodInvocation *invocation, uid_t sender_uid)
676 GVariant *param = NULL;
677 int result = APP2EXT_SUCCESS;
680 _D("sender_uid(%d)", sender_uid);
682 if (sender_uid >= REGULAR_USER) {
683 _E("Not permitted user!");
684 _app2sd_server_return_method_error(invocation,
685 APP2EXT_ERROR_OPERATION_NOT_PERMITTED);
689 ret = app2sd_disable_full_pkg();
691 _E("error(%d)", ret);
695 param = g_variant_new("(i)", result);
696 g_dbus_method_invocation_return_value(invocation, param);
699 static void handle_method_call(GDBusConnection *connection,
700 const gchar *sender, const gchar *object_path,
701 const gchar *interface_name, const gchar *method_name,
702 GVariant *parameters, GDBusMethodInvocation *invocation,
705 uid_t sender_uid = -1;
707 sender_uid = (uid_t)__app2sd_get_sender_uid(connection, sender);
709 if (g_strcmp0(method_name, "PreAppInstall") == 0) {
710 _app2sd_server_pre_app_install(connection, sender,
711 parameters, invocation, sender_uid);
712 } else if (g_strcmp0(method_name, "PostAppInstall") == 0) {
713 _app2sd_server_post_app_install(connection, sender,
714 parameters, invocation, sender_uid);
715 } else if (g_strcmp0(method_name, "PreAppUpgrade") == 0) {
716 _app2sd_server_pre_app_upgrade(connection, sender,
717 parameters, invocation, sender_uid);
718 } else if (g_strcmp0(method_name, "PostAppUpgrade") == 0) {
719 _app2sd_server_post_app_upgrade(connection, sender,
720 parameters, invocation, sender_uid);
721 } else if (g_strcmp0(method_name, "PreAppUninstall") == 0) {
722 _app2sd_server_pre_app_uninstall(connection, sender,
723 parameters, invocation, sender_uid);
724 } else if (g_strcmp0(method_name, "PostAppUninstall") == 0) {
725 _app2sd_server_post_app_uninstall(connection, sender,
726 parameters, invocation, sender_uid);
727 } else if (g_strcmp0(method_name, "OndemandSetupInit") == 0) {
728 _app2sd_server_ondemand_setup_init(connection, sender,
729 parameters, invocation, sender_uid);
730 } else if (g_strcmp0(method_name, "OndemandSetupExit") == 0) {
731 _app2sd_server_ondemand_setup_exit(connection, sender,
732 parameters, invocation, sender_uid);
733 } else if (g_strcmp0(method_name, "PreMoveInstalledApp") == 0) {
734 _app2sd_server_pre_move_installed_app(connection, sender,
735 parameters, invocation, sender_uid);
736 } else if (g_strcmp0(method_name, "PostMoveInstalledApp") == 0) {
737 _app2sd_server_post_move_installed_app(connection, sender,
738 parameters, invocation, sender_uid);
739 } else if (g_strcmp0(method_name, "ForceClean") == 0) {
740 _app2sd_server_force_clean(connection, sender,
741 parameters, invocation, sender_uid);
742 } else if (g_strcmp0(method_name, "EnableFullPkg") == 0) {
743 _app2sd_server_enable_full_pkg(connection, sender,
744 parameters, invocation, sender_uid);
745 } else if (g_strcmp0(method_name, "DisableFullPkg") == 0) {
746 _app2sd_server_disable_full_pkg(connection, sender,
747 parameters, invocation, sender_uid);
750 g_timeout_add_seconds(5, __exit_app2sd_server, NULL);
753 static const GDBusInterfaceVTable interface_vtable = {
759 static void __app2sd_on_bus_acquired(GDBusConnection *connection,
760 const gchar *name, gpointer user_data)
762 _I("bus acquired(%s)", name);
765 GError *error = NULL;
767 reg_id = g_dbus_connection_register_object(connection,
769 introspection_data->interfaces[0],
773 _E("g_dbus_connection_register_object error(%s)", error->message);
778 static void __app2sd_on_name_acquired(GDBusConnection *connection,
779 const gchar *name, gpointer user_data)
781 _I("name acquired(%s)", name);
784 static void __app2sd_on_name_lost(GDBusConnection *connection,
785 const gchar *name, gpointer user_data)
787 _E("name lost(%s)", name);
788 g_main_loop_quit(app2sd_mainloop);
791 static int __app2sd_server_init()
793 GError *error = NULL;
796 /* gdbus setup for method call */
797 introspection_data = g_dbus_node_info_new_for_xml(introspection_xml, &error);
798 if (!introspection_data) {
799 _E("g_dbus_node_info_new_for_xml error(%s)", error->message);
804 owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
806 G_BUS_NAME_OWNER_FLAGS_NONE,
807 __app2sd_on_bus_acquired,
808 __app2sd_on_name_acquired,
809 __app2sd_on_name_lost,
812 _E("g_bus_own_name error");
813 g_dbus_node_info_unref(introspection_data);
822 static void __app2sd_finalize(void)
824 _D("app2sd finalize");
826 if (introspection_data)
827 g_dbus_node_info_unref(introspection_data);
829 _D("app2sd finalize end");
832 int main(int argc, char *argv[])
836 _I("app2sd_server : start");
838 ret = __app2sd_server_init();
840 _E("app2sd_server init failed(%d)", ret);
844 app2sd_mainloop = g_main_loop_new(NULL, FALSE);
845 if (!app2sd_mainloop) {
846 _E("g_main_loop_new failed");
850 g_main_loop_run(app2sd_mainloop);
854 _I("app2sd_server : end");