securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp
changeset 59 881d92421467
parent 39 61986511a9c8
equal deleted inserted replaced
53:25dd1e8b2663 59:881d92421467
    30 #include <securitynotification.h>
    30 #include <securitynotification.h>
    31 #include <AknQueryDialog.h>
    31 #include <AknQueryDialog.h>
    32 #include <featmgr.h>
    32 #include <featmgr.h>
    33 #include <SCPClient.h>
    33 #include <SCPClient.h>
    34 #include <apgcli.h>
    34 #include <apgcli.h>
       
    35 #include <keyguardaccessapi.h>
    35 
    36 
    36 //  LOCAL CONSTANTS AND MACROS
    37 //  LOCAL CONSTANTS AND MACROS
    37   /*****************************************************
    38   /*****************************************************
    38   * Series 60 Customer / TSY
    39   * Series 60 Customer / TSY
    39   * Needs customer TSY implementation
    40   * Needs customer TSY implementation
   223 // Initialize parameters and jump to RunL
   224 // Initialize parameters and jump to RunL
   224 // ----------------------------------------------------------
   225 // ----------------------------------------------------------
   225 //
   226 //
   226 void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage)
   227 void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage)
   227     {
   228     {
   228   #if defined(_DEBUG)
       
   229   RDebug::Printf( "%s %s (%u) searching for autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 );
       
   230   #endif
       
   231     
   229     
   232   TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
       
   233   const TUid KAutolockUid = { 0x100059B5 };
       
   234   TApaTask task( taskList.FindApp( KAutolockUid ) );
       
   235   if ( !task.Exists() )
       
   236     {
       
   237     #if defined(_DEBUG)
       
   238     RDebug::Printf( "%s %s (%u) autolock.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 );
       
   239     #endif
       
   240     RApaLsSession ls;                   
       
   241     User::LeaveIfError(ls.Connect());   
       
   242     CleanupClosePushL(ls);         
       
   243     
       
   244     CApaCommandLine* commandLine = CApaCommandLine::NewLC();
       
   245     commandLine->SetExecutableNameL( _L("autolock.exe" ) );     
       
   246     commandLine->SetCommandL( EApaCommandRun );
       
   247     
       
   248     // Try to launch the application.        
       
   249     TInt err = ls.StartApp(*commandLine);
       
   250     #if defined(_DEBUG)
       
   251     RDebug::Printf( "%s %s (%u) autolock.exe err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err );
       
   252     #endif
       
   253     
       
   254     CleanupStack::PopAndDestroy(2); // commandLine, ls
       
   255     }
       
   256 
       
   257   /*****************************************************
   230   /*****************************************************
   258   * Series 60 Customer / ETel
   231   * Series 60 Customer / ETel
   259   * Series 60  ETel API
   232   * Series 60  ETel API
   260   *****************************************************/
   233   *****************************************************/
   261     iMessage = aMessage;
   234     iMessage = aMessage;
   268     
   241     
   269 
   242 
   270     TSecurityNotificationPckg pckg;
   243     TSecurityNotificationPckg pckg;
   271     pckg.Copy( aBuffer );
   244     pckg.Copy( aBuffer );
   272     iStartup = pckg().iStartup;
   245     iStartup = pckg().iStartup;
   273     iEvent = static_cast<RMobilePhone::TMobilePhoneSecurityEvent>(pckg().iEvent);
   246     TInt lEvent = pckg().iEvent;
   274     
   247     iEvent = static_cast<RMobilePhone::TMobilePhoneSecurityEvent>(lEvent);
       
   248     if(lEvent==100+RMobilePhone::EPhonePasswordRequired)
       
   249     	{
       
   250     	// from AskSecCodeInAutoLockL
       
   251     	iEvent = RMobilePhone::EPhonePasswordRequired;
       
   252     	}
       
   253 
       
   254   #if defined(_DEBUG)
       
   255   RDebug::Printf( "%s %s (%u) iStartup =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iStartup );
       
   256   RDebug::Printf( "%s %s (%u) lEvent =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lEvent );
       
   257   RDebug::Printf( "%s %s (%u) iEvent =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iEvent );
       
   258   RDebug::Printf( "%s %s (%u) iReturnVal =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iReturnVal );
       
   259   #endif
       
   260 
       
   261     // Forces Autolock to load
       
   262     TInt err = KErrNone;
       
   263 
       
   264 		if(iEvent == RMobilePhone::EPhonePasswordRequired && lEvent==100+RMobilePhone::EPhonePasswordRequired)
       
   265 			{
       
   266 		  #if defined(_DEBUG)
       
   267 		  RDebug::Printf( "%s %s (%u) query from AskSecCodeInAutoLockL . No need to start Autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   268 		  #endif
       
   269 			}
       
   270 		else
       
   271 			{
       
   272 	    CKeyguardAccessApi* iKeyguardAccess = CKeyguardAccessApi::NewL( );
       
   273 	   	RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
   274 			err = iKeyguardAccess->ShowKeysLockedNote( );
       
   275 			RDebug::Printf( "%s %s (%u) err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err );
       
   276 			delete iKeyguardAccess;
       
   277 			}
   275 
   278 
   276 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
   279 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
   277     {
   280     {
   278     if(iEvent == RMobilePhone::EPhonePasswordRequired)
   281     if(iEvent == RMobilePhone::EPhonePasswordRequired)
   279         {
   282         {