sysstatemgmt/systemstatereferenceplugins/custcmd/src/ssmsecuritychecknotifier.cpp
branchRCL_3
changeset 9 21e939dd208a
parent 8 8d1d8440b626
child 12 4a5c47a50617
--- a/sysstatemgmt/systemstatereferenceplugins/custcmd/src/ssmsecuritychecknotifier.cpp	Wed Apr 14 17:17:45 2010 +0300
+++ b/sysstatemgmt/systemstatereferenceplugins/custcmd/src/ssmsecuritychecknotifier.cpp	Tue Apr 27 17:57:16 2010 +0300
@@ -26,10 +26,12 @@
 #include "ssmsecuritychecknotifier.h"
 #include "ssmdebug.h"
 #include "ssmuiproviderdll.h"
+#include "ssmrefcustomcmdcommon.h"
 #include <ssm/ssmstateawaresession.h>
 #include <e32def.h>
 #include <startupdomaindefs.h>
-#include <etelmm.h> 
+#include <etelmm.h>
+#include <ctsydomainpskeys.h>
 
 static TBool NoteTypeToEvent(
     TInt& aEventCode, const TStrtSecurityNoteType aNoteType )
@@ -199,21 +201,27 @@
 	//Get the current state of the system
 	TSsmState currentState = ssmStateAwareSession.State();
 
+	//Close the state aware session
+	ssmStateAwareSession.Close();
+
 	TBool isDlgCancellable;
 
 	//Is system in start up state
 	if ( currentState.MainState() == ESsmStartup )
 		{
+		TInt securityPhaseVal = EStarterSecurityPhaseUninitialized;
+		TInt errorCode = RProperty::Get(CSsmUiSpecific::StarterPSUid(), KStarterSecurityPhase, securityPhaseVal);
+		DEBUGPRINT3A("Getting the KStarterSecurityPhase completed with errorcode %d and its value is %d", errorCode, securityPhaseVal);
+		User::LeaveIfError(errorCode);
+
 		//TSsmStartupSubStateExt::ESsmStateNonCritical
-		iAfterStartup = ( 0x34 == currentState.SubState() ) ? ETrue : EFalse;
+		iAfterStartup = ( 0x34 == currentState.SubState() && securityPhaseVal > EStarterSecurityPhaseSimNok ) ? ETrue : EFalse;
 		}
 	else
 		{
 		iAfterStartup = ETrue;
 		}
-	
-	//Close the state aware session
-	ssmStateAwareSession.Close();
+	DEBUGPRINT2A("iAfterStartup is %d", iAfterStartup);
 
 	//Notifier dialogue is not cancellable if system is in startup state and
 	//requested for PUK1 or PUK2 or UPUK code
@@ -242,10 +250,26 @@
         }
     else if (iCmdState == EEmergencyCallIsActive && iStatus.Int() != KErrCancel)
         {
-        // Emergency call activated from the security note dialog has
-        // finished. Show the note again.
-        DEBUGPRINT1A("ECall Ended and restarting pin notifier");
-        StartNotifier();
+        TInt value = -1; 
+		const TInt errorcode = iSsmEmergencyCallProperty.Get( value );
+		DEBUGPRINT3A("iSsmEmergencyCallProperty.Get() has returned value %d and errorcode %d", value , errorcode);
+		if (KErrNone == errorcode)
+			{
+			// Compare the property value with EPSCTsyCallStateNone. This indicates the call has finished.
+			if (EPSCTsyCallStateNone == value)
+				{
+				// Emergency call activated from the security note dialog has
+				// finished. Show the note again.
+				DEBUGPRINT1A("ECall Ended and restarting pin notifier");
+				StartNotifier();
+				}
+			else
+				{
+				//Subscribe to the property again if the property key value is not yet set to EPSCTsyCallStateNone.
+				iSsmEmergencyCallProperty.Subscribe(iStatus);
+				SetActive();
+				}
+			}
         }
     else
         {