summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>2015-01-09 11:31:09 +0100
committerBaptiste DURAND <baptiste.durand@open.eurogiciel.org>2015-01-09 05:27:10 -0800
commit859ec161b49125408a7c74cacc29e78ad27d9a3c (patch)
treef203dc67c16e9bb9a25f02837afe4df9543b488d
parentf576bfea93240152921047444a9a9a271536e4ca (diff)
downloadapp-svc-tizen_3.0.2014.q4_common.tar.gz
app-svc-tizen_3.0.2014.q4_common.tar.bz2
app-svc-tizen_3.0.2014.q4_common.zip
using default user to allow app-svc API usage for deamon. App-svc run service leads to app launch that could requires a graphical session BUG-Tizen=TC-2222 Signed-off-by: Sabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org> Change-Id: Id937789cd6c828745f1b2dbf19330e8602c759c1
-rwxr-xr-xinclude/appsvc.h8
-rw-r--r--src/appsvc.c20
-rwxr-xr-xtest/appsvc_test.c4
3 files changed, 25 insertions, 7 deletions
diff --git a/include/appsvc.h b/include/appsvc.h
index f31f249..35e04c4 100755
--- a/include/appsvc.h
+++ b/include/appsvc.h
@@ -47,6 +47,7 @@
#include <bundle.h>
+#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
@@ -485,7 +486,8 @@ int appsvc_set_category(bundle *b, const char *category);
* @endcode
*
*/
-int appsvc_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data, uid_t uid);
+int appsvc_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data);
+int appsvc_usr_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data, uid_t uid);
/**
* @par Description:
@@ -532,7 +534,8 @@ static int iter_fn(const char* pkg_name, void *data)
* @endcode
*
*/
-int appsvc_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data, uid_t uid);
+int appsvc_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data);
+int appsvc_usr_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data, uid_t uid);
/**
* @par Description:
@@ -919,7 +922,6 @@ int appsvc_unset_defapp(const char *defapp, uid_t uid);
*/
int appsvc_is_defapp(const char *appid, uid_t uid);
-
/**
* @par Description:
* This API ask a extra data is array or not.
diff --git a/src/appsvc.c b/src/appsvc.c
index ff70bfc..f6d6766 100644
--- a/src/appsvc.c
+++ b/src/appsvc.c
@@ -664,7 +664,15 @@ static int __get_list_with_submode(char *win_id, GSList **pkg_list)
return 0;
}
-SLPAPI int appsvc_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data, uid_t uid)
+SLPAPI int appsvc_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data)
+{
+ //using default user to allow app-svc API usage for deamon.
+ //App-svc run service leads to app launch that could require a graphical session.
+ //Indeed bluetooth_agent uses this API and is launched as bluetooth user (that not regular user).
+ return appsvc_usr_run_service(b, request_code, cbfunc, data, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+}
+
+SLPAPI int appsvc_usr_run_service(bundle *b, int request_code, appsvc_res_fn cbfunc, void *data, uid_t uid)
{
appsvc_resolve_info_t info;
char *pkgname;
@@ -846,7 +854,15 @@ end:
return ret;
}
-SLPAPI int appsvc_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data, uid_t uid)
+
+SLPAPI int appsvc_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data)
+{
+ //using default user to allow app-svc API usage for deamon.
+ //App-svc run get list leads to app launch that could require a graphical session.
+ return appsvc_usr_get_list(b, iter_fn, data, tzplatform_getuid(TZ_SYS_DEFAULT_USER));
+}
+
+SLPAPI int appsvc_usr_get_list(bundle *b, appsvc_info_iter_fn iter_fn, void *data, uid_t uid)
{
appsvc_resolve_info_t info;
char *pkgname = NULL;
diff --git a/test/appsvc_test.c b/test/appsvc_test.c
index d3c4965..cb4a62f 100755
--- a/test/appsvc_test.c
+++ b/test/appsvc_test.c
@@ -131,7 +131,7 @@ int run_svc()
__set_bundle_from_args(kb);
- ret = appsvc_run_service(kb,0,NULL, NULL, getuid());
+ ret = appsvc_usr_run_service(kb,0,NULL, NULL, getuid());
if(ret >= 0){
printf("open service success\n");
@@ -218,7 +218,7 @@ int run_svc_res()
__set_bundle_from_args(kb);
- ret = appsvc_run_service(kb, 0, cb_func, (void*)num, getuid());
+ ret = appsvc_usr_run_service(kb, 0, cb_func, (void*)num, getuid());
if(ret >= 0){
printf("open service success\n");