Removed Deprecated Telephony API's 93/133193/4
authorbhutani.92 <bhutani.92@samsung.com>
Fri, 9 Jun 2017 07:04:50 +0000 (12:34 +0530)
committerbhutani.92 <bhutani.92@samsung.com>
Mon, 12 Jun 2017 09:30:56 +0000 (15:00 +0530)
Change-Id: Ide0b0da95bff92258dc574832a075157533fc24b
Signed-off-by: bhutani.92 <bhutani.92@samsung.com>
playview/src/common/vp-play-config.c
playview/src/core/vp-sound.c
playview/src/view/include/vp-play-view-priv.h
playview/src/vp-play-view.c
src/common/mp-util.c

index f79560b..9d0f93d 100644 (file)
@@ -232,35 +232,37 @@ static void _call_async_event_callback(telephony_h handle,
        VideoLogDebug("call interrupt cb called");
 
        PlayView *pPlayView = (PlayView *) user_data;
-       int status = 0;
-       telephony_call_state_e voice_status;
-       telephony_call_state_e video_status;
+       int ret = TELEPHONY_ERROR_NONE;
+       telephony_call_h *call_list_sim;
+       telephony_call_status_e status;
+       telephony_call_type_e type;
+       telephony_error_e ret_sim;
+       unsigned int count_sim = 0;
 
        VideoLogDebug("getting call status");
 
-       status = telephony_call_get_voice_call_state(handle, &voice_status);
-
-       if (status != TELEPHONY_ERROR_NONE) {
-               VideoLogError("getting call status failed");
+       ret_sim =
+                       telephony_call_get_call_list(handle, &count_sim,
+                                       &call_list_sim);
+       if (ret_sim != TELEPHONY_ERROR_NONE) {
+               VideoLogError("Cannot get call list information for the sim");
                return;
        }
 
-       status = telephony_call_get_video_call_state(handle, &video_status);
-
-       if (status != TELEPHONY_ERROR_NONE) {
-               VideoLogError("getting video call status failed");
+       ret = telephony_call_get_status(*call_list_sim, &status);
+       if (ret != TELEPHONY_ERROR_NONE) {
+               VideoLogError("getting call status failed");
                return;
        }
-       VideoLogDebug("voice_status = %d", voice_status);
-       VideoLogDebug("video_status = %d", video_status);
+       VideoLogDebug("call status = %d", status);
 
-       if (voice_status != TELEPHONY_CALL_STATE_IDLE
-               || video_status != TELEPHONY_CALL_STATE_IDLE) {
+       telephony_call_release_call_list(count_sim, &call_list_sim);
+
+       if (status != TELEPHONY_CALL_STATE_IDLE) {
                if (!vp_play_normal_view_pause(pPlayView->pNormalView)) {
                        VideoLogError("vp_play_normal_view_pause fail");
                }
-       } else if (voice_status == TELEPHONY_CALL_STATE_IDLE
-                          && video_status == TELEPHONY_CALL_STATE_IDLE) {
+       } else if (status == TELEPHONY_CALL_STATE_IDLE) {
                bool bManualPause = FALSE;
                vp_play_normal_view_get_manual_pause(pPlayView->pNormalView,
                                                                                         &bManualPause);
@@ -286,27 +288,28 @@ bool vp_play_telephony_initialize(void *pUserData)
        }
 
        /*setting callbacks */
-       telephony_h *newhandle = tel_list.handle;
-       int api_err =
-               telephony_set_noti_cb(*newhandle, TELEPHONY_NOTI_VOICE_CALL_STATE,
-                                                         (telephony_noti_cb)
-                                                         _call_async_event_callback,
-                                                         (void *) pUserData);
-       if (api_err != TELEPHONY_ERROR_NONE) {
-               VideoLogError
-                       ("tel_register_noti_event for voice call failed ( api_err : %d ) !!",
-                        api_err);
-       }
+       for (int i=0;i<tel_list.count;i++) {
+               int api_err =
+                       telephony_set_noti_cb(tel_list.handle[i], TELEPHONY_NOTI_VOICE_CALL_STATE,
+                                                                 (telephony_noti_cb)
+                                                                 _call_async_event_callback,
+                                                                 (void *) pUserData);
+               if (api_err != TELEPHONY_ERROR_NONE) {
+                       VideoLogError
+                               ("tel_register_noti_event for voice call failed ( api_err : %d ) !!",
+                                api_err);
+               }
 
-       api_err =
-               telephony_set_noti_cb(*newhandle, TELEPHONY_NOTI_VIDEO_CALL_STATE,
-                                                         (telephony_noti_cb)
-                                                         _call_async_event_callback,
-                                                         (void *) pUserData);
-       if (api_err != TELEPHONY_ERROR_NONE) {
-               VideoLogError
-                       ("tel_register_noti_event for video call failed ( api_err : %d ) !!",
-                        api_err);
+               api_err =
+                       telephony_set_noti_cb(tel_list.handle[i], TELEPHONY_NOTI_VIDEO_CALL_STATE,
+                                                                 (telephony_noti_cb)
+                                                                 _call_async_event_callback,
+                                                                 (void *) pUserData);
+               if (api_err != TELEPHONY_ERROR_NONE) {
+                       VideoLogError
+                               ("tel_register_noti_event for video call failed ( api_err : %d ) !!",
+                                api_err);
+               }
        }
 
        return TRUE;
index 18cee08..ea05879 100644 (file)
@@ -350,11 +350,12 @@ bool vp_sound_set_route_change_cb(vp_sound_route_change_cb func,
 {
        int nRet = SOUND_MANAGER_ERROR_NONE;
 
+       PlayView *pPlayView = (PlayView *)pUserData;
        sound_device_mask_e g_device_mask = SOUND_DEVICE_IO_DIRECTION_OUT_MASK;
 
        nRet =
-               sound_manager_set_device_information_changed_cb(g_device_mask,
-                                                                                                               NULL, pUserData);
+                       sound_manager_add_device_state_changed_cb(g_device_mask,
+                                       NULL, pPlayView, &pPlayView->device_state_id);
        if (nRet != SOUND_MANAGER_ERROR_NONE) {
                VideoLogError("sound_manager_set_available_route_changed_cb fail");
                return FALSE;
index f607c41..2ef3a9b 100644 (file)
@@ -173,4 +173,6 @@ typedef struct _PlayView {
        bool b_lockmini_show;
        bool isLiveStreaming;
        app_control_h pServiceShare;
+
+       int device_state_id;
 } PlayView;
index 7003757..31d34a8 100644 (file)
@@ -2000,6 +2000,12 @@ bool vp_play_view_unrealize(play_view_handle pViewHandle)
                                VideoLogError("failed to release focus error[%x]", error);
                        }
                }
+
+               error = sound_manager_remove_device_state_changed_cb(pPlayView->device_state_id);
+               if (error != SOUND_MANAGER_ERROR_NONE) {
+                       VideoLogError("Cannot remove device state changed callback");
+               }
+
                media_key_release();
                int nDuration = 0;
                if (vp_play_normal_view_get_video_duration
index 01d79e5..05c909f 100644 (file)
@@ -681,6 +681,11 @@ bool mp_util_remove_all_videos_question_popup(void *pUserData,
 
        tmpTitle = g_strdup_printf(VIDEOS_DELETEPOP_HEADER_DELETE);
        elm_object_part_text_set(pPopUpHandle, "title,text", tmpTitle);
+       if (tmpTitle) {
+               free(tmpTitle);
+               tmpTitle = NULL;
+
+       }
 
        if (viewType == MP_LIST_VIEW_AS_FOLDER_LIST) {
                VideoLogInfo("All folders are selected to delete");
@@ -695,6 +700,10 @@ bool mp_util_remove_all_videos_question_popup(void *pUserData,
        }
 
        elm_object_part_text_set(pPopUpHandle, "default", tmpStr);
+       if (tmpStr) {
+               free(tmpStr);
+               tmpStr = NULL;
+       }
 
        pButton = elm_button_add(pPopUpHandle);
        elm_object_domain_translatable_text_set(pButton, VIDEOS_STRING,
@@ -763,6 +772,10 @@ bool mp_util_remove_question_popup(int pUserData,
 
        tmpTitle = g_strdup_printf(VIDEOS_DELETEPOP_HEADER_DELETE);
        elm_object_part_text_set(pPopUpHandle, "title,text", tmpTitle);
+       if (tmpTitle) {
+               free(tmpTitle);
+               tmpTitle = NULL;
+       }
 
        if (nSelected < -1) {           /* select videos */
                if (viewType == MP_LIST_VIEW_AS_FOLDER_LIST) {
@@ -795,6 +808,10 @@ bool mp_util_remove_question_popup(int pUserData,
                }
        }
        elm_object_part_text_set(pPopUpHandle, "default", tmpStr);
+       if (tmpStr) {
+               free(tmpStr);
+               tmpStr = NULL;
+       }
 
        pButton = elm_button_add(pPopUpHandle);
        elm_object_domain_translatable_text_set(pButton, VIDEOS_STRING,
@@ -1109,8 +1126,13 @@ void *mp_util_create_style_button(void *pParent, const char *szButtonText,
 
 bool mp_util_call_off(void)
 {
-       telephony_call_state_e state = TELEPHONY_CALL_STATE_IDLE;
        telephony_handle_list_s tel_list;
+       telephony_call_h *call_list_sim;
+       telephony_call_status_e status = TELEPHONY_CALL_STATE_IDLE;
+       telephony_call_type_e type;
+       unsigned int count_sim[2] = {0};
+       int ret = TELEPHONY_ERROR_NONE;
+
        int tel_valid = telephony_init(&tel_list);
        if (tel_valid != TELEPHONY_ERROR_NONE) {
                VideoLogError("telephony is not initialized. ERROR Code is %d",
@@ -1118,19 +1140,32 @@ bool mp_util_call_off(void)
                return TRUE;
        }
 
-       telephony_h *newhandle = tel_list.handle;
-       int s = telephony_call_get_voice_call_state(*newhandle, &state);
-       telephony_deinit(&tel_list);
+       for (int i=0;i<tel_list.count;i++) {
+               ret =
+                               telephony_call_get_call_list(tel_list.handle[i], &count_sim[i],
+                                               &call_list_sim);
+               if (ret != TELEPHONY_ERROR_NONE) {
+                       VideoLogError("Cannot get call list information for the sim");
+                       return TRUE;
+               }
 
-       if (s == TELEPHONY_ERROR_NONE) {
-               if (state == TELEPHONY_CALL_STATE_IDLE) {
+               ret = telephony_call_get_status(*call_list_sim, &status);
+               if (ret != TELEPHONY_ERROR_NONE) {
+                       VideoLogError("getting call status failed");
                        return TRUE;
-               } else {
+               }
+               VideoLogDebug("call status = %d", status);
+
+               telephony_call_release_call_list(count_sim[i], &call_list_sim);
+       }
+       telephony_deinit(&tel_list);
+
+       if (ret == TELEPHONY_ERROR_NONE) {
+               if (status != TELEPHONY_CALL_STATE_IDLE) {
                        return FALSE;
                }
-       } else {
-               VideoLogError("ERROR: state error is %d", s);
        }
+
        return TRUE;
 }