diff -r a289dde0a1d6 -r 415ff50d2eca camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp --- a/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Fri Sep 17 08:27:13 2010 +0300 +++ b/camerauis/cameraxui/cxui/src/cxuiapplicationstate.cpp Mon Oct 04 00:05:08 2010 +0300 @@ -48,6 +48,9 @@ // USB mass memory mode signal connect(mApplicationMonitor, SIGNAL(usbMassMemoryModeToggled(bool)), this, SLOT(handleUsbMassMemoryModeChanged(bool))); + + // Task switcher state signal + connect(mApplicationMonitor, SIGNAL(taskSwitcherStateChanged(bool)), this, SLOT(handleTaskSwitcherStateChanged(bool))); // Severe error signals connect(mErrorManager, SIGNAL(errorPopupShown()), this, SLOT(handleSevereError())); @@ -121,10 +124,10 @@ mErrorManager->clear(); } else { CX_DEBUG(("CxuiApplicationState - application is in partial / full foreground")); - // Check that we were in background. Switching between partial and full background - // needs no actions. - if (currentState() == Background) { - CX_DEBUG(("CxuiApplicationState - application was in background before, moving to foreground")); + // Check that we were in background or standby state. + // State can be standby, if camera lost focus to task switcher. + if (currentState() == Background || currentState() == Standby) { + CX_DEBUG(("CxuiApplicationState - application was in partial/full background, moving to foreground")); // Check that there's no active errors that have been ignored in background. checkErrors(); if (currentState() != Error) { @@ -165,6 +168,26 @@ } /*! +* Handle Task Switcher state changes. +* If Task Switcher activates, we enter standby mode. +* When we receive foreground event, we can move back to Normal mode. +* @param foreground Is the Task Switcher in foreground/active. +*/ +void CxuiApplicationState::handleTaskSwitcherStateChanged(bool foreground) +{ + CX_DEBUG_ENTER_FUNCTION(); + if (foreground) { + // When task switcher is active, we enter standby mode. + if (currentState() == Normal) { + // Go to standby mode (release camera). + CX_DEBUG(("CxuiApplicationState - application losing partial-foreground to task switcher")); + setState(Standby); + } + } + CX_DEBUG_EXIT_FUNCTION(); +} + +/*! * Handle battery emptying. We need to stop all activity and exit the application. */ void CxuiApplicationState::handleBatteryEmpty()