From: Amith Kumar Mahale Date: Mon, 22 Apr 2013 12:14:14 +0000 (+0530) Subject: Fix for N_SE-35771 X-Git-Tag: accepted/tizen_2.1/20130425.023544~2 X-Git-Url: http://review.tizen.org/git/?p=apps%2Fosp%2FCall.git;a=commitdiff_plain;h=b8fd35648b7c3c206790418d7252ad61ba05a816 Fix for N_SE-35771 Change-Id: I55351864ba26736a49334b2339015bb284d57ca0 Signed-off-by: Amith Kumar Mahale --- diff --git a/inc/CallActiveCallForm.h b/inc/CallActiveCallForm.h index 57dd0a2..69135bf 100644 --- a/inc/CallActiveCallForm.h +++ b/inc/CallActiveCallForm.h @@ -73,6 +73,7 @@ public: //From IAppStateChangeListener virtual void OnForeground(void); virtual void OnBackground(void){}; + virtual void OnScreenOff(void){}; private: // Create the call buttons panel and add to form diff --git a/inc/CallEndCallForm.h b/inc/CallEndCallForm.h index 5cf6de6..65cbfe0 100644 --- a/inc/CallEndCallForm.h +++ b/inc/CallEndCallForm.h @@ -90,6 +90,8 @@ public: virtual void OnForeground(void); //Called when App goes to background virtual void OnBackground(void); + //Called when screen goes off + virtual void OnScreenOff(void){}; //From IOrientationEventListener virtual void OnOrientationChanged(const Tizen::Ui::Control& source, Tizen::Ui::OrientationStatus orientationStatus); diff --git a/inc/CallIAppStateChangeListner.h b/inc/CallIAppStateChangeListner.h index 323bfbf..fa63b79 100644 --- a/inc/CallIAppStateChangeListner.h +++ b/inc/CallIAppStateChangeListner.h @@ -32,6 +32,7 @@ public: virtual void OnForeground(void) = 0; virtual void OnBackground(void) = 0; + virtual void OnScreenOff(void) = 0; }; #endif /* _PHN_STATE_CHANGE_LISTNER_H_ */ diff --git a/inc/CallIncomingCallForm.h b/inc/CallIncomingCallForm.h index eccdeb8..77b4070 100644 --- a/inc/CallIncomingCallForm.h +++ b/inc/CallIncomingCallForm.h @@ -107,6 +107,8 @@ public: //From IAppStateChangeListener virtual void OnForeground(void); virtual void OnBackground(void){}; + virtual void OnScreenOff(void); + private: // Method to fetch person details using phone number. void ShowPersonDetails(const Tizen::Base::String& phoneNumber, const Tizen::Base::String& contactLblName, const Tizen::Base::String& nameLblName, AppCallInfo* pCallInfo); diff --git a/src/CallApp.cpp b/src/CallApp.cpp index b9f46b6..714b8ca 100644 --- a/src/CallApp.cpp +++ b/src/CallApp.cpp @@ -46,6 +46,7 @@ CallApp::OnAppInitializing(AppRegistry& appRegistry) { AppControlProviderManager* pProviderMgr = AppControlProviderManager::GetInstance(); pProviderMgr->SetAppControlProviderEventListener(this); + PowerManager::AddScreenEventListener(*this); return true; } @@ -86,6 +87,7 @@ CallApp::OnAppTerminating(AppRegistry& appRegistry, bool forcedTermination) // TODO: // Deallocate resources allocated by this App for termination. // The App's permanent data and context can be saved via appRegistry. + PowerManager::RemoveScreenEventListener(*this); return true; } @@ -139,12 +141,21 @@ CallApp::OnScreenOn(void) void CallApp::OnScreenOff(void) { - // TODO: - // Unless there is a strong reason to do otherwise, release resources (such as 3D, media, and sensors) to allow the device - // to enter the sleep mode to save the battery. - // Invoking a lengthy asynchronous method within this listener method can be risky, because it is not guaranteed to invoke a - // callback before the device enters the sleep mode. - // Similarly, do not perform lengthy operations in this listener method. Any operation must be a quick one. + AppLogDebug("Enter"); + IEnumerator* pEnum = __listenerList.GetEnumeratorN(); + while (pEnum->MoveNext() == E_SUCCESS) + { + IAppStateChangeListener* pInterface = static_cast(pEnum->GetCurrent()); + if (pInterface == null) + { + delete pEnum; + + return; + } + pInterface->OnScreenOff(); + } + delete pEnum; + } SceneId diff --git a/src/CallIncomingCallForm.cpp b/src/CallIncomingCallForm.cpp index fa067b7..fdea3cb 100644 --- a/src/CallIncomingCallForm.cpp +++ b/src/CallIncomingCallForm.cpp @@ -1598,6 +1598,12 @@ IncomingCallForm::OnForeground(void) } void +IncomingCallForm::OnScreenOff(void) +{ + __pCallPresentor->StopAlert(); +} + +void IncomingCallForm::CallDisconnected(void) { //check if no call option popup is shown, then remain on incoming call screen.