--- a/group/screensaver.mmp Tue Apr 27 16:38:49 2010 +0300
+++ b/group/screensaver.mmp Tue May 11 16:14:23 2010 +0300
@@ -65,7 +65,6 @@
SOURCE screensaverrepositorywatcher.cpp
SOURCE screensavershareddatamonitor.cpp
SOURCE screensaverengine.cpp
-SOURCE screensaveractivitymanager.cpp
START RESOURCE screensaver.rss
HEADER
@@ -115,6 +114,7 @@
LIBRARY CenRepNotifHandler.lib
LIBRARY efsrv.lib
LIBRARY flogger.lib
+LIBRARY activitymanager.lib
#ifdef RD_UI_TRANSITION_EFFECTS_PHASE2
LIBRARY gfxtrans.lib
LIBRARY akntransitionutils.lib
@@ -122,3 +122,4 @@
#endif
// End of file.
+
--- a/inc/screensaverengine.h Tue Apr 27 16:38:49 2010 +0300
+++ b/inc/screensaverengine.h Tue May 11 16:14:23 2010 +0300
@@ -34,7 +34,7 @@
const TInt KDefaultScreenSaverTimeout = 2 * 60 * 1000000; // 2 mins
// FORWARD DECLARATIONS
-class CScreensaverActivityManager;
+class CUserActivityManager;
class CScreensaverSharedDataI;
class CScreensaverSharedDataMonitor;
class CScreensaverAppUi;
@@ -147,9 +147,10 @@
void HandleKeyguardStateChanged( TBool aEnabled );
/**
- * Informs the engine that a key event was received
+ * Informs the engine that a start/stop request was emitted through P&S
+ * @param aStart True if screensaver should be started, false if stopped
*/
- void NotifyKeyEventReceived();
+ void HandleActivateSSChanged( TBool aStart );
private:
@@ -185,7 +186,7 @@
/**
* Stops monitoring the user activity
*/
- void StopActivityMonitoring( CScreensaverActivityManager*& aActivityManager );
+ void StopActivityMonitoring( CUserActivityManager*& aActivityManager );
/**
* Gets the color model from the resource
@@ -236,11 +237,6 @@
static TInt HandleSuspendTimerExpiry( TAny* aPtr );
/**
- * Callback function. Called when activity is no longer ignored
- */
- static TInt ResetIgnoreFlagCb( TAny* aPtr );
-
- /**
* Returns the CScreensaverView
*/
CScreensaverView* View() const;
@@ -278,14 +274,9 @@
TBool iScreenSaverIsPreviewing;
/**
- *
- */
- TBool iIgnoreNextActivity;
-
- /**
* The trigger for screensaver activation
*/
- CScreensaverActivityManager* iActivityManagerScreensaver;
+ CUserActivityManager* iActivityManagerScreensaver;
/**
@@ -310,7 +301,7 @@
/**
* The trigger for screensaver activation, short timeout
*/
- CScreensaverActivityManager* iActivityManagerScreensaverShort;
+ CUserActivityManager* iActivityManagerScreensaverShort;
/**
* moved from view class
@@ -341,11 +332,6 @@
*/
CPeriodic* iExpiryTimer;
- /**
- * Timer to ignore activity events after keylock activated.
- */
- CPeriodic* iIgnoreActivityResetTimer;
-
};
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/inc/SlideshowPlugin.h Tue Apr 27 16:38:49 2010 +0300
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/inc/SlideshowPlugin.h Tue May 11 16:14:23 2010 +0300
@@ -269,10 +269,7 @@
// Display info
TScreensaverDisplayInfo iDi;
-
- // Plugin state tracking
- TInt iState;
-
+
// Resource file offset
TInt iResourceOffset;
@@ -320,6 +317,9 @@
// Draw count
TInt iDrawCount;
TBool iTimerUpdated;
+
+ //loading state
+ TBool iIsLoadFinished;
};
--- a/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp Tue Apr 27 16:38:49 2010 +0300
+++ b/scrsaver/scrsaverplugins/SlideshowPlugin/src/SlideshowPlugin.cpp Tue May 11 16:14:23 2010 +0300
@@ -264,12 +264,13 @@
return KErrNone;
}
// Make sure we have something to display
- if (iModel->NumberOfSlides() == 0)
+ if (iModel->NumberOfSlides() == 0 && iIsLoadFinished )
{
+ iHost->RevertToDefaultSaver();
SSPLOGGER_WRITE("Draw(): Nothing to display, suspending");
SSPLOGGER_LEAVEFN("Draw()");
// iHost->Suspend( -1 ); // This place will be crashed when transform to default type
- return KErrNotFound;
+ return KErrNone;
}
CSlideshowSlide* pSlide = iModel->NextSlide(EFalse);
@@ -720,7 +721,7 @@
void CSlideshowPlugin::LoadSlidesL()
{
SSPLOGGER_ENTERFN("LoadSlidesL()");
-
+ iIsLoadFinished = EFalse;
// Based on settings, load predefined set or random slides
if (iSettings->iSlideshowType == KSlideshowTypeRandom)
{
@@ -730,7 +731,7 @@
{
LoadSlideSetL();
}
-
+ iIsLoadFinished = ETrue;
SSPLOGGER_LEAVEFN("LoadSlidesL()");
}
--- a/src/screensaverappui.cpp Tue Apr 27 16:38:49 2010 +0300
+++ b/src/screensaverappui.cpp Tue May 11 16:14:23 2010 +0300
@@ -138,7 +138,6 @@
{
return EKeyWasConsumed;
}
- iModel->NotifyKeyEventReceived();
if ( aType == EEventKey && aKeyEvent.iCode == EKeyNo )
{
@@ -155,9 +154,10 @@
}
else
{
- if ( aType == EEventKeyUp )
+ if ( aType == EEventKeyUp &&
+ !iModel->SharedDataInterface()->IsKeyguardOn() )
{
- //stop = ETrue;
+ stop = ETrue;
}
}
}
--- a/src/screensaverbase.cpp Tue Apr 27 16:38:49 2010 +0300
+++ b/src/screensaverbase.cpp Tue May 11 16:14:23 2010 +0300
@@ -101,6 +101,8 @@
SetRect( Rect() );
DrawNow();
+
+ StartCaptureScreenTimer();
}
// -----------------------------------------------------------------------------
@@ -286,7 +288,6 @@
SCRLOGGER_WRITEF( _L("SCR: Inside CScreensaverView::HandleRefreshTimerExpiry()") );
control->DrawObject();
- control->StartCaptureScreenTimer();
return KErrNone;
}
--- a/src/screensaverengine.cpp Tue Apr 27 16:38:49 2010 +0300
+++ b/src/screensaverengine.cpp Tue May 11 16:14:23 2010 +0300
@@ -23,6 +23,7 @@
#include <Profile.hrh>
#include <screensaver.rsg>
#include <AknUtils.h>
+#include <activitymanager.h>
#include "screensaverengine.h"
#include "screensaverctrlmovingtext.h"
@@ -31,8 +32,6 @@
#include "screensaverappui.h"
#include "ScreensaverUtils.h"
#include "screensaverutility.h"
-#include "screensaveractivitymanager.h"
-
// Minimum plugin suspension time
const TInt KMinPluginSuspensionTime = 500000; // 0.5 sec
@@ -43,7 +42,6 @@
const TInt KNoPreview = 0;
const TInt KPreviewTimeout = 10000000; // 10 sec
-const TInt KIgnoreActivityTimeout = 500000; // 0.5 sec
const TText KSilentProfileInd= KPuaCodeSilentSymbol;
const TText KSilentVibraInd= KPuaCodeAprofSilentVibra;
@@ -77,7 +75,6 @@
delete iIndicatorArray;
KillTimer( iPreviewTimer );
KillTimer( iExpiryTimer );
- KillTimer( iIgnoreActivityResetTimer );
iAknUiServer.Close();
}
@@ -228,7 +225,6 @@
void CScreensaverEngine::StartPreviewModeL( )
{
SCRLOGGER_WRITEF(_L("SCR: Inside CScreensaverEngine::StartPreviewModeL()") );
- iActivityManagerScreensaverShort->SetInactivityTimeout(0);
iScreenSaverIsPreviewing = ETrue;
// Change the display object into what's being previewed
@@ -563,14 +559,14 @@
// Start monitoring activity for screensaver
iActivityManagerScreensaver
- = CScreensaverActivityManager::NewL( CActive::EPriorityStandard );
+ = CUserActivityManager::NewL( CActive::EPriorityStandard );
iActivityManagerScreensaver->Start( Timeout(),
TCallBack( HandleInactiveEventL,this ),
TCallBack( HandleActiveEventL, this ) );
// Start monitoring activity for screensaver, short timeout
iActivityManagerScreensaverShort
- = CScreensaverActivityManager::NewL( CActive::EPriorityUserInput );
+ = CUserActivityManager::NewL( CActive::EPriorityUserInput );
iActivityManagerScreensaverShort->Start( KTimeoutShort,
TCallBack( HandleInactiveEventShortL, this ),
@@ -581,7 +577,7 @@
// CScreensaverEngine::StopActivityMonitoring
// -----------------------------------------------------------------------------
//
-void CScreensaverEngine::StopActivityMonitoring( CScreensaverActivityManager*& aActivityManager )
+void CScreensaverEngine::StopActivityMonitoring( CUserActivityManager*& aActivityManager )
{
if ( aActivityManager )
{
@@ -733,16 +729,7 @@
//
TInt CScreensaverEngine::HandleActiveEventShortL( TAny* aPtr )
{
- SCRLOGGER_WRITE("HandleActiveEventShortL(), stopping saver");
- CScreensaverEngine* _this= STATIC_CAST(CScreensaverEngine*, aPtr);
- if ( !_this->iIgnoreNextActivity )
- {
- _this->StopScreenSaver();
- }
- else
- {
- _this->iActivityManagerScreensaverShort->SetInactivityTimeout(0);
- }
+ SCRLOGGER_WRITE("HandleActiveEventShortL()");
return KErrNone;
}
@@ -755,10 +742,6 @@
SCRLOGGER_WRITE("HandleInactiveEventShortL()");
// Start, if keys are locked and short timeout in use
CScreensaverEngine* _this= STATIC_CAST(CScreensaverEngine*, aPtr);
- // Restore inactivity timeout if it was reset at keylock activation
- _this->iActivityManagerScreensaverShort->SetInactivityTimeout(KTimeoutShort);
- _this->iIgnoreNextActivity = EFalse;
-
if ( _this->iSharedDataI->IsKeyguardOn() )
{
SCRLOGGER_WRITE("HandleInactiveEventShortL() starting saver");
@@ -786,53 +769,14 @@
}
// ---------------------------------------------------------------------------
-// CScreensaverEngine::ResetIgnoreFlagCb
-// ---------------------------------------------------------------------------
-//
-TInt CScreensaverEngine::ResetIgnoreFlagCb( TAny* aPtr )
- {
- CScreensaverEngine* engine = STATIC_CAST(CScreensaverEngine*, aPtr);
- engine->KillTimer( engine->iIgnoreActivityResetTimer );
- engine->iIgnoreNextActivity = EFalse;
-
- return KErrNone;
- }
-
-// ---------------------------------------------------------------------------
// CScreensaverEngine::HandleKeyguardStateChanged
// ---------------------------------------------------------------------------
//
void CScreensaverEngine::HandleKeyguardStateChanged( TBool aEnabled )
{
- KillTimer( iIgnoreActivityResetTimer );
if ( aEnabled )
{
- if ( !iScreenSaverIsOn )
- {
- // Start the screensaver, but set the ignore flag in case keylock
- // was activated using the side switch. The switch will generate
- // activity that must be ignored.
- if ( iActivityManagerScreensaverShort->IsMonitoringForActivity() )
- {
- // Inactive state, start immediately
- StartScreenSaver();
- }
- else
- {
- // Active state, go to inactive and start.
- iActivityManagerScreensaverShort->SetInactivityTimeout(0);
- }
-
- iIgnoreNextActivity = ETrue;
-
- iIgnoreActivityResetTimer = CPeriodic::New( EPriorityLow );
- if ( iIgnoreActivityResetTimer )
- {
- iIgnoreActivityResetTimer->Start( KIgnoreActivityTimeout,
- KIgnoreActivityTimeout,
- TCallBack( ResetIgnoreFlagCb, this ) );
- }
- }
+ StartScreenSaver();
}
else
{
@@ -844,11 +788,15 @@
//
// ---------------------------------------------------------------------------
//
-void CScreensaverEngine::NotifyKeyEventReceived()
+void CScreensaverEngine::HandleActivateSSChanged( TBool aStart )
{
- if ( iSharedDataI->IsKeyguardOn() )
+ if ( aStart )
{
- iIgnoreNextActivity = ETrue;
+ StartScreenSaver();
+ }
+ else
+ {
+ StopScreenSaver();
}
}
--- a/src/screensavershareddatamonitor.cpp Tue Apr 27 16:38:49 2010 +0300
+++ b/src/screensavershareddatamonitor.cpp Tue May 11 16:14:23 2010 +0300
@@ -199,9 +199,10 @@
// MMC, screensaver defaults to date & time when MMC removed
// -----------------------------------------------------------------------------
//
-TInt CScreensaverSharedDataMonitor::HandleMMCStateChanged(TAny* /*aPtr*/)
+TInt CScreensaverSharedDataMonitor::HandleMMCStateChanged(TAny* aPtr)
{
User::ResetInactivityTime();
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
return KErrNone;
}
@@ -211,10 +212,11 @@
// MMC, screensaver defaults to date & time when USB attached
// -----------------------------------------------------------------------------
//
-TInt CScreensaverSharedDataMonitor::HandleUSBStateChanged(TAny* /*aPtr*/)
+TInt CScreensaverSharedDataMonitor::HandleUSBStateChanged(TAny* aPtr)
{
// Same handler as in MMC removal, parameter tells it's because of USB
User::ResetInactivityTime();
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
return KErrNone;
}
@@ -289,13 +291,13 @@
{
// Enable SS
SCRLOGGER_WRITE("SharedDataMonitor: Activate SS");
- STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StartScreenSaver();
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().HandleActivateSSChanged( ETrue );
}
else if ( !activateState )
{
// Disable SS
SCRLOGGER_WRITE("SharedDataMonitor: Stop SS");
- STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().StopScreenSaver();
+ STATIC_CAST(CScreensaverSharedDataMonitor*, aPtr)->Model().HandleActivateSSChanged( EFalse );
}
else
{
--- a/src/screensaverview.cpp Tue Apr 27 16:38:49 2010 +0300
+++ b/src/screensaverview.cpp Tue May 11 16:14:23 2010 +0300
@@ -114,7 +114,7 @@
case EDisplayNone:
{
iControl = CScreensaverCtrlNone::NewL();
- iIsContentless = ETrue;
+ // iIsContentless = ETrue;
break;
}