Fix for N_SE-35771
authorAmith Kumar Mahale <amith.m@samsung.com>
Mon, 22 Apr 2013 12:14:14 +0000 (17:44 +0530)
committerAmith Kumar Mahale <amith.m@samsung.com>
Mon, 22 Apr 2013 12:14:14 +0000 (17:44 +0530)
Change-Id: I55351864ba26736a49334b2339015bb284d57ca0
Signed-off-by: Amith Kumar Mahale <amith.m@samsung.com>
inc/CallActiveCallForm.h
inc/CallEndCallForm.h
inc/CallIAppStateChangeListner.h
inc/CallIncomingCallForm.h
src/CallApp.cpp
src/CallIncomingCallForm.cpp

index 57dd0a2..69135bf 100644 (file)
@@ -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
index 5cf6de6..65cbfe0 100644 (file)
@@ -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);
 
index 323bfbf..fa63b79 100644 (file)
@@ -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_ */
index eccdeb8..77b4070 100644 (file)
@@ -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);
index b9f46b6..714b8ca 100644 (file)
@@ -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<IAppStateChangeListener*>(pEnum->GetCurrent());
+               if (pInterface == null)
+               {
+                       delete pEnum;
+
+                       return;
+               }
+               pInterface->OnScreenOff();
+       }
+       delete pEnum;
+
 }
 
 SceneId
index fa067b7..fdea3cb 100644 (file)
@@ -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.