summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-02-21 10:54:53 (GMT)
committerSung-jae Park <nicesj.park@samsung.com>2013-02-21 10:55:21 (GMT)
commitd898e4b9538f2a036a33d731c811b4caa09b181b (patch)
tree0976d7e9796579896f6206480f347d3f48844afc
parentc79d7267800029ed5309ab684b51a6a6b7ac7226 (diff)
downloaddata-provider-master-d898e4b9538f2a036a33d731c811b4caa09b181b.zip
data-provider-master-d898e4b9538f2a036a33d731c811b4caa09b181b.tar.gz
data-provider-master-d898e4b9538f2a036a33d731c811b4caa09b181b.tar.bz2
Sync with the latest code
Change-Id: I3950d362f4eb8d0396c18c41db958f21a4e3f64e
-rw-r--r--CMakeLists.txt5
-rw-r--r--data/baltic.conf.ini30
-rw-r--r--data/private.conf.ini (renamed from data/conf.ini)1
-rw-r--r--include/conf.h3
-rw-r--r--include/xmonitor.h2
-rw-r--r--packaging/org.tizen.data-provider-master.spec4
-rw-r--r--src/conf.c11
-rw-r--r--src/fb.c66
-rw-r--r--src/instance.c41
-rw-r--r--src/server.c67
-rw-r--r--src/setting.c2
-rw-r--r--src/xmonitor.c61
12 files changed, 251 insertions, 42 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d2066d..54ba946 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -55,7 +55,6 @@ ADD_DEFINITIONS("-DNDEBUG")
ADD_DEFINITIONS(${pkg_CFLAGS})
ADD_DEFINITIONS(${pkg_LDFLAGS})
-
ADD_EXECUTABLE(${PROJECT_NAME}
src/main.c
src/util.c
@@ -87,7 +86,9 @@ TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkg_LDFLAGS} "-ldl")
#INSTALL(FILES ${CMAKE_SOURCE_DIR}/org.tizen.data-provider-master.desktop DESTINATION /opt/share/applications)
#INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /opt/apps/org.tizen.${PROJECT_NAME}/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/abi.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
-INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/conf.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/${PRODUCT}.conf.ini DESTINATION /usr/share/data-provider-master RENAME "conf.ini" PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
+
INSTALL(FILES ${CMAKE_SOURCE_DIR}/data/resolution.ini DESTINATION /usr/share/data-provider-master PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/LICENSE DESTINATION /usr/share/license RENAME "org.tizen.${PROJECT_NAME}")
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE SETUID)
diff --git a/data/baltic.conf.ini b/data/baltic.conf.ini
new file mode 100644
index 0000000..d823052
--- /dev/null
+++ b/data/baltic.conf.ini
@@ -0,0 +1,30 @@
+base_width=720
+base_height=1280
+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=5242880
+replace_tag=/APPID/
+slave_ttl=30.0
+slave_activate_time=30.0
+max_log_line=1000
+max_log_file=3
+sqilte_flush_max=1048576
+db_path=/opt/dbspace/.livebox.db
+share_path=/opt/usr/share/live_magazine/
+log_path=/opt/usr/share/live_magazine/log
+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=240.0
+slave_max_load=30
+use_sw_backend=false
+provider_method=shm
+debug_mode=false
+overwrite_content=false
+com_core_thread=true
+use_xmonitor=false
diff --git a/data/conf.ini b/data/private.conf.ini
index 586d1a0..c5285fe 100644
--- a/data/conf.ini
+++ b/data/private.conf.ini
@@ -27,3 +27,4 @@ provider_method=pixmap
debug_mode=false
overwrite_content=false
com_core_thread=true
+use_xmonitor=false
diff --git a/include/conf.h b/include/conf.h
index a1b27dd..714cf0c 100644
--- a/include/conf.h
+++ b/include/conf.h
@@ -81,6 +81,7 @@ struct conf {
int debug_mode;
int overwrite_content;
int com_core_thread;
+ int use_xmonitor;
};
extern struct conf g_conf;
@@ -146,6 +147,8 @@ extern int conf_loader(void);
#define DEFAULT_CLUSTER "user,created"
#define MINIMUM_REACTIVATION_TIME 10
+#define USE_XMONITOR g_conf.use_xmonitor
+
#define HAPI __attribute__((visibility("hidden")))
/* End of a file */
diff --git a/include/xmonitor.h b/include/xmonitor.h
index 3ddc7cd..1ee8eab 100644
--- a/include/xmonitor.h
+++ b/include/xmonitor.h
@@ -28,5 +28,7 @@ extern int xmonitor_add_event_callback(enum xmonitor_event event, int (*cb)(void
extern int xmonitor_del_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data);
extern int xmonitor_is_paused(void);
extern void xmonitor_handle_state_changes(void);
+extern int xmonitor_resume(struct client_node *client);
+extern int xmonitor_pause(struct client_node *client);
/* End of a file */
diff --git a/packaging/org.tizen.data-provider-master.spec b/packaging/org.tizen.data-provider-master.spec
index bcd1653..3c4ad2f 100644
--- a/packaging/org.tizen.data-provider-master.spec
+++ b/packaging/org.tizen.data-provider-master.spec
@@ -1,6 +1,6 @@
Name: org.tizen.data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.16.7
+Version: 0.16.10
Release: 1
Group: framework/livebox
License: Flora License
@@ -41,7 +41,7 @@ Keep trace on the life-cycle of the livebox and status of the service providers,
%setup -q
%build
-cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DPRODUCT=private
CFLAGS="${CFLAGS} -Wall -Winline -Werror" LDFLAGS="${LDFLAGS}" make %{?jobs:-j%jobs}
%install
diff --git a/src/conf.c b/src/conf.c
index ca57d98..c8667f9 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -81,6 +81,7 @@ HAPI struct conf g_conf = {
.debug_mode = 0,
.overwrite_content = 0,
.com_core_thread = 1,
+ .use_xmonitor = 1,
};
static void conf_update_size(void)
@@ -88,6 +89,12 @@ static void conf_update_size(void)
ecore_x_window_size_get(0, &g_conf.width, &g_conf.height);
}
+static void use_xmonitor(char *buffer)
+{
+ g_conf.use_xmonitor = !strcasecmp(buffer, "true");
+ DbgPrint("Use xmonitor: %d\n", g_conf.use_xmonitor);
+}
+
static void use_sw_backend_handler(char *buffer)
{
g_conf.use_sw_backend = !strcasecmp(buffer, "true");
@@ -437,6 +444,10 @@ HAPI int conf_loader(void)
.handler = use_sw_backend_handler,
},
{
+ .name = "use_xmonitor",
+ .handler = use_xmonitor,
+ },
+ {
.name = "provider_method",
.handler = provider_method_handler,
},
diff --git a/src/fb.c b/src/fb.c
index 99fc74f..fa8e122 100644
--- a/src/fb.c
+++ b/src/fb.c
@@ -20,6 +20,7 @@
#include <dlog.h>
#include <Ecore_Evas.h>
+#include <Evas.h>
#include "util.h"
#include "conf.h"
@@ -95,13 +96,48 @@ HAPI struct fb_info *fb_create(struct inst_info *inst, int w, int h, enum buffer
return info;
}
+static void sw_render_pre_cb(void *data, Evas *e, void *event_info)
+{
+ struct fb_info *info = data;
+ int w;
+ int h;
+
+ buffer_handler_get_size(info->buffer, &w, &h);
+ evas_damage_rectangle_add(e, 0, 0, w, h);
+}
+
+static void sw_render_post_cb(void *data, Evas *e, void *event_info)
+{
+ void *canvas;
+ Ecore_Evas *internal_ee;
+ int x, y, w, h;
+
+ internal_ee = ecore_evas_ecore_evas_get(e);
+ if (!internal_ee) {
+ LOGD("Failed to get ecore evas\n");
+ return;
+ }
+
+ // Get a pointer of a buffer of the virtual canvas
+ canvas = (void*)ecore_evas_buffer_pixels_get(internal_ee);
+ if (!canvas) {
+ LOGD("Failed to get pixel canvas\n");
+ return;
+ }
+
+ ecore_evas_geometry_get(internal_ee, &x, &y, &w, &h);
+ evas_data_argb_unpremul(canvas, w * h);
+}
+
static void render_pre_cb(void *data, Evas *e, void *event_info)
{
fb_pixmap_render_pre(data);
+ sw_render_pre_cb(data, e, event_info);
}
static void render_post_cb(void *data, Evas *e, void *event_info)
{
+ sw_render_post_cb(data, e, event_info);
fb_pixmap_render_post(data);
}
@@ -109,6 +145,7 @@ HAPI int fb_create_buffer(struct fb_info *info)
{
int ow;
int oh;
+ Evas *e;
buffer_handler_get_size(info->buffer, &ow, &oh);
DbgPrint("Buffer handler size: %dx%d\n", ow, oh);
@@ -136,23 +173,22 @@ HAPI int fb_create_buffer(struct fb_info *info)
return -EFAULT;
}
+ e = ecore_evas_get(info->ee);
if (buffer_handler_type(info->buffer) == BUFFER_TYPE_PIXMAP) {
- Evas *e;
- e = ecore_evas_get(info->ee);
- if (e) {
- evas_event_callback_add(e, EVAS_CALLBACK_RENDER_PRE, render_pre_cb, info);
- evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, render_post_cb, info);
-
- /*!
- * \note
- * ecore_evas_alpha_set tries to access the canvas buffer.
- * Without any render_pre/render_post callback.
- */
- fb_pixmap_render_pre(info);
- ecore_evas_alpha_set(info->ee, EINA_TRUE);
- fb_pixmap_render_post(info);
- }
+ evas_event_callback_add(e, EVAS_CALLBACK_RENDER_PRE, render_pre_cb, info);
+ evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, render_post_cb, info);
+
+ /*!
+ * \note
+ * ecore_evas_alpha_set tries to access the canvas buffer.
+ * Without any render_pre/render_post callback.
+ */
+ fb_pixmap_render_pre(info);
+ ecore_evas_alpha_set(info->ee, EINA_TRUE);
+ fb_pixmap_render_post(info);
} else {
+ evas_event_callback_add(e, EVAS_CALLBACK_RENDER_PRE, sw_render_pre_cb, info);
+ evas_event_callback_add(e, EVAS_CALLBACK_RENDER_POST, sw_render_post_cb, info);
ecore_evas_alpha_set(info->ee, EINA_TRUE);
}
diff --git a/src/instance.c b/src/instance.c
index 14572c5..f3a2e64 100644
--- a/src/instance.c
+++ b/src/instance.c
@@ -247,6 +247,22 @@ static inline int instance_recover_visible_state(struct inst_info *inst)
return ret;
}
+static inline void send_size_changed_event(struct inst_info *inst, int is_pd, int w, int h, int status)
+{
+ struct packet *packet;
+ const char *pkgname;
+ const char *id;
+
+ pkgname = package_name(inst->info);
+ id = inst->id;
+
+ packet = packet_create_noack("size_changed", "ssiiii", pkgname, id, is_pd, w, h, status);
+ if (packet)
+ CLIENT_SEND_EVENT(inst, packet);
+ else
+ ErrPrint("Failed to send size changed event\n");
+}
+
HAPI int instance_unicast_created_event(struct inst_info *inst, struct client_node *client)
{
struct packet *packet;
@@ -979,10 +995,10 @@ static void activate_cb(struct slave_node *slave, const struct packet *packet, v
* so just increase the loaded instance counter
* After that, do reset jobs.
*/
- inst->state = INST_ACTIVATED;
-
instance_set_lb_info(inst, w, h, priority, content, title);
+ inst->state = INST_ACTIVATED;
+
switch (inst->requested_state) {
case INST_DESTROYED:
instance_unicast_deleted_event(inst, NULL);
@@ -1486,9 +1502,6 @@ HAPI void instance_set_lb_info(struct inst_info *inst, int w, int h, double prio
ErrPrint("Heap: %s\n", strerror(errno));
}
- inst->lb.width = w;
- inst->lb.height = h;
-
if (_content) {
DbgFree(inst->content);
inst->content= _content;
@@ -1501,10 +1514,25 @@ HAPI void instance_set_lb_info(struct inst_info *inst, int w, int h, double prio
if (priority >= 0.0f && priority <= 1.0f)
inst->lb.priority = priority;
+
+ if (inst->state == INST_ACTIVATED && (inst->lb.width != w || inst->lb.height != h)) {
+ /*!
+ */
+ send_size_changed_event(inst, 0, w, h, 0);
+ }
+
+ inst->lb.width = w;
+ inst->lb.height = h;
}
HAPI void instance_set_pd_info(struct inst_info *inst, int w, int h)
{
+ if (inst->state == INST_ACTIVATED && (inst->pd.width != w || inst->pd.height != h)) {
+ /*!
+ */
+ send_size_changed_event(inst, 1, w, h, 0);
+ }
+
inst->pd.width = w;
inst->pd.height = h;
}
@@ -1700,10 +1728,9 @@ static void resize_cb(struct slave_node *slave, const struct packet *packet, voi
if (ret == 0) {
cbdata->inst->lb.width = cbdata->w;
cbdata->inst->lb.height = cbdata->h;
- } else {
- ErrPrint("Failed to change the size of a livebox (%d)\n", ret);
}
+ send_size_changed_event(cbdata->inst, 0, cbdata->w, cbdata->h, ret);
instance_unref(cbdata->inst);
DbgFree(cbdata);
}
diff --git a/src/server.c b/src/server.c
index 75f4e18..9d641b4 100644
--- a/src/server.c
+++ b/src/server.c
@@ -2335,6 +2335,64 @@ out:
return NULL;
}
+static struct packet *client_pause_request(pid_t pid, int handle, const struct packet *packet)
+{
+ struct client_node *client;
+ double timestamp;
+ int ret;
+
+ client = client_find_by_pid(pid);
+ if (!client) {
+ ErrPrint("Client %d is paused - manually reported\n", pid);
+ ret = -ENOENT;
+ goto out;
+ }
+
+ ret = packet_get(packet, "d", &timestamp);
+ if (ret != 1) {
+ ErrPrint("Invalid parameter\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (USE_XMONITOR)
+ DbgPrint("XMONITOR enabled. ignore client paused request\n");
+ else
+ xmonitor_pause(client);
+
+out:
+ return NULL;
+}
+
+static struct packet *client_resume_request(pid_t pid, int handle, const struct packet *packet)
+{
+ struct client_node *client;
+ double timestamp;
+ int ret;
+
+ client = client_find_by_pid(pid);
+ if (!client) {
+ ErrPrint("Client %d is paused - manually reported\n", pid);
+ ret = -ENOENT;
+ goto out;
+ }
+
+ ret = packet_get(packet, "d", &timestamp);
+ if (ret != 1) {
+ ErrPrint("Invalid parameter\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+ if (USE_XMONITOR)
+ DbgPrint("XMONITOR enabled. ignore client resumed request\n");
+ else
+ xmonitor_resume(client);
+
+out:
+ return NULL;
+}
+
static struct packet *client_pd_key_up(pid_t pid, int handle, const struct packet *packet)
{
struct client_node *client;
@@ -5215,6 +5273,15 @@ static struct method s_client_table[] = {
},
{
+ .cmd = "client_paused",
+ .handler = client_pause_request,
+ },
+ {
+ .cmd = "client_resumed",
+ .handler = client_resume_request,
+ },
+
+ {
.cmd = NULL,
.handler = NULL,
},
diff --git a/src/setting.c b/src/setting.c
index ffcc949..d60807d 100644
--- a/src/setting.c
+++ b/src/setting.c
@@ -29,6 +29,7 @@
#include <Eina.h>
+#include "client_life.h"
#include "setting.h"
#include "util.h"
#include "debug.h"
@@ -62,6 +63,7 @@ HAPI int setting_is_lcd_off(void)
state = VCONFKEY_PM_STATE_NORMAL; /* UNLOCK */
}
+ DbgPrint("State: %d, (%d:lcdoff, %d:sleep)\n", state, VCONFKEY_PM_STATE_LCDOFF, VCONFKEY_PM_STATE_SLEEP);
return state == VCONFKEY_PM_STATE_LCDOFF || state == VCONFKEY_PM_STATE_SLEEP;
}
diff --git a/src/xmonitor.c b/src/xmonitor.c
index c3924c5..ef89efd 100644
--- a/src/xmonitor.c
+++ b/src/xmonitor.c
@@ -34,13 +34,13 @@
#include <dlog.h>
#include "conf.h"
-#include "xmonitor.h"
#include "debug.h"
#include "client_life.h"
#include "slave_life.h"
#include "main.h"
#include "util.h"
#include "setting.h"
+#include "xmonitor.h"
int errno;
@@ -66,7 +66,7 @@ static struct info {
.pause_list = NULL,
.resume_list = NULL,
- .paused = 0,
+ .paused = 1, /*!< The provider is treated as paused process when it is launched */
};
static inline void touch_paused_file(void)
@@ -218,14 +218,10 @@ static Eina_Bool client_cb(void *data, int type, void *event)
if (!strcmp(name, "_X_ILLUME_DEACTIVATE_WINDOW")) {
DbgPrint("PAUSE EVENT\n");
- client_paused(client);
-
- xmonitor_handle_state_changes();
+ xmonitor_pause(client);
} else if (!strcmp(name, "_X_ILLUME_ACTIVATE_WINDOW")) {
DbgPrint("RESUME EVENT\n");
- client_resumed(client);
-
- xmonitor_handle_state_changes();
+ xmonitor_resume(client);
} else {
/* ignore event */
}
@@ -316,7 +312,34 @@ static inline void sniff_all_windows(void)
return;
}
-HAPI int xmonitor_init(void)
+HAPI int xmonitor_pause(struct client_node *client)
+{
+ DbgPrint("%d is paused\n", client_pid(client));
+ client_paused(client);
+ xmonitor_handle_state_changes();
+ return 0;
+}
+
+HAPI int xmonitor_resume(struct client_node *client)
+{
+ DbgPrint("%d is resumed\n", client_pid(client));
+ client_resumed(client);
+ xmonitor_handle_state_changes();
+ return 0;
+}
+
+static inline void disable_xmonitor(void)
+{
+ ecore_event_handler_del(s_info.create_handler);
+ ecore_event_handler_del(s_info.destroy_handler);
+ ecore_event_handler_del(s_info.client_handler);
+
+ s_info.create_handler = NULL;
+ s_info.destroy_handler = NULL;
+ s_info.client_handler = NULL;
+}
+
+static inline int enable_xmonitor(void)
{
if (ecore_x_composite_query() == EINA_FALSE)
DbgPrint("====> COMPOSITOR IS NOT ENABLED\n");
@@ -352,6 +375,17 @@ HAPI int xmonitor_init(void)
}
sniff_all_windows();
+ return 0;
+}
+
+HAPI int xmonitor_init(void)
+{
+ if (USE_XMONITOR) {
+ int ret;
+ ret = enable_xmonitor();
+ if (ret < 0)
+ return ret;
+ }
s_info.paused = client_is_all_paused() || setting_is_lcd_off();
if (s_info.paused) {
@@ -364,13 +398,8 @@ HAPI int xmonitor_init(void)
HAPI void xmonitor_fini(void)
{
- ecore_event_handler_del(s_info.create_handler);
- ecore_event_handler_del(s_info.destroy_handler);
- ecore_event_handler_del(s_info.client_handler);
-
- s_info.create_handler = NULL;
- s_info.destroy_handler = NULL;
- s_info.client_handler = NULL;
+ if (USE_XMONITOR)
+ disable_xmonitor();
}
HAPI int xmonitor_add_event_callback(enum xmonitor_event event, int (*cb)(void *user_data), void *user_data)