sysstatemgmt/systemstatereferenceplugins/custcmd/src/ssmsecuritychecknotifier.cpp
branchRCL_3
changeset 9 21e939dd208a
parent 8 8d1d8440b626
child 12 4a5c47a50617
equal deleted inserted replaced
8:8d1d8440b626 9:21e939dd208a
    24 */
    24 */
    25 
    25 
    26 #include "ssmsecuritychecknotifier.h"
    26 #include "ssmsecuritychecknotifier.h"
    27 #include "ssmdebug.h"
    27 #include "ssmdebug.h"
    28 #include "ssmuiproviderdll.h"
    28 #include "ssmuiproviderdll.h"
       
    29 #include "ssmrefcustomcmdcommon.h"
    29 #include <ssm/ssmstateawaresession.h>
    30 #include <ssm/ssmstateawaresession.h>
    30 #include <e32def.h>
    31 #include <e32def.h>
    31 #include <startupdomaindefs.h>
    32 #include <startupdomaindefs.h>
    32 #include <etelmm.h> 
    33 #include <etelmm.h>
       
    34 #include <ctsydomainpskeys.h>
    33 
    35 
    34 static TBool NoteTypeToEvent(
    36 static TBool NoteTypeToEvent(
    35     TInt& aEventCode, const TStrtSecurityNoteType aNoteType )
    37     TInt& aEventCode, const TStrtSecurityNoteType aNoteType )
    36     {
    38     {
    37     TBool result( ETrue );
    39     TBool result( ETrue );
   197 	User::LeaveIfError(ssmStateAwareSession.Connect(dmId));
   199 	User::LeaveIfError(ssmStateAwareSession.Connect(dmId));
   198 
   200 
   199 	//Get the current state of the system
   201 	//Get the current state of the system
   200 	TSsmState currentState = ssmStateAwareSession.State();
   202 	TSsmState currentState = ssmStateAwareSession.State();
   201 
   203 
       
   204 	//Close the state aware session
       
   205 	ssmStateAwareSession.Close();
       
   206 
   202 	TBool isDlgCancellable;
   207 	TBool isDlgCancellable;
   203 
   208 
   204 	//Is system in start up state
   209 	//Is system in start up state
   205 	if ( currentState.MainState() == ESsmStartup )
   210 	if ( currentState.MainState() == ESsmStartup )
   206 		{
   211 		{
       
   212 		TInt securityPhaseVal = EStarterSecurityPhaseUninitialized;
       
   213 		TInt errorCode = RProperty::Get(CSsmUiSpecific::StarterPSUid(), KStarterSecurityPhase, securityPhaseVal);
       
   214 		DEBUGPRINT3A("Getting the KStarterSecurityPhase completed with errorcode %d and its value is %d", errorCode, securityPhaseVal);
       
   215 		User::LeaveIfError(errorCode);
       
   216 
   207 		//TSsmStartupSubStateExt::ESsmStateNonCritical
   217 		//TSsmStartupSubStateExt::ESsmStateNonCritical
   208 		iAfterStartup = ( 0x34 == currentState.SubState() ) ? ETrue : EFalse;
   218 		iAfterStartup = ( 0x34 == currentState.SubState() && securityPhaseVal > EStarterSecurityPhaseSimNok ) ? ETrue : EFalse;
   209 		}
   219 		}
   210 	else
   220 	else
   211 		{
   221 		{
   212 		iAfterStartup = ETrue;
   222 		iAfterStartup = ETrue;
   213 		}
   223 		}
   214 	
   224 	DEBUGPRINT2A("iAfterStartup is %d", iAfterStartup);
   215 	//Close the state aware session
       
   216 	ssmStateAwareSession.Close();
       
   217 
   225 
   218 	//Notifier dialogue is not cancellable if system is in startup state and
   226 	//Notifier dialogue is not cancellable if system is in startup state and
   219 	//requested for PUK1 or PUK2 or UPUK code
   227 	//requested for PUK1 or PUK2 or UPUK code
   220     isDlgCancellable = (iAfterStartup &&
   228     isDlgCancellable = (iAfterStartup &&
   221 						iNoteType != ESecCodePUK1 &&
   229 						iNoteType != ESecCodePUK1 &&
   240 		DEBUGPRINT1A("Pin cancelled and ECall Started");
   248 		DEBUGPRINT1A("Pin cancelled and ECall Started");
   241 		SetActive();
   249 		SetActive();
   242         }
   250         }
   243     else if (iCmdState == EEmergencyCallIsActive && iStatus.Int() != KErrCancel)
   251     else if (iCmdState == EEmergencyCallIsActive && iStatus.Int() != KErrCancel)
   244         {
   252         {
   245         // Emergency call activated from the security note dialog has
   253         TInt value = -1; 
   246         // finished. Show the note again.
   254 		const TInt errorcode = iSsmEmergencyCallProperty.Get( value );
   247         DEBUGPRINT1A("ECall Ended and restarting pin notifier");
   255 		DEBUGPRINT3A("iSsmEmergencyCallProperty.Get() has returned value %d and errorcode %d", value , errorcode);
   248         StartNotifier();
   256 		if (KErrNone == errorcode)
       
   257 			{
       
   258 			// Compare the property value with EPSCTsyCallStateNone. This indicates the call has finished.
       
   259 			if (EPSCTsyCallStateNone == value)
       
   260 				{
       
   261 				// Emergency call activated from the security note dialog has
       
   262 				// finished. Show the note again.
       
   263 				DEBUGPRINT1A("ECall Ended and restarting pin notifier");
       
   264 				StartNotifier();
       
   265 				}
       
   266 			else
       
   267 				{
       
   268 				//Subscribe to the property again if the property key value is not yet set to EPSCTsyCallStateNone.
       
   269 				iSsmEmergencyCallProperty.Subscribe(iStatus);
       
   270 				SetActive();
       
   271 				}
       
   272 			}
   249         }
   273         }
   250     else
   274     else
   251         {
   275         {
   252         //Reset the state to initial start
   276         //Reset the state to initial start
   253         iCmdState = EIdle;
   277         iCmdState = EIdle;