Sync with the private repository
authorSung-jae Park <nicesj.park@samsung.com>
Wed, 10 Apr 2013 11:49:24 +0000 (20:49 +0900)
committerGerrit Code Review <gerrit2@kim11>
Wed, 10 Apr 2013 12:11:09 +0000 (21:11 +0900)
Deal with acquiring 0x0 buffer request.
Prepend new buffer for give the mouse event to newly created buffer.
Because the mouse event will be feed to the first matched buffer info.
(using pkgname & id)
so the previous code is not able to give the mouse event to lately created buffer info.
it just pass the mouse event to the first created buffer.
but the first created buffer is not usable.
This patch will change the order of buffer info in its list.
So the mouse event will be feed to the last buffer info.
and the first buffer info will not be used anymore.

Add log for debugging

Update accessibility API.
To send the accessiblity result status to the viewer.
Update VERSION

Add update begin/end. (passive/active) update mode

Update mode event handler added.
And the recreate event updated.
To recover the instance properly.
Update mode & scroll lock information is added.

Change-Id: If6a5c7c03b9230212217e05c9bf9b48c130d97ae

include/fb.h
include/provider.h
packaging/libprovider.spec
src/provider.c
src/provider_buffer.c

index 5b2622c..e67c797 100644 (file)
@@ -18,7 +18,6 @@ struct fb_info;
 
 extern int fb_init(void *disp);
 extern int fb_fini(void);
-extern const char *fb_filename(struct fb_info *info);
 extern int fb_get_size(struct fb_info *info, int *w, int *h);
 extern int fb_sync(struct fb_info *info);
 extern int fb_size(struct fb_info *info);
index 3e591cc..6e31e27 100644 (file)
@@ -133,6 +133,8 @@ struct event_arg {
                        char *out_content; /*!< Output content */
                        char *out_title; /*!< Output title */
                        int out_is_pinned_up; /*!< Is this pinned up? */
+                       int hold_scroll; /*!< The scroller which is in viewer is locked */
+                       int active_update; /*!< Need to know, current update mode */
                } lb_recreate; /*!< renew */
 
                struct {
@@ -202,8 +204,6 @@ struct event_arg {
                        enum access_event event;
                        double x;
                        double y;
-                       int w;
-                       int h;
                } lb_access;
 
                struct {
@@ -211,9 +211,11 @@ struct event_arg {
                        enum access_event event;
                        double x;
                        double y;
-                       int w;
-                       int h;
                } pd_access;
+
+               struct {
+                       int active_update;
+               } update_mode;
        } info;
 };
 
@@ -256,6 +258,8 @@ struct event_handler {
         */
        int (*lb_access)(struct event_arg *arg, void *data);
        int (*pd_access)(struct event_arg *arg, void *data);
+
+       int (*update_mode)(struct event_arg *arg, void *data);
 };
 
 /*!
@@ -307,6 +311,41 @@ extern int provider_send_updated(const char *pkgname, const char *id, int w, int
 extern int provider_send_desc_updated(const char *pkgname, const char *id, const char *descfile);
 
 /*!
+ * \brief
+ * \param[in] pkgname
+ * \param[in] id
+ * \param[in] priority
+ * \param[in] content_info
+ * \param[in] title
+ * \return
+ */
+extern int provider_send_lb_update_begin(const char *pkgname, const char *id, double priority, const char *content_info, const char *title);
+
+/*!
+ * \brief
+ * \param[in] pkgname
+ * \param[in] id
+ * \return
+ */
+extern int provider_send_lb_update_end(const char *pkgname, const char *id);
+
+/*!
+ * \brief
+ * \param[in] pkgname
+ * \param[in] id
+ * \return
+ */
+extern int provider_send_pd_update_begin(const char *pkgname, const char *id);
+
+/*!
+ * \brief
+ * \param[in] pkgname
+ * \param[in] id
+ * \return
+ */
+extern int provider_send_pd_update_end(const char *pkgname, const char *id);
+
+/*!
  * \brief Send the deleted event of specified livebox instance
  * \param[in] pkgname Package name of the livebox
  * \param[in] id Livebox instance ID
@@ -354,6 +393,15 @@ extern int provider_send_faulted(const char *pkgname, const char *id, const char
  */
 extern int provider_send_hold_scroll(const char *pkgname, const char *id, int seize);
 
+/*!
+ * \brief Notify to viewer for accessiblity event processing status.
+ * \param[in] pkgname
+ * \param[in] id
+ * \param[in] status
+ * \return int
+ */
+extern int provider_send_access_status(const char *pkgname, const char *id, int status);
+
 #ifdef __cplusplus
 }
 #endif
index d7d3832..2d703e5 100644 (file)
@@ -1,6 +1,6 @@
 Name: libprovider
 Summary: Library for developing the livebox service provider.
-Version: 0.7.0
+Version: 0.8.0
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
index 70b4f7c..c59f43b 100644 (file)
@@ -199,15 +199,17 @@ static struct packet *master_renew(pid_t pid, int handle, const struct packet *p
        arg.info.lb_recreate.out_content = NULL;
        arg.info.lb_recreate.out_is_pinned_up = 0;
 
-       ret = packet_get(packet, "sssiidssiis", &arg.pkgname, &arg.id,
+       ret = packet_get(packet, "sssiidssiisii", &arg.pkgname, &arg.id,
                                &arg.info.lb_recreate.content,
                                &arg.info.lb_recreate.timeout,
                                &arg.info.lb_recreate.has_script,
                                &arg.info.lb_recreate.period,
                                &arg.info.lb_recreate.cluster, &arg.info.lb_recreate.category,
                                &arg.info.lb_recreate.width, &arg.info.lb_recreate.height,
-                               &arg.info.lb_recreate.abi);
-       if (ret != 11) {
+                               &arg.info.lb_recreate.abi,
+                               &arg.info.lb_recreate.hold_scroll,
+                               &arg.info.lb_recreate.active_update);
+       if (ret != 13) {
                ErrPrint("Parameter is not valid\n");
                ret = LB_STATUS_ERROR_INVALID;
                goto errout;
@@ -474,6 +476,29 @@ errout:
        return result;
 }
 
+static struct packet *master_update_mode(pid_t pid, int handle, const struct packet *packet)
+{
+       struct packet *result;
+       struct event_arg arg;
+       int ret;
+
+       ret = packet_get(packet, "ssi", &arg.pkgname, &arg.id, &arg.info.update_mode.active_update);
+       if (ret != 3) {
+               ErrPrint("Invalid parameter\n");
+               ret = LB_STATUS_ERROR_INVALID;
+               goto errout;
+       }
+
+       if (s_info.table.update_mode)
+               ret = s_info.table.update_mode(&arg, s_info.data);
+       else
+               ret = LB_STATUS_ERROR_NOT_IMPLEMENTED;
+
+errout:
+       result = packet_create_reply(packet, "i", ret);
+       return result;
+}
+
 /* timestamp, ret */
 static struct packet *master_resume(pid_t pid, int handle, const struct packet *packet)
 {
@@ -1015,6 +1040,10 @@ static struct method s_table[] = {
                .cmd = "lb_access_value_change",
                .handler = master_lb_access_value_change,
        },
+       {
+               .cmd = "update_mode",
+               .handler = master_update_mode,
+       },
 
        {
                .cmd = NULL,
@@ -1294,6 +1323,129 @@ static inline void keep_file_in_safe(const char *id)
        free(new_path);
 }
 
+/*!
+ * \NOTE
+ *   Only for the buffer type
+ */
+EAPI int provider_send_lb_update_begin(const char *pkgname, const char *id, double priority, const char *content_info, const char *title)
+{
+       struct packet *packet;
+       int ret;
+
+       if (!pkgname || !id) {
+               ErrPrint("Invalid argument\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       if (!content_info)
+               content_info = "";
+
+       if (!title)
+               title = "";
+
+       if (s_info.fd < 0) {
+               ErrPrint("Connection is not established\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       packet = packet_create_noack("lb_update_begin", "ssdss",
+                                       pkgname, id, priority, content_info, title);
+       if (!packet) {
+               ErrPrint("Failed to build a packet\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       ret = com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
+
+       DbgPrint("[ACTIVE] LB BEGIN: %s (%d)\n", id, ret);
+       return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
+}
+
+EAPI int provider_send_lb_update_end(const char *pkgname, const char *id)
+{
+       struct packet *packet;
+       int ret;
+
+       if (!pkgname || !id) {
+               ErrPrint("Invalid argument\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       if (s_info.fd < 0) {
+               ErrPrint("Connection is not established\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       packet = packet_create_noack("lb_update_end", "ss", pkgname, id);
+       if (!packet) {
+               ErrPrint("Failed to build a packet\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       ret = com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
+
+       DbgPrint("[ACTIVE] LB END: %s (%d)\n", id, ret);
+       return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
+}
+
+EAPI int provider_send_pd_update_begin(const char *pkgname, const char *id)
+{
+       struct packet *packet;
+       int ret;
+
+       if (!pkgname || !id) {
+               ErrPrint("Invalid argument\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       if (s_info.fd < 0) {
+               ErrPrint("Connection is not established\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       packet = packet_create_noack("pd_update_begin", "ss", pkgname, id);
+       if (!packet) {
+               ErrPrint("Failed to build a packet\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       ret = com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
+
+       DbgPrint("[ACTIVE] PD BEGIN: %s (%d)\n", id, ret);
+       return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
+}
+
+EAPI int provider_send_pd_update_end(const char *pkgname, const char *id)
+{
+       struct packet *packet;
+       int ret;
+
+       if (!pkgname || !id) {
+               ErrPrint("Invalid argument\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       if (s_info.fd < 0) {
+               ErrPrint("Connection is not established\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       packet = packet_create_noack("pd_update_end", "ss", pkgname, id);
+       if (!packet) {
+               ErrPrint("Failed to build a packet\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       ret = com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
+
+       DbgPrint("[ACTIVE] PD END: %s (%d)\n", id, ret);
+       return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
+}
+
 EAPI int provider_send_updated(const char *pkgname, const char *id, int w, int h, double priority, const char *content_info, const char *title)
 {
        struct packet *packet;
@@ -1407,6 +1559,35 @@ EAPI int provider_send_hold_scroll(const char *pkgname, const char *id, int hold
 
        ret = com_core_packet_send_only(s_info.fd, packet);
        packet_destroy(packet);
+       DbgPrint("[HOLD] Send hold: %d (%s) ret(%d)\n", hold, id, ret);
+       return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
+}
+
+EAPI int provider_send_access_status(const char *pkgname, const char *id, int status)
+{
+       struct packet *packet;
+       int ret;
+
+       if (!pkgname || !id) {
+               ErrPrint("Invalid argument\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       if (s_info.fd < 0) {
+               ErrPrint("Connection is not established\n");
+               return LB_STATUS_ERROR_INVALID;
+       }
+
+       packet = packet_create_noack("access_status", "ssi", pkgname, id, status);
+       if (!packet) {
+               ErrPrint("Failed to build a packet\n");
+               return LB_STATUS_ERROR_FAULT;
+       }
+
+       ret = com_core_packet_send_only(s_info.fd, packet);
+       packet_destroy(packet);
+
+       DbgPrint("[ACCESS] Send status: %d (%s) (%d)\n", status, id, ret);
        return ret < 0 ? LB_STATUS_ERROR_FAULT : LB_STATUS_SUCCESS;
 }
 
index c61f061..2180cb7 100644 (file)
@@ -193,6 +193,11 @@ EAPI struct livebox_buffer *provider_buffer_acquire(enum target_type type, const
 {
        struct livebox_buffer *info;
 
+       if (width <= 0 || height <= 0 || pixel_size <= 0) {
+               ErrPrint("Invalid size: %dx%d, %d\n", width, height, pixel_size);
+               return NULL;
+       }
+
        if (!pkgname) {
                ErrPrint("Invalid parameter: pkgname is NIL\n");
                return NULL;
@@ -248,7 +253,7 @@ EAPI struct livebox_buffer *provider_buffer_acquire(enum target_type type, const
        info->data = data;
        info->state = BUFFER_CREATED;
 
-       s_info.buffer_list = dlist_append(s_info.buffer_list, info);
+       s_info.buffer_list = dlist_prepend(s_info.buffer_list, info);
        return info;
 }