securitydialogs/Autolock/src/AutolockAppUi.cpp
branchRCL_3
changeset 17 2ca12c9f635b
parent 14 33ad376816a8
child 19 94b923fa11ed
equal deleted inserted replaced
15:fabe5ded361a 17:2ca12c9f635b
    63 #define KPhoneAppUid TUid::Uid(0x100058B3)
    63 #define KPhoneAppUid TUid::Uid(0x100058B3)
    64 
    64 
    65 const TInt KTriesToConnectServer( 2 );
    65 const TInt KTriesToConnectServer( 2 );
    66 const TInt KTimeBeforeRetryingServerConnection( 50000 );
    66 const TInt KTimeBeforeRetryingServerConnection( 50000 );
    67 const TInt PhoneIndex( 0 );
    67 const TInt PhoneIndex( 0 );
       
    68 const TInt KCancelKeyScanCode( EStdKeyDevice1 ); // 165
       
    69 
    68 
    70 
    69 // ================= MEMBER FUNCTIONS =======================
    71 // ================= MEMBER FUNCTIONS =======================
    70 //
    72 //
    71 // ----------------------------------------------------------
    73 // ----------------------------------------------------------
    72 // CAutolockAppUi::ConstructL()
    74 // CAutolockAppUi::ConstructL()
    77     {
    79     {
    78 	#if defined(_DEBUG)
    80 	#if defined(_DEBUG)
    79     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL"));
    81     RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL"));
    80     #endif
    82     #endif
    81     
    83     
    82     BaseConstructL( EAknEnableSkin | EAknEnableMSK );
    84     BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknDisableAnimationBackground );
    83     
    85     
    84     //Disable priority control so that Autolock process priority isn't set to "background" by 
    86     //Disable priority control so that Autolock process priority isn't set to "background" by 
    85 	//window server when it is not active.
    87 	//window server when it is not active.
    86 	iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); 
    88 	iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); 
    87 	RThread().SetProcessPriority( EPriorityHigh );
    89 	RThread().SetProcessPriority( EPriorityHigh );
   266 	//call bubble
   268 	//call bubble
   267 	iIncallBubble = CAknIncallBubble::NewL();
   269 	iIncallBubble = CAknIncallBubble::NewL();
   268 
   270 
   269 	//Autokeyguard Period observer
   271 	//Autokeyguard Period observer
   270 	#ifdef RD_AUTO_KEYGUARD
   272 	#ifdef RD_AUTO_KEYGUARD
   271 	iKeyguardObserver = CAutoKeyguardObserver::NewL();
   273 	iKeyguardObserver = CAutoKeyguardObserver::NewL(this);
   272 	#else //!RD_AUTO_KEYGUARD
   274 	#else //!RD_AUTO_KEYGUARD
   273 	iKeyguardObserver = NULL;
   275 	iKeyguardObserver = NULL;
   274 	#endif //RD_AUTO_KEYGUARD
   276 	#endif //RD_AUTO_KEYGUARD
   275     // Create the write policy. Also processes with write device data can write the value.
   277     // Create the write policy. Also processes with write device data can write the value.
   276     TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); 
   278     TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); 
  1243 // ----------------------------------------------------------
  1245 // ----------------------------------------------------------
  1244 //
  1246 //
  1245 void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination )
  1247 void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination )
  1246     {
  1248     {
  1247     	const TInt type = aEvent.Type();
  1249     	const TInt type = aEvent.Type();
  1248     	
  1250 		#if defined(_DEBUG)
       
  1251 	    RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type );
       
  1252 	    #endif
       
  1253 
  1249     	switch ( type )
  1254     	switch ( type )
  1250     	{
  1255     	{
  1251     		case KAknFullOrPartialForegroundLost: // partial or full fg lost
  1256     		case KAknFullOrPartialForegroundLost: // partial or full fg lost
  1252     			if( iIncallBubble )
  1257     			if( iIncallBubble )
  1253                     {
  1258                     {
  1364         // part of emergency call handling when telephony+devicelock is active
  1369         // part of emergency call handling when telephony+devicelock is active
  1365         // this solution is meant only for 3.1 and 3.2
  1370         // this solution is meant only for 3.1 and 3.2
  1366         // Emergency detector only handles key down events
  1371         // Emergency detector only handles key down events
  1367         if ( iEmergencySupportReady )
  1372         if ( iEmergencySupportReady )
  1368         	iEcsDetector->HandleWsEventL( aEvent, aDestination);    	
  1373         	iEcsDetector->HandleWsEventL( aEvent, aDestination);    	
       
  1374 	#if defined(_DEBUG)
       
  1375     RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
  1376     #endif
  1369     }
  1377     }
  1370 
  1378 
  1371 TBool CAutolockAppUi::DeviceLockQueryStatus()
  1379 TBool CAutolockAppUi::DeviceLockQueryStatus()
  1372     {
  1380     {
  1373     return iDeviceLockQueryStatus;
  1381     return iDeviceLockQueryStatus;
  1374     }
  1382     }
  1375 
  1383 
  1376 TBool CAutolockAppUi::DeviceLockStatus()
  1384 TBool CAutolockAppUi::DeviceLockStatus()
  1377     {
  1385     {
  1378     return iLocked;
  1386     return iLocked;
       
  1387     }
       
  1388 
       
  1389 void CAutolockAppUi::CancelDeviceLockQuery()
       
  1390     {
       
  1391 	#if defined(_DEBUG)
       
  1392     RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
       
  1393     #endif
       
  1394     TRawEvent rawEvent;
       
  1395     rawEvent.Set( TRawEvent::EKeyDown, KCancelKeyScanCode );
       
  1396     iCoeEnv->WsSession().SimulateRawEvent( rawEvent );          
       
  1397     rawEvent.Set( TRawEvent::EKeyUp, KCancelKeyScanCode );
       
  1398     iCoeEnv->WsSession().SimulateRawEvent( rawEvent );          
  1379     }
  1399     }
  1380 
  1400 
  1381 TBool CAutolockAppUi::DeviceFpsLock(TInt iStatus)
  1401 TBool CAutolockAppUi::DeviceFpsLock(TInt iStatus)
  1382     {
  1402     {
  1383 		if(iStatus)
  1403 		if(iStatus)
  1386 			iModel->SetLockedL(ETimerLocked);
  1406 			iModel->SetLockedL(ETimerLocked);
  1387     return ETrue;
  1407     return ETrue;
  1388     }
  1408     }
  1389 void CAutolockAppUi::HandleWindowGroupListChange()
  1409 void CAutolockAppUi::HandleWindowGroupListChange()
  1390     {
  1410     {
       
  1411 	#if defined(_DEBUG)
       
  1412     RDebug::Printf( "%s %s (%u) iLocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLocked );
       
  1413     #endif
  1391     if ( !iLocked )
  1414     if ( !iLocked )
  1392         {
  1415         {
  1393         // System is not locked, make sure app is not on the foreground.
  1416         // System is not locked, make sure app is not on the foreground.
  1394         if ( !iCoeEnv->RootWin().OrdinalPosition() )
  1417         if ( !iCoeEnv->RootWin().OrdinalPosition() )
  1395             {
  1418             {
  1469             #endif
  1492             #endif
  1470             }                    
  1493             }                    
  1471         }  
  1494         }  
  1472 
  1495 
  1473 }
  1496 }
       
  1497 	#if defined(_DEBUG)
       
  1498     RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret );
       
  1499     #endif
  1474 return ret;
  1500 return ret;
  1475 }
  1501 }
  1476 
  1502 
  1477 // ---------------------------------------------------------
  1503 // ---------------------------------------------------------
  1478 // CAutolockAppUi::HiddenReset()
  1504 // CAutolockAppUi::HiddenReset()