summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiwoong Im <jiwoong.im@samsung.com>2015-06-11 15:08:43 +0900
committerJiwoong Im <jiwoong.im@samsung.com>2015-06-11 15:08:43 +0900
commit8194518e167ed2ec3980ebb864899eda54b64a2a (patch)
treef69e4acaab3e0d36b4b8414e69a770c75bc2b514
parent4698b4d396ba606a93ad256eae305573326f187d (diff)
downloadapp-svc-8194518e167ed2ec3980ebb864899eda54b64a2a.tar.gz
app-svc-8194518e167ed2ec3980ebb864899eda54b64a2a.tar.bz2
app-svc-8194518e167ed2ec3980ebb864899eda54b64a2a.zip
Change-Id: Ia4ae576fa824b49722d83b0f76cb438396354f1c Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
-rwxr-xr-xinclude/appsvc.h59
-rwxr-xr-xinclude/priv_key.h2
-rw-r--r--src/appsvc.c44
3 files changed, 101 insertions, 4 deletions
diff --git a/include/appsvc.h b/include/appsvc.h
index d88c437..9b10aa3 100755
--- a/include/appsvc.h
+++ b/include/appsvc.h
@@ -945,8 +945,8 @@ int appsvc_is_defapp(const char *appid, uid_t uid);
...
- * int is_defapp_browser_app(bundle *b, char *key)
- * {
+ * int appsvc_data_is_array(bundle *b, char *key)
+ * {
* return appsvc_data_is_array(b, key);
* }
*
@@ -959,6 +959,61 @@ int appsvc_data_is_array(bundle *b, const char *key);
int appsvc_subapp_terminate_request_pid(int pid);
+/**
+ * @par Description:
+ * This function sets an uri to launch application based on appsvc.
+ *
+ * @param[in] b bundle object
+ * @param[in] char *mode
+ *
+ * @return 0 if success, negative value(<0) if fail
+ * @retval APPSVC_RET_OK - success
+ * @retval APPSVC_RET_ERROR - general error
+ * @retval APPSVC_RET_EINVAL - invalid argument(content)
+ *
+ * @pre None.
+ * @post None.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appsvc.h>
+
+...
+{
+ appsvc_set_launch_mode(app_control->data, mode);
+}
+ * @endcode
+ *
+ */
+int appsvc_set_launch_mode(bundle *b, const char *mode);
+
+/**
+ * @par Description:
+ * This function sets an uri to launch application based on appsvc.
+ *
+ * @param[in] b bundle object
+ *
+ * @return Pointer for launch mode string if success, NULL if fail
+ *
+ * @pre None.
+ * @post None.
+ * @see None.
+ * @remarks None.
+ *
+ * @par Sample code:
+ * @code
+#include <appsvc.h>
+
+...
+{
+ appsvc_get_launch_mode(app_control->data);
+}
+ * @endcode
+ *
+ */
+const char *appsvc_get_launch_mode(bundle *b);
#ifdef __cplusplus
}
#endif
diff --git a/include/priv_key.h b/include/priv_key.h
index 71ab27d..a21abe4 100755
--- a/include/priv_key.h
+++ b/include/priv_key.h
@@ -42,6 +42,8 @@
/** APP SVC internal private key */
#define APP_SVC_K_WIN_ID "__APP_SVC_K_WIN_ID__"
+/** APP SVC internal private key */
+#define APP_SVC_K_LAUNCH_MODE "__APP_SVC_LAUNCH_MODE__"
#endif /* __PRIV_KEY_H__ */
diff --git a/src/appsvc.c b/src/appsvc.c
index e136732..98dbbca 100644
--- a/src/appsvc.c
+++ b/src/appsvc.c
@@ -453,6 +453,15 @@ SLPAPI int appsvc_set_category(bundle *b, const char *category)
return __set_bundle(b, APP_SVC_K_CATEGORY, category);
}
+SLPAPI int appsvc_set_launch_mode(bundle *b, const char *mode)
+{
+ if (b == NULL) {
+ _E("bundle for appsvc_set_launch_mode is NULL");
+ return APPSVC_RET_EINVAL;
+ }
+
+ return __set_bundle(b, APP_SVC_K_LAUNCH_MODE, mode);
+}
static int __get_list_with_condition_mime_extened(char *op, char *uri, char *mime,
char *m_type, char *s_type, GSList **pkg_list, uid_t uid)
{
@@ -915,6 +924,11 @@ SLPAPI const char *appsvc_get_category(bundle *b)
return bundle_get_val(b, APP_SVC_K_CATEGORY);
}
+SLPAPI const char *appsvc_get_launch_mode(bundle *b)
+{
+ return bundle_get_val(b, APP_SVC_K_LAUNCH_MODE);
+}
+
SLPAPI int appsvc_create_result_bundle(bundle *inb, bundle **outb)
{
int ret = -1;
@@ -1117,6 +1131,32 @@ SLPAPI int appsvc_request_transient_app(bundle *b, unsigned int callee_id, appsv
SLPAPI int appsvc_subapp_terminate_request_pid(int pid)
{
- return aul_subapp_terminate_request_pid(pid);
-}
+ int cpid = getpid();
+ int lcnt;
+ int *lpids = NULL;
+ int i;
+
+ aul_app_group_get_leader_pids(&lcnt, &lpids);
+ for (i = 0; i < lcnt; i++) {
+ if (lpids[i] == cpid) {
+ int cnt;
+ int *pids = NULL;
+
+ aul_app_group_get_group_pids(cpid, &cnt, &pids);
+
+ if (cnt == 0) {
+ free(lpids);
+ return aul_subapp_terminate_request_pid(pid);
+ }
+
+ if (pids != NULL)
+ free(pids);
+ break;
+ }
+ }
+ if (lpids != NULL)
+ free(lpids);
+
+ return aul_app_group_clear_top();
+}