Fixed recursive appcontrol issue. Fixed Call reject from event injector during answer...
[apps/osp/Call.git] / src / CallPresentationModel.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        CallCallPresentationModel.cpp
19  * @brief       Call Presentation model class
20  */
21 #include <FApp.h>
22 #include <FUi.h>
23 #include <FMedia.h>
24 #include "CallApp.h"
25 #include "CallAppControlRequestMgr.h"
26 #include "CallActiveCallForm.h"
27 #include "CallInfo.h"
28 #include "CallPresentationModel.h"
29 #include "CallSettingsPresentationModel.h"
30 #include "CallConfCallerListForm.h"
31 #include "CallTelephonyManager.h"
32 #include "CallSceneRegister.h"
33 #include "CallTypes.h"
34
35 using namespace Tizen::Base;
36 using namespace Tizen::Base::Collection;
37 using namespace Tizen::App;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Media;
40 using namespace Tizen::Social;
41 using namespace Tizen::Ui::Scenes;
42
43 CallPresentationModel* CallPresentationModel::__pInstance = null;
44
45 CallPresentationModel::CallPresentationModel(void)
46 {
47         __pTelephonyMgr = null;
48         __pTelEventListener = null;
49         __pSettingsPresentor = null;
50         __isMessageAppControlRunning = false;
51         __isDialAppControlRunning = false;
52         __pAppControlMgr = null;
53 }
54
55 CallPresentationModel::~CallPresentationModel(void)
56 {
57         __pTelephonyMgr = null;
58         __pSettingsPresentor = null;
59         __pAppControlMgr =null;
60 }
61
62 void
63 CallPresentationModel::CreateInstance(void)
64 {
65         __pInstance = new (std::nothrow) CallPresentationModel();
66         result r = __pInstance->Construct();
67         if(IsFailed(r))
68         {
69                 delete __pInstance;
70                 __pInstance = null;
71                 return;
72         }
73
74         std::atexit(DestroyInstance);
75 }
76
77 CallPresentationModel*
78 CallPresentationModel::GetInstance(void)
79 {
80         if (__pInstance == null)
81         {
82                 CreateInstance();
83         }
84         return __pInstance;
85 }
86
87 void
88 CallPresentationModel::DestroyInstance(void)
89 {
90         if (__pInstance != null)
91         {
92                 delete __pInstance;
93                 __pInstance = null;
94         }
95 }
96
97 result
98 CallPresentationModel::Construct(void)
99 {
100         //Fetch Telephony Manager
101         __pTelephonyMgr = TelephonyManager::GetInstance(this);
102         __pSettingsPresentor = SettingsPresentationModel::GetInstance();
103         __pAppControlMgr = CallAppControlRequestMgr::GetInstance();
104         return E_SUCCESS;
105 }
106
107 void
108 CallPresentationModel::SetTelEventListener(ITelephonyEventListener* pTelEventListener)
109 {
110         //set form as telephony event listener
111         __pTelEventListener = pTelEventListener;
112 }
113
114 void
115 CallPresentationModel::DialCall(String& contactNumber, bool isEmergency)
116 {
117         int errorCode = ERROR_NONE;
118         //Check if Telephony Manager is initialized
119         TryCatch(__pTelephonyMgr != null, (errorCode = ERROR_TAPI_INIT_FAILED), "TAPI initialization failed");
120
121         //check if phone is in flight mode
122         if(__pSettingsPresentor != null && __pSettingsPresentor->GetFlightModeStatus() == true)
123         {
124                 __pTelEventListener->HandleTelephonyError(ERROR_FLIGHT_MODE_SET);
125                 return;
126         }
127         //setup outgoing call
128         errorCode = __pTelephonyMgr->SetupMoCall(contactNumber, isEmergency);
129         TryCatch(errorCode == ERROR_NONE,,"Error occurred while setup MO call");
130         if(__pSettingsPresentor != null)
131         {
132                 __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_CONNECTING);
133         }
134         return;
135
136 CATCH:
137         __pTelEventListener->HandleTelephonyError(errorCode);
138 }
139
140 void
141 CallPresentationModel::EndActiveCall(Long callHandle)
142 {
143         if(__pTelephonyMgr != null)
144         {
145                 __pTelephonyMgr->EndActiveCall(callHandle);
146         }
147 }
148
149 void
150 CallPresentationModel::EndDialingCall(String& contactNumber)
151 {
152         if(__pTelephonyMgr != null)
153         {
154                 __pTelephonyMgr->EndDialingCall(contactNumber);
155         }
156 }
157
158 bool
159 CallPresentationModel::EndConferenceCall(void)
160 {
161         result r = __pTelephonyMgr->EndConferenceCall();
162         if (IsFailed(r))
163         {
164                 //TODO: send proper error code
165                 __pTelEventListener->HandleTelephonyError(ERROR_GENERAL);
166                 return false;
167         }
168         return true;
169 }
170
171 void
172 CallPresentationModel::EndAllCall(void)
173 {
174         if(__pTelephonyMgr != null)
175         {
176                 __pTelephonyMgr->EndAllCalls();
177         }
178 }
179 bool
180 CallPresentationModel::HoldCall(Tizen::Base::Long callHandle)
181 {
182         result r = __pTelephonyMgr->HoldCall(callHandle, true);
183         return (!IsFailed(r));
184 }
185
186 bool
187 CallPresentationModel::UnHoldCall(Tizen::Base::Long callHandle)
188 {
189         result r = __pTelephonyMgr->HoldCall(callHandle, false);
190         return (!IsFailed(r));
191 }
192
193 bool
194 CallPresentationModel::HoldConferenceCall(void)
195 {
196         result r = __pTelephonyMgr->HoldConferenceCall(true);
197         return (!IsFailed(r));
198 }
199
200 bool
201 CallPresentationModel::ActivateConferenceCall(void)
202 {
203         result r = __pTelephonyMgr->HoldConferenceCall(false);
204         return (!IsFailed(r));
205 }
206
207 void
208 CallPresentationModel::JoinCall(void)
209 {
210         result r = __pTelephonyMgr->JoinCall();
211         if (IsFailed(r))
212         {
213                 __pTelEventListener->HandleTelephonyError(ERROR_JOIN_FAILED);
214         }
215 }
216
217 void
218 CallPresentationModel::SwapCalls(void)
219 {
220         result r = __pTelephonyMgr->SwapCalls();
221         if (IsFailed(r))
222         {
223                 __pTelEventListener->HandleTelephonyError(ERROR_SWAP_FAILED);
224         }
225 }
226
227 bool
228 CallPresentationModel::SetMuteStatus(bool setMute)
229 {
230         result r = __pTelephonyMgr->SetMuteStatus(setMute);
231         return (!IsFailed(r));
232 }
233
234 bool
235 CallPresentationModel::IsCallMuted(void)
236 {
237         return __pTelephonyMgr->IsCallMuted();
238 }
239
240 bool
241 CallPresentationModel::SetSpeakerStatus(bool setSpeaker)
242 {
243         result r = __pTelephonyMgr->SetSpeakerStatus(setSpeaker);
244         return (!IsFailed(r));
245 }
246
247 bool
248 CallPresentationModel::IsSpeakerOn(void)
249 {
250         return __pTelephonyMgr->IsSpeakerOn();
251 }
252 void
253 CallPresentationModel::SendDTMFSignal(String& textToBeSent)
254 {
255         __pTelephonyMgr->SendCallDTMF(textToBeSent);
256 }
257
258 AppCallInfo*
259 CallPresentationModel::GetConferenceCallInfoN(void)
260 {
261         return __pTelephonyMgr->GetConferenceCallInfoN();
262 }
263
264 bool
265 CallPresentationModel::SplitFromConference(SplitConfCallerCmdIds splitCallerCmdId, IListT<AppCallInfo>* pConfCallList)
266 {
267         int callIndex = -1;
268         AppCallInfo callToBeSpli;
269         switch (splitCallerCmdId)
270         {
271         case IDA_SPLIT_CALLER1:
272                 callIndex = 0;
273                 break;
274
275         case IDA_SPLIT_CALLER2:
276                 callIndex = 1;
277                 break;
278
279         case IDA_SPLIT_CALLER3:
280                 callIndex = 2;
281                 break;
282
283         case IDA_SPLIT_CALLER4:
284                 callIndex = 3;
285                 break;
286
287         case IDA_SPLIT_CALLER5:
288                 callIndex = 4;
289                 break;
290
291         default:
292         break;
293         }
294
295         result r = pConfCallList->GetAt(callIndex, callToBeSpli);
296         TryCatch(r == E_SUCCESS,,"conf. call list corrupted");
297         //split single call from conference
298         r = __pTelephonyMgr->SplitFromConference(callToBeSpli.GetCallHandle()->ToLong());
299         TryCatch(r == E_SUCCESS,,"Split from conf. call failed");
300         return true;
301
302 CATCH:
303         __pTelEventListener->HandleTelephonyError(ERROR_SPLIT_FROM_CONFERENCE_FAILED);
304         return false;
305 }
306
307 void
308 CallPresentationModel::EndCallFromConference(EndConfCallerCmdIds endCallerCmdId, IListT<AppCallInfo>* pConfCallList)
309 {
310         int callIndex = -1;
311         AppCallInfo callToBeEnded;
312         switch (endCallerCmdId)
313         {
314         case IDA_END_CALLER1:
315                 callIndex = 0;
316                 break;
317
318         case IDA_END_CALLER2:
319                 callIndex = 1;
320                 break;
321
322         case IDA_END_CALLER3:
323                 callIndex = 2;
324                 break;
325
326         case IDA_END_CALLER4:
327                 callIndex = 3;
328                 break;
329
330         case IDA_END_CALLER5:
331                 callIndex = 4;
332                 break;
333
334         default:
335         break;
336         }
337
338         result r = pConfCallList->GetAt(callIndex, callToBeEnded);
339         TryCatch(r == E_SUCCESS,,"conference call list corrupted");
340         //end single call
341         r = __pTelephonyMgr->EndFromConference(callToBeEnded.GetCallHandle()->ToLong());
342         TryCatch(r == E_SUCCESS,,"End single call from conference call failed");
343
344         return;
345
346 CATCH:
347         __pTelEventListener->HandleTelephonyError(ERROR_END_CALL_FAILED);
348         return;
349 }
350
351 bool
352 CallPresentationModel::IsSplitAllowed(void)
353 {
354         return __pTelephonyMgr->IsSplitAllowed();
355 }
356
357 void
358 CallPresentationModel::AcceptIncomingCall(CallAnsweringOptions answerOptions,int callHandle)
359 {
360         result r = E_FAILURE;
361         if (answerOptions == ANSERWING_OPTION_ACCEPT_CALL)
362         {
363                 r = __pTelephonyMgr->AnswerCall(callHandle, true);
364         }
365         else
366         {
367                 r = __pTelephonyMgr->AcceptCall(answerOptions,callHandle);
368         }
369         if (IsFailed(r))
370         {
371                 __pTelEventListener->HandleTelephonyError(ERROR_GENERAL);
372         }
373 }
374
375 IListT<AppCallInfo>*
376 CallPresentationModel::GetCallListN(void)
377 {
378         return __pTelephonyMgr->GetCallListN();
379 }
380
381
382 bool
383 CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& contactNumber)
384 {
385         AppLogDebug("Enter");
386         result r = __pTelephonyMgr->AnswerCall(callHandle, false);
387         if (IsFailed(r))
388         {
389                 __pTelEventListener->HandleTelephonyError(ERROR_GENERAL);
390                 return false;
391         }
392
393         if (sendMsg == true && __pAppControlMgr != null)
394         {
395                 //launch compose message AppControl
396                 __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast<String*>(&contactNumber)), this);
397         }
398         AppLogDebug("Exit");
399         return true;
400 }
401
402 void CallPresentationModel::OnAppForeground(void)
403 {
404         if (__isMessageAppControlRunning == true)
405         {
406                 //This comes here, when Message AppControl is finished working.
407                 __isMessageAppControlRunning = false;
408                 __pAppControlMgr->AppControlRequestCompleted();
409                 //Check if this was the last call, then terminate application.
410                 //And if any calls are active, then those cases are already handled from Other places.
411                 if( GetCurrentCallCount() == 0)
412                 {
413                         CallApp* pPhoneApp = static_cast<CallApp*>(UiApp::GetInstance());
414                         pPhoneApp->Terminate();
415                 }
416         }
417 }
418
419 void
420 CallPresentationModel::OnAppControlCompleteResponseReceived(const AppId& appId, const String& operationId, AppCtrlResult appControlResult, const IMap* pExtraData)
421 {
422         if (__isMessageAppControlRunning == true)
423         {
424                 //This comes here, when Message AppControl is finished working.
425                 __isMessageAppControlRunning = false;
426                 __pAppControlMgr->AppControlRequestCompleted();
427                 //Check if this was the last call, then terminate application.
428                 //And if any calls are active, then those cases are already handled from Other places.
429                 if( GetCurrentCallCount() == 0)
430                 {
431                         CallApp* pPhoneApp = static_cast<CallApp*>(UiApp::GetInstance());
432                         pPhoneApp->Terminate();
433                 }
434         }
435         if(appId.Equals(PROVIDER_ID_PHONE,false) == true &&  operationId.Equals(OPERATION_ID_DIAL,false) == true)
436         {
437                 __isDialAppControlRunning = false;
438
439                 __pAppControlMgr->AppControlRequestCompleted();
440                 if(appControlResult == APP_CTRL_RESULT_SUCCEEDED)
441                 {
442                         String* pKey = new (std::nothrow) String(PARAM_PHONE_NUMBER);
443                         if (pExtraData->ContainsKey(*pKey) == true)
444                         {
445                                 const String* pPhoneNumber = static_cast<const String*>(pExtraData->GetValue(*pKey));
446                                 if(pPhoneNumber != null && pPhoneNumber->IsEmpty() == false)
447                                 {
448                                         AddCall(*pPhoneNumber);
449                                 }
450
451                         }
452
453                 }
454
455         }
456 }
457
458 void
459 CallPresentationModel::AddCall(const String& phoneNumber)
460 {
461         ArrayList* pLaunchArgs = null;
462         SceneManager* pSceneManager = SceneManager::GetInstance();
463         int currentActiveCallCount = GetCurrentCallCount();
464         if(currentActiveCallCount <= 1)
465         {
466                 //make an outgoing call with given number
467                 String* contactTxt = new (std::nothrow) String(phoneNumber);
468                 pLaunchArgs =  new (std::nothrow) ArrayList(SingleObjectDeleter);
469                 pLaunchArgs->Construct();
470                 pLaunchArgs->Add(contactTxt);
471                 bool isEmergencyCall = IsEmergencyNumber(*contactTxt, true);
472
473                 SceneId nextScene = IDSCN_SCENE_OUTCALL;
474                 if (isEmergencyCall)
475                 {
476                         nextScene = IDSCN_SCENE_OUT_EMERGENCYCALL;
477                 }
478                 pSceneManager->GoForward( ForwardSceneTransition( nextScene), pLaunchArgs);
479
480         }
481 }
482
483 int
484 CallPresentationModel::GetCurrentCallCount(void)
485 {
486         return __pTelephonyMgr->GetCurrentCallCount();
487 }
488
489 bool
490 CallPresentationModel::CheckSimInitializationIsCompleted()
491 {
492         result r = E_FAILURE;
493         if(__pTelephonyMgr != null)
494         {
495                 r = __pTelephonyMgr->CheckIfMOCallIsPossible();
496         }
497         return (!IsFailed(r));
498 }
499
500 bool
501 CallPresentationModel::IsEmergencyNumber(const Tizen::Base::String& phoneNumber, bool isSimInitialized)
502 {
503         return __pTelephonyMgr->CheckIfMOCallIsEmergency(phoneNumber, isSimInitialized);
504 }
505
506 void
507 CallPresentationModel::StartAlert(AppCallInfo& incomingCallInfo)
508 {
509         //Adding incoming call sate setting here
510         if(__pSettingsPresentor != null)
511         {
512                 __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_CONNECTING);
513         }
514         __pTelephonyMgr->StartAlert(incomingCallInfo);
515 }
516
517 void
518 CallPresentationModel::StopAlert(void)
519 {
520         __pTelephonyMgr->StopAlert();
521 }
522
523 Contact*
524 CallPresentationModel::GetContactN(const String& phoneNumber)
525 {
526         return __pTelephonyMgr->GetContactN(phoneNumber);
527 }
528
529 AppCallInfo*
530 CallPresentationModel::FetchIncomingCallDetailsN(const String& callHandle, const String& contactNumber)
531 {
532
533         return __pTelephonyMgr->FetchIncomingCallHandleN(callHandle, contactNumber);
534 }
535
536 bool
537 CallPresentationModel::CheckIncomingCallToBeRejected(AppCallInfo* pIncomingCallInfo)
538 {
539         return __pTelephonyMgr->CheckIncomingCallToBeRejected(pIncomingCallInfo);
540 }
541
542 /////////////////////////////////////////////////////////////////
543 /////  Event Listener methods from ITelephonyEventListener  /////
544 /////////////////////////////////////////////////////////////////
545 void
546 CallPresentationModel::HandleCallConnected(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList)
547 {
548         if (__pTelEventListener != null)
549         {
550                 __pTelEventListener->HandleCallConnected(pCallList);
551         }
552         if(__pSettingsPresentor != null)
553         {
554                 __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE);
555         }
556 }
557
558 void
559 CallPresentationModel::HandleCallDisconnected(bool isLastCall, Tizen::Base::Collection::IListT<AppCallInfo>& pCallList)
560 {
561         AppLogDebug("Enter");
562         if (isLastCall == true)
563         {
564                 SetSpeakerStatus(false);
565                 SetMuteStatus(false);
566                 if(__pSettingsPresentor != null)
567                 {
568                         __pSettingsPresentor->SetCallState(CALL_STATE_CALL_OFF);
569                 }
570         }
571         else
572         {
573                 if(__pSettingsPresentor != null)
574                 {
575                         __pSettingsPresentor->SetCallState(CALL_STATE_CALL_VOICE_ACTIVE);
576                 }
577         }
578         //1) Defer from sending call disconnected event to form, in case Msg AppControl is running,
579         //to avoid PhoneApp from going to EndCall form, where it shows for 3 sec. and automatically closes.
580         //2) Do not send call disconnected event to any form, in case an incoming call or dialing call is present.
581         if (__pTelEventListener != null && __isMessageAppControlRunning == false )
582         {
583                 __pTelEventListener->HandleCallDisconnected(isLastCall, pCallList);
584         }
585 }
586
587 void
588 CallPresentationModel::HandleConferenceCall(AppCallInfo& pCallInfo)
589 {
590         if (__pTelEventListener != null)
591         {
592                 __pTelEventListener->HandleConferenceCall(pCallInfo);
593         }
594 }
595
596 void
597 CallPresentationModel::HandleIncomingCall(AppCallInfo& pCallInfo)
598 {
599         AppLogDebug("Error - This will never come here. Since, now we are getting incoming call event through AppControl!!");
600 }
601
602 void
603 CallPresentationModel::HandleCallSwapOccured(Tizen::Base::Collection::IListT<AppCallInfo>& pCallList)
604 {
605         if (__pTelEventListener != null)
606         {
607                 __pTelEventListener->HandleCallSwapOccured(pCallList);
608         }
609 }
610
611 void
612 CallPresentationModel::HandleConferenceChange(void)
613 {
614         //1) Do not send conf. call changed event to any form, in case an incoming call or dialing call is present.
615         if (__pTelEventListener != null)
616         {
617                 __pTelEventListener->HandleConferenceChange();
618         }
619 }
620
621 void
622 CallPresentationModel::HandleTelephonyError(int errorCode)
623 {
624         if (__pTelEventListener != null)
625         {
626                 __pTelEventListener->HandleTelephonyError(errorCode);
627         }
628 }
629
630 void
631 CallPresentationModel::LaunchDialAppControl()
632 {
633
634         if(__isDialAppControlRunning == true)
635         {
636                 //Do not allow another app control if already running
637                 return;
638         }
639
640         //Launch dialer AppControl
641         if (__pAppControlMgr != null)
642         {
643                 __isDialAppControlRunning = __pAppControlMgr->LaunchDialerAppControl(this);
644         }
645
646 }
647
648 bool
649 CallPresentationModel::IsEnableJoinCallButton(void)
650 {
651         //Check if conf. call has maximum participants
652         AppCallInfo* pConfCallInfo = GetConferenceCallInfoN();
653         if(pConfCallInfo != null && pConfCallInfo->GetCallerListCount() >= IDI_MAX_CONF_CALL_PARTICIPANTS)
654         {
655                 return false;
656         }
657
658         //check if either of the caller is same or present in conf call.
659         IListT<AppCallInfo>* pActiveCallList = GetCallListN();
660         if ( pActiveCallList != null && pActiveCallList->GetCount() == IDI_MAX_ACTIVE_CALLS)
661         {
662                 AppCallInfo firstCall;
663                 AppCallInfo secondCall;
664                 pActiveCallList->GetAt(0, firstCall);
665                 pActiveCallList->GetAt(1, secondCall);
666
667                 if (firstCall.IsConferenceCall() == true)
668                 {
669                         IListT<AppCallInfo>* pConfMemberList = firstCall.GetCallerList();
670                         for (int index = 0; index < pConfMemberList->GetCount(); index++)
671                         {
672                                 AppCallInfo singleConfMember;
673                                 pConfMemberList->GetAt(index, singleConfMember);
674                                 if (secondCall.GetContactNumber().IsEmpty() == false && secondCall.GetContactNumber().Equals(singleConfMember.GetContactNumber()) == true)
675                                 {
676                                         return false;
677                                 }
678                         }
679                 }
680                 else if (secondCall.IsConferenceCall() == true)
681                 {
682                         IListT<AppCallInfo>* pConfMemberList = secondCall.GetCallerList();
683                         for (int index = 0; index < pConfMemberList->GetCount(); index++)
684                         {
685                                 AppCallInfo singleConfMember;
686                                 pConfMemberList->GetAt(index, singleConfMember);
687                                 if (firstCall.GetContactNumber().IsEmpty() == false && firstCall.GetContactNumber().Equals(singleConfMember.GetContactNumber()) == true)
688                                 {
689                                         return false;
690                                 }
691                         }
692                 }
693                 else
694                 {
695                         //Now, we definitely know that both are single active calls.
696                         if (firstCall.GetContactNumber().IsEmpty() == false && firstCall.GetContactNumber().Equals(secondCall.GetContactNumber()) == true)
697                         {
698                                 return false;
699                         }
700                 }
701         }
702         delete pConfCallInfo;
703         pConfCallInfo = null;
704         return true;
705 }
706
707 bool
708 CallPresentationModel::IsIncomingorDialingCallPresent(void)
709 {
710         //returns false, if incoming call or dialed call is present.
711         return __pTelephonyMgr->IsIncomingorDialingCallPresent();
712 }
713
714 bool
715 CallPresentationModel::LaunchComposeMessageAppControl(String& contactNumber, IAppControlResponseListener* pListener)
716 {
717         if (__pAppControlMgr != null)
718         {
719                 return __pAppControlMgr->LaunchComposeMessageAppControl(contactNumber, pListener);
720         }
721         return false;
722 }
723
724 bool
725 CallPresentationModel::LaunchViewContactAppControl(String& contactId, IAppControlResponseListener* pListener)
726 {
727         if (__pAppControlMgr != null)
728         {
729                 return __pAppControlMgr->LaunchViewContactAppControl(contactId, pListener);
730         }
731         return false;
732 }
733
734 bool
735 CallPresentationModel::LaunchAddContactAppControl(Tizen::Base::String& contactNumber, Tizen::App::IAppControlResponseListener* pListener)
736 {
737         if (__pAppControlMgr != null)
738         {
739                 return __pAppControlMgr->LaunchAddContactAppControl(contactNumber, pListener);
740         }
741         return false;
742 }
743
744 bool
745 CallPresentationModel::IsAppControlRunning(void)
746 {
747         if (__pAppControlMgr != null)
748         {
749                 return __pAppControlMgr->IsAppControlRunning();
750         }
751         return false;
752 }
753
754 void
755 CallPresentationModel::AbortAppControlRequest(void)
756 {
757         if (__pAppControlMgr != null)
758         {
759                 __pAppControlMgr->AbortAppControlRequest();
760         }
761 }
762
763 void
764 CallPresentationModel::AppControlRequestCompleted(void)
765 {
766         if (__pAppControlMgr != null)
767         {
768                 __pAppControlMgr->AppControlRequestCompleted();
769         }
770 }