*/
int aul_widget_instance_update(const char *widget_id, const char *instance_id, bundle *b);
+/**
+ * @par Description:
+ * This API gets the last caller process id of specified application process id.
+ * @par Purpose:
+ * This API's purpose is to get the application's last caller process id.
+ *
+ * @param[in] pid pid of application
+ * @return caller pid if success, nagative value if fail
+ *
+ * @remark
+ * This API is only available in User Session.
+ */
+int aul_app_get_last_caller_pid(int pid);
+
+/**
+ * @par Description:
+ * This API gets the last caller process id of specified application process id.
+ * @par Purpose:
+ * This API's purpose is to get the last caller process id of the application.
+ *
+ * @param[in] pid pid of application
+ * @param[in] uid User ID
+ * @return caller pid if success, nagative value if fail
+ *
+ * @remark
+ * This API is only available in System users.
+ */
+int aul_app_get_last_caller_pid_for_uid(int pid, uid_t uid);
+
#ifdef __cplusplus
}
#endif
APP_PREPARE_CANDIDATE_PROCESS,
APP_TERM_BY_PID_SYNC,
APP_GET_STATUS_BY_APPID,
+ APP_GET_LAST_CALLER_PID,
APP_CMD_MAX
};
return AUL_R_OK;
}
+
+API int aul_app_get_last_caller_pid(int pid)
+{
+ return aul_app_get_last_caller_pid_for_uid(pid, getuid());
+}
+
+API int aul_app_get_last_caller_pid_for_uid(int pid, uid_t uid)
+{
+ int ret;
+
+ if (pid < 0) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ ret = aul_sock_send_raw(AUL_UTIL_PID, uid, APP_GET_LAST_CALLER_PID,
+ (unsigned char *)&pid, sizeof(int),
+ AUL_SOCK_NONE);
+ if (ret < 0)
+ return aul_error_convert(ret);
+
+ return ret;
+}
+
return 0;
}
+static int get_last_caller_pid_test(void)
+{
+ static int num;
+
+ printf("[aul_app_get_last_caller_pid %d test] %d \n", num++, apn_pid);
+ return aul_app_get_last_caller_pid(apn_pid);
+}
+
+static int get_last_caller_pid_test_for_uid(void)
+{
+ static int num;
+
+ printf("[aul_app_get_last_caller_pid_for_uid %d test] %d \n", num++, apn_pid);
+ return aul_app_get_last_caller_pid_for_uid(apn_pid, atoi(gargv[3]));
+}
+
static int test_regex()
{
char *token;
"[usage] get_status <appid>"},
{"get_status_for_uid", get_status_test_for_uid, "aul_app_get_status_for_uid test",
"[usage] get_status_for_uid <appid> <uid>"},
+ {"get_last_caller_pid", get_last_caller_pid_test, "aul_app_get_last_caller_pid test",
+ "[usage] get_last_caller_pid <pid>"},
+ {"get_last_caller_pid_for_uid", get_last_caller_pid_test_for_uid, "aul_app_get_last_caller_pid_for_uid test",
+ "[usage] get_last_caller_pid_for_uid <pid> <uid"},
};
int callfunc(char *testname)