From 3d8dc903879b52febbe5fc895afb51d3d18830fd Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 24 Jul 2015 22:50:18 +0900 Subject: [PATCH 01/16] Sync with the latest tizen 2.4 Change-Id: If420d44f120a3e71494dd15f4da225990a66c969 --- CMakeLists.txt | 17 +- data/CMakeLists.txt | 10 + data/data-provider-master-badge.socket | 16 ++ data/data-provider-master-client.socket | 16 ++ data/data-provider-master-fd.socket | 16 ++ data/data-provider-master-notification.socket | 16 ++ data/data-provider-master-provider.socket | 16 ++ data/data-provider-master-service.socket | 16 ++ data/data-provider-master-shortcut.socket | 16 ++ data/data-provider-master-utility.socket | 16 ++ data/data-provider-master.target | 3 + data/device/abi.ini | 3 + data/emulator/abi.ini | 3 + include/client_life.h | 3 + include/package.h | 2 + include/service_common.h | 1 + include/shared_fd_service.h | 20 ++ include/slave_life.h | 26 ++- include/util.h | 3 - packaging/data-provider-master.spec | 35 +++- pkgmgr_widget/common/src/common.c | 50 ++++- pkgmgr_widget/watch/src/service_watchapp.c | 7 + .../widget-application/src/service_widget.c | 7 + pkgmgr_widget/widget/src/service_widget.c | 7 + src/client_life.c | 52 ++++- src/dead_monitor.c | 17 +- src/instance.c | 69 +++++++ src/main.c | 41 ++-- src/package.c | 143 ++++++++++--- src/server.c | 81 +++----- src/service_common.c | 39 +++- src/shared_fd_service.c | 158 +++++++++++++++ src/slave_life.c | 40 +++- src/util.c | 222 --------------------- src/utility_service.c | 2 +- 35 files changed, 818 insertions(+), 371 deletions(-) create mode 100644 data/data-provider-master-badge.socket create mode 100644 data/data-provider-master-client.socket create mode 100644 data/data-provider-master-fd.socket create mode 100644 data/data-provider-master-notification.socket create mode 100644 data/data-provider-master-provider.socket create mode 100644 data/data-provider-master-service.socket create mode 100644 data/data-provider-master-shortcut.socket create mode 100644 data/data-provider-master-utility.socket create mode 100644 data/data-provider-master.target create mode 100644 include/shared_fd_service.h create mode 100644 src/shared_fd_service.c diff --git a/CMakeLists.txt b/CMakeLists.txt index d7ca326..8ca3785 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,9 +64,11 @@ ADD_DEFINITIONS("-D_GNU_SOURCE") ADD_DEFINITIONS("-D_FILE_OFFSET_BITS=64") ADD_DEFINITIONS("-DINFO_SOCKET=\"/opt/usr/share/live_magazine/.live.socket\"") -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_SOCKET=\"/tmp/.data-provider-master-client.socket\"") +ADD_DEFINITIONS("-DSLAVE_SOCKET=\"/tmp/.data-provider-master-slave.socket\"") +ADD_DEFINITIONS("-DSERVICE_SOCKET=\"/tmp/.data-provider-master-service.socket\"") +ADD_DEFINITIONS("-DSHARED_SOCKET=\"/tmp/.data-provider-master-fd.socket\"") + ADD_DEFINITIONS("-DCATEGORY_WATCH_CLOCK=\"http://tizen.org/category/wearable_clock\"") ADD_DEFINITIONS("-DCLIENT_PORT=\"8208\"") @@ -130,11 +132,12 @@ IF (LIVEBOX) src/file_service.c src/conf.c src/monitor.c + src/shared_fd_service.c ) IF (WAYLAND_SUPPORT) ADD_DEFINITIONS("-DHAVE_WAYLAND") - SET(BUILD_SOURCE + SET(BUILD_SOURCE ${BUILD_SOURCE} src/xmonitor_wayland.c src/buffer_handler_wayland.c @@ -144,7 +147,7 @@ IF (LIVEBOX) IF (X11_SUPPORT) ADD_DEFINITIONS("-DHAVE_X11") - SET(BUILD_SOURCE + SET(BUILD_SOURCE ${BUILD_SOURCE} src/xmonitor.c src/buffer_handler.c @@ -155,7 +158,7 @@ ENDIF (LIVEBOX) IF (WAYLAND_SUPPORT) ADD_DEFINITIONS("-DHAVE_WAYLAND") - SET(BUILD_SOURCE + SET(BUILD_SOURCE ${BUILD_SOURCE} src/util_wayland.c ) @@ -163,7 +166,7 @@ ENDIF (WAYLAND_SUPPORT) IF (X11_SUPPORT) ADD_DEFINITIONS("-DHAVE_X11") - SET(BUILD_SOURCE + SET(BUILD_SOURCE ${BUILD_SOURCE} src/util_x11.c ) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index ef51d99..aa56f64 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -4,3 +4,13 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION /usr/lib 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) + +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/data/data-provider-master-badge.socket b/data/data-provider-master-badge.socket new file mode 100644 index 0000000..bbfd3fa --- /dev/null +++ b/data/data-provider-master-badge.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.badge.service +SocketMode=0666 +SmackLabelIPIn=data-provider-master::badge +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-client.socket b/data/data-provider-master-client.socket new file mode 100644 index 0000000..97727d1 --- /dev/null +++ b/data/data-provider-master-client.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.data-provider-master-client.socket +SocketMode=0666 +SmackLabelIPIn=data-provider-master::client +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-fd.socket b/data/data-provider-master-fd.socket new file mode 100644 index 0000000..0c29dba --- /dev/null +++ b/data/data-provider-master-fd.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.data-provider-master-fd.socket +SocketMode=0666 +SmackLabelIPIn=data-provider-master::fd +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-notification.socket b/data/data-provider-master-notification.socket new file mode 100644 index 0000000..b535537 --- /dev/null +++ b/data/data-provider-master-notification.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.notification.service +SocketMode=0666 +SmackLabelIPIn=data-provider-master::notification +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-provider.socket b/data/data-provider-master-provider.socket new file mode 100644 index 0000000..2428301 --- /dev/null +++ b/data/data-provider-master-provider.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.data-provider-master-slave.socket +SocketMode=0666 +SmackLabelIPIn=data-provider-master::provider +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-service.socket b/data/data-provider-master-service.socket new file mode 100644 index 0000000..c3f7166 --- /dev/null +++ b/data/data-provider-master-service.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.data-provider-master-service.socket +SocketMode=0666 +SmackLabelIPIn=data-provider-master +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-shortcut.socket b/data/data-provider-master-shortcut.socket new file mode 100644 index 0000000..0c3dacd --- /dev/null +++ b/data/data-provider-master-shortcut.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.shortcut.service +SocketMode=0666 +SmackLabelIPIn=data-provider-master::shortcut +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master-utility.socket b/data/data-provider-master-utility.socket new file mode 100644 index 0000000..33d25fd --- /dev/null +++ b/data/data-provider-master-utility.socket @@ -0,0 +1,16 @@ +[Socket] +SocketUser=system +SocketGroup=system +ListenStream=/tmp/.utility.service +SocketMode=0666 +SmackLabelIPIn=data-provider-master::utility +SmackLabelIPOut=@ + +Service=data-provider-master.service + +[Unit] +Wants=data-provider-master.target +Before=data-provider-master.target + +[Install] +WantedBy=sockets.target diff --git a/data/data-provider-master.target b/data/data-provider-master.target new file mode 100644 index 0000000..cc07318 --- /dev/null +++ b/data/data-provider-master.target @@ -0,0 +1,3 @@ +[Unit] +Description=data-provider-master sockets +DefaultDependencies=true diff --git a/data/device/abi.ini b/data/device/abi.ini index 048f85e..3b57cd0 100644 --- a/data/device/abi.ini +++ b/data/device/abi.ini @@ -15,3 +15,6 @@ package=/APPID/ [svc] package=org.tizen.data-provider-slave.svc + +[meta] +package=meta-key diff --git a/data/emulator/abi.ini b/data/emulator/abi.ini index 048f85e..3b57cd0 100644 --- a/data/emulator/abi.ini +++ b/data/emulator/abi.ini @@ -15,3 +15,6 @@ package=/APPID/ [svc] package=org.tizen.data-provider-slave.svc + +[meta] +package=meta-key diff --git a/include/client_life.h b/include/client_life.h index 93d7cb6..e96d103 100644 --- a/include/client_life.h +++ b/include/client_life.h @@ -112,6 +112,9 @@ extern int client_browse_category_list(const char *category, int (*cb)(struct cl extern int client_broadcast(struct inst_info *inst, struct packet *packet); extern const char *client_direct_addr(const struct client_node *client); +extern struct client_node *client_find_by_direct_addr(const char *direct_addr); +extern void client_set_direct_fd(struct client_node *client, int fd); +extern int client_direct_fd(struct client_node *client); extern int client_orientation(const struct client_node *client); extern void client_set_orientation(struct client_node *client, int orientation); diff --git a/include/package.h b/include/package.h index 9159803..fe6e9c4 100644 --- a/include/package.h +++ b/include/package.h @@ -121,4 +121,6 @@ extern int package_faulted(struct pkg_info *info, int broadcast); extern char *package_get_pkgid(const char *appid); extern int package_instance_count(struct pkg_info *info); +extern char *package_meta_tag(const char *appid, const char *meta_tag); + /* End of a file */ diff --git a/include/service_common.h b/include/service_common.h index de3a0ba..188435a 100644 --- a/include/service_common.h +++ b/include/service_common.h @@ -47,6 +47,7 @@ extern int tcb_is_valid(struct service_context *svc_ctx, struct tcb *tcb); extern struct service_context *service_common_create(const char *addr, const char *label, int (*service_thread_main)(struct tcb *tcb, struct packet *packet, void *data), void *data); extern int service_common_destroy(struct service_context *svc_ctx); +extern int service_common_destroy_tcb(struct service_context *svc_ctx, struct tcb *tcb); extern int service_common_multicast_packet(struct tcb *tcb, struct packet *packet, int type); extern int service_common_unicast_packet(struct tcb *tcb, struct packet *packet); diff --git a/include/shared_fd_service.h b/include/shared_fd_service.h new file mode 100644 index 0000000..4c2475c --- /dev/null +++ b/include/shared_fd_service.h @@ -0,0 +1,20 @@ +/* + * 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. + */ + +extern int shared_fd_service_init(void); +extern int shared_fd_service_fini(void); + +/* End of a file */ diff --git a/include/slave_life.h b/include/slave_life.h index db52ebd..aebc949 100644 --- a/include/slave_life.h +++ b/include/slave_life.h @@ -34,39 +34,40 @@ enum slave_event { }; enum slave_state { - /*! + /** + * @note * Launch the slave but not yet receives "hello" packet */ SLAVE_REQUEST_TO_LAUNCH, - /*! - * \note + /** + * @note * Terminate the slave but not yet receives dead signal */ SLAVE_REQUEST_TO_TERMINATE, - /*! - * \note + /** + * @note * No slave process exists, just slave object created */ SLAVE_TERMINATED, - /*! - * \note + /** + * @note * State change request is sent, */ SLAVE_REQUEST_TO_PAUSE, SLAVE_REQUEST_TO_RESUME, - /*! - * \note + /** + * @note * Request an action for disconnecting to master from the provider side. * This flag should be treated as an activated state. */ SLAVE_REQUEST_TO_DISCONNECT, - /*! - * \note + /** + * @note * SLAVE_ACTIVATED = { SLAVE_PAUSED, SLAVE_RESUMED } */ SLAVE_PAUSED, @@ -227,4 +228,7 @@ extern void slave_set_is_watch(struct slave_node *slave, int flag); extern int slave_set_resource_limit(struct slave_node *slave, unsigned int soft, unsigned int hard); extern int slave_get_resource_limit(struct slave_node *slave, unsigned int *soft, unsigned int *hard); +extern void slave_set_wait_deactivation(struct slave_node *slave, int wait); +extern int slave_wait_deactivation(struct slave_node *slave); + /* End of a file */ diff --git a/include/util.h b/include/util.h index 132bfda..3aa09d2 100644 --- a/include/util.h +++ b/include/util.h @@ -26,9 +26,6 @@ extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void * extern void util_timer_interval_set(void *timer, double interval); extern double util_time_delay_for_compensation(double period); extern void util_setup_log_disk(void); -extern void util_remove_emergency_disk(void); -extern void util_prepare_emergency_disk(void); -extern int util_emergency_disk_is_mounted(void); extern int util_service_is_enabled(const char *tag); extern int util_string_is_in_list(const char *str, const char *haystack); diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 5d011b9..2dd01ac 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for widgetes -Version: 1.1.8 +Version: 1.1.10 Release: 1 Group: Applications/Core Applications License: Flora-1.1 @@ -112,6 +112,16 @@ mkdir -p %{buildroot}/%{_datarootdir}/license mkdir -p %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service ln -sf ../%{name}.path %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path +ln -sf ../%{name}.target %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target +ln -sf ../%{name}-client.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket +ln -sf ../%{name}-provider.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket +ln -sf ../%{name}-service.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket +ln -sf ../%{name}-badge.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket +ln -sf ../%{name}-notification.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket +ln -sf ../%{name}-shortcut.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket +ln -sf ../%{name}-utility.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket +ln -sf ../%{name}-fd.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket + 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 @@ -162,7 +172,6 @@ else fi chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine - # System tool(widget-mgr) should be able to access this folder. # So give the "rx" permission to the other group. (750 -> 755) chmod 755 /opt/usr/share/live_magazine @@ -189,10 +198,28 @@ echo "Successfully installed. Please start a daemon again manually" %manifest %{name}.manifest %defattr(-,root,root,-) %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} -%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service -%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path +%{_prefix}/lib/systemd/user/%{name}.target +%{_prefix}/lib/systemd/user/%{name}-client.socket +%{_prefix}/lib/systemd/user/%{name}-provider.socket +%{_prefix}/lib/systemd/user/%{name}-service.socket +%{_prefix}/lib/systemd/user/%{name}-badge.socket +%{_prefix}/lib/systemd/user/%{name}-notification.socket +%{_prefix}/lib/systemd/user/%{name}-shortcut.socket +%{_prefix}/lib/systemd/user/%{name}-utility.socket +%{_prefix}/lib/systemd/user/%{name}-fd.socket %{_prefix}/lib/systemd/user/%{name}.service %{_prefix}/lib/systemd/user/%{name}.path +%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket +%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service +%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path %{_datarootdir}/license/* %if 0%{?tizen_build_binary_release_type_eng} /opt/usr/devel/usr/bin/* diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index 62b10a0..1175467 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -31,6 +31,7 @@ #include #include +#include #include "dlist.h" #include "common.h" @@ -880,6 +881,7 @@ out: sqlite3_finalize(stmt); return ret; } + static int db_insert_provider(struct widget *widget) { static const char *dml; @@ -2356,7 +2358,7 @@ static void update_support_size(struct widget *widget, xmlNodePtr node) } widget->default_mouse_event = 0; - widget->default_touch_effect = 1; + widget->default_touch_effect = 0; widget->default_need_frame = 0; if (xmlHasProp(node, (const xmlChar *)"mode")) { @@ -2478,14 +2480,14 @@ static void update_box(struct widget *widget, xmlNodePtr node) } if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) { - widget->default_touch_effect = 1; + widget->default_touch_effect = 0; } else { xmlChar *touch_effect; touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect"); if (!touch_effect) { ErrPrint("default touch_effect is NIL\n"); - widget->default_touch_effect = 1; + widget->default_touch_effect = 0; } else { widget->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true"); xmlFree(touch_effect); @@ -3035,6 +3037,34 @@ errout: return ret; } +static int has_meta_tag(const char *appid, const char *meta_tag) +{ + int ret; + char *value = NULL; + pkgmgrinfo_appinfo_h handle; + + if (!meta_tag) { + ErrPrint("meta ABI is not valid (%s)\n", appid); + return 0; + } + + ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); + if (ret != PMINFO_R_OK) { + return 0; + } + + ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return 0; + } + + ret = value && value[0] != '\0'; + + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return ret; +} + int db_install_widget(xmlNodePtr node, const char *appid) { struct widget *widget; @@ -3361,6 +3391,20 @@ int db_install_widget(xmlNodePtr node, const char *appid) DbgPrint("Default MAIN UI-APP: [%s]\n", (char *)widget->uiapp); } + /** + * Check the "meta" tag of this widget. + * If it has speicific meta tag, replace "abi" with "meta". + */ + if (has_meta_tag((const char *)widget->pkgid, widget_abi_get_pkgname_by_abi("meta"))) { + DbgPrint("Meta tag is overrided: %s -> meta\n", (char *)widget->abi); + + if (widget->abi) { + xmlFree(widget->abi); + } + + widget->abi = xmlStrdup((xmlChar *)"meta"); + } + return db_insert_widget(widget, appid); } diff --git a/pkgmgr_widget/watch/src/service_watchapp.c b/pkgmgr_widget/watch/src/service_watchapp.c index fe36772..efbfc62 100644 --- a/pkgmgr_widget/watch/src/service_watchapp.c +++ b/pkgmgr_widget/watch/src/service_watchapp.c @@ -15,6 +15,7 @@ */ #include "common.h" +#include #define WATCH_APP_TAG "watch-application" #define EAPI __attribute__((visibility("default"))) @@ -36,6 +37,7 @@ static inline int remove_all_watch(const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid) { + widget_abi_init(); ErrPrintWithConsole("%s\n", appid); if (!db_check()) { @@ -54,6 +56,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid) { ErrPrintWithConsole("[%s]\n", appid); db_fini(); + widget_abi_fini(); return 0; } @@ -90,6 +93,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid) { + widget_abi_init(); ErrPrintWithConsole("[%s]\n", appid); if (!db_check()) { @@ -108,6 +112,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid) { ErrPrintWithConsole("[%s]\n", appid); db_fini(); + widget_abi_fini(); return 0; } @@ -143,6 +148,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid) { + widget_abi_init(); ErrPrintWithConsole("[%s]\n", appid); if (!db_check()) { @@ -167,6 +173,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid) remove_all_watch(appid); db_fini(); + widget_abi_fini(); return 0; } diff --git a/pkgmgr_widget/widget-application/src/service_widget.c b/pkgmgr_widget/widget-application/src/service_widget.c index 4c812fc..2fbe654 100644 --- a/pkgmgr_widget/widget-application/src/service_widget.c +++ b/pkgmgr_widget/widget-application/src/service_widget.c @@ -16,6 +16,7 @@ #include #include +#include #include "common.h" @@ -41,6 +42,7 @@ static inline int remove_all_widgets(const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid) { + widget_abi_init(); if (!db_check()) { if (db_init() < 0) { ErrPrintWithConsole("Failed to init DB\n"); @@ -57,6 +59,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid) { ErrPrintWithConsole("[%s]\n", appid); db_fini(); + widget_abi_fini(); return 0; } @@ -93,6 +96,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid) { + widget_abi_init(); if (!db_check()) { if (db_init() < 0) { ErrPrintWithConsole("Failed to init DB\n"); @@ -109,6 +113,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid) { ErrPrintWithConsole("[%s]\n", appid); db_fini(); + widget_abi_fini(); return 0; } @@ -144,6 +149,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid) { + widget_abi_init(); ErrPrintWithConsole("[%s]\n", appid); if (!db_check()) { @@ -165,6 +171,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid) ret = remove_all_widgets(appid); db_fini(); + widget_abi_fini(); return ret; } diff --git a/pkgmgr_widget/widget/src/service_widget.c b/pkgmgr_widget/widget/src/service_widget.c index 48be3ef..231efcc 100644 --- a/pkgmgr_widget/widget/src/service_widget.c +++ b/pkgmgr_widget/widget/src/service_widget.c @@ -16,6 +16,7 @@ #include #include +#include #include "common.h" @@ -41,6 +42,7 @@ static inline int remove_all_widgets(const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_INSTALL(const char *appid) { + widget_abi_init(); if (!db_check()) { if (db_init() < 0) { ErrPrintWithConsole("Failed to init DB\n"); @@ -57,6 +59,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *appid) { ErrPrintWithConsole("[%s]\n", appid); db_fini(); + widget_abi_fini(); return 0; } @@ -93,6 +96,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_UPGRADE(const char *appid) { + widget_abi_init(); if (!db_check()) { if (db_init() < 0) { ErrPrintWithConsole("Failed to init DB\n"); @@ -109,6 +113,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *appid) { ErrPrintWithConsole("[%s]\n", appid); db_fini(); + widget_abi_fini(); return 0; } @@ -144,6 +149,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_UPGRADE(xmlDocPtr docPtr, const char *appid) EAPI int PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL(const char *appid) { + widget_abi_init(); ErrPrintWithConsole("[%s]\n", appid); if (!db_check()) { @@ -165,6 +171,7 @@ EAPI int PKGMGR_PARSER_PLUGIN_POST_UNINSTALL(const char *appid) ret = remove_all_widgets(appid); db_fini(); + widget_abi_fini(); return ret; } diff --git a/src/client_life.c b/src/client_life.c index e5f8228..fb3c99d 100644 --- a/src/client_life.c +++ b/src/client_life.c @@ -112,9 +112,12 @@ struct client_node { Eina_List *category_subscribe_list; int faulted; - char *direct_addr; int orientation; int is_sdk_viewer; + struct _direct { + char *addr; + int fd; + } direct; }; static inline void invoke_global_destroyed_cb(struct client_node *client) @@ -259,9 +262,15 @@ static inline void destroy_client_data(struct client_node *client) s_info.nr_of_paused_clients--; } - if (client->direct_addr) { - (void)unlink(client->direct_addr); - DbgFree(client->direct_addr); + if (client->direct.addr) { + (void)unlink(client->direct.addr); + DbgFree(client->direct.addr); + } + + if (client->direct.fd >= 0) { + if (close(client->direct.fd) < 0) { + ErrPrint("Client FD: %d\n", errno); + } } DbgFree(client->appid); @@ -290,6 +299,7 @@ static struct client_node *create_client_data(pid_t pid, const char *direct_addr client->pid = pid; client->refcnt = 1; + client->direct.fd = -1; if (aul_app_get_pkgname_bypid(pid, pid_pkgname, sizeof(pid_pkgname)) == AUL_R_OK) { client->appid = strdup(pid_pkgname); @@ -303,8 +313,8 @@ static struct client_node *create_client_data(pid_t pid, const char *direct_addr } if (direct_addr && direct_addr[0]) { - client->direct_addr = strdup(direct_addr); - if (!client->direct_addr) { + client->direct.addr = strdup(direct_addr); + if (!client->direct.addr) { ErrPrint("Failed to allocate direct_addr (%s)\n", direct_addr); } } @@ -1040,7 +1050,7 @@ HAPI int client_broadcast(struct inst_info *inst, struct packet *packet) HAPI const char *client_direct_addr(const struct client_node *client) { - return client ? client->direct_addr : NULL; + return client ? client->direct.addr : NULL; } HAPI void client_set_orientation(struct client_node *client, int orientation) @@ -1063,4 +1073,32 @@ HAPI int client_is_sdk_viewer(const struct client_node *client) return client ? client->is_sdk_viewer : 0; } +HAPI struct client_node *client_find_by_direct_addr(const char *direct_addr) +{ + Eina_List *l; + struct client_node *client; + + if (!direct_addr) { + return NULL; + } + + EINA_LIST_FOREACH(s_info.client_list, l, client) { + if (client->direct.addr && !strcmp(client->direct.addr, direct_addr)) { + return client; + } + } + + return NULL; +} + +HAPI void client_set_direct_fd(struct client_node *client, int fd) +{ + client->direct.fd = fd; +} + +HAPI int client_direct_fd(struct client_node *client) +{ + return client->direct.fd; +} + /* End of a file */ diff --git a/src/dead_monitor.c b/src/dead_monitor.c index 706a809..ad6b2e7 100644 --- a/src/dead_monitor.c +++ b/src/dead_monitor.c @@ -74,7 +74,22 @@ static int evt_cb(int handle, void *data) slave = slave_deactivated(slave); break; default: - slave = slave_deactivated_by_fault(slave); + if (slave_wait_deactivation(slave)) { + /** + * @note + * Slave is waiting the termination, + * in this case, it should be dealt as a normal termination. + */ + + DbgPrint("Slave is waiting deactivation, Do not re-activate automatically in this case\n"); + slave_set_wait_deactivation(slave, 0); + slave_set_reactivation(slave, 0); + slave_set_reactivate_instances(slave, 1); + + slave = slave_deactivated(slave); + } else { + slave = slave_deactivated_by_fault(slave); + } break; } } diff --git a/src/instance.c b/src/instance.c index 9fcc87b..d9e0d0b 100644 --- a/src/instance.c +++ b/src/instance.c @@ -1700,6 +1700,48 @@ HAPI int instance_destroy(struct inst_info *inst, widget_destroy_type_e type) inst->requested_state = INST_DESTROYED; return WIDGET_ERROR_NONE; default: + if (type == WIDGET_DESTROY_TYPE_UNINSTALL || type == WIDGET_DESTROY_TYPE_UPGRADE) { + struct pkg_info *pkg; + + /** + * @note + * In this case, we cannot re-activate the slave. + * Because it is already uninstalled so there is no widget application anymore. + * So just clear the instances from the homescreen + */ + pkg = instance_package(inst); + if (pkg) { + struct slave_node *slave; + + slave = package_slave(pkg); + if (slave) { + /** + * @note + * If a slave is not activated, (already deactivated) + * We don't need to try to destroy an instance. + * Just delete an instance from here. + */ + if (!slave_is_activated(slave)) { + /** + * @note + * Notify deleted instance information to the viewer. + */ + if (inst->unicast_delete_event) { + instance_unicast_deleted_event(inst, NULL, WIDGET_ERROR_NONE); + } else { + instance_broadcast_deleted_event(inst, WIDGET_ERROR_NONE); + } + + DbgPrint("Slave is deactivated, delete an instance\n"); + inst->state = INST_DESTROYED; + inst->requested_state = INST_DESTROYED; + (void)instance_unref(inst); + return WIDGET_ERROR_NONE; + } + } + } + } + break; } @@ -1744,6 +1786,33 @@ HAPI int instance_reload(struct inst_info *inst, widget_destroy_type_e type) DbgPrint("Instance is destroying now\n"); return WIDGET_ERROR_NONE; default: + if (type == WIDGET_DESTROY_TYPE_UNINSTALL || type == WIDGET_DESTROY_TYPE_UPGRADE) { + struct pkg_info *pkg; + + pkg = instance_package(inst); + if (pkg) { + struct slave_node *slave; + + slave = package_slave(pkg); + if (slave) { + /** + * @note + * If a slave is not activated, (already deactivated) + * We don't need to try to destroy an instance. + * Just re-activate an instance from here. + */ + if (!slave_is_activated(slave)) { + inst->state = INST_INIT; + DbgPrint("Slave is deactivated, just activate an instasnce\n"); + ret = instance_activate(inst); + if (ret < 0) { + ErrPrint("Failed to activate instance: %d (%s)\n", ret, instance_id(inst)); + } + return WIDGET_ERROR_NONE; + } + } + } + } break; } diff --git a/src/main.c b/src/main.c index c5cc9f8..748b5f6 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,7 @@ #include "shortcut_service.h" #include "notification_service.h" #include "badge_service.h" +#include "shared_fd_service.h" #if defined(FLOG) #define TMP_LOG_FILE "/tmp/live.log" @@ -139,6 +140,11 @@ static inline int app_create(void) DbgPrint("Buffer handler init is done: %d\n", ret); } + ret = shared_fd_service_init(); + if (ret < 0) { + DbgPrint("Shared FD service init is done: %d\n", ret); + } + /*! * \note * After initiate all other sub-systtems, @@ -215,6 +221,11 @@ static inline int app_terminate(void) DbgPrint("Finalize server: %d\n", ret); } + ret = shared_fd_service_fini(); + if (ret < 0) { + DbgPrint("Finalize shared service: %d\n", ret); + } + ret = dead_fini(); if (ret < 0) { DbgPrint("dead signal handler finalized: %d\n", ret); @@ -369,6 +380,19 @@ int main(int argc, char *argv[]) widget_conf_load(); widget_abi_init(); + if (vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count) < 0 || restart_count == 0) { + /*! + * \note + * Clear old contents files before start the master provider. + */ + (void)util_unlink_files(WIDGET_CONF_ALWAYS_PATH); + (void)util_unlink_files(WIDGET_CONF_READER_PATH); + (void)util_unlink_files(WIDGET_CONF_IMAGE_PATH); + (void)util_unlink_files(WIDGET_CONF_LOG_PATH); + } + + util_setup_log_disk(); + /*! * How could we care this return values? * Is there any way to print something on the screen? @@ -378,22 +402,6 @@ int main(int argc, char *argv[]) ErrPrint("Failed to init the critical log\n"); } - /*! - * \note - * Clear old contents files before start the master provider. - */ - (void)util_unlink_files(WIDGET_CONF_ALWAYS_PATH); - (void)util_unlink_files(WIDGET_CONF_READER_PATH); - (void)util_unlink_files(WIDGET_CONF_IMAGE_PATH); - (void)util_unlink_files(WIDGET_CONF_LOG_PATH); - - if (util_free_space(WIDGET_CONF_IMAGE_PATH) < WIDGET_CONF_MINIMUM_SPACE) { - util_remove_emergency_disk(); - util_prepare_emergency_disk(); - } - - util_setup_log_disk(); - sigemptyset(&mask); ret = sigaddset(&mask, SIGTERM); @@ -427,7 +435,6 @@ int main(int argc, char *argv[]) app_create(); sd_notify(0, "READY=1"); - vconf_get_int(VCONFKEY_MASTER_RESTART_COUNT, &restart_count); restart_count++; vconf_set_int(VCONFKEY_MASTER_RESTART_COUNT, restart_count); diff --git a/src/package.c b/src/package.c index 8b534a1..e88526c 100644 --- a/src/package.c +++ b/src/package.c @@ -1401,13 +1401,20 @@ static inline void reload_package_info(struct pkg_info *info) EINA_LIST_FOREACH_SAFE(info->inst_list, l, n, inst) { width = instance_widget_width(inst); height = instance_widget_height(inst); - widget_service_get_size_type(width, height, &size_type); - if (info->widget.size_list & size_type) { - if (instance_period(inst) == old_period) { - instance_reload_period(inst, package_period(info)); + DbgPrint("%dx%d\n", width, height); + if (widget_service_get_size_type(width, height, &size_type) == WIDGET_ERROR_NONE) { + if ((info->widget.size_list & size_type) == size_type) { + DbgPrint("Supported size type: %x\n", size_type); + if (instance_period(inst) == old_period) { + instance_reload_period(inst, package_period(info)); + } + instance_reload(inst, WIDGET_DESTROY_TYPE_UPGRADE); + } else { + DbgPrint("Unsupported size type: %x\n", size_type); + instance_destroy(inst, WIDGET_DESTROY_TYPE_UNINSTALL); } - instance_reload(inst, WIDGET_DESTROY_TYPE_UPGRADE); } else { + DbgPrint("Invalid size\n"); instance_destroy(inst, WIDGET_DESTROY_TYPE_UNINSTALL); } } @@ -1437,17 +1444,40 @@ static int io_install_cb(const char *pkgid, const char *widget_id, int prime, vo static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data) { - Eina_List *l; - Eina_List *n; - struct pkg_info *info; + if (status == PKGMGR_STATUS_START) { + Eina_List *l; + Eina_List *n; + struct pkg_info *info; - if (status != PKGMGR_STATUS_END) { - return 0; - } + EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) { + if (!strcmp(info->pkgid, pkgname)) { + struct slave_node *slave; + /** + * @note + * While updating packages, the slave can be terminated, + * Even if a slave is terminated, do not handles it as a faulted one. + */ + slave = package_slave(info); + DbgPrint("Update slave state : %p\n", slave); + if (slave) { + slave_set_wait_deactivation(slave, 1); + } + } + } + } else if (status == PKGMGR_STATUS_END) { + Eina_List *l; + Eina_List *n; + struct pkg_info *info; - EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) { - if (!strcmp(info->pkgid, pkgname)) { - io_uninstall_cb(pkgname, info->widget_id, -1, NULL); + EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) { + if (!strcmp(info->pkgid, pkgname)) { + struct slave_node *slave; + slave = package_slave(info); + if (slave) { + slave_set_wait_deactivation(slave, 0); + } + io_uninstall_cb(pkgname, info->widget_id, -1, NULL); + } } } @@ -1456,26 +1486,52 @@ static int uninstall_cb(const char *pkgname, enum pkgmgr_status status, double v static int update_cb(const char *pkgname, enum pkgmgr_status status, double value, void *data) { - Eina_List *l; - Eina_List *n; - struct pkg_info *info; + if (status == PKGMGR_STATUS_START) { + Eina_List *l; + Eina_List *n; + struct pkg_info *info; - if (status != PKGMGR_STATUS_END) { - return 0; - } + EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) { + if (!strcmp(info->pkgid, pkgname)) { + struct slave_node *slave; + /** + * @note + * While updating packages, the slave can be terminated, + * Even if a slave is terminated, do not handles it as a faulted one. + */ + slave = package_slave(info); + DbgPrint("Update slave state : %p\n", slave); + if (slave) { + slave_set_wait_deactivation(slave, 1); + } + } + } + } else if (status == PKGMGR_STATUS_END) { + Eina_List *l; + Eina_List *n; + struct pkg_info *info; - EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) { - if (!strcmp(info->pkgid, pkgname)) { - DbgPrint("Update widget_id: %s\n", info->widget_id); - if (io_is_exists(info->widget_id) == 1) { - reload_package_info(info); - } else { - io_uninstall_cb(pkgname, info->widget_id, -1, NULL); + EINA_LIST_FOREACH_SAFE(s_info.pkg_list, l, n, info) { + if (!strcmp(info->pkgid, pkgname)) { + struct slave_node *slave; + + slave = package_slave(info); + if (slave) { + slave_set_wait_deactivation(slave, 0); + } + + DbgPrint("Update widget_id: %s\n", info->widget_id); + if (io_is_exists(info->widget_id) == 1) { + reload_package_info(info); + } else { + io_uninstall_cb(pkgname, info->widget_id, -1, NULL); + } } } + + (void)io_update_widget_package(pkgname, io_install_cb, NULL); } - (void)io_update_widget_package(pkgname, io_install_cb, NULL); return 0; } @@ -1700,6 +1756,37 @@ HAPI int package_is_enabled(const char *appid) return enabled == true; } +HAPI char *package_meta_tag(const char *appid, const char *meta_tag) +{ + char *ret = NULL; + char *value = NULL; + int status; + pkgmgrinfo_appinfo_h handle; + + if (!meta_tag || !appid) { + ErrPrint("meta(%s) is not valid (%s)\n", meta_tag, appid); + return NULL; + } + + status = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); + if (status != PMINFO_R_OK) { + return NULL; + } + + status = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); + if (status != PMINFO_R_OK) { + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return NULL; + } + + if (value && value[0] != '\0') { + ret = strdup(value); + } + + pkgmgrinfo_appinfo_destroy_appinfo(handle); + return ret; +} + HAPI int package_faulted(struct pkg_info *pkg, int broadcast) { Eina_List *l; diff --git a/src/server.c b/src/server.c index dfded9c..37cfc9b 100644 --- a/src/server.c +++ b/src/server.c @@ -89,7 +89,6 @@ static struct info { int client_fd; int service_fd; int slave_fd; - int remote_client_fd; Eina_List *hello_sync_ctx_list; } s_info = { @@ -97,7 +96,6 @@ static struct info { .client_fd = -1, .service_fd = -1, .slave_fd = -1, - .remote_client_fd = -1, .hello_sync_ctx_list = NULL, }; @@ -194,6 +192,18 @@ static char *is_valid_slave(pid_t pid, const char *abi, const char *provider_pkg return NULL; } + if (!strcmp(abi, "meta")) { + converted_provider_pkgname = package_meta_tag(provider_pkgname, abi_pkgname); + if (!converted_provider_pkgname || strcmp(converted_provider_pkgname, pid_pkgname)) { + DbgPrint("Meta tag is not matched: %s <> %s (%s)\n", converted_provider_pkgname, pid_pkgname, abi_pkgname); + DbgFree(converted_provider_pkgname); + return NULL; + } + + DbgPrint("Meta package detected: %s\n", converted_provider_pkgname); + return converted_provider_pkgname; + } + if (!strcmp(abi_pkgname, pid_pkgname)) { /*! * This request is comes from predefined service provider. @@ -8192,8 +8202,8 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe double timestamp; const char *pkgname = NULL; - ret = packet_get(packet, "dissss", ×tamp, &secured, &slavename, &slave_pkgname, &acceleration, &abi); - if (ret != 6) { + ret = packet_get(packet, "disssss", ×tamp, &secured, &slavename, &slave_pkgname, &acceleration, &abi, &widget_id); + if (ret != 7) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -8330,15 +8340,21 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe int width, height; unsigned int widget_size; Eina_List *inst_list; + char *tmp_widget_id; - widget_id = is_valid_slave(pid, abi, pkgname); - if (!widget_id) { + tmp_widget_id = is_valid_slave(pid, abi, pkgname); + if (!tmp_widget_id) { goto out; } + if (strcmp(widget_id, tmp_widget_id)) { + DbgPrint("[%s] <> [%s]\n", widget_id, tmp_widget_id); + } + + DbgFree(tmp_widget_id); + if (!slave_is_watch(slave)) { ErrPrint("Slave is not watch(only watch can use hello_sync) [%s]\n", widget_id); - DbgFree(widget_id); goto out; } @@ -8348,7 +8364,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe pkgid = widget_service_get_package_id(widget_id); if (!pkgid) { - DbgFree(widget_id); goto out; } @@ -8356,7 +8371,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe info = package_create(pkgid, widget_id); DbgFree(pkgid); - DbgFree(widget_id); ret = WIDGET_ERROR_FAULT; goto out; } @@ -8365,7 +8379,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe inst = eina_list_nth(inst_list, 0); if (!inst) { ErrPrint("Instance is not available for [%s]\n", widget_id); - DbgFree(widget_id); ret = WIDGET_ERROR_FAULT; goto out; } @@ -8379,7 +8392,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe ret = aul_terminate_pid_async(pid); CRITICAL_LOG("Terminate %d (ret: %d)\n", pid, ret); } - DbgFree(widget_id); ret = WIDGET_ERROR_NOT_EXIST; goto out; } @@ -8432,8 +8444,6 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe */ (void)instance_watch_recover_visible_state(inst); } - - DbgFree(widget_id); } out: @@ -9858,44 +9868,22 @@ HAPI int server_init(void) ErrPrint("unlink info: %d\n", errno); } - if (unlink(SLAVE_SOCKET) < 0) { - ErrPrint("unlink slave: %d\n", errno); - } - - if (unlink(CLIENT_SOCKET) < 0) { - ErrPrint("unlink client: %d\n", errno); - } - - if (unlink(SERVICE_SOCKET) < 0) { - ErrPrint("unlink service: %d\n", errno); - } - s_info.info_fd = com_core_packet_server_init(INFO_SOCKET, s_info_table); if (s_info.info_fd < 0) { ErrPrint("Failed to create a info socket\n"); } - s_info.slave_fd = com_core_packet_server_init_with_permission(SLAVE_SOCKET, s_slave_table, "data-provider-master::provider"); + s_info.slave_fd = com_core_packet_server_init_with_permission("sdlocal://"SLAVE_SOCKET, s_slave_table, NULL); if (s_info.slave_fd < 0) { ErrPrint("Failed to create a slave socket\n"); } - s_info.client_fd = com_core_packet_server_init_with_permission(CLIENT_SOCKET, s_client_table, "data-provider-master::client"); + s_info.client_fd = com_core_packet_server_init_with_permission("sdlocal://"CLIENT_SOCKET, s_client_table, NULL); if (s_info.client_fd < 0) { ErrPrint("Failed to create a client socket\n"); } - /*! - * \note - * remote://:8208 - * Skip address to use the NULL. - */ - s_info.remote_client_fd = com_core_packet_server_init_with_permission("remote://:"CLIENT_PORT, s_client_table, "data-provider-master::client"); - if (s_info.client_fd < 0) { - ErrPrint("Failed to create a remote client socket\n"); - } - - s_info.service_fd = com_core_packet_server_init_with_permission(SERVICE_SOCKET, s_service_table, "data-provider-master"); + s_info.service_fd = com_core_packet_server_init_with_permission("sdlocal://"SERVICE_SOCKET, s_service_table, NULL); if (s_info.service_fd < 0) { ErrPrint("Faild to create a service socket\n"); } @@ -9904,18 +9892,6 @@ HAPI int server_init(void) ErrPrint("chmod info: %d\n", errno); } - if (chmod(SLAVE_SOCKET, 0666) < 0) { - ErrPrint("chmod slave: %d\n", errno); - } - - if (chmod(CLIENT_SOCKET, 0666) < 0) { - ErrPrint("chmod client: %d\n", errno); - } - - if (chmod(SERVICE_SOCKET, 0666) < 0) { - ErrPrint("chmod service: %d\n", errno); - } - return 0; } @@ -9936,11 +9912,6 @@ HAPI int server_fini(void) s_info.client_fd = -1; } - if (s_info.remote_client_fd > 0) { - com_core_packet_server_fini(s_info.remote_client_fd); - s_info.remote_client_fd = -1; - } - if (s_info.service_fd > 0) { com_core_packet_server_fini(s_info.service_fd); s_info.service_fd = -1; diff --git a/src/service_common.c b/src/service_common.c index 65b300f..f65e382 100644 --- a/src/service_common.c +++ b/src/service_common.c @@ -89,6 +89,8 @@ struct service_context { Eina_List *tcb_create_cb_list; Eina_List *tcb_destroy_cb_list; + + int processing_service_handler; }; struct packet_info { @@ -543,6 +545,22 @@ static inline void tcb_teminate_all(struct service_context *svc_ctx) } } +HAPI int service_common_destroy_tcb(struct service_context *svc_ctx, struct tcb *tcb) +{ + if (!svc_ctx || !tcb) { + return WIDGET_ERROR_INVALID_PARAMETER; + } + /** + * @note + * In this case, we just need to push terminate event to pipe. + */ + if (write(svc_ctx->tcb_pipe[PIPE_WRITE], &tcb, sizeof(tcb)) != sizeof(tcb)) { + ErrPrint("write: %d\n", errno); + } + + return WIDGET_ERROR_NONE; +} + /*! * \note * SERVER THREAD @@ -754,7 +772,9 @@ static void *server_main(void *data) * What happens if the client thread is terminated, so the packet_info->tcb is deleted * while processing svc_ctx->service_thread_main? */ + svc_ctx->processing_service_handler = 1; ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data); + svc_ctx->processing_service_handler = 0; if (ret < 0) { ErrPrint("Service thread returns: %d\n", ret); } @@ -805,7 +825,9 @@ static void *server_main(void *data) EINA_LIST_FREE(lockfree_packet_list, packet_info) { ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch)); DbgPrint("Flushing filtered pipe: %d (%c)\n", ret, evt_ch); + svc_ctx->processing_service_handler = 1; ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data); + svc_ctx->processing_service_handler = 0; if (ret < 0) { ErrPrint("Service thread returns: %d\n", ret); } @@ -817,7 +839,9 @@ static void *server_main(void *data) * \note * Invoke the service thread main, to notify the termination of a TCB */ + svc_ctx->processing_service_handler = 1; ret = svc_ctx->service_thread_main(tcb, NULL, svc_ctx->service_thread_data); + svc_ctx->processing_service_handler = 0; /*! * at this time, the client thread can access this tcb. @@ -843,7 +867,9 @@ static void *server_main(void *data) EINA_LIST_FREE(svc_ctx->packet_list, packet_info) { ret = read(svc_ctx->evt_pipe[PIPE_READ], &evt_ch, sizeof(evt_ch)); DbgPrint("Flushing pipe: %d (%c)\n", ret, evt_ch); + svc_ctx->processing_service_handler = 1; ret = svc_ctx->service_thread_main(packet_info->tcb, packet_info->packet, svc_ctx->service_thread_data); + svc_ctx->processing_service_handler = 0; if (ret < 0) { ErrPrint("Service thread returns: %d\n", ret); } @@ -870,9 +896,18 @@ HAPI struct service_context *service_common_create(const char *addr, const char return NULL; } - if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME))) { - int offset = 0; + /** + * @note + * Do not try to delete a URI file if it is created for a remote service or by the systemd service. + */ + if (strncmp(addr, COM_CORE_REMOTE_SCHEME, strlen(COM_CORE_REMOTE_SCHEME)) && strncmp(addr, COM_CORE_SD_LOCAL_SCHEME, strlen(COM_CORE_SD_LOCAL_SCHEME))) { + int offset; + /** + * @note + * If the address is not for the REMOTE or SD_LOCAL, we can assume it just a local(unix) domain socket file. + * So, find the scheme length first and then "unlink" it. + */ offset = strlen(COM_CORE_LOCAL_SCHEME); if (strncmp(addr, COM_CORE_LOCAL_SCHEME, offset)) { offset = 0; diff --git a/src/shared_fd_service.c b/src/shared_fd_service.c new file mode 100644 index 0000000..d153882 --- /dev/null +++ b/src/shared_fd_service.c @@ -0,0 +1,158 @@ +/* + * 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 +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include + +#include "shared_fd_service.h" +#include "service_common.h" +#include "client_life.h" +#include "client_rpc.h" +#include "debug.h" +#include "util.h" +#include "conf.h" + +static struct info { + int fd; +} s_info = { + .fd = -1, +}; + +static struct packet *direct_hello_handler(pid_t pid, int handle, const struct packet *packet) +{ + const char *direct_addr; + struct client_node *client; + + if (!packet) { + ErrPrint("%d is disconnected (%d)\n", pid, handle); + return NULL; + } + + if (packet_get(packet, "s", &direct_addr) != 1) { + ErrPrint("Packet is not valid\n"); + return NULL; + } + + client = client_find_by_direct_addr(direct_addr); + if (!client) { + ErrPrint("Client is not exists: %s\n", direct_addr); + return NULL; + } + + DbgPrint("Client Direct Handler is updated: %d\n", handle); + client_set_direct_fd(client, handle); + return NULL; +} + +static struct packet *direct_connected_handler(pid_t pid, int handle, const struct packet *packet) +{ + struct packet *result; + const char *direct_addr; + struct client_node *client; + + if (!packet) { + ErrPrint("%d is disconnected (%d)\n", pid, handle); + return NULL; + } + + if (packet_get(packet, "s", &direct_addr) != 1) { + ErrPrint("Packet is not valid\n"); + result = packet_create_reply(packet, "i", WIDGET_ERROR_INVALID_PARAMETER); + return result; + } + + client = client_find_by_direct_addr(direct_addr); + if (!client) { + ErrPrint("Client is not exists: %s\n", direct_addr); + result = packet_create_reply(packet, "i", WIDGET_ERROR_NOT_EXIST); + return result; + } + + result = packet_create_reply(packet, "i", WIDGET_ERROR_NONE); + packet_set_fd(result, client_direct_fd(client)); + DbgPrint("Set FD Handle for (%s): %d\n", direct_addr, client_direct_fd(client)); + return result; +} + +static struct method s_table[] = { + { + .cmd = CMD_STR_DIRECT_HELLO, + .handler = direct_hello_handler, + }, + { + .cmd = CMD_STR_DIRECT_CONNECTED, + .handler = direct_connected_handler, + }, + { + .cmd = NULL, + .handler = NULL, + }, +}; + +/** + * @note + * MAIN THREAD + */ +HAPI int shared_fd_service_init(void) +{ + DbgPrint("Successfully initiated\n"); + /** + * @todo + * 1. Accept FD (Get a new connection handle) + * 2. Waiting "hello" message from viewer. + * 3. Waiting "connected" message from provider + * 4. Send accepted FD to provider via result packet. + * 5. Provider will send a packet to the viewer via that FD. + */ + s_info.fd = com_core_packet_server_init("sdlocal://"SHARED_SOCKET, s_table); + if (s_info.fd < 0) { + ErrPrint("Failed to make a server for %s\n", "sdlocal://"SHARED_SOCKET); + } + + return WIDGET_ERROR_NONE; +} + +/** + * @note + * MAIN THREAD + */ +HAPI int shared_fd_service_fini(void) +{ + if (s_info.fd >= 0) { + com_core_packet_server_fini(s_info.fd); + s_info.fd = -1; + } + + DbgPrint("Successfully Finalized\n"); + return WIDGET_ERROR_NONE; +} + +/* End of a file */ diff --git a/src/slave_life.c b/src/slave_life.c index 58b2262..d03f86c 100644 --- a/src/slave_life.c +++ b/src/slave_life.c @@ -127,6 +127,8 @@ struct slave_node { unsigned int hard; } memory; } resources; + + int wait_deactivation; }; struct event { @@ -1119,8 +1121,8 @@ HAPI struct slave_node *slave_deactivated(struct slave_node *slave) } if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_REACTIVATION) == PROVIDER_CTRL_MANUAL_REACTIVATION) { - /*! - * \note + /** + * @note * In this case, the provider(Slave) should be reactivated by itself or user. * The master will not reactivate it automatically. */ @@ -1134,8 +1136,8 @@ HAPI struct slave_node *slave_deactivated(struct slave_node *slave) ErrPrint("Failed to reactivate a slave\n"); } } else if (slave_loaded_instance(slave) == 0) { - /*! - * \note + /** + * @note * If a slave has no more instances, * Destroy it */ @@ -1617,13 +1619,21 @@ HAPI char *slave_package_name(const char *abi, const char *lbid) return NULL; } - s_pkgname = widget_util_replace_string(tmp, WIDGET_CONF_REPLACE_TAG_APPID, lbid); - if (!s_pkgname) { - DbgPrint("Failed to get replaced string\n"); - s_pkgname = strdup(tmp); + if (!strcasecmp(abi, "meta")) { + s_pkgname = package_meta_tag(lbid, tmp); if (!s_pkgname) { - ErrPrint("strdup: %d\n", errno); - return NULL; + s_pkgname = strdup(lbid); + ErrPrint("Meta tag is not valid[%s] - [%s], use [%s]\n", lbid, tmp, s_pkgname); + } + } else { + s_pkgname = widget_util_replace_string(tmp, WIDGET_CONF_REPLACE_TAG_APPID, lbid); + if (!s_pkgname) { + DbgPrint("Failed to get replaced string\n"); + s_pkgname = strdup(tmp); + if (!s_pkgname) { + ErrPrint("strdup: %d\n", errno); + return NULL; + } } } @@ -2196,4 +2206,14 @@ HAPI int slave_get_resource_limit(struct slave_node *slave, unsigned int *soft, return WIDGET_ERROR_NONE; } +HAPI void slave_set_wait_deactivation(struct slave_node *slave, int wait) +{ + slave->wait_deactivation = !!wait; +} + +HAPI int slave_wait_deactivation(struct slave_node *slave) +{ + return slave->wait_deactivation; +} + /* End of a file */ diff --git a/src/util.c b/src/util.c index af1d6b8..49960cc 100644 --- a/src/util.c +++ b/src/util.c @@ -46,12 +46,6 @@ #define DELIM ';' -static struct info { - int emergency_mounted; -} s_info = { - .emergency_mounted = 0, -}; - int errno; HAPI unsigned long util_string_hash(const char *str) @@ -301,222 +295,6 @@ HAPI int util_unlink_files(const char *folder) return WIDGET_ERROR_NONE; } -HAPI void util_remove_emergency_disk(void) -{ - int ret; - ret = umount(WIDGET_CONF_IMAGE_PATH); - if (ret < 0) { - ErrPrint("umount: %d\n", errno); - } - - DbgPrint("Try to unmount[%s] %d\n", WIDGET_CONF_IMAGE_PATH, ret); - s_info.emergency_mounted = 0; -} - -HAPI void util_prepare_emergency_disk(void) -{ - char *buf; - char *source = NULL; - char *type = NULL; - char *option = NULL; - char *ptr; - char *rollback_ptr; - int tag_idx; - int idx; - int len; - int ret; - static const char *tag[] = { - "source", - "type", - "option", - NULL, - }; - enum tag_type { - TAG_SOURCE, - TAG_TYPE, - TAG_OPTION, - TAG_ERROR - }; - - buf = strdup(WIDGET_CONF_EMERGENCY_DISK); - if (!buf) { - ErrPrint("Failed to prepare emergency disk info\n"); - return; - } - - rollback_ptr = ptr = buf; - idx = 0; - tag_idx = 0; - len = strlen(ptr); - - while (tag[tag_idx] != NULL && ptr != (buf + len)) { - if (tag[tag_idx][idx] == '\0') { - if (*ptr == '=' || isblank(*ptr)) { - switch (tag_idx) { - case TAG_SOURCE: - if (source) { - ErrPrint("source[%s] is overrided\n", source); - } - - while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) { - ptr++; - } - - source = ptr; - while (*ptr != '\0' && *ptr != ';') { - ptr++; - } - - if (*source == '\0') { - type = NULL; - } - - *ptr = '\0'; - rollback_ptr = ptr + 1; - idx = 0; - break; - case TAG_TYPE: - if (type) { - ErrPrint("type[%s] is overrided\n", type); - } - - while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) { - ptr++; - } - - type = ptr; - while (*ptr != '\0' && *ptr != ';') { - ptr++; - } - - if (*type == '\0') { - type = NULL; - } - - *ptr = '\0'; - rollback_ptr = ptr + 1; - idx = 0; - break; - case TAG_OPTION: - if (option) { - ErrPrint("option[%s] is overrided\n", option); - } - - while ((*ptr != '\0' && *ptr != ';') && (*ptr == '=' || isblank(*ptr))) { - ptr++; - } - - option = ptr; - while (*ptr != '\0' && *ptr != ';') { - ptr++; - } - - if (*option == '\0') { - option = NULL; - } - - *ptr = '\0'; - rollback_ptr = ptr + 1; - idx = 0; - break; - default: - break; - } - } else { - ptr = rollback_ptr; - tag_idx++; - idx = 0; - } - } else if (tag[tag_idx][idx] != *ptr) { - ptr = rollback_ptr; - tag_idx++; - idx = 0; - } else { - ptr++; - idx++; - } // tag - } - - DbgPrint("source[%s] type[%s] option[%s]\n", source, type, option); - - ret = mount(source, WIDGET_CONF_IMAGE_PATH, type, MS_NOSUID | MS_NOEXEC, option); - DbgFree(buf); - if (ret < 0) { - ErrPrint("Failed to mount: %d\n", errno); - return; - } - - ErrPrint("Disk space is not enough, use the tmpfs. Currently required minimum space is %lu bytes\n", WIDGET_CONF_MINIMUM_SPACE); - if (chmod(WIDGET_CONF_IMAGE_PATH, 0750) < 0) { - ErrPrint("chmod: %d\n", errno); - } - - if (chown(WIDGET_CONF_IMAGE_PATH, 5000, 5000) < 0) { - ErrPrint("chown: %d\n", errno); - } - - if (!!DATA_SHARE_LABEL) { - ret = smack_setlabel(WIDGET_CONF_IMAGE_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS); - if (ret != 0) { - ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_IMAGE_PATH, ret); - } else { - ret = smack_setlabel(WIDGET_CONF_IMAGE_PATH, "1", SMACK_LABEL_TRANSMUTE); - DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_IMAGE_PATH, ret); - } - } - - if (mkdir(WIDGET_CONF_ALWAYS_PATH, 0755) < 0) { - ErrPrint("mkdir: (%s) %d\n", WIDGET_CONF_ALWAYS_PATH, errno); - } else { - if (chmod(WIDGET_CONF_ALWAYS_PATH, 0750) < 0) { - ErrPrint("chmod: %d\n", errno); - } - - if (chown(WIDGET_CONF_ALWAYS_PATH, 5000, 5000) < 0) { - ErrPrint("chown: %d\n", errno); - } - - if (!!DATA_SHARE_LABEL) { - ret = smack_setlabel(WIDGET_CONF_ALWAYS_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS); - if (ret != 0) { - ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_ALWAYS_PATH, ret); - } else { - ret = smack_setlabel(WIDGET_CONF_ALWAYS_PATH, "1", SMACK_LABEL_TRANSMUTE); - DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_ALWAYS_PATH, ret); - } - } - } - - if (mkdir(WIDGET_CONF_READER_PATH, 0755) < 0) { - ErrPrint("mkdir: (%s) %d\n", WIDGET_CONF_READER_PATH, errno); - } else { - if (chmod(WIDGET_CONF_READER_PATH, 0750) < 0) { - ErrPrint("chmod: %d\n", errno); - } - - if (chown(WIDGET_CONF_READER_PATH, 5000, 5000) < 0) { - ErrPrint("chown: %d\n", errno); - } - - if (!!DATA_SHARE_LABEL) { - ret = smack_setlabel(WIDGET_CONF_READER_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS); - if (ret != 0) { - ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_READER_PATH, ret); - } else { - ret = smack_setlabel(WIDGET_CONF_READER_PATH, "1", SMACK_LABEL_TRANSMUTE); - DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_READER_PATH, ret); - } - } - } - - s_info.emergency_mounted = 1; -} - -HAPI int util_emergency_disk_is_mounted(void) -{ - return s_info.emergency_mounted; -} - HAPI void util_setup_log_disk(void) { int ret; diff --git a/src/utility_service.c b/src/utility_service.c index f66053c..fa3d2d8 100644 --- a/src/utility_service.c +++ b/src/utility_service.c @@ -409,7 +409,7 @@ int utility_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create(UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create("sdlocal://"UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; -- 2.7.4 From 946b62d6b2f6845886e4d291b8bcd801ec072714 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 24 Jul 2015 22:56:28 +0900 Subject: [PATCH 02/16] Tizen 3.0 doesn't support metadata getter Change-Id: Ia06c46bb8af71704f9f00c3eca54e86840a83851 --- pkgmgr_widget/common/src/common.c | 4 ++++ src/package.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index 1175467..dd3e656 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -3053,11 +3053,15 @@ static int has_meta_tag(const char *appid, const char *meta_tag) return 0; } +/** + * Not supported from tizen 3.0 yet + * ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); if (ret != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } +*/ ret = value && value[0] != '\0'; diff --git a/src/package.c b/src/package.c index e88526c..998c311 100644 --- a/src/package.c +++ b/src/package.c @@ -1773,11 +1773,15 @@ HAPI char *package_meta_tag(const char *appid, const char *meta_tag) return NULL; } +/** + * This is not supported from Tizen 3.0 yet. + * status = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); if (status != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return NULL; } +*/ if (value && value[0] != '\0') { ret = strdup(value); -- 2.7.4 From 02d05ee00f12f8fe153e2fdfb716547d783c1063 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 31 Jul 2015 10:55:12 +0900 Subject: [PATCH 03/16] Choose the last watch instance if there are two or more instances are exist. Change-Id: I502ff7ea923408fcfff9e52b63ed2139f03bd695 --- src/server.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index 37cfc9b..5c2eea4 100644 --- a/src/server.c +++ b/src/server.c @@ -8376,7 +8376,7 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe } inst_list = package_instance_list(info); - inst = eina_list_nth(inst_list, 0); + inst = eina_list_data_get(eina_list_last(inst_list)); if (!inst) { ErrPrint("Instance is not available for [%s]\n", widget_id); ret = WIDGET_ERROR_FAULT; -- 2.7.4 From ec59a8d34fb039739c778ffbdf1ef1906b128c8e Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 7 Aug 2015 16:37:53 +0900 Subject: [PATCH 04/16] Sync with the latest tizen_2.4 Handling the fault case - slave is not launched Change-Id: I91f2d33c9f78e31620cfaac239c14b2167be1e88 --- src/main.c | 8 ++++++++ src/server.c | 2 -- src/shortcut_service.c | 2 +- src/slave_life.c | 20 +++++++++++++++++++- src/slave_rpc.c | 2 +- 5 files changed, 29 insertions(+), 5 deletions(-) diff --git a/src/main.c b/src/main.c index 748b5f6..b7e5047 100644 --- a/src/main.c +++ b/src/main.c @@ -42,6 +42,8 @@ #include #include +#include + #include "slave_life.h" #include "slave_rpc.h" #include "client_life.h" @@ -140,6 +142,12 @@ static inline int app_create(void) DbgPrint("Buffer handler init is done: %d\n", ret); } + /** + * @note + * Use thread mode must has to be initialized before server or client initialization. + */ + com_core_packet_use_thread(WIDGET_CONF_COM_CORE_THREAD); + ret = shared_fd_service_init(); if (ret < 0) { DbgPrint("Shared FD service init is done: %d\n", ret); diff --git a/src/server.c b/src/server.c index 5c2eea4..25a3fac 100644 --- a/src/server.c +++ b/src/server.c @@ -9862,8 +9862,6 @@ static struct method s_slave_table[] = { HAPI int server_init(void) { - com_core_packet_use_thread(WIDGET_CONF_COM_CORE_THREAD); - if (unlink(INFO_SOCKET) < 0) { ErrPrint("unlink info: %d\n", errno); } diff --git a/src/shortcut_service.c b/src/shortcut_service.c index 472c73c..f18d1d8 100644 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -221,7 +221,7 @@ HAPI int shortcut_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create(SHORTCUT_SOCKET, SHORTCUT_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create("sdlocal://"SHORTCUT_SOCKET, SHORTCUT_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; diff --git a/src/slave_life.c b/src/slave_life.c index d03f86c..1fdb695 100644 --- a/src/slave_life.c +++ b/src/slave_life.c @@ -671,6 +671,11 @@ static Eina_Bool sdk_activate_timer_cb(void *data) return activate_timer_cb(slave); } +/** + * @note + * This callback is called only if the slave is not launched (or it doesn't send hello message to master) + * If the slave is launched so it has valid PID, however it doesn't send hello message in time (activate time in conf file). + */ static inline void invoke_slave_fault_handler(struct slave_node *slave) { slave->fault_count++; @@ -683,6 +688,10 @@ static inline void invoke_slave_fault_handler(struct slave_node *slave) slave_set_reactivate_instances(slave, 0); if (slave_pid(slave) > 0) { + /** + * @note + * Slave is launched but there is no connection (hello message). + */ if ((slave->ctrl_option & PROVIDER_CTRL_MANUAL_TERMINATION) == PROVIDER_CTRL_MANUAL_TERMINATION) { DbgPrint("Manual termination is turned on\n"); (void)slave_rpc_disconnect(slave); @@ -694,9 +703,18 @@ static inline void invoke_slave_fault_handler(struct slave_node *slave) ErrPrint("Terminate failed, pid %d (reason: %d)\n", slave_pid(slave), ret); } } + } else { + /** + * @note + * Slave is not launched yet. + */ + DbgPrint("Slave is not launched before (%s)\n", slave_name(slave)); } - slave->state = SLAVE_TERMINATED; + if (slave->state != SLAVE_TERMINATED) { + slave = slave_deactivated(slave); + DbgPrint("Slave deactivated: %p\n", slave); + } } static Eina_Bool relaunch_timer_cb(void *data) diff --git a/src/slave_rpc.c b/src/slave_rpc.c index 78b4f2c..099ee13 100644 --- a/src/slave_rpc.c +++ b/src/slave_rpc.c @@ -600,7 +600,7 @@ HAPI int slave_rpc_init(struct slave_node *slave) } if (slave_event_callback_add(slave, SLAVE_EVENT_DEACTIVATE, slave_deactivate_cb, NULL) < 0) { - ErrPrint("Failed to add event callback\n"); + ErrPrint("Failed to add deactivate event callback\n"); } rpc->ping_count = 0; -- 2.7.4 From fd314044254207eb7eb086e50d736cd5270a0c4f Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 7 Aug 2015 16:41:12 +0900 Subject: [PATCH 05/16] use the systemd socket Change-Id: I47338474710430c46eb82f09b32967a180f252a0 --- src/badge_service.c | 2 +- src/notification_service.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/badge_service.c b/src/badge_service.c index 2e2921e..d0288ba 100644 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -551,7 +551,7 @@ HAPI int badge_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create(BADGE_SOCKET, BADGE_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create("sdlocal://"BADGE_SOCKET, BADGE_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; diff --git a/src/notification_service.c b/src/notification_service.c index eb03e03..db2a63c 100644 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -960,7 +960,7 @@ HAPI int notification_service_init(void) _notification_init(); - s_info.svc_ctx = service_common_create(NOTIFICATION_SOCKET, NOTIFICATION_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create("sdlocal://"NOTIFICATION_SOCKET, NOTIFICATION_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; -- 2.7.4 From b7c3d4996c7ea149188759a9d70532348d97c442 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 7 Aug 2015 20:41:02 +0900 Subject: [PATCH 06/16] Fix the duplicated active/relaunch timer registration issue. When the slave is not activated (waiting hello message or relaunching it) If a user adds widget instance again, the slave "pause" / "resume" state change request can be sent. At that time, the slave state is changed to REQUEST_PAUSE or REQUEST_RESUME. but slave activate function only check the REQUEST_LAUNCH state. and its pid is not speicified. Because of this weird cases, the slave gets two or more activate/reluanch timer. it creates dangled timer pointer. After few secs later, even if the slave is faulted. so the object is deleted. those dangled timer object fired, and tries to access the deleted slave object. finally, the master gets crashed. This patch will fix it. Change-Id: Ie418a874def0711ad2a8d3d6a01e9409e23abd8d --- src/slave_life.c | 107 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 56 insertions(+), 51 deletions(-) diff --git a/src/slave_life.c b/src/slave_life.c index 1fdb695..e400bd6 100644 --- a/src/slave_life.c +++ b/src/slave_life.c @@ -626,6 +626,7 @@ static Eina_Bool activate_timer_cb(void *data) ecore_timer_del(slave->relaunch_timer); slave->relaunch_timer = NULL; } + slave->activate_timer = NULL; slave->fault_count++; @@ -637,7 +638,6 @@ static Eina_Bool activate_timer_cb(void *data) slave_set_reactivation(slave, 0); slave_set_reactivate_instances(slave, 0); - slave->activate_timer = NULL; if (slave_pid(slave) > 0) { int ret; DbgPrint("Try to terminate PID: %d\n", slave_pid(slave)); @@ -717,6 +717,39 @@ static inline void invoke_slave_fault_handler(struct slave_node *slave) } } +static bundle *create_slave_param(struct slave_node *slave) +{ + 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(); + } + + if (param) { + 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_is_secured(slave)) ? "true" : "false"); + bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave_abi(slave)); + bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration); + } else { + ErrPrint("Failed to create a bundle\n"); + } + + return param; +} + static Eina_Bool relaunch_timer_cb(void *data) { struct slave_node *slave = data; @@ -735,19 +768,9 @@ static Eina_Bool relaunch_timer_cb(void *data) slave->relaunch_timer = NULL; invoke_slave_fault_handler(slave); } else { - 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(); - } + bundle *param; + param = create_slave_param(slave); if (!param) { ErrPrint("Failed to create a bundle\n"); @@ -758,20 +781,8 @@ static Eina_Bool relaunch_timer_cb(void *data) invoke_slave_fault_handler(slave); } else { - 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); - bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration); - ErrPrint("Launch App [%s]\n", slave_pkgname(slave)); slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param); - bundle_free(param); switch (slave->pid) { @@ -813,7 +824,6 @@ static Eina_Bool relaunch_timer_cb(void *data) break; } } - } return ret; @@ -851,38 +861,33 @@ HAPI int slave_activate(struct slave_node *slave) return WIDGET_ERROR_ALREADY_STARTED; } + /** + * @note + * Slave state can be changed even though it is not activated, By calling the "slave_pause" or "slave_resume" + * In that case, this part of codes can be executed. + * + * We have to check the activate_timer or relaunch_timer. + * If one of them or all of them are exist, it means, the slave is not activated yet. + * But the activate request is sent. + * Then just return from here. with ALREADY_STARTED error code. + */ + if (slave->activate_timer || slave->relaunch_timer) { + DbgPrint("Slave State[0x%X] is changed by pause/resume even though it is not activated yet\n", slave_state(slave)); + return WIDGET_ERROR_ALREADY_STARTED; + } + if (WIDGET_CONF_DEBUG_MODE || g_conf.debug_mode) { DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->secured, slave->abi); } else { - bundle *param = NULL; - - slave->relaunch_count = WIDGET_CONF_SLAVE_RELAUNCH_COUNT; - - 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); - } - } + bundle *param; + param = create_slave_param(slave); if (!param) { - param = bundle_create(); - if (!param) { - ErrPrint("Failed to create a bundle\n"); - return WIDGET_ERROR_FAULT; - } + ErrPrint("Failed to create a bundle\n"); + return WIDGET_ERROR_FAULT; } - 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); - bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration); + slave->relaunch_count = WIDGET_CONF_SLAVE_RELAUNCH_COUNT; ErrPrint("Launch App [%s]\n", slave_pkgname(slave)); slave->pid = (pid_t)aul_launch_app(slave_pkgname(slave), param); -- 2.7.4 From 4a40fbcb37f2c97c98e0acef368bf5d8e2ab9dc1 Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Wed, 19 Aug 2015 21:38:00 +0900 Subject: [PATCH 07/16] Move DB file to /usr/dbspace Change-Id: I305de14b9c80a993e54662d7097f7a4500346302 Signed-off-by: Kyuho Jo --- data/device/wayland.mobile.320x480.conf.ini | 2 +- data/device/wayland.mobile.480x800.conf.ini | 2 +- data/device/wayland.mobile.conf.ini | 2 +- data/device/wayland.wearable.360x360.conf.ini | 2 +- data/device/wayland.wearable.360x480.conf.ini | 2 +- data/device/wayland.wearable.conf.ini | 2 +- data/device/x11.mobile.320x480.conf.ini | 2 +- data/device/x11.mobile.480x800.conf.ini | 2 +- data/device/x11.mobile.540x960.conf.ini | 2 +- data/device/x11.mobile.conf.ini | 2 +- data/device/x11.wearable.360x360.conf.ini | 2 +- data/device/x11.wearable.360x480.conf.ini | 2 +- data/device/x11.wearable.conf.ini | 2 +- data/dump_widget.sh | 2 +- data/emulator/wayland.mobile.320x480.conf.ini | 2 +- data/emulator/wayland.mobile.480x800.conf.ini | 2 +- data/emulator/wayland.mobile.conf.ini | 2 +- data/emulator/wayland.wearable.360x360.conf.ini | 2 +- data/emulator/wayland.wearable.360x480.conf.ini | 2 +- data/emulator/wayland.wearable.conf.ini | 2 +- data/emulator/x11.mobile.320x480.conf.ini | 2 +- data/emulator/x11.mobile.480x800.conf.ini | 2 +- data/emulator/x11.mobile.540x960.conf.ini | 2 +- data/emulator/x11.mobile.conf.ini | 2 +- data/emulator/x11.wearable.360x360.conf.ini | 2 +- data/emulator/x11.wearable.360x480.conf.ini | 2 +- data/emulator/x11.wearable.conf.ini | 2 +- packaging/data-provider-master.spec | 28 ++++++++++++------------- pkgmgr_widget/common/src/common.c | 2 +- 29 files changed, 42 insertions(+), 42 deletions(-) diff --git a/data/device/wayland.mobile.320x480.conf.ini b/data/device/wayland.mobile.320x480.conf.ini index fc49048..ff5b5bc 100644 --- a/data/device/wayland.mobile.320x480.conf.ini +++ b/data/device/wayland.mobile.320x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/wayland.mobile.480x800.conf.ini b/data/device/wayland.mobile.480x800.conf.ini index 7593188..993296f 100644 --- a/data/device/wayland.mobile.480x800.conf.ini +++ b/data/device/wayland.mobile.480x800.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/wayland.mobile.conf.ini b/data/device/wayland.mobile.conf.ini index ea6dd0a..84e2f02 100644 --- a/data/device/wayland.mobile.conf.ini +++ b/data/device/wayland.mobile.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/wayland.wearable.360x360.conf.ini b/data/device/wayland.wearable.360x360.conf.ini index c0cda7c..b562eb4 100644 --- a/data/device/wayland.wearable.360x360.conf.ini +++ b/data/device/wayland.wearable.360x360.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/wayland.wearable.360x480.conf.ini b/data/device/wayland.wearable.360x480.conf.ini index b4276b2..7a695cf 100644 --- a/data/device/wayland.wearable.360x480.conf.ini +++ b/data/device/wayland.wearable.360x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/wayland.wearable.conf.ini b/data/device/wayland.wearable.conf.ini index eba043d..c6514c6 100644 --- a/data/device/wayland.wearable.conf.ini +++ b/data/device/wayland.wearable.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.mobile.320x480.conf.ini b/data/device/x11.mobile.320x480.conf.ini index fc49048..ff5b5bc 100644 --- a/data/device/x11.mobile.320x480.conf.ini +++ b/data/device/x11.mobile.320x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.mobile.480x800.conf.ini b/data/device/x11.mobile.480x800.conf.ini index 7593188..993296f 100644 --- a/data/device/x11.mobile.480x800.conf.ini +++ b/data/device/x11.mobile.480x800.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.mobile.540x960.conf.ini b/data/device/x11.mobile.540x960.conf.ini index b2962dd..d50f449 100644 --- a/data/device/x11.mobile.540x960.conf.ini +++ b/data/device/x11.mobile.540x960.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.mobile.conf.ini b/data/device/x11.mobile.conf.ini index 2f732fa..3de8d17 100644 --- a/data/device/x11.mobile.conf.ini +++ b/data/device/x11.mobile.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.wearable.360x360.conf.ini b/data/device/x11.wearable.360x360.conf.ini index c0cda7c..b562eb4 100644 --- a/data/device/x11.wearable.360x360.conf.ini +++ b/data/device/x11.wearable.360x360.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.wearable.360x480.conf.ini b/data/device/x11.wearable.360x480.conf.ini index b4276b2..7a695cf 100644 --- a/data/device/x11.wearable.360x480.conf.ini +++ b/data/device/x11.wearable.360x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/device/x11.wearable.conf.ini b/data/device/x11.wearable.conf.ini index 336af73..37b61a5 100644 --- a/data/device/x11.wearable.conf.ini +++ b/data/device/x11.wearable.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/dump_widget.sh b/data/dump_widget.sh index 2963bbb..5af7857 100644 --- a/data/dump_widget.sh +++ b/data/dump_widget.sh @@ -4,5 +4,5 @@ WIDGET_DEBUG=$1/widget mkdir -p ${WIDGET_DEBUG} /bin/cp -r /opt/usr/share/live_magazine ${WIDGET_DEBUG} /bin/cp -r /tmp/.widget.service ${WIDGET_DEBUG}/log -/bin/cp -r /opt/dbspace/.widget.db ${WIDGET_DEBUG} +/bin/cp -r /usr/dbspace/.widget.db ${WIDGET_DEBUG} ls -la /tmp/ | /bin/grep srw > ${WIDGET_DEBUG}/log/tmp.hidden_files diff --git a/data/emulator/wayland.mobile.320x480.conf.ini b/data/emulator/wayland.mobile.320x480.conf.ini index fc49048..ff5b5bc 100644 --- a/data/emulator/wayland.mobile.320x480.conf.ini +++ b/data/emulator/wayland.mobile.320x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/wayland.mobile.480x800.conf.ini b/data/emulator/wayland.mobile.480x800.conf.ini index 7593188..993296f 100644 --- a/data/emulator/wayland.mobile.480x800.conf.ini +++ b/data/emulator/wayland.mobile.480x800.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/wayland.mobile.conf.ini b/data/emulator/wayland.mobile.conf.ini index ea6dd0a..84e2f02 100644 --- a/data/emulator/wayland.mobile.conf.ini +++ b/data/emulator/wayland.mobile.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/wayland.wearable.360x360.conf.ini b/data/emulator/wayland.wearable.360x360.conf.ini index c0cda7c..b562eb4 100644 --- a/data/emulator/wayland.wearable.360x360.conf.ini +++ b/data/emulator/wayland.wearable.360x360.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/wayland.wearable.360x480.conf.ini b/data/emulator/wayland.wearable.360x480.conf.ini index b4276b2..7a695cf 100644 --- a/data/emulator/wayland.wearable.360x480.conf.ini +++ b/data/emulator/wayland.wearable.360x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/wayland.wearable.conf.ini b/data/emulator/wayland.wearable.conf.ini index eba043d..c6514c6 100644 --- a/data/emulator/wayland.wearable.conf.ini +++ b/data/emulator/wayland.wearable.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.mobile.320x480.conf.ini b/data/emulator/x11.mobile.320x480.conf.ini index 9341273..9f208a7 100644 --- a/data/emulator/x11.mobile.320x480.conf.ini +++ b/data/emulator/x11.mobile.320x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.mobile.480x800.conf.ini b/data/emulator/x11.mobile.480x800.conf.ini index f6a9e8b..2b3cacf 100644 --- a/data/emulator/x11.mobile.480x800.conf.ini +++ b/data/emulator/x11.mobile.480x800.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.mobile.540x960.conf.ini b/data/emulator/x11.mobile.540x960.conf.ini index 3c85ec7..5bf3240 100644 --- a/data/emulator/x11.mobile.540x960.conf.ini +++ b/data/emulator/x11.mobile.540x960.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.mobile.conf.ini b/data/emulator/x11.mobile.conf.ini index 67818c6..2dc2bf0 100644 --- a/data/emulator/x11.mobile.conf.ini +++ b/data/emulator/x11.mobile.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.wearable.360x360.conf.ini b/data/emulator/x11.wearable.360x360.conf.ini index a277980..2595602 100644 --- a/data/emulator/x11.wearable.360x360.conf.ini +++ b/data/emulator/x11.wearable.360x360.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.wearable.360x480.conf.ini b/data/emulator/x11.wearable.360x480.conf.ini index a8511a2..4a2181a 100644 --- a/data/emulator/x11.wearable.360x480.conf.ini +++ b/data/emulator/x11.wearable.360x480.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/data/emulator/x11.wearable.conf.ini b/data/emulator/x11.wearable.conf.ini index e0fc7e4..987ce52 100644 --- a/data/emulator/x11.wearable.conf.ini +++ b/data/emulator/x11.wearable.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/opt/dbspace/.widget.db +#db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 2dd01ac..83f4fe5 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -127,10 +127,10 @@ 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}/usr/dbspace echo "widget DB file is not exists, initiate it" -sqlite3 %{buildroot}/opt/dbspace/.widget.db-new < Date: Fri, 21 Aug 2015 12:05:36 +0900 Subject: [PATCH 08/16] Rollback changes for systemd socket path Change-Id: I12d0f81383d80ba3ba1caee690a8d67cc20b2410 Signed-off-by: Kyuho Jo --- src/badge_service.c | 2 +- src/notification_service.c | 2 +- src/server.c | 6 +++--- src/shared_fd_service.c | 4 ++-- src/shortcut_service.c | 2 +- src/utility_service.c | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/badge_service.c b/src/badge_service.c index d0288ba..2e2921e 100644 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -551,7 +551,7 @@ HAPI int badge_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create("sdlocal://"BADGE_SOCKET, BADGE_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create(BADGE_SOCKET, BADGE_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; diff --git a/src/notification_service.c b/src/notification_service.c index db2a63c..eb03e03 100644 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -960,7 +960,7 @@ HAPI int notification_service_init(void) _notification_init(); - s_info.svc_ctx = service_common_create("sdlocal://"NOTIFICATION_SOCKET, NOTIFICATION_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create(NOTIFICATION_SOCKET, NOTIFICATION_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; diff --git a/src/server.c b/src/server.c index 25a3fac..6047a78 100644 --- a/src/server.c +++ b/src/server.c @@ -9871,17 +9871,17 @@ HAPI int server_init(void) ErrPrint("Failed to create a info socket\n"); } - s_info.slave_fd = com_core_packet_server_init_with_permission("sdlocal://"SLAVE_SOCKET, s_slave_table, NULL); + s_info.slave_fd = com_core_packet_server_init_with_permission(SLAVE_SOCKET, s_slave_table, NULL); if (s_info.slave_fd < 0) { ErrPrint("Failed to create a slave socket\n"); } - s_info.client_fd = com_core_packet_server_init_with_permission("sdlocal://"CLIENT_SOCKET, s_client_table, NULL); + s_info.client_fd = com_core_packet_server_init_with_permission(CLIENT_SOCKET, s_client_table, NULL); if (s_info.client_fd < 0) { ErrPrint("Failed to create a client socket\n"); } - s_info.service_fd = com_core_packet_server_init_with_permission("sdlocal://"SERVICE_SOCKET, s_service_table, NULL); + s_info.service_fd = com_core_packet_server_init_with_permission(SERVICE_SOCKET, s_service_table, NULL); if (s_info.service_fd < 0) { ErrPrint("Faild to create a service socket\n"); } diff --git a/src/shared_fd_service.c b/src/shared_fd_service.c index d153882..e2d16b5 100644 --- a/src/shared_fd_service.c +++ b/src/shared_fd_service.c @@ -132,9 +132,9 @@ HAPI int shared_fd_service_init(void) * 4. Send accepted FD to provider via result packet. * 5. Provider will send a packet to the viewer via that FD. */ - s_info.fd = com_core_packet_server_init("sdlocal://"SHARED_SOCKET, s_table); + s_info.fd = com_core_packet_server_init(SHARED_SOCKET, s_table); if (s_info.fd < 0) { - ErrPrint("Failed to make a server for %s\n", "sdlocal://"SHARED_SOCKET); + ErrPrint("Failed to make a server for %s\n", SHARED_SOCKET); } return WIDGET_ERROR_NONE; diff --git a/src/shortcut_service.c b/src/shortcut_service.c index f18d1d8..472c73c 100644 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -221,7 +221,7 @@ HAPI int shortcut_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create("sdlocal://"SHORTCUT_SOCKET, SHORTCUT_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create(SHORTCUT_SOCKET, SHORTCUT_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; diff --git a/src/utility_service.c b/src/utility_service.c index fa3d2d8..f66053c 100644 --- a/src/utility_service.c +++ b/src/utility_service.c @@ -409,7 +409,7 @@ int utility_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create("sdlocal://"UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create(UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; -- 2.7.4 From f1a3561528316935b1dea041f5eb5a5b08c1fc2a Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Wed, 2 Sep 2015 21:10:22 +0900 Subject: [PATCH 09/16] Checking privileges by using cynara. Change-Id: If90371dbdd8f2ef3c401534eb4e3153f063b9afb Signed-off-by: Kyuho Jo --- CMakeLists.txt | 2 + include/service_common.h | 2 + packaging/data-provider-master.spec | 3 ++ src/badge_service.c | 40 ++----------------- src/notification_service.c | 17 +------- src/service_common.c | 79 +++++++++++++++++++++++++++++++++++++ src/shortcut_service.c | 15 +++---- 7 files changed, 95 insertions(+), 63 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8ca3785..d4ed2eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ pkg_check_modules(pkg REQUIRED libsystemd-daemon libtbm capi-appfw-app-manager + cynara-client + cynara-creds-socket ) IF (LIVEBOX) diff --git a/include/service_common.h b/include/service_common.h index 188435a..97f597c 100644 --- a/include/service_common.h +++ b/include/service_common.h @@ -63,4 +63,6 @@ extern int service_unregister_tcb_callback(struct service_context *svc_ctx, stru extern int service_common_send_packet_to_service(struct service_context *svc_ctx, struct tcb *tcb, struct packet *packet); +extern int service_check_privilege_by_socket_fd(struct service_context *svc_ctx, int socket_fd, char *privilege); + /* End of a file */ diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 83f4fe5..00cfe04 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -46,6 +46,9 @@ BuildRequires: pkgconfig(badge-service) BuildRequires: pkgconfig(shortcut) BuildRequires: pkgconfig(security-server) BuildRequires: pkgconfig(libsystemd-daemon) +BuildRequires: pkgconfig(cynara-client) +BuildRequires: pkgconfig(cynara-creds-socket) + Requires(post): sys-assert Requires(post): dbus diff --git a/src/badge_service.c b/src/badge_service.c index 2e2921e..c8f8084 100644 --- a/src/badge_service.c +++ b/src/badge_service.c @@ -60,40 +60,6 @@ struct badge_service { }; /*! - * FUNCTIONS to check smack permission - */ -static int _is_valid_permission(int fd, struct badge_service *service) -{ - if (service->rule != NULL && service->access != NULL) { - /* - int ret; - ret = security_server_check_privilege_by_sockfd(fd, service->rule, service->access); - if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { - ErrPrint("SMACK:Access denied\n"); - return 0; - } - */ - } - - return 1; -} - -static int _is_manager_permission(int fd) -{ - /* - int ret; - ret = security_server_check_privilege_by_sockfd(fd, - "data-provider-master::badge.manager", "w"); - if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { - ErrPrint("SMACK:not a manager\n"); - return 0; - } - */ - - return 1; -} - -/*! * FUNCTIONS to handle badge */ static inline char *get_string(char *string) @@ -172,7 +138,7 @@ static void _handler_delete_badge(struct tcb *tcb, struct packet *packet, void * caller = get_string(caller); if (pkgname != NULL && caller != NULL) { - if (_is_manager_permission(tcb_fd(tcb)) == 1) { + if (service_check_privilege_by_socket_fd(tcb_svc_ctx(tcb), tcb_fd(tcb), "http://tizen.org/privilege/notification") == 1) { ret = badge_db_delete(pkgname, pkgname); } else { ret = badge_db_delete(pkgname, caller); @@ -510,13 +476,13 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat } #if ENABLE_BS_ACCESS_CONTROL - if (_is_valid_permission(tcb_fd(tcb), &(service_req_table[i])) == 1) { + if (service_check_privilege_by_socket_fd(tcb_svc_ctx(tcb), tcb_fd(tcb), "http://tizen.org/privilege/notification") == 1) { service_req_table[i].handler(tcb, packet, data); } else { _handler_access_control_error(tcb, packet); } #else - _is_valid_permission(tcb_fd(tcb), &(service_req_table[i])); + service_check_privilege_by_socket_fd(tcb_svc_ctx(tcb), tcb_fd(tcb), "http://tizen.org/privilege/notification"); service_req_table[i].handler(tcb, packet, data); #endif break; diff --git a/src/notification_service.c b/src/notification_service.c index eb03e03..92984c3 100644 --- a/src/notification_service.c +++ b/src/notification_service.c @@ -641,21 +641,6 @@ static void _permission_check_property_get(struct tcb *tcb, struct packet *packe } } -static int _persmission_check(int fd, struct noti_service *service) -{ - if (service->rule != NULL && service->access != NULL) { - /* - ret = security_server_check_privilege_by_sockfd(fd, service->rule, service->access); - if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) { - ErrPrint("SMACK:Access denied\n"); - return 0; - } - */ - } - - return 1; -} - /*! * NOTIFICATION SERVICE INITIALIZATION */ @@ -843,7 +828,7 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat continue; } - if (_persmission_check(tcb_fd(tcb), &(service_req_table[i])) == 1) { + if (service_check_privilege_by_socket_fd(tcb_svc_ctx(tcb), tcb_fd(tcb), "http://tizen.org/privilege/notification") == 1) { service_req_table[i].handler(tcb, packet, data); } else { if (service_req_table[i].handler_access_error != NULL) { diff --git a/src/service_common.c b/src/service_common.c index f65e382..a19dc00 100644 --- a/src/service_common.c +++ b/src/service_common.c @@ -27,6 +27,9 @@ #include #include +#include +#include + #include #if defined(HAVE_LIVEBOX) #include @@ -91,6 +94,8 @@ struct service_context { Eina_List *tcb_destroy_cb_list; int processing_service_handler; + + cynara *cynara_handle; }; struct packet_info { @@ -113,6 +118,27 @@ struct tcb { /* Thread controll block */ pid_t pid; /*!< Keep the PID of client, if the client is remote one, this will be -1 */ }; +static void _initialize_privilege_checker(struct service_context *svc_ctx) +{ + int ret; + + /* Cynara structure init */ + ret = cynara_initialize(&(svc_ctx->cynara_handle), NULL); + if (ret != CYNARA_API_SUCCESS) { + ErrPrint("cynara_initialize failed[%d]\n", ret); + } +} + +static void _finish_privilege_checker(struct service_context *svc_ctx) +{ + int ret; + + ret = cynara_finish(svc_ctx->cynara_handle); + if (ret != CYNARA_API_SUCCESS) { + ErrPrint("cynara_initialize failed[%d]\n", ret); + } +} + HAPI int service_common_send_packet_to_service(struct service_context *svc_ctx, struct tcb *tcb, struct packet *packet) { int ret = 0; @@ -956,6 +982,8 @@ HAPI struct service_context *service_common_create(const char *addr, const char return NULL; } + _initialize_privilege_checker(svc_ctx); + status = pthread_mutex_init(&svc_ctx->packet_list_lock, NULL); if (status != 0) { ErrPrint("Unable to create a mutex: %d\n", status); @@ -1018,6 +1046,8 @@ HAPI int service_common_destroy(struct service_context *svc_ctx) DbgPrint("Thread returns: %p\n", ret); } + _finish_privilege_checker(svc_ctx); + secure_socket_destroy_handle(svc_ctx->fd); status = pthread_mutex_destroy(&svc_ctx->packet_list_lock); @@ -1260,4 +1290,53 @@ HAPI int service_common_fd(struct service_context *ctx) return ctx->fd; } + +HAPI int service_check_privilege_by_socket_fd(struct service_context *svc_ctx, int socket_fd, char *privilege) +{ + int ret = 0; + int result = 0; + char *uid = NULL; + char *client_smack = NULL; + + if (privilege != NULL) { + + ret = cynara_creds_socket_get_client(socket_fd, CLIENT_METHOD_SMACK, &client_smack); + + if (ret != CYNARA_API_SUCCESS) { + ErrPrint("cynara_creds_socket_get_client failed [%d]", ret); + goto out; + } + + ret = cynara_creds_socket_get_user(socket_fd, USER_METHOD_UID, &uid); + + if (ret != CYNARA_API_SUCCESS) { + ErrPrint("cynara_creds_socket_get_user failed [%d]", ret); + goto out; + } + + ret = cynara_check(svc_ctx->cynara_handle, client_smack, "", uid, privilege); + + if (ret == CYNARA_API_ACCESS_ALLOWED) { + DbgPrint("[%s] Access allowed.", privilege); + result = 1; + } + else { + DbgPrint("[%s] Access denied.[%d]", privilege, ret); + result = 0; + } + + } + +out: + if (client_smack) { + free(client_smack); + } + + if (uid) { + free(uid); + } + + return result; +} + /* End of a file */ diff --git a/src/shortcut_service.c b/src/shortcut_service.c index 472c73c..43ada70 100644 --- a/src/shortcut_service.c +++ b/src/shortcut_service.c @@ -96,7 +96,6 @@ 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; @@ -113,7 +112,6 @@ static void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret) packet_destroy(reply_packet); } -#endif /*! * SERVICE THREAD @@ -139,25 +137,22 @@ 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) { + ret = service_check_privilege_by_socket_fd(tcb_svc_ctx(tcb), tcb_fd(tcb), "http://tizen.org/privilege/shortcut"); + if (ret == 0) { ErrPrint("SMACK:Access denied\n"); 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) { + ret = service_check_privilege_by_socket_fd(tcb_svc_ctx(tcb), tcb_fd(tcb), "http://tizen.org/privilege/shortcut"); + if (ret == 0) { ErrPrint("SMACK:Access denied\n"); 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 25f41665ee304195f50d36a75709ec86247cc55a Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Wed, 2 Sep 2015 13:44:16 +0900 Subject: [PATCH 10/16] Sync with the latest tizen 2.x Change-Id: I7116caeb40d00d6a4307aea96b76df77c8106bfc --- data/CMakeLists.txt | 23 ++- include/dead_monitor.h | 2 +- include/debug.h | 6 +- include/event.h | 6 +- include/script_handler.h | 2 +- include/util.h | 1 - packaging/data-provider-master.spec | 76 ++++---- pkgmgr_widget/common/src/common.c | 48 ++++- src/buffer_handler.c | 25 ++- src/buffer_handler_wayland.c | 6 +- src/critical_log.c | 3 +- src/dead_monitor.c | 26 ++- src/event.c | 199 ++++++++++++++------- src/main.c | 6 +- src/monitor.c | 2 +- src/package.c | 9 +- src/script_handler.c | 8 +- src/server.c | 339 ++++++++++++++++++++++-------------- src/slave_life.c | 19 +- src/util.c | 27 +-- src/utility_service.c | 2 +- widget-mgr/src/widget-mgr.c | 59 +++++++ 22 files changed, 580 insertions(+), 314 deletions(-) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index aa56f64..e56be3e 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,16 +1,13 @@ -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.service DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.path DESTINATION /usr/lib/systemd/user/ 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) 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) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/user/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/include/dead_monitor.h b/include/dead_monitor.h index 52ebbe4..35ce0f1 100644 --- a/include/dead_monitor.h +++ b/include/dead_monitor.h @@ -17,6 +17,6 @@ extern int dead_init(void); extern int dead_fini(void); extern int dead_callback_add(int handle, void (*dead_cb)(int handle, void *data), void *data); -extern void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data)); +extern void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data), void *data); /* End of a file */ diff --git a/include/debug.h b/include/debug.h index cbf1ea0..717fb49 100644 --- a/include/debug.h +++ b/include/debug.h @@ -20,9 +20,9 @@ #define WarnPrint(format, arg...) SECURE_LOGW(format, ##arg) #else extern FILE *__file_log_fp; -#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) -#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) -#define WarnPrint(format, arg...) do { fprintf(__file_log_fp, "[WRN] [%s/%s:%d] " format, util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) +#define DbgPrint(format, arg...) do { fprintf(__file_log_fp, "[LOG] [%s/%s:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) +#define ErrPrint(format, arg...) do { fprintf(__file_log_fp, "[ERR] [%s/%s:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) +#define WarnPrint(format, arg...) do { fprintf(__file_log_fp, "[WRN] [%s/%s:%d] " format, widget_util_basename(__FILE__), __func__, __LINE__, ##arg); fflush(__file_log_fp); } while (0) #endif // DbgPrint("FREE\n"); diff --git a/include/event.h b/include/event.h index 64acb5b..8943ab1 100644 --- a/include/event.h +++ b/include/event.h @@ -56,14 +56,14 @@ 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, 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_activate(int device, 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 device, 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); 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 ratio_w, double ratio_h, double timestamp); +extern void event_set_mouse_xy(int device, int x, int y, double ratio_w, double ratio_h, double timestamp); /* End of a file */ diff --git a/include/script_handler.h b/include/script_handler.h index 5e84f2b..933c557 100644 --- a/include/script_handler.h +++ b/include/script_handler.h @@ -30,7 +30,7 @@ extern int script_fini(void); extern int script_signal_emit(void *buffer_handle, const char *part, const char *signal, double sx, double sy, double ex, double ey); -extern int script_handler_update_pointer(struct script_info *inst, int x, int y, int down); +extern int script_handler_update_pointer(struct script_info *info, int device, int x, int y, int down); extern int script_handler_update_keycode(struct script_info *info, unsigned int keycode); extern int script_handler_resize(struct script_info *info, int w, int h); extern const char *script_handler_buffer_id(struct script_info *info); diff --git a/include/util.h b/include/util.h index 3aa09d2..91ee9fc 100644 --- a/include/util.h +++ b/include/util.h @@ -20,7 +20,6 @@ extern int util_check_ext(const char *filename, const char *check_ptr); extern int util_unlink(const char *filename); extern int util_unlink_files(const char *folder); extern char *util_slavename(void); -extern const char *util_basename(const char *name); extern unsigned long long util_free_space(const char *path); extern void *util_timer_add(double interval, Eina_Bool (*cb)(void *data), void *data); extern void util_timer_interval_set(void *timer, double interval); diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 00cfe04..9eb52c4 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for widgetes -Version: 1.1.10 +Version: 1.2.0 Release: 1 Group: Applications/Core Applications License: Flora-1.1 @@ -112,23 +112,13 @@ CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%j rm -rf %{buildroot} %make_install mkdir -p %{buildroot}/%{_datarootdir}/license -mkdir -p %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants -ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service -ln -sf ../%{name}.path %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path -ln -sf ../%{name}.target %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target -ln -sf ../%{name}-client.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket -ln -sf ../%{name}-provider.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket -ln -sf ../%{name}-service.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket -ln -sf ../%{name}-badge.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket -ln -sf ../%{name}-notification.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket -ln -sf ../%{name}-shortcut.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket -ln -sf ../%{name}-utility.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket -ln -sf ../%{name}-fd.socket %{buildroot}%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket - +mkdir -p %{buildroot}%{_prefix}/lib/systemd/system/multi-user.target.wants +ln -sf ../%{name}.service %{buildroot}%{_prefix}/lib/systemd/system/multi-user.target.wants/%{name}.service 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/share/live_magazine/widget.lck mkdir -p %{buildroot}/opt/usr/devel/usr/bin mkdir -p %{buildroot}/usr/dbspace @@ -178,51 +168,49 @@ chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine # System tool(widget-mgr) should be able to access this folder. # So give the "rx" permission to the other group. (750 -> 755) chmod 755 /opt/usr/share/live_magazine + chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/log chmod 750 /opt/usr/share/live_magazine/log + chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/reader chmod 750 /opt/usr/share/live_magazine/reader + chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/always chmod 750 /opt/usr/share/live_magazine/always +chown ${SYSTEM}:${APP_GID} /opt/usr/share/live_magazine/widget.lck +chmod 770 /opt/usr/share/live_magazine/widget.lck +mv /opt/usr/share/live_magazine/widget.lck /opt/usr/share/live_magazine/.widget.lck + +chown ${SYSTEM}:${APP_GID} %{_prefix}/dbspace/.widget.db +chmod 644 %{_prefix}/dbspace/.widget.db +chown ${SYSTEM}:${APP_GID} /opt/dbspace/.widget.db-journal +chmod 644 %{_prefix}/dbspace/.widget.db-journal + # SYSTEM_UID? chown ${APP_UID}:${APP_GID} /usr/dbspace/.widget.db chmod 640 /usr/dbspace/.widget.db chown ${APP_UID}:${APP_GID} /usr/dbspace/.widget.db-journal chmod 640 /usr/dbspace/.widget.db-journal -vconftool set -t bool "memory/%{name}/started" 0 -i -u ${APP_UID} -f -s system::vconf_system -vconftool set -t int "memory/private/%{name}/restart_count" 0 -i -u ${APP_UID} -f -s %{name} -vconftool set -t string "db/%{name}/serveraddr" "/opt/usr/share/live_magazine/.client.socket" -i -u ${APP_UID} -f -s system::vconf_system - echo "Successfully installed. Please start a daemon again manually" %files -n %{name} %manifest %{name}.manifest -%defattr(-,root,root,-) -%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} -%{_prefix}/lib/systemd/user/%{name}.target -%{_prefix}/lib/systemd/user/%{name}-client.socket -%{_prefix}/lib/systemd/user/%{name}-provider.socket -%{_prefix}/lib/systemd/user/%{name}-service.socket -%{_prefix}/lib/systemd/user/%{name}-badge.socket -%{_prefix}/lib/systemd/user/%{name}-notification.socket -%{_prefix}/lib/systemd/user/%{name}-shortcut.socket -%{_prefix}/lib/systemd/user/%{name}-utility.socket -%{_prefix}/lib/systemd/user/%{name}-fd.socket -%{_prefix}/lib/systemd/user/%{name}.service -%{_prefix}/lib/systemd/user/%{name}.path -%{_prefix}/lib/systemd/user/default.target.wants/%{name}.target -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-client.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-provider.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-service.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-badge.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-notification.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-shortcut.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-utility.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}-fd.socket -%{_prefix}/lib/systemd/user/default.target.wants/%{name}.service -%{_prefix}/lib/systemd/user/default.target.wants/%{name}.path +%defattr(-,system,system,-) +#%caps(cap_chown,cap_dac_override,cap_dac_read_search,cap_sys_admin,cap_sys_nice+ep) %{_prefix}/bin/%{name} +%{_prefix}/lib/systemd/system/multi-user.target.wants/%{name}.service +%{_prefix}/lib/systemd/system/%{name}.service +%{_prefix}/lib/systemd/system/%{name}.target +%{_prefix}/bin +#%{_libdir}/systemd/system/%{name}-client.socket +#%{_libdir}/systemd/system/%{name}-provider.socket +#%{_libdir}/systemd/system/%{name}-service.socket +#%{_libdir}/systemd/system/%{name}-badge.socket +#%{_libdir}/systemd/system/%{name}-notification.socket +#%{_libdir}/systemd/system/%{name}-shortcut.socket +#%{_libdir}/systemd/system/%{name}-utility.socket +#%{_libdir}/systemd/system/%{name}-fd.socket %{_datarootdir}/license/* %if 0%{?tizen_build_binary_release_type_eng} /opt/usr/devel/usr/bin/* @@ -230,8 +218,8 @@ echo "Successfully installed. Please start a daemon again manually" %{_prefix}/etc/package-manager/parserlib/* %{_datarootdir}/%{name}/* /opt/etc/dump.d/module.d/dump_widget.sh -%defattr(-,owner,users,-) +#%defattr(-,owner,users,-) /opt/usr/share/live_magazine/* -/usr/dbspace/.widget.db* +%{_prefix}/dbspace/.widget.db* # End of a file diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index 9f3d19e..37aa3bc 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -44,6 +44,9 @@ #define CUR_VER 5 #define DEFAULT_CATEGORY "http://tizen.org/category/default" +#define SCHEME_HTTP "http://" +#define SCHEME_HTTPS "https://" +#define SCHEME_FILE "file://" #if !defined(WIDGET_COUNT_OF_SIZE_TYPE) #define WIDGET_COUNT_OF_SIZE_TYPE 13 @@ -223,6 +226,23 @@ static struct { .handle = NULL, }; +static int is_scheme(const char *path) +{ + if (!strncasecmp(path, SCHEME_HTTP, strlen(SCHEME_HTTP))) { + return 1; + } + + if (!strncasecmp(path, SCHEME_HTTPS, strlen(SCHEME_HTTPS))) { + return 1; + } + + if (!strncasecmp(path, SCHEME_FILE, strlen(SCHEME_FILE))) { + return 1; + } + + return 0; +} + static inline int next_state(int from, char ch) { switch (ch) { @@ -2617,7 +2637,9 @@ static void update_box(struct widget *widget, xmlNodePtr node) if (!src) { ErrPrint("strdup: %d\n", errno); } else { - abspath((char *)widget->widget_src, (char *)src); + if (!is_scheme((char *)widget->widget_src)) { + abspath((char *)widget->widget_src, (char *)src); + } xmlFree(widget->widget_src); widget->widget_src = src; } @@ -2835,7 +2857,9 @@ static void update_glance_bar(struct widget *widget, xmlNodePtr node) if (!src) { ErrPrint("strdup: %d\n", errno); } else { - abspath((char *)widget->gbar_src, (char *)src); + if (!is_scheme((char *)widget->widget_src)) { + abspath((char *)widget->gbar_src, (char *)src); + } xmlFree(widget->gbar_src); widget->gbar_src = src; } @@ -3053,15 +3077,16 @@ static int has_meta_tag(const char *appid, const char *meta_tag) return 0; } -/** - * Not supported from tizen 3.0 yet - * + /** + * @todo + * Need to find a replacement of this API + * ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); if (ret != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } -*/ + */ ret = value && value[0] != '\0'; @@ -3178,8 +3203,8 @@ int db_install_widget(xmlNodePtr node, const char *appid) xmlFree(tmp); } - if (xmlHasProp(node, (const xmlChar *)"direct_input")) { - tmp = xmlGetProp(node, (const xmlChar *)"direct_input"); + if (xmlHasProp(node, (const xmlChar *)"direct-input")) { + tmp = xmlGetProp(node, (const xmlChar *)"direct-input"); widget->direct_input = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true"); xmlFree(tmp); } @@ -3453,6 +3478,13 @@ int db_install_watchapp(xmlNodePtr node, const char *appid) widget->default_need_frame = 0; widget->size_list = WIDGET_SIZE_TYPE_2x2; + /** + * @note + * In case of the watch, + * It only can be created one instance at a time. + */ + widget->count = 1; + if (xmlHasProp(node, (const xmlChar *)"exec")) { widget->libexec = xmlGetProp(node, (const xmlChar *)"exec"); if (!widget->libexec) { diff --git a/src/buffer_handler.c b/src/buffer_handler.c index c8a9a8e..b1065a1 100644 --- a/src/buffer_handler.c +++ b/src/buffer_handler.c @@ -75,6 +75,7 @@ struct gem_data { Pixmap pixmap; void *data; /* Gem layer */ int refcnt; + widget_resource_lock_t resource_lock; void *compensate_data; /* Check the pitch value, copy this to data */ }; @@ -167,6 +168,13 @@ static inline widget_fb_t create_pixmap(struct buffer_info *info) ErrPrint("Unable to clear the pixmap\n"); } + if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) { + gem->resource_lock = widget_service_create_resource_lock(gem->pixmap, WIDGET_LOCK_WRITE); + if (!gem->resource_lock) { + ErrPrint("Failed to create a resource lock: %u\n", gem->pixmap); + } + } + return buffer; } @@ -342,6 +350,15 @@ static inline int destroy_pixmap(widget_fb_t buffer) DbgPrint("pixmap %lu\n", gem->pixmap); XFreePixmap(disp, gem->pixmap); + + if (WIDGET_CONF_ENABLE_RESOURCE_LOCK) { + if (gem->resource_lock) { + if (widget_service_destroy_resource_lock(gem->resource_lock, 1) != WIDGET_ERROR_NONE) { + ErrPrint("Failed to destroy resource lock\n"); + } + gem->resource_lock = NULL; + } + } } buffer->state = WIDGET_FB_STATE_DESTROYED; @@ -353,10 +370,6 @@ static inline int destroy_gem(widget_fb_t buffer) { struct gem_data *gem; - if (!buffer) { - return WIDGET_ERROR_INVALID_PARAMETER; - } - /*! * Forcely release the acquire_buffer. */ @@ -703,12 +716,12 @@ EAPI int buffer_handler_unload(struct buffer_info *info) switch (info->type) { case WIDGET_FB_TYPE_FILE: - widget_service_destroy_lock(info->lock_info); + widget_service_destroy_lock(info->lock_info, 1); info->lock_info = NULL; ret = unload_file_buffer(info); break; case WIDGET_FB_TYPE_SHM: - widget_service_destroy_lock(info->lock_info); + widget_service_destroy_lock(info->lock_info, 1); info->lock_info = NULL; ret = unload_shm_buffer(info); break; diff --git a/src/buffer_handler_wayland.c b/src/buffer_handler_wayland.c index 8fe6a74..a8dcb99 100644 --- a/src/buffer_handler_wayland.c +++ b/src/buffer_handler_wayland.c @@ -565,12 +565,12 @@ EAPI int buffer_handler_unload(struct buffer_info *info) switch (info->type) { case WIDGET_FB_TYPE_FILE: - widget_service_destroy_lock(info->lock_info); + widget_service_destroy_lock(info->lock_info, 1); info->lock_info = NULL; ret = unload_file_buffer(info); break; case WIDGET_FB_TYPE_SHM: - widget_service_destroy_lock(info->lock_info); + widget_service_destroy_lock(info->lock_info, 1); info->lock_info = NULL; ret = unload_shm_buffer(info); break; @@ -1072,7 +1072,7 @@ static inline widget_fb_t raw_open_file(const char *filename) buffer->state = WIDGET_FB_STATE_CREATED; buffer->type = WIDGET_FB_TYPE_FILE; buffer->refcnt = 0; - buffer->info = (void *)((unsigned long)off); + buffer->info = (void *)off; ret = read(fd, buffer->data, off); if (ret < 0) { diff --git a/src/critical_log.c b/src/critical_log.c index fce937f..703be15 100644 --- a/src/critical_log.c +++ b/src/critical_log.c @@ -30,6 +30,7 @@ #if defined(HAVE_LIVEBOX) #include #include +#include #else #include "lite-errno.h" #endif @@ -101,7 +102,7 @@ HAPI int critical_log(const char *func, int line, const char *fmt, ...) CRITICAL_SECTION_BEGIN(&s_info.cri_lock); - fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), util_basename((char *)func), line); + fprintf(s_info.fp, "%lf [%s:%d] ", util_timestamp(), widget_util_basename((char *)func), line); va_start(ap, fmt); ret = vfprintf(s_info.fp, fmt, ap); diff --git a/src/dead_monitor.c b/src/dead_monitor.c index ad6b2e7..009dd23 100644 --- a/src/dead_monitor.c +++ b/src/dead_monitor.c @@ -38,6 +38,7 @@ struct cb_item { int handle; + int disconnected; void (*dead_cb)(int handle, void *data); void *data; }; @@ -58,9 +59,17 @@ static int evt_cb(int handle, void *data) Eina_List *n; EINA_LIST_FOREACH_SAFE(s_info.cb_list, l, n, dead_item) { + /** + * If the callback is called already, + * Do not call it again. + * Using "disconnected" varaible, prevent from duplicated callback call. + */ if (dead_item->handle == handle) { - dead_item->dead_cb(dead_item->handle, dead_item->data); - break; + if (dead_item->disconnected == 0) { + dead_item->dead_cb(dead_item->handle, dead_item->data); + dead_item->disconnected = 1; + break; + } } } @@ -148,7 +157,7 @@ HAPI int dead_callback_add(int handle, void (*dead_cb)(int handle, void *data), Eina_List *l; EINA_LIST_FOREACH(s_info.cb_list, l, item) { - if (item->handle == handle) { + if (item->handle == handle && item->disconnected == 0) { return WIDGET_ERROR_ALREADY_EXIST; } } @@ -161,19 +170,26 @@ HAPI int dead_callback_add(int handle, void (*dead_cb)(int handle, void *data), item->handle = handle; item->dead_cb = dead_cb; item->data = data; + /** + * Handle can be reallocated if the first connection is disconnected, + * The kernel can resue the last handle (index) for newly comming connection. + * So we have to check the callback data using disconnected field. + * If the connection is disconnected first, we have to toggle this to true. + */ + item->disconnected = 0; s_info.cb_list = eina_list_append(s_info.cb_list, item); return 0; } -HAPI void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data)) +HAPI void *dead_callback_del(int handle, void (*dead_cb)(int handle, void *data), void *data) { struct cb_item *item; Eina_List *l; Eina_List *n; EINA_LIST_FOREACH_SAFE(s_info.cb_list, l, n, item) { - if (item->handle == handle && item->dead_cb == dead_cb) { + if (item->handle == handle && item->dead_cb == dead_cb && item->data == data) { void *cbdata; s_info.cb_list = eina_list_remove(s_info.cb_list, item); diff --git a/src/event.c b/src/event.c index 4930cea..d95707d 100644 --- a/src/event.c +++ b/src/event.c @@ -83,7 +83,7 @@ static struct info { .x = -1, .y = -1, .device = -1, - .slot = -1, + .slot = 0, .keycode = 0, }, @@ -91,7 +91,7 @@ static struct info { .x = -1, .y = -1, .device = -1, - .slot = -1, + .slot = 0, .keycode = 0, }, @@ -112,6 +112,9 @@ struct event_listener { int y; /* RelY */ double ratio_w; double ratio_h; + int slot; + + int unset_done; }; static int event_control_fini(void); @@ -179,6 +182,20 @@ static int push_event_item(void) return WIDGET_ERROR_NONE; } +static struct event_data *pop_event_item(void) +{ + struct event_data *item; + + CRITICAL_SECTION_BEGIN(&s_info.event_list_lock); + item = eina_list_nth(s_info.event_list, 0); + if (item) { + s_info.event_list = eina_list_remove(s_info.event_list, item); + } + CRITICAL_SECTION_END(&s_info.event_list_lock); + + return item; +} + static double current_time_get(void) { double ret; @@ -498,6 +515,7 @@ static void *event_thread_main(void *data) s_info.event_data.x = -1; s_info.event_data.y = -1; + s_info.event_data.slot = 0; while (1) { FD_ZERO(&set); @@ -590,12 +608,70 @@ static int invoke_event_cb(struct event_listener *listener, struct event_data *i return 0; } -static inline void clear_all_listener_list(void) +static inline void clear_listener(struct event_listener *listener) { - struct event_listener *listener; enum event_state next_state; struct event_data event_data; struct event_data *p_event_data; + + /** + * @note + * terminate this listener. with keep its event state (DOWN -> MOVE -> UP) + */ + while (listener) { + DbgPrint("listener[%p] prev[%x] state[%x]\n", listener, listener->prev_state, listener->state); + + switch (listener->state) { + case EVENT_STATE_ACTIVATE: + p_event_data = &s_info.event_data; + next_state = EVENT_STATE_ACTIVATED; + break; + case EVENT_STATE_ACTIVATED: + p_event_data = &s_info.event_data; + next_state = EVENT_STATE_DEACTIVATE; + break; + case EVENT_STATE_DEACTIVATE: + memcpy(&event_data, &s_info.event_data, sizeof(event_data)); + p_event_data = &event_data; + + if (listener->prev_state == EVENT_STATE_ACTIVATE) { + /* There is no move event. we have to emulate it */ + DbgPrint ("Let's emulate move event (%dx%d)\n", p_event_data->x, p_event_data->y); + listener->state = EVENT_STATE_ACTIVATE; + next_state = EVENT_STATE_ACTIVATED; + } else { + next_state = EVENT_STATE_DEACTIVATED; + } + break; + case EVENT_STATE_DEACTIVATED: + default: + s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener); + DbgFree(listener); + listener = NULL; + continue; + } + + p_event_data->slot = listener->slot; + if (invoke_event_cb(listener, p_event_data)) { + /** + * @note + * listener is deleted. + */ + listener = NULL; + continue; + } + + /*! + * Changing state of listener will affect to the event collecting thread. + */ + listener->prev_state = listener->state; + listener->state = next_state; + } +} + +static inline void clear_all_listener_list(void) +{ + struct event_listener *listener; Eina_List *l; Eina_List *n; @@ -606,50 +682,8 @@ static inline void clear_all_listener_list(void) DbgPrint("Use skipped event: %dx%d\n", s_info.skipped_event_data.x, s_info.skipped_event_data.y); } - while (s_info.event_listener_list) { - EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) { - - DbgPrint("listener[%p] prev[%x] state[%x]\n", listener, listener->prev_state, listener->state); - - switch (listener->state) { - case EVENT_STATE_ACTIVATE: - p_event_data = &s_info.event_data; - next_state = EVENT_STATE_ACTIVATED; - break; - case EVENT_STATE_ACTIVATED: - p_event_data = &s_info.event_data; - next_state = EVENT_STATE_DEACTIVATE; - break; - case EVENT_STATE_DEACTIVATE: - memcpy(&event_data, &s_info.event_data, sizeof(event_data)); - p_event_data = &event_data; - - if (listener->prev_state == EVENT_STATE_ACTIVATE) { - /* There is no move event. we have to emulate it */ - DbgPrint ("Let's emulate move event (%dx%d)\n", p_event_data->x, p_event_data->y); - listener->state = EVENT_STATE_ACTIVATE; - next_state = EVENT_STATE_ACTIVATED; - } else { - next_state = EVENT_STATE_DEACTIVATED; - } - break; - case EVENT_STATE_DEACTIVATED: - default: - s_info.event_listener_list = eina_list_remove(s_info.event_listener_list, listener); - DbgFree(listener); - continue; - } - - if (invoke_event_cb(listener, p_event_data)) { - continue; - } - - /*! - * Changing state of listener will affect to the event collecting thread. - */ - listener->prev_state = listener->state; - listener->state = next_state; - } + EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) { + clear_listener(listener); } } @@ -719,19 +753,21 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler) } } - CRITICAL_SECTION_BEGIN(&s_info.event_list_lock); - item = eina_list_nth(s_info.event_list, 0); - if (item) { - s_info.event_list = eina_list_remove(s_info.event_list, item); - } - CRITICAL_SECTION_END(&s_info.event_list_lock); - + item = pop_event_item(); if (!item) { ErrPrint("There is no remained event\n"); return ECORE_CALLBACK_RENEW; } EINA_LIST_FOREACH_SAFE(s_info.event_listener_list, l, n, listener) { + if (item->slot != listener->slot) { + continue; + } + + if (item->device == -1) { + DbgPrint("Touch released (%d) listener state(%x)\n", item->slot, listener->state); + } + switch (listener->state) { case EVENT_STATE_ACTIVATE: if (compare_timestamp(listener, item) > 0) { @@ -743,6 +779,23 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler) break; case EVENT_STATE_DEACTIVATE: if (compare_timestamp(listener, item) < 0) { + if (listener->unset_done == 1) { + /** + * @note + * in case of the multi=touch, + * The thread will not be terminated soon. + * in this case, we should send UP event and destroy listener properly. + */ + clear_listener(listener); + /** + * @note + * Listener will be deleted. + * But event_item which is related with this listener can be remained. + * And it will be deleted soon. + */ + continue; + } + /* Consuming all events occurred while activating this listener */ state = listener->prev_state; listener->prev_state = listener->state; @@ -759,12 +812,16 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler) } if (invoke_event_cb(listener, item) == 1) { - /* listener is deleted */ + /** + * @note + * listener is deleted + */ continue; } if (listener->state == EVENT_STATE_ACTIVATE) { /** + * @note * We are already jumped into the DEACTIVATE state * But the state is ACTIVATE, it means, we forcely chnaged it from LINE 747 * We successfully sent the DOWN event. @@ -782,7 +839,10 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler) memcpy(&s_info.skipped_event_data, item, sizeof(s_info.skipped_event_data)); } - /* Do not terminate this listener, until this mets EVENT_EXIT */ + /** + * @note + * Do not terminate this listener, until this mets EVENT_EXIT + */ continue; case EVENT_STATE_ACTIVATED: if (compare_timestamp(listener, item) > 0) { @@ -805,6 +865,10 @@ static Eina_Bool event_read_cb(void *data, Ecore_Fd_Handler *handler) } if (invoke_event_cb(listener, item) == 1) { + /** + * @note + * listener is deleted. + */ continue; } @@ -963,14 +1027,14 @@ 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, double ratio_w, double ratio_h, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data) +HAPI int event_activate(int slot, 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; Eina_List *l; EINA_LIST_FOREACH(s_info.event_listener_list, l, listener) { - if (listener->event_cb == event_cb && listener->cbdata == data) { + if (listener->event_cb == event_cb && listener->cbdata == data && listener->slot == slot) { ErrPrint("Already registered\n"); return WIDGET_ERROR_ALREADY_EXIST; } @@ -993,6 +1057,8 @@ HAPI int event_activate(int x, int y, double ratio_w, double ratio_h, int (*even listener->y = y; listener->ratio_w = ratio_w; listener->ratio_h = ratio_h; + listener->slot = slot; + listener->unset_done = 0; if (s_info.event_handler_activated == EVENT_HANDLER_DEACTIVATED) { /*! @@ -1027,7 +1093,7 @@ HAPI int event_input_fd(void) return s_info.handle; } -HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data) +HAPI int event_deactivate(int slot, int (*event_cb)(enum event_state state, struct event_data *event, void *data), void *data) { struct event_listener *listener = NULL; struct event_listener *item; @@ -1035,7 +1101,7 @@ HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_d int keep_thread = 0; EINA_LIST_FOREACH(s_info.event_listener_list, l, item) { - if (item->event_cb == event_cb && item->cbdata == data) { + if (item->event_cb == event_cb && item->cbdata == data && (slot < 0 || item->slot == slot)) { switch (item->state) { case EVENT_STATE_ACTIVATE: case EVENT_STATE_ACTIVATED: @@ -1066,6 +1132,14 @@ HAPI int event_deactivate(int (*event_cb)(enum event_state state, struct event_d if (keep_thread) { DbgPrint("Keep thread\n"); + listener->unset_done = 1; + + /** + * @note + * This will invoke the event_read_cb callback with fake event data. + * At that time we should terminate this listener. + */ + push_event_item(); return WIDGET_ERROR_NONE; } @@ -1102,7 +1176,7 @@ HAPI int event_is_activated(void) return s_info.handle >= 0; } -HAPI void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, double timestamp) +HAPI void event_set_mouse_xy(int slot, int x, int y, double ratio_w, double ratio_h, double timestamp) { s_info.event_data.x = x; s_info.event_data.y = y; @@ -1110,6 +1184,7 @@ HAPI void event_set_mouse_xy(int x, int y, double ratio_w, double ratio_h, doubl s_info.event_data.ratio_h = ratio_h; s_info.event_data.tv = timestamp; s_info.event_data.source = INPUT_EVENT_SOURCE_VIEWER; + s_info.event_data.slot = slot; /** * Don't touch the timestamp_updated variable. * if we toggle it, the input thread will not be terminated correctly. SEE LINE: 537 diff --git a/src/main.c b/src/main.c index b7e5047..7a390fe 100644 --- a/src/main.c +++ b/src/main.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,8 @@ FILE *__file_log_fp; #endif +#define WIDGET_STATIC_LOCK_PATH "/opt/usr/share/live_magazine/.widget.lck" + static inline int app_create(void) { int ret; @@ -397,6 +400,7 @@ int main(int argc, char *argv[]) (void)util_unlink_files(WIDGET_CONF_READER_PATH); (void)util_unlink_files(WIDGET_CONF_IMAGE_PATH); (void)util_unlink_files(WIDGET_CONF_LOG_PATH); + (void)util_unlink_files(WIDGET_STATIC_LOCK_PATH); } util_setup_log_disk(); @@ -405,7 +409,7 @@ int main(int argc, char *argv[]) * How could we care this return values? * Is there any way to print something on the screen? */ - ret = critical_log_init(util_basename(argv[0])); + ret = critical_log_init(widget_util_basename(argv[0])); if (ret < 0) { ErrPrint("Failed to init the critical log\n"); } diff --git a/src/monitor.c b/src/monitor.c index 6ce128d..a444914 100644 --- a/src/monitor.c +++ b/src/monitor.c @@ -111,7 +111,7 @@ HAPI int monitor_destroy_client(struct monitor_client *monitor) } if (cnt == 0) { - dead_callback_del(handle, monitor_disconnected_cb); + dead_callback_del(handle, monitor_disconnected_cb, NULL); ErrPrint("Registered monitor object is not valid\n"); } diff --git a/src/package.c b/src/package.c index 998c311..e064d22 100644 --- a/src/package.c +++ b/src/package.c @@ -1773,15 +1773,16 @@ HAPI char *package_meta_tag(const char *appid, const char *meta_tag) return NULL; } -/** - * This is not supported from Tizen 3.0 yet. - * + /** + * @TODO + * Need to find replacement of this API + * status = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); if (status != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return NULL; } -*/ + */ if (value && value[0] != '\0') { ret = strdup(value); diff --git a/src/script_handler.c b/src/script_handler.c index 4aec836..aa82041 100644 --- a/src/script_handler.c +++ b/src/script_handler.c @@ -158,6 +158,7 @@ struct script_info { int x; int y; int down; + int device; unsigned int keycode; @@ -1058,7 +1059,7 @@ HAPI int script_fini(void) return 0; } -HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, int down) +HAPI int script_handler_update_pointer(struct script_info *info, int device, int x, int y, int down) { if (!info) { return WIDGET_ERROR_NONE; @@ -1066,6 +1067,7 @@ HAPI int script_handler_update_pointer(struct script_info *info, int x, int y, i info->x = x; info->y = y; + info->device = device; if (down == 0) { info->down = 0; @@ -1096,6 +1098,10 @@ HAPI int script_handler_feed_event(struct script_info *info, int event, double t return WIDGET_ERROR_INVALID_PARAMETER; } + /** + * @todo + * Feeds device info to the script loader. + */ ret = info->port->feed_event(info->port_data, event, info->x, info->y, info->down, info->keycode, timestamp); return ret; } diff --git a/src/server.c b/src/server.c index 6047a78..b8916e6 100644 --- a/src/server.c +++ b/src/server.c @@ -204,15 +204,21 @@ static char *is_valid_slave(pid_t pid, const char *abi, const char *provider_pkg return converted_provider_pkgname; } + if (!provider_pkgname) { + DbgPrint("provider_pkgname is NULL (%s)\n", pid_pkgname); + return NULL; + } + if (!strcmp(abi_pkgname, pid_pkgname)) { /*! * This request is comes from predefined service provider. * In this case, we should believe its request. */ + DbgPrint("Provider pkgname[%s]\n", provider_pkgname); return strdup(provider_pkgname); } else if (WIDGET_CONF_DEBUG_MODE || g_conf.debug_mode) { DbgPrint("Debug mode is enabled, use the %s as a widget_id\n", provider_pkgname); - return provider_pkgname ? strdup(provider_pkgname) : NULL; + return strdup(provider_pkgname); } /*! @@ -627,7 +633,7 @@ static int key_event_widget_route_cb(enum event_state state, struct event_data * return WIDGET_ERROR_INVALID_PARAMETER; } - packet = packet_create_noack((const char *)&cmd, "ssdi", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode); + packet = packet_create_noack((const char *)&cmd, "ssdii", package_name(pkg), instance_id(inst), event_info->tv, event_info->keycode, event_info->slot); if (!packet) { return WIDGET_ERROR_FAULT; } @@ -672,7 +678,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, "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); + packet = packet_create_noack((const char *)&cmd, "ssdiiiddi", 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, event_info->slot); if (!packet) { return WIDGET_ERROR_FAULT; } @@ -746,15 +752,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->ratio_w, event_info->y * event_info->ratio_h, 1); + script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, -1); + script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, 0); + script_handler_update_pointer(script, event_info->slot, 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: @@ -846,7 +852,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, "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); + packet = packet_create_noack((const char *)&cmd, "ssdiiiddi", 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, event_info->slot); if (!packet) { return WIDGET_ERROR_FAULT; } @@ -921,15 +927,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->ratio_w, event_info->y * event_info->ratio_h, 1); + script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, -1); + script_handler_update_pointer(script, event_info->slot, 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->ratio_w, event_info->y * event_info->ratio_h, 0); + script_handler_update_pointer(script, event_info->slot, 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: @@ -1642,6 +1648,7 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1650,8 +1657,8 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Invalid parameter\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1673,7 +1680,7 @@ static struct packet *client_gbar_mouse_enter(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp); ret = 0; } else { @@ -1700,6 +1707,7 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1708,8 +1716,8 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1731,7 +1739,7 @@ static struct packet *client_gbar_mouse_leave(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp); ret = 0; } else { @@ -1758,6 +1766,7 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1766,8 +1775,8 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1789,7 +1798,7 @@ static struct packet *client_gbar_mouse_down(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp); ret = 0; } else { @@ -1816,6 +1825,7 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1824,8 +1834,8 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1847,7 +1857,7 @@ static struct packet *client_gbar_mouse_up(pid_t pid, int handle, const struct p goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 0); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp); ret = 0; } else { @@ -1874,6 +1884,7 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1882,8 +1893,8 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1905,7 +1916,7 @@ static struct packet *client_gbar_mouse_move(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp); ret = 0; } else { @@ -1932,6 +1943,7 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -1940,8 +1952,8 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -1963,7 +1975,7 @@ static struct packet *client_widget_mouse_move(pid_t pid, int handle, const stru goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_MOVE, timestamp); ret = 0; } else { @@ -1985,7 +1997,7 @@ static int inst_del_cb(struct inst_info *inst, void *data) * It will calls event callbacks. * And the event callbacks will try to access the "inst" */ - (void)event_deactivate(data, inst); + (void)event_deactivate(-1, data, inst); /* Reset callback data to prevent accessing inst from event callback */ ret = event_reset_cbdata(data, inst, NULL); @@ -2009,6 +2021,7 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa struct inst_info *inst; const struct pkg_info *pkg; struct packet *result; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2017,8 +2030,8 @@ static struct packet *client_gbar_key_set(pid_t pid, int handle, const struct pa goto out; } - ret = packet_get(packet, "ssdi", &pkgname, &id, ×tamp, &keycode); - if (ret != 4) { + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &keycode, &device); + if (ret != 5) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2030,7 +2043,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, 1.0f, 1.0f, key_event_gbar_route_cb, inst); + ret = event_activate(device, 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); @@ -2040,7 +2053,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, 1.0f, 1.0f, key_event_gbar_consume_cb, inst); + ret = event_activate(device, 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); @@ -2074,6 +2087,7 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct struct inst_info *inst; const struct pkg_info *pkg; struct packet *result; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2082,8 +2096,8 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdi", &pkgname, &id, ×tamp, &keycode); - if (ret != 4) { + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &keycode, &device); + if (ret != 5) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2095,7 +2109,7 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct } if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { - ret = event_deactivate(key_event_gbar_route_cb, inst); + ret = event_deactivate(device, key_event_gbar_route_cb, inst); 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_OFF); } @@ -2106,7 +2120,7 @@ static struct packet *client_gbar_key_unset(pid_t pid, int handle, const struct } */ } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { - ret = event_deactivate(key_event_gbar_consume_cb, inst); + ret = event_deactivate(device, key_event_gbar_consume_cb, inst); 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_OFF); } @@ -2141,6 +2155,7 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct struct inst_info *inst; const struct pkg_info *pkg; struct packet *result; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2149,8 +2164,8 @@ static struct packet *client_widget_key_set(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdi", &pkgname, &id, ×tamp, &keycode); - if (ret != 4) { + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &keycode, &device); + if (ret != 5) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2162,7 +2177,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, 1.0f, 1.0f, key_event_widget_route_cb, inst); + ret = event_activate(device, 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); @@ -2172,7 +2187,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, 1.0f, 1.0f, key_event_widget_consume_cb, inst); + ret = event_activate(device, 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); @@ -2206,6 +2221,7 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc struct inst_info *inst; const struct pkg_info *pkg; struct packet *result; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2214,8 +2230,8 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdi", &pkgname, &id, ×tamp, &keycode); - if (ret != 4) { + ret = packet_get(packet, "ssdii", &pkgname, &id, ×tamp, &keycode, &device); + if (ret != 5) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2227,7 +2243,7 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc } if (package_widget_type(pkg) == WIDGET_TYPE_BUFFER) { - ret = event_deactivate(key_event_widget_route_cb, inst); + ret = event_deactivate(device, key_event_widget_route_cb, inst); 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_OFF); } @@ -2238,7 +2254,7 @@ static struct packet *client_widget_key_unset(pid_t pid, int handle, const struc } */ } else if (package_widget_type(pkg) == WIDGET_TYPE_SCRIPT) { - ret = event_deactivate(key_event_widget_consume_cb, inst); + ret = event_deactivate(device, key_event_widget_consume_cb, inst); 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_OFF); } @@ -2276,6 +2292,7 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2284,8 +2301,8 @@ static struct packet *client_widget_mouse_set(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2298,7 +2315,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, ratio_w, ratio_h, mouse_event_widget_route_cb, inst); + ret = event_activate(device, 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); @@ -2321,7 +2338,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, ratio_w, ratio_h, mouse_event_widget_consume_cb, inst); + ret = event_activate(device, 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); @@ -2352,6 +2369,7 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2360,8 +2378,8 @@ static struct packet *client_widget_mouse_unset(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2375,9 +2393,9 @@ 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, ratio_w, ratio_h, timestamp); + event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp); - ret = event_deactivate(mouse_event_widget_route_cb, inst); + ret = event_deactivate(device, mouse_event_widget_route_cb, inst); 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_OFF); } @@ -2402,9 +2420,9 @@ 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, ratio_w, ratio_h, timestamp); + event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp); - ret = event_deactivate(mouse_event_widget_consume_cb, inst); + ret = event_deactivate(device, mouse_event_widget_consume_cb, inst); 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_OFF); } @@ -2436,6 +2454,7 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2444,8 +2463,8 @@ static struct packet *client_gbar_mouse_set(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2458,7 +2477,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, ratio_w, ratio_h, mouse_event_gbar_route_cb, inst); + ret = event_activate(device, 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); @@ -2481,7 +2500,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, ratio_w, ratio_h, mouse_event_gbar_consume_cb, inst); + ret = event_activate(device, 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); @@ -2513,6 +2532,7 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2521,8 +2541,8 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const goto out; } - ret = packet_get(packet, "ssdiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2544,7 +2564,7 @@ static struct packet *client_widget_mouse_on_scroll(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp); ret = 0; } else { @@ -2571,6 +2591,7 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2579,8 +2600,8 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons goto out; } - ret = packet_get(packet, "ssdiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2602,7 +2623,7 @@ static struct packet *client_widget_mouse_off_scroll(pid_t pid, int handle, cons goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp); ret = 0; } else { @@ -2629,6 +2650,7 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2637,8 +2659,8 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2660,7 +2682,7 @@ static struct packet *client_widget_mouse_on_hold(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp); ret = 0; } else { @@ -2687,6 +2709,7 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2695,8 +2718,8 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2718,7 +2741,7 @@ static struct packet *client_widget_mouse_off_hold(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp); ret = 0; } else { @@ -2745,6 +2768,7 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2753,8 +2777,8 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2776,7 +2800,7 @@ static struct packet *client_gbar_mouse_on_scroll(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_SCROLL, timestamp); ret = 0; } else { @@ -2803,6 +2827,7 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2811,8 +2836,8 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2834,7 +2859,7 @@ static struct packet *client_gbar_mouse_off_scroll(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_SCROLL, timestamp); ret = 0; } else { @@ -2861,6 +2886,7 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2869,8 +2895,8 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2892,7 +2918,7 @@ static struct packet *client_gbar_mouse_on_hold(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_ON_HOLD, timestamp); ret = 0; } else { @@ -2919,6 +2945,7 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2927,8 +2954,8 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -2950,7 +2977,7 @@ static struct packet *client_gbar_mouse_off_hold(pid_t pid, int handle, const st goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OFF_HOLD, timestamp); ret = 0; } else { @@ -2977,6 +3004,7 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -2985,8 +3013,8 @@ static struct packet *client_gbar_mouse_unset(pid_t pid, int handle, const struc goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3000,9 +3028,9 @@ 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, ratio_w, ratio_h, timestamp); + event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp); - ret = event_deactivate(mouse_event_gbar_route_cb, inst); + ret = event_deactivate(device, mouse_event_gbar_route_cb, inst); 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_OFF); } @@ -3027,9 +3055,9 @@ 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, ratio_w, ratio_h, timestamp); + event_set_mouse_xy(device, x, y, ratio_w, ratio_h, timestamp); - ret = event_deactivate(mouse_event_gbar_consume_cb, inst); + ret = event_deactivate(device, mouse_event_gbar_consume_cb, inst); 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_OFF); } @@ -3061,6 +3089,7 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3069,8 +3098,8 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3092,7 +3121,7 @@ static struct packet *client_widget_mouse_enter(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_IN, timestamp); ret = 0; } else { @@ -3119,6 +3148,7 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3127,8 +3157,8 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3150,7 +3180,7 @@ static struct packet *client_widget_mouse_leave(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, -1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, -1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_OUT, timestamp); ret = 0; } else { @@ -3177,6 +3207,7 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3185,8 +3216,8 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3208,7 +3239,7 @@ static struct packet *client_widget_mouse_down(pid_t pid, int handle, const stru goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 1); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 1); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_DOWN, timestamp); ret = 0; } else { @@ -3235,6 +3266,7 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct int source; double ratio_w; double ratio_h; + int device; client = client_find_by_rpc_handle(handle); if (!client) { @@ -3243,8 +3275,8 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct goto out; } - ret = packet_get(packet, "ssdiiidd", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h); - if (ret != 8) { + ret = packet_get(packet, "ssdiiiddi", &pkgname, &id, ×tamp, &x, &y, &source, &ratio_w, &ratio_h, &device); + if (ret != 9) { ErrPrint("Parameter is not matched\n"); ret = WIDGET_ERROR_INVALID_PARAMETER; goto out; @@ -3266,7 +3298,7 @@ static struct packet *client_widget_mouse_up(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, x * ratio_w, y * ratio_h, 0); + script_handler_update_pointer(script, device, x * ratio_w, y * ratio_h, 0); script_handler_feed_event(script, WIDGET_SCRIPT_MOUSE_UP, timestamp); ret = 0; } else { @@ -3321,7 +3353,7 @@ static struct packet *client_gbar_access_action(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTION, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3382,7 +3414,7 @@ static struct packet *client_gbar_access_scroll(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_SCROLL, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3443,7 +3475,7 @@ static struct packet *client_gbar_access_value_change(pid_t pid, int handle, con goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_VALUE_CHANGE, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3504,7 +3536,7 @@ static struct packet *client_gbar_access_mouse(pid_t pid, int handle, const stru goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_MOUSE, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3565,7 +3597,7 @@ static struct packet *client_gbar_access_back(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_BACK, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3626,7 +3658,7 @@ static struct packet *client_gbar_access_over(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_OVER, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3687,7 +3719,7 @@ static struct packet *client_gbar_access_read(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_READ, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3751,7 +3783,7 @@ static struct packet *client_gbar_access_enable(pid_t pid, int handle, const str type = (event.type == 0) ? WIDGET_SCRIPT_ACCESS_DISABLE : WIDGET_SCRIPT_ACCESS_ENABLE; - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, type, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3831,7 +3863,7 @@ static struct packet *client_gbar_access_hl(pid_t pid, int handle, const struct goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, type, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -3892,7 +3924,7 @@ static struct packet *client_gbar_access_activate(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTIVATE, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4319,7 +4351,7 @@ static struct packet *client_widget_access_hl(pid_t pid, int handle, const struc goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, type, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4386,7 +4418,7 @@ static struct packet *client_widget_access_action(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTION, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4453,7 +4485,7 @@ static struct packet *client_widget_access_scroll(pid_t pid, int handle, const s goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_SCROLL, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4520,7 +4552,7 @@ static struct packet *client_widget_access_value_change(pid_t pid, int handle, c goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_VALUE_CHANGE, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4587,7 +4619,7 @@ static struct packet *client_widget_access_mouse(pid_t pid, int handle, const st goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_MOUSE, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4654,7 +4686,7 @@ static struct packet *client_widget_access_back(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_BACK, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4721,7 +4753,7 @@ static struct packet *client_widget_access_over(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_OVER, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4788,7 +4820,7 @@ static struct packet *client_widget_access_read(pid_t pid, int handle, const str goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_READ, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4858,7 +4890,7 @@ static struct packet *client_widget_access_enable(pid_t pid, int handle, const s type = (event.type == 0) ? WIDGET_SCRIPT_ACCESS_DISABLE : WIDGET_SCRIPT_ACCESS_ENABLE; - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, type, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -4920,7 +4952,7 @@ static struct packet *client_widget_access_activate(pid_t pid, int handle, const goto out; } - script_handler_update_pointer(script, event.x, event.y, event.type); + script_handler_update_pointer(script, 0, event.x, event.y, event.type); ret = script_handler_feed_event(script, WIDGET_SCRIPT_ACCESS_ACTIVATE, timestamp); if (ret >= 0) { ret = send_delayed_access_status(inst, ret); @@ -5719,7 +5751,7 @@ static struct packet *client_gbar_move(pid_t pid, int handle, const struct packe instance_slave_set_gbar_pos(inst, x, y); ix = x * instance_gbar_width(inst); iy = y * instance_gbar_height(inst); - script_handler_update_pointer(instance_gbar_script(inst), ix, iy, 0); + script_handler_update_pointer(instance_gbar_script(inst), 0, ix, iy, 0); ret = instance_signal_emit(inst, "pd,move", instance_id(inst), 0.0, 0.0, 0.0, 0.0, x, y, 0); } else { ErrPrint("Invalid GBAR type\n"); @@ -5930,7 +5962,7 @@ static struct packet *client_create_gbar(pid_t pid, int handle, const struct pac ix = x * instance_gbar_width(inst); iy = y * instance_gbar_height(inst); - script_handler_update_pointer(instance_gbar_script(inst), ix, iy, 0); + script_handler_update_pointer(instance_gbar_script(inst), 0, ix, iy, 0); ret = instance_slave_open_gbar(inst, client); if (ret == (int)WIDGET_ERROR_NONE) { @@ -8310,7 +8342,7 @@ static struct packet *slave_hello_sync(pid_t pid, int handle, const struct packe handle = item->handle; - if (dead_callback_del(handle, delete_ctx_cb) != item) { + if (dead_callback_del(handle, delete_ctx_cb, item) != item) { ErrPrint("Dead callback is not valid\n"); } @@ -8528,9 +8560,10 @@ static struct packet *service_get_content(pid_t pid, int handle, const struct pa return NULL; } - if (is_valid_service_requestor(pid, widget_id)) { + if (is_valid_service_requestor(pid, widget_id) == 0) { ErrPrint("Invalid service requestor: %d %s\n", pid, widget_id); - return NULL; + result = packet_create_reply(packet, "is", WIDGET_ERROR_PERMISSION_DENIED, "?"); + return result; } inst = package_find_instance_by_id(widget_id, inst_id); @@ -8560,7 +8593,8 @@ static struct packet *service_get_inst_list(pid_t pid, int handle, const struct if (is_valid_service_requestor(pid, widget_id) == 0) { ErrPrint("Invalid requestor: %d %s\n", pid, widget_id); - return NULL; + result = packet_create_reply(packet, "iis", WIDGET_ERROR_PERMISSION_DENIED, 0, NULL); + return result; } pkg = package_find(widget_id); @@ -9138,6 +9172,57 @@ out: static struct packet *widget_mgr_slave_ctrl(pid_t pid, int handle, const struct packet *packet) { + char *pkgname; + char *id; + int cmd; + int value; + int packet_cmd; + struct widget_mgr *mgr; + struct inst_info *inst; + struct pkg_info *info; + struct packet *ctrl_packet; + + if (packet_get(packet, "ssii", &pkgname, &id, &cmd, &value) != 4) { + ErrPrint("Invalid argument\n"); + goto out; + } + + mgr = widget_mgr_find_by_pid(pid); + if (!mgr) { + ErrPrint("Invalid request\n"); + goto out; + } + + switch (cmd) { + case WIDGET_CTRL_MODE_DUMP_FRAME: + inst = package_find_instance_by_id(pkgname, id); + if (!inst) { + ErrPrint("Instance not found: %s\n", id); + goto out; + } + + info = instance_package(inst); + if (!info) { + ErrPrint("Unable to get pkginfo\n"); + goto out; + } + + packet_cmd = CMD_CTRL_MODE; + ctrl_packet = packet_create_noack((const char *)&packet_cmd, "ssii", pkgname, id, cmd, value); + if (ctrl_packet) { + if (slave_rpc_request_only(package_slave(info), package_name(info), ctrl_packet, 0) < 0) { + ErrPrint("Failed to send request\n"); + } + } + + DbgPrint("Dump frames: %d\n", value); + break; + default: + ErrPrint("Unknown command\n"); + break; + } + +out: return NULL; } diff --git a/src/slave_life.c b/src/slave_life.c index e400bd6..9284afa 100644 --- a/src/slave_life.c +++ b/src/slave_life.c @@ -235,7 +235,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 (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave)) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f) { + } else if (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave)) && (!slave_is_watch(slave) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f)) { DbgPrint("Fire the terminate timer: %d (%d)\n", slave->pid, slave_is_app(slave)); slave->terminate_timer = ecore_timer_add(WIDGET_CONF_SLAVE_TERMINATE_TIME, terminate_timer_cb, slave); if (!slave->terminate_timer) { @@ -260,9 +260,14 @@ static struct slave_node *slave_deactivate(struct slave_node *slave, int no_time } } } else { - /*! - * \todo + /** + * @todo * check the return value of the aul_terminate_pid + * + * @note + * In case of the watch, + * There is no waiting timer for termination. + * Because the watch application cannot be re-used for new instance. */ slave->state = SLAVE_REQUEST_TO_TERMINATE; @@ -786,7 +791,7 @@ static Eina_Bool relaunch_timer_cb(void *data) bundle_free(param); switch (slave->pid) { -// case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */ + case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */ case AUL_R_ENOLAUNCHPAD: /**< no launchpad */ case AUL_R_EILLACC: /**< Illegal Access */ case AUL_R_EINVAL: /**< Invalid argument */ @@ -806,7 +811,7 @@ static Eina_Bool relaunch_timer_cb(void *data) case AUL_R_ECOMM: /**< Comunication Error */ case AUL_R_ETERMINATING: /**< application terminating */ case AUL_R_ECANCELED: /**< Operation canceled */ -// case AUL_R_EREJECTED: + case AUL_R_EREJECTED: slave->relaunch_count--; CRITICAL_LOG("Try relaunch again %s (%d), %d\n", slave_name(slave), slave->pid, slave->relaunch_count); @@ -895,7 +900,7 @@ HAPI int slave_activate(struct slave_node *slave) bundle_free(param); switch (slave->pid) { -// case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */ + case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */ case AUL_R_ENOLAUNCHPAD: /**< no launchpad */ case AUL_R_EILLACC: /**< Illegal Access */ case AUL_R_EINVAL: /**< Invalid argument */ @@ -909,7 +914,7 @@ HAPI int slave_activate(struct slave_node *slave) case AUL_R_ETERMINATING: /**< application terminating */ case AUL_R_ECANCELED: /**< Operation canceled */ case AUL_R_ETIMEOUT: /**< Timeout */ -// case AUL_R_EREJECTED: + case AUL_R_EREJECTED: CRITICAL_LOG("Try relaunch this soon %s (%d)\n", slave_name(slave), slave->pid); slave->relaunch_timer = ecore_timer_add(WIDGET_CONF_SLAVE_RELAUNCH_TIME, relaunch_timer_cb, slave); if (!slave->relaunch_timer) { diff --git a/src/util.c b/src/util.c index 49960cc..66211b8 100644 --- a/src/util.c +++ b/src/util.c @@ -133,19 +133,6 @@ HAPI char *util_slavename(void) return strdup(slavename); } -HAPI const char *util_basename(const char *name) -{ - int length; - length = name ? strlen(name) : 0; - if (!length) { - return "."; - } - - while (--length > 0 && name[length] != '/'); - - return length <= 0 ? name : (name + length + (name[length] == '/')); -} - /*! * Return size of stroage in Bytes unit. */ @@ -316,14 +303,12 @@ HAPI void util_setup_log_disk(void) ErrPrint("chown: %d\n", errno); } - if (!!DATA_SHARE_LABEL) { - ret = smack_setlabel(WIDGET_CONF_LOG_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS); - if (ret != 0) { - ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_LOG_PATH, ret); - } else { - ret = smack_setlabel(WIDGET_CONF_LOG_PATH, "1", SMACK_LABEL_TRANSMUTE); - DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_LOG_PATH, ret); - } + ret = smack_setlabel(WIDGET_CONF_LOG_PATH, DATA_SHARE_LABEL, SMACK_LABEL_ACCESS); + if (ret != 0) { + ErrPrint("Failed to set SMACK for %s (%d)\n", WIDGET_CONF_LOG_PATH, ret); + } else { + ret = smack_setlabel(WIDGET_CONF_LOG_PATH, "1", SMACK_LABEL_TRANSMUTE); + DbgPrint("[%s] is successfully created (t: %d)\n", WIDGET_CONF_LOG_PATH, ret); } } } diff --git a/src/utility_service.c b/src/utility_service.c index f66053c..e893eab 100644 --- a/src/utility_service.c +++ b/src/utility_service.c @@ -220,7 +220,7 @@ static int launch_svc(struct service_context *svc_ctx) pid = aul_launch_app(SVC_PKG, NULL); switch (pid) { -// case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */ + case AUL_R_EHIDDENFORGUEST: /**< App hidden for guest mode */ case AUL_R_ENOLAUNCHPAD: /**< no launchpad */ case AUL_R_EILLACC: /**< Illegal Access */ case AUL_R_EINVAL: /**< Invalid argument */ diff --git a/widget-mgr/src/widget-mgr.c b/widget-mgr/src/widget-mgr.c index 948b861..5168ccc 100644 --- a/widget-mgr/src/widget-mgr.c +++ b/widget-mgr/src/widget-mgr.c @@ -1136,6 +1136,63 @@ static void do_get_list(const char *cmd) } } +static int do_frame_dump(const char *cmd) +{ + struct instance *info; + struct packet *packet; + struct node *parent; + char widget_id[256]; + int value; + int ret; + + cmd = trim_cmd(cmd + strlen("frame_dump")); + if (!*cmd) { + return -EINVAL; + } + + if (s_info.cmd != NOP) { + printf("Waiting the server response\n"); + return -EBUSY; + } + + if (sscanf(cmd, "%[^ ] %d", widget_id, &value) != 2) { + printf("Error[%s]\n", cmd); + return -EINVAL; + } + + s_info.targetdir = update_target_dir(widget_id); + if (!s_info.targetdir) { + printf("%s is not exists\n", cmd); + return -ENOENT; + } + + if (!(node_mode(s_info.targetdir) & NODE_WRITE)) { + printf("Access denied %s\n", cmd); + return -EACCES; + } + + parent = node_parent(s_info.targetdir); + if (!parent) { + printf("Invalid folder: %s\n", cmd); + return -EFAULT; + } + + info = node_data(s_info.targetdir); + printf("WidgetId: %s\n", info->id); + packet = packet_create_noack("slave_ctrl", "ssii", node_name(parent), info->id, WIDGET_CTRL_MODE_DUMP_FRAME, !!value); + ret = com_core_packet_send_only(s_info.fd, packet); + packet_destroy(packet); + if (ret < 0) { + printf("Failed to send a packet: %d\n", ret); + return ret; + } + + printf("Dump frame %s (%s)\n", cmd, node_name(parent)); + s_info.age++; + + return 0; +} + static void do_get_content(const char *cmd) { char widget_id[256]; @@ -1438,6 +1495,8 @@ static void do_command(const char *cmd) do_get_content(cmd); } else if (!strncasecmp(cmd, "get_list", strlen("get_list"))) { do_get_list(cmd); + } else if (!strncasecmp(cmd, "frame_dump", strlen("frame_dump"))) { + do_frame_dump(cmd); } else { help(); } -- 2.7.4 From 7fa2e08cf1625b6cfd99f56fa3b222e4c96c2cf2 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Thu, 3 Sep 2015 11:08:00 +0900 Subject: [PATCH 11/16] Remove SMACK labeling code & Update env file for service All socket service files remove SMACK Label setting. Change-Id: Icedb76ffad4ccad1b0945094a2d154790e72ef85 --- CMakeLists.txt | 63 ++++++++++++++++------- data/CMakeLists.txt | 16 +++--- data/data-provider-master-badge.socket | 2 - data/data-provider-master-client.socket | 2 - data/data-provider-master-fd.socket | 2 - data/data-provider-master-notification.socket | 2 - data/data-provider-master-provider.socket | 2 - data/data-provider-master-service.socket | 2 - data/data-provider-master-shortcut.socket | 2 - data/data-provider-master-utility.socket | 2 - data/device/wayland.mobile.540x960.conf.ini | 45 ++++++++++++++++ data/device/wayland.mobile.540x960.resolution.ini | 14 +++++ data/device/wayland.mobile.conf.ini | 4 +- packaging/data-provider-master.spec | 34 +++++------- src/util_wayland.c | 11 ++++ 15 files changed, 137 insertions(+), 66 deletions(-) create mode 100644 data/device/wayland.mobile.540x960.conf.ini create mode 100644 data/device/wayland.mobile.540x960.resolution.ini diff --git a/CMakeLists.txt b/CMakeLists.txt index d4ed2eb..3645c9f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,26 +197,49 @@ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/abi.ini DESTINATION /usr/share/ INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PRODUCT}.conf.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PRODUCT}.resolution.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.320x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.320x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.480x800.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.480x800.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x360.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x360.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) - -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.540x960.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.540x960.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +IF (WAYLAND_SUPPORT) + IF (WEARABLE) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x360.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.360x360.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.wearable.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + ELSE (WEARABLE) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.320x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.320x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.480x800.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.480x800.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.540x960.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/wayland.mobile.540x960.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + ENDIF (WEARABLE) +ELSE (WAYLAND_SUPPORT) + IF (WEARABLE) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x360.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.360x360.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/360x360 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.wearable.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x320 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + ELSE (WEARABLE) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.320x480.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.320x480.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/320x480 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.480x800.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.480x800.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/480x800 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/720x1280 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.540x960.conf.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/x11.mobile.540x960.resolution.ini DESTINATION /usr/share/${PROJECT_NAME}/540x960 RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) + ENDIF (WEARABLE) +ENDIF (WAYLAND_SUPPORT) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PRODUCT}.conf.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${TARGET}/${PRODUCT}.resolution.ini DESTINATION /usr/share/${PROJECT_NAME} RENAME "resolution.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index e56be3e..30205e4 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -3,11 +3,11 @@ 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) INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}.target DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) -#INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-client.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-provider.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-fd.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-service.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-badge.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-notification.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-shortcut.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) +INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PROJECT_NAME}-utility.socket DESTINATION /usr/lib/systemd/system/ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) diff --git a/data/data-provider-master-badge.socket b/data/data-provider-master-badge.socket index bbfd3fa..445c8cd 100644 --- a/data/data-provider-master-badge.socket +++ b/data/data-provider-master-badge.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.badge.service SocketMode=0666 -SmackLabelIPIn=data-provider-master::badge -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-client.socket b/data/data-provider-master-client.socket index 97727d1..c431a59 100644 --- a/data/data-provider-master-client.socket +++ b/data/data-provider-master-client.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.data-provider-master-client.socket SocketMode=0666 -SmackLabelIPIn=data-provider-master::client -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-fd.socket b/data/data-provider-master-fd.socket index 0c29dba..f79e6c4 100644 --- a/data/data-provider-master-fd.socket +++ b/data/data-provider-master-fd.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.data-provider-master-fd.socket SocketMode=0666 -SmackLabelIPIn=data-provider-master::fd -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-notification.socket b/data/data-provider-master-notification.socket index b535537..051b1d7 100644 --- a/data/data-provider-master-notification.socket +++ b/data/data-provider-master-notification.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.notification.service SocketMode=0666 -SmackLabelIPIn=data-provider-master::notification -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-provider.socket b/data/data-provider-master-provider.socket index 2428301..296f1ea 100644 --- a/data/data-provider-master-provider.socket +++ b/data/data-provider-master-provider.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.data-provider-master-slave.socket SocketMode=0666 -SmackLabelIPIn=data-provider-master::provider -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-service.socket b/data/data-provider-master-service.socket index c3f7166..bc9bb43 100644 --- a/data/data-provider-master-service.socket +++ b/data/data-provider-master-service.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.data-provider-master-service.socket SocketMode=0666 -SmackLabelIPIn=data-provider-master -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-shortcut.socket b/data/data-provider-master-shortcut.socket index 0c3dacd..bb99196 100644 --- a/data/data-provider-master-shortcut.socket +++ b/data/data-provider-master-shortcut.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.shortcut.service SocketMode=0666 -SmackLabelIPIn=data-provider-master::shortcut -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/data-provider-master-utility.socket b/data/data-provider-master-utility.socket index 33d25fd..90e381c 100644 --- a/data/data-provider-master-utility.socket +++ b/data/data-provider-master-utility.socket @@ -3,8 +3,6 @@ SocketUser=system SocketGroup=system ListenStream=/tmp/.utility.service SocketMode=0666 -SmackLabelIPIn=data-provider-master::utility -SmackLabelIPOut=@ Service=data-provider-master.service diff --git a/data/device/wayland.mobile.540x960.conf.ini b/data/device/wayland.mobile.540x960.conf.ini new file mode 100644 index 0000000..d50f449 --- /dev/null +++ b/data/device/wayland.mobile.540x960.conf.ini @@ -0,0 +1,45 @@ +base_width=540 +base_height=960 +minimum_period=1.0 +#script=edje +#default_abi=c +#default_group=disclosure +default_period=-1.0 +default_packet_time=0.0001 +#default_content=default +minimum_space=1048576 +#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 +#db_path=/usr/dbspace/.widget.db +#share_path=/opt/usr/share/live_magazine/ +log_path=/tmp/.widget.service +#always_path=/opt/usr/share/live_magazine/always +#reader_path=/opt/usr/share/live_magazine/reader +#script_port_path=/usr/share/data-provider-master/plugin-script/ +ping_interval=20.0 +slave_max_load=30 +use_sw_backend=false +provider_method=pixmap +debug_mode=false +overwrite_content=false +com_core_thread=true +use_xmonitor=false +input=sec_touchscreen +gbar_request_timeout=5.0 +premultiplied=0 +#emergency_disk=source=tmpfs;type=tmpfs;option=size=6M +services=[widget],[shortcut],[notification],[badge] +auto_align=false +use_event_time=true +use_gettimeofday=false +slave_event_boost_on=-10 +slave_event_boost_off=0 +event_filter=0.5 +#slave_limit_to_ttl=true +#frame_skip=5 diff --git a/data/device/wayland.mobile.540x960.resolution.ini b/data/device/wayland.mobile.540x960.resolution.ini new file mode 100644 index 0000000..31566cf --- /dev/null +++ b/data/device/wayland.mobile.540x960.resolution.ini @@ -0,0 +1,14 @@ +1x1=130x150 +2x1=264x150 +2x2=264x304 +4x1=534x150 +4x2=534x304 +4x3=534x458 +4x4=534x612 +4x5=534x766 +4x6=534x920 +21x21=0x0 +23x21=0x0 +23x23=0x0 +0x0=540x960 +base=540x960 diff --git a/data/device/wayland.mobile.conf.ini b/data/device/wayland.mobile.conf.ini index 84e2f02..6d667e1 100644 --- a/data/device/wayland.mobile.conf.ini +++ b/data/device/wayland.mobile.conf.ini @@ -16,7 +16,7 @@ slave_relaunch_count=3 max_log_line=1000 max_log_file=3 sqilte_flush_max=1048576 -#db_path=/usr/dbspace/.widget.db +db_path=/usr/dbspace/.widget.db #share_path=/opt/usr/share/live_magazine/ log_path=/tmp/.widget.service #always_path=/opt/usr/share/live_magazine/always @@ -32,7 +32,7 @@ com_core_thread=true use_xmonitor=false #input=/dev/input/event2 gbar_request_timeout=5.0 -premultiplied=1 +premultiplied=0 #emergency_disk=source=tmpfs;type=tmpfs;option=size=6M services=[widget],[shortcut],[notification],[badge] #auto_align=true diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 9eb52c4..6349dd7 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -147,8 +147,8 @@ fi # This SYSTEM_UID should be updated properly. # In the SPIN, system user id is 1000 SYSTEM_UID=1000 -APP_UID=5000 -APP_GID=5000 +APP_UID=380 +APP_GID=0 if [ ! -s /usr/dbspace/.widget.db ]; then echo "DB is not exists" @@ -178,21 +178,15 @@ chmod 750 /opt/usr/share/live_magazine/reader chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/always chmod 750 /opt/usr/share/live_magazine/always -chown ${SYSTEM}:${APP_GID} /opt/usr/share/live_magazine/widget.lck +chown ${APP_UID}:${APP_GID} /opt/usr/share/live_magazine/widget.lck chmod 770 /opt/usr/share/live_magazine/widget.lck mv /opt/usr/share/live_magazine/widget.lck /opt/usr/share/live_magazine/.widget.lck -chown ${SYSTEM}:${APP_GID} %{_prefix}/dbspace/.widget.db +chown ${APP_UID}:${APP_GID} %{_prefix}/dbspace/.widget.db chmod 644 %{_prefix}/dbspace/.widget.db -chown ${SYSTEM}:${APP_GID} /opt/dbspace/.widget.db-journal +chown ${APP_UID}:${APP_GID} /opt/dbspace/.widget.db-journal chmod 644 %{_prefix}/dbspace/.widget.db-journal -# SYSTEM_UID? -chown ${APP_UID}:${APP_GID} /usr/dbspace/.widget.db -chmod 640 /usr/dbspace/.widget.db -chown ${APP_UID}:${APP_GID} /usr/dbspace/.widget.db-journal -chmod 640 /usr/dbspace/.widget.db-journal - echo "Successfully installed. Please start a daemon again manually" %files -n %{name} @@ -202,15 +196,15 @@ echo "Successfully installed. Please start a daemon again manually" %{_prefix}/lib/systemd/system/multi-user.target.wants/%{name}.service %{_prefix}/lib/systemd/system/%{name}.service %{_prefix}/lib/systemd/system/%{name}.target -%{_prefix}/bin -#%{_libdir}/systemd/system/%{name}-client.socket -#%{_libdir}/systemd/system/%{name}-provider.socket -#%{_libdir}/systemd/system/%{name}-service.socket -#%{_libdir}/systemd/system/%{name}-badge.socket -#%{_libdir}/systemd/system/%{name}-notification.socket -#%{_libdir}/systemd/system/%{name}-shortcut.socket -#%{_libdir}/systemd/system/%{name}-utility.socket -#%{_libdir}/systemd/system/%{name}-fd.socket +%{_prefix}/bin/%{name} +%{_prefix}/lib/systemd/system/%{name}-client.socket +%{_prefix}/lib/systemd/system/%{name}-provider.socket +%{_prefix}/lib/systemd/system/%{name}-service.socket +%{_prefix}/lib/systemd/system/%{name}-badge.socket +%{_prefix}/lib/systemd/system/%{name}-notification.socket +%{_prefix}/lib/systemd/system/%{name}-shortcut.socket +%{_prefix}/lib/systemd/system/%{name}-utility.socket +%{_prefix}/lib/systemd/system/%{name}-fd.socket %{_datarootdir}/license/* %if 0%{?tizen_build_binary_release_type_eng} /opt/usr/devel/usr/bin/* diff --git a/src/util_wayland.c b/src/util_wayland.c index 7a64e7f..340ad3c 100644 --- a/src/util_wayland.c +++ b/src/util_wayland.c @@ -20,11 +20,22 @@ static struct info { int util_screen_size_get(int *width, int *height) { + int _width; + int _height; + if (!s_info.initialized) { ErrPrint("Not initialized\n"); return WIDGET_ERROR_FAULT; } + if (!width) { + width = &_width; + } + + if (!height) { + height = &_height; + } + ecore_wl_screen_size_get(width, height); return WIDGET_ERROR_NONE; } -- 2.7.4 From a6383037231270380faf6a4a4e69643d849ffc7b Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Fri, 4 Sep 2015 20:32:41 +0900 Subject: [PATCH 12/16] Creates a client session string based on pid and time of creation of client process. Change-Id: Ic42c3fe69e33e625ca67ad88bd7a42928ae5073c Signed-off-by: Kyuho Jo --- CMakeLists.txt | 1 + packaging/data-provider-master.spec | 1 + src/service_common.c | 27 ++++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3645c9f..44504f7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ pkg_check_modules(pkg REQUIRED libtbm capi-appfw-app-manager cynara-client + cynara-session cynara-creds-socket ) diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 6349dd7..97ee029 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -47,6 +47,7 @@ BuildRequires: pkgconfig(shortcut) BuildRequires: pkgconfig(security-server) BuildRequires: pkgconfig(libsystemd-daemon) BuildRequires: pkgconfig(cynara-client) +BuildRequires: pkgconfig(cynara-session) BuildRequires: pkgconfig(cynara-creds-socket) Requires(post): sys-assert diff --git a/src/service_common.c b/src/service_common.c index a19dc00..b113460 100644 --- a/src/service_common.c +++ b/src/service_common.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1296,25 +1297,41 @@ HAPI int service_check_privilege_by_socket_fd(struct service_context *svc_ctx, i int ret = 0; int result = 0; char *uid = NULL; + pid_t pid; char *client_smack = NULL; + char *session = NULL; if (privilege != NULL) { - ret = cynara_creds_socket_get_client(socket_fd, CLIENT_METHOD_SMACK, &client_smack); + ret = cynara_creds_socket_get_client(socket_fd, CLIENT_METHOD_SMACK, &client_smack); if (ret != CYNARA_API_SUCCESS) { ErrPrint("cynara_creds_socket_get_client failed [%d]", ret); goto out; } - ret = cynara_creds_socket_get_user(socket_fd, USER_METHOD_UID, &uid); + ret = cynara_creds_socket_get_user(socket_fd, USER_METHOD_UID, &uid); if (ret != CYNARA_API_SUCCESS) { ErrPrint("cynara_creds_socket_get_user failed [%d]", ret); goto out; } - ret = cynara_check(svc_ctx->cynara_handle, client_smack, "", uid, privilege); + ret = cynara_creds_socket_get_pid(socket_fd, &pid); + + if (ret != CYNARA_API_SUCCESS) { + ErrPrint("cynara_creds_socket_get_pid failed [%d]", ret); + goto out; + } + + session = cynara_session_from_pid(pid); + + if (session == NULL) { + ErrPrint("cynara_session_from_pid failed"); + goto out; + } + + ret = cynara_check(svc_ctx->cynara_handle, client_smack, session, uid, privilege); if (ret == CYNARA_API_ACCESS_ALLOWED) { DbgPrint("[%s] Access allowed.", privilege); @@ -1332,6 +1349,10 @@ out: free(client_smack); } + if (session) { + free(session); + } + if (uid) { free(uid); } -- 2.7.4 From 77e3e9f300172961ce5194f1b59351240164b450 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Wed, 16 Sep 2015 20:31:41 +0900 Subject: [PATCH 13/16] Sync with the latest tizen 2.x Change-Id: I2ea7f782ae483d6d98042a888b2c51d9691e2bbf --- include/package.h | 4 +- include/slave_life.h | 2 +- packaging/data-provider-master.spec | 4 +- pkgmgr_widget/common/include/common.h | 2 +- pkgmgr_widget/common/src/common.c | 166 ++++++++++++++++++++++++++++------ src/instance.c | 8 ++ src/io.c | 3 +- src/package.c | 57 ++++++++---- src/server.c | 10 +- src/shared_fd_service.c | 4 +- src/slave_life.c | 87 ++++++++++-------- src/utility_service.c | 2 +- 12 files changed, 249 insertions(+), 100 deletions(-) diff --git a/include/package.h b/include/package.h index fe6e9c4..bc92e8e 100644 --- a/include/package.h +++ b/include/package.h @@ -89,6 +89,8 @@ extern void package_add_ctx_info(struct pkg_info *pkginfo, struct context_info * extern void package_del_ctx_info(struct pkg_info *pkginfo, struct context_info *info); extern void package_set_direct_input(struct pkg_info *info, int direct_input); extern int package_direct_input(const struct pkg_info *info); +extern void package_set_auto_align(struct pkg_info *info, int auto_align); +extern int package_auto_align(const struct pkg_info *info); extern const char *package_hw_acceleration(struct pkg_info *info); extern int package_set_hw_acceleration(struct pkg_info *info, const char *hw_acceleration); @@ -120,7 +122,7 @@ extern int package_is_enabled(const char *appid); extern int package_faulted(struct pkg_info *info, int broadcast); extern char *package_get_pkgid(const char *appid); -extern int package_instance_count(struct pkg_info *info); +extern int package_instance_count(struct pkg_info *info, int include_deleting); extern char *package_meta_tag(const char *appid, const char *meta_tag); /* End of a file */ diff --git a/include/slave_life.h b/include/slave_life.h index aebc949..1afb032 100644 --- a/include/slave_life.h +++ b/include/slave_life.h @@ -166,7 +166,7 @@ extern int slave_set_pid(struct slave_node *slave, pid_t pid); extern void slave_load_package(struct slave_node *slave); extern void slave_unload_package(struct slave_node *slave); extern int const slave_loaded_package(struct slave_node *slave); -extern struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration); +extern struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration, int auto_align); extern double const slave_ttl(const struct slave_node *slave); diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec index 97ee029..6b94f1f 100644 --- a/packaging/data-provider-master.spec +++ b/packaging/data-provider-master.spec @@ -2,7 +2,7 @@ Name: data-provider-master Summary: Master service provider for widgetes -Version: 1.2.0 +Version: 1.3.0 Release: 1 Group: Applications/Core Applications License: Flora-1.1 @@ -133,7 +133,7 @@ CREATE TABLE groupmap (option_id INTEGER PRIMARY KEY AUTOINCREMENT, id INTEGER, CREATE TABLE i18n ( pkgid TEXT NOT NULL, lang TEXT COLLATE NOCASE, name TEXT, icon TEXT, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE); CREATE TABLE option ( pkgid TEXT NOT NULL, option_id INTEGER, key TEXT NOT NULL, value TEXT NOT NULL, FOREIGN KEY(option_id) REFERENCES groupmap(option_id), FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE); CREATE TABLE pkgmap ( pkgid TEXT PRIMARY KEY NOT NULL, appid TEXT, uiapp TEXT, prime INTEGER, category TEXT DEFAULT 'http://tizen.org/category/default' ); -CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type INTEGER, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT '', FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE); +CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type INTEGER, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT '', auto_align INTEGER DEFAULT 0, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE); EOF %pre diff --git a/pkgmgr_widget/common/include/common.h b/pkgmgr_widget/common/include/common.h index 9c2441a..ab23b11 100644 --- a/pkgmgr_widget/common/include/common.h +++ b/pkgmgr_widget/common/include/common.h @@ -38,7 +38,7 @@ #define ErrPrintWithConsole(format, arg...) do { fprintf(stderr, "[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); SECURE_LOGE("[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); } while (0) #endif -#define CUR_VER 5 +#define CUR_VER 6 #define DEFAULT_CATEGORY "http://tizen.org/category/default" extern int begin_transaction(void); diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index 37aa3bc..7dd623e 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -42,8 +42,6 @@ #define ErrPrintWithConsole(format, arg...) do { fprintf(stderr, "[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); SECURE_LOGE("[%s/%s:%d] " format, basename(__FILE__), __func__, __LINE__, ##arg); } while (0) #endif -#define CUR_VER 5 -#define DEFAULT_CATEGORY "http://tizen.org/category/default" #define SCHEME_HTTP "http://" #define SCHEME_HTTPS "https://" #define SCHEME_FILE "file://" @@ -75,12 +73,12 @@ * * * provider - * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+ - * | pkgid | network | abi | secured | box_type | box_src | box_group | gbar_type | gbar_src | gbar_group | libexec | timeout | period | script | pinup | count(from ver 4) | direct_input | hw_acceleration | - * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+-------|---------------| - * | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - * +-------+---------+-----+---------+----------+---------+-----------+---------+--------+----------+---------+---------+--------+--------+-------+-----------------------+-------|---------------| - * CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type TEXT, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid)) + * +-------+---------+-----+---------+----------+---------+-----------+-----------+----------+------------+---------+---------+--------+--------+-------+-------------------+--------------+-----------------+------------+ + * | pkgid | network | abi | secured | box_type | box_src | box_group | gbar_type | gbar_src | gbar_group | libexec | timeout | period | script | pinup | count(from ver 4) | direct_input | hw_acceleration | auto_align | + * +-------+---------+-----+---------+----------+---------+-----------+-----------+----------+------------+---------+---------+--------+--------+-------+-------------------+--------------|-----------------+------------+ + * | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | + * +-------+---------+-----+---------+----------+---------+-----------+-----------+----------+------------+---------+---------+--------+--------+-------+-------------------+--------------|-----------------+------------+ + * CREATE TABLE provider ( pkgid TEXT PRIMARY KEY NOT NULL, network INTEGER, abi TEXT, secured INTEGER, box_type INTEGER, box_src TEXT, box_group TEXT, gbar_type TEXT, gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', auto_align INTEGER DEFAULT 0, FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid)) * * = box_type = { text | buffer | script | image } * = gbar_type = { text | buffer | script } @@ -201,6 +199,7 @@ struct widget { xmlChar *gbar_group; xmlChar *gbar_size; /* Default PD size */ xmlChar *hw_acceleration; + int auto_align; struct dlist *i18n_list; struct dlist *group_list; @@ -222,7 +221,7 @@ static struct { const char *dbfile; sqlite3 *handle; } s_info = { - .dbfile = "/usr/dbspace/.widget.db", + .dbfile = "/opt/dbspace/.widget.db", .handle = NULL, }; @@ -323,7 +322,7 @@ static inline void abspath(const char* pBuffer, char* pRet) static inline xmlChar *abspath_strdup(xmlChar *src) { - return xmlMalloc(xmlStrlen(src) + 2); + return xmlMalloc(xmlStrlen(src) + 3); } int begin_transaction(void) @@ -560,6 +559,32 @@ static void upgrade_to_version_5(void) } } +/** + * From version 5 to 6 + * "provider" table should have "auto_align" column. + * "auto_align" will be used for selecting engine for rendering of widget window. + * If it is "true", the widget will creates auto-alignment enabled window buffer. + */ +static void upgrade_to_version_6(void) +{ + char *err; + static const char *ddl; + + /** + * Step 1 + * Create a new column "auto_align" for provider table + */ + ddl = "ALTER TABLE provider ADD COLUMN auto_align INTEGER DEFAULT 0"; + if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { + ErrPrint("Failed to execute the DDL (%s)\n", err); + return; + } + + if (sqlite3_changes(s_info.handle) == 0) { + ErrPrint("No chages to DB\n"); + } +} + /*! * \note * From version 3 to 4 @@ -721,6 +746,8 @@ void db_upgrade_db_schema(void) upgrade_to_version_4(); case 4: upgrade_to_version_5(); + case 5: + upgrade_to_version_6(); default: /* Need to update version */ DbgPrint("Old version: %d\n", version); @@ -854,7 +881,7 @@ static inline int db_create_provider(void) "abi TEXT, secured INTEGER, box_type INTEGER, " \ "box_src TEXT, box_group TEXT, gbar_type INTEGER, " \ "gbar_src TEXT, gbar_group TEXT, libexec TEXT, timeout INTEGER, period TEXT, script TEXT, pinup INTEGER, "\ - "count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', "\ + "count INTEGER, direct_input INTEGER DEFAULT 0, hw_acceleration TEXT DEFAULT 'none', auto_align INTEGER DEFAULT 0, "\ "FOREIGN KEY(pkgid) REFERENCES pkgmap(pkgid) ON DELETE CASCADE)"; if (sqlite3_exec(s_info.handle, ddl, NULL, NULL, &err) != SQLITE_OK) { @@ -917,6 +944,7 @@ static int db_insert_provider(struct widget *widget) char *period = (char *)widget->period; char *script = (char *)widget->script; char *hw_acceleration = (char *)widget->hw_acceleration; + int auto_align = widget->auto_align; if (!abi) { abi = "c"; @@ -938,7 +966,7 @@ static int db_insert_provider(struct widget *widget) hw_acceleration = "none"; } - dml = "INSERT INTO provider ( pkgid, network, abi, secured, box_type, box_src, box_group, gbar_type, gbar_src, gbar_group, libexec, timeout, period, script, pinup, count, direct_input, hw_acceleration) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + dml = "INSERT INTO provider ( pkgid, network, abi, secured, box_type, box_src, box_group, gbar_type, gbar_src, gbar_group, libexec, timeout, period, script, pinup, count, direct_input, hw_acceleration, auto_align) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; ret = sqlite3_prepare_v2(s_info.handle, dml, -1, &stmt, NULL); if (ret != SQLITE_OK) { ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle)); @@ -1070,6 +1098,13 @@ static int db_insert_provider(struct widget *widget) goto out; } + ret = sqlite3_bind_int(stmt, 19, auto_align); + if (ret != SQLITE_OK) { + ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle)); + ret = -EIO; + goto out; + } + ret = 0; if (sqlite3_step(stmt) != SQLITE_DONE) { ErrPrintWithConsole("Error: %s\n", sqlite3_errmsg(s_info.handle)); @@ -2323,7 +2358,17 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node) } } - if (xmlHasProp(node, (const xmlChar *)"need_frame")) { + if (xmlHasProp(node, (const xmlChar *)"need-frame")) { + xmlChar *need_frame; + + need_frame = xmlGetProp(node, (const xmlChar *)"need-frame"); + if (need_frame) { + widget->need_frame[idx] = !xmlStrcasecmp(need_frame, (const xmlChar *)"true"); + xmlFree(need_frame); + } else { + widget->need_frame[idx] = widget->default_need_frame; + } + } else if (xmlHasProp(node, (const xmlChar *)"need_frame")) { xmlChar *need_frame; need_frame = xmlGetProp(node, (const xmlChar *)"need_frame"); @@ -2337,7 +2382,18 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node) widget->need_frame[idx] = widget->default_need_frame; } - if (xmlHasProp(node, (const xmlChar *)"touch_effect")) { + + if (xmlHasProp(node, (const xmlChar *)"touch-effect")) { + xmlChar *touch_effect; + + touch_effect = xmlGetProp(node, (const xmlChar *)"touch-effect"); + if (touch_effect) { + widget->touch_effect[idx] = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true"); + xmlFree(touch_effect); + } else { + widget->touch_effect[idx] = widget->default_touch_effect; + } + } else if (xmlHasProp(node, (const xmlChar *)"touch_effect")) { xmlChar *touch_effect; touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect"); @@ -2351,7 +2407,17 @@ static void update_size_info(struct widget *widget, int idx, xmlNodePtr node) widget->touch_effect[idx] = widget->default_touch_effect; } - if (xmlHasProp(node, (const xmlChar *)"mouse_event")) { + if (xmlHasProp(node, (const xmlChar *)"mouse-event")) { + xmlChar *mouse_event; + + mouse_event = xmlGetProp(node, (const xmlChar *)"mouse-event"); + if (mouse_event) { + widget->mouse_event[idx] = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true"); + xmlFree(mouse_event); + } else { + widget->mouse_event[idx] = widget->default_mouse_event; + } + } else if (xmlHasProp(node, (const xmlChar *)"mouse_event")) { xmlChar *mouse_event; mouse_event = xmlGetProp(node, (const xmlChar *)"mouse_event"); @@ -2484,9 +2550,25 @@ static void update_box(struct widget *widget, xmlNodePtr node) } } - if (!xmlHasProp(node, (const xmlChar *)"mouse_event")) { - widget->default_mouse_event = 0; - } else { + /** + * @note + * mouse_event is internal style name of attribute. + * It should be replaced with "mouse-event" for public one. + * But we should keep the old style also. + * Try to find "mouse_event" first and if it fails, try to find "mouse-event" + */ + if (xmlHasProp(node, (const xmlChar *)"mouse-event")) { + xmlChar *mouse_event; + + mouse_event = xmlGetProp(node, (const xmlChar *)"mouse-event"); + if (!mouse_event) { + ErrPrint("mouse_event is NIL\n"); + widget->default_mouse_event = 0; + } else { + widget->default_mouse_event = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true"); + xmlFree(mouse_event); + } + } else if (xmlHasProp(node, (const xmlChar *)"mouse_event")) { xmlChar *mouse_event; mouse_event = xmlGetProp(node, (const xmlChar *)"mouse_event"); @@ -2497,11 +2579,22 @@ static void update_box(struct widget *widget, xmlNodePtr node) widget->default_mouse_event = !xmlStrcasecmp(mouse_event, (const xmlChar *)"true"); xmlFree(mouse_event); } + } else { + widget->default_mouse_event = 0; } - if (!xmlHasProp(node, (const xmlChar *)"touch_effect")) { - widget->default_touch_effect = 0; - } else { + if (xmlHasProp(node, (const xmlChar *)"touch-effect")) { + xmlChar *touch_effect; + + touch_effect = xmlGetProp(node, (const xmlChar *)"touch-effect"); + if (!touch_effect) { + ErrPrint("default touch_effect is NIL\n"); + widget->default_touch_effect = 0; + } else { + widget->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true"); + xmlFree(touch_effect); + } + } else if (xmlHasProp(node, (const xmlChar *)"touch_effect")) { xmlChar *touch_effect; touch_effect = xmlGetProp(node, (const xmlChar *)"touch_effect"); @@ -2512,11 +2605,22 @@ static void update_box(struct widget *widget, xmlNodePtr node) widget->default_touch_effect = !xmlStrcasecmp(touch_effect, (const xmlChar *)"true"); xmlFree(touch_effect); } + } else { + widget->default_touch_effect = 0; } - if (!xmlHasProp(node, (const xmlChar *)"need_frame")) { - widget->default_need_frame = 0; - } else { + if (xmlHasProp(node, (const xmlChar *)"need-frame")) { + xmlChar *need_frame; + + need_frame = xmlGetProp(node, (const xmlChar *)"need-frame"); + if (!need_frame) { + ErrPrint("default need_frame is NIL\n"); + widget->default_need_frame = 0; + } else { + widget->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true"); + xmlFree(need_frame); + } + } else if (xmlHasProp(node, (const xmlChar *)"need_frame")) { xmlChar *need_frame; need_frame = xmlGetProp(node, (const xmlChar *)"need_frame"); @@ -2527,6 +2631,8 @@ static void update_box(struct widget *widget, xmlNodePtr node) widget->default_need_frame = !xmlStrcasecmp(need_frame, (const xmlChar *)"true"); xmlFree(need_frame); } + } else { + widget->default_need_frame = 0; } for (node = node->children; node; node = node->next) { @@ -3077,16 +3183,11 @@ static int has_meta_tag(const char *appid, const char *meta_tag) return 0; } - /** - * @todo - * Need to find a replacement of this API - * ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); if (ret != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } - */ ret = value && value[0] != '\0'; @@ -3216,6 +3317,12 @@ int db_install_widget(xmlNodePtr node, const char *appid) } } + if (xmlHasProp(node, (const xmlChar *)"auto-align")) { + tmp = xmlGetProp(node, (const xmlChar *)"auto-align"); + widget->auto_align = tmp && !xmlStrcasecmp(tmp, (const xmlChar *)"true"); + xmlFree(tmp); + } + if (xmlHasProp(node, (const xmlChar *)"abi")) { widget->abi = xmlGetProp(node, (const xmlChar *)"abi"); if (!widget->abi) { @@ -3477,6 +3584,7 @@ int db_install_watchapp(xmlNodePtr node, const char *appid) widget->default_touch_effect = 0; widget->default_need_frame = 0; widget->size_list = WIDGET_SIZE_TYPE_2x2; + widget->auto_align = 0; /** * @note diff --git a/src/instance.c b/src/instance.c index d9e0d0b..c1498ca 100644 --- a/src/instance.c +++ b/src/instance.c @@ -1139,6 +1139,14 @@ HAPI struct packet *instance_duplicate_packet_create(const struct packet *packet inst->state = INST_ACTIVATED; + if (inst->requested_state == INST_DESTROYED) { + /** + * In this case, we should destroy the instance. + */ + DbgPrint("Destroy Instance\n"); + instance_destroy(inst, WIDGET_DESTROY_TYPE_DEFAULT); + } + instance_create_widget_buffer(inst, WIDGET_CONF_DEFAULT_PIXELS); instance_broadcast_created_event(inst); instance_thaw_updator(inst); diff --git a/src/io.c b/src/io.c index 9f59fdd..d5316d4 100644 --- a/src/io.c +++ b/src/io.c @@ -100,7 +100,7 @@ static inline int build_client_info(struct pkg_info *info) static inline int build_provider_info(struct pkg_info *info) { - static const char *dml = "SELECT provider.network, provider.abi, provider.secured, provider.box_type, provider.box_src, provider.box_group, provider.gbar_type, provider.gbar_src, provider.gbar_group, provider.libexec, provider.timeout, provider.period, provider.script, provider.pinup, pkgmap.appid, provider.direct_input, provider.hw_acceleration, pkgmap.category FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?"; + static const char *dml = "SELECT provider.network, provider.abi, provider.secured, provider.box_type, provider.box_src, provider.box_group, provider.gbar_type, provider.gbar_src, provider.gbar_group, provider.libexec, provider.timeout, provider.period, provider.script, provider.pinup, pkgmap.appid, provider.direct_input, provider.hw_acceleration, pkgmap.category, provider.auto_align FROM provider, pkgmap WHERE pkgmap.pkgid = ? AND provider.pkgid = ?"; sqlite3_stmt *stmt; int ret; const char *tmp; @@ -192,6 +192,7 @@ static inline int build_provider_info(struct pkg_info *info) package_set_direct_input(info, sqlite3_column_int(stmt, 15)); package_set_hw_acceleration(info, (const char *)sqlite3_column_text(stmt, 16)); package_set_category(info, (const char *)sqlite3_column_text(stmt, 17)); + package_set_auto_align(info, sqlite3_column_int(stmt, 18)); sqlite3_reset(stmt); sqlite3_clear_bindings(stmt); diff --git a/src/package.c b/src/package.c index e064d22..63e2b61 100644 --- a/src/package.c +++ b/src/package.c @@ -114,9 +114,6 @@ struct pkg_info { unsigned int height; } gbar; - int network; - int secured; - int direct_input; char *script; /* script type: edje, ... */ char *abi; char *hw_acceleration; @@ -132,7 +129,18 @@ struct pkg_info { Eina_List *inst_list; Eina_List *ctx_list; - int is_uninstalled; + union _pkg_flags { + struct _pkg_field { + unsigned int network: 1; + unsigned int secured: 1; + unsigned int direct_input: 1; + unsigned int auto_align: 1; + unsigned int is_uninstalled: 1; + + unsigned int reserved: 27; + } field; + unsigned int mask; + } flags; }; static struct { @@ -464,7 +472,7 @@ static inline int load_conf(struct pkg_info *info) } info->widget.timeout = parser_timeout(parser); - info->network = parser_network(parser); + info->flags.field.network = parser_network(parser); info->widget.period = parser_period(parser); if (info->widget.period < 0.0f) { @@ -495,7 +503,7 @@ static inline int load_conf(struct pkg_info *info) return WIDGET_ERROR_OUT_OF_MEMORY; } - info->secured = parser_secured(parser); + info->flags.field.secured = parser_secured(parser); info->widget.pinup = parser_pinup(parser); parser_get_gbar_size(parser, &info->gbar.width, &info->gbar.height); @@ -801,12 +809,12 @@ HAPI void package_set_period(struct pkg_info *info, double period) HAPI const int const package_secured(const struct pkg_info *info) { - return info->secured; + return info->flags.field.secured; } HAPI void package_set_secured(struct pkg_info *info, int secured) { - info->secured = secured; + info->flags.field.secured = secured; } HAPI const char * const package_script(const struct pkg_info *info) @@ -1077,22 +1085,32 @@ HAPI int package_set_libexec(struct pkg_info *info, const char *libexec) HAPI int package_network(struct pkg_info *info) { - return info->network; + return info->flags.field.network; } HAPI void package_set_network(struct pkg_info *info, int network) { - info->network = network; + info->flags.field.network = network; } HAPI void package_set_direct_input(struct pkg_info *info, int direct_input) { - info->direct_input = direct_input; + info->flags.field.direct_input = direct_input; } HAPI int package_direct_input(const struct pkg_info *info) { - return info->direct_input; + return info->flags.field.direct_input; +} + +HAPI void package_set_auto_align(struct pkg_info *info, int auto_align) +{ + info->flags.field.auto_align = auto_align; +} + +HAPI int package_auto_align(const struct pkg_info *info) +{ + return info->flags.field.auto_align; } HAPI const enum widget_gbar_type const package_gbar_type(const struct pkg_info *info) @@ -1170,7 +1188,7 @@ static inline int assign_new_slave(const char *slave_pkgname, struct pkg_info *i } DbgPrint("New slave[%s] is assigned for %s (using %s / abi[%s] / accel[%s]\n", s_name, info->widget_id, slave_pkgname, info->abi, info->hw_acceleration); - info->slave = slave_create(s_name, info->secured, info->abi, slave_pkgname, info->network, info->hw_acceleration); + info->slave = slave_create(s_name, info->flags.field.secured, info->abi, slave_pkgname, info->flags.field.network, info->hw_acceleration); DbgFree(s_name); if (!info->slave) { /*! @@ -1209,7 +1227,7 @@ HAPI int package_add_instance(struct pkg_info *info, struct inst_info *inst) return WIDGET_ERROR_OUT_OF_MEMORY; } - info->slave = slave_find_available(slave_pkgname, info->abi, info->secured, info->network, info->hw_acceleration); + info->slave = slave_find_available(slave_pkgname, info->abi, info->flags.field.secured, info->flags.field.network, info->hw_acceleration, info->flags.field.auto_align); if (!info->slave) { int ret; @@ -1229,7 +1247,7 @@ HAPI int package_add_instance(struct pkg_info *info, struct inst_info *inst) (void)slave_event_callback_add(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info); (void)slave_event_callback_add(info->slave, SLAVE_EVENT_FAULT, slave_fault_cb, info); - if (info->secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) { + if (info->flags.field.secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) { (void)slave_event_callback_add(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info); (void)slave_event_callback_add(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info); @@ -1265,7 +1283,7 @@ HAPI int package_del_instance(struct pkg_info *info, struct inst_info *inst) slave_event_callback_del(info->slave, SLAVE_EVENT_DEACTIVATE, slave_deactivated_cb, info); slave_event_callback_del(info->slave, SLAVE_EVENT_ACTIVATE, slave_activated_cb, info); - if (info->secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) { + if (info->flags.field.secured || (WIDGET_IS_INHOUSE(package_abi(info)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) { slave_event_callback_del(info->slave, SLAVE_EVENT_PAUSE, slave_paused_cb, info); slave_event_callback_del(info->slave, SLAVE_EVENT_RESUME, slave_resumed_cb, info); @@ -1277,7 +1295,7 @@ HAPI int package_del_instance(struct pkg_info *info, struct inst_info *inst) info->slave = NULL; } - if (info->is_uninstalled) { + if (info->flags.field.is_uninstalled) { package_destroy(info); } @@ -1352,7 +1370,7 @@ static int io_uninstall_cb(const char *pkgid, const char *widget_id, int prime, return 0; } - info->is_uninstalled = 1; + info->flags.field.is_uninstalled = 1; /*! * \NOTE @@ -1710,7 +1728,7 @@ HAPI int const package_fault_count(struct pkg_info *info) return info ? info->fault_count : 0; } -HAPI int package_instance_count(struct pkg_info *info) +HAPI int package_instance_count(struct pkg_info *info, int include_deleting) { Eina_List *l; struct inst_info *inst; @@ -1726,6 +1744,7 @@ HAPI int package_instance_count(struct pkg_info *info) break; case INST_DESTROYED: case INST_REQUEST_TO_DESTROY: + count += !!include_deleting; default: break; } diff --git a/src/server.c b/src/server.c index b8916e6..6e7684f 100644 --- a/src/server.c +++ b/src/server.c @@ -1458,8 +1458,8 @@ static struct packet *client_new(pid_t pid, int handle, const struct packet *pac } else if (util_free_space(WIDGET_CONF_IMAGE_PATH) <= WIDGET_CONF_MINIMUM_SPACE) { ErrPrint("Not enough space\n"); ret = WIDGET_ERROR_FILE_NO_SPACE_ON_DEVICE; - } else if (max_count && max_count <= package_instance_count(info)) { - ErrPrint("Reached to the max count of widgets %d, %d\n", max_count, package_instance_count(info)); + } else if (max_count && max_count <= package_instance_count(info, 1)) { + ErrPrint("Reached to the max count of widgets %d, %d\n", max_count, package_instance_count(info, 1)); ret = WIDGET_ERROR_CANCELED; } else { struct inst_info *inst; @@ -9956,17 +9956,17 @@ HAPI int server_init(void) ErrPrint("Failed to create a info socket\n"); } - s_info.slave_fd = com_core_packet_server_init_with_permission(SLAVE_SOCKET, s_slave_table, NULL); + s_info.slave_fd = com_core_packet_server_init_with_permission("sdlocal://"SLAVE_SOCKET, s_slave_table, NULL); if (s_info.slave_fd < 0) { ErrPrint("Failed to create a slave socket\n"); } - s_info.client_fd = com_core_packet_server_init_with_permission(CLIENT_SOCKET, s_client_table, NULL); + s_info.client_fd = com_core_packet_server_init_with_permission("sdlocal://"CLIENT_SOCKET, s_client_table, NULL); if (s_info.client_fd < 0) { ErrPrint("Failed to create a client socket\n"); } - s_info.service_fd = com_core_packet_server_init_with_permission(SERVICE_SOCKET, s_service_table, NULL); + s_info.service_fd = com_core_packet_server_init_with_permission("sdlocal://"SERVICE_SOCKET, s_service_table, NULL); if (s_info.service_fd < 0) { ErrPrint("Faild to create a service socket\n"); } diff --git a/src/shared_fd_service.c b/src/shared_fd_service.c index e2d16b5..d153882 100644 --- a/src/shared_fd_service.c +++ b/src/shared_fd_service.c @@ -132,9 +132,9 @@ HAPI int shared_fd_service_init(void) * 4. Send accepted FD to provider via result packet. * 5. Provider will send a packet to the viewer via that FD. */ - s_info.fd = com_core_packet_server_init(SHARED_SOCKET, s_table); + s_info.fd = com_core_packet_server_init("sdlocal://"SHARED_SOCKET, s_table); if (s_info.fd < 0) { - ErrPrint("Failed to make a server for %s\n", SHARED_SOCKET); + ErrPrint("Failed to make a server for %s\n", "sdlocal://"SHARED_SOCKET); } return WIDGET_ERROR_NONE; diff --git a/src/slave_life.c b/src/slave_life.c index 9284afa..d5b24a8 100644 --- a/src/slave_life.c +++ b/src/slave_life.c @@ -68,18 +68,29 @@ struct slave_node { char *name; char *abi; char *pkgname; - int secured; /* Only A package(widget) is loaded for security requirements */ int refcnt; int fault_count; int critical_fault_count; enum slave_state state; - int network; int loaded_instance; int loaded_package; - int reactivate_instances; - int reactivate_slave; + union _slave_flags { + struct _slave_fields { + unsigned int reactivate_instances: 1; + unsigned int reactivate_slave: 1; + unsigned int secured: 1; /* Only A package(widget) is loaded for security requirements */ + unsigned int network: 1; + unsigned int auto_align: 1; + unsigned int valid: 1; + unsigned int is_watch: 1; /*!< Specialized field. Only for the WATCH */ + unsigned int wait_deactivation: 1; + + unsigned int reserved: 24; + } field; + unsigned int mask; + } flags; pid_t pid; @@ -116,19 +127,14 @@ struct slave_node { #endif char *hw_acceleration; - int valid; char *extra_bundle_data; - int is_watch; /*!< Specialized field. Only for the WATCH */ - struct _resource { struct _memory { unsigned int soft; unsigned int hard; } memory; } resources; - - int wait_deactivation; }; struct event { @@ -235,7 +241,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 (!slave->extra_bundle_data && ((!no_timer && !slave->secured) || slave_is_app(slave)) && (!slave_is_watch(slave) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f)) { + } else if (!slave->extra_bundle_data && ((!no_timer && !slave->flags.field.secured) || slave_is_app(slave)) && (!slave_is_watch(slave) && WIDGET_CONF_SLAVE_TERMINATE_TIME > 0.0f)) { DbgPrint("Fire the terminate timer: %d (%d)\n", slave->pid, slave_is_app(slave)); slave->terminate_timer = ecore_timer_add(WIDGET_CONF_SLAVE_TERMINATE_TIME, terminate_timer_cb, slave); if (!slave->terminate_timer) { @@ -395,10 +401,10 @@ static inline struct slave_node *create_slave_node(const char *name, int is_secu } } - slave->secured = is_secured; + slave->flags.field.secured = is_secured; slave->pid = (pid_t)-1; slave->state = SLAVE_TERMINATED; - slave->network = network; + slave->flags.field.network = network; slave->relaunch_count = WIDGET_CONF_SLAVE_RELAUNCH_COUNT; xmonitor_add_event_callback(XMONITOR_PAUSED, xmonitor_pause_cb, slave); @@ -505,7 +511,7 @@ HAPI int slave_expired_ttl(struct slave_node *slave) } if (!slave_is_app(slave) - && !slave->secured + && !slave->flags.field.secured && !(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL)) { return 0; @@ -555,7 +561,7 @@ HAPI struct slave_node *slave_create(const char *name, int is_secured, const cha slave = find_slave(name); if (slave) { - if (slave->secured != is_secured) { + if (slave->flags.field.secured != is_secured) { ErrPrint("Exists slave and creating slave's security flag is not matched\n"); } return slave; @@ -748,6 +754,7 @@ static bundle *create_slave_param(struct slave_node *slave) bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_SECURED, ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave_is_secured(slave)) ? "true" : "false"); bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_ABI, slave_abi(slave)); bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_HW_ACCELERATION, slave->hw_acceleration); + bundle_add_str(param, WIDGET_CONF_BUNDLE_SLAVE_AUTO_ALIGN, slave->flags.field.auto_align ? "true" : "false"); } else { ErrPrint("Failed to create a bundle\n"); } @@ -882,7 +889,7 @@ HAPI int slave_activate(struct slave_node *slave) } if (WIDGET_CONF_DEBUG_MODE || g_conf.debug_mode) { - DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->secured, slave->abi); + DbgPrint("Debug Mode enabled. name[%s] secured[%d] abi[%s]\n", slave_name(slave), slave->flags.field.secured, slave->abi); } else { bundle *param; @@ -958,7 +965,7 @@ HAPI int slave_give_more_ttl(struct slave_node *slave) double delay; if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) - && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer)) + && ((!slave_is_app(slave) && !slave->flags.field.secured) || !slave->ttl_timer)) { return WIDGET_ERROR_INVALID_PARAMETER; } @@ -976,7 +983,7 @@ HAPI int slave_give_more_ttl(struct slave_node *slave) HAPI int slave_freeze_ttl(struct slave_node *slave) { if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) - && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer)) + && ((!slave_is_app(slave) && !slave->flags.field.secured) || !slave->ttl_timer)) { return WIDGET_ERROR_INVALID_PARAMETER; } @@ -990,7 +997,7 @@ HAPI int slave_thaw_ttl(struct slave_node *slave) double delay; if (!(WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) - && ((!slave_is_app(slave) && !slave->secured) || !slave->ttl_timer)) + && ((!slave_is_app(slave) && !slave->flags.field.secured) || !slave->ttl_timer)) { return WIDGET_ERROR_INVALID_PARAMETER; } @@ -1023,7 +1030,7 @@ HAPI int slave_activated(struct slave_node *slave) */ if (!slave->extra_bundle_data /* Launched by SDK Viewer */ && !slave_is_watch(slave) /* Not a watch */ - && ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->secured == 1 || slave_is_app(slave)) + && ((WIDGET_IS_INHOUSE(slave_abi(slave)) && WIDGET_CONF_SLAVE_LIMIT_TO_TTL) || slave->flags.field.secured == 1 || slave_is_app(slave)) && WIDGET_CONF_SLAVE_TTL > 0.0f) { DbgPrint("Slave deactivation timer is added (%s - %lf)\n", slave_name(slave), WIDGET_CONF_SLAVE_TTL); @@ -1532,13 +1539,13 @@ HAPI struct slave_node *slave_find_by_name(const char *name) return NULL; } -HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration) +HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const char *abi, int secured, int network, const char *hw_acceleration, int auto_align) { Eina_List *l; struct slave_node *slave; EINA_LIST_FOREACH(s_info.slave_list, l, slave) { - if (slave->secured != secured) { + if (slave->flags.field.secured != secured) { continue; } @@ -1569,13 +1576,17 @@ HAPI struct slave_node *slave_find_available(const char *slave_pkgname, const ch } } - if (slave->secured) { + if (slave->flags.field.auto_align != auto_align) { + continue; + } + + if (slave->flags.field.secured) { if (slave->loaded_package == 0) { DbgPrint("Found secured slave - has no instances (%s)\n", slave_name(slave)); return slave; } - } else if (slave->network == network) { - DbgPrint("slave[%s] loaded_package[%d] net: [%d]\n", slave_name(slave), slave->loaded_package, slave->network); + } else if (slave->flags.field.network == network) { + DbgPrint("slave[%s] loaded_package[%d] net: [%d]\n", slave_name(slave), slave->loaded_package, slave->flags.field.network); if (!strcasecmp(abi, WIDGET_CONF_DEFAULT_ABI)) { int max_load; if (g_conf.slave_max_load < 0) { @@ -1720,7 +1731,7 @@ HAPI struct slave_node *slave_unload_instance(struct slave_node *slave) HAPI const int const slave_is_secured(const struct slave_node *slave) { - return slave->secured; + return slave->flags.field.secured; } HAPI const int const slave_is_app(const struct slave_node *slave) @@ -1969,17 +1980,17 @@ HAPI double const slave_ttl(const struct slave_node *slave) HAPI void slave_set_reactivate_instances(struct slave_node *slave, int reactivate) { - slave->reactivate_instances = reactivate; + slave->flags.field.reactivate_instances = !!reactivate; } HAPI int slave_need_to_reactivate_instances(struct slave_node *slave) { - return slave->reactivate_instances; + return slave->flags.field.reactivate_instances; } HAPI void slave_set_reactivation(struct slave_node *slave, int flag) { - slave->reactivate_slave = flag; + slave->flags.field.reactivate_slave = flag; } HAPI int slave_need_to_reactivate(struct slave_node *slave) @@ -2028,17 +2039,17 @@ HAPI int slave_need_to_reactivate(struct slave_node *slave) reactivate = 1; } - return reactivate && slave->reactivate_slave; + return reactivate && slave->flags.field.reactivate_slave; } HAPI int slave_network(const struct slave_node *slave) { - return slave->network; + return slave->flags.field.network; } HAPI void slave_set_network(struct slave_node *slave, int network) { - slave->network = network; + slave->flags.field.network = network; } HAPI int slave_deactivate_all(int reactivate, int reactivate_instances, int no_timer) @@ -2148,17 +2159,17 @@ HAPI int slave_priority(struct slave_node *slave) HAPI int slave_valid(const struct slave_node *slave) { - if (!slave->valid) { + if (!slave->flags.field.valid) { DbgPrint("slave is invalid"); } - return slave->valid; + return slave->flags.field.valid; } HAPI void slave_set_valid(struct slave_node *slave) { DbgPrint("slave is set valid\n"); - slave->valid = 1; + slave->flags.field.valid = 1; } HAPI void slave_set_extra_bundle_data(struct slave_node *slave, const char *extra_bundle_data) @@ -2188,7 +2199,7 @@ HAPI const char *slave_extra_bundle_data(struct slave_node *slave) HAPI int slave_is_watch(struct slave_node *slave) { - return slave ? slave->is_watch : 0; + return slave ? slave->flags.field.is_watch : 0; } HAPI void slave_set_is_watch(struct slave_node *slave, int flag) @@ -2197,7 +2208,7 @@ HAPI void slave_set_is_watch(struct slave_node *slave, int flag) return; } - slave->is_watch = flag; + slave->flags.field.is_watch = flag; } HAPI int slave_set_resource_limit(struct slave_node *slave, unsigned int soft, unsigned int hard) @@ -2236,12 +2247,12 @@ HAPI int slave_get_resource_limit(struct slave_node *slave, unsigned int *soft, HAPI void slave_set_wait_deactivation(struct slave_node *slave, int wait) { - slave->wait_deactivation = !!wait; + slave->flags.field.wait_deactivation = !!wait; } HAPI int slave_wait_deactivation(struct slave_node *slave) { - return slave->wait_deactivation; + return slave->flags.field.wait_deactivation; } /* End of a file */ diff --git a/src/utility_service.c b/src/utility_service.c index e893eab..e861f5b 100644 --- a/src/utility_service.c +++ b/src/utility_service.c @@ -409,7 +409,7 @@ int utility_service_init(void) return WIDGET_ERROR_ALREADY_STARTED; } - s_info.svc_ctx = service_common_create(UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL); + s_info.svc_ctx = service_common_create("sdlocal://"UTILITY_SOCKET, UTILITY_SMACK_LABEL, service_thread_main, NULL); if (!s_info.svc_ctx) { ErrPrint("Unable to activate service thread\n"); return WIDGET_ERROR_FAULT; -- 2.7.4 From 00c9eb3e434911597a9d33e0d7b434d5fb7a3e22 Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Wed, 16 Sep 2015 21:33:47 +0900 Subject: [PATCH 14/16] Comment out unsupported function call Change-Id: I3ea1779d9437f455e35c81c511b2f241aeaa647c --- pkgmgr_widget/common/src/common.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgmgr_widget/common/src/common.c b/pkgmgr_widget/common/src/common.c index 7dd623e..4a2ed29 100644 --- a/pkgmgr_widget/common/src/common.c +++ b/pkgmgr_widget/common/src/common.c @@ -3183,11 +3183,14 @@ static int has_meta_tag(const char *appid, const char *meta_tag) return 0; } + /* + * @note, not supported by 3.0 yet ret = pkgmgrinfo_appinfo_get_metadata_value(handle, meta_tag, &value); if (ret != PMINFO_R_OK) { pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } + */ ret = value && value[0] != '\0'; -- 2.7.4 From c60190fc706be34baab79cbf7937b585db135b83 Mon Sep 17 00:00:00 2001 From: Kyuho Jo Date: Wed, 16 Sep 2015 22:14:52 +0900 Subject: [PATCH 15/16] Fix a build error on 32 bit. Change-Id: I46a1e6fe2dd017e5b00a6246684e1dd6cbb49e91 Signed-off-by: Kyuho Jo --- src/buffer_handler_wayland.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buffer_handler_wayland.c b/src/buffer_handler_wayland.c index a8dcb99..05eae87 100644 --- a/src/buffer_handler_wayland.c +++ b/src/buffer_handler_wayland.c @@ -1072,7 +1072,7 @@ static inline widget_fb_t raw_open_file(const char *filename) buffer->state = WIDGET_FB_STATE_CREATED; buffer->type = WIDGET_FB_TYPE_FILE; buffer->refcnt = 0; - buffer->info = (void *)off; + buffer->info = (void *)((long)off); ret = read(fd, buffer->data, off); if (ret < 0) { -- 2.7.4 From 9d9a6813693f484c6917255cec30ce99df8433bb Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Wed, 16 Sep 2015 22:48:27 +0900 Subject: [PATCH 16/16] Add environment file for XDG_XXX Change-Id: I3231354e181e49ed151c12a9a3134c721bd7a055 --- data/data-provider-master.service | 1 + 1 file changed, 1 insertion(+) diff --git a/data/data-provider-master.service b/data/data-provider-master.service index 50cc58d..7d2f283 100644 --- a/data/data-provider-master.service +++ b/data/data-provider-master.service @@ -21,6 +21,7 @@ Description=Data Provider daemon Environment=BUFMGR_LOCK_TYPE="once" Environment=BUFMGR_MAP_CACHE="true" EnvironmentFile=/run/tizen-system-env +EnvironmentFile=/run/xdg-root-env Type=notify ExecStart=/usr/bin/data-provider-master RestartSec=1 -- 2.7.4