add _usr_ prototypes : appsvc_usr_run_service, appsvc_usr_get_list 37/33437/2 tizen_3.0.2014.q4_common tizen_3.0_ivi accepted/tizen/common/20150113.085925 accepted/tizen/ivi/20150115.062918 accepted/tizen/tv/20150302.010506 accepted/tizen/wearable/20150128.040605 submit/tizen_common/20150109.133122 submit/tizen_common/20150112.103909 submit/tizen_common/20150112.154626 submit/tizen_ivi/20150115.222222 submit/tizen_mobile/20150116.000000 submit/tizen_mobile/20150116.000001 submit/tizen_mobile/20150116.000003 submit/tizen_mobile/20150129.000000 submit/tizen_mobile/20150213.000000 submit/tizen_tv/20150116.000000 submit/tizen_tv/20150119.000000 submit/tizen_tv/20150119.000001 submit/tizen_tv/20150120.000000 submit/tizen_tv/20150120.000002 submit/tizen_tv/20150130.000000 submit/tizen_tv/20150130.050505 submit/tizen_tv/20150227.073215 submit/tizen_tv/20150228.021455 submit/tizen_wearable/20150116.000000 submit/tizen_wearable/20150127.000000 tizen_3.0_ivi_release
authorSabera Djelti (sdi2) <sabera.djelti@open.eurogiciel.org>
Fri, 9 Jan 2015 10:31:09 +0000 (11:31 +0100)
committerBaptiste DURAND <baptiste.durand@open.eurogiciel.org>
Fri, 9 Jan 2015 13:27:10 +0000 (05:27 -0800)
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

include/appsvc.h
src/appsvc.c
test/appsvc_test.c

index f31f249..35e04c4 100755 (executable)
@@ -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.
index ff70bfc..f6d6766 100644 (file)
@@ -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;
index d3c4965..cb4a62f 100755 (executable)
@@ -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");