From f44c33dcc6ca6dc64427f90eaa7de8d0a9ac5636 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Mon, 8 Jun 2015 15:23:48 +0900 Subject: [PATCH 01/16] Apply Scaled W,H for touch events Change-Id: I273417c23760681e42f1733b3079b8aae0f50a00 --- include/event.h | 4 +- pkgmgr_widget/common/CMakeLists.txt | 4 +- src/event.c | 8 +- src/main.c | 1 + src/parser.c | 2 - src/pkgmgr.c | 1 - src/server.c | 216 ++++++++++++++++++++++-------------- src/shortcut_service.c | 3 +- src/slave_life.c | 30 ++++- 9 files changed, 171 insertions(+), 98 deletions(-) diff --git a/include/event.h b/include/event.h index 6778ec9..924ab94 100644 --- a/include/event.h +++ b/include/event.h @@ -34,6 +34,8 @@ struct event_data { int updated; /* Timestamp is updated */ double tv; input_event_source_e source; + double ratio_w; + double ratio_h; }; enum event_state { @@ -54,7 +56,7 @@ enum event_handler_activate_type { extern int event_init(void); extern int event_fini(void); extern int event_input_fd(void); -extern int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data); +extern int event_activate(int x, int y, double ratio_w, double ratio_h, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data); extern int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data); extern int event_is_activated(void); extern int event_reset_cbdata(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data, void *new_data); diff --git a/pkgmgr_widget/common/CMakeLists.txt b/pkgmgr_widget/common/CMakeLists.txt index 66496d3..463a665 100644 --- a/pkgmgr_widget/common/CMakeLists.txt +++ b/pkgmgr_widget/common/CMakeLists.txt @@ -1,10 +1,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6) PROJECT(common C) -SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) ADD_LIBRARY(${PROJECT_NAME} STATIC src/common.c diff --git a/src/event.c b/src/event.c index a76357a..4b8872e 100644 --- a/src/event.c +++ b/src/event.c @@ -111,6 +111,8 @@ struct event_listener { double tv; int x; /* RelX */ int y; /* RelY */ + double ratio_w; + double ratio_h; }; static int event_control_fini(void); @@ -571,6 +573,8 @@ static int invoke_event_cb(struct event_listener *listener, struct event_data *i modified_item.x -= listener->x; modified_item.y -= listener->y; + modified_item.ratio_w = listener->ratio_w; + modified_item.ratio_h = listener->ratio_h; if (!WIDGET_CONF_USE_EVENT_TIME) { item->tv = current_time_get(); @@ -960,7 +964,7 @@ int event_deactivate_thread(enum event_handler_activate_type activate_type) /*! * x, y is the starting point. */ -HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data) +HAPI int event_activate(int x, int y, double ratio_w, double ratio_h, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data) { struct event_listener *listener; int ret = WIDGET_ERROR_NONE; @@ -988,6 +992,8 @@ HAPI int event_activate(int x, int y, int (*event_cb)(enum event_state state, st listener->state = EVENT_STATE_ACTIVATE; listener->x = x; listener->y = y; + listener->ratio_w = ratio_w; + listener->ratio_h = ratio_h; if (s_info.event_handler_activated == EVENT_HANDLER_DEACTIVATED) { /*! diff --git a/src/main.c b/src/main.c index 3bee66a..c5cc9f8 100644 --- a/src/main.c +++ b/src/main.c @@ -365,6 +365,7 @@ int main(int argc, char *argv[]) } widget_conf_init(); + widget_conf_set_search_input_node(1); widget_conf_load(); widget_abi_init(); diff --git a/src/parser.c b/src/parser.c index 6177dd0..41c4957 100644 --- a/src/parser.c +++ b/src/parser.c @@ -34,10 +34,8 @@ static Eina_List *s_list; int errno; - #define RETURN_TYPE long - struct parser { char *filename; double period; diff --git a/src/pkgmgr.c b/src/pkgmgr.c index b3f1365..8201e0b 100644 --- a/src/pkgmgr.c +++ b/src/pkgmgr.c @@ -463,7 +463,6 @@ static int pkgmgr_cb(uid_t target_uid, int req_id, const char *type, const char return WIDGET_ERROR_NONE; } - HAPI int pkgmgr_init(void) { if (s_info.listen_pc) { diff --git a/src/server.c b/src/server.c index 43b562b..6441984 100644 --- a/src/server.c +++ b/src/server.c @@ -646,7 +646,7 @@ static int mouse_event_widget_route_cb(enum event_state state, struct event_data return WIDGET_ERROR_INVALID_PARAMETER; } - packet = packet_create_noack((const char *)&cmd, "ssdiii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source); + packet = packet_create_noack((const char *)&cmd, "ssdiiidd", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source, event_info->ratio_w, event_info->ratio_h); if (!packet) { return WIDGET_ERROR_FAULT; } @@ -720,15 +720,15 @@ static int mouse_event_widget_consume_cb(enum event_state state, struct event_da */ switch (state) { case EVENT_STATE_ACTIVATE: - script_handler_update_pointer(script, event_info->x, event_info->y, 1); + script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 1); (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp); break; case EVENT_STATE_ACTIVATED: - script_handler_update_pointer(script, event_info->x, event_info->y, -1); + script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, -1); (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp); break; case EVENT_STATE_DEACTIVATE: - script_handler_update_pointer(script, event_info->x, event_info->y, 0); + script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 0); (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp); break; default: @@ -820,7 +820,7 @@ static int mouse_event_gbar_route_cb(enum event_state state, struct event_data * return WIDGET_ERROR_INVALID_PARAMETER; } - packet = packet_create_noack((const char *)&cmd, "ssdiii", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source); + packet = packet_create_noack((const char *)&cmd, "ssdiiidd", package_name(pkg), instance_id(inst), event_info->tv, event_info->x, event_info->y, (int)event_info->source, event_info->ratio_w, event_info->ratio_h); if (!packet) { return WIDGET_ERROR_FAULT; } @@ -895,15 +895,15 @@ static int mouse_event_gbar_consume_cb(enum event_state state, struct event_data switch (state) { case EVENT_STATE_ACTIVATE: - script_handler_update_pointer(script, event_info->x, event_info->y, 1); + script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 1); (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp); break; case EVENT_STATE_ACTIVATED: - script_handler_update_pointer(script, event_info->x, event_info->y, -1); + script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, -1); (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp); break; case EVENT_STATE_DEACTIVATE: - script_handler_update_pointer(script, event_info->x, event_info->y, 0); + script_handler_update_pointer(script, event_info->x * event_info->ratio_w, event_info->y * event_info->ratio_h, 0); (void)script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp); break; default: @@ -1613,6 +1613,8 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1621,8 +1623,8 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Invalid parameter\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1644,7 +1646,7 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp); ret = 0; } else { @@ -1669,6 +1671,8 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1677,8 +1681,8 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1700,7 +1704,7 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp); ret = 0; } else { @@ -1725,6 +1729,8 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1733,8 +1739,8 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1756,7 +1762,7 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, x, y, 1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp); ret = 0; } else { @@ -1781,6 +1787,8 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1789,8 +1797,8 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1812,7 +1820,7 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p goto out; } - script_handler_update_pointer(script, x, y, 0); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp); ret = 0; } else { @@ -1837,6 +1845,8 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1845,8 +1855,8 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1868,7 +1878,7 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp); ret = 0; } else { @@ -1893,6 +1903,8 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1901,8 +1913,8 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1924,7 +1936,7 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp); ret = 0; } else { @@ -1991,7 +2003,7 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa } if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { - ret = event_activate(0, 0, key_event_gbar_route_cb, inst); + ret = event_activate(0, 0, 1.0f, 1.0f, key_event_gbar_route_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2001,7 +2013,7 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa } } } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { - ret = event_activate(0, 0, key_event_gbar_consume_cb, inst); + ret = event_activate(0, 0, 1.0f, 1.0f, key_event_gbar_consume_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2123,7 +2135,7 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct } if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { - ret = event_activate(0, 0, key_event_widget_route_cb, inst); + ret = event_activate(0, 0, 1.0f, 1.0f, key_event_widget_route_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2133,7 +2145,7 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct } } } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { - ret = event_activate(0, 0, key_event_widget_consume_cb, inst); + ret = event_activate(0, 0, 1.0f, 1.0f, key_event_widget_consume_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2234,6 +2246,9 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc int y; struct inst_info *inst; const struct pkg_info *pkg; + int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2242,8 +2257,8 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); - if (ret != 5) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2256,7 +2271,7 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { if (package_direct_input(pkg) == 0 || packet_set_fd((struct packet *)packet, event_input_fd()) < 0) { - ret = event_activate(x, y, mouse_event_widget_route_cb, inst); + ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_widget_route_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2279,7 +2294,7 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc } } } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { - ret = event_activate(x, y, mouse_event_widget_consume_cb, inst); + ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_widget_consume_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2307,6 +2322,9 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str int y; struct inst_info *inst; const struct pkg_info *pkg; + int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2315,8 +2333,8 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); - if (ret != 5) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2330,7 +2348,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { if (package_direct_input(pkg) == 0) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x, y, timestamp); + event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); ret = event_deactivate(mouse_event_widget_route_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -2357,7 +2375,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str } } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x, y, timestamp); + event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); ret = event_deactivate(mouse_event_widget_consume_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -2388,6 +2406,9 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct int y; struct inst_info *inst; const struct pkg_info *pkg; + int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2396,8 +2417,8 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); - if (ret != 5) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2410,7 +2431,7 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) { if (package_direct_input(pkg) == 0 || packet_set_fd((struct packet *)packet, event_input_fd()) < 0) { - ret = event_activate(x, y, mouse_event_gbar_route_cb, inst); + ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_gbar_route_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2433,7 +2454,7 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct } } } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) { - ret = event_activate(x, y, mouse_event_gbar_consume_cb, inst); + ret = event_activate(x, y, ratio_w, ratio_h, mouse_event_gbar_consume_cb, inst); if (ret == WIDGET_ERROR_NONE) { if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { (void)slave_set_priority(package_slave(pkg), WIDGET_CONF_SLAVE_EVENT_BOOST_ON); @@ -2463,6 +2484,8 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2471,8 +2494,8 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const goto out; } - ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2494,7 +2517,7 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp); ret = 0; } else { @@ -2519,6 +2542,8 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2527,8 +2552,8 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons goto out; } - ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2550,7 +2575,7 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp); ret = 0; } else { @@ -2575,6 +2600,8 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2583,8 +2610,8 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2606,7 +2633,7 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp); ret = 0; } else { @@ -2631,6 +2658,8 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2639,8 +2668,8 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2662,7 +2691,7 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp); ret = 0; } else { @@ -2687,6 +2716,8 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2695,8 +2726,8 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2718,7 +2749,7 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp); ret = 0; } else { @@ -2743,6 +2774,8 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2751,8 +2784,8 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2774,7 +2807,7 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp); ret = 0; } else { @@ -2799,6 +2832,8 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2807,8 +2842,8 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2830,7 +2865,7 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp); ret = 0; } else { @@ -2855,6 +2890,8 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2863,8 +2900,8 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2886,7 +2923,7 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp); ret = 0; } else { @@ -2910,6 +2947,9 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc int y; struct inst_info *inst; const struct pkg_info *pkg; + int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2918,8 +2958,8 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &x, &y); - if (ret != 5) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2933,7 +2973,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) { if (package_direct_input(pkg) == 0) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x, y, timestamp); + event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); ret = event_deactivate(mouse_event_gbar_route_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -2942,7 +2982,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc /* * This delete callback will be removed when the instance will be destroyed. if (ret == 0) { - instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb); + instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_route_cb); } */ } else { @@ -2960,7 +3000,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc } } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x, y, timestamp); + event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); ret = event_deactivate(mouse_event_gbar_consume_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -2969,7 +3009,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc /* * This delete callback will be removed when the instance will be destroyed. if (ret == 0) { - instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb); + instance_event_callback_del(inst, INSTANCE_EVENT_DESTROY, inst_del_cb, mouse_event_gbar_consume_cb); } */ } else { @@ -2992,6 +3032,8 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3000,8 +3042,8 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3023,7 +3065,7 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp); ret = 0; } else { @@ -3048,6 +3090,8 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3056,8 +3100,8 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3079,7 +3123,7 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, x, y, -1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp); ret = 0; } else { @@ -3104,6 +3148,8 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3112,8 +3158,8 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3135,7 +3181,7 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru goto out; } - script_handler_update_pointer(script, x, y, 1); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp); ret = 0; } else { @@ -3160,6 +3206,8 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct struct inst_info *inst; const struct pkg_info *pkg; int source; + double ratio_w; + double ratio_h; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3168,8 +3216,8 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiii", &pkgname, &id, ×tamp, &x, &y, &source); - if (ret != 6) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); + if (ret != 8) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3191,7 +3239,7 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, x, y, 0); + script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp); ret = 0; } else { diff --git a/src/shortcut_service.c b/src/shortcut_service.c index 9141f81..3edbf50 100644 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -28,6 +28,7 @@ #include #include +#include #include #include "service_common.h" @@ -93,7 +94,6 @@ static inline struct tcb *get_reply_context(double seq) return tcb; } -/* static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret) { struct packet *reply_packet; @@ -110,7 +110,6 @@ static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret) packet_destroy(reply_packet); } -*/ /*! * SERVICE THREAD diff --git a/src/slave_life.c b/src/slave_life.c index cfa35d5..202b2d1 100644 --- a/src/slave_life.c +++ b/src/slave_life.c @@ -200,7 +200,7 @@ static struct slave_node *slave_deactivate(struct slave_node *slave, int no_time (void)slave_rpc_disconnect(slave); } else if (slave->terminate_timer) { ErrPrint("Terminate timer is already fired (%d)\n", slave->pid); - } else if ((!no_timer && !slave->secured) || slave_is_app(slave)) { + } else if (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave))) { DbgPrint("Fire the terminate timer: %d (%d)\n", slave->pid, slave_is_app(slave)); slave->terminate_timer = ecore_timer_add(WIDGET_CONF_SLAVE_ACTIVATE_TIME, terminate_timer_cb, slave); if (!slave->terminate_timer) { @@ -645,9 +645,19 @@ static Eina_Bool relaunch_timer_cb(void *data) slave->relaunch_timer = NULL; invoke_slave_fault_handler(slave); } else { - bundle *param; + bundle *param = NULL; + + if (slave->extra_bundle_data) { + param = bundle_decode((bundle_raw *)slave->extra_bundle_data, strlen(slave->extra_bundle_data)); + if (!param) { + ErrPrint("Invalid extra_bundle_data[%s]\n", slave->extra_bundle_data); + } + } + + if (!param) { + param = bundle_create(); + } - param = bundle_create(); if (!param) { ErrPrint("Failed to create a bundle\n"); @@ -658,7 +668,12 @@ static Eina_Bool relaunch_timer_cb(void *data) invoke_slave_fault_handler(slave); } else { - bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN); + if (bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN) == BUNDLE_ERROR_KEY_EXISTS) { + if (bundle_del(param, BUNDLE_SLAVE_SVC_OP_TYPE) == BUNDLE_ERROR_NONE) { + DbgPrint("Main operation is deleted\n"); + } + bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN); + } bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_NAME, slave_name(slave)); bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_SECURED, ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured) ? "true" : "false"); bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave->abi); @@ -768,7 +783,12 @@ HAPI int slave_activate(struct slave_node *slave) } } - bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN); + if (bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN) == BUNDLE_ERROR_KEY_EXISTS) { + if (bundle_del(param, BUNDLE_SLAVE_SVC_OP_TYPE) == BUNDLE_ERROR_NONE) { + DbgPrint("Main operation is deleted\n"); + } + bundle_add_str(param, BUNDLE_SLAVE_SVC_OP_TYPE, APP_CONTROL_OPERATION_MAIN); + } bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_NAME, slave_name(slave)); bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_SECURED, ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured) ? "true" : "false"); bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave->abi); -- 2.7.4 From f20e3c2ffafa0b937f65c08c60d741de51d22dd1 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Tue, 9 Jun 2015 13:42:05 +0900 Subject: [PATCH 02/16] Remove unsupported header file (package) security-server. Change-Id: I7895844e9c67d55e589b195e9a2873aefec62991 --- src/shortcut_service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shortcut_service.c b/src/shortcut_service.c index 3edbf50..6197303 100644 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -28,7 +28,7 @@ #include #include -#include +//#include #include #include "service_common.h" -- 2.7.4 From 99107f10acb0c3e2a77b7e56140cba07469380bf Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Tue, 9 Jun 2015 13:45:46 +0900 Subject: [PATCH 03/16] Security server filtering Change-Id: I71d45e82a89ac58c1bf8d8bbdce294e5df43bf78 --- src/shortcut_service.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/shortcut_service.c b/src/shortcut_service.c index 6197303..472c73c 100644 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -28,7 +28,9 @@ #include #include -//#include +#if defined(HAVE_SECURITY_SERVER) +#include +#endif #include #include "service_common.h" @@ -94,6 +96,7 @@ static inline struct tcb *get_reply_context(double seq) return tcb; } +#if defined(HAVE_SECURITY_SERVER) static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret) { struct packet *reply_packet; @@ -110,6 +113,7 @@ static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret) packet_destroy(reply_packet); } +#endif /*! * SERVICE THREAD @@ -135,7 +139,7 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat /* Need to send reply packet */ DbgPrint("%p REQ: Command: [%s]\n", tcb, command); if (!strcmp(command, "add_shortcut_widget") || !strcmp(command, "rm_shortcut_widget")) { - /* +#if defined(HAVE_SECURITY_SERVER) int ret; ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.widget", "w"); if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { @@ -143,9 +147,9 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED); break; } - */ +#endif } else if (!strcmp(command, "add_shortcut") || !strcmp(command, "rm_shortcut")) { - /* +#if defined(HAVE_SECURITY_SERVER) int ret; ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.shortcut", "w"); if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { @@ -153,7 +157,7 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION_DENIED); break; } - */ +#endif } if (service_common_multicast_packet(tcb, packet, TCB_CLIENT_TYPE_SERVICE) < 0) { -- 2.7.4 From f14f3ab5e99746057c5a2d2595959830711824ac Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Tue, 9 Jun 2015 16:53:31 +0900 Subject: [PATCH 04/16] Set ratio_w,h for event_set_xy Change-Id: Ie0b0c80900ccfcbc0dff1ba7b58d3a16042f0881 --- include/event.h | 2 +- src/event.c | 4 +++- src/server.c | 8 ++++---- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/event.h b/include/event.h index 924ab94..64acb5b 100644 --- a/include/event.h +++ b/include/event.h @@ -64,6 +64,6 @@ extern int event_reset_cbdata(int (*event_cb)(enum event_state state, struct eve extern int event_deactivate_thread(enum event_handler_activate_type activate_type); extern int event_activate_thread(enum event_handler_activate_type activate_type); -extern void event_set_mouse_xy(int x, int y, double timestamp); +extern void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, double timestamp); /* End of a file */ diff --git a/src/event.c b/src/event.c index 4b8872e..47ce633 100644 --- a/src/event.c +++ b/src/event.c @@ -1103,10 +1103,12 @@ HAPI int event_is_activated(void) return s_info.handle >= 0; } -HAPI void event_set_mouse_xy(int x, int y, double timestamp) +HAPI void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, double timestamp) { s_info.event_data.x = x; s_info.event_data.y = y; + s_info.event_data.ratio_w = ratio_w; + s_info.event_data.ratio_h = ratio_h; s_info.event_data.tv = timestamp; s_info.event_data.source = INPUT_EVENT_SOURCE_VIEWER; /** diff --git a/src/server.c b/src/server.c index 6441984..6722a98 100644 --- a/src/server.c +++ b/src/server.c @@ -2348,7 +2348,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { if (package_direct_input(pkg) == 0) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); + event_set_mouse_xy(x, y, ratio_w, ratio_h, timestamp); ret = event_deactivate(mouse_event_widget_route_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -2375,7 +2375,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str } } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); + event_set_mouse_xy(x, y, ratio_w, ratio_h, timestamp); ret = event_deactivate(mouse_event_widget_consume_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -2973,7 +2973,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc if (package_gbar_type(pkg) == GBAR_TYPE_BUFFER) { if (package_direct_input(pkg) == 0) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); + event_set_mouse_xy(x, y, ratio_w, ratio_h, timestamp); ret = event_deactivate(mouse_event_gbar_route_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { @@ -3000,7 +3000,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc } } else if (package_gbar_type(pkg) == GBAR_TYPE_SCRIPT) { /* Forcely update the X,Y position using viewer's */ - event_set_mouse_xy(x * ratio_w, y * ratio_h, timestamp); + event_set_mouse_xy(x, y, ratio_w, ratio_h, timestamp); ret = event_deactivate(mouse_event_gbar_consume_cb, inst); if (WIDGET_CONF_SLAVE_EVENT_BOOST_OFF != WIDGET_CONF_SLAVE_EVENT_BOOST_ON) { -- 2.7.4 From d6a1e82352b5476d4daac5c2cd0e6b9b5aef6c19 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 11 Jun 2015 13:09:21 +0900 Subject: [PATCH 05/16] Update wayland initialization code Change-Id: I7fb7fb02ee7aa557873b9a4050bd059d7f7cb2c0 --- src/util_wayland.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/util_wayland.c b/src/util_wayland.c index 41297a7..7a64e7f 100644 --- a/src/util_wayland.c +++ b/src/util_wayland.c @@ -26,21 +26,19 @@ int util_screen_size_get(int *width, int *height) } ecore_wl_screen_size_get(width, height); - return WIDGET_ERROR_NOT_SUPPORTED; + return WIDGET_ERROR_NONE; } int util_screen_init(void) { s_info.initialized = 1; - ecore_wl_init(NULL); - return WIDGET_ERROR_NONE; + return ecore_wl_init(NULL); } int util_screen_fini(void) { s_info.initialized = 0; - ecore_wl_shutdown(); - return WIDGET_ERROR_NONE; + return ecore_wl_shutdown(); } /* End of a file */ -- 2.7.4 From 606e79f7b638d3f519ef6353f2b96eb98e5bc8fa Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Tue, 16 Jun 2015 13:52:45 +0900 Subject: [PATCH 06/16] Add new plugin for package manager Change-Id: Ic5328f651388a2d5ff083ab2d81862c3229c02ee --- data/data-provider-master.service | 1 - data/emulator/x11.mobile.540x960.conf.ini | 2 +- packaging/data-provider-master.manifest | 2 +- pkgmgr_widget/CMakeLists.txt | 2 + pkgmgr_widget/common/src/common.c | 201 +++++++++++++++++++-- pkgmgr_widget/widget-application/CMakeLists.txt | 15 ++ .../widget-application/src/service_widget.c | 183 +++++++++++++++++++ 7 files changed, 384 insertions(+), 22 deletions(-) create mode 100644 pkgmgr_widget/widget-application/CMakeLists.txt create mode 100644 pkgmgr_widget/widget-application/src/service_widget.c diff --git a/data/data-provider-master.service b/data/data-provider-master.service index 283d13f..45e6589 100644 --- a/data/data-provider-master.service +++ b/data/data-provider-master.service @@ -21,7 +21,6 @@ After=xorg.target [Service] User=system Group=system -SmackProcessLabel=data-provider-master::bin Environment=BUFMGR_LOCK_TYPE="once" Environment=BUFMGR_MAP_CACHE="true" Type=notify diff --git a/data/emulator/x11.mobile.540x960.conf.ini b/data/emulator/x11.mobile.540x960.conf.ini index b2962dd..3c85ec7 100644 --- a/data/emulator/x11.mobile.540x960.conf.ini +++ b/data/emulator/x11.mobile.540x960.conf.ini @@ -30,7 +30,7 @@ debug_mode=false overwrite_content=false com_core_thread=true use_xmonitor=false -input=sec_touchscreen +input=/dev/input/event2 gbar_request_timeout=5.0 premultiplied=0 #emergency_disk=source=tmpfs;type=tmpfs;option=size=6M diff --git a/packaging/data-provider-master.manifest b/packaging/data-provider-master.manifest index 850aa0a..5b14a70 100644 --- a/packaging/data-provider-master.manifest +++ b/packaging/data-provider-master.manifest @@ -82,6 +82,6 @@ - + diff --git a/pkgmgr_widget/CMakeLists.txt b/pkgmgr_widget/CMakeLists.txt index dc47d02..5454dc8 100644 --- a/pkgmgr_widget/CMakeLists.txt +++ b/pkgmgr_widget/CMakeLists.txt @@ -20,8 +20,10 @@ INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/common/include) ADD_SUBDIRECTORY(common) ADD_SUBDIRECTORY(watch) ADD_SUBDIRECTORY(widget) +ADD_SUBDIRECTORY(widget-application) ADD_DEPENDENCIES("watch-application" "common") ADD_DEPENDENCIES("widget" "common") +ADD_DEPENDENCIES("widget-application" "common") # End of a file diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index f1d24a3..7a93487 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -2314,6 +2314,96 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node) } } +static void update_support_size(struct widget *widget, xmlNodePtr node) +{ + xmlChar *size; + int is_easy = 0; + + size = xmlNodeGetContent(node); + if (!size) { + ErrPrint("Invalid size tag\n"); + return; + } + + widget->default_mouse_event = 0; + widget->default_touch_effect = 1; + widget->default_need_frame = 0; + + if (xmlHasProp(node, (const xmlChar *)"mode")) { + xmlChar *mode; + mode = xmlGetProp(node, (const xmlChar *)"mode"); + if (mode) { + DbgPrint("Easy mode: %s\n", mode); + is_easy = !xmlStrcasecmp(mode, (const xmlChar *)"easy"); + xmlFree(mode); + } + } + + if (!xmlStrcasecmp(size, (const xmlChar *)"1x1")) { + if (is_easy) { + widget->size_list |= WIDGET_SIZE_TYPE_EASY_1x1; + update_size_info(widget, 9, node); + } else { + widget->size_list |= WIDGET_SIZE_TYPE_1x1; + update_size_info(widget, 0, node); + } + } else if (!xmlStrcasecmp(size, (const xmlChar *)"3x1")) { + if (is_easy) { + widget->size_list |= WIDGET_SIZE_TYPE_EASY_3x1; + update_size_info(widget, 10, node); + } else { + ErrPrint("Invalid size tag (%s)\n", size); + } + } else if (!xmlStrcasecmp(size, (const xmlChar *)"3x3")) { + if (is_easy) { + widget->size_list |= WIDGET_SIZE_TYPE_EASY_3x3; + update_size_info(widget, 11, node); + } else { + ErrPrint("Invalid size tag (%s)\n", size); + } + } else if (!xmlStrcasecmp(size, (const xmlChar *)"2x1")) { + widget->size_list |= WIDGET_SIZE_TYPE_2x1; + update_size_info(widget, 1, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"2x2")) { + widget->size_list |= WIDGET_SIZE_TYPE_2x2; + update_size_info(widget, 2, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x1")) { + widget->size_list |= WIDGET_SIZE_TYPE_4x1; + update_size_info(widget, 3, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x2")) { + widget->size_list |= WIDGET_SIZE_TYPE_4x2; + update_size_info(widget, 4, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x3")) { + widget->size_list |= WIDGET_SIZE_TYPE_4x3; + update_size_info(widget, 5, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x4")) { + widget->size_list |= WIDGET_SIZE_TYPE_4x4; + update_size_info(widget, 6, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x5")) { + widget->size_list |= WIDGET_SIZE_TYPE_4x5; + update_size_info(widget, 7, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"4x6")) { + widget->size_list |= WIDGET_SIZE_TYPE_4x6; + update_size_info(widget, 8, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"21x21")) { + widget->size_list |= WIDGET_SIZE_TYPE_EASY_1x1; + update_size_info(widget, 9, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"23x21")) { + widget->size_list |= WIDGET_SIZE_TYPE_EASY_3x1; + update_size_info(widget, 10, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"23x23")) { + widget->size_list |= WIDGET_SIZE_TYPE_EASY_3x3; + update_size_info(widget, 11, node); + } else if (!xmlStrcasecmp(size, (const xmlChar *)"0x0")) { + widget->size_list |= WIDGET_SIZE_TYPE_FULL; + update_size_info(widget, 12, node); + } else { + ErrPrint("Invalid size tag (%s)\n", size); + } + + xmlFree(size); +} + static void update_box(struct widget *widget, xmlNodePtr node) { if (!xmlHasProp(node, (const xmlChar *)"type")) { @@ -3023,12 +3113,37 @@ int db_install_widget(xmlNodePtr node, const char *appid) widget_destroy(widget); return -EFAULT; } + } + + /** + * @note + * originally, "type" attribute is sticked with "box" tag. + * But for the "widget-application" style tag, this "type" attribute is moved to "widget-application". + * And there is no "box" tag. + */ + if (!xmlHasProp(node, (const xmlChar *)"type")) { + widget->widget_type = WIDGET_TYPE_FILE; } else { - widget->abi = xmlStrdup((const xmlChar *)"c"); - if (!widget->abi) { - ErrPrint("xmlstrdup: %d\n", errno); - widget_destroy(widget); - return -ENOMEM; + xmlChar *type; + + type = xmlGetProp(node, (const xmlChar *)"type"); + if (!type) { + ErrPrint("Type is NIL\n"); + widget->widget_type = WIDGET_TYPE_FILE; + } else { + if (!xmlStrcasecmp(type, (const xmlChar *)"text")) { + widget->widget_type = WIDGET_TYPE_TEXT; + } else if (!xmlStrcasecmp(type, (const xmlChar *)"buffer")) { + widget->widget_type = WIDGET_TYPE_BUFFER; + } else if (!xmlStrcasecmp(type, (const xmlChar *)"script")) { + widget->widget_type = WIDGET_TYPE_SCRIPT; + } else if (!xmlStrcasecmp(type, (const xmlChar *)"elm")) { + widget->widget_type = WIDGET_TYPE_UIFW; + } else { /* Default */ + widget->widget_type = WIDGET_TYPE_FILE; + } + + xmlFree(type); } } @@ -3052,27 +3167,70 @@ int db_install_widget(xmlNodePtr node, const char *appid) abspath((char *)widget->libexec, (char *)tmp_libexec); xmlFree(widget->libexec); widget->libexec = tmp_libexec; - } else if (!xmlStrcasecmp(widget->abi, (const xmlChar *)"c") || !xmlStrcasecmp(widget->abi, (const xmlChar *)"cpp")) { - char *filename; - int len; - len = strlen((char *)widget->pkgid) + strlen("/libexec/liblive-.so") + 1; + if (!widget->abi) { + /** + * @note + * If there is no "abi" attribute, + * Assumes it "c" in this case. + * abi="c" can only has the "libexec" attribute + */ + widget->abi = xmlStrdup((const xmlChar *)"c"); + if (!widget->abi) { + ErrPrint("xmlstrdup: %d\n", errno); + widget_destroy(widget); + return -ENOMEM; + } + } else if (xmlStrcasecmp(widget->abi, (const xmlChar *)"c") && xmlStrcasecmp(widget->abi, (const xmlChar *)"cpp")) { + ErrPrint("libexec with unrecognized abi[%s]\n", (const char *)widget->abi); + } + } else if (xmlHasProp(node, (const xmlChar *)"exec")) { + xmlChar *tmp_libexec; - filename = malloc(len); - if (!filename) { + widget->libexec = xmlGetProp(node, (const xmlChar *)"exec"); + if (!widget->libexec) { + ErrPrint("libexec is NIL\n"); widget_destroy(widget); - return -ENOMEM; + return -EFAULT; } - snprintf(filename, len, "/libexec/liblive-%s.so", widget->pkgid); - widget->libexec = xmlStrdup((xmlChar *)filename); - DbgPrint("Use the default libexec: %s\n", filename); - free(filename); - - if (!widget->libexec) { + tmp_libexec = abspath_strdup(widget->libexec); + if (!tmp_libexec) { + ErrPrint("strdup: %d\n", errno); widget_destroy(widget); - return -ENOMEM; + return -EFAULT; } + + abspath((char *)widget->libexec, (char *)tmp_libexec); + xmlFree(widget->libexec); + widget->libexec = tmp_libexec; + + if (!widget->abi) { + /** + * @note + * If there is no "abi" attribute, + * Assumes it "app" in this case. + * abi="app" can only has the "exec" attribute + */ + widget->abi = xmlStrdup((const xmlChar *)"app"); + if (!widget->abi) { + ErrPrint("xmlstrdup: %d\n", errno); + widget_destroy(widget); + return -ENOMEM; + } + } else if (xmlStrcasecmp(widget->abi, (const xmlChar *)"app")) { + ErrPrint("exec with unrecognized abi[%s]\n", (const char *)widget->abi); + } + } else { + /** + * @note + * Remove old style fallback processing. + * If the element has no attribute for "libexec" or "exec", this is not valid XML + * stop parsing from here. + */ + ErrPrint("Invalid XML\n"); + widget_destroy(widget); + return -EINVAL; } for (node = node->children; node; node = node->next) { @@ -3096,6 +3254,11 @@ int db_install_widget(xmlNodePtr node, const char *appid) continue; } + if (!xmlStrcasecmp(node->name, (const xmlChar *)"support-size")) { + update_support_size(widget, node); + continue; + } + if (!xmlStrcasecmp(node->name, (const xmlChar *)"glancebar")) { update_glance_bar(widget, node); continue; diff --git a/pkgmgr_widget/widget-application/CMakeLists.txt b/pkgmgr_widget/widget-application/CMakeLists.txt new file mode 100644 index 0000000..c326e2b --- /dev/null +++ b/pkgmgr_widget/widget-application/CMakeLists.txt @@ -0,0 +1,15 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +PROJECT(widget-application C) + +ADD_DEFINITIONS("-DPREFIX=\"${PREFIX}\"") + +INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include) +ADD_LIBRARY(${PROJECT_NAME} MODULE + src/service_widget.c +) + +TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${bin_pkgs_LDFLAGS} common) + +INSTALL(TARGETS ${PROJECT_NAME} DESTINATION "etc/package-manager/parserlib") + +# End of a file diff --git a/pkgmgr_widget/widget-application/src/service_widget.c b/pkgmgr_widget/widget-application/src/service_widget.c new file mode 100644 index 0000000..4c812fc --- /dev/null +++ b/pkgmgr_widget/widget-application/src/service_widget.c @@ -0,0 +1,183 @@ +/* + * Copyright 2013 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "common.h" + +#define WIDGET_TAG "widget-application" +#define EAPI __attribute__((visibility("default"))) + +static inline int remove_all_widgets(const char *appid) +{ + int cnt; + + ErrPrintWithConsole("%s\n", appid); + + begin_transaction(); + cnt = pkglist_get_via_callback(appid, 0, delete_record_cb, NULL); + commit_transaction(); + + if (cnt > 0) { + DbgPrint("Package[%s] is not deleted: %d\n", appid, cnt); + } + + return 0; +} + +EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid) +{ + if (!db_check()) { + if (db_init() < 0) { + ErrPrintWithConsole("Failed to init DB\n"); + return -EIO; + } + } + + db_upgrade_db_schema(); + + return remove_all_widgets(appid); +} + +EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid) +{ + ErrPrintWithConsole("[%s]\n", appid); + db_fini(); + return 0; +} + +EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid) +{ + xmlNodePtr node; + int ret; + + ErrPrintWithConsole("[%s]\n", appid); + + if (!db_check()) { + ErrPrintWithConsole("Failed to init DB\n"); + return -EIO; + } + + node = xmlDocGetRootElement(docPtr); + if (!node) { + ErrPrintWithConsole("Invalid document\n"); + return -EINVAL; + } + + for (node = node->children; node; node = node->next) { + DbgPrint("node->name: %s\n", node->name); + if (!xmlStrcasecmp(node->name, (const xmlChar *)WIDGET_TAG)) { + ret = db_install_widget(node, appid); + if (ret < 0) { + DbgPrint("Returns: %d\n", ret); + } + } + } + + return 0; +} + +EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid) +{ + if (!db_check()) { + if (db_init() < 0) { + ErrPrintWithConsole("Failed to init DB\n"); + return -EIO; + } + } + + db_upgrade_db_schema(); + + return remove_all_widgets(appid); +} + +EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid) +{ + ErrPrintWithConsole("[%s]\n", appid); + db_fini(); + return 0; +} + +EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid) +{ + xmlNodePtr node; + int ret; + + ErrPrintWithConsole("[%s]\n", appid); + + if (!db_check()) { + ErrPrint("Failed to init DB\n"); + return -EIO; + } + + node = xmlDocGetRootElement(docPtr); + if (!node) { + ErrPrint("Invalid document\n"); + return -EINVAL; + } + + for (node = node->children; node; node = node->next) { + if (!xmlStrcasecmp(node->name, (const xmlChar *)WIDGET_TAG)) { + ret = db_install_widget(node, appid); + if (ret < 0) { + DbgPrint("Returns: %d\n", ret); + } + } + } + + return 0; +} + +EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid) +{ + ErrPrintWithConsole("[%s]\n", appid); + + if (!db_check()) { + if (db_init() < 0) { + ErrPrint("Failed to init DB\n"); + return -EIO; + } + } + + db_upgrade_db_schema(); + + return 0; +} + +EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid) +{ + int ret; + + ret = remove_all_widgets(appid); + + db_fini(); + return ret; +} + +EAPI int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char *appid) +{ + ErrPrintWithConsole("[%s]\n", appid); + if (!db_check()) { + return -EIO; + } + + /* Doesn't need to do anything from here, we already dealt it with this */ + + return 0; +} + +/* End of a file */ -- 2.7.4 From b3311fab096ba2f410ce47f4f3f0a4c0af06de5d Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Wed, 17 Jun 2015 12:47:05 +0900 Subject: [PATCH 07/16] Keep the compatibility and fix double free issue for notification Change-Id: I56b60d73117d591f0766e5f0b789291382e4d420 --- pkgmgr_widget/common/src/common.c | 7 ++++--- src/service_common.c | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index 7a93487..6e600d9 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -3228,9 +3228,10 @@ int db_install_widget(xmlNodePtr node, const char *appid) * If the element has no attribute for "libexec" or "exec", this is not valid XML * stop parsing from here. */ - ErrPrint("Invalid XML\n"); - widget_destroy(widget); - return -EINVAL; + widget->libexec = xmlStrdup((const xmlChar *)"empty_path"); + if (!widget->libexec) { + ErrPrint("xmlStrdup: %d\n", errno); + } } for (node = node->children; node; node = node->next) { diff --git a/src/service_common.c b/src/service_common.c index 6eecffe..b06c508 100644 --- a/src/service_common.c +++ b/src/service_common.c @@ -125,7 +125,7 @@ HAPI int service_common_send_packet_to_service(struct service_context *svc_ctx, goto out; } - packet_info->packet = packet; + packet_info->packet = packet_ref(packet); packet_info->tcb = tcb; CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock); @@ -138,13 +138,13 @@ HAPI int service_common_send_packet_to_service(struct service_context *svc_ctx, CRITICAL_SECTION_BEGIN(&svc_ctx->packet_list_lock); svc_ctx->packet_list = eina_list_remove(svc_ctx->packet_list, packet_info); CRITICAL_SECTION_END(&svc_ctx->packet_list_lock); + packet_unref(packet); + DbgFree(packet_info); goto out; } out: - DbgFree(packet_info); - return ret; } -- 2.7.4 From f89663aa004cb71170ffc000371c0073c8476f60 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 25 Jun 2015 10:55:35 +0900 Subject: [PATCH 08/16] Add "path" file to launch the data-provider-master Change-Id: I9e87481f4aa676665ddc9678c17cf0884c21f786 --- data/CMakeLists.txt | 2 ++ data/data-provider-master.path | 5 +++++ 2 files changed, 7 insertions(+) create mode 100644 data/data-provider-master.path diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index a24c08b..5925052 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,4 +1,6 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.service DESTINATION ${LIB_INSTALL_DIR}/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION ${LIB_INSTALL_DIR}/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + IF (LIVEBOX) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_widget.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ENDIF (LIVEBOX) diff --git a/data/data-provider-master.path b/data/data-provider-master.path new file mode 100644 index 0000000..deeeb85 --- /dev/null +++ b/data/data-provider-master.path @@ -0,0 +1,5 @@ +[Unit] +Description=Check the WM_READY file to launch the data-provider-master + +[Path] +PathExists=/run/.wm_ready -- 2.7.4 From f4f89355970ea15933851ecb88510e0b31a56223 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 25 Jun 2015 11:14:30 +0900 Subject: [PATCH 09/16] Update spec file to install path file. Change-Id: I5314e56591d08ffca27eb00da1df42aacd9b8ce7 --- packaging/data-provider-master.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 19634d5..5f50662 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -186,6 +186,7 @@ echo "Successfully installed. Please start a daemon again manually" %caps(cap_chown,cap_dac_override,cap_dac_read_search,cap_sys_admin,cap_sys_nice,cap_mac_override,cap_mac_admin+ep) %{_bindir}/%{name} %{_libdir}/systemd/system/multi-user.target.wants/%{name}.service %{_libdir}/systemd/system/%{name}.service +%{_libdir}/systemd/system/%{name}.path %{_datarootdir}/license/* %if 0%{?tizen_build_binary_release_type_eng} /opt/usr/devel/usr/bin/* -- 2.7.4 From 144d640f6f7fd01837785217fbd5d96916c398cd Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 25 Jun 2015 18:41:17 +0900 Subject: [PATCH 10/16] Sync with the tizen 2.4 SDK Viewer monitoring code is added. Change-Id: Ib69828a6cd5a519fa6debfb275695b6e594cc722 --- CMakeLists.txt | 9 ++++++--- data/CMakeLists.txt | 4 ++-- data/data-provider-master.service | 4 ++++ packaging/data-provider-master.manifest | 9 ++++----- packaging/data-provider-master.spec | 13 ++++++++----- src/server.c | 8 ++++---- src/slave_life.c | 28 +++++++++++++++++++++++++++- 7 files changed, 55 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe7614c..07043d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,7 @@ pkg_check_modules(pkg REQUIRED pkgmgr-info libsystemd-daemon libtbm + capi-appfw-app-manager ) IF (LIVEBOX) @@ -165,6 +166,11 @@ IF (X11_SUPPORT) ) ENDIF (X11_SUPPORT) +STRING(REPLACE "-L-l" "-l" pkg_fixed_LDFLAGS ${pkg_LDFLAGS}) +STRING(REPLACE "-l" " -l" pkg_LDFLAGS ${pkg_fixed_LDFLAGS}) +STRING(REPLACE "-L" " -L" pkg_fixed_LDFLAGS ${pkg_LDFLAGS}) +STRING(REGEX REPLACE "^ " "" pkg_LDFLAGS ${pkg_fixed_LDFLAGS}) + #ADD_DEFINITIONS("-D_APPLY_SCRIPT_ASYNC_UPDATE") #ADD_DEFINITIONS("-DFLOG") ADD_DEFINITIONS(${pkg_CFLAGS}) @@ -174,9 +180,6 @@ ADD_DEFINITIONS(${pkg_extra_LDFLAGS}) ADD_DEFINITIONS(${pkg_widget_CFLAGS}) ADD_DEFINITIONS(${pkg_widget_LDFLAGS}) -STRING(REPLACE "-L-l" "-l" pkg_fixed_LDFLAGS ${pkg_LDFLAGS}) -STRING(REPLACE "-l" " -l" pkg_LDFLAGS ${pkg_fixed_LDFLAGS}) - ADD_EXECUTABLE(${PROJECT_NAME} ${BUILD_SOURCE}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} ${pkg_extra_LDFLAGS} ${pkg_widget_LDFLAGS} "-ldl -lrt -pie") diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 5925052..8950819 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,5 +1,5 @@ -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.service DESTINATION ${LIB_INSTALL_DIR}/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION ${LIB_INSTALL_DIR}/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.service DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) IF (LIVEBOX) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/dump_widget.sh DESTINATION /opt/etc/dump.d/module.d/ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) diff --git a/data/data-provider-master.service b/data/data-provider-master.service index 45e6589..4c710c7 100644 --- a/data/data-provider-master.service +++ b/data/data-provider-master.service @@ -21,6 +21,10 @@ After=xorg.target [Service] User=system Group=system +Environment=ECORE_EVAS_ENGINE=wayland_egl +Environment=ECORE_IMF_INPUT_PANEL_ENABLED=1 +Environment=ECORE_IMF_MODULE=isf +Environment=XDG_RUNTIME_DIR=/tmp Environment=BUFMGR_LOCK_TYPE="once" Environment=BUFMGR_MAP_CACHE="true" Type=notify diff --git a/packaging/data-provider-master.manifest b/packaging/data-provider-master.manifest index 5b14a70..e5dbca7 100644 --- a/packaging/data-provider-master.manifest +++ b/packaging/data-provider-master.manifest @@ -6,7 +6,6 @@