[TSAM-8426] Fix share popup issue 92/93592/1
authorRavi Kiran K N <ravi.kiran@samsung.com>
Tue, 25 Oct 2016 05:08:47 +0000 (10:38 +0530)
committerRavi Kiran K N <ravi.kiran@samsung.com>
Tue, 25 Oct 2016 05:08:47 +0000 (10:38 +0530)
Hold the handle to app control service handle,
release it in playview cleanup

Change-Id: I32929a8394a4df55999c813d6647e0a5dc9693e3
Signed-off-by: Ravi Kiran K N <ravi.kiran@samsung.com>
playview/src/common/include/vp-play-ug.h
playview/src/common/vp-play-ug.c
playview/src/view/include/vp-play-view-priv.h
playview/src/view/vp-play-normal-view.c

index 476f521..40cc04b 100644 (file)
@@ -20,6 +20,6 @@
 #include <stdbool.h>
 #include <Elementary.h>
 
-bool vp_play_app_launch_share_panel(Evas_Object *pWin, const char *szMediaURL, void *pUserData);
+bool vp_play_app_launch_share_panel(Evas_Object *pWin, const char *szMediaURL, app_control_h *pServiceShare, void *pUserData);
 bool vp_play_app_launch_videos(Evas_Object *pWin, bool bRaise, void *pUserData);
 
index 6a66c6e..90fe8c5 100644 (file)
@@ -135,6 +135,7 @@ Execption:
 
 bool vp_play_app_launch_share_panel(Evas_Object *pWin,
                                     const char *szMediaURL,
+                                    app_control_h *pServiceShare,
                                     void *pUserData)
 {
        if (szMediaURL == NULL) {
@@ -142,22 +143,23 @@ bool vp_play_app_launch_share_panel(Evas_Object *pWin,
                return FALSE;
        }
 
-       app_control_h pService = NULL;
        char *szFileName = NULL;
 
        int nRet = 0;
-       nRet = app_control_create(&pService);
-       if (nRet != APP_CONTROL_ERROR_NONE) {
-               VideoLogError("app_control_create is fail [0x%x]", nRet);
-               goto Execption;
+       if (*pServiceShare == NULL) {
+               nRet = app_control_create(pServiceShare);
+               if (nRet != APP_CONTROL_ERROR_NONE) {
+                       VideoLogError("app_control_create is fail [0x%x]", nRet);
+                       goto Execption;
+               }
        }
 
-       nRet = app_control_set_operation(pService, VP_SHARE_OPERATION_SINGLE);
+       nRet = app_control_set_operation(*pServiceShare, VP_SHARE_OPERATION_SINGLE);
        if (nRet != APP_CONTROL_ERROR_NONE) {
                VideoLogError("app_control_add_extra_data is fail [0x%x]", nRet);
                goto Execption;
        }
-       nRet = app_control_add_extra_data(pService, "http://tizen.org/appcontrol/data/path", szMediaURL);
+       nRet = app_control_add_extra_data(*pServiceShare, "http://tizen.org/appcontrol/data/path", szMediaURL);
        if (nRet != APP_CONTROL_ERROR_NONE) {
                VideoLogError("app_control_add_extra_data is fail [0x%x]", nRet);
                goto Execption;
@@ -170,14 +172,14 @@ bool vp_play_app_launch_share_panel(Evas_Object *pWin,
 
        VideoSecureLogInfo("file : %s", szFileName);
 
-       nRet = app_control_set_uri(pService, szFileName);
+       nRet = app_control_set_uri(*pServiceShare, szFileName);
        if (nRet != APP_CONTROL_ERROR_NONE) {
                VideoLogError("app_control_add_extra_data is fail [0x%x]", nRet);
                goto Execption;
        }
 
        nRet =
-           app_control_send_launch_request(pService, __vp_play_ug_reply_cb,
+           app_control_send_launch_request(*pServiceShare, __vp_play_ug_reply_cb,
                                            pUserData);
        if (nRet != APP_CONTROL_ERROR_NONE) {
                VideoLogError("app_control_send_launch_request is fail [0x%x]",
@@ -186,17 +188,14 @@ bool vp_play_app_launch_share_panel(Evas_Object *pWin,
        }
        VP_FREE(szFileName);
 
-       app_control_destroy(pService);
-       pService = NULL;
-
        return TRUE;
 
 Execption:
        VP_FREE(szFileName);
 
-       if (pService) {
-               app_control_destroy(pService);
-               pService = NULL;
+       if (*pServiceShare) {
+               app_control_destroy(*pServiceShare);
+               *pServiceShare = NULL;
        }
        return FALSE;
 }
index 84fe31a..d05f0ec 100644 (file)
@@ -22,6 +22,7 @@
 #include <Elementary.h>
 #include <net_connection.h>
 #include <sound_manager.h>
+#include <app_control.h>
 
 #include "vp-play-view.h"
 #include "vp-play-type-define.h"
@@ -168,5 +169,6 @@ typedef struct _PlayView {
        bool lockmini_hide;
        bool b_lockmini_show;
 
+       app_control_h pServiceShare;
 } PlayView;
 
index 0a1fc99..dd003d8 100644 (file)
@@ -7181,6 +7181,21 @@ static Evas_Object *_vp_play_normal_view_create_image_sink(void *pParent, void *
 }
 #endif
 
+static bool _vp_play_normal_view_release_service_share(PlayView *pView)
+{
+       if(!pView)
+               return FALSE;
+
+       if (pView->pServiceShare) {
+               app_control_send_terminate_request(pView->pServiceShare);
+               app_control_destroy(pView->pServiceShare);
+               pView->pServiceShare = NULL;
+       }
+
+       return TRUE;
+}
+
+
 bool vp_play_normal_view_play_start(normal_view_handle pViewHandle)
 {
        if (!pViewHandle) {
@@ -7649,6 +7664,7 @@ static bool _vp_play_normal_view_play_start(NormalView *pNormalView, bool bCheck
                                                                                      pNormalView);
                                                evas_object_show(pNormalView->pPopup);
                                                pNormalView->bIsPopupShow = TRUE;
+                                               _vp_play_normal_view_release_service_share(pNormalView->pPlayView);
                                        }
                                }
                        }
@@ -8063,6 +8079,8 @@ static void _vp_play_normal_view_set_played_time(NormalView *pNormalView)
                        if (pPlayView->bViewChange == FALSE) {
                                if (vp_file_exists(pNormalView->szMediaURL)) {
                                        vp_play_config_set_preview_url_videos(pNormalView->szMediaURL);
+                               } else {
+                                       _vp_play_normal_view_release_service_share(pNormalView->pPlayView);
                                }
                        }
                        vp_play_preference_set_preview_audio_track(pNormalView->nDefaultAudioTrackIndex);
@@ -8417,7 +8435,7 @@ static void _vp_play_normal_view_on_share_popup(NormalView *pNormalView)
                //pNormalView->bManualPause = TRUE;
        }
 
-       if (vp_play_app_launch_share_panel(pPlayView->pWin, pNormalView->szMediaURL, (void *)pNormalView)) {
+       if (vp_play_app_launch_share_panel(pPlayView->pWin, pNormalView->szMediaURL, &pPlayView->pServiceShare, (void *)pNormalView)) {
                pNormalView->bSharepopup = TRUE;
 
        } else {
@@ -9833,6 +9851,8 @@ static void _vp_play_normal_view_on_detail_popup(NormalView *pNormalView)
 
        if (vp_file_exists((const char*)pNormalView->szMediaURL)) {
                pDetailInfo->szLocation = vp_dir_get((const char*)pNormalView->szMediaURL);
+       } else {
+               _vp_play_normal_view_release_service_share(pNormalView->pPlayView);
        }
 
        pNormalView->pDetailHandle = vp_detail_page_create((void *)pPlayView->pNaviframe,__vp_normal_detail_popup_close_cb, pDetailInfo);
@@ -13662,6 +13682,7 @@ void vp_play_normal_view_db_change(normal_view_handle pViewHandle)
                VideoSecureLogInfo("change == %d, %s, %s", pNormalView->nLaunchingType, pNormalView->szMediaURL, pVideoId);
                if (!vp_file_exists(pNormalView->szMediaURL) || !pVideoId) {
                        VideoLogError("current file is deleted");
+                       _vp_play_normal_view_release_service_share(pNormalView->pPlayView);
                        VP_FREE(pVideoId);
                        if (!pPlayView->pFunc) {
                                VideoLogError("pPlayView pFunc is NULL");