#define AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE "org.tizen.aul.AppStatus"
#define AUL_APP_STATUS_BUS_NAME AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE
+#define AUL_APP_STATUS_DBUS_LAUNCH_REQUEST "AppLaunch"
+#define AUL_APP_STATUS_DBUS_LAUNCH_REQUEST_TYPE "(isss)"
+#define AUL_APP_STATUS_DBUS_TERMINATE_REQUEST "AppTerminate"
+#define AUL_APP_STATUS_DBUS_TERMINATE_REQUEST_TYPE "(isss)"
#define AUL_APP_STATUS_DBUS_STATUS_CHANGE "AppStatusChange"
#define AUL_APP_STATUS_DBUS_STATUS_CHANGE_TYPE "(issss)"
pid_t pid;
stc_cmd_type_e status;
stc_app_type_e apptype;
- gchar *appid, *pkgid, *statstr, *pkgtype;
-
- if (g_strcmp0(g_variant_get_type_string(parameters),
- AUL_APP_STATUS_DBUS_STATUS_CHANGE_TYPE)) {
- STC_LOGE("Dbus type not matching, do not process");
- return;
- }
-
- g_variant_get(parameters, AUL_APP_STATUS_DBUS_STATUS_CHANGE_TYPE,
+ gchar *appid = NULL;
+ gchar *pkgid = NULL;
+ gchar *statstr = NULL;
+ gchar *pkgtype = NULL;
+
+ if (g_strcmp0(signal_name, AUL_APP_STATUS_DBUS_LAUNCH_REQUEST) == 0) {
+ if (g_strcmp0(g_variant_get_type_string(parameters),
+ AUL_APP_STATUS_DBUS_LAUNCH_REQUEST_TYPE)) {
+ STC_LOGE("Dbus type not matching, do not process");
+ return;
+ }
+
+ g_variant_get(parameters, AUL_APP_STATUS_DBUS_LAUNCH_REQUEST_TYPE,
+ &pid, &appid, &pkgid, &pkgtype);
+
+ status = STC_CMD_SET_APP_LAUNCHED;
+
+ if (!strncmp(pkgtype, "svc", 3))
+ apptype = STC_APP_TYPE_SERVICE;
+ else if (!strncmp(pkgtype, "widget", 6))
+ apptype = STC_APP_TYPE_WIDGET;
+ else if (!strncmp(pkgtype, "watch", 5))
+ apptype = STC_APP_TYPE_WATCH;
+ else
+ apptype = STC_APP_TYPE_GUI;
+
+ if (STC_STAT_LOG) {
+ STC_LOGD("APP STATUS[\033[1;34mlaunch\033[0;m] PkgID[\033[0;34m%s\033[0;m] "
+ "AppID[\033[0;32m%s\033[0;m] PID[\033[1;33m%d\033[0;m] Type[%s]",
+ pkgid, appid, pid, pkgtype);
+ }
+
+ if (state_changed_cb)
+ state_changed_cb(status, pid, appid, pkgid, apptype);
+ } else if (g_strcmp0(signal_name, AUL_APP_STATUS_DBUS_TERMINATE_REQUEST) == 0) {
+ if (g_strcmp0(g_variant_get_type_string(parameters),
+ AUL_APP_STATUS_DBUS_TERMINATE_REQUEST_TYPE)) {
+ STC_LOGE("Dbus type not matching, do not process");
+ return;
+ }
+
+ g_variant_get(parameters, AUL_APP_STATUS_DBUS_TERMINATE_REQUEST_TYPE,
+ &pid, &appid, &pkgid, &pkgtype);
+
+ status = STC_CMD_SET_TERMINATED;
+
+ if (!strncmp(pkgtype, "svc", 3))
+ apptype = STC_APP_TYPE_SERVICE;
+ else if (!strncmp(pkgtype, "widget", 6))
+ apptype = STC_APP_TYPE_WIDGET;
+ else if (!strncmp(pkgtype, "watch", 5))
+ apptype = STC_APP_TYPE_WATCH;
+ else
+ apptype = STC_APP_TYPE_GUI;
+
+ if (STC_STAT_LOG) {
+ STC_LOGD("APP STATUS[\033[1;34mterminate\033[0;m] PkgID[\033[0;34m%s\033[0;m] "
+ "AppID[\033[0;32m%s\033[0;m] PID[\033[1;33m%d\033[0;m] Type[%s]",
+ pkgid, appid, pid, pkgtype);
+ }
+
+ if (state_changed_cb)
+ state_changed_cb(status, pid, appid, pkgid, apptype);
+ } else if (g_strcmp0(signal_name, AUL_APP_STATUS_DBUS_STATUS_CHANGE) == 0) {
+ if (g_strcmp0(g_variant_get_type_string(parameters),
+ AUL_APP_STATUS_DBUS_STATUS_CHANGE_TYPE)) {
+ STC_LOGE("Dbus type not matching, do not process");
+ return;
+ }
+
+ g_variant_get(parameters, AUL_APP_STATUS_DBUS_STATUS_CHANGE_TYPE,
&pid, &appid, &pkgid, &statstr, &pkgtype);
- if (!strncmp(statstr, "fg", 2)) {
- status = STC_CMD_SET_FOREGRD;
- } else if (!strncmp(statstr, "bg", 2)) {
- status = STC_CMD_SET_BACKGRD;
- } else {
- goto out;
- }
-
- if (!strncmp(pkgtype, "svc", 3))
- apptype = STC_APP_TYPE_SERVICE;
- else if (!strncmp(pkgtype, "widget", 6))
- apptype = STC_APP_TYPE_WIDGET;
- else if (!strncmp(pkgtype, "watch", 5))
- apptype = STC_APP_TYPE_WATCH;
- else
- apptype = STC_APP_TYPE_GUI;
-
- if (STC_STAT_LOG) {
- STC_LOGD("\033[1;34mAPP STATUS\033[0;m: PkgID[\033[0;34m%s\033[0;m] "
- "AppID[\033[0;32m%s\033[0;m] PID[\033[1;33m%d\033[0;m] Status[%s] Type[%s]",
- pkgid, appid, pid, statstr, pkgtype);
+ if (!strncmp(statstr, "fg", 2)) {
+ status = STC_CMD_SET_FOREGRD;
+ } else if (!strncmp(statstr, "bg", 2)) {
+ status = STC_CMD_SET_BACKGRD;
+ } else {
+ goto out;
+ }
+
+ if (!strncmp(pkgtype, "svc", 3))
+ apptype = STC_APP_TYPE_SERVICE;
+ else if (!strncmp(pkgtype, "widget", 6))
+ apptype = STC_APP_TYPE_WIDGET;
+ else if (!strncmp(pkgtype, "watch", 5))
+ apptype = STC_APP_TYPE_WATCH;
+ else
+ apptype = STC_APP_TYPE_GUI;
+
+ if (STC_STAT_LOG) {
+ STC_LOGD("APP STATUS[\033[1;34m%s\033[0;m] PkgID[\033[0;34m%s\033[0;m] "
+ "AppID[\033[0;32m%s\033[0;m] PID[\033[1;33m%d\033[0;m] Type[%s]",
+ (status == STC_CMD_SET_FOREGRD) ? "Foregrd" : "Backgrd", pkgid, appid, pid, pkgtype);
+ }
+
+ if (state_changed_cb)
+ state_changed_cb(status, pid, appid, pkgid, apptype);
}
- if (state_changed_cb)
- state_changed_cb(status, pid, appid, pkgid, apptype);
-
out:
FREE(appid);
FREE(pkgid);
0,
AUL_APP_STATUS_DBUS_PATH,
AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE,
+ AUL_APP_STATUS_DBUS_LAUNCH_REQUEST,
+ AUL_APP_STATUS_DBUS_LAUNCH_REQUEST_TYPE,
+ __stc_gdbus_handle_aul_changestate,
+ NULL
+ },
+ {
+ 0,
+ AUL_APP_STATUS_DBUS_PATH,
+ AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE,
+ AUL_APP_STATUS_DBUS_TERMINATE_REQUEST,
+ AUL_APP_STATUS_DBUS_TERMINATE_REQUEST_TYPE,
+ __stc_gdbus_handle_aul_changestate,
+ NULL
+ },
+ {
+ 0,
+ AUL_APP_STATUS_DBUS_PATH,
+ AUL_APP_STATUS_DBUS_SIGNAL_INTERFACE,
AUL_APP_STATUS_DBUS_STATUS_CHANGE,
AUL_APP_STATUS_DBUS_STATUS_CHANGE_TYPE,
__stc_gdbus_handle_aul_changestate,
if (STC_STAT_LOG)
STC_LOGD("\033[1;32mFORK\033[0;m: tgid[\033[1;33m%d\033[0;m] "
- "ppid=[%s] cmdline[\033[0;34m%s\033[0;m] pid[%d]",
+ "ppid[%s] cmdline[\033[0;34m%s\033[0;m] pid[%d]",
tgid, status[PROC_STATUS_PPID], cmdline, pid);
__proc_tree_add(&key, &value);
switch (cmd) {
case STC_CMD_SET_FOREGRD:
{
- uint32_t fg_classid;
- uint32_t bg_classid;
- char *bg_app_id;
+ uint32_t fg_classid = STC_UNKNOWN_CLASSID;
+ uint32_t bg_classid = STC_UNKNOWN_CLASSID;
+ char *bg_app_id = NULL;
stc_app_value_s app_value;
stc_proc_value_s proc_value;
}
case STC_CMD_SET_BACKGRD:
{
- uint32_t bg_classid;
- uint32_t fg_classid;
- char *bg_app_id;
+ uint32_t bg_classid = STC_UNKNOWN_CLASSID;
+ uint32_t fg_classid = STC_UNKNOWN_CLASSID;
+ char *bg_app_id = NULL;
stc_app_value_s app_value;
stc_proc_value_s proc_value;
FREE(bg_app_id);
break;
}
+ case STC_CMD_SET_APP_LAUNCHED:
+ {
+ uint32_t classid = STC_UNKNOWN_CLASSID;
+ stc_app_value_s app_value;
+ stc_proc_value_s proc_value;
+
+ memset(&app_value, 0, sizeof(stc_app_value_s));
+ memset(&proc_value, 0, sizeof(stc_proc_value_s));
+
+ classid = get_classid_by_app_id(app_id, FALSE);
+
+ app_value.type = app_type;
+ app_value.state = STC_APP_STATE_FOREGROUND;
+ app_value.processes = NULL;
+
+ proc_value.pid = pid;
+ proc_value.ground = STC_APP_STATE_FOREGROUND;
+
+ stc_plugin_monitor_add_app(classid, app_id, pkg_id, app_value);
+ stc_plugin_monitor_add_proc(classid, app_id, proc_value);
+
+ break;
+ }
case STC_CMD_SET_SERVICE_LAUNCHED:
{
- uint32_t classid;
- char *bg_app_id;
+ uint32_t classid = STC_UNKNOWN_CLASSID;
+ char *bg_app_id = NULL;
stc_app_value_s app_value;
stc_proc_value_s proc_value;
gboolean is_exist;
}
case STC_CMD_SET_TERMINATED:
{
- uint32_t classid;
- char *bg_app_id;
+ uint32_t classid = STC_UNKNOWN_CLASSID;
+ char *bg_app_id = NULL;
- bg_app_id = g_strconcat(app_id, STC_BACKGROUND_APP_SUFFIX, NULL);
- classid = get_classid_by_app_id(bg_app_id, FALSE);
+ if (app_type == STC_APP_TYPE_NONE) {
+ bg_app_id = g_strconcat(app_id, STC_BACKGROUND_APP_SUFFIX, NULL);
+ classid = get_classid_by_app_id(bg_app_id, FALSE);
+ }
if (classid == STC_UNKNOWN_CLASSID)
- classid = get_classid_by_app_id(app_id, FALSE);
+ classid = get_classid_by_app_id(bg_app_id, FALSE);
stc_plugin_monitor_remove_proc(classid, pid);