*
*/
-
+#define _GNU_SOURCE
#include <poll.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
#include <Ecore.h>
+#include <bundle_internal.h>
#include "menu_db_util.h"
#include "aul.h"
+#include "aul_svc.h"
#define PERF_ACTIVATE
#include "perf.h"
-#define MAX_LOCAL_BUFSZ 128
#define QUERY_LEN 10240
static char **gargv;
return ret;
}
-static void prt_recvd_bundle(const char *key, const char *value, void *d)
-{
- printf("recvd - key: %s, value: %s\n", key, value);
-}
-
-static void cb_func(bundle *kb, int is_cancel, void *data)
-{
- int num;
- num = (int)data;
-
- if (is_cancel) {
- printf("==== %d : canceled(preemptted) my request ===\n", num);
- } else {
- printf("==== %d : result packet ===\n", num);
- bundle_iterate(kb, prt_recvd_bundle, NULL);
- }
-
- if ((strcmp(cmd, "launch_res") == 0)
- || (strcmp(cmd, "open_svc_res") == 0))
- ecore_main_loop_quit();
-}
-
int open_test()
{
static int num = 0;
return aul_subapp_terminate_request_pid(apn_pid);
}
+int pause_test()
+{
+ static int num = 0;
+
+ printf("[aul_pause_app %d test] %s \n", num++, gargv[2]);
+ return aul_pause_app(gargv[2]);
+}
+
+int pause_pid_test()
+{
+ static int num = 0;
+
+ printf("[aul_pause_pid %d test] %d \n", num++, apn_pid);
+ return aul_pause_pid(apn_pid);
+}
+
static test_func_t scn_func[] = {
{"n", launch_test, "launch_test", ""},
{"n", launch_test, "launch_test", ""},
return 0;
}
+int get_pid_test()
+{
+ printf("[aul_app_get_pid %s test] \n", gargv[2]);
+ return aul_app_get_pid(gargv[2]);
+}
+
+int get_pid_cache_test()
+{
+ printf("[aul_app_get_pid_cache %s test] \n", gargv[2]);
+ return aul_app_get_pid_cache(gargv[2]);
+}
+
int iterfunc(const aul_app_info *info, void *data)
{
printf("\t==========================\n");
return 0;
}
+static char *status_text[] = {
+ "STATUS_LAUNCHING",
+ "STATUS_CREATED",
+ "STATUS_FOCUS",
+ "STATUS_VISIBLE",
+ "STATUS_BG",
+ "STATUS_DYING",
+ "STATUS_HOME",
+ "STATUS_NORESTART",
+};
+
+static int get_status_pid()
+{
+ int ret;
+ ret = aul_app_get_status_bypid(apn_pid);
+
+ printf("pid: %d status: %d ", apn_pid, ret);
+ if (ret >= STATUS_LAUNCHING && ret <= STATUS_NORESTART)
+ printf("(%s)", status_text[ret]);
+
+ printf("\n");
+
+ return 0;
+}
+
+static int get_last_caller_pid()
+{
+ int ret;
+ int pid;
+
+ pid = atoi(gargv[2]);
+ ret = aul_app_get_last_caller_pid(pid);
+ printf("pid: %d, last caller pid: %d\n", pid, ret);
+ return ret;
+}
+
static int update_running_list()
{
aul_running_list_update(gargv[2], gargv[3], gargv[4]);
return 0;
}
+static int set_group_test()
+{
+ int owner_pid;
+ int child_pid;
+
+ owner_pid = atoi(gargv[2]);
+ child_pid = atoi(gargv[3]);
+ aul_set_process_group(owner_pid, child_pid);
+
+ return 0;
+}
+
+static int get_group_test()
+{
+ char *str;
+
+ str = aul_get_group_info();
+ printf("%s\n", str);
+ free(str);
+
+ return 0;
+}
+
+/** AUL SVC internal private key */
+#define AUL_SVC_K_OPERATION "__APP_SVC_OP_TYPE__"
+/** AUL SVC internal private key */
+#define AUL_SVC_K_URI "__APP_SVC_URI__"
+/** AUL SVC internal private key */
+#define AUL_SVC_K_MIME "__APP_SVC_MIME_TYPE__"
+/** AUL SVC internal private key */
+#define AUL_SVC_K_CATEGORY "__APP_SVC_CATEGORY__"
+/** AUL SVC internal private key */
+
+static int iter_svc_fn(const char *appid, void *data)
+{
+ printf("matched : %s\n", appid);
+ return 0;
+}
+
+static int get_svc_list()
+{
+ int i = 2;
+ int ret = 0;
+ bundle *b = NULL;
+ if (gargc < 3 || (gargc - 2) % 2 == 1) {
+ printf("[usage] get_svc_list --operation <operation> --mime <mime> --uri <uri>\n");
+ return -1;
+ }
+
+ b = bundle_create();
+ if (!b) {
+ printf("out of memory\n");
+ return -1;
+ }
+
+ for (i = 2; i < gargc; i+=2) {
+ if (strcmp(gargv[i], "--operation") == 0) {
+ bundle_add(b, AUL_SVC_K_OPERATION, gargv[i + 1]);
+ }
+ else if (strcmp(gargv[i], "--mime") == 0) {
+ bundle_add(b, AUL_SVC_K_MIME, gargv[i + 1]);
+ }
+ else if (strcmp(gargv[i], "--uri") == 0) {
+ bundle_add(b, AUL_SVC_K_URI, gargv[i + 1]);
+ }
+ else if (strcmp(gargv[i], "--category") == 0) {
+ bundle_add(b, AUL_SVC_K_CATEGORY, gargv[i + 1]);
+ }
+ }
+
+ printf("start aul_svc_get_list\n");
+ ret = aul_svc_get_list(b, iter_svc_fn, NULL);
+ printf("end aul_svc_get_list\n");
+ bundle_free(b);
+
+ return ret;
+}
/*
static int set_pkg_func()
"[usage] getpkg <pkgname>"},
{"update_list", update_running_list, "update running list",
"[usage] update_list <appid> <app_path> <pid>"},
+
+ {"pause",pause_test,"aul_pause_app test",
+ "[usage] pause <pkgname>" },
+ {"pause_pid",pause_pid_test,"aul_pause_pid test",
+ "[usage] pause_pid <pid>" },
+
+ {"get_pid", get_pid_test, "aul_get_pid test",
+ "[usage] get_pid <pkgname>"},
+ {"get_pid_cache", get_pid_cache_test, "aul_get_pid_cache test",
+ "[usage] get_pid_cache <pkgname>"},
+
+ {"get_status_pid", get_status_pid, "aul_app_get_status_bypid test",
+ "[usage] get_status_pid <pid>"},
+ {"set_group", set_group_test, "set_group_test",
+ "[usage] set_group <pid> <pid>"},
+ {"get_group", get_group_test, "get_group_test",
+ "[usage] get_group"},
+ {"get_svc_list", get_svc_list, "aul_svc_get_list test",
+ "[usage] get_svc_list --operation <operation> --mime <mime> --uri <uri>"},
+ {"get_last_caller_pid", get_last_caller_pid, "aul_app_get_last_caller_pid test",
+ "[usage] get_last_caller_pid <pid>"},
+
/*
{"setpkg", set_pkg_func, "set package",
"[usage] setpkg <pkgname> <apppath>"},
gargv = argv;
apn_pid = atoi(argv[2]);
- aul_launch_init(NULL, NULL);
-
/*aul_listen_app_dead_signal(dead_tracker,NULL); */
/*aul_listen_app_dead_signal(NULL,NULL); */