Fixed nabi issues 36791 36868 36881 36879 36280 36808 36332
authorAmith Kumar Mahale <amith.m@samsung.com>
Mon, 29 Apr 2013 13:53:30 +0000 (19:23 +0530)
committerAmith Kumar Mahale <amith.m@samsung.com>
Mon, 29 Apr 2013 13:53:30 +0000 (19:23 +0530)
Change-Id: I4cbc19423b9c3e29235b40c6072c4bdbd86e1173
Signed-off-by: Amith Kumar Mahale <amith.m@samsung.com>
inc/CallButtonsPanel.h
inc/CallPresentationModel.h
manifest.xml
src/CallActiveCallForm.cpp
src/CallApp.cpp
src/CallButtonsPanel.cpp
src/CallEndCallForm.cpp
src/CallPresentationModel.cpp
src/CallSettingsManager.cpp
src/CallSettingsPresentationModel.cpp
src/CallTelephonyManager.cpp

index dd5e11d..6e2bcc1 100644 (file)
@@ -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
index da03c8e..19f8461 100644 (file)
@@ -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
index 4df0251..362d9fb 100644 (file)
@@ -15,8 +15,9 @@
             <Privilege>http://tizen.org/privilege/power</Privilege>
             <Privilege>http://tizen.org/privilege/appusage</Privilege>
             <Privilege>http://tizen.org/privilege/setting</Privilege>
-            <Privilege>http://tizen.org/privilege/messaging.write</Privilege>
+            <Privilege>http://tizen.org/privilege/lockmanager</Privilege>
             <Privilege>http://tizen.org/privilege/telephony</Privilege>
+            <Privilege>http://tizen.org/privilege/messaging.write</Privilege>
             <Privilege>http://tizen.org/privilege/vibrator</Privilege>
             <Privilege>http://tizen.org/privilege/contact.read</Privilege>
         </Privileges>
index d311a22..a11ea22 100644 (file)
@@ -22,6 +22,7 @@
 #include <FUi.h>
 #include <FMedia.h>
 #include <FSystem.h>
+#include <FShell.h>
 #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);
index c793f2c..97ec256 100644 (file)
@@ -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
index 07b2213..ab0635d 100644 (file)
@@ -622,6 +622,13 @@ CallButtonsPanel::DisableKeysForOutgoingCall(void)
 }
 
 void
+CallButtonsPanel::ShowOrHideAddtoContactsButton(bool isEnabled)
+{
+       Button* pButton = static_cast<Button*>(GetControl(IDC_ADD_TO_CONTACT_BUTTON));
+       pButton->SetShowState(isEnabled);
+}
+
+void
 CallButtonsPanel::SetEndCallPanelState(bool isEnabled)
 {
        //Voice Call
index 8809220..ae7ada8 100644 (file)
@@ -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");
 }
 
index 32407f6..7108c61 100644 (file)
@@ -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<String*>(&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<String*>(&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;
+       }
+}
index b0e6cf5..78ab594 100644 (file)
@@ -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)
index f5e451f..a616e5d 100644 (file)
@@ -79,7 +79,10 @@ SettingsPresentationModel::Construct(void)
 {
        //Construct Settings Manager
        __pSettingsMgr = SettingsManager::GetInstance();
+       if(__pSettingsMgr != null)
+       {
        __pSettingsMgr->AddSettingEventListener(this);
+       }
        return E_SUCCESS;
 }
 
index f3d821b..8e0d355 100644 (file)
@@ -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;
 }