Revert "Revert "Remove pre-resume, viewer visibility"" 72/229572/2
authorHyunho Kang <hhstark.kang@samsung.com>
Thu, 2 Apr 2020 04:48:36 +0000 (04:48 +0000)
committerHyunho Kang <hhstark.kang@samsung.com>
Wed, 8 Apr 2020 00:58:02 +0000 (00:58 +0000)
This reverts commit e629ee1093d7aacde28b0deec24d7b281dba3b5c.

Change-Id: Ibba9423456f4d6b874e9a637d64056129f53b51c

src/base/watch_base.c
src/base/watch_base_signal.c
src/base/watch_base_signal.h

index 7f72822..d75e059 100755 (executable)
@@ -88,7 +88,6 @@ static watch_base_ambient_tick_type_e ambient_tick_type
 static watch_base_time_tick_resolution_e app_tick_type
                = WATCH_BASE_TIME_TICKS_PER_SECOND;
 static int app_tick_resolution = 1;
-static aul_app_com_connection_h __conn_viewer_state;
 
 struct app_event_handler {
        app_event_type_e type;
@@ -109,7 +108,6 @@ struct watch_base_context {
        int width;
        int height;
        enum watch_visible_state watch_visibility;
-       int viewer_visibility;
        bool ambient_mode;
        bool ambient_mode_skip_resume;
        bool bg_launch;
@@ -701,11 +699,6 @@ static void __on_base_preresume(void *data)
 static int __on_ui_base_resume(void *data)
 {
        _W("_watch_base_signal_resume");
-       if (__context.viewer_visibility != AUL_SCREEN_STATUS_RESUME) {
-               _D("Viewer is paused, do not resume watch");
-               return APP_ERROR_NONE;
-       }
-
        if (__context.ambient_mode) {
                __context.ambient_mode_skip_resume = false;
                return 0;
@@ -798,15 +791,11 @@ static void __on_window_show(int type, void *event, void *data)
 {
        LOGW("on window show bg_launch(%d)", __context.bg_launch);
        appcore_ui_base_window_on_show(type, event);
-       if (__context.viewer_visibility == AUL_SCREEN_STATUS_RESUME) {
-               if (__context.bg_launch) {
-                       appcore_ui_base_resume();
-                       appcore_ui_base_pause();
-               } else {
-                       appcore_ui_base_resume();
-               }
+       if (__context.bg_launch) {
+               appcore_ui_base_resume();
+               appcore_ui_base_pause();
        } else {
-               _D("viewer is not resumed, do not resume watch");
+               appcore_ui_base_resume();
        }
 }
 
@@ -849,12 +838,8 @@ static void __on_window_visibility(int type, void *event, void *data)
        } else {
                __context.watch_visibility = WVS_RESUME;
                __context.bg_launch = false;
-               if (__context.viewer_visibility == AUL_SCREEN_STATUS_RESUME) {
-                       __remove_pause_timer();
-                       __on_ui_base_resume(NULL);
-               } else {
-                       _D("Viewer is paused, do not resume watch");
-               }
+               __remove_pause_timer();
+               __on_ui_base_resume(NULL);
        }
 }
 
@@ -913,53 +898,6 @@ static int __get_time_tick_frequency(int *ticks, watch_base_time_tick_resolution
        return 0;
 }
 
-static int __viewer_state_handler(const char *widget_id, aul_app_com_result_e e,
-               bundle *envelope, void *user_data)
-{
-       int *state = NULL;
-       size_t state_sz = 0;
-       struct _watch_base_time_s timeinfo = {
-               .timezone = NULL
-       };
-
-       bundle_get_byte(envelope, "__AUL_SC_VIEWER_STATUS__", (void **)&state,
-                       &state_sz);
-       if (state == NULL) {
-               _E("Failed to get viewer status");
-               return -1;
-       }
-
-       _D("receive viewer state %d", *state);
-       if (*state != AUL_SCREEN_STATUS_PRE_RESUME) {
-               __context.viewer_visibility = *state;
-               _D("set viewer state to %d", *state);
-       }
-
-       if (*state == AUL_SCREEN_STATUS_RESUME &&
-                       __context.watch_visibility == WVS_RESUME) {
-               __remove_pause_timer();
-               __on_ui_base_resume(NULL);
-       } else if (*state == AUL_SCREEN_STATUS_PAUSE) {
-               __add_pause_timer();
-       } else if (*state == AUL_SCREEN_STATUS_PRE_RESUME) {
-               __remove_pause_timer();
-               _D("call pre resume tick");
-               __on_pre_resume(NULL);
-       }
-
-       if (timeinfo.timezone)
-               free(timeinfo.timezone);
-
-       return 0;
-}
-
-static void __lcd_on_handler(void *user_data)
-{
-       _D("Call pre resume tick");
-       __remove_pause_timer();
-       __on_pre_resume(NULL);
-}
-
 EXPORT_API void watch_base_on_create(int width, int height)
 {
        _W("watch_base_on_create");
@@ -1051,7 +989,6 @@ EXPORT_API watch_base_ops watch_base_get_default_ops(void)
 EXPORT_API int watch_base_init(int argc, char **argv,
                watch_base_ops *callback, void *user_data)
 {
-       int ret;
        bundle *kb;
        char *width_str = NULL;
        char *height_str = NULL;
@@ -1060,7 +997,6 @@ EXPORT_API int watch_base_init(int argc, char **argv,
        int width = 360;
        int height = 360;
        appcore_ui_base_ops ops = appcore_ui_base_get_default_ops();
-       char *viewer_visibility_str = NULL;
 
        if (!watch_base_check_feature())
                return APP_ERROR_NOT_SUPPORTED;
@@ -1108,8 +1044,6 @@ EXPORT_API int watch_base_init(int argc, char **argv,
        if (kb) {
                bundle_get_str(kb, "WATCH_WIDTH", &width_str);
                bundle_get_str(kb, "WATCH_HEIGHT", &height_str);
-               bundle_get_str(kb, "WATCH_VIEWER_VISIBILITY",
-                               &viewer_visibility_str);
                bundle_get_str(kb, "WATCH_BG_LAUNCH", &bg_launch_str);
 
                if (width_str)
@@ -1118,11 +1052,6 @@ EXPORT_API int watch_base_init(int argc, char **argv,
                if (height_str)
                        height = atoi(height_str);
 
-               if (viewer_visibility_str) {
-                       __context.viewer_visibility =
-                                       atoi(viewer_visibility_str);
-               }
-
                if (bg_launch_str)
                        bg_launch = atoi(bg_launch_str);
 
@@ -1131,15 +1060,6 @@ EXPORT_API int watch_base_init(int argc, char **argv,
                _E("failed to get launch argv");
        }
 
-       ret = aul_app_com_create(__context.appid, NULL, __viewer_state_handler,
-                       NULL, &__conn_viewer_state);
-       if (ret < 0) {
-               free(__context.appid);
-               __context.appid = NULL;
-               return watch_base_set_error(APP_ERROR_INVALID_CONTEXT,
-                               __FUNCTION__, "Failed to create app com");
-       }
-
        __context.callback = *callback;
        __context.bg_launch = bg_launch;
        __context.width = width;
@@ -1150,7 +1070,6 @@ EXPORT_API int watch_base_init(int argc, char **argv,
        __context.data = user_data;
        __context.state = WATCH_BASE_STATE_CREATING;
        __context.extra = NULL;
-       _watch_base_signal_listen_lcd_status_signal(__lcd_on_handler, NULL);
 
        return appcore_ui_base_init(ops, argc, argv, NULL, 0);
 }
@@ -1160,9 +1079,6 @@ EXPORT_API void watch_base_fini(void)
        __unset_ambient_changed_cb();
        free(__context.appid);
        __context.appid = NULL;
-       aul_app_com_leave(__conn_viewer_state);
-       __conn_viewer_state = NULL;
-       _watch_base_signal_ignore_lcd_status_signal();
        appcore_ui_base_fini();
        __context.state = WATCH_BASE_STATE_NOT_RUNNING;
 }
index dbc5b78..ee072d6 100755 (executable)
 #define CLOCK_START "clockbegin"
 #define CLOCK_STOP "clockstop"
 
-#define DEVICED_PATH_DISPLAY            "/Org/Tizen/System/DeviceD/Display"
-#define DEVICED_INTERFACE_DISPLAY       "org.tizen.system.deviced.display"
-#define LCD_ON                         "LCDOn"
-
 static GDBusConnection *conn;
 static unsigned int __conn_ref;
 static guint s_id;
 static int (*_deviced_signal_alpm_handler)(int ambient, void *data);
 static void *_deviced_signal_alpm_data;
-static guint __lcd_sid;
-static void (*__deviced_signal_lcd_handler)(void *data);
-static void *__deviced_signal_lcd_data;
 
 /* LCOV_EXCL_START */
 static void __dbus_signal_filter(GDBusConnection *connection,
@@ -186,61 +179,3 @@ int _watch_base_signal_send_alpm_update_done(void)
        return 0;
 }
 /* LCOV_EXCL_STOP */
-
-/* LCOV_EXCL_START */
-static void __lcd_on_signal_handler(GDBusConnection *connection,
-               const gchar *sender_name,
-               const gchar *object_path,
-               const gchar *interface_name,
-               const gchar *signal_name,
-               GVariant *parameters,
-               gpointer user_data)
-{
-       _I("LCD ON");
-       if (__deviced_signal_lcd_handler)
-               __deviced_signal_lcd_handler(__deviced_signal_lcd_data);
-}
-/* LCOV_EXCL_STOP */
-
-int _watch_base_signal_listen_lcd_status_signal(void (*func)(void *), void *data)
-{
-       if (__dbus_init() < 0)
-               return -1;
-
-       __lcd_sid = g_dbus_connection_signal_subscribe(conn,
-                       NULL,
-                       DEVICED_INTERFACE_DISPLAY,
-                       LCD_ON,
-                       DEVICED_PATH_DISPLAY,
-                       NULL,
-                       G_DBUS_SIGNAL_FLAGS_NONE,
-                       __lcd_on_signal_handler,
-                       NULL,
-                       NULL);
-       if (!__lcd_sid) {
-               _E("Failed to subscribe LCD status signal");
-               return -1;
-       }
-
-       __deviced_signal_lcd_handler = func;
-       __deviced_signal_lcd_data = data;
-
-       _D("Listen LCD status signal");
-
-       return 0;
-}
-
-void _watch_base_signal_ignore_lcd_status_signal(void)
-{
-       __deviced_signal_lcd_handler = NULL;
-       __deviced_signal_lcd_data = NULL;
-
-       if (__lcd_sid) {
-               g_dbus_connection_signal_unsubscribe(conn, __lcd_sid);
-               __lcd_sid = 0;
-       }
-
-       __dbus_fini();
-
-       _D("Ignore LCD status signal");
-}
index 8503a40..d171535 100755 (executable)
@@ -23,8 +23,6 @@ extern "C" {
 
 int _watch_base_signal_listen_alpm_handler(int (*func)(int, void *), void *data);
 int _watch_base_signal_send_alpm_update_done(void);
-int _watch_base_signal_listen_lcd_status_signal(void (*func)(void *), void *data);
-void _watch_base_signal_ignore_lcd_status_signal(void);
 
 #ifdef __cplusplus
 }