tizen2.1 code merge
[apps/osp/Call.git] / src / CallTelephonyManager.cpp
index 8e0d355..0a98f23 100644 (file)
@@ -1,7 +1,7 @@
 //
 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
 //
-// Licensed under the Flora License, Version 1.0 (the License);
+// Licensed under the Flora License, Version 1.1 (the License);
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
@@ -554,7 +554,7 @@ TelephonyManager::AcceptSecondCall(CallAnsweringOptions answerOptions, const int
                //Call connected successfully
                r = E_SUCCESS;
                //Add calls information to call log before deleting from active call list.
-               IListT<AppCallInfo>* pCallList = pEndCallsList->GetValuesN();
+               /*IListT<AppCallInfo>* pCallList = pEndCallsList->GetValuesN();
                if(pCallList != null)
                {
                        AppCallInfo endCallInfo;
@@ -563,7 +563,7 @@ TelephonyManager::AcceptSecondCall(CallAnsweringOptions answerOptions, const int
                                SaveCallInfoToLogsDb(endCallInfo);
                        }
                        delete pCallList;
-               }
+               }*/
                pEndCallsList->RemoveAll();
                delete pEndCallsList;
        }
@@ -612,7 +612,7 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                //Incoming Call connected successfully
                r = E_SUCCESS;
                //save to ended call to call logs db.
-               SaveCallInfoToLogsDb(callToBeEnded);
+               //SaveCallInfoToLogsDb(callToBeEnded);
        }
        break;
 
@@ -667,7 +667,7 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                        break;
                }
                //"Held" call successfully ended - Add call ended to call log database
-               SaveCallInfoToLogsDb(callToBeEnded);
+               //SaveCallInfoToLogsDb(callToBeEnded);
 
                //accept incoming call by Holding "Active" call using "TAPI_CALL_ANSWER_HOLD_AND_ACCEPT".
                res = tel_answer_call(__pTapiHandle, incomingCallHandle, TAPI_CALL_ANSWER_HOLD_AND_ACCEPT, &HandleCallbackResponse, this);
@@ -722,7 +722,7 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                IListT<AppCallInfo>* pCallList = pEndCallsList->GetValuesN();
                if(pCallList != null)
                {
-                       int callCount = pCallList->GetCount();
+/*                     int callCount = pCallList->GetCount();
                        for (int index = 0; index < callCount; index++)
                        {
                                AppCallInfo endCallInfo;
@@ -730,7 +730,7 @@ TelephonyManager::AcceptMultipleCall(CallAnsweringOptions answerOptions, const i
                                {
                                        SaveCallInfoToLogsDb(endCallInfo);
                                }
-                       }
+                       }*/
                        delete pCallList;
                        pCallList = null;
                }
@@ -1560,7 +1560,7 @@ TelephonyManager::HandleParticipantEndedFromConference(unsigned int participantC
                        conferenceCall.RemoveCallFromCallerList(index);
                        //update its status to individual call before saving to database
                        callToBeEnded.SetConference(false);
-                       SaveCallInfoToLogsDb(callToBeEnded);
+               //      SaveCallInfoToLogsDb(callToBeEnded);
                        isParticipantCallEnded = true;
                        break;
                }
@@ -1773,7 +1773,7 @@ TelephonyManager::HandleEndConferenceCallbackResponse(TapiHandle* pHandle, int c
                //remove the conference call handle from active call list to avoid any processing in HandleIdleCallback().
                pTelManager->__pActiveCallList->Remove(endConfCallInfo.GetCallHandle()->ToLong());
                //Save "End" Conf. call info to call log database
-               pTelManager->SaveCallInfoToLogsDb(endConfCallInfo);
+       //      pTelManager->SaveCallInfoToLogsDb(endConfCallInfo);
 
                //check if the ended call was the last call and show notification to user
                bool isLastCall = (pTelManager->__pActiveCallList->GetCount() == 0);
@@ -1784,7 +1784,9 @@ TelephonyManager::HandleEndConferenceCallbackResponse(TapiHandle* pHandle, int c
                        //stop sound session
                        pTelManager->__pSoundManager->StopSession();
                        //send empty call list to show dialer or call log screen
-                       pCallList = new (std::nothrow) ArrayListT<AppCallInfo>();
+                       pCallList =new (std::nothrow) ArrayListT<AppCallInfo>();
+                       pCallList->Construct(1);
+                       pCallList->Add(endConfCallInfo);
                }
                else
                {
@@ -1819,10 +1821,7 @@ TelephonyManager::HandleIdleCallBack(void* pData)
        //2) an "unconnected" dialed call is ended by caller or other party.
        //3) Any normal active calls(NOT conference calls) ended by user or by other party.
 
-       if(__pSoundManager->GetLastConferenceCall() == false)
-       {
-               __pSoundManager->SetDisconnectTone();
-       }
+
 
        TelCallStatusIdleNoti_t idleNotification;
        memcpy(&idleNotification, pData, sizeof(TelCallStatusIdleNoti_t));
@@ -1837,7 +1836,10 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                AppLogDebug("EXIT - no calls exist");
                return;
        }
-
+       if(__pSoundManager->GetLastConferenceCall() == false)
+       {
+               __pSoundManager->SetDisconnectTone();
+       }
        //Check if ended call was among conference caller list,
        //then divert event to "HandleParticipantEndedFromConference()"
        AppCallInfo confCallInfo;
@@ -1906,9 +1908,11 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                        __pIncomingCall = null;
                        //update missed status
                        endCallInfo.SetCalllogType(CALL_LOG_TYPE_VOICE_MISSED_UNSEEN);
+                       //save ended call to call log db.
+                       SaveCallInfoToLogsDb(endCallInfo);
                }
-               //save ended call to call log db.
-               SaveCallInfoToLogsDb(endCallInfo);
+               /*//save ended call to call log db.
+               SaveCallInfoToLogsDb(endCallInfo);*/
 
                //notify listener that call is disconnected.
                if (isLastCall == true)
@@ -1916,7 +1920,12 @@ TelephonyManager::HandleIdleCallBack(void* pData)
                        __pSoundManager->StopSession();
                        pCallList = new (std::nothrow) ArrayListT<AppCallInfo>();
                        pCallList->Construct(1);
-                       if (isMissedIncomingCallEnded == false)
+               //This is done to show end call form in missed call case also
+               //this was done on request received from HQ to solve a bug in
+               //camera application. In which if a call comes when camera is
+               //running and user disconnects before the ui is shown the camera
+               //application hangs
+                       //if (isMissedIncomingCallEnded == false)
                        {
                                //save to list to show EndCallForm
                                pCallList->Add(endCallInfo);
@@ -1965,7 +1974,7 @@ TelephonyManager::HandleEndNormalActiveCall(AppCallInfo& endCallInfo)
                }
 
                //Save "End" call info to call log database
-               SaveCallInfoToLogsDb(endCallInfo);
+               //SaveCallInfoToLogsDb(endCallInfo);
                //notify listener that call is disconnected.
                __pEventListener->HandleCallDisconnected(isLastCall, *pCallList);
                delete pCallList;
@@ -2023,6 +2032,7 @@ TelephonyManager::HandleDialingCallBack(void* pData)
        long long startTime = 0;
        SystemTime::GetTicks(startTime);
        __pDialedCall->SetCallNotificationTime(startTime);
+       SaveCallInfoToLogsDb(*__pDialedCall);
 }
 
 void
@@ -2174,6 +2184,10 @@ TelephonyManager::HandleCallConnected(unsigned int connectedCallHandle)
 
        //transfer ownership to Active calls list
        __pActiveCallList->Add(connectedCallHandle, *(pConnectedCall));
+       if (pConnectedCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_INCOMING)
+       {
+               SaveCallInfoToLogsDb(*pConnectedCall);
+       }
        pConnectedCall = null;
 
        //notify listener that call is connected.