Timer: Fixed screen flicker during launching of timer alert. 29/88729/1 submit/tizen/20160920.140803
authorIrfan Abdul <irfan.abdul@samsung.com>
Tue, 20 Sep 2016 10:36:51 +0000 (16:06 +0530)
committerIrfan Abdul <irfan.abdul@samsung.com>
Tue, 20 Sep 2016 10:36:51 +0000 (16:06 +0530)
Change-Id: Idf6425ff57f8661cd41b7e34ea0ee6d8d14557ff

src/main.c
timer_alert/src/ring.c
tizen-manifest.xml

index f967a53e0f392266b1ed3a92d661a72d56534f7d..cc4afbd4365fe69de556f055bfd82012ae6be6f1 100755 (executable)
@@ -21,6 +21,7 @@
 #include "log.h"
 #include "timer_util.h"
 #include <device/power.h>
+#include <device/display.h>
 #include <sound_manager.h>
 #include <app_preference.h>
 #include <app_alarm.h>
@@ -250,19 +251,6 @@ static Eina_Bool _tmr_view_change_to_timeset_cb(void *data)
        _tmr_timepicker_time_update(ad);
        edje_object_signal_emit(_EDJ(ad->progress), "default", "");
 
-       app_control_h app_control = NULL;
-       int ret = -1;
-
-       app_control_create(&app_control);
-       app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
-       app_control_set_app_id(app_control, "org.tizen.timer.alert");
-       app_control_add_extra_data(app_control, "type", "timer");
-       ret = app_control_send_launch_request(app_control, NULL, NULL);
-       if (ret != 0)
-               TMR_ERR("ret = %d, launch request is failed", ret);
-
-       app_control_destroy(app_control);
-
        TMR_INFO("progressbar hide");
        return ECORE_CALLBACK_CANCEL;
 }
@@ -860,6 +848,31 @@ void _tmr_btn_update(struct appdata *ad)
 
 }
 
+void _launch_alert()
+{
+       _TMR_ENTER_;
+       app_control_h app_control = NULL;
+       int ret = -1;
+       display_state_e state;
+       ret = device_display_get_state(&state);
+       TMR_INFO("display status state: %d and ret:%d", state, ret);
+       if(state == DISPLAY_STATE_SCREEN_OFF || state == DISPLAY_STATE_SCREEN_DIM) {
+               ret = device_display_change_state(DISPLAY_STATE_NORMAL);
+               TMR_INFO("set display status to normal: ret:%d", ret);
+       }
+       //int ret = device_power_wakeup(false);
+       app_control_create(&app_control);
+       app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
+       app_control_set_app_id(app_control, "org.tizen.timer.alert");
+       app_control_add_extra_data(app_control, "type", "timer");
+       ret = app_control_send_launch_request(app_control, NULL, NULL);
+       if (ret != 0)
+               TMR_ERR("ret = %d, launch request is failed", ret);
+
+       app_control_destroy(app_control);
+
+}
+
 static Eina_Bool _tmr_timer_cb(void *data)
 {
        _TMR_ENTER_;
@@ -894,6 +907,7 @@ static Eina_Bool _tmr_timer_cb(void *data)
                ad->due_time.tv_sec = -1;
                _tmr_panel_time_update(ad);
 
+               _launch_alert();
                ecore_timer_add(1.5, _tmr_view_change_to_timeset_cb, ad);
 
                return ECORE_CALLBACK_CANCEL;
@@ -1571,7 +1585,7 @@ static void app_pause(void *data)
        _TMR_ENTER_;
        struct appdata *ad = (struct appdata *)data;
        if (ad->cur_state == TMR_STATE_TYPE_START) {
-               ecore_timer_freeze(ad->timer);
+               //ecore_timer_freeze(ad->timer);
                _tmr_pm_state_set(EINA_FALSE);
        } else if (ad->cur_state == TMR_STATE_TYPE_RESET) {
                _tmr_set_start_time(ad);
@@ -1618,7 +1632,7 @@ static void app_resume(void *data)
                        _tmr_view_change_to_timeset_cb(ad);
                } else {
                        elm_scroller_page_show(ad->scroller, 0, 1);
-                       ecore_timer_thaw(ad->timer);
+                       //ecore_timer_thaw(ad->timer);
                        _tmr_pm_state_set(EINA_TRUE);
                }
        } else if (ad->cur_state == TMR_STATE_TYPE_RESET) {
index 858a75bc971755f76904b2a21381d8270732f7ae..0e58e60148a8e6df8cc1d63028fce24ababf85a3 100755 (executable)
@@ -18,6 +18,8 @@
 #include "ring.h"
 #include "sound.h"
 #include "app_alarm.h"
+#include <device/power.h>
+#include <sound_manager.h>
 
 
 typedef struct appdata {
@@ -29,6 +31,21 @@ typedef struct appdata {
 
 Ecore_Timer *timer =  NULL;
 int delay_count = 0;
+
+static void _ring_pm_state_set(Eina_Bool isLock)
+{
+       dlog_print(DLOG_INFO, LOG_TAG, "_ring_pm_state_set");
+       int ret = 0;
+       if (isLock == EINA_TRUE) {
+               ret = device_power_request_lock(POWER_LOCK_DISPLAY_DIM, 0);
+               dlog_print(DLOG_INFO, LOG_TAG, "Lock display state :: ret = %d", ret);
+       } else {
+               ret = device_power_release_lock(POWER_LOCK_DISPLAY_DIM);
+               dlog_print(DLOG_INFO, LOG_TAG, "Unlock display state :: ret = %d", ret);
+       }
+}
+
+
 void data_get_resource_path(const char *file_in, char *file_path_out, int file_path_max)
 {
        char *res_path = app_get_resource_path();
@@ -41,6 +58,7 @@ void data_get_resource_path(const char *file_in, char *file_path_out, int file_p
 static void
 win_delete_request_cb(void *data, Evas_Object *obj, void *event_info)
 {
+       _ring_pm_state_set(EINA_FALSE);
        ui_app_exit();
 }
 
@@ -244,6 +262,7 @@ app_control(app_control_h app_control, void *data)
 {
        /* Handle the launch request. */
        appdata_s *ad = data;
+       _ring_pm_state_set(EINA_TRUE);
        dlog_print(DLOG_INFO, LOG_TAG, "app_control >>");
 
        ring_view_add_by_timer(ad->nf);
@@ -254,12 +273,14 @@ static void
 app_pause(void *data)
 {
        /* Take necessary actions when application becomes invisible. */
+       _ring_pm_state_set(EINA_FALSE);
 }
 
 static void
 app_resume(void *data)
 {
        /* Take necessary actions when application becomes visible. */
+       _ring_pm_state_set(EINA_TRUE);
 }
 
 static void
index f36a0832f62d6c6302cd5b0b0e68de624cb961cd..d4df4b669b80f06f3688f8abce35a620e8d136ed 100755 (executable)
@@ -7,5 +7,6 @@
     </ui-application>
     <privileges>
         <privilege>http://tizen.org/privilege/appmanager.launch</privilege>
+        <privilege>http://tizen.org/privilege/display</privilege>
     </privileges>
 </manifest>