typedef struct status_listen_s *status_listen_h;
/**
- * This API is only for Appfw internally.
+ * @par Description:
+ * Registers a callback function to be invoked when the application change status.
+ *
+ * @param[in] appid The application ID to get status
+ * @param[in] callback The callback function to register
+ * @param[in] data The user data to be passed to the callback function
+ * @param[out] handle The status listen handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
*/
int aul_listen_app_status(const char *appid, app_status_cb callback,
void *data, status_listen_h *handle);
+int aul_listen_app_status_for_uid(const char *appid, app_status_cb callback,
+ void *data, status_listen_h *handle, uid_t uid);
/*
* This API is only for Appfw internally.
#define MAX_PACKAGE_STR_SIZE 512
#define MAX_PID_STR_BUFSZ 20
#define MAX_UID_STR_BUFSZ 20
+#define REGULAR_UID_MIN 5000
typedef enum {
TIZEN_PROFILE_UNKNOWN = 0,
return 0;
}
-API int aul_listen_app_status(const char *appid, app_status_cb callback,
- void *data, status_listen_h *handle)
+API int aul_listen_app_status_for_uid(const char *appid, app_status_cb callback,
+ void *data, status_listen_h *handle, uid_t uid)
{
struct status_listen_s *listen;
char endpoint[128];
return AUL_R_ERROR;
}
- snprintf(endpoint, sizeof(endpoint), "app_status_event:%s:%d",
- appid, getuid());
+ if (uid < REGULAR_UID_MIN) {
+ snprintf(endpoint, sizeof(endpoint),
+ "app_status_event:%s", appid);
+ } else {
+ snprintf(endpoint, sizeof(endpoint),
+ "app_status_event:%s:%d", appid, uid);
+ }
+
aul_app_com_create(endpoint, NULL, __app_status_event_cb,
listen, &listen->conn);
if (listen->conn == NULL) {
return AUL_R_OK;
}
+
+API int aul_listen_app_status(const char *appid, app_status_cb callback,
+ void *data, status_listen_h *handle)
+{
+ return aul_listen_app_status_for_uid(appid, callback, data, handle,
+ getuid());
+}
return aul_listen_app_status(gargv[2], app_status_handler, NULL, &listen_handle);
}
+static int listen_app_status_for_uid_test(void)
+{
+ static int num;
+
+ printf("aul_listen_app_status %d test] %s \n", num++, gargv[2]);
+ return aul_listen_app_status_for_uid(gargv[2], app_status_handler, NULL, &listen_handle, apn_pid);
+}
+
static int test_regex()
{
char *token;
"[usage] resume_pid_async_for_uid <pid> <uid>"},
{"listen_app_status", listen_app_status, "aul_listen_app_status",
"[usage] listen_app_status <appid>"},
+ {"listen_app_status_for_uid", listen_app_status_for_uid_test, "aul_listen_app_status_for_uid",
+ "[usage] listen_app_status_for_uid <appid> <uid>"},
};
int callfunc(char *testname)