summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoon87.park <moon87.park@samsung.com>2017-03-16 21:12:28 +0900
committermoon87.park <moon87.park@samsung.com>2017-03-16 21:12:28 +0900
commitf048fbcf2e542ab6da7fa311dae57a7e1c5413db (patch)
treed3f4d85f7bf224c23904fcc214f3daa5406bcb12
parentc202ae14b1ee4597c347429bf9825547fa5d1086 (diff)
downloadw-clock-viewer-f048fbcf2e542ab6da7fa311dae57a7e1c5413db.tar.gz
w-clock-viewer-f048fbcf2e542ab6da7fa311dae57a7e1c5413db.tar.bz2
w-clock-viewer-f048fbcf2e542ab6da7fa311dae57a7e1c5413db.zip
Change-Id: Ide11b3d64493a956966d8757a0d7f84674a973d9
-rw-r--r--clock-viewer/CMakeLists.txt1
-rw-r--r--clock-viewer/include/clock-viewer-util-pkginfo.h2
-rw-r--r--clock-viewer/org.tizen.w-clock-viewer.xml.in1
-rw-r--r--clock-viewer/src/clock-viewer-default-clock-fallback.c3
-rw-r--r--clock-viewer/src/clock-viewer-util-pkginfo.c31
-rw-r--r--clock-viewer/src/clock-viewer-widget.c8
-rw-r--r--clock-viewer/src/clock-viewer.c47
-rw-r--r--packaging/org.tizen.w-clock-viewer.spec1
8 files changed, 32 insertions, 62 deletions
diff --git a/clock-viewer/CMakeLists.txt b/clock-viewer/CMakeLists.txt
index 9b354b9..80b7e20 100644
--- a/clock-viewer/CMakeLists.txt
+++ b/clock-viewer/CMakeLists.txt
@@ -14,6 +14,7 @@ pkg_check_modules(PKGS REQUIRED
capi-appfw-application
capi-system-device
capi-base-utils-i18n
+ capi-ui-efl-util
elementary
watch-control
widget_viewer_evas
diff --git a/clock-viewer/include/clock-viewer-util-pkginfo.h b/clock-viewer/include/clock-viewer-util-pkginfo.h
index e8e98bd..ca9d34b 100644
--- a/clock-viewer/include/clock-viewer-util-pkginfo.h
+++ b/clock-viewer/include/clock-viewer-util-pkginfo.h
@@ -32,6 +32,4 @@ extern int clock_viewer_util_pkginfo_get_clock_resource_id(void);
extern clock_viewer_ambient_type clock_viewer_util_pkginfo_get_ambient_type(char *appid);
-extern int clock_viewer_util_pkginfo_is_widget(char *appid);
-
#endif /* __CLOCK_VIEWER_UTIL_PKGINFO_H__ */
diff --git a/clock-viewer/org.tizen.w-clock-viewer.xml.in b/clock-viewer/org.tizen.w-clock-viewer.xml.in
index 97acca3..68e023a 100644
--- a/clock-viewer/org.tizen.w-clock-viewer.xml.in
+++ b/clock-viewer/org.tizen.w-clock-viewer.xml.in
@@ -10,5 +10,6 @@
<privilege>http://tizen.org/privilege/alarm.set</privilege>
<privilege>http://tizen.org/privilege/setting</privilege>
<privilege>http://tizen.org/privilege/power</privilege>
+ <privilege>http://tizen.org/privilege/display</privilege>
</privileges>
</manifest>
diff --git a/clock-viewer/src/clock-viewer-default-clock-fallback.c b/clock-viewer/src/clock-viewer-default-clock-fallback.c
index 172865b..d0a7b57 100644
--- a/clock-viewer/src/clock-viewer-default-clock-fallback.c
+++ b/clock-viewer/src/clock-viewer-default-clock-fallback.c
@@ -279,8 +279,7 @@ static UDateFormat *_clock_viewer_default_clock_fallback_get_time_formatter_24(v
if (strncmp(a_best_pattern_fixed, "HH'h'mm", 7) == 0
|| strncmp(s_default_clock_info.timeregion_format, "id_ID", 5) == 0
|| strncmp(s_default_clock_info.timeregion_format, "da_DK", 5) == 0
- || strncmp(s_default_clock_info.timeregion_format, "mr_IN", 5) == 0)
- {
+ || strncmp(s_default_clock_info.timeregion_format, "mr_IN", 5) == 0) {
char *a_best_pattern_changed = g_strndup("HH:mm", 5);
_DBG("best pattern is changed [%s]", a_best_pattern_changed);
if (a_best_pattern_changed) {
diff --git a/clock-viewer/src/clock-viewer-util-pkginfo.c b/clock-viewer/src/clock-viewer-util-pkginfo.c
index efebc3b..f2d7740 100644
--- a/clock-viewer/src/clock-viewer-util-pkginfo.c
+++ b/clock-viewer/src/clock-viewer-util-pkginfo.c
@@ -103,42 +103,17 @@ HAPI clock_viewer_ambient_type clock_viewer_util_pkginfo_get_ambient_type(char *
ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
free(appid);
if (ret != PMINFO_R_OK || handle == NULL) {
+ _ERR("Fail to get pkgmgr handle");
return CLOCK_VIEWER_AMBIENT_TYPE_ANALOG;
}
- /* TODO : request below API or alternative on tizen 3.0
- ret = pkgmgrinfo_appinfo_get_ambient_support(handle, &ambient_mode);
- */
+ ret = pkgmgrinfo_appinfo_is_support_ambient(handle, &ambient_mode);
pkgmgrinfo_appinfo_destroy_appinfo(handle);
if (ret != PMINFO_R_OK) {
+ _ERR("Fail to get ambient mode[%d], ambient_mode[%d]", ret, ambient_mode);
return CLOCK_VIEWER_AMBIENT_TYPE_ANALOG;
}
_DBG("ambient mode[%s]", ambient_mode ? "manual" : "analog");
-
return ambient_mode ? CLOCK_VIEWER_AMBIENT_TYPE_MANUAL : CLOCK_VIEWER_AMBIENT_TYPE_ANALOG;
}
-
-HAPI int clock_viewer_util_pkginfo_is_widget(char *appid)
-{
- int is_widget = 0;
- char *widget_id = NULL;
-
- widget_id = widget_service_get_widget_id(appid);
- if (widget_id != NULL) {
- char *category = NULL;
- /* TODO : Replace below line with watch core API
- category = widget_service_get_category(widget_id);
- */
-
- if (category != NULL) {
- if (!strcmp(category, CLOCK_VIEWER_TIZEN_CLOCK_CATEGORY)) {
- is_widget = 1;
- }
- free(category);
- }
- free(widget_id);
- }
-
- return is_widget;
-}
diff --git a/clock-viewer/src/clock-viewer-widget.c b/clock-viewer/src/clock-viewer-widget.c
index 66dd465..311df20 100644
--- a/clock-viewer/src/clock-viewer-widget.c
+++ b/clock-viewer/src/clock-viewer-widget.c
@@ -260,18 +260,18 @@ HAPI void clock_viewer_widget_update_position(void)
HAPI void clock_viewer_widget_register_render_event(Evas_Smart_Cb func, void *data)
{
- if (!s_widget_info.widget) {
+ if (!s_widget_info.win) {
return;
}
- evas_object_smart_callback_add(s_widget_info.widget, WIDGET_SMART_SIGNAL_UPDATED, func, data);
+ evas_object_smart_callback_add(s_widget_info.win, WATCH_SMART_SIGNAL_UPDATED, func, data);
}
HAPI void clock_viewer_widget_unregister_render_event(Evas_Smart_Cb func, void *data)
{
- if (!s_widget_info.widget) {
+ if (!s_widget_info.win) {
return;
}
- evas_object_smart_callback_del(s_widget_info.widget, WIDGET_SMART_SIGNAL_UPDATED, func);
+ evas_object_smart_callback_del(s_widget_info.win, WATCH_SMART_SIGNAL_UPDATED, func);
}
diff --git a/clock-viewer/src/clock-viewer.c b/clock-viewer/src/clock-viewer.c
index 24f365d..c9e9d01 100644
--- a/clock-viewer/src/clock-viewer.c
+++ b/clock-viewer/src/clock-viewer.c
@@ -19,7 +19,7 @@
#include <Ecore.h>
#include <Ecore_Evas.h>
-#include <device/power.h>
+#include <efl_util.h>
#include "clock-viewer.h"
#include "clock-viewer-window.h"
@@ -86,10 +86,12 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer);
static Eina_Bool __clock_viewer_clockend_timer_cb(void *data)
{
+ clock_viewer_s *clock_viewer = data;
char *clock_signal[1] = { "clockend" };
_WARN("clock end <<");
clock_viewer_util_dbus_broadcast_signal(data, DEVICED_PATH, DEVICED_INTERFACE, "HomeScreen", "s", &clock_signal[0]);
- device_power_release_lock(POWER_LOCK_CPU);
+ if (clock_viewer)
+ efl_util_set_window_screen_mode(clock_viewer->window, EFL_UTIL_SCREEN_MODE_DEFAULT);
s_info.clockend_timer = NULL;
@@ -127,8 +129,7 @@ static void __clock_viewer_render_pre_cb(void *data, Evas *e, void *event_info)
}
if (clock_viewer->request_pm_status == CLOCK_VIEWER_PM_STEP_CLOCKSTART
- || clock_viewer->request_pm_status == CLOCK_VIEWER_PM_STEP_CLOCKEND)
- {
+ || clock_viewer->request_pm_status == CLOCK_VIEWER_PM_STEP_CLOCKEND) {
clock_viewer_display_set_dpms_mode(CLOCK_VIEWER_DISPLAY_MODE_RESUME);
if (s_info.ambient_type == CLOCK_VIEWER_AMBIENT_TYPE_MANUAL) {
@@ -269,7 +270,7 @@ static void __clock_viewer_lcdoff_cb(void *data, DBusMessage *msg)
char *clock_signal[1] = { "clockstart" };
_DBG("clock start >>");
- device_power_request_lock(POWER_LOCK_CPU, 0);
+ efl_util_set_window_screen_mode(clock_viewer->window, EFL_UTIL_SCREEN_MODE_ALWAYS_ON);
clock_viewer_util_dbus_broadcast_signal(clock_viewer, DEVICED_PATH, DEVICED_INTERFACE, "HomeScreen", "s", &clock_signal[0]);
_DBG("ambient_type[%d] clock_viewer->current_type[%d]", s_info.ambient_type, clock_viewer->current_type);
@@ -318,7 +319,6 @@ static int _clock_viewer_try_clockend(clock_viewer_s *clock_viewer)
/* [LCDOFF Flow 3] move to view area */
evas_object_resize(clock_viewer->window, clock_viewer->win_width, clock_viewer->win_height);
- evas_object_move(clock_viewer->window, CV_WINDOW_SHOW_POS_X, CV_WINDOW_SHOW_POS_Y);
evas_object_show(clock_viewer->window);
}
@@ -359,12 +359,6 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
return;
}
- resource_id = clock_viewer_util_pkginfo_get_clock_resource_id();
- if (!resource_id) {
- _ERR("resource id is not valid\n");
- return;
- }
-
if (s_info.clock_pkgname) {
if (!strcmp(s_info.clock_pkgname, pkgname)) {
_WARN("same pkgname(%s), skip!", pkgname);
@@ -375,8 +369,14 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
_DBG("First time\n");
}
- ambient_type = clock_viewer_util_pkginfo_get_ambient_type(pkgname);
- _DBG("package[%s] ambient type[%d]", pkgname, ambient_type);
+ resource_id = clock_viewer_util_pkginfo_get_clock_resource_id();
+ if (!resource_id) {
+ _ERR("resource id is not valid\n");
+ ambient_type = CLOCK_VIEWER_AMBIENT_TYPE_ANALOG;
+ } else {
+ ambient_type = clock_viewer_util_pkginfo_get_ambient_type(pkgname);
+ _DBG("package[%s] ambient type[%d]", pkgname, ambient_type);
+ }
/* unload old clock */
clock_viewer_default_clock_fini(clock_viewer);
@@ -384,12 +384,8 @@ static void _clock_viewer_set_current_clock(clock_viewer_s *clock_viewer)
/* load new clock */
if (ambient_type == CLOCK_VIEWER_AMBIENT_TYPE_MANUAL) {
- if (clock_viewer_util_pkginfo_is_widget(pkgname)) {
- clock_viewer_widget_init(clock_viewer, clock_viewer->window, pkgname, resource_id);
- clock_viewer->current_type = CLOCK_VIEWER_TYPE_WIDGET;
- } else {
- clock_viewer->current_type = CLOCK_VIEWER_TYPE_MINICTRL;
- }
+ clock_viewer_widget_init(clock_viewer, clock_viewer->window, pkgname, resource_id);
+ clock_viewer->current_type = CLOCK_VIEWER_TYPE_WIDGET;
} else {
_DBG("CLOCK_VIEWER_AMBIENT_TYPE_ANALOG");
clock_viewer_default_clock_init(clock_viewer, clock_viewer->window, ambient_type);
@@ -449,8 +445,7 @@ HAPI void clock_viewer_create(clock_viewer_s *clock_viewer)
clock_viewer->window = clock_viewer_window_create();
elm_win_screen_size_get(clock_viewer->window, NULL, NULL, &clock_viewer->win_width, &clock_viewer->win_height);
- evas_object_move(clock_viewer->window, CV_WINDOW_HIDE_POS_X, CV_WINDOW_HIDE_POS_Y);
- evas_object_show(clock_viewer->window);
+ evas_object_hide(clock_viewer->window);
_clock_viewer_set_current_clock(clock_viewer);
}
@@ -484,6 +479,7 @@ HAPI void clock_viewer_show(clock_viewer_s *clock_viewer, int is_hide_launch)
win = clock_viewer->window;
if (win) {
if (!s_info.is_render_added) {
+
if (clock_viewer->current_type == CLOCK_VIEWER_TYPE_WIDGET) {
clock_viewer_widget_register_render_event(__clock_viewer_widget_updated_cb, clock_viewer);
} else {
@@ -492,7 +488,6 @@ HAPI void clock_viewer_show(clock_viewer_s *clock_viewer, int is_hide_launch)
evas_event_callback_add(evas, EVAS_CALLBACK_RENDER_PRE, __clock_viewer_render_pre_cb, clock_viewer);
evas_event_callback_add(evas, EVAS_CALLBACK_RENDER_POST, __clock_viewer_render_post_cb, clock_viewer);
}
-
s_info.is_render_added = 1;
}
@@ -510,6 +505,7 @@ HAPI void clock_viewer_show(clock_viewer_s *clock_viewer, int is_hide_launch)
if (clock_viewer->current_type != CLOCK_VIEWER_TYPE_WIDGET) {
/* temporary move to set visible so we can receive render pre/post */
evas_object_move(win, clock_viewer->win_width - 1, clock_viewer->win_height - 1);
+ evas_object_show(win);
}
}
@@ -530,12 +526,12 @@ HAPI void clock_viewer_show(clock_viewer_s *clock_viewer, int is_hide_launch)
/* if homescreen is not clock, do move in drawdone */
/* [LCDOFF Flow 3] move to view area */
evas_object_resize(win, clock_viewer->win_width, clock_viewer->win_height);
- evas_object_move(win, CV_WINDOW_SHOW_POS_X, CV_WINDOW_SHOW_POS_Y);
evas_object_show(win);
} else {
if (clock_viewer->current_type != CLOCK_VIEWER_TYPE_WIDGET) {
/* temporary move to set visible so we can receive render pre/post */
evas_object_move(win, clock_viewer->win_width - 1, clock_viewer->win_height - 1);
+ evas_object_show(win);
}
}
@@ -569,7 +565,6 @@ HAPI void clock_viewer_hide(clock_viewer_s *clock_viewer)
evas_event_callback_del(evas, EVAS_CALLBACK_RENDER_PRE, __clock_viewer_render_pre_cb);
evas_event_callback_del(evas, EVAS_CALLBACK_RENDER_POST, __clock_viewer_render_post_cb);
}
-
s_info.is_render_added = 0;
}
@@ -590,7 +585,7 @@ HAPI void clock_viewer_hide(clock_viewer_s *clock_viewer)
}
}
- evas_object_move(win, CV_WINDOW_HIDE_POS_X, CV_WINDOW_HIDE_POS_Y);
+ evas_object_hide(win);
} else {
_ERR("window is not created");
}
diff --git a/packaging/org.tizen.w-clock-viewer.spec b/packaging/org.tizen.w-clock-viewer.spec
index 6b8569f..75f55f7 100644
--- a/packaging/org.tizen.w-clock-viewer.spec
+++ b/packaging/org.tizen.w-clock-viewer.spec
@@ -9,6 +9,7 @@ Source0: %{name}-%{version}.tar.gz
BuildRequires: pkgconfig(capi-appfw-application)
BuildRequires: pkgconfig(capi-system-device)
BuildRequires: pkgconfig(capi-base-utils-i18n)
+BuildRequires: pkgconfig(capi-ui-efl-util)
BuildRequires: pkgconfig(elementary)
BuildRequires: pkgconfig(watch-control)
BuildRequires: pkgconfig(widget_viewer_evas)