securitydialogs/Securitynotifier/Src/SecurityNotifier.cpp
changeset 22 6b63ca65093a
parent 19 098e361762d2
child 26 aad866c37519
equal deleted inserted replaced
19:098e361762d2 22:6b63ca65093a
   224 // ----------------------------------------------------------
   224 // ----------------------------------------------------------
   225 //
   225 //
   226 void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage)
   226 void CSecurityNotifier::GetParamsL(const TDesC8& aBuffer, TInt aReturnVal, const RMessagePtr2& aMessage)
   227     {
   227     {
   228 	#if defined(_DEBUG)
   228 	#if defined(_DEBUG)
   229 	RDebug::Printf( "%s %s (%u) searching for autolock.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 );
   229 	RDebug::Printf( "%s %s (%u) searching for autolocksrv.exe =%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x0 );
   230 	#endif
   230 	#endif
   231 	
       
   232    // Start Dirty and quick hack    
       
   233    #include <PSVariables.h>   // Property values
       
   234    #include <coreapplicationuisdomainpskeys.h>
       
   235    _LIT_SECURITY_POLICY_PASS(KReadPolicy);
       
   236    _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData);
       
   237    int ret = RProperty::Define( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy);
       
   238    RDebug::Printf( "%s %s (%u) EAutolockOff=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 );
       
   239    RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, 1);
       
   240    // End Dirty and quick hack
       
   241 		
   231 		
   242 	
       
   243 	TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
   232 	TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
   244 	const TUid KAutolockUid = { 0x100059B5 };
   233 	const TUid KAutolockUid = { 0x100059B5 };
   245 	TApaTask task( taskList.FindApp( KAutolockUid ) );
   234 	//TApaTask task( taskList.FindApp( KAutolockUid ) );
       
   235 	TApaTask task( taskList.FindApp( _L("autolocksrv.exe" )) );
   246 	if ( !task.Exists() )
   236 	if ( !task.Exists() )
   247 		{
   237 		{
   248 		#if defined(_DEBUG)
   238 		#if defined(_DEBUG)
   249 		RDebug::Printf( "%s %s (%u) autolock.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 );
   239 		RDebug::Printf( "%s %s (%u) sutolocksrv.exe not running. Starting now=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 );
   250 		#endif
   240 		#endif
   251 		RApaLsSession ls;                   
   241 		RApaLsSession ls;                   
   252 		User::LeaveIfError(ls.Connect());   
   242 		User::LeaveIfError(ls.Connect());   
   253 		CleanupClosePushL(ls);         
   243 		CleanupClosePushL(ls);         
   254 		
   244 		
   255 		CApaCommandLine* commandLine = CApaCommandLine::NewLC();
   245 		CApaCommandLine* commandLine = CApaCommandLine::NewLC();
   256 		commandLine->SetExecutableNameL( _L("autolock.exe" ) );     
   246 		commandLine->SetExecutableNameL( _L("autolockarv.exe" ) );     
   257 		commandLine->SetCommandL( EApaCommandRun );
   247 		commandLine->SetCommandL( EApaCommandRun );
   258 		
   248 		
   259 		// Try to launch the application.        
   249 		// Try to launch the application.        
   260 		User::LeaveIfError(ls.StartApp(*commandLine));
   250 		User::LeaveIfError(ls.StartApp(*commandLine));
   261 		#if defined(_DEBUG)
   251 		#if defined(_DEBUG)
   262 		RDebug::Printf( "%s %s (%u) autolock.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x2 );
   252 		RDebug::Printf( "%s %s (%u) autolocksrv.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x2 );
   263 		#endif
   253 		#endif
   264 		
   254 		
   265 		CleanupStack::PopAndDestroy(2); // commandLine, ls
   255 		CleanupStack::PopAndDestroy(2); // commandLine, ls
   266 		}
   256 		}
   267 
   257