static int __emit_app_launch_signal(int pid, const char *app_id)
{
- pending_item_t *item;
int ret;
ret = __emit_signal(AUL_DBUS_PATH,
AUL_DBUS_SIGNAL_INTERFACE,
AUL_DBUS_APPLAUNCH_SIGNAL,
g_variant_new("(us)", pid, app_id));
- if (ret < 0) {
- item = __create_pending_item(app_id, pid, APP_SIGNAL_LAUNCH);
- if (!item)
- return -ENOMEM;
+ if (ret < 0)
+ return ret;
- _W("Pend app launch signal. pid(%d), app_id(%s)", pid, app_id);
- __pending_items = g_list_append(__pending_items, item);
- __set_pending_item_timer();
- } else {
- _D("App launch. pid(%d), app_id(%s)", pid, app_id);
- }
+ _D("App launch. pid(%d), app_id(%s)", pid, app_id);
return 0;
}
static int __emit_app_dead_signal(int pid)
{
- pending_item_t *item;
int ret;
ret = __emit_signal(AUL_DBUS_PATH,
AUL_DBUS_SIGNAL_INTERFACE,
AUL_DBUS_APPDEAD_SIGNAL,
g_variant_new("(u)", pid));
- if (ret < 0) {
- item = __create_pending_item(NULL, pid, APP_SIGNAL_DEAD);
- if (!item)
- return -ENOMEM;
+ if (ret < 0)
+ return ret;
- _W("Pend app dead signal. pid(%d)", pid);
- __pending_items = g_list_append(__pending_items, item);
- __set_pending_item_timer();
- } else {
- _D("App dead. pid(%d)", pid);
- }
+ _D("App dead. pid(%d)", pid);
return 0;
}
int _dbus_send_app_launch_signal(int pid, const char *app_id)
{
+ pending_item_t *item;
+ int ret;
+
if (pid <= 1 || !app_id) {
_E("Invalid parameter");
return -EINVAL;
}
- return __emit_app_launch_signal(pid, app_id);
+ ret = __emit_app_launch_signal(pid, app_id);
+ if (ret < 0) {
+ item = __create_pending_item(app_id, pid, APP_SIGNAL_LAUNCH);
+ if (!item)
+ return -ENOMEM;
+
+ _W("Pend app launch signal. pid(%d), app_id(%s)", pid, app_id);
+ __pending_items = g_list_append(__pending_items, item);
+ __set_pending_item_timer();
+ }
+
+ return 0;
}
int _dbus_send_app_dead_signal(int pid)
{
+ pending_item_t *item;
+ int ret;
+
if (pid <= 1) {
_E("Invalid parameter");
return -EINVAL;
}
- return __emit_app_dead_signal(pid);
+ ret = __emit_app_dead_signal(pid);
+ if (ret < 0) {
+ item = __create_pending_item(NULL, pid, APP_SIGNAL_DEAD);
+ if (!item)
+ return -ENOMEM;
+
+ _W("Pend app dead signal. pid(%d)", pid);
+ __pending_items = g_list_append(__pending_items, item);
+ __set_pending_item_timer();
+ }
+
+ return 0;
}
int _dbus_init(void)