Add new APIs to resume app instance 23/114723/3
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 14 Feb 2017 22:52:06 +0000 (07:52 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Wed, 15 Feb 2017 00:55:42 +0000 (16:55 -0800)
Change-Id: I0906bf504812465e7811e16c3bf08fc529c0e620
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
include/aul.h
src/launch.c

index e45af3e..7656997 100644 (file)
@@ -3022,6 +3022,13 @@ int aul_app_get_instance_id_bypid(int pid, char *instance_id, int len);
 int aul_app_get_instance_id_bypid_for_uid(int pid, char *instance_id,
                int len, uid_t uid);
 
+/*
+ * This API is only for Appfw internally.
+ */
+int aul_resume_app_by_instance_id(const char *appid, const char *instance_id);
+int aul_resume_app_by_instance_id_for_uid(const char *appid,
+               const char *instance_id, uid_t uid);
+
 #ifdef __cplusplus
        }
 #endif
index 3329f7e..5591201 100644 (file)
@@ -1152,3 +1152,39 @@ API int aul_resume_pid_async_for_uid(int pid, uid_t uid)
        return ret;
 }
 
+API int aul_resume_app_by_instance_id(const char *appid,
+               const char *instance_id)
+{
+       return aul_resume_app_by_instance_id_for_uid(appid,
+                       instance_id, getuid());
+}
+
+API int aul_resume_app_by_instance_id_for_uid(const char *appid,
+               const char *instance_id, uid_t uid)
+{
+       int ret;
+       bundle *b;
+
+       if (appid == NULL || instance_id == NULL) {
+               _E("Invalid parameter");
+               return AUL_R_EINVAL;
+       }
+
+       b = bundle_create();
+       if (b == NULL) {
+               _E("Out of memory");
+               return AUL_R_EINVAL;
+       }
+
+       ret = bundle_add(b, AUL_K_INSTANCE_ID, instance_id);
+       if (ret != BUNDLE_ERROR_NONE) {
+               _E("Failed to add instance id(%s)", instance_id);
+               bundle_free(b);
+               return AUL_R_ERROR;
+       }
+
+       ret = app_request_to_launchpad_for_uid(APP_RESUME, appid, b, uid);
+       bundle_free(b);
+
+       return ret;
+}