diff -r 84a16765cd86 -r 98b66e4fb0be appinstaller/AppinstUi/Daemon/Src/daemon.cpp --- a/appinstaller/AppinstUi/Daemon/Src/daemon.cpp Fri Mar 19 09:33:35 2010 +0200 +++ b/appinstaller/AppinstUi/Daemon/Src/daemon.cpp Fri Apr 16 15:05:20 2010 +0300 @@ -19,12 +19,24 @@ #include "drivewatcher.h" #include "SWInstDebug.h" #include "securitypolicy.h" -#include "sisregistrysession.h" + +//#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK +#include +#include +#include "../../../../installationservices/swtransactionservices/inc/stsrecovery.h" +#include "swiobserverclient.h" +//#else +//#include "sisregistrysession.h" +//#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK namespace Swi { // CDaemon +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// /*static*/ CDaemon* CDaemon::NewL(MDaemonBehaviour& aBehaviour) { CDaemon* self=NewLC(aBehaviour); @@ -32,6 +44,10 @@ return self; } +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// /*static*/ CDaemon* CDaemon::NewLC(MDaemonBehaviour& aBehaviour) { CDaemon* self=new(ELeave) CDaemon(aBehaviour); @@ -39,7 +55,11 @@ self->ConstructL(); return self; } - + +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// CDaemon::~CDaemon() { iPolicyLockFile.Close(); @@ -48,11 +68,19 @@ iFs.Close(); } +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// CDaemon::CDaemon(MDaemonBehaviour& aBehaviour) : iBehaviour(aBehaviour) { } +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// void CDaemon::ConstructL() { User::LeaveIfError(iFs.Connect()); @@ -64,6 +92,10 @@ StartWatchersL(); } +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// void CDaemon::StartWatchersL() { FLOG( _L("Daemon: Start watchers") ); @@ -152,6 +184,10 @@ } // StartWatchersL() +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// void CDaemon::LockSensitiveFiles() { TInt err = iPolicyLockFile.Open( @@ -162,6 +198,41 @@ FLOG_1( _L("Daemon: Policy file lock error = %d."), err ); } +//#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK + +// ----------------------------------------------------------------------- +// +// ----------------------------------------------------------------------- +// +void CDaemon::StartRecoveryL() + { + FLOG( _L("Daemon: StartRecoveryL: Check to see if a recovery is needed.") ); + + // Check to see if a backup is in progress... + TInt backup = 0; + User::LeaveIfError( RProperty::Get( KUidSystemCategory, conn::KUidBackupRestoreKey,backup ) ); + + // if no backup or restore is in progress... + if( backup == conn::EBURUnset || ( backup == ( conn::EBURNormal | conn::ENoBackup ) ) ) + { + // no recovery attempt is made during backup/restore as recovery may seriously affect + // the file system, which might impact backup/restore, recovery will be made at next bootup + Usif::RStsRecoverySession stsRecoverySession; + // A recovery failure should not affect Daemon start up. + TRAPD( err, stsRecoverySession.RollbackAllPendingL() ); + if( err != KErrNone ) + { + FLOG_1( _L("CDaemon::StartRecoveryL() - STS server failed to recover transactions. Error code: %d"), err ); + } + // Start SWI Observer so that it can process the log files left from the previous session. + RSwiObserverSession swiObserver; + swiObserver.ProcessLogsL( iFs ); + swiObserver.Close(); + } + } + +/* +//#else void CDaemon::StartRecoveryL() { @@ -178,4 +249,7 @@ FLOG( _L("Daemon: StartRecoveryL: Recovery check finished.") ); } // StartRecoveryL() +#endif // SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK +*/ + } // namespace Swi