#define WATCHDOG_VALUE_1 "watchdog"
#define TIZEN_DEBUG_MODE_FILE RD_SYS_ETC"/.debugmode"
+#define DEFAULT_APPID "NULL"
#define INIT_PID 1
#define INIT_PROC_VAL -1
g_dbus_method_invocation_return_value(invocation, g_variant_new("(i)", -1));
}
+static void dbus_get_checkappstatus(GDBusMethodInvocation *invocation, GVariant *params)
+{
+ int len;
+ int detect = 0;
+ struct proc_app_info *pai;
+ char *appid = DEFAULT_APPID;
+ char *type = NULL;
+ pid_t pid = -1;
+
+ do_expr_unless_g_variant_get_typechecked(goto null_reply, params, "(i&s)", &pid, &type);
+ if (pid < 0 || type == NULL) {
+ _D("there is no message");
+ goto null_reply;
+ }
+
+ pai = find_app_info(pid);
+ if (!pai) {
+ _D("There is no appid %d", pid);
+ goto response;
+ }
+
+ /*
+ * allowed strings: normal, lcddim, lcdoff
+ * normal & lcddim : allow only UI application
+ * lcdoff : allow if it sends the excluding dbus signal
+ */
+ len = strlen(type);
+
+ if (len != 6) {
+ _D("wrong lock type : %s", type);
+ goto response;
+ }
+
+ appid = pai->appid;
+ if (pai->watchdog_exclude || pai->runtime_exclude) {
+ _E("application (%d, %s) used %s lock longly but it is excluded", pid, appid, type);
+ goto response;
+ }
+
+ if (!strncmp(type, "norm", 4) || !strncmp(type, "lcdd", 4)) {
+ if (pai->type == PROC_TYPE_SERVICE || pai->type == PROC_TYPE_READY ||
+ pai->type == PROC_TYPE_NONE)
+ detect = 1;
+ } else if (!strncmp(type, "lcdo", 4)) {
+ detect = 1;
+ }
+
+ if (detect)
+ _E("detect application locking %s lock longly : %d, %s", type, pid, appid);
+ else
+ _D("application locking %s lock longly but it seems normal : %d, %s", type, pid, appid);
+
+response:
+ g_dbus_method_invocation_return_value(invocation, g_variant_new("(iis)",
+ pid, detect, appid));
+ return;
+
+null_reply:
+ D_BUS_REPLY_NULL(invocation);
+}
+
static void proc_dbus_active_signal_handler(GVariant *params)
{
int type;
" <arg type='ai' name='ProcList' direction='in'/>"
" <arg type='a(ii)' name='CpuUsage' direction='out'/>"
" </method>"
+" <method name='CheckAppStatus'>"
+" <arg type='i' name='Pid' direction='in'/>"
+" <arg type='s' name='Type' direction='in'/>"
+" <arg type='i' name='Pid' direction='out'/>"
+" <arg type='i' name='Detect' direction='out'/>"
+" <arg type='s' name='Appid' direction='out'/>"
+" </method>"
" </interface>"
"</node>";
/* Following functions are defined in proc-usage-stats.c */
{ "ProcMemoryUsage", dbus_proc_memory_usage },
{ "ProcCpuUsage", dbus_proc_cpu_usage },
+ { "CheckAppStatus", dbus_get_checkappstatus },
/* Add methods here */
};