Delays to call tune after tv service resume 96/47696/2
authorjinwoo.shin <jw0227.shin@samsung.com>
Tue, 8 Sep 2015 05:36:23 +0000 (14:36 +0900)
committerjinwoo.shin <jw0227.shin@samsung.com>
Tue, 8 Sep 2015 07:55:04 +0000 (16:55 +0900)
Change-Id: Id9c9c4c10f5955ff2d70c48eba804cc09c9dd3df
Signed-off-by: jinwoo.shin <jw0227.shin@samsung.com>
src/main.c
src/view_pin.c

index b400730..324e5d3 100644 (file)
@@ -41,6 +41,7 @@ struct _appdata {
        tzsh_h tzsh;
        tzsh_tvsrv_h ta;
        Ecore_Timer *pause_timer;
+       int service_id;
 
        int is_signal;
        int is_channel;
@@ -273,14 +274,30 @@ static void _resume(void *data)
        r = tv_resume();
        if (r < 0) {
                _ERR("Resume tv service failed");
+               ui_app_exit();
+
                return;
-       } else if (r > 0) {
-               r = tv_channel_tune();
-               if (r < 0) {
-                       _ERR("Tune channel failed");
+       }
+
+       /* Try to tune with service id if supplied from app control */
+       if (ad->service_id > 0) {
+               r = tv_channel_tune_with_service_id(ad->service_id);
+               ad->service_id = 0;
+
+               if (!r) {
+                       ad->is_channel = true;
                        return;
                }
        }
+
+       r = tv_channel_tune();
+       if (r < 0) {
+               ad->is_channel = false;
+               viewmgr_show_view(VIEW_ERROR);
+               viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOCHANNEL, NULL);
+       } else {
+               ad->is_channel = true;
+       }
 }
 
 static bool _create(void *data)
@@ -409,25 +426,11 @@ static void _control(app_control_h control, void *data)
        ad = data;
 
        r = app_control_get_extra_data(control, KEY_SVCID, &svcid);
-       if (r == SERVICE_ERROR_NONE) {
-               r = tv_channel_tune_with_service_id(atoll(svcid));
-               free(svcid);
-               if (!r) {
-                       ad->is_channel = true;
-                       viewmgr_show_view(VIEW_CHANNELINFO);
-                       return;
-               }
-       }
-
-       r = tv_channel_tune();
+       if (r != SERVICE_ERROR_NONE)
+               return;
 
-       if (r < 0) {
-               ad->is_channel = false;
-               viewmgr_show_view(VIEW_ERROR);
-               viewmgr_update_view(VIEW_ERROR, UPDATE_TYPE_NOCHANNEL, NULL);
-       } else {
-               ad->is_channel = true;
-       }
+       ad->service_id = atoll(svcid);
+       free(svcid);
 }
 
 int main(int argc, char *argv[])
index bab97bc..b91800e 100644 (file)
@@ -53,7 +53,7 @@ static void _send_message(struct _priv *priv, const char *result)
        service_destroy(service);
 }
 
-static void _check_pincode(struct _priv *priv, const char *pincode)
+static void _check_pincode(struct _priv *priv, char *pincode)
 {
        const struct tv_channel_info *channel_info;
        int r;