diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2016-01-05 10:54:42 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2016-01-05 10:54:42 +0900 |
commit | c7e37b59af152c62d24c8ea45596309cea597e20 (patch) | |
tree | 27a109d2cd4364f5c98f9765f8c756d4d5f3fa35 | |
parent | d7f147e4033964e2c8fac0a8e1e6e4fde846f1dc (diff) | |
download | aul-1-c7e37b59af152c62d24c8ea45596309cea597e20.tar.gz aul-1-c7e37b59af152c62d24c8ea45596309cea597e20.tar.bz2 aul-1-c7e37b59af152c62d24c8ea45596309cea597e20.zip |
Add API for System Sessionsubmit/tizen/20160105.021130accepted/tizen/wearable/20160105.045246accepted/tizen/tv/20160105.045225accepted/tizen/mobile/20160105.045151
- add aul_app_is_running_for_uid()
Change-Id: I4176f339f520667621266745f180396695182b38
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r-- | include/aul.h | 25 | ||||
-rw-r--r-- | src/pkginfo.c | 7 |
2 files changed, 29 insertions, 3 deletions
diff --git a/include/aul.h b/include/aul.h index b4a8d0e4..47082c17 100644 --- a/include/aul.h +++ b/include/aul.h @@ -649,12 +649,33 @@ typedef int (*aul_app_info_iter_fn)(const aul_app_info *ainfo, void *data); * @endcode * @remark * This API is only available in User Session. -* -*/ + * + */ int aul_app_is_running(const char *appid); /** * @par Description: + * This API ask a application is running by application package name. + * @par Purpose: + * To know whether some application is running or not, use this API + * @par Typical use case: + * For example, If you want to know browser application running, + * you can check it by using this API. + * + * @param[in] pkgname application package name + * @param[in] uid User ID + * @return true / false + * @retval 1 app_name is running now. + * @retval 0 app_name is NOT running now. + * + * @endcode + * @remark + * This API is only available in System Session. + */ +int aul_app_is_running_for_uid(const char *appid, uid_t uid); + +/** + * @par Description: * This API use to get running application list. * This API call iter_fn with each aul_app_info of running apps when running application is found. * @par Purpose: diff --git a/src/pkginfo.c b/src/pkginfo.c index 498dea60..da6b2886 100644 --- a/src/pkginfo.c +++ b/src/pkginfo.c @@ -49,12 +49,17 @@ API int aul_app_get_pid(const char *appid) API int aul_app_is_running(const char *appid) { + return aul_app_is_running_for_uid(appid, getuid()); +} + +API int aul_app_is_running_for_uid(const char *appid, uid_t uid) +{ int ret = 0; if (appid == NULL) return 0; - ret = aul_sock_send_raw(AUL_UTIL_PID, getuid(), APP_IS_RUNNING, + ret = aul_sock_send_raw(AUL_UTIL_PID, uid, APP_IS_RUNNING, (unsigned char*)appid, strlen(appid)); if (ret > 0) |