Fix for N_SE-51371
[apps/osp/Call.git] / src / CallApp.cpp
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.1 (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  * Name        : CallApp
18  * Version     :
19  * Vendor      :
20  * Description :
21  */
22
23 #include <FUi.h>
24 #include <FShell.h>
25 #include "CallApp.h"
26 #include "CallAppFrame.h"
27 #include "CallPresentationModel.h"
28 #include "CallTypes.h"
29 #include "CallAppUtility.h"
30 #include "CallIAppStateChangeListner.h"
31
32 using namespace Tizen::App;
33 using namespace Tizen::Base;
34 using namespace Tizen::System;
35 using namespace Tizen::Ui;
36 using namespace Tizen::Ui::Controls;
37 using namespace Tizen::Ui::Scenes;
38 using namespace Tizen::Base::Utility;
39 using namespace Tizen::Base::Collection;
40 using namespace Tizen::Base::Utility;
41 using namespace Tizen::Shell;
42
43 static const int FONT_SIZE_AUTOREJECT_POPUP_TEXT = 36;
44
45
46 CallApp::CallApp(void):__initialSceneId(L""), __pLaunchArgs(null)
47 {
48         __listenerList.Construct();
49         __pCallRejectedIonPopup = null;
50         __pCallAppTimer = null;
51         __callTicks = 0;
52 }
53
54 CallApp::~CallApp(void)
55 {
56 }
57
58 UiApp*
59 CallApp::CreateInstance(void)
60 {
61         // Create the instance through the constructor.
62         return new CallApp();
63 }
64
65 bool
66 CallApp::OnAppInitializing(AppRegistry& appRegistry)
67 {
68         AppControlProviderManager* pProviderMgr = AppControlProviderManager::GetInstance();
69         pProviderMgr->SetAppControlProviderEventListener(this);
70         PowerManager::AddScreenEventListener(*this);
71         __callRejectedIontimer.Construct(*this);
72         return true;
73 }
74
75 bool
76 CallApp::OnAppInitialized(void)
77 {
78         // TODO:
79         // Comment.
80
81         // Create a Frame
82         CallAppFrame* pCallAppFrame = new CallAppFrame();
83         pCallAppFrame->Construct();
84         pCallAppFrame->SetName(L"CallApp");
85         AddFrame(*pCallAppFrame);
86
87         //Check if there is no initial scene, then exit application.
88         //This case will normally come when invalid AppControl request has come,
89         //or incoming call is coming from unknown number and "reject unknown number" settings is enabled.
90         if (GetInitialScene().IsEmpty() == true)
91         {
92                 return false;
93         }
94
95         if (__pCallAppTimer == null)
96         {
97                 __pCallAppTimer = new (std::nothrow) Tizen::Base::Runtime::Timer();
98                 __pCallAppTimer->Construct(*this);
99                 long long currTime = 0;
100                 SystemTime::GetTicks(currTime);
101                 __callTicks = currTime;
102                 __pCallAppTimer->StartAsRepeatable(TimeSpan::NUM_OF_TICKS_IN_SECOND);
103         }
104
105
106         return true;
107 }
108
109 bool
110 CallApp::OnAppWillTerminate(void)
111 {
112         // TODO:
113         // Comment.
114         return true;
115 }
116
117 bool
118 CallApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination)
119 {
120         // TODO:
121         // Deallocate resources allocated by this App for termination.
122         // The App's permanent data and context can be saved via appRegistry.
123         PowerManager::RemoveScreenEventListener(*this);
124         if (__pCallAppTimer != null)
125         {
126                 __pCallAppTimer->Cancel();
127                 delete __pCallAppTimer;
128         }
129
130         return true;
131 }
132
133 void
134 CallApp::OnForeground(void)
135 {
136         IEnumerator* pEnum = __listenerList.GetEnumeratorN();
137         while (pEnum->MoveNext() == E_SUCCESS)
138         {
139                 IAppStateChangeListener* pInterface = static_cast<IAppStateChangeListener*>(pEnum->GetCurrent());
140                 if (pInterface == null)
141                 {
142                         delete pEnum;
143
144                         return;
145                 }
146                 pInterface->OnForeground();
147         }
148         delete pEnum;
149 }
150
151 void
152 CallApp::OnBackground(void)
153 {
154         // TODO:
155         // Stop drawing when the application is moved to the background.
156 }
157
158 void
159 CallApp::OnLowMemory(void)
160 {
161         // TODO:
162         // Free unused resources or close the application.
163 }
164
165 void
166 CallApp::OnBatteryLevelChanged(BatteryLevel batteryLevel)
167 {
168         // TODO:
169         // Handle any changes in battery level here.
170         // Stop using multimedia features(camera, mp3 etc.) if the battery level is CRITICAL.
171 }
172
173 void
174 CallApp::OnScreenOn(void)
175 {
176         // TODO:
177         // Get the released resources or resume the operations that were paused or stopped in OnScreenOff().
178 }
179
180 void
181 CallApp::OnScreenOff(void)
182 {
183         AppLogDebug("Enter");
184         IEnumerator* pEnum = __listenerList.GetEnumeratorN();
185         while (pEnum->MoveNext() == E_SUCCESS)
186         {
187                 IAppStateChangeListener* pInterface = static_cast<IAppStateChangeListener*>(pEnum->GetCurrent());
188                 if (pInterface == null)
189                 {
190                         delete pEnum;
191
192                         return;
193                 }
194                 pInterface->OnScreenOff();
195         }
196         delete pEnum;
197
198 }
199
200 SceneId
201 CallApp::GetInitialScene(void)
202 {
203         return __initialSceneId;
204 }
205
206 IList*
207 CallApp::GetAppLaunchArguments(void)
208 {
209         return __pLaunchArgs;
210 }
211
212 void
213 CallApp::AddAppStateChangeListener(const IAppStateChangeListener& listener)
214 {
215         __listenerList.Add(listener);
216
217 }
218 void
219 CallApp::RemoveAppStateChangeListener(const IAppStateChangeListener& listener)
220 {
221         __listenerList.Remove(listener);
222 }
223
224 void
225 CallApp::OnAppControlRequestReceived(RequestId reqId, const String& operationId, const String* pUriData,
226                 const String* pMimeType, const IMap* pExtraData)
227 {
228         AppLogDebug("Enter ");
229         if(pUriData != null)
230         {
231                 AppLogDebug("%ls ",pUriData->GetPointer());
232         }
233
234         if(pExtraData == null && pUriData != null)
235         {
236                 //The request is from web app
237                 AppLogDebug("%ls",pUriData->GetPointer());
238                 ProcessWebAppControlRequest(reqId, operationId, pUriData);
239         }
240         else
241         {
242                 //process AppControl parameters
243                 ProcessAppControlRequest(reqId, operationId, pExtraData,pUriData);
244         }
245         AppLogDebug("EXIT");
246 }
247
248 void
249 CallApp::ProcessWebAppControlRequest(RequestId reqId, const String& operationId,const String* pUriData)
250 {
251         //Construct map from string
252         String delim(DELIMITER);
253         StringTokenizer st(*pUriData,delim);
254         String token;
255         HashMap extraData;
256         extraData.Construct();
257         while(st.HasMoreTokens())
258         {
259                 String key=L"";
260                 String value=L"";
261                 st.GetNextToken(token);
262                 token.Trim();
263                 key.Append(token);
264                 if(st.HasMoreTokens())
265                 {
266                         token.Clear();
267                         st.GetNextToken(token);
268                         token.Trim();
269                         value.Append(token);
270                 }
271                 extraData.Add(new (std::nothrow) String(key), new (std::nothrow) String(value));
272         }
273
274         //Adding this explicitly as there no other way to invoke call from webapp
275         extraData.Add(new (std::nothrow) String(PARAM_CALL_TYPE), new (std::nothrow) String(PARAM_CALL_VALUE_VOICE));
276
277         ProcessAppControlRequest(reqId,operationId,&extraData);
278
279         extraData.RemoveAll(true);
280 }
281
282 void
283 CallApp::ProcessAppControlRequest(RequestId reqId, const String& operationId,const IMap* pArgsMap,const String* pUriData)
284 {
285         AppLogDebug("Enter %ls",operationId.GetPointer());
286         __pLaunchArgs = null;
287         if(operationId.Equals(OPERATION_ID_CALL,true) == true)
288         {
289                 AppLogDebug("OPERATION_ID_CALL");
290                 if(pArgsMap != null)
291                 {
292                         bool isIncomingCallRequest = false;
293                         String* pKey = new (std::nothrow) String(LAUNCHTYPE);
294                         if (pArgsMap->ContainsKey(*pKey) == true)
295                         {
296                                 const String* pValue = static_cast<const String*>(pArgsMap->GetValue(*pKey));
297                                 if ((pValue != null) && (pValue->Equals(PARAM_ORIGIN_MT, true) == true))
298                                 {
299                                         isIncomingCallRequest = true;
300                                 }
301                         }
302                         //Check if incoming call request or outgoing call request
303                         if(isIncomingCallRequest == true)
304                         {
305                                 HandleIncomingCallAppControlRequest(reqId, pArgsMap);
306                         }
307                         else
308                         {
309                                 HandleDialCallAppControlRequest(reqId, pArgsMap,pUriData);
310                         }
311                 }
312                 else
313                 {
314                         AppLogDebug("pArgsMap == null");
315                 }
316         }
317 }
318
319 void
320 CallApp::HandleIncomingCallAppControlRequest(RequestId reqId,const IMap* pArgsMap)
321 {
322         AppLogDebug("Enter");
323         SceneManager* pSceneManager = SceneManager::GetInstance();
324         //response message
325         AppCtrlResult appControlResult = APP_CTRL_RESULT_FAILED;
326
327         //call handle
328         String callHandle(L"");
329         String* pKey = new (std::nothrow) String(CALL_HANDLE);
330         if (pArgsMap->ContainsKey(*pKey) == true)
331         {
332                 const String* pValue = static_cast<const String*>(pArgsMap->GetValue(*pKey));
333                 if (pValue != null)
334                 {
335                         callHandle.Append(*pValue);
336                 }
337         }
338         delete pKey;
339         //contact number
340         String contactNumber(L"");
341         pKey = new (std::nothrow) String(CONTACT_NUMBER);
342         if (pArgsMap->ContainsKey(*pKey) == true)
343         {
344                 const String* pContactValue = static_cast<const String*>(pArgsMap->GetValue(*pKey));
345                 if (pContactValue != null)
346                 {
347                         contactNumber.Append(*pContactValue);
348                         AppLogDebug("%ls",contactNumber.GetPointer());
349                 }
350         }
351         delete pKey;
352         pKey = null;
353
354         //Fetch incoming call details
355         CallPresentationModel* pCallPresentor = CallPresentationModel::GetInstance();
356         //Check if there is already a dial call present .This can happen in some
357         //race conditions N_SE-39531
358    // removing this as per N_SE-49099
359         /*if(pCallPresentor->IsIncomingorDialingCallPresent())
360         {
361                 int incomingHandle;
362                 Integer::Parse(callHandle,incomingHandle);
363                 pCallPresentor->RejectCall(incomingHandle,false,contactNumber);
364                 AppLog("Cancelled already an incoming call present");
365                 appControlResult = APP_CTRL_RESULT_CANCELED;
366                 AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, appControlResult, null);
367                 return;
368         }*/
369
370         AppCallInfo* pIncomingCall = pCallPresentor->FetchIncomingCallDetailsN(callHandle, contactNumber);
371         if(pIncomingCall != null)
372         {
373                 bool isCallRejected = pCallPresentor->CheckIncomingCallToBeRejected(pIncomingCall);
374                 if(isCallRejected == false)
375                 {
376                         //save app launch argument list
377                         __pLaunchArgs = new (std::nothrow) ArrayList(SingleObjectDeleter);
378                         __pLaunchArgs->Construct(1);
379                         __pLaunchArgs->Add(pIncomingCall);
380                         if(__initialSceneId.IsEmpty() == true)
381                         {
382                                 __initialSceneId = IDSCN_SCENE_INCOMINGCALL;
383                         }
384                         else
385                         {
386                                 //App already initialized, goto incoming call form
387                                 pSceneManager->GoForward(ForwardSceneTransition(IDSCN_SCENE_INCOMINGCALL, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
388                                                  SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_DESTROY), __pLaunchArgs);
389                                 __pLaunchArgs = null;
390                         }
391
392
393                 }
394                 else
395                 {
396                         //Show messageBox showing automatic call rejection
397                         /*MessageBox callRejectedInoMsgBox;
398                         String msg(L"Call From ");
399                         msg.Append(contactNumber);
400                         msg.Append(L" Rejected.");
401                         callRejectedInoMsgBox.Construct(L"Call Rejected", msg, MSGBOX_STYLE_NONE,1000);
402                         int modalResult = 0;
403                         // Calls ShowAndWait() : Draws and Shows itself and processes events
404                         callRejectedInoMsgBox.ShowAndWait(modalResult);*/
405                         //go back to previous scene if App was already running, else exit application.
406                         if(__initialSceneId.IsEmpty() == true)
407                         {
408                                 //KEEP "__initialSceneId" as empty and return false from "OnAppInitialized()"
409                                 AppLog("Terminate Phone Application");
410                                 Terminate();
411                         }
412                         else
413                         {
414                                 ShowAutoRejectPopup(contactNumber);
415                         }
416                 }
417                 //set success message
418                 appControlResult = APP_CTRL_RESULT_SUCCEEDED;
419         }
420         else
421         {
422                 appControlResult = APP_CTRL_RESULT_FAILED;
423         }
424         AppLogDebug("Exiting %d",appControlResult);
425         AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, appControlResult, null);
426 }
427
428 void
429 CallApp::ShowAutoRejectPopup(Tizen::Base::String contactNumber)
430 {
431         String msg(AppUtility::GetResourceString(IDS_CALL_REJECT_FROM_STRING));
432         msg.Append(L" ");
433         msg.Append(contactNumber);
434         if(__pCallRejectedIonPopup != null)
435         {
436                 delete __pCallRejectedIonPopup;
437                 __pCallRejectedIonPopup = null;
438         }
439         __pCallRejectedIonPopup = new (std::nothrow) Popup();
440         Tizen::Graphics::Dimension dim(600,200);
441         __pCallRejectedIonPopup->Construct(true, dim);
442         __pCallRejectedIonPopup->SetTitleText(AppUtility::GetResourceString(IDS_CALL_REJECTED_TITLE_STRING));
443         Label* pLabelText = new (std::nothrow) Label();
444         pLabelText->Construct(Tizen::Graphics::Rectangle(0, 0, dim.width, dim.height-100), msg);
445         pLabelText->SetTextConfig(FONT_SIZE_AUTOREJECT_POPUP_TEXT, LABEL_TEXT_STYLE_NORMAL);
446         pLabelText->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
447         pLabelText->SetTextVerticalAlignment(ALIGNMENT_MIDDLE);
448         __pCallRejectedIonPopup->AddControl(pLabelText);
449         __pCallRejectedIonPopup->Show();
450         __pCallRejectedIonPopup->SetShowState(true);
451         __callRejectedIontimer.Start(3000);
452 }
453
454 void
455 CallApp::OnTimerExpired(Tizen::Base::Runtime::Timer &timer)
456 {
457         if (__callRejectedIontimer.Equals(timer))
458         {
459                 if(__pCallRejectedIonPopup != null)
460                 {
461                         delete __pCallRejectedIonPopup;
462                         __pCallRejectedIonPopup = null;
463                 }
464         }
465
466         if(__pCallAppTimer->Equals(timer))
467         {
468                 __callTicks += 1000;
469         }
470 }
471
472 void
473 CallApp::HandleDialCallAppControlRequest(RequestId reqId,const IMap* pArgsMap,const String* pUriData)
474 {
475         //response message
476         AppCtrlResult appControlResult = APP_CTRL_RESULT_FAILED;
477
478         if (pArgsMap != null)
479         {
480                 String callType(L"");
481                 String phoneNumber(L"");
482                 //phone number
483                 String* pKey = new (std::nothrow) String(PARAM_PHONE_NUMBER);
484                 if(pArgsMap->ContainsKey(*pKey) == true)
485                 {
486                         const String* pPhoneValue = static_cast<const String*>(pArgsMap->GetValue(*pKey));
487                         if(pPhoneValue != null)
488                         {
489                                 AppLogDebug("%ls",pPhoneValue->GetPointer());
490                                 phoneNumber.Append(*pPhoneValue);
491                         }
492                 }
493                 else
494                 {
495                         AppLogDebug("PARAM_PHONE_NUMBER not present");
496                         //Now check if tel uri is present
497                         if(pUriData != null)
498                         {
499                                 AppLogDebug("pUriData is present %ls",pUriData->GetPointer());
500                                 phoneNumber.Append(*pUriData);
501                                 if(phoneNumber.Contains(PARAM_PHONE_NUMBER))
502                                 {
503                                         phoneNumber.Replace(PARAM_PHONE_NUMBER,L"");
504                                         if(phoneNumber.Contains(DELIMITER))
505                                         {
506                                                 phoneNumber.Replace(DELIMITER,L"");
507                                                 AppLogDebug("%ls",phoneNumber.GetPointer());
508                                         }
509                                 }
510                                 AppLogDebug("%ls",phoneNumber.GetPointer());
511                         }
512                 }
513                 delete pKey;
514                 //Check if its a valid number
515         /*      if(CheckNumberIsValid(phoneNumber) == false)
516                 {
517                         //go back to previous scene if App was already running, else exit application.
518                         if(__initialSceneId.IsEmpty() == true)
519                         {
520                                 //KEEP "__initialSceneId" as empty and return false from "OnAppInitialized()"
521                                 AppLog("Terminate Phone Application");
522                                 AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, appControlResult, null);
523                                 Terminate();
524                                 return;
525                         }
526                         else
527                         {
528                                 //invalid phone number.always return, but App will come to foreground
529                                 //and show current screen, if any calls is present.
530                                 return;
531                         }
532                 }*/
533                 //call type
534                 pKey = new (std::nothrow) String(PARAM_CALL_TYPE);
535                 if(pArgsMap->ContainsKey(*pKey) == true)
536                 {
537                         const String* pCallTypeValue = static_cast<const String*>(pArgsMap->GetValue(*pKey));
538                         if(pCallTypeValue != null)
539                         {
540                                 callType.Append(*pCallTypeValue);
541                         }
542                 }
543                 delete pKey;
544                 pKey = null;
545
546                 //Fetch currently active call count
547                 if (callType.IsEmpty() == false
548                                 && callType.Equals(PARAM_CALL_VALUE_VOICE, false) == true
549                                 && phoneNumber.IsEmpty() == false)
550                 {
551                         SceneManager* pSceneManager = SceneManager::GetInstance();
552                         //check if there is already a call in dialing mode, then dont accept any other dialing request.
553                         if (pSceneManager->GetCurrentSceneId() == IDSCN_SCENE_OUTCALL
554                                         || pSceneManager->GetCurrentSceneId()
555                                                         == IDSCN_SCENE_OUT_EMERGENCYCALL)
556                         {
557                                 AppLog("Cancelled");
558                                 appControlResult = APP_CTRL_RESULT_CANCELED;
559                                 AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, appControlResult, null);
560                                 return;
561                         }
562
563                         CallPresentationModel* pCallPresentor = CallPresentationModel::GetInstance();
564                         //Check if there is already an incoming call
565                         //this can  happen in some race conditions N_SE-39531
566                         if(pCallPresentor->IsIncomingorDialingCallPresent() == true)
567                         {
568                                 AppLog("Cancelled already an incoming call present");
569                                 appControlResult = APP_CTRL_RESULT_CANCELED;
570                                 AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, appControlResult, null);
571                                 return;
572                         }
573                         int currentActiveCallCount = pCallPresentor->GetCurrentCallCount();
574                         if(currentActiveCallCount <= 1)
575                         {
576                                 //Abort any AppControl Request running already to show incoming call screen
577                                 if (pCallPresentor->IsAppControlRunning() == true)
578                                 {
579                                         pCallPresentor->AbortAppControlRequest();
580                                 }
581                                 //make an outgoing call with given number
582                                 String* contactTxt = new (std::nothrow) String(phoneNumber);
583                                 __pLaunchArgs =  new (std::nothrow) ArrayList(SingleObjectDeleter);
584                                 __pLaunchArgs->Construct();
585                                 __pLaunchArgs->Add(contactTxt);
586                                 bool isEmergencyCall = pCallPresentor->IsEmergencyNumber(*contactTxt, true);
587
588                                 SceneId nextScene = IDSCN_SCENE_OUTCALL;
589                                 if (isEmergencyCall)
590                                 {
591                                         nextScene = IDSCN_SCENE_OUT_EMERGENCYCALL;
592                                 }
593                                 //Check if app was already running
594                                 if(__initialSceneId.IsEmpty() == true)
595                                 {
596                                         //phone App is not already launched
597                                         __initialSceneId = nextScene;
598                                 }
599                                 else
600                                 {
601                                         AppLog("Outgoing call");
602                                         pSceneManager->GoForward( ForwardSceneTransition( nextScene, SCENE_TRANSITION_ANIMATION_TYPE_NONE,
603                                                          SCENE_HISTORY_OPTION_NO_HISTORY, SCENE_DESTROY_OPTION_KEEP), __pLaunchArgs);
604                                 }
605                                 appControlResult = APP_CTRL_RESULT_SUCCEEDED;
606                         }
607                         else
608                         {
609                                 //already 2 active calls, 3rd call not allowed
610                                 appControlResult = APP_CTRL_RESULT_CANCELED;
611                         }
612                 }
613                 else
614                 {
615                         appControlResult = APP_CTRL_RESULT_FAILED;
616                 }
617         }
618         //send response message
619         AppControlProviderManager::GetInstance()->SendAppControlResult(reqId, appControlResult, null);
620 }
621
622 bool
623 CallApp::CheckNumberIsValid(String phoneNumber)
624 {
625         //Pattern to compare all characters except 0-9 * # P ; , +
626         String phoneNumberPattern(L"[^0-9*#P,p+;]");
627         RegularExpression checkPhoneNumber;
628         checkPhoneNumber.Construct(phoneNumberPattern);
629         //If there is any character other than these listed above then display invalid number
630         bool resultMatch = checkPhoneNumber.Match(phoneNumber,false);
631         //return false for patterns other than 0-9 * # P ; , +
632         if(resultMatch == true)
633         {
634                 //return phone number is invalid
635                 return false;
636         }
637
638         return true;
639
640 }
641
642 void
643 CallApp::SetTopMostWindow(bool bTopMost)
644 {
645         AppLogDebug("bTopMost = %d",bTopMost);
646         result res = E_FAILURE;
647         //ToDO: Need to see if there is better way to handle
648         //this case
649
650         if(bTopMost == true)
651         {
652                 GetAppFrame()->GetFrame()->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_HIGHEST);
653                 AppManager::GetInstance()->AddActiveAppEventListener(*this);
654                 /*if(PowerManager::IsScreenOn() == false)
655                 {
656                         AppLogDebug("TurnScreenOn");
657                         res = PowerManager::TurnScreenOn();
658                         AppLogDebug("TurnScreenOn %d",res);
659                 }*/
660
661         }
662         else
663         {
664                 GetAppFrame()->GetFrame()->SetZOrderGroup(WINDOW_Z_ORDER_GROUP_NORMAL);
665                 PowerManager::KeepScreenOnState(false);
666                 AppManager::GetInstance()->RemoveActiveAppEventListener(*this);
667         }
668
669         if(LockManager::GetInstance()->IsLocked())
670         {
671                 AppLogDebug("Phone Locked");
672                 LockManager::GetInstance()->Unlock();
673         }
674
675 }
676 void
677 CallApp::OnActiveAppChanged(const String& appId)
678 {
679         AppLogDebug("Enter %ls",appId.GetPointer());
680         if(GetAppId().Equals(appId) == true)
681         {
682                 result res = PowerManager::KeepScreenOnState(true,false);
683                 AppLogDebug("KeepScreenOnState %d",res);
684
685         }
686
687 }
688
689 long long
690 CallApp::GetCallAppTicks(void)
691 {
692         return __callTicks;
693 }