add a support for data-control provider 81/33481/3
authorJiwoong Im <jiwoong.im@samsung.com>
Mon, 12 Jan 2015 06:43:20 +0000 (15:43 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Wed, 14 Jan 2015 08:39:28 +0000 (17:39 +0900)
- set/unset data-control provider callback
- handle data-control request

Change-Id: Id39d47a9a6c5ffd8d656aac330859d74b6aa28e1
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
include/aul.h
src/launch.c

index 6df6460..b061d5d 100644 (file)
@@ -209,6 +209,8 @@ typedef enum _aul_type{
 #define AUL_K_APPID            "__AUL_APPID__"
 /** AUL internal private key */
 #define AUL_K_PID              "__AUL_PID__"
+/** AUL internal private key - To support data control*/
+#define AUL_K_DATA_CONTROL_TYPE   "__AUL_DATA_CONTROL_TYPE__"
 
 #define PRIVACY_POPUP "tizenprv00.privacy-popup"
 
@@ -1615,6 +1617,9 @@ int aul_set_subapp(subapp_fn cb, void *data);
 int aul_subapp_terminate_request_pid(int pid);
 int aul_is_subapp(void);
 
+typedef int (*data_control_provider_handler_fn) (bundle *b, int request_id, void *data);
+int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler);
+int aul_unset_data_control_provider_cb(void);
 
 /** @} */
 
index 1e7a925..f8be552 100644 (file)
@@ -56,6 +56,7 @@ static int __app_start_internal(gpointer data);
 static int __app_launch_local(bundle *b);
 static int __send_result_to_launchpad(int fd, int res);
 
+static data_control_provider_handler_fn __dc_handler = NULL;
 extern  int aul_launch_fini();
 
 int aul_is_initialized()
@@ -72,8 +73,19 @@ static int __call_aul_handler(aul_type type, bundle *kb)
 
 int app_start(bundle *kb)
 {
+       const char *str = NULL;
+
        _app_start_res_prepare(kb);
        __call_aul_handler(AUL_START, kb);
+       // Handle the DataControl callback
+       str = bundle_get_val(kb, AUL_K_DATA_CONTROL_TYPE);
+       if (str != NULL && strcmp(str, "CORE") == 0)
+       {
+               if (__dc_handler != NULL)
+               {
+                       __dc_handler(kb, 0, NULL); // bundle, request_id, data
+               }
+       }
        return 0;
 }
 
@@ -622,5 +634,17 @@ SLPAPI int aul_kill_pid(int pid)
        return ret;
 }
 
+SLPAPI int aul_set_data_control_provider_cb(data_control_provider_handler_fn handler)
+{
+       __dc_handler = handler;
+       return 0;
+}
+
+SLPAPI int aul_unset_data_control_provider_cb(void)
+{
+       __dc_handler = NULL;
+       return 0;
+}
+
 /* vi: set ts=8 sts=8 sw=8: */