From ae4a29bb3b9f149b458351feec6e6b1beccd7f86 Mon Sep 17 00:00:00 2001 From: Amith Kumar Mahale Date: Fri, 12 Apr 2013 20:04:45 +0530 Subject: [PATCH 1/1] 1.Soundmanger checkes added for Media Palyer return 2.Diabling join call if the member is present in Call Change-Id: Id56cc3ad56d0e1dce2ad6f4973ca91b5d6461588 Signed-off-by: Amith Kumar Mahale --- inc/CallPresentationModel.h | 3 +- src/CallActiveCallForm.cpp | 14 +-- src/CallEndCallForm.cpp | 16 ++- src/CallInfo.cpp | 11 +- src/CallPresentationModel.cpp | 57 +++++++++++ src/CallSoundManager.cpp | 228 ++++++++++++++++++++++++++++++++++-------- src/CallTelephonyManager.cpp | 6 +- 7 files changed, 272 insertions(+), 63 deletions(-) diff --git a/inc/CallPresentationModel.h b/inc/CallPresentationModel.h index 58b7aec..afe0179 100644 --- a/inc/CallPresentationModel.h +++ b/inc/CallPresentationModel.h @@ -131,7 +131,8 @@ public: bool CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo); //Launch dial appcontrol for add call senario result LaunchDialAppControl(); - + //Used to check if Join button should be enabled or not + bool IsEnableJoinCallButton(void); //Event Listener methods from ITelephonyEventListener virtual void HandleCallConnected(Tizen::Base::Collection::IListT& pCallList); virtual void HandleCallDisconnected(bool isLastCall, Tizen::Base::Collection::IListT& pCallList); diff --git a/src/CallActiveCallForm.cpp b/src/CallActiveCallForm.cpp index 11ef10b..df2a4f3 100644 --- a/src/CallActiveCallForm.cpp +++ b/src/CallActiveCallForm.cpp @@ -194,8 +194,6 @@ ActiveCallForm::OnInitializing(void) void ActiveCallForm::ShowDTMFKeypad(void) { - - if(__pDTMFKeypad == null) { //update rect according to client screen area @@ -1138,7 +1136,7 @@ ActiveCallForm::HandleConfCallChanged(void) //change AddCall Button status __pCallButtonsPanel->EnableAddCallButton(isEnableAddCall); //change JoinCall Button status - __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall); + __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton()); AppLog("EXIT"); } @@ -1290,15 +1288,7 @@ ActiveCallForm::UpdateMultipleCallScreen(Tizen::Base::Collection::IListTGetConferenceCallInfoN(); - if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS) - { - isEnableJoinCall = false; - } - __pCallButtonsPanel->EnableJoinCallButton(isEnableJoinCall); - delete pConfCallInfo; - pConfCallInfo = null; + __pCallButtonsPanel->EnableJoinCallButton(__pCallPresentor->IsEnableJoinCallButton()); Invalidate(true); AppLog("EXIT"); } diff --git a/src/CallEndCallForm.cpp b/src/CallEndCallForm.cpp index b1a894a..799a0e5 100644 --- a/src/CallEndCallForm.cpp +++ b/src/CallEndCallForm.cpp @@ -616,16 +616,24 @@ EndCallForm::OnForeground(void) //as we do not know if it success or failed. if(__isContactAppControlLaunched == true) { - CallApp* pPhoneApp = (static_cast(UiApp::GetInstance())); - pPhoneApp->Terminate(); + //CallApp* pPhoneApp = (static_cast(UiApp::GetInstance())); + //pPhoneApp->Terminate(); + if(__pEndCallEventTimer != null) + { + __pEndCallEventTimer->Start(2000); + } } __isContactAppControlLaunched = false; if (__isMsgAppControlLaunched == true) { //Message AppControl request completed. - CallApp* pPhoneApp = (static_cast(UiApp::GetInstance())); - pPhoneApp->Terminate(); + //CallApp* pPhoneApp = (static_cast(UiApp::GetInstance())); + //pPhoneApp->Terminate(); + if(__pEndCallEventTimer != null) + { + __pEndCallEventTimer->Start(2000); + } __isMsgAppControlLaunched = false; } AppLogDebug("Exit"); diff --git a/src/CallInfo.cpp b/src/CallInfo.cpp index 81fa515..ed7af01 100644 --- a/src/CallInfo.cpp +++ b/src/CallInfo.cpp @@ -322,14 +322,17 @@ AppCallInfo::FetchCallerNameN(void) if (__pContact != null) { //fetch name to be displayed - __pContact->GetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, displayName); - if (displayName.IsEmpty()) - { String firstName(L""); String lastName(L""); + String middlename(L""); __pContact->GetValue(CONTACT_PROPERTY_ID_FIRST_NAME, firstName); __pContact->GetValue(CONTACT_PROPERTY_ID_LAST_NAME, lastName); - displayName.Append(firstName + " " + lastName); + __pContact->GetValue(CONTACT_PROPERTY_ID_MIDDLE_NAME, middlename); + displayName.Append(firstName + middlename + lastName); + + if (displayName.IsEmpty() == false) + { + __pContact->GetValue(CONTACT_PROPERTY_ID_DISPLAY_NAME, displayName); } } diff --git a/src/CallPresentationModel.cpp b/src/CallPresentationModel.cpp index 73447b1..efea53c 100644 --- a/src/CallPresentationModel.cpp +++ b/src/CallPresentationModel.cpp @@ -662,6 +662,63 @@ CallPresentationModel::LaunchDialAppControl() extraData.RemoveAll(true); return r; +} +bool +CallPresentationModel::IsEnableJoinCallButton(void) +{ + //Check if conf. call has maximum participants + AppCallInfo* pConfCallInfo = GetConferenceCallInfoN(); + if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS) + { + return false; + } + //check if either of the caller is same or present in conf call. + IListT* pActiveCallList = GetCallListN(); + if ( pActiveCallList != null && pActiveCallList->GetCount() == IDI_MAX_ACTIVE_CALLS) + { + AppCallInfo firstCall; + AppCallInfo secondCall; + pActiveCallList->GetAt(0, firstCall); + pActiveCallList->GetAt(1, secondCall); + + if (firstCall.IsConferenceCall() == true) + { + IListT* pConfMemberList = firstCall.GetCallerList(); + for (int index = 0; index < pConfMemberList->GetCount(); index++) + { + AppCallInfo singleConfMember; + pConfMemberList->GetAt(index, singleConfMember); + if (secondCall.GetContactNumber().IsEmpty() == false && secondCall.GetContactNumber().Equals(singleConfMember.GetContactNumber()) == true) + { + return false; + } + } + } + else if (secondCall.IsConferenceCall() == true) + { + IListT* pConfMemberList = secondCall.GetCallerList(); + for (int index = 0; index < pConfMemberList->GetCount(); index++) + { + AppCallInfo singleConfMember; + pConfMemberList->GetAt(index, singleConfMember); + if (firstCall.GetContactNumber().IsEmpty() == false && firstCall.GetContactNumber().Equals(singleConfMember.GetContactNumber()) == true) + { + return false; + } + } + } + else + { + //Now, we definitely know that both are single active calls. + if (firstCall.GetContactNumber().IsEmpty() == false && firstCall.GetContactNumber().Equals(secondCall.GetContactNumber()) == true) + { + return false; + } + } + } + delete pConfCallInfo; + pConfCallInfo = null; + return true; } diff --git a/src/CallSoundManager.cpp b/src/CallSoundManager.cpp index 3e52598..c66928a 100644 --- a/src/CallSoundManager.cpp +++ b/src/CallSoundManager.cpp @@ -198,8 +198,9 @@ SoundManager::OnTimerExpired(Timer& timer) { String reminderTonePath; int unknownRejectStatus = -1; - vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &unknownRejectStatus); - bool ReminderToneSetStatus = unknownRejectStatus; + vconf_get_bool(VCONFKEY_CISSAPPL_MINUTE_MINDER_BOOL, &unknownRejectStatus); + bool ReminderToneSetStatus = unknownRejectStatus; + result res = E_FAILURE; if(ReminderToneSetStatus == true) { @@ -207,18 +208,44 @@ SoundManager::OnTimerExpired(Timer& timer) if(__pPlayer == null) { __pPlayer = new (std::nothrow) Player(); - __pPlayer->Construct(*this); + res = __pPlayer->Construct(*this); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } } reminderTonePath.Append(MINUTEREMINDERTONE_PATH); if(reminderTonePath.IsEmpty() == false) { + __pPlayer->Stop(); __pPlayer->Close(); - __pPlayer->OpenFile(reminderTonePath,false); - __pPlayer->SetLooping(false); - __pPlayer->SetVolume(80); + res = __pPlayer->OpenFile(reminderTonePath,false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer OpenFile failed with %d",res); + return; + } + res = __pPlayer->SetLooping(false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetLooping failed with %d",res); + return; + } + res = __pPlayer->SetVolume(80); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetVolume failed with %d",res); + return; + } SetSoundMode(SOUND_MODE_MEDIA); - __pPlayer->Play(); + res = __pPlayer->Play(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Play failed with %d",res); + return; + } SetSoundMode(SOUND_MODE_VOICE); } } @@ -240,6 +267,7 @@ SoundManager::SetDisconnectTone(void) String disconnectTonePath=L""; vconf_get_bool(VCONFKEY_CISSAPPL_CALL_END_TONE_BOOL, &unknownRejectStatus); bool disconnectToneSetStatus = unknownRejectStatus; + result res = E_FAILURE; if(disconnectToneSetStatus == true) { @@ -248,23 +276,46 @@ SoundManager::SetDisconnectTone(void) if(__pPlayer == null) { AppLogDebug("__pPlayer == null"); - __pPlayer = new (std::nothrow) Player(); - __pPlayer->Construct(*this); - AppLogDebug("__pPlayer Construct"); + res = __pPlayer->Construct(*this); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } + } if(disconnectTonePath.IsEmpty() == false) { + __pPlayer->Stop(); + __pPlayer->Close(); AppLogDebug("__pPlayer OpenFile %ls",disconnectTonePath.GetPointer()); - __pPlayer->OpenFile(disconnectTonePath,false); - AppLogDebug("__pPlayer OpenFile"); - __pPlayer->SetLooping(false); - AppLogDebug("__pPlayer SetLooping"); - __pPlayer->SetVolume(80); - AppLogDebug("__pPlayer SetVolume"); + res = __pPlayer->OpenFile(disconnectTonePath,false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer OpenFile failed with %d",res); + return; + } + res = __pPlayer->SetLooping(false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetLooping failed with %d",res); + return; + } + res = __pPlayer->SetVolume(80); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetLooping SetVolume with %d",res); + return; + } SetSoundMode(SOUND_MODE_MEDIA); AppLogDebug("__pPlayer SetVolume"); - __pPlayer->Play(); + res = __pPlayer->Play(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Play with %d",res); + return; + } } } AppLogDebug("Exit"); @@ -291,11 +342,11 @@ void SoundManager::SetConnectTone() { - result r = E_FAILURE; String connectTonePath; int unknownRejectStatus = -1; vconf_get_bool(VCONFKEY_CISSAPPL_CALL_CONNECT_TONE_BOOL, &unknownRejectStatus); bool connectToneSetStatus = unknownRejectStatus; + result res = E_FAILURE; connectTonePath.Append(CALLCONNECTTONE_PATH); @@ -305,16 +356,44 @@ SoundManager::SetConnectTone() if(__pPlayer == null) { __pPlayer = new (std::nothrow) Player(); - r = __pPlayer->Construct(*this); + res = __pPlayer->Construct(*this); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } } if (connectTonePath.IsEmpty() == false) { - r = __pPlayer->OpenFile(connectTonePath,false); - r = __pPlayer->SetLooping(false); - r = __pPlayer->SetVolume(80); - r = SetSoundMode(SOUND_MODE_MEDIA); - r = __pPlayer->Play(); + __pPlayer->Stop(); + __pPlayer->Close(); + res = __pPlayer->OpenFile(connectTonePath,false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer OpenFile failed with %d",res); + return; + } + res = __pPlayer->SetLooping(false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetLooping failed with %d",res); + return; + } + res = __pPlayer->SetVolume(80); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetVolume failed with %d",res); + return; + } + res = SetSoundMode(SOUND_MODE_MEDIA); + AppLogDebug("__pPlayer Playing connect tone"); + res = __pPlayer->Play(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Play failed with %d",res); + return; + } } } } @@ -322,6 +401,7 @@ SoundManager::SetConnectTone() void SoundManager::StartAlert(String& contactRingTone) { + result res = E_FAILURE; AppLogDebug("Enter"); if(__pSoundCallSession != null) { @@ -341,16 +421,42 @@ SoundManager::StartAlert(String& contactRingTone) if(__pPlayer == null) { __pPlayer = new (std::nothrow) Player(); - __pPlayer->Construct(*this); + res = __pPlayer->Construct(*this); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } } if (waitingTonePath.IsEmpty() == false) { + __pPlayer->Stop(); __pPlayer->Close(); - __pPlayer->OpenFile(waitingTonePath,false); - __pPlayer->SetLooping(true); - __pPlayer->SetVolume(80); + res = __pPlayer->OpenFile(waitingTonePath,false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer OpenFile failed with %d",res); + return; + } + res = __pPlayer->SetLooping(true); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetLooping failed with %d",res); + return; + } + res = __pPlayer->SetVolume(80); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer SetVolume failed with %d",res); + return; + } SetSoundMode(SOUND_MODE_MEDIA); - __pPlayer->Play(); + res = __pPlayer->Play(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Play failed with %d",res); + return; + } } } return; @@ -359,16 +465,25 @@ SoundManager::StartAlert(String& contactRingTone) { StartSession(); } - result r = E_FAILURE; if(__pVibrator == null) { __pVibrator = new (std::nothrow) Vibrator(); - r = __pVibrator->Construct(); + res = __pVibrator->Construct(); + if(res != E_SUCCESS) + { + AppLogDebug("__pVibrator Construct failed with %d",res); + return; + } } if(__pPlayer == null) { __pPlayer = new (std::nothrow) Player(); - r = __pPlayer->Construct(*this); + res = __pPlayer->Construct(*this); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } } int retVal = -1; vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &retVal); @@ -394,23 +509,43 @@ SoundManager::StartAlert(String& contactRingTone) //Check if file is present File file; - result res = file.Construct(ringTonePath, "r"); + res = file.Construct(ringTonePath, "r"); if(res != E_SUCCESS ) { ringTonePath.Clear(); ringTonePath.Append(RINGTONE_PATH); } __pPlayer->Close(); - r = __pPlayer->OpenFile(ringTonePath,false); - r = __pPlayer->SetLooping(true); - r = __pPlayer->SetVolume(80); - r = SetSoundMode(SOUND_MODE_RINGTONE); - r = __pPlayer->Play(); + res = __pPlayer->OpenFile(ringTonePath,false); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } + res = __pPlayer->SetLooping(true); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } + res = __pPlayer->SetVolume(80); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } + res = SetSoundMode(SOUND_MODE_RINGTONE); + res = __pPlayer->Play(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Construct failed with %d",res); + return; + } } if (__isVibrateStatusOn == true) { //todo: Get the level from settings - r = __pVibrator->Start(3000,1000,1000); + res = __pVibrator->Start(3000,1000,1000); } AppLogDebug("Exit"); return; @@ -419,13 +554,24 @@ SoundManager::StartAlert(String& contactRingTone) void SoundManager::StopAlert(void) { + result res = E_FAILURE; AppLogDebug("Enter"); if (__isSoundStatusOn == true) { //todo: stop player AppLogDebug("Stopping ring tone"); - __pPlayer->Stop(); - __pPlayer->Close(); + res = __pPlayer->Stop(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Stop failed with %d",res); + return; + } + res = __pPlayer->Close(); + if(res != E_SUCCESS) + { + AppLogDebug("__pPlayer Close failed with %d",res); + return; + } SetSoundMode(SOUND_MODE_VOICE); __isSoundStatusOn = false; StopSession(); diff --git a/src/CallTelephonyManager.cpp b/src/CallTelephonyManager.cpp index d420746..fc34ab0 100644 --- a/src/CallTelephonyManager.cpp +++ b/src/CallTelephonyManager.cpp @@ -1856,6 +1856,7 @@ TelephonyManager::HandleIdleCallBack(void* pData) //end call event handled - conference call will now either remain as conf. call //or become single active call, if it has only 1 participant left. __pSoundManager->SetSoundMode(SOUND_MODE_VOICE); + AppLogDebug("isConferenceCallChanged == true"); return; } @@ -1873,7 +1874,7 @@ TelephonyManager::HandleIdleCallBack(void* pData) } //Check if dialed call is rejected by other party - bool isDialedCallEnded = ((__pDialedCall != null) && (((unsigned int)__pDialedCall->GetCallHandle()->ToLong()) == idleNotification.id)); + bool isDialedCallEnded = ((__pDialedCall != null) && (__pDialedCall->GetCallHandle() != null) &&(((unsigned int)__pDialedCall->GetCallHandle()->ToLong()) == idleNotification.id)); //Check if "missed" incoming call is ended bool isMissedIncomingCallEnded = (__pIncomingCall != null && ((unsigned int)__pIncomingCall->GetCallHandle()->ToLong() == idleNotification.id)); if (isDialedCallEnded == true || isMissedIncomingCallEnded == true) @@ -1934,6 +1935,7 @@ TelephonyManager::HandleIdleCallBack(void* pData) bool TelephonyManager::HandleEndNormalActiveCall(AppCallInfo& endCallInfo) { + AppLogDebug("Enter"); // This function gets called only from HandleIdleCallback(), // to handle disconnection of normal active calls. if (endCallInfo.IsConferenceCall() == false) @@ -1972,6 +1974,7 @@ TelephonyManager::HandleEndNormalActiveCall(AppCallInfo& endCallInfo) void TelephonyManager::HandleDialingCallBack(void* pData) { + AppLogDebug("Enter"); unsigned int tempHandle = 0; TelCallStatusDialingNoti_t dialingNotification; memcpy(&tempHandle, pData, sizeof(TS_UINT)); @@ -1980,6 +1983,7 @@ TelephonyManager::HandleDialingCallBack(void* pData) //Dont check for call handle, since this is the first time, we get call handle for a dialed call. if (__pDialedCall == null) { + AppLogDebug("__pDialedCall == null"); //construct new dialed call __pDialedCall = new (std::nothrow) AppCallInfo(); -- 2.7.4