Fix the prevent issue.
authorSung-jae Park <nicesj.park@samsung.com>
Fri, 23 Aug 2013 09:24:20 +0000 (18:24 +0900)
committerSung-jae Park <nicesj.park@samsung.com>
Fri, 23 Aug 2013 09:24:20 +0000 (18:24 +0900)
Change-Id: I5d265288989fc1c282a3aa44ca8ff442fda07e71

18 files changed:
CMakeLists.txt
data-provider-master.manifest
data/baltic.conf.ini
data/private.conf.ini
packaging/data-provider-master.spec
pkgmgr_livebox/src/dlist.c
src/buffer_handler.c
src/event.c
src/file_service.c
src/instance.c
src/liveinfo.c
src/main.c
src/server.c
src/service_common.c
src/shortcut_service.c
src/util.c
src/utility_service.c
util_liveinfo/CMakeLists.txt

index e01b4c7..d552d4a 100644 (file)
@@ -50,6 +50,8 @@ ADD_DEFINITIONS("-DCLIENT_SOCKET=\"/opt/usr/share/live_magazine/.client.socket\"
 ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/opt/usr/share/live_magazine/.slave.socket\"")
 ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/opt/usr/share/live_magazine/.service.socket\"")
 
+ADD_DEFINITIONS("-DCLIENT_PORT=\"8208\"")
+
 ADD_DEFINITIONS("-DBADGE_SOCKET=\"/tmp/.badge.service\"")
 ADD_DEFINITIONS("-DSHORTCUT_SOCKET=\"/tmp/.shortcut.service\"")
 ADD_DEFINITIONS("-DNOTIFICATION_SOCKET=\"/tmp/.notification.service\"")
@@ -60,8 +62,6 @@ ADD_DEFINITIONS("-DSHORTCUT_SMACK_LABEL=\"data-provider-master::shortcut\"")
 ADD_DEFINITIONS("-DNOTIFICATION_SMACK_LABEL=\"data-provider-master::notification\"")
 ADD_DEFINITIONS("-DBADGE_SMACK_LABEL=\"data-provider-master::badge\"")
 
-ADD_DEFINITIONS("-DCLIENT_PORT=\"8208\"")
-
 ADD_DEFINITIONS("-DNDEBUG")
 #ADD_DEFINITIONS("-DFLOG")
 ADD_DEFINITIONS(${pkg_CFLAGS})
@@ -97,8 +97,8 @@ ADD_EXECUTABLE(${PROJECT_NAME}
        src/badge_service.c
        src/notification_service.c
        src/utility_service.c
-       src/service_common.c
        src/file_service.c
+       src/service_common.c
 )
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} "-ldl")
@@ -115,4 +115,7 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNE
 ADD_SUBDIRECTORY(res)
 ADD_SUBDIRECTORY(data)
 ADD_SUBDIRECTORY(pkgmgr_livebox)
+
+if ("${ENGINEER_BINARY}" STREQUAL "true")
 ADD_SUBDIRECTORY(util_liveinfo)
+endif ("${ENGINEER_BINARY}" STREQUAL "true")
index 1c8909c..d5b9102 100644 (file)
@@ -34,7 +34,8 @@
        <assign>
                <!-- Executable file -->
                <filesystem path="/usr/bin/data-provider-master" label="data-provider-master" exec_label="data-provider-master" />
-               <filesystem path="/usr/bin/liveinfo" label="data-provider-master" exec_label="data-provider-master" />
+               <filesystem path="/opt/usr/devel/usr/bin/liveinfo" label="data-provider-master" exec_label="data-provider-master" />
+               <filesystem path="/opt/usr/devel/usr/bin" label="_" />
 
                <!-- Configuration data -->
                <filesystem path="/usr/share/data-provider-master" label="data-provider-master::data" />
index b97ab43..9a9c2f4 100644 (file)
@@ -11,6 +11,8 @@ minimum_space=5242880
 replace_tag=/APPID/
 slave_ttl=30.0
 slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
 max_log_line=1000
 max_log_file=3
 sqilte_flush_max=1048576
index 33c5f75..383e3d6 100644 (file)
@@ -11,6 +11,8 @@ minimum_space=5242880
 replace_tag=/APPID/
 slave_ttl=30.0
 slave_activate_time=30.0
+slave_relaunch_time=3.0
+slave_relaunch_count=3
 max_log_line=1000
 max_log_file=3
 sqilte_flush_max=1048576
@@ -28,5 +30,5 @@ debug_mode=false
 overwrite_content=false
 com_core_thread=true
 use_xmonitor=false
-input=/dev/input/event1
+input=/dev/input/event2
 pd_request_timeout=5.0
index b7728d6..44afb4f 100644 (file)
@@ -1,6 +1,6 @@
 Name: data-provider-master
 Summary: Master service provider for liveboxes.
-Version: 0.25.6
+Version: 0.25.7
 Release: 1
 Group: HomeTF/Livebox
 License: Flora License
@@ -48,18 +48,22 @@ Keep trace on the life-cycle of the livebox and status of the service providers,
 %setup -q
 
 %build
+export ENGINEER=false
 %if 0%{?tizen_build_binary_release_type_eng}
 export CFLAGS="${CFLAGS} -DTIZEN_ENGINEER_MODE"
 export CXXFLAGS="${CXXFLAGS} -DTIZEN_ENGINEER_MODE"
 export FFLAGS="${FFLAGS} -DTIZEN_ENGINEER_MODE"
+export ENGINEER=true
 %endif
 
 %if 0%{?sec_product_feature_livebox_shm}
-       %cmake . -DPRODUCT=baltic
+export LIVEBOX_SHM=baltic
 %else
-       %cmake . -DPRODUCT=private
+export LIVEBOX_SHM=private
 %endif
 
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPRODUCT=${LIVEBOX_SHM} -DENGINEER_BINARY=${ENGINEER}
+
 CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
 
 %install
@@ -70,6 +74,7 @@ mkdir -p %{buildroot}/opt/usr/share/live_magazine
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/log
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/reader
 mkdir -p %{buildroot}/opt/usr/share/live_magazine/always
+mkdir -p %{buildroot}/opt/usr/devel/usr/bin
 mkdir -p %{buildroot}/opt/dbspace
 #mkdir -p %{buildroot}/%{_sysconfdir}/rc.d/rc3.d
 mkdir -p %{buildroot}/%{_libdir}/systemd/user/tizen-middleware.target.wants
@@ -121,13 +126,15 @@ echo "%{_sysconfdir}/init.d/data-provider-master start"
 %{_sysconfdir}/rc.d/init.d/data-provider-master
 #%{_sysconfdir}/rc.d/rc3.d/S99data-provider-master
 %{_bindir}/data-provider-master
-%{_bindir}/liveinfo
 %{_prefix}/etc/package-manager/parserlib/*
 %{_datarootdir}/data-provider-master/*
 %{_libdir}/systemd/user/data-provider-master.service
 %{_libdir}/systemd/user/tizen-middleware.target.wants/data-provider-master.service
 %{_datarootdir}/license/*
 /opt/usr/share/live_magazine/*
+%if 0%{?tizen_build_binary_release_type_eng}
+/opt/usr/devel/usr/bin/*
+%endif
 /opt/dbspace/.livebox.db
 /opt/dbspace/.livebox.db-journal
 /opt/etc/smack/accesses.d/*
index fa3082a..3ae571b 100644 (file)
@@ -45,8 +45,9 @@ struct dlist *dlist_append(struct dlist *list, void *data)
        struct dlist *item;
 
        item = malloc(sizeof(*item));
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        item->next = NULL;
        item->data = data;
@@ -71,8 +72,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
        struct dlist *item;
 
        item = malloc(sizeof(*item));
-       if (!item)
+       if (!item) {
                return NULL;
+       }
 
        item->data = data;
 
@@ -80,8 +82,9 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
                item->prev = item;
                item->next = NULL;
        } else {
-               if (list->prev->next)
+               if (list->prev->next) {
                        list->prev->next = item;
+               }
 
                item->prev = list->prev;
                item->next = list;
@@ -95,16 +98,19 @@ struct dlist *dlist_prepend(struct dlist *list, void *data)
 
 struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
 {
-       if (!list || !l)
+       if (!list || !l) {
                return NULL;
+       }
 
-       if (l == list)
+       if (l == list) {
                list = l->next;
-       else
+       } else {
                l->prev->next = l->next;
+       }
 
-       if (l->next)
+       if (l->next) {
                l->next->prev = l->prev;
+       }
        /*!
         * \note
         * If the removed entry 'l' has no next element, it is the last element.
@@ -113,8 +119,9 @@ struct dlist *dlist_remove(struct dlist *list, struct dlist *l)
         *
         * If we didn't care about this, the head element(list) can indicates the invalid element.
         */
-       else if (list)
+       else if (list) {
                list->prev = l->prev;
+       }
 
        free(l);
        return list;
@@ -126,8 +133,9 @@ struct dlist *dlist_find_data(struct dlist *list, void *data)
        void *_data;
 
        dlist_foreach(list, l, _data) {
-               if (data == _data)
+               if (data == _data) {
                        return l;
+               }
        }
 
        return NULL;
@@ -169,8 +177,9 @@ struct dlist *dlist_nth(struct dlist *l, int nth)
 
        i = 0;
        for (n = l; n; n = n->next) {
-               if (i == nth)
+               if (i == nth) {
                        return n;
+               }
                i++;
        }
 
index 9c46fa5..788b753 100644 (file)
@@ -426,7 +426,7 @@ static inline int destroy_gem(struct buffer *buffer)
        if (s_info.fd >= 0) {
                if (gem->compensate_data) {
                        DbgPrint("Release compensate buffer %p\n", gem->compensate_data);
-                       free(gem->compensate_data);
+                       DbgFree(gem->compensate_data);
                        gem->compensate_data = NULL;
                }
 
@@ -1433,7 +1433,7 @@ static inline struct buffer *raw_open_file(const char *filename)
        ret = read(fd, buffer->data, off);
        if (ret < 0) {
                ErrPrint("read: %s\n", strerror(errno));
-               free(buffer);
+               DbgFree(buffer);
 
                if (close(fd) < 0) {
                        ErrPrint("close: %s\n", strerror(errno));
@@ -1451,7 +1451,7 @@ static inline struct buffer *raw_open_file(const char *filename)
 
 static inline int raw_close_file(struct buffer *buffer)
 {
-       free(buffer);
+       DbgFree(buffer);
        return 0;
 }
 
@@ -1498,7 +1498,7 @@ static inline struct buffer *raw_open_pixmap(unsigned int pixmap)
 
 static inline int raw_close_pixmap(struct buffer *buffer)
 {
-       free(buffer);
+       DbgFree(buffer);
        return 0;
 }
 
index f891e35..592ee7a 100644 (file)
@@ -324,14 +324,14 @@ static inline void clear_all_listener_list(void)
                        case EVENT_STATE_DEACTIVATED:
                        default:
                                s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               free(listener);
+                               DbgFree(listener);
                                continue;
                        }
 
                        if (listener->event_cb(listener->state, &s_info.event_data, listener->cbdata) < 0) {
                                if (eina_list_data_find(s_info.event_listener_list, listener)) {
                                        s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                                       free(listener);
+                                       DbgFree(listener);
                                        continue;
                                }
                        }
@@ -368,66 +368,66 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler)
        item = eina_list_nth(s_info.event_list, 0);
        if (item) {
                s_info.event_list = eina_list_remove(s_info.event_list, item);
-       } else {
-               ErrPrint("Unable to get event\n");
        }
        CRITICAL_SECTION_END(&s_info.event_list_lock);
 
-       EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
-               switch (listener->state) {
-               case EVENT_STATE_ACTIVATE:
-                       if (timercmp(&listener->tv, &item->tv, >)) {
-                               /* Ignore previous events before activating this listener */
-                               continue;
-                       }
+       if (item) {
+               EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) {
+                       switch (listener->state) {
+                       case EVENT_STATE_ACTIVATE:
+                               if (timercmp(&listener->tv, &item->tv, >)) {
+                                       /* Ignore previous events before activating this listener */
+                                       continue;
+                               }
 
-                       next_state = EVENT_STATE_ACTIVATED;
-                       cur_state = listener->state;
-                       break;
-               case EVENT_STATE_DEACTIVATE:
-                       if (timercmp(&listener->tv, &item->tv, >)) {
-                               /* Consuming all events occurred while activating this listener */
-                               cur_state = EVENT_STATE_ACTIVATED;
                                next_state = EVENT_STATE_ACTIVATED;
+                               cur_state = listener->state;
                                break;
-                       }
+                       case EVENT_STATE_DEACTIVATE:
+                               if (timercmp(&listener->tv, &item->tv, >)) {
+                                       /* Consuming all events occurred while activating this listener */
+                                       cur_state = EVENT_STATE_ACTIVATED;
+                                       next_state = EVENT_STATE_ACTIVATED;
+                                       break;
+                               }
 
-                       cur_state = listener->state;
-                       next_state = EVENT_STATE_DEACTIVATED;
-                       break;
-               case EVENT_STATE_ACTIVATED:
-                       cur_state = listener->state;
-                       next_state = listener->state;
-                       break;
-               case EVENT_STATE_DEACTIVATED:
-               default:
-                       /* Remove this from the list */
-                               /* Check the item again. the listener can be deleted from the callback */
-                       if (eina_list_data_find(s_info.event_listener_list, listener)) {
-                               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               free(listener);
-                       }
+                               cur_state = listener->state;
+                               next_state = EVENT_STATE_DEACTIVATED;
+                               break;
+                       case EVENT_STATE_ACTIVATED:
+                               cur_state = listener->state;
+                               next_state = listener->state;
+                               break;
+                       case EVENT_STATE_DEACTIVATED:
+                       default:
+                               /* Remove this from the list */
+                                       /* Check the item again. the listener can be deleted from the callback */
+                               if (eina_list_data_find(s_info.event_listener_list, listener)) {
+                                       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+                                       DbgFree(listener);
+                               }
 
-                       continue;
-               }
+                               continue;
+                       }
 
-               memcpy(&modified_item, item, sizeof(modified_item));
-               modified_item.x -= listener->x;
-               modified_item.y -= listener->y;
+                       memcpy(&modified_item, item, sizeof(modified_item));
+                       modified_item.x -= listener->x;
+                       modified_item.y -= listener->y;
 
-               if (listener->event_cb(cur_state, &modified_item, listener->cbdata) < 0) {
-                       if (eina_list_data_find(s_info.event_listener_list, listener)) {
-                               s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               free(listener);
-                               continue;
+                       if (listener->event_cb(cur_state, &modified_item, listener->cbdata) < 0) {
+                               if (eina_list_data_find(s_info.event_listener_list, listener)) {
+                                       s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
+                                       DbgFree(listener);
+                                       continue;
+                               }
                        }
+
+                       listener->state = next_state;
                }
 
-               listener->state = next_state;
+               DbgFree(item);
        }
 
-       free(item);
-
        if (s_info.handle < 0 && !s_info.event_list) {
                /* This callback must has to clear all listeners in this case */
                clear_all_listener_list();
@@ -537,7 +537,7 @@ HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, st
 
        if (gettimeofday(&listener->tv, NULL) < 0) {
                ErrPrint("gettimeofday: %s\n", strerror(errno));
-               free(listener);
+               DbgFree(listener);
                return LB_STATUS_ERROR_FAULT;
        }
 
@@ -563,7 +563,7 @@ HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, st
 
                        if ((ret = activate_thread()) < 0) {
                                s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener);
-                               free(listener);
+                               DbgFree(listener);
                        }
                }
        } else {
@@ -597,7 +597,7 @@ HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_d
 
        if (s_info.handle < 0) {
                ErrPrint("Event handler is not actiavated\n");
-               free(listener);
+               DbgFree(listener);
                return LB_STATUS_SUCCESS;
        }
 
index b866120..c524dbd 100644 (file)
@@ -108,7 +108,7 @@ static inline struct request_item *create_request_item(struct tcb *tcb, int type
                item->data.filename = strdup(data);
                if (!item->data.filename) {
                        ErrPrint("Heap: %s\n", strerror(errno));
-                       free(item);
+                       DbgFree(item);
                        return NULL;
                }
                break;
@@ -120,7 +120,7 @@ static inline struct request_item *create_request_item(struct tcb *tcb, int type
                break;
        default:
                ErrPrint("Invalid type of request\n");
-               free(item);
+               DbgFree(item);
                return NULL;
        }
 
@@ -133,7 +133,7 @@ static inline int destroy_request_item(struct request_item *item)
 {
        switch (item->type) {
        case REQUEST_TYPE_FILE:
-               free(item->data.filename);
+               DbgFree(item->data.filename);
                break;
        case REQUEST_TYPE_SHM:
        case REQUEST_TYPE_PIXMAP:
@@ -142,7 +142,7 @@ static inline int destroy_request_item(struct request_item *item)
                return LB_STATUS_ERROR_INVALID;
        }
 
-       free(item);
+       DbgFree(item);
        return LB_STATUS_SUCCESS;
 }
 
@@ -354,7 +354,7 @@ static int send_file(int handle, const struct request_item *item)
        fsize = lseek(fd, 0L, SEEK_END);
        if (fsize == (off_t)-1) {
                ErrPrint("heap: %s\n", strerror(errno));
-               free(head);
+               DbgFree(head);
                ret = -EIO;
                goto errout;
        }
@@ -365,7 +365,7 @@ static int send_file(int handle, const struct request_item *item)
 
        /* Anytime we can fail to send packet */
        ret = com_core_send(handle, (void *)head, pktsz, 2.0f);
-       free(head);
+       DbgFree(head);
        if (ret < 0) {
                ret = -EFAULT;
                goto errout;
@@ -382,7 +382,7 @@ static int send_file(int handle, const struct request_item *item)
 
                body->size = -1;
                ret = com_core_send(handle, (void *)body, sizeof(*body), 2.0f);
-               free(body);
+               DbgFree(body);
 
                if (ret < 0) {
                        ret = -EFAULT;
@@ -433,7 +433,7 @@ static int send_file(int handle, const struct request_item *item)
                ret = -EFAULT;
        }
 
-       free(body);
+       DbgFree(body);
 
 errout:
        if (close(fd) < 0) {
@@ -480,7 +480,7 @@ static int send_buffer(int handle, const struct request_item *item)
 
        /* Anytime we can fail to send packet */
        ret = com_core_send(handle, (void *)head, pktsz, 2.0f);
-       free(head);
+       DbgFree(head);
        if (ret < 0) {
                ret = -EFAULT;
                goto errout;
@@ -513,7 +513,7 @@ static int send_buffer(int handle, const struct request_item *item)
                offset += body->size;
        }
 
-       free(body);
+       DbgFree(body);
 
 errout:
        (void)buffer_handler_raw_close(buffer);
index 567b337..fde6a3d 100644 (file)
@@ -549,7 +549,7 @@ static inline void invoke_delete_callbacks(struct inst_info *inst)
                if (item->event_cb(inst, item->data) < 0) {
                        if (eina_list_data_find(inst->delete_event_list, item)) {
                                inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
-                               free(item);
+                               DbgFree(item);
                        }
                }
        }
@@ -594,7 +594,7 @@ HAPI int instance_event_callback_del(struct inst_info *inst, enum instance_event
                EINA_LIST_FOREACH_SAFE(inst->delete_event_list, l, n, item) {
                        if (item->event_cb == event_cb) {
                                inst->delete_event_list = eina_list_remove(inst->delete_event_list, item);
-                               free(item);
+                               DbgFree(item);
                                return LB_STATUS_SUCCESS;
                        }
                }
@@ -656,8 +656,8 @@ static inline void destroy_instance(struct inst_info *inst)
 
        EINA_LIST_FREE(inst->data_list, tag_item) {
                DbgPrint("Tagged item[%s] %p\n", tag_item->tag, tag_item->data);
-               free(tag_item->tag);
-               free(tag_item);
+               DbgFree(tag_item->tag);
+               DbgFree(tag_item);
        }
 
        /*!
@@ -669,7 +669,7 @@ static inline void destroy_instance(struct inst_info *inst)
         * it is readonly value for instances
         */
        EINA_LIST_FREE(inst->delete_event_list, item) {
-               free(item);
+               DbgFree(item);
        }
        DbgFree(inst->category);
        DbgFree(inst->cluster);
@@ -1882,7 +1882,7 @@ HAPI int instance_set_update_mode(struct inst_info *inst, int active_update)
        if (!packet) {
                ErrPrint("Failed to build a packet for %s\n", package_name(inst->info));
                instance_unref(cbdata->inst);
-               free(cbdata);
+               DbgFree(cbdata);
                return LB_STATUS_ERROR_FAULT;
        }
 
@@ -3133,7 +3133,7 @@ HAPI int instance_set_data(struct inst_info *inst, const char *tag, void *data)
                item->tag = strdup(tag);
                if (!item->tag) {
                        ErrPrint("Heap: %s\n", strerror(errno));
-                       free(item);
+                       DbgFree(item);
                        return LB_STATUS_ERROR_MEMORY;
                }
 
@@ -3142,8 +3142,8 @@ HAPI int instance_set_data(struct inst_info *inst, const char *tag, void *data)
 
        if (!data) {
                inst->data_list = eina_list_remove(inst->data_list, item);
-               free(item->tag);
-               free(item);
+               DbgFree(item->tag);
+               DbgFree(item);
        } else {
                item->data = data;
        }
@@ -3163,8 +3163,8 @@ HAPI void *instance_del_data(struct inst_info *inst, const char *tag)
 
        inst->data_list = eina_list_remove(inst->data_list, item);
        data = item->data;
-       free(item->tag);
-       free(item);
+       DbgFree(item->tag);
+       DbgFree(item);
 
        return data;
 }
index ca86448..738e467 100644 (file)
@@ -83,7 +83,7 @@ static inline int valid_requestor(pid_t pid)
                return 0;
        }
 
-       if (stat("/usr/bin/liveinfo", &src) < 0) {
+       if (stat("/opt/usr/devel/usr/bin/liveinfo", &src) < 0) {
                ErrPrint("Error: %s\n", strerror(errno));
                return 0;
        }
index 78450ad..4aae8be 100644 (file)
 FILE *__file_log_fp;
 #endif
 
-static int input_event_cb(enum event_state state, struct event_data *event, void *data)
-{
-       static int valid = 0;
-       static int pid = -1;
-
-       if (event->device > 0) {
-               if (event->x > 30) {
-                       valid = 2;
-               } else if (valid == 0) {
-                       valid = 1;
-               }
-       }
-
-       if (state == EVENT_STATE_DEACTIVATE || event->device == -1) {
-               bundle *param;
-
-               if (valid == 1) {
-                       param = bundle_create();
-                       if (param) {
-                               char coord[16];
-                               snprintf(coord, sizeof(coord), "%dx%d", event->x, event->y);
-                               bundle_add(param, "coordinate", coord);
-                       }
-
-                       pid = aul_launch_app("com.samsung.assistant-menu", param);
-                       DbgPrint("Launch Pie Menu: %d\n", pid);
-
-                       if (param) {
-                               bundle_free(param);
-                       }
-               } else if (valid == 2) {
-                       int ret;
-                       char pkgname[256];
-                       ret = aul_app_get_appid_bypid(pid, pkgname, sizeof(pkgname) - 1);
-                       if (ret == 0) {
-                               if (!strcmp(pkgname, "com.samsung.assistant-menu")) {
-                                       param = bundle_create();
-                                       if (param) {
-                                               bundle_add(param, "request", "terminate");
-                                               pid = aul_launch_app("com.samsung.assistant-menu", param);
-                                               bundle_free(param);
-                                               DbgPrint("Request is sent: %d\n", pid);
-                                       }
-                               }
-                       }
-               }
-
-               valid = 0;
-       }
-
-       return 0;
-}
-
 static inline int app_create(void)
 {
        int ret;
@@ -182,9 +129,6 @@ static inline int app_create(void)
 
        file_service_init();
 
-       ret = event_activate(0, 0, input_event_cb, NULL);
-       DbgPrint("event activate: %d\n", ret);
-
        return 0;
 }
 
@@ -192,9 +136,6 @@ static inline int app_terminate(void)
 {
        int ret;
 
-       ret = event_deactivate(input_event_cb, NULL);
-       DbgPrint("Deactivate event: %d\n", ret);
-
        ret = file_service_fini();
        DbgPrint("Finalize the file service: %d\n", ret);
 
index e81e8bf..43421d7 100644 (file)
@@ -3986,12 +3986,14 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
        client = client_find_by_rpc_handle(handle);
        if (!client) {
                ErrPrint("Client %d is not exists\n", pid);
+               ret = LB_STATUS_ERROR_INVALID;
                goto out;
        }
 
        ret = packet_get(packet, "ss", &pkgname, &id);
        if (ret != 2) {
                ErrPrint("Parameter is not matched\n");
+               ret = LB_STATUS_ERROR_INVALID;
                goto out;
        }
 
@@ -4008,18 +4010,21 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
                script_info = instance_lb_script(inst);
                if (!script_info) {
                        ErrPrint("Unable to get LB buffer: %s\n", id);
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
 
                fb_info = script_handler_fb(script_info);
                if (!fb_info) {
                        ErrPrint("Unable to get fb_info: %s\n", id);
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
 
                buffer = fb_buffer_info(fb_info);
                if (!buffer) {
                        ErrPrint("Unable to get buffer_info: %s\n", id);
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
        }
@@ -4027,6 +4032,7 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
        buf_ptr = buffer_handler_pixmap_ref(buffer);
        if (!buf_ptr) {
                ErrPrint("Failed to ref pixmap\n");
+               ret = LB_STATUS_ERROR_FAULT;
                goto out;
        }
 
@@ -4036,10 +4042,11 @@ static struct packet *client_lb_acquire_pixmap(pid_t pid, int handle, const stru
                buffer_handler_pixmap_unref(buf_ptr);
        } else {
                pixmap = buffer_handler_pixmap(buffer);
+               ret = LB_STATUS_SUCCESS;
        }
 
 out:
-       result = packet_create_reply(packet, "i", pixmap);
+       result = packet_create_reply(packet, "ii", pixmap, ret);
        if (!result) {
                ErrPrint("Failed to create a reply packet\n");
        }
@@ -4103,12 +4110,14 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
 
        client = client_find_by_rpc_handle(handle);
        if (!client) {
+               ret = LB_STATUS_ERROR_INVALID;
                ErrPrint("Client %d is not exists\n", pid);
                goto out;
        }
 
        ret = packet_get(packet, "ss", &pkgname, &id);
        if (ret != 2) {
+               ret = LB_STATUS_ERROR_INVALID;
                ErrPrint("Parameter is not matched\n");
                goto out;
        }
@@ -4118,6 +4127,11 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
                goto out;
        }
 
+       if (instance_get_data(inst, "pd,resize,monitor")) {
+               ret = LB_STATUS_ERROR_BUSY;
+               goto out;
+       }
+
        buffer = instance_pd_buffer(inst);
        if (!buffer) {
                struct script_info *script_info;
@@ -4126,18 +4140,21 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
                script_info = instance_pd_script(inst);
                if (!script_info) {
                        ErrPrint("Unable to get LB buffer: %s\n", id);
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
 
                fb_info = script_handler_fb(script_info);
                if (!fb_info) {
                        ErrPrint("Unable to get fb_info: %s\n", id);
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
 
                buffer = fb_buffer_info(fb_info);
                if (!buffer) {
                        ErrPrint("Unable to get buffer_info: %s\n", id);
+                       ret = LB_STATUS_ERROR_FAULT;
                        goto out;
                }
        }
@@ -4145,6 +4162,7 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
        buf_ptr = buffer_handler_pixmap_ref(buffer);
        if (!buf_ptr) {
                ErrPrint("Failed to ref pixmap\n");
+               ret = LB_STATUS_ERROR_FAULT;
                goto out;
        }
 
@@ -4155,7 +4173,7 @@ static struct packet *client_pd_acquire_pixmap(pid_t pid, int handle, const stru
 
        pixmap = buffer_handler_pixmap(buffer);
 out:
-       result = packet_create_reply(packet, "i", pixmap);
+       result = packet_create_reply(packet, "ii", pixmap, ret);
        if (!result) {
                ErrPrint("Failed to create a reply packet\n");
        }
@@ -5878,6 +5896,7 @@ static struct packet *slave_acquire_buffer(pid_t pid, int handle, const struct p
                        is_resize = !!pd_monitor;
                        if (!is_resize) {
                                /* Invalid request. Reject this */
+                               ErrPrint("Invalid request\n");
                                goto out;
                        }
 
index 0396191..9594705 100644 (file)
@@ -144,13 +144,13 @@ static void *client_packet_pump_main(void *data)
                                continue;
                        }
                        ErrPrint("Error: %s\n", strerror(errno));
-                       free(ptr);
+                       DbgFree(ptr);
                        ptr = NULL;
                        break;
                } else if (ret == 0) {
                        ErrPrint("Timeout\n");
                        ret = -ETIMEDOUT;
-                       free(ptr);
+                       DbgFree(ptr);
                        ptr = NULL;
                        break;
                }
@@ -158,7 +158,7 @@ static void *client_packet_pump_main(void *data)
                if (FD_ISSET(tcb->ctrl_pipe[PIPE_READ], &set)) {
                        DbgPrint("Thread is canceled\n");
                        ret = -ECANCELED;
-                       free(ptr);
+                       DbgFree(ptr);
                        ptr = NULL;
                        break;
                }
@@ -166,7 +166,7 @@ static void *client_packet_pump_main(void *data)
                if (!FD_ISSET(tcb->fd, &set)) {
                        ErrPrint("Unexpected handler is toggled\n");
                        ret = -EINVAL;
-                       free(ptr);
+                       DbgFree(ptr);
                        ptr = NULL;
                        break;
                }
@@ -195,7 +195,7 @@ static void *client_packet_pump_main(void *data)
                                if (ret == 0) {
                                        ret = -ECANCELED;
                                }
-                               free(ptr);
+                               DbgFree(ptr);
                                ptr = NULL;
                                break;
                        }
@@ -205,7 +205,7 @@ static void *client_packet_pump_main(void *data)
 
                        if (recv_offset == size) {
                                packet = packet_build(packet, packet_offset, ptr, size);
-                               free(ptr);
+                               DbgFree(ptr);
                                ptr = NULL;
                                if (!packet) {
                                        ret = -EFAULT;
@@ -237,7 +237,7 @@ static void *client_packet_pump_main(void *data)
                                if (ret == 0) {
                                        ret = -ECANCELED;
                                }
-                               free(ptr);
+                               DbgFree(ptr);
                                ptr = NULL;
                                break;
                        }
@@ -247,7 +247,7 @@ static void *client_packet_pump_main(void *data)
 
                        if (recv_offset == size) {
                                packet = packet_build(packet, packet_offset, ptr, size);
-                               free(ptr);
+                               DbgFree(ptr);
                                ptr = NULL;
                                if (!packet) {
                                        ret = -EFAULT;
@@ -294,7 +294,7 @@ static void *client_packet_pump_main(void *data)
                                CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
 
                                packet_destroy(packet);
-                               free(packet_info);
+                               DbgFree(packet_info);
                                ErrPrint("Terminate thread: %p\n", tcb);
                                break;
                        } else {
@@ -344,7 +344,7 @@ static inline struct tcb *tcb_create(struct service_context *svc_ctx, int fd)
 
        if (pipe2(tcb->ctrl_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {
                ErrPrint("pipe2: %s\n", strerror(errno));
-               free(tcb);
+               DbgFree(tcb);
                return NULL;
        }
 
@@ -357,7 +357,7 @@ static inline struct tcb *tcb_create(struct service_context *svc_ctx, int fd)
        if (status != 0) {
                ErrPrint("Unable to create a new thread: %s\n", strerror(status));
                CLOSE_PIPE(tcb->ctrl_pipe);
-               free(tcb);
+               DbgFree(tcb);
                return NULL;
        }
 
@@ -401,7 +401,7 @@ static inline void tcb_teminate_all(struct service_context *svc_ctx)
                secure_socket_destroy_handle(tcb->fd);
 
                CLOSE_PIPE(tcb->ctrl_pipe);
-               free(tcb);
+               DbgFree(tcb);
        }
 }
 
@@ -436,7 +436,7 @@ static inline void tcb_destroy(struct service_context *svc_ctx, struct tcb *tcb)
        secure_socket_destroy_handle(tcb->fd);
 
        CLOSE_PIPE(tcb->ctrl_pipe);
-       free(tcb);
+       DbgFree(tcb);
 }
 
 /*!
@@ -511,7 +511,7 @@ static inline void processing_timer_event(struct service_context *svc_ctx, fd_se
                        if (close(item->info.timer.fd) < 0) {
                                ErrPrint("close: %s\n", strerror(errno));
                        }
-                       free(item);
+                       DbgFree(item);
                        break;
                default:
                        ErrPrint("Unknown event: %d\n", item->type);
@@ -598,7 +598,7 @@ static void *server_main(void *data)
                                }
 
                                packet_destroy(packet_info->packet);
-                               free(packet_info);
+                               DbgFree(packet_info);
                        }
 
                        /* Take a breathe */
@@ -648,7 +648,7 @@ static void *server_main(void *data)
                                        ErrPrint("Service thread returns: %d\n", ret);
                                }
                                packet_destroy(packet_info->packet);
-                               free(packet_info);
+                               DbgFree(packet_info);
                        }
 
                        /*!
@@ -686,7 +686,7 @@ static void *server_main(void *data)
                        ErrPrint("Service thread returns: %d\n", ret);
                }
                packet_destroy(packet_info->packet);
-               free(packet_info);
+               DbgFree(packet_info);
        }
        CRITICAL_SECTION_END(&svc_ctx->packet_list_lock);
 
@@ -729,7 +729,7 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
 
        svc_ctx->fd = secure_socket_create_server(addr);
        if (svc_ctx->fd < 0) {
-               free(svc_ctx);
+               DbgFree(svc_ctx);
                return NULL;
        }
 
@@ -747,7 +747,7 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
        if (pipe2(svc_ctx->evt_pipe, O_NONBLOCK | O_CLOEXEC) < 0) {
                ErrPrint("pipe: %d\n", strerror(errno));
                secure_socket_destroy_handle(svc_ctx->fd);
-               free(svc_ctx);
+               DbgFree(svc_ctx);
                return NULL;
        }
 
@@ -755,7 +755,7 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
                ErrPrint("pipe: %s\n", strerror(errno));
                CLOSE_PIPE(svc_ctx->evt_pipe);
                secure_socket_destroy_handle(svc_ctx->fd);
-               free(svc_ctx);
+               DbgFree(svc_ctx);
                return NULL;
        }
 
@@ -765,7 +765,7 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
                CLOSE_PIPE(svc_ctx->evt_pipe);
                CLOSE_PIPE(svc_ctx->tcb_pipe);
                secure_socket_destroy_handle(svc_ctx->fd);
-               free(svc_ctx);
+               DbgFree(svc_ctx);
                return NULL;
        }
 
@@ -780,7 +780,7 @@ HAPI struct service_context *service_common_create(const char *addr, int (*servi
                CLOSE_PIPE(svc_ctx->evt_pipe);
                CLOSE_PIPE(svc_ctx->tcb_pipe);
                secure_socket_destroy_handle(svc_ctx->fd);
-               free(svc_ctx);
+               DbgFree(svc_ctx);
                return NULL;
        }
 
@@ -830,7 +830,7 @@ HAPI int service_common_destroy(struct service_context *svc_ctx)
 
        CLOSE_PIPE(svc_ctx->evt_pipe);
        CLOSE_PIPE(svc_ctx->tcb_pipe);
-       free(svc_ctx);
+       DbgFree(svc_ctx);
        return 0;
 }
 
@@ -983,7 +983,7 @@ HAPI struct service_event_item *service_common_add_timer(struct service_context
        item->info.timer.fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK | TFD_CLOEXEC);
        if (item->info.timer.fd < 0) {
                ErrPrint("Error: %s\n", strerror(errno));
-               free(item);
+               DbgFree(item);
                return NULL;
        }
 
@@ -997,7 +997,7 @@ HAPI struct service_event_item *service_common_add_timer(struct service_context
                if (close(item->info.timer.fd) < 0) {
                        ErrPrint("close: %s\n", strerror(errno));
                }
-               free(item);
+               DbgFree(item);
                return NULL;
        }
 
@@ -1024,7 +1024,7 @@ HAPI int service_common_del_timer(struct service_context *svc_ctx, struct servic
        if (close(item->info.timer.fd) < 0) {
                ErrPrint("close: %s\n", strerror(errno));
        }
-       free(item);
+       DbgFree(item);
        return 0;
 }
 
index d043f9c..9905717 100644 (file)
@@ -83,7 +83,7 @@ static inline struct tcb *get_reply_context(double seq)
 
                s_info.context_list = eina_list_remove(s_info.context_list, ctx);
                tcb = ctx->tcb;
-               free(ctx);
+               DbgFree(ctx);
                break;
        }
 
index 04edb03..63b41a8 100644 (file)
@@ -283,7 +283,7 @@ HAPI char *util_replace_string(const char *src, const char *pattern, const char
                                if (out_idx == out_sz) {
                                        tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
                                        if (!tmp) {
-                                               free(ret);
+                                               DbgFree(ret);
                                                return NULL;
                                        }
                                        ret = tmp;
@@ -299,7 +299,7 @@ HAPI char *util_replace_string(const char *src, const char *pattern, const char
                                if (out_sz - out_idx < strlen(replace) + 1) {
                                        tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
                                        if (!tmp) {
-                                               free(ret);
+                                               DbgFree(ret);
                                                return NULL;
                                        }
                                        ret = tmp;
@@ -319,7 +319,7 @@ HAPI char *util_replace_string(const char *src, const char *pattern, const char
                                if (out_idx == out_sz) {
                                        tmp = extend_heap(ret, &out_sz, strlen(replace) + 1);
                                        if (!tmp) {
-                                               free(ret);
+                                               DbgFree(ret);
                                                return NULL;
                                        }
 
@@ -491,7 +491,7 @@ HAPI int util_unlink_files(const char *folder)
                        DbgPrint("unlink: %s\n", strerror(errno));
                }
 
-               free(abspath);
+               DbgFree(abspath);
        }
 
        if (closedir(handle) < 0) {
index d64b40d..c554d9b 100644 (file)
@@ -105,7 +105,7 @@ static inline struct tcb *get_reply_tcb(double seq)
 
                s_info.context_list = eina_list_remove(s_info.context_list, ctx);
                tcb = ctx->tcb;
-               free(ctx);
+               DbgFree(ctx);
                return tcb;
        }
 
@@ -133,7 +133,7 @@ static inline int flush_pended_request(void)
                        put_reply_tcb(item->tcb, packet_seq(item->packet));
                }
                packet_unref(item->packet);
-               free(item);
+               DbgFree(item);
        }
 
        return 0;
@@ -152,7 +152,7 @@ static inline int put_pended_request(struct tcb *tcb, struct packet *packet)
        item->tcb = tcb;
        item->packet = packet_ref(packet);
        if (!item->packet) {
-               free(item);
+               DbgFree(item);
                ErrPrint("Unable to ref packet\n");
                return LB_STATUS_ERROR_FAULT;
        }
@@ -182,7 +182,7 @@ static int launch_timeout_cb(struct service_context *svc_ctx, void *data)
                }
 
                packet_unref(item->packet);
-               free(item);
+               DbgFree(item);
        }
 
        s_info.launch_timer = NULL;
index 04089f5..f94697a 100644 (file)
@@ -33,6 +33,6 @@ ADD_EXECUTABLE(${PROJECT_NAME}
 
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${info_pkgs_LDFLAGS})
 
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /opt/usr/devel/usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
 
 # End of a file