Support ambient block tick state 95/234395/6
authorhyunho <hhstark.kang@samsung.com>
Tue, 26 May 2020 05:06:29 +0000 (14:06 +0900)
committerhyunho <hhstark.kang@samsung.com>
Tue, 26 May 2020 06:25:04 +0000 (15:25 +0900)
Change-Id: Ia00dc64330168d8e40242bc66aee3627238867ee
Signed-off-by: hyunho <hhstark.kang@samsung.com>
include/watch_base.h
src/base/watch_base.c

index 2b24a22..81af36e 100755 (executable)
@@ -108,6 +108,12 @@ typedef enum {
        WATCH_BASE_AMBIENT_EVENT_NOTIFIED
 } watch_base_ambient_event_e;
 
+typedef enum {
+       WATCH_BASE_AMBIENT_STATE_LEAVE,
+       WATCH_BASE_AMBIENT_STATE_ENTER,
+       WATCH_BASE_AMBIENT_STATE_BLOCK_TICK
+} watch_base_ambient_state_e;
+
 int watch_base_set_ambient_tick_type(watch_base_ambient_tick_type_e type);
 int watch_base_get_ambient_tick_type(watch_base_ambient_tick_type_e *type);
 int watch_base_time_get_current_time(watch_base_time_h *watch_base_time);
index 95edc53..dc365b2 100755 (executable)
@@ -108,6 +108,7 @@ struct watch_base_context {
        int width;
        int height;
        enum watch_visible_state watch_visibility;
+       bool clock_tick_block;
        bool ambient_mode;
        bool ambient_mode_skip_resume;
        bool bg_launch;
@@ -396,7 +397,7 @@ static int __handling_ambient_mode(int ambient, void *data)
        };
 
        /* Enter the ambient mode */
-       if (ambient) {
+       if (ambient == WATCH_BASE_AMBIENT_STATE_ENTER) {
                if (appcore_ui_base_is_resumed()) {
                        appcore_ui_base_on_pause();
                        if (__context.callback.pause)
@@ -416,7 +417,7 @@ static int __handling_ambient_mode(int ambient, void *data)
                watch_base_ambient_notify_event(
                        WATCH_BASE_AMBIENT_EVENT_NOTIFIED, NULL);
                _watch_base_signal_send_alpm_update_done();
-       } else { /* Exit the ambient mode */
+       } else if (ambient == WATCH_BASE_AMBIENT_STATE_LEAVE) { /* Exit the ambient mode */
 
                _watch_base_time_get_timeinfo(&timeinfo);
                __on_ambient_tick(&timeinfo, data);
@@ -436,8 +437,17 @@ static int __handling_ambient_mode(int ambient, void *data)
                        alarmmgr_remove_alarm(alarm_id);
                        alarm_id = 0;
                }
+       } else if (ambient == WATCH_BASE_AMBIENT_STATE_BLOCK_TICK) {
+               _W("Disable the alarm");
+               /* Disable alarm */
+               if (alarm_id) {
+                       alarmmgr_remove_alarm(alarm_id);
+                       alarm_id = 0;
+               }
+               __context.clock_tick_block = true;
        }
 
+
        if (timeinfo.timezone)
                free(timeinfo.timezone);
 
@@ -539,6 +549,11 @@ static void __vconf_time_changed_cb(keynode_t *key, void *data)
                .timezone = NULL
        };
 
+       if (__context.clock_tick_block) {
+               _W("clock tick blocked skip tick");
+               return;
+       }
+
        _D("ambient_mode check: %d", __context.ambient_mode);
        _watch_base_time_get_timeinfo(&timeinfo);
        if (__context.ambient_mode) {