diff -r ef634fd8dac3 -r effbe8362efc sysstatemgmt/ssmpolicyplugins/ssmswppolicybase/src/ssmswppolicybase.cpp --- a/sysstatemgmt/ssmpolicyplugins/ssmswppolicybase/src/ssmswppolicybase.cpp Mon May 03 13:42:22 2010 +0300 +++ b/sysstatemgmt/ssmpolicyplugins/ssmswppolicybase/src/ssmswppolicybase.cpp Fri May 14 17:08:00 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2009 - 2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -22,6 +22,7 @@ #include #include #include +#include #include "ssmswppolicybase.h" #include "trace.h" @@ -135,27 +136,30 @@ } else { - RSsmStateManager session; - TInt errorCode = session.Connect(); - ERROR( errorCode, "Failed to connect to RSsmStateManager" ); - if ( errorCode == KErrNone ) - { - if ( ResetLimitReached() ) // Updates the reset count - { - INFO( "SWP transition failed -> Fail" ); - errorCode = session.RequestStateTransition( - TSsmStateTransition( ESsmFail, KSsmAnySubState, 0 ) ); - } - else - { - INFO( "SWP transition failed -> Reset" ); - errorCode = session.RequestStateTransition( - TSsmStateTransition( ESsmShutdown, KSsmAnySubState, - RStarterSession::EUnknownReset ) ); - } + TSsmState currentState; + TInt errorCode = GetCurrentState(currentState); - session.Close(); - } + if ( ((currentState.MainState() != ESsmShutdown) && (currentState.MainState() != ESsmFail)) || KErrNone != errorCode) + { + RSsmStateManager session; + errorCode = session.Connect(); + ERROR( errorCode, "Failed to connect to RSsmStateManager" ); + if ( KErrNone == errorCode ) + { + if ( ResetLimitReached() ) // Updates the reset count + { + INFO_1( "SWP 0x%08x transition failed -> Fail", aSwp.Key() ); + errorCode = session.RequestStateTransition( TSsmStateTransition( ESsmFail, KSsmAnySubState, 0 ) ); + } + else + { + INFO_1( "SWP 0x%08x transition failed -> Reset", aSwp.Key() ); + errorCode = session.RequestStateTransition( + TSsmStateTransition( ESsmShutdown, KSsmAnySubState, RStarterSession::EUnknownReset ) ); + } + session.Close(); + } + } TRequestStatus* status = &aStatus; User::RequestComplete( status, errorCode );