Add aod notified event 06/229606/2
authorhyunho <hhstark.kang@samsung.com>
Thu, 2 Apr 2020 07:46:12 +0000 (16:46 +0900)
committerhyunho <hhstark.kang@samsung.com>
Thu, 2 Apr 2020 07:48:33 +0000 (16:48 +0900)
Change-Id: I802f58a1d98b29585f934991e4cf03d39e32a647
Signed-off-by: hyunho <hhstark.kang@samsung.com>
include/watch_app_internal.h
include/watch_base.h
src/base/watch_base.c

index 7a9d449..657ca4b 100644 (file)
@@ -30,7 +30,8 @@ extern "C" {
  */
 typedef enum {
        WATCH_APP_AMBIENT_EVENT_PREPARE,
-       WATCH_APP_AMBIENT_EVENT_READY
+       WATCH_APP_AMBIENT_EVENT_READY,
+       WATCH_APP_AMBIENT_EVENT_NOTIFIED
 } watch_app_ambient_event_e;
 
 /**
index a6845cd..2b24a22 100755 (executable)
@@ -105,7 +105,7 @@ typedef enum {
 typedef enum {
        WATCH_BASE_AMBIENT_EVENT_PREPARE,
        WATCH_BASE_AMBIENT_EVENT_READY,
-       WATCH_BASE_AMBIENT_EVENT_CHANGED
+       WATCH_BASE_AMBIENT_EVENT_NOTIFIED
 } watch_base_ambient_event_e;
 
 int watch_base_set_ambient_tick_type(watch_base_ambient_tick_type_e type);
index 02fd6a4..76461c8 100755 (executable)
@@ -395,18 +395,13 @@ static int __set_ambient_tick_cb(void *data)
 /* LCOV_EXCL_STOP */
 
 /* LCOV_EXCL_START */
-static int __signal_alpm_handler(int ambient, void *data)
+static int __handling_ambient_mode(int ambient, void *data)
 {
+       _I("_handling ambient event: (ambient: %d)", ambient);
        struct _watch_base_time_s timeinfo = {
                .timezone = NULL
        };
 
-       _D("_signal_alpm_handler: ambient: %d", ambient);
-       if (__context.ambient_mode == ambient) {
-               _E("invalid state");
-               return 0;
-       }
-
        /* Enter the ambient mode */
        if (ambient) {
                if (appcore_ui_base_is_resumed()) {
@@ -425,6 +420,8 @@ static int __signal_alpm_handler(int ambient, void *data)
                        __set_ambient_tick_cb(data);
 
                /* Send a update done signal */
+               watch_base_ambient_notify_event(
+                       WATCH_BASE_AMBIENT_EVENT_NOTIFIED, NULL);
                _watch_base_signal_send_alpm_update_done();
        } else { /* Exit the ambient mode */
 
@@ -454,6 +451,16 @@ static int __signal_alpm_handler(int ambient, void *data)
 
        return 0;
 }
+
+static int __signal_alpm_handler(int ambient, void *data)
+{
+       _D("_signal_alpm_handler: ambient: %d", ambient);
+       if (__context.ambient_mode == ambient) {
+               _E("invalid state");
+               return 0;
+       }
+       return __handling_ambient_mode(ambient, data);
+}
 /* LCOV_EXCL_STOP */
 
 static Eina_Bool __time_tick_cb(void *data)
@@ -565,18 +572,12 @@ int __on_change_signal(const char *endpoint, aul_app_com_result_e e,
 {
        char *extra;
        char *mode;
-       watch_base_ambient_changed_cb ambient_changed_cb;
 
        _W("__on_change_signal");
-
        bundle_get_str(envelope, "__AMBIENT_MODE__", &mode);
        bundle_get_str(envelope, "__AMBIENT_EXTRA__", &extra);
        __context.extra = bundle_decode((bundle_raw *)extra, strlen(extra));
-
-       ambient_changed_cb = __context.callback.ambient_changed;
-
-       if (ambient_changed_cb != NULL)
-               ambient_changed_cb((bool)atoi(mode), __context.data);
+       __handling_ambient_mode(atoi(mode), NULL);
 
        return 0;
 }