IF(_APPFW_FEATURE_PRIVATE_SERVICE)
ADD_DEFINITIONS("-D_APPFW_FEATURE_PRIVATE_SERVICE")
ENDIF(_APPFW_FEATURE_PRIVATE_SERVICE)
+IF(_APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP)
+ ADD_DEFINITIONS("-D_APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP")
+ENDIF(_APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP)
# Linker flags
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
__app_send_raw_with_noreply(pid, APP_WAKE, (unsigned char *)&dummy, sizeof(int));
}
-static void __set_fg_flag(int cpid, int flag)
+static void __set_fg_flag(int cpid, int flag, gboolean force)
{
int lpid = app_group_get_leader_pid(cpid);
GHashTableIter iter;
while (i != NULL) {
ac = (app_group_context_t*) i->data;
- if (ac->fg != flag) {
+ if (ac->fg != flag || force == TRUE) {
const char *appid = NULL;
const char *pkgid = NULL;
const struct appinfo *ai = NULL;
GINT_TO_POINTER(pid));
if (ppid != -1) {
- app_group_set_status(ppid, -1);
+ app_group_set_status(ppid, -1, FALSE);
}
}
return -1;
}
-int app_group_set_status(int pid, int status)
+int app_group_set_status(int pid, int status, gboolean force)
{
GHashTableIter iter;
gpointer key, value;
GList *last = g_list_last(list);
app_group_context_t *last_ac = (app_group_context_t*) last->data;
- if (last_ac->wid != 0 || status == STATUS_VISIBLE) {
+ if (last_ac->wid != 0 || status == STATUS_VISIBLE || force == TRUE) {
if (__is_visible(pid)) {
- __set_fg_flag(pid, 1);
+ __set_fg_flag(pid, 1, force);
if (!ac->group_sig && (int)key != pid) {
char *appid = NULL;
const char *pkgid = NULL;
ac->group_sig = 1;
}
} else
- __set_fg_flag(pid, 0);
+ __set_fg_flag(pid, 0, force);
}
return 0;
}
if (list != NULL) {
app_group_context_t *ac = (app_group_context_t*) list->data;
if (ac->can_be_leader) {
+ _W("found the second leader, lpid: %d, pid: %d", lpid, ac->pid);
return ac->pid;
}
}
*pids = idle_pids;
}
+int app_group_get_next_caller_pid(int pid)
+{
+ GHashTableIter iter;
+ gpointer key, value;
+
+ g_hash_table_iter_init(&iter, app_group_hash);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ GList *list = (GList*) value;
+ GList *i = g_list_first(list);
+
+ while (i != NULL) {
+ app_group_context_t *ac = (app_group_context_t*) i->data;
+
+ if (ac->pid == pid) {
+ i = g_list_next(i);
+ if (i == NULL)
+ return -1;
+
+ ac = (app_group_context_t*) i->data;
+ return ac->caller_pid;
+ }
+ i = g_list_next(i);
+ }
+ }
+
+ return -1;
+}
+
+
int app_group_get_leader_pid(int pid);
void app_group_set_dead_pid(int pid);
int app_group_get_status(int pid);
-int app_group_set_status(int pid, int status);
+int app_group_set_status(int pid, int status, gboolean force);
int app_group_get_fg_flag(int pid);
int app_group_set_hint(int pid, bundle *kb);
int app_group_find_second_leader(int lpid);
int app_group_find_pid_from_recycle_bin(const char *appid);
void app_group_get_idle_pids(int *cnt, int **pids);
void app_group_remove_from_recycle_bin(int pid);
+int app_group_get_next_caller_pid(int pid);
#endif
#define HIDE_INDICATOR 0
#define SHOW_INDICATOR 1
-#define PROC_STATUS_FG 3
-#define PROC_STATUS_BG 4
+#define PROC_STATUS_LAUNCH 0
+#define PROC_STATUS_FG 3
+#define PROC_STATUS_BG 4
#ifdef _APPFW_FEATURE_CPU_BOOST
#define APP_BOOSTING_PERIOD 1500 //msec
#endif
guint grab_timer_id;
#endif
+static GList *_fgmgr_list;
+
+struct fgmgr {
+ guint tid;
+ int pid;
+};
#if 0
/*Unused data structure. Will be removed*/
g_strfreev(argv);
}
-static inline int __send_app_launch_signal(int launch_pid)
+static inline int __send_app_launch_signal(int launch_pid, const char *app_id)
{
DBusMessage *message;
AUL_DBUS_APPLAUNCH_SIGNAL);
if (dbus_message_append_args(message,
- DBUS_TYPE_UINT32, &launch_pid,
- DBUS_TYPE_INVALID) == FALSE) {
+ DBUS_TYPE_UINT32, &launch_pid,
+ DBUS_TYPE_STRING, &app_id,
+ DBUS_TYPE_INVALID) == FALSE) {
_E("Failed to load data error");
return -1;
}
dbus_connection_flush(conn);
dbus_message_unref(message);
- _W("send launch signal done: %d", launch_pid);
+ _W("send launch signal done: %d, %s", launch_pid, app_id);
return 0;
}
return ret;
}
-int start_process(const char *group, const char *cmd, bundle *kb)
+int start_process(const char *appid, const char *cmd, bundle *kb)
{
int r;
pid_t p;
getpid(), errno, strerror(errno));
}
#endif
- _do_exec(cmd, group, kb);
+ _do_exec(cmd, appid, kb);
/* exec error */
exit(0);
_W("child process: %d", p);
r = __check_cmdline(p);
if(r > 0)
- __send_app_launch_signal(r);
+ __send_app_launch_signal(r, appid);
else
_E("cmdline change failed.");
break;
ret = -1;
}
}
- _D("pause done\n");
- if (ret > 0)
- __set_reply_handler(ret, pid, clifd, APP_PAUSE_BY_PID);
+ _D("pause done\n");
+ close(clifd);
return ret;
}
r_info->gpollfd = gpollfd;
r_info->cmd = cmd;
-
r_info->timer_id = g_timeout_add(5000, __recv_timeout_handler, (gpointer) r_info);
g_source_add_poll(src, gpollfd);
g_source_set_callback(src, (GSourceFunc) __reply_handler,
{
int dummy;
int ret;
+ char *appid = NULL;
+ const char *pkgid = NULL;
+ const char *type = NULL;
+ const struct appinfo *ai = NULL;
+
+ appid = _status_app_get_appid_bypid(pid);
+ ai = appinfo_find(_laf, appid);
+ pkgid = appinfo_get_value(ai, AIT_PKGID);
+ type = appinfo_get_value(ai, AIT_COMPTYPE);
+ aul_send_app_terminate_request_signal(pid, appid, pkgid, type);
if ( (ret = __app_send_raw_with_noreply(pid, APP_TERM_BY_PID_ASYNC,
(unsigned char *)&dummy, sizeof(int))) < 0) {
_E("terminate packet send error - use SIGKILL");
root_win = ecore_x_window_root_first_get();
SECURE_LOGD("path : %s", image_file);
- ecore_x_window_prop_string_set(root_win, ATOM_IMAGE_EFFECT,image_file);
+ ecore_x_window_prop_string_set(root_win, ATOM_IMAGE_EFFECT, image_file);
}
static void __amd_send_message_to_e17(int screenmode, const char * indicator, int effect_type, int theme)
{
+ traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "AUL:AMD:EFFECT_START");
Ecore_X_Window root_win;
int ret;
- if(!_window_is_initialized())
+ if (!_window_is_initialized()) {
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
return;
+ }
root_win = ecore_x_window_root_first_get();
_D("root win : %x",root_win);
if (screenmode > 4 || screenmode < 0)
screenmode=0;
- if (strncmp(indicator, "true", 4) == 0){
+ if (strncmp(indicator, "true", 4) == 0) {
_D("[LAUNCHING EFFECT]: screen mode(%d), effect type(%d), theme(%d), indicator show",
screen_orientation[screenmode], effect_type, theme);
ret = ecore_x_client_message32_send (root_win, ATOM_IMAGE_EFFECT,
screen_orientation[screenmode],
SHOW_INDICATOR, theme, 0);
- }else{
+ } else {
_D("[LAUNCHING EFFECT]: screen mode(%d), effect type(%d), theme(%d), indicator show",
screen_orientation[screenmode], effect_type, theme);
ret = ecore_x_client_message32_send (root_win, ATOM_IMAGE_EFFECT,
}
ecore_x_flush();
_D("ecore_x_client_message32_send : %d",ret);
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
}
#endif
}
#endif
+static gboolean __fg_timeout_handler(gpointer data)
+{
+ struct fgmgr *fg = data;
+
+ if (!fg)
+ return FALSE;
+
+ _status_update_app_info_list(fg->pid, STATUS_BG, TRUE);
+
+ _fgmgr_list = g_list_remove(_fgmgr_list, fg);
+ free(fg);
+
+ return FALSE;
+}
+
+static void __add_fgmgr_list(int pid)
+{
+ struct fgmgr *fg;
+
+ fg = calloc(1, sizeof(struct fgmgr));
+ if (!fg)
+ return;
+
+ fg->pid = pid;
+ fg->tid = g_timeout_add(5000, __fg_timeout_handler, fg);
+
+ _fgmgr_list = g_list_append(_fgmgr_list, fg);
+}
+
+static void __del_fgmgr_list(int pid)
+{
+ GList *iter = NULL;
+ struct fgmgr *fg;
+
+ if (pid < 0)
+ return;
+
+ for (iter = _fgmgr_list; iter != NULL; iter = g_list_next(iter)) {
+ fg = (struct fgmgr *)iter->data;
+ if (fg->pid == pid) {
+ g_source_remove(fg->tid);
+ _fgmgr_list = g_list_remove(_fgmgr_list, fg);
+ free(fg);
+ return;
+ }
+ }
+}
+
#ifdef _APPFW_FEATURE_EXPANSION_PKG_INSTALL
static int __tep_mount(char *mnt_path[])
{
if (api_ver && strverscmp("2.4", api_ver) < 1) { // ver 2.4 or later
ret = security_server_check_privilege_by_pid(caller_pid, "privilege::tizen::download", "rw");
if (ret != SECURITY_SERVER_API_SUCCESS) {
- _E("caller %d violates http://tizen.org/privilege/download privilege", caller_pid);
+ _E("caller %d violates http://tizen.org/privilege/download privilege (%d)", caller_pid, ret);
return -EILLEGALACCESS;
}
}
// Check the privilege for call operation
ret = security_server_check_privilege_by_pid(caller_pid, "privilege::tizen::call", "rw");
if (ret != SECURITY_SERVER_API_SUCCESS) {
- _E("caller %d violates http://tizen.org/privilege/call privilege", caller_pid);
+ _E("caller %d violates http://tizen.org/privilege/call privilege (%d)", caller_pid, ret);
return -EILLEGALACCESS;
}
}
_status_add_shared_info(pid, caller_exec_label, paths);
}
+#ifdef _APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP
+#ifdef _APPFW_FEATURE_SEND_HOME_LAUNCH_SIGNAL
+static void __check_home_app(int pid)
+{
+ const char *home_app = _get_home_appid();
+ const char *appid = NULL;
+
+ if (home_app == NULL)
+ return;
+
+ appid = _status_app_get_appid_bypid(pid);
+
+ if (appid && strcmp(appid, home_app) == 0) {
+ int cnt = 0;
+ int *pids = NULL;
+ int i;
+ const char *taskmanage = NULL;
+ const struct appinfo *ai = NULL;
+ const char* bg = NULL;
+
+ app_group_get_leader_pids(&cnt, &pids);
+ if (pids) {
+ for (i = 0; i < cnt; ++i) {
+ appid = _status_app_get_appid_bypid(pids[i]);
+ if (appid == NULL || strcmp(appid, home_app) == 0)
+ continue;
+
+ ai = appinfo_find(_laf, appid);
+ taskmanage = appinfo_get_value(ai, AIT_TASKMANAGE);
+ bg = appinfo_get_value(ai, AIT_ALLOWED_BG);
+
+ if (taskmanage && strcmp("false", taskmanage) == 0
+ && bg && strcmp("NONE", bg) == 0) {
+ int st = _status_get_app_info_status(pids[i]);
+ if (st != STATUS_DYING) {
+ _W("terminate %d %s %d", pids[i], appid, st);
+ aul_update_freezer_status(pids[i], "wakeup");
+ _term_sub_app(pids[i]);
+ }
+ }
+ }
+
+ free(pids);
+ }
+ }
+}
+#endif
+#endif
+
int _revoke_temporary_permission(int pid)
{
GList *list = _status_get_shared_info_list(pid);
return pid;
}
- if (found_pid != -1)
+ if (found_pid != -1) {
+ _W("app_group_clear_top, pid: %d", found_pid);
app_group_clear_top(found_pid);
+ }
}
if (pid == -1 && can_attach)
if (__grant_temporary_permission(caller_pid, appid, kb,
&caller_exec_label, &callee_exec_label, &paths) == 0)
grant_permission = 1;
+
status = _status_get_app_info_status(pid);
if (pid > 0 && status != STATUS_DYING) {
if (caller_pid == pid) {
if (new_process) {
_D("add app group info");
app_group_start_app(pid, kb, lpid, can_attach, launch_mode);
+
+ if (component_type && strncmp(component_type, APP_TYPE_UI, strlen(APP_TYPE_UI)) == 0)
+ __add_fgmgr_list(pid);
} else if (cmd == APP_START
|| cmd == APP_START_RES
|| cmd == APP_START_ASYNC
) {
app_group_restart_app(pid, kb);
}
+
#ifdef _APPFW_FEATURE_AMD_KEY
grab_timer_id = g_timeout_add(1000, __grab_timeout_handler, (void *)pid);
#endif
if ((ret = __nofork_processing(cmd, pid, kb, fd)) < 0) {
pid = ret;
+ } else {
+ delay_reply = 1;
}
} else if (cmd != APP_RESUME) {
#ifdef _APPFW_FEATURE_AMD_MODULE_LOG
#ifdef _APPFW_FEATURE_APP_CHECKER
pkg_type = appinfo_get_value(ai, AIT_TYPE);
- if (!pkg_type)
+ if (!pkg_type) {
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
return -1;
+ }
ret = ac_server_check_launch_privilege(appid, pkg_type, pid);
if (ret != AC_R_ERROR) {
int __e17_status_handler(int pid, int status, void *data)
{
if (status == PROC_STATUS_FG) {
+ __del_fgmgr_list(pid);
+
#ifdef _APPFW_FEATURE_AMD_KEY
_D("pid(%d) status(%d)", pid, status);
if(_input_window_get() != 0)
}
g_source_remove(grab_timer_id);
#endif
-
- _status_update_app_info_list(pid, STATUS_VISIBLE);
+ _status_update_app_info_list(pid, STATUS_VISIBLE, FALSE);
+#ifdef _APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP
+#ifdef _APPFW_FEATURE_SEND_HOME_LAUNCH_SIGNAL
+ __check_home_app(pid);
+#endif
+#endif
} else if (status == PROC_STATUS_BG) {
- _status_update_app_info_list(pid, STATUS_BG);
+ _status_update_app_info_list(pid, STATUS_BG, FALSE);
+ } else if (status == PROC_STATUS_LAUNCH) {
+ _D("pid(%d) status(%d)", pid, status);
+ traceBegin(TTRACE_TAG_APPLICATION_MANAGER, "AUL:AMD:EFFECT_DONE");
+ traceEnd(TTRACE_TAG_APPLICATION_MANAGER);
}
return 0;
char trm_buf[MAX_PACKAGE_STR_SIZE];
char buf[MAX_LOCAL_BUFSZ];
- _I("__app_dead_handler, pid: %d", pid);
+ _W("__app_dead_handler, pid: %d", pid);
if(pid <= 0)
return 0;
#endif
if (app_group_is_leader_pid(pid)) {
+ _W("app_group_leader_app, pid: %d", pid);
if (app_group_find_second_leader(pid) == -1) {
app_group_clear_top(pid);
app_group_set_dead_pid(pid);
} else
app_group_remove_leader_pid(pid);
} else if (app_group_is_sub_app(pid)) {
- if (app_group_can_reroute(pid))
+ _W("app_group_sub_app, pid: %d", pid);
+ int caller_pid = app_group_get_next_caller_pid(pid);
+
+ if (app_group_can_reroute(pid) || (caller_pid > 0 && caller_pid != pid)) {
+ _W("app_group reroute");
app_group_reroute(pid);
- else
+ } else {
+ _W("app_group clear top");
app_group_clear_top(pid);
+ }
app_group_set_dead_pid(pid);
app_group_remove(pid);
}
ecore_x_init(NULL);
_set_atom_effect();
-#ifndef __i386__
_key_init();
-#endif
window_initialized = 1;
}
static int __send_result_to_client(int fd, int res)
{
+ if (fd < 0)
+ return -1;
+
_W("__send_result_to_client, pid: %d", res);
if (send(fd, &res, sizeof(int), MSG_NOSIGNAL) < 0) {
static void __real_send(int clifd, int ret)
{
- if(clifd <= 0) {
+ if(clifd < 0)
return;
- }
+
if (send(clifd, &ret, sizeof(int), MSG_NOSIGNAL) < 0) {
if (errno == EPIPE) {
_E("send failed due to EPIPE.\n");
char buf[512];
if (_status_get_pkgname_bypid(pid, buf, 512) == -1) {
_E("request for unknown pid. It might not be a pid of app: %d", pid);
+ __real_send(clifd, -1);
return -1;
}
}
ret = _start_app(appid, kb, pkt->cmd, cr.pid, cr.uid, clifd);
#endif
- if(ret > 0 && bundle_get_type(kb, AUL_K_PRELAUCHING) == BUNDLE_TYPE_NONE) {
+ if (ret > 0 && bundle_get_type(kb, AUL_K_PRELAUCHING) == BUNDLE_TYPE_NONE) {
#ifdef _APPFW_FEATURE_BG_PROCESS_LIMIT
if (!app_group_is_group_app(kb)) {
item_pkt_t *item = g_malloc0(sizeof(item_pkt_t));
ret = _start_app(appid, kb, pkt->cmd, cr.pid, cr.uid, clifd);
}
- if(ret > 0) {
+ if (ret > 0) {
#ifdef _APPFW_FEATURE_BG_PROCESS_LIMIT
if (!app_group_is_group_app(kb)) {
item_pkt_t *item = g_malloc0(sizeof(item_pkt_t));
case APP_RESULT:
case APP_CANCEL:
ret = __foward_cmd(pkt->cmd, kb, cr.pid);
- //__real_send(clifd, ret);
close(clifd);
break;
case APP_PAUSE:
term_pid = (char *)bundle_get_val(kb, AUL_K_PKG_NAME);
appid = _status_app_get_appid_bypid(atoi(term_pid));
ai = appinfo_find(_raf, appid);
- if(ai) {
+ if (ai) {
appinfo_set_value((struct appinfo *)ai, AIT_STATUS, "norestart");
ret = __app_process_by_pid(pkt->cmd, term_pid, &cr, clifd);
} else {
ret = -1;
- close(clifd);
+ __send_result_to_client(clifd, ret);
}
}
break;
ai = appinfo_find(_raf, appid);
appinfo_set_value((struct appinfo *)ai, AIT_STATUS, "norestart");
} else {
- ret = _status_update_app_info_list(cr.pid, *status);
+ ret = _status_update_app_info_list(cr.pid, *status, FALSE);
}
- //__send_result_to_client(clifd, ret);
close(clifd);
break;
case APP_GET_STATUS:
return 0;
}
+#ifdef _APPFW_FEATURE_SEND_HOME_LAUNCH_SIGNAL
+const char* _get_home_appid(void)
+{
+ return home_appid;
+}
+#endif
int _send_set_process_group_signal_signal(int owner_pid, int child_pid);
int _signal_block_sigchld(void);
int _signal_unblock_sigchld(void);
+#ifdef _APPFW_FEATURE_SEND_HOME_LAUNCH_SIGNAL
+const char* _get_home_appid(void);
+#endif
#endif
struct appinfomgr *_saf = NULL;
#ifdef _APPFW_FEATURE_AMD_MODULE_LOG
-#define AMD_LOG_BUFFER_SIZE 10000
-#define AMD_LOG_BUFFER_STRING_SIZE 128
-#define AMD_LOG_FILE "/var/log/amd.log"
+#define AMD_LOG_BUFFER_SIZE 10000
+#define AMD_LOG_BUFFER_STRING_SIZE 128
+#define AMD_LOG_FILE "/var/log/amd.log"
static int log_index = 0;
static int log_fd = 0;
#endif
+static int __send_result_to_client(int clifd, int res)
+{
+ if (clifd < 0)
+ return -1;
+
+ if (send(clifd, &res, sizeof(int), MSG_NOSIGNAL) < 0) {
+ if (errno == EPIPE)
+ _E("send failed due to EPIPE.\n");
+ _E("send fail to client");
+ }
+
+ close(clifd);
+
+ return 0;
+}
+
static app_status_info_t* __get_app_status_info(int pid)
{
GSList *iter = NULL;
return ECORE_CALLBACK_CANCEL;
}
-int _status_update_app_info_list(int pid, int status)
+int _status_update_app_info_list(int pid, int status, gboolean force)
{
GSList *iter = NULL;
app_status_info_t *info_t = NULL;
}
}
- app_group_set_status(pid, status);
+ app_group_set_status(pid, status, force);
return 0;
}
app_pkt_t *pkt = NULL;
char tmp_pid[MAX_PID_STR_BUFSZ];
- pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
- if(!pkt) {
+ pkt = (app_pkt_t *)malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
+ if (!pkt) {
_E("malloc fail");
- return 0;
+ __send_result_to_client(fd, -1);
+ return -1;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);
_E("send fail to client");
}
- if(pkt)
+ if (pkt)
free(pkt);
close(fd);
app_pkt_t *pkt = NULL;
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
- if(!pkt) {
+ if (!pkt) {
_E("malloc fail");
- close(fd);
- return 0;
+ __send_result_to_client(fd, -1);
+ return -1;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);
_E("send fail to client");
}
- if(pkt)
+ if (pkt)
free(pkt);
close(fd);
char *cmdline;
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
- if(!pkt) {
+ if (!pkt) {
_E("malloc fail");
close(fd);
return 0;
char buf[2048];
pkt = (app_pkt_t *) malloc(sizeof(char) * AUL_SOCK_MAXBUFF);
- if(!pkt) {
+ if (!pkt) {
_E("malloc fail");
- return 0;
+ __send_result_to_client(fd, -1);
+ return -1;
}
memset(pkt, 0, AUL_SOCK_MAXBUFF);
_E("send fail to client");
}
- if(pkt)
+ if (pkt)
free(pkt);
close(fd);
int _status_add_app_info_list(const char *appid, const char *app_path,
const char *caller, int pid, int pad_pid, int is_subapp);
-int _status_update_app_info_list(int pid, int status);
+int _status_update_app_info_list(int pid, int status, gboolean force);
int _status_update_app_info_caller_pid(int pid, int caller_pid);
int _status_get_app_info_last_caller_pid(int pid);
int _status_remove_app_info_list(int pid);
*/
int aul_listen_app_launch_signal(int (*func) (int, void *), void *data);
+int aul_listen_app_launch_signal_v2(int (*func) (int, const char *, void *), void *data);
+
int aul_listen_booting_done_signal(int (*func) (int, void *), void *data);
int aul_listen_cooldown_signal(int (*func) (const char *, void *), void *data);
%define appfw_feature_data_control 1
%define appfw_feature_debug_launchpad 1
%define appfw_feature_app_control_lite 0
+%define appfw_feature_terminate_unmanageable_app 0
%if "%{?tizen_profile_name}" == "wearable"
%define appfw_feature_bg_process_limit 0
%define appfw_feature_app_checker 0
%if 0%{?appfw_feature_private_service}
_APPFW_FEATURE_PRIVATE_SERVICE=ON
%endif
-
+%if 0%{?appfw_feature_terminate_unmanageable_app}
+_APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP=ON
+%endif
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} \
-D_APPFW_FEATURE_PROCESS_POOL:BOOL=${_APPFW_FEATURE_PROCESS_POOL} \
-D_APPFW_FEATURE_FAKE_EFFECT:BOOL=${_APPFW_FEATURE_FAKE_EFFECT} \
-D_APPFW_FEATURE_EFFECTIVE_APPID:BOOL=${_APPFW_FEATURE_EFFECTIVE_APPID} \
-D_APPFW_FEATURE_PRIVATE_SERVICE:BOOL=${_APPFW_FEATURE_PRIVATE_SERVICE} \
+ -D_APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP:BOOL=${_APPFW_FEATURE_TERMINATE_UNMANAGEABLE_APP} \
.
make %{?jobs:-j%jobs}
static int (*_app_launch_handler) (int pid, void *data);
static void *_app_launch_data;
+static int (*_app_launch_handler2) (int pid, const char *app_id, void *data);
+static void *_app_launch_data2;
+
static int (*_booting_done_handler) (int pid, void *data);
static void *_booting_done_data;
if (dbus_message_is_signal(
message, interface, AUL_DBUS_APPDEAD_SIGNAL)) {
- if (dbus_message_get_args(message, &error, DBUS_TYPE_UINT32,
- &pid, DBUS_TYPE_INVALID) == FALSE) {
- _E("Failed to get data: %s", error.message);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- if (_app_dead_handler)
+ if (_app_dead_handler) {
+ if (dbus_message_get_args(message, &error,
+ DBUS_TYPE_UINT32, &pid,
+ DBUS_TYPE_INVALID) == FALSE) {
+ _E("Failed to get data: %s", error.message);
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
_app_dead_handler(pid, _app_dead_data);
+ }
} else if (dbus_message_is_signal(
message, interface, AUL_DBUS_APPLAUNCH_SIGNAL)) {
- if (dbus_message_get_args(message, &error, DBUS_TYPE_UINT32,
- &pid, DBUS_TYPE_INVALID) == FALSE) {
- _E("Failed to get data: %s", error.message);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ if (_app_launch_handler || _app_launch_handler2) {
+ const char *app_id = NULL;
+
+ if (dbus_message_get_args(message, &error,
+ DBUS_TYPE_UINT32, &pid,
+ DBUS_TYPE_STRING, &app_id,
+ DBUS_TYPE_INVALID) == FALSE) {
+ _E("Failed to get data: %s", error.message);
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
+
+ if (_app_launch_handler)
+ _app_launch_handler(pid, _app_launch_data);
+
+ if (_app_launch_handler2)
+ _app_launch_handler2(pid, app_id, _app_launch_data2);
}
- if (_app_launch_handler)
- _app_launch_handler(pid, _app_launch_data);
} else if (dbus_message_is_signal(
message, interface, SYSTEM_SIGNAL_BOOTING_DONE)) {
if (_booting_done_handler)
_booting_done_handler(pid, _booting_done_data);
} else if (dbus_message_is_signal(
message, interface, RESOURCED_SIGNAL_PROCESS_STATUS)) {
- if (dbus_message_get_args(message, &error, DBUS_TYPE_INT32,&status,
- DBUS_TYPE_INT32,&pid, DBUS_TYPE_INVALID) == FALSE) {
- _E("Failed to get data: %s", error.message);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- if (_status_handler)
+ if (_status_handler) {
+ if (dbus_message_get_args(message, &error,
+ DBUS_TYPE_INT32,&status,
+ DBUS_TYPE_INT32,&pid,
+ DBUS_TYPE_INVALID) == FALSE) {
+ _E("Failed to get data: %s", error.message);
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
_status_handler(pid, status, _status_data);
+ }
} else if (dbus_message_is_signal(
message, interface, SYSTEM_SIGNAL_COOLDOWN_CHANGED)) {
- if (dbus_message_get_args(message, &error, DBUS_TYPE_STRING, &cooldown_status,
- DBUS_TYPE_INVALID) == FALSE) {
- _E("Failed to get data: %s", error.message);
- dbus_error_free(&error);
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
- if (_cooldown_handler)
+ if (_cooldown_handler) {
+ if (dbus_message_get_args(message, &error,
+ DBUS_TYPE_STRING, &cooldown_status,
+ DBUS_TYPE_INVALID) == FALSE) {
+ _E("Failed to get data: %s", error.message);
+ dbus_error_free(&error);
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
_cooldown_handler(cooldown_status, _cooldown_data);
+ }
}
return DBUS_HANDLER_RESULT_HANDLED;
_E("error app signal init");
return AUL_R_ERROR;
}
- } else if (_app_launch_handler == NULL) {
+ } else if (_app_launch_handler == NULL && _app_launch_handler2 == NULL) {
if (__app_dbus_signal_handler_fini() < 0) {
_E("error app signal fini");
return AUL_R_ERROR;
_E("error app signal init");
return AUL_R_ERROR;
}
- } else if (_app_dead_handler == NULL) {
+ } else if (_app_launch_handler2 == NULL && _app_dead_handler == NULL) {
if (__app_dbus_signal_handler_fini() < 0) {
_E("error app signal fini");
return AUL_R_ERROR;
return AUL_R_OK;
}
+SLPAPI int aul_listen_app_launch_signal_v2(int (*func) (int, const char *, void *), void *data)
+{
+ if (func) {
+ if (__app_dbus_signal_handler_init() < 0) {
+ _E("error app signal init");
+ return AUL_R_ERROR;
+ }
+ } else if (_app_launch_handler == NULL && _app_dead_handler == NULL) {
+ if (__app_dbus_signal_handler_fini() < 0) {
+ _E("error app signal fini");
+ return AUL_R_ERROR;
+ }
+ }
+
+ _app_launch_handler2 = func;
+ _app_launch_data2 = data;
+
+ return AUL_R_OK;
+}
+
SLPAPI int aul_listen_booting_done_signal(int (*func) (int, void *), void *data)
{
if (func) {
dbus_error_init(&err);
+ _W("send_update_freezer_status, pid: %d, type: %s", pid, type);
+
conn = dbus_bus_get(DBUS_BUS_SYSTEM, &err);
if (!conn) {
_E("Fail to dbus_bus_get : %s", err.message);
ret = -1;
}
- _D("Send a freezer signal pid: %d, type: %s", pid, type);
-
if (!dbus_connection_send(conn, msg, &serial)) {
_E("Failed to send a D-Bus Message.");
ret = -1;
__app_status_dbus_init();
+ _W("send_app_launch_signal, pid: %d, appid: %s", pid, appid);
+
msg = dbus_message_new_signal(AUL_APP_STATUS_DBUS_PATH,
AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE,
AUL_APP_STATUS_DBUS_LAUNCH_REQUEST);
__app_status_dbus_init();
+ _W("send_app_resume_signal, pid: %d, appid: %s", pid, appid);
+
msg = dbus_message_new_signal(AUL_APP_STATUS_DBUS_PATH,
AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE,
AUL_APP_STATUS_DBUS_RESUME_REQUEST);
int ret = -1;
+ _W("send_app_status_change_signal, pid: %d, appid: %s, status: %s", pid, appid, status);
+
__app_status_dbus_init();
msg = dbus_message_new_signal(AUL_APP_STATUS_DBUS_PATH,
int ret = -1;
+ _W("send_app_group_signal, owner: %d, child: %d", owner_pid, child_pid);
+
__app_status_dbus_init();
msg = dbus_message_new_signal(AUL_APP_STATUS_DBUS_PATH,
return ret;
}
-