From 968ce47ae7a353e2ad110ef3b64be43d5c9b0b36 Mon Sep 17 00:00:00 2001 From: Amith Kumar Mahale Date: Mon, 29 Apr 2013 19:23:30 +0530 Subject: [PATCH 1/1] Fixed nabi issues 36791 36868 36881 36879 36280 36808 36332 Change-Id: I4cbc19423b9c3e29235b40c6072c4bdbd86e1173 Signed-off-by: Amith Kumar Mahale --- inc/CallButtonsPanel.h | 2 +- inc/CallPresentationModel.h | 2 + manifest.xml | 3 +- src/CallActiveCallForm.cpp | 13 ++++++ src/CallApp.cpp | 7 +-- src/CallButtonsPanel.cpp | 7 +++ src/CallEndCallForm.cpp | 25 ++++++++-- src/CallPresentationModel.cpp | 86 ++++++++++++++++++++++++++++++++--- src/CallSettingsManager.cpp | 7 +++ src/CallSettingsPresentationModel.cpp | 3 ++ src/CallTelephonyManager.cpp | 26 +++++++++-- 11 files changed, 159 insertions(+), 22 deletions(-) diff --git a/inc/CallButtonsPanel.h b/inc/CallButtonsPanel.h index dd5e11d..6e2bcc1 100644 --- a/inc/CallButtonsPanel.h +++ b/inc/CallButtonsPanel.h @@ -84,9 +84,9 @@ public: void ShowViewContactButton(void); // Used to set the AddToContact is present or not void ShowAddContactButton(void); - //set the buttons in the panel as the top controls. Chk if its needed in RC2 void SetButtonPosition(void); + void ShowOrHideAddtoContactsButton(bool isEnabled); protected: // Construct the panel to be shown in "End Call" form diff --git a/inc/CallPresentationModel.h b/inc/CallPresentationModel.h index da03c8e..19f8461 100644 --- a/inc/CallPresentationModel.h +++ b/inc/CallPresentationModel.h @@ -55,6 +55,8 @@ private: result Construct(void); static void CreateInstance(void); static void DestroyInstance(void); + //gets the sim info + result GetSimInfo(void); public: //set the telephony event listener diff --git a/manifest.xml b/manifest.xml index 4df0251..362d9fb 100644 --- a/manifest.xml +++ b/manifest.xml @@ -15,8 +15,9 @@ http://tizen.org/privilege/power http://tizen.org/privilege/appusage http://tizen.org/privilege/setting - http://tizen.org/privilege/messaging.write + http://tizen.org/privilege/lockmanager http://tizen.org/privilege/telephony + http://tizen.org/privilege/messaging.write http://tizen.org/privilege/vibrator http://tizen.org/privilege/contact.read diff --git a/src/CallActiveCallForm.cpp b/src/CallActiveCallForm.cpp index d311a22..a11ea22 100644 --- a/src/CallActiveCallForm.cpp +++ b/src/CallActiveCallForm.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include "CallActiveCallForm.h" #include "CallButtonsPanel.h" #include "CallInfo.h" @@ -43,6 +44,7 @@ using namespace Tizen::System; using namespace Tizen::Ui; using namespace Tizen::Ui::Controls; using namespace Tizen::Ui::Scenes; +using namespace Tizen::Shell; //constants const int IDI_MAX_SECONDS = 60; @@ -1004,6 +1006,17 @@ ActiveCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& break; } + if(__formType == FORMTYPE_ACTIVECALL || __formType == FORMTYPE_EMERGENCYACTIVECALL || + __formType == FORMTYPE_MULTIPLECALLS || __formType == FORMTYPE_ACTIVECONFCALL) + { + //Unlock the phone if its locked + if(LockManager::GetInstance()->IsLocked()) + { + AppLogDebug("Phone Locked"); + LockManager::GetInstance()->Unlock(); + } + } + //Hide DTMFKeypad, if visible and show caller info HideDTMFKeypad(); SetShowStateOnKeypad(true); diff --git a/src/CallApp.cpp b/src/CallApp.cpp index c793f2c..97ec256 100644 --- a/src/CallApp.cpp +++ b/src/CallApp.cpp @@ -560,12 +560,7 @@ CallApp::SetTopMostWindow(bool bTopMost) PowerManager::KeepScreenOnState(false); AppManager::GetInstance()->RemoveActiveAppEventListener(*this); } - //Unlock the phone if its locked -/* if(LockManager::GetInstance()->IsLocked()) - { - AppLogDebug("Phone Locked"); - LockManager::GetInstance()->Unlock(); - }*/ + } void diff --git a/src/CallButtonsPanel.cpp b/src/CallButtonsPanel.cpp index 07b2213..ab0635d 100644 --- a/src/CallButtonsPanel.cpp +++ b/src/CallButtonsPanel.cpp @@ -622,6 +622,13 @@ CallButtonsPanel::DisableKeysForOutgoingCall(void) } void +CallButtonsPanel::ShowOrHideAddtoContactsButton(bool isEnabled) +{ + Button* pButton = static_cast(GetControl(IDC_ADD_TO_CONTACT_BUTTON)); + pButton->SetShowState(isEnabled); +} + +void CallButtonsPanel::SetEndCallPanelState(bool isEnabled) { //Voice Call diff --git a/src/CallEndCallForm.cpp b/src/CallEndCallForm.cpp index 8809220..ae7ada8 100644 --- a/src/CallEndCallForm.cpp +++ b/src/CallEndCallForm.cpp @@ -332,6 +332,17 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu { __pCallButtonsPanel->SetEndCallPanelState(true); } + + //check if we reached the end call form of an outgoing call then don't show add to contacts + if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_OUTGOING) + { + __pCallButtonsPanel->ShowOrHideAddtoContactsButton(false); + } + else if(pEndCall->GetCalllogType() == CALL_LOG_TYPE_VOICE_INCOMING) + { + __pCallButtonsPanel->ShowOrHideAddtoContactsButton(true); + } + } break; @@ -339,7 +350,8 @@ EndCallForm::OnSceneActivatedN(const SceneId& previousSceneId, const SceneId& cu break; } - if (__pEndCallEventTimer) + //Before starting end call timer check if messaging appcontrol was launched during incoming call + if (__pEndCallEventTimer && __pCallPresentor->IsAppControlRunning() == false) { __pEndCallEventTimer->Start(IDI_APP_END_TIMER); } @@ -603,8 +615,7 @@ EndCallForm::OnForeground(void) __isContactAppControlLaunched = false; __pCallPresentor->AppControlRequestCompleted(); } - - if (__isMsgAppControlLaunched == true) + else if (__isMsgAppControlLaunched == true) { //Message AppControl request completed. if(__pEndCallEventTimer != null) @@ -614,6 +625,14 @@ EndCallForm::OnForeground(void) __isMsgAppControlLaunched = false; __pCallPresentor->AppControlRequestCompleted(); } + else if(__pCallPresentor->IsAppControlRunning() == true) + { + if(__pEndCallEventTimer != null) + { + __pEndCallEventTimer->Start(2000); + } + __pCallPresentor->AppControlRequestCompleted(); + } AppLogDebug("Exit"); } diff --git a/src/CallPresentationModel.cpp b/src/CallPresentationModel.cpp index 32407f6..7108c61 100644 --- a/src/CallPresentationModel.cpp +++ b/src/CallPresentationModel.cpp @@ -39,6 +39,7 @@ using namespace Tizen::Graphics; using namespace Tizen::Media; using namespace Tizen::Social; using namespace Tizen::Ui::Scenes; +using namespace Tizen::Telephony; CallPresentationModel* CallPresentationModel::__pInstance = null; @@ -115,6 +116,10 @@ void CallPresentationModel::DialCall(String& contactNumber, bool isEmergency) { int errorCode = ERROR_NONE; + bool isCallServiceAvailable = false; + NetworkStatus networkStatus; + NetworkManager* pNetworkManager = new NetworkManager(); + result r; //Check if Telephony Manager is initialized TryCatch(__pTelephonyMgr != null, (errorCode = ERROR_TAPI_INIT_FAILED), "TAPI initialization failed"); @@ -124,6 +129,30 @@ CallPresentationModel::DialCall(String& contactNumber, bool isEmergency) __pTelEventListener->HandleTelephonyError(ERROR_FLIGHT_MODE_SET); return; } + //Check if dialing a call is possible - Check if sim is available + if (GetSimInfo() == E_FAILURE) + { + __pTelEventListener->HandleTelephonyError(ERROR_CODE_SIM_INITIALIZATION_FAILED); + return ; + } + + //fetch call service status + r = pNetworkManager->Construct(null); + if (r == E_SUCCESS) + { + r = pNetworkManager->GetNetworkStatus(networkStatus); + if (r == E_SUCCESS) + { + isCallServiceAvailable = networkStatus.IsCallServiceAvailable(); + } + } + delete pNetworkManager; + + if (isCallServiceAvailable == false) + { + __pTelEventListener->HandleTelephonyError(ERROR_DIAL_FAILED); + return ; + } //setup outgoing call errorCode = __pTelephonyMgr->SetupMoCall(contactNumber, isEmergency); TryCatch(errorCode == ERROR_NONE,,"Error occurred while setup MO call"); @@ -383,6 +412,11 @@ bool CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& contactNumber) { AppLogDebug("Enter"); + if (sendMsg == true && __pAppControlMgr != null) + { + //launch compose message AppControl + __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast(&contactNumber)), this); + } result r = __pTelephonyMgr->AnswerCall(callHandle, false); if (IsFailed(r)) { @@ -390,11 +424,7 @@ CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& co return false; } - if (sendMsg == true && __pAppControlMgr != null) - { - //launch compose message AppControl - __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast(&contactNumber)), this); - } + AppLogDebug("Exit"); return true; } @@ -468,7 +498,7 @@ CallPresentationModel::AddCall(const String& phoneNumber) ArrayList* pLaunchArgs = null; SceneManager* pSceneManager = SceneManager::GetInstance(); int currentActiveCallCount = GetCurrentCallCount(); - if(currentActiveCallCount <= 1) + if(currentActiveCallCount <= 1 && IsIncomingorDialingCallPresent() == false) { //make an outgoing call with given number String* contactTxt = new (std::nothrow) String(phoneNumber); @@ -585,7 +615,7 @@ CallPresentationModel::HandleCallDisconnected(bool isLastCall, Tizen::Base::Coll //1) Defer from sending call disconnected event to form, in case Msg AppControl is running, //to avoid PhoneApp from going to EndCall form, where it shows for 3 sec. and automatically closes. //2) Do not send call disconnected event to any form, in case an incoming call or dialing call is present. - if (__pTelEventListener != null && __isMessageAppControlRunning == false ) + if (__pTelEventListener != null /*&& __isMessageAppControlRunning == false*/ ) { __pTelEventListener->HandleCallDisconnected(isLastCall, pCallList); } @@ -775,3 +805,45 @@ CallPresentationModel::AppControlRequestCompleted(void) __pAppControlMgr->AppControlRequestCompleted(); } } + +result +CallPresentationModel::GetSimInfo(void) +{ + int mnc; + int mcc; + bool isAvailable; + String spn; + String iccId; + String operatorName; + + SimStateManager simStateManager; + SimInfo simInfo; + + result r = simStateManager.Construct(); + if (IsFailed(r)) + { + return E_FAILURE; + } + + r = simStateManager.GetSimInfo(simInfo); + if (IsFailed(r)) + { + return E_FAILURE; + } + + mnc = simInfo.GetMnc(); + mcc = simInfo.GetMcc(); + spn = simInfo.GetSpn(); + iccId = simInfo.GetIccId(); + operatorName = simInfo.GetOperatorName(); + //Checks whether a SIM card is present in the device or not + isAvailable = simInfo.IsAvailable(); + if(isAvailable == true) + { + return E_SUCCESS; + } + else + { + return E_FAILURE; + } +} diff --git a/src/CallSettingsManager.cpp b/src/CallSettingsManager.cpp index b0e6cf5..78ab594 100644 --- a/src/CallSettingsManager.cpp +++ b/src/CallSettingsManager.cpp @@ -136,8 +136,15 @@ SettingsManager::RemoveSettingEventListener(ISettingsEventListener* pSettingsEve bool SettingsManager::IsCallToBeRejected(String& phoneNumber) { + if(__pCallSettingDataService != null) + { return __pCallSettingDataService->IsCallToBeRejected(phoneNumber); } + else + { + return false; + } +} bool SettingsManager::GetUnknownRejectStatus(void) diff --git a/src/CallSettingsPresentationModel.cpp b/src/CallSettingsPresentationModel.cpp index f5e451f..a616e5d 100644 --- a/src/CallSettingsPresentationModel.cpp +++ b/src/CallSettingsPresentationModel.cpp @@ -79,7 +79,10 @@ SettingsPresentationModel::Construct(void) { //Construct Settings Manager __pSettingsMgr = SettingsManager::GetInstance(); + if(__pSettingsMgr != null) + { __pSettingsMgr->AddSettingEventListener(this); + } return E_SUCCESS; } diff --git a/src/CallTelephonyManager.cpp b/src/CallTelephonyManager.cpp index f3d821b..8e0d355 100644 --- a/src/CallTelephonyManager.cpp +++ b/src/CallTelephonyManager.cpp @@ -1281,6 +1281,21 @@ TelephonyManager::HandleDialCallbackResponse(TapiHandle* pHandle, int callBackRe delete pTelManager->__pDialedCall; pTelManager->__pDialedCall = null; } + + //Check if there are no active connected calls and no incoming call. + if (pTelManager->__pIncomingCall != null) + { + pTelManager->__pSettingsManager->SetCallState(CALL_STATE_CALL_VOICE_CONNECTING); + } + else if (pTelManager->GetCurrentCallCount() >= 1) + { + pTelManager->__pSettingsManager->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE); + } + else + { + pTelManager->__pSettingsManager->SetCallState(CALL_STATE_CALL_OFF); + } + pTelManager->__pEventListener->HandleTelephonyError(ERROR_DIAL_FAILED); } } @@ -2182,11 +2197,14 @@ TelephonyManager::CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo) contactNumber.Append(pIncomingCallInfo->GetContactNumber()); //Check if "reject unknown calls" is set and contact number is not present in AddressBook //or if contact number is blacklisted - if (((__pSettingsManager->GetUnknownRejectStatus() == true) && (pIncomingCallInfo->GetContactInfo() == null)) - || (__pSettingsManager->IsCallToBeRejected(contactNumber) == true)) + if(__pSettingsManager != null) { - AnswerAutoRejectCall(callHandle); - return true; + if (((__pSettingsManager->GetUnknownRejectStatus() == true) && (pIncomingCallInfo->GetContactInfo() == null)) + || (__pSettingsManager->IsCallToBeRejected(contactNumber) == true)) + { + AnswerAutoRejectCall(callHandle); + return true; + } } return false; } -- 2.7.4