securitydialogs/Autolock/src/AutoLockModel.cpp
branchRCL_3
changeset 8 ece4bbb094df
parent 0 164170e6151a
child 11 9971b621ef6c
equal deleted inserted replaced
7:6e226572c5f0 8:ece4bbb094df
    19 #include <activitymanager.h>
    19 #include <activitymanager.h>
    20 #include <bldvariant.hrh>
    20 #include <bldvariant.hrh>
    21 #include <featmgr.h>
    21 #include <featmgr.h>
    22 #include <AknNotifierController.h>
    22 #include <AknNotifierController.h>
    23 #include <featmgr.h>
    23 #include <featmgr.h>
    24 #include    <e32property.h>
    24 #include <e32property.h>
    25 #include	<PSVariables.h>
    25 #include <PSVariables.h>
    26 #include    <startupdomainpskeys.h>
    26 #include <startupdomainpskeys.h>
    27 #include    <coreapplicationuisdomainpskeys.h>
    27 #include <coreapplicationuisdomainpskeys.h>
    28 #include <ctsydomainpskeys.h>
    28 #include <ctsydomainpskeys.h>
    29 
    29 
    30 #include <SCPClient.h>
    30 #include <SCPClient.h>
    31 
    31 
    32 #include    "AutoLockModelPS.h"  
    32 #include "AutoLockModelPS.h"  
    33 #include	"AutolockAppUiPS.h"
    33 #include "AutolockAppUiPS.h"
    34 #include    "AutoLockLockObserverPS.h"
    34 #include "AutoLockLockObserverPS.h"
    35 #include "AutoLockCenRepI.h"
    35 #include "AutoLockCenRepI.h"
    36 
    36 
    37 
    37 
    38 const TInt AutoLockOff(60000);
    38 const TInt AutoLockOff(60000);
    39 
    39 
    45 // CAutoLockModel::NewL()
    45 // CAutoLockModel::NewL()
    46 // ----------------------------------------------------------
    46 // ----------------------------------------------------------
    47 //
    47 //
    48 
    48 
    49 CAutoLockModel* CAutoLockModel::NewL(CAutolockAppUi* aAppUi, TBool aLocked)
    49 CAutoLockModel* CAutoLockModel::NewL(CAutolockAppUi* aAppUi, TBool aLocked)
    50 	{
    50   {
    51 	CAutoLockModel* self = new (ELeave) CAutoLockModel(aAppUi);
    51   CAutoLockModel* self = new (ELeave) CAutoLockModel(aAppUi);
    52 	CleanupStack::PushL(self);
    52   CleanupStack::PushL(self);
    53 	self->ConstructL( aLocked );
    53   self->ConstructL( aLocked );
    54 	CleanupStack::Pop(); //self
    54   CleanupStack::Pop(); //self
    55 	return self;
    55   return self;
    56 	}
    56   }
    57 //
    57 //
    58 // ----------------------------------------------------------
    58 // ----------------------------------------------------------
    59 // CAutoLockModel::CAutoLockModel()
    59 // CAutoLockModel::CAutoLockModel()
    60 // C++ default constructor
    60 // C++ default constructor
    61 // ----------------------------------------------------------
    61 // ----------------------------------------------------------
    62 // 
    62 // 
    63 CAutoLockModel::CAutoLockModel(CAutolockAppUi* aAppUi) : 
    63 CAutoLockModel::CAutoLockModel(CAutolockAppUi* aAppUi) : 
    64  iAppUi( aAppUi ), iMonitoring(EFalse)	
    64  iAppUi( aAppUi ), iMonitoring(EFalse)  
    65 	{
    65   {
    66 	}
    66   }
    67 
    67 
    68 //
    68 //
    69 // ----------------------------------------------------------
    69 // ----------------------------------------------------------
    70 // CAutoLockModel::ConstructL()
    70 // CAutoLockModel::ConstructL()
    71 // Symbian OS default constructor
    71 // Symbian OS default constructor
    72 // ----------------------------------------------------------
    72 // ----------------------------------------------------------
    73 //
    73 //
    74 void CAutoLockModel::ConstructL( TBool aLocked )
    74 void CAutoLockModel::ConstructL( TBool aLocked )
    75 	{
    75   {
    76 		FeatureManager::InitializeLibL();
    76     FeatureManager::InitializeLibL();
    77 	#if defined(_DEBUG)
    77   #if defined(_DEBUG)
    78     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() BEGIN"));
    78     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() BEGIN"));
    79   #endif	
    79   #endif  
    80     iCenRepI = CAutolockCenRepI::NewL(iAppUi);
    80     iCenRepI = CAutolockCenRepI::NewL(iAppUi);
    81 	// lock status observer
    81   // lock status observer
    82 	iLockObserver = CLockObserver::NewL(iAppUi);
    82   iLockObserver = CLockObserver::NewL(iAppUi);
    83 	// Activitymanager
    83   // Activitymanager
    84 	iActivityManager = CUserActivityManager::NewL(CActive::EPriorityStandard);
    84   iActivityManager = CUserActivityManager::NewL(CActive::EPriorityStandard);
    85 	StartActivityMonitoringL();
    85   StartActivityMonitoringL();
    86     // In GSM the device is always unlocked.
    86     // In GSM the device is always unlocked.
    87     // In CDMA, SecClientUi will lock the device on boot-up if needed.
    87     // In CDMA, SecClientUi will lock the device on boot-up if needed.
    88  
    88     if ( aLocked == EFalse ) {       
    89  	if ( aLocked == EAutolockStatusUninitialized )
    89        SetLockedL(EAutolockOff);
    90 	{
    90        #if defined(_DEBUG)
    91 			RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus,	EAutolockStatusUninitialized);
    91        RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() EAutolockOff"));
    92 	}
    92        #endif       
    93 	else
    93     }     
    94 	{
       
    95 	    RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus,	EAutolockOff);
       
    96   }
       
    97        
    94        
    98     #if defined(_DEBUG)
    95     #if defined(_DEBUG)
    99     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() END"));
    96     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::ConstructL() END"));
   100     #endif
    97     #endif
   101 	}
    98   }
   102 	//
    99   //
   103 // ----------------------------------------------------------
   100 // ----------------------------------------------------------
   104 // CAutoLockModel::StartActivityMonitoringL()
   101 // CAutoLockModel::StartActivityMonitoringL()
   105 // Start monitoring user activity
   102 // Start monitoring user activity
   106 // ----------------------------------------------------------
   103 // ----------------------------------------------------------
   107 //
   104 //
   108 void CAutoLockModel::StartActivityMonitoringL()
   105 void CAutoLockModel::StartActivityMonitoringL()
   109 	{	
   106   { 
   110 	SetActivityManagerL();
   107   SetActivityManagerL();
   111 	}
   108   }
   112 
   109 
   113 //
   110 //
   114 // ----------------------------------------------------------
   111 // ----------------------------------------------------------
   115 // CAutoLockModel::StopActivityMonitoring()
   112 // CAutoLockModel::StopActivityMonitoring()
   116 // Stop monitoring user activity
   113 // Stop monitoring user activity
   117 // ----------------------------------------------------------
   114 // ----------------------------------------------------------
   118 //
   115 //
   119 void CAutoLockModel::StopActivityMonitoring()
   116 void CAutoLockModel::StopActivityMonitoring()
   120 	{
   117   {
   121 	CancelActivityManager();
   118   CancelActivityManager();
   122 	}
   119   }
   123 
   120 
   124 //
   121 //
   125 // ----------------------------------------------------------
   122 // ----------------------------------------------------------
   126 // CAutoLockModel::SetActivityManagerL()
   123 // CAutoLockModel::SetActivityManagerL()
   127 // Initializes activymanager   
   124 // Initializes activymanager   
   128 // ----------------------------------------------------------
   125 // ----------------------------------------------------------
   129 //
   126 //
   130 void CAutoLockModel::SetActivityManagerL()
   127 void CAutoLockModel::SetActivityManagerL()
   131 	{
   128   {
   132 	if (AutoLockTimeout() )
   129   if (AutoLockTimeout() )
   133 		{
   130     {
   134 		iActivityManager->Start(AutoLockTimeout(), TCallBack(HandleInactiveEventL,this), 
   131     iActivityManager->Start(AutoLockTimeout(), TCallBack(HandleInactiveEventL,this), 
   135 								TCallBack(HandleActiveEventL,this));
   132                 TCallBack(HandleActiveEventL,this));
   136 		}
   133     }
   137 	else
   134   else
   138 		{
   135     {
   139 		iActivityManager->Start(AutoLockOff, TCallBack(HandleInactiveEventL,this), 
   136     iActivityManager->Start(AutoLockOff, TCallBack(HandleInactiveEventL,this), 
   140 								TCallBack(HandleActiveEventL,this));
   137                 TCallBack(HandleActiveEventL,this));
   141 		}
   138     }
   142 
   139 
   143 	}
   140   }
   144 //
   141 //
   145 // ----------------------------------------------------------
   142 // ----------------------------------------------------------
   146 // CAutoLockModel::CancelActivityManager()
   143 // CAutoLockModel::CancelActivityManager()
   147 // UnInitializes activymanager   
   144 // UnInitializes activymanager   
   148 // ----------------------------------------------------------
   145 // ----------------------------------------------------------
   149 //
   146 //
   150 void CAutoLockModel::CancelActivityManager()
   147 void CAutoLockModel::CancelActivityManager()
   151 	{
   148   {
   152     if ( iActivityManager )
   149     if ( iActivityManager )
   153         {
   150         {
   154 	    iActivityManager->Cancel();
   151       iActivityManager->Cancel();
   155         }
   152         }
   156 	delete iActivityManager;
   153   delete iActivityManager;
   157 	iActivityManager = NULL;
   154   iActivityManager = NULL;
   158 	}
   155   }
   159 //
   156 //
   160 // ----------------------------------------------------------
   157 // ----------------------------------------------------------
   161 // CAutoLockModel::~CAutoLockModel()
   158 // CAutoLockModel::~CAutoLockModel()
   162 // Destructor   
   159 // Destructor   
   163 // ----------------------------------------------------------
   160 // ----------------------------------------------------------
   164 //
   161 //
   165 CAutoLockModel::~CAutoLockModel()
   162 CAutoLockModel::~CAutoLockModel()
   166 	{
   163   {
   167     delete iCenRepI;
   164     delete iCenRepI;
   168 	delete iLockObserver;
   165   delete iLockObserver;
   169 	StopActivityMonitoring();
   166   StopActivityMonitoring();
   170 	FeatureManager::UnInitializeLib();
   167   FeatureManager::UnInitializeLib();
   171     // close custom phone
   168     // close custom phone
   172 	}
   169   }
   173 //
   170 //
   174 // ----------------------------------------------------------
   171 // ----------------------------------------------------------
   175 // CAutoLockModel::AutoLockTimeout()
   172 // CAutoLockModel::AutoLockTimeout()
   176 // Returns current autolock period
   173 // Returns current autolock period
   177 // ----------------------------------------------------------
   174 // ----------------------------------------------------------
   178 //
   175 //
   179 TInt CAutoLockModel::AutoLockTimeout()
   176 TInt CAutoLockModel::AutoLockTimeout()
   180 	{
   177   {
   181     return iCenRepI->Timeout();
   178     return iCenRepI->Timeout();
   182 	}
   179   }
   183 //
   180 //
   184 // ----------------------------------------------------------
   181 // ----------------------------------------------------------
   185 // CAutoLockModel::ResetInactivityTimeoutL()
   182 // CAutoLockModel::ResetInactivityTimeoutL()
   186 // Gets autolock period and starts monitoring user activity 
   183 // Gets autolock period and starts monitoring user activity 
   187 // ----------------------------------------------------------
   184 // ----------------------------------------------------------
   188 //
   185 //
   189 void CAutoLockModel::ResetInactivityTimeout()
   186 void CAutoLockModel::ResetInactivityTimeout()
   190 	{	
   187   { 
   191 	if (AutoLockTimeout() )
   188   if (AutoLockTimeout() )
   192 		{
   189     {
   193 		iActivityManager->SetInactivityTimeout(AutoLockTimeout());
   190     iActivityManager->SetInactivityTimeout(AutoLockTimeout());
   194 		}
   191     }
   195 	else
   192   else
   196 		{
   193     {
   197 		iActivityManager->SetInactivityTimeout(AutoLockOff);
   194     iActivityManager->SetInactivityTimeout(AutoLockOff);
   198 		}
   195     }
   199 	}
   196   }
   200 //
   197 //
   201 // ----------------------------------------------------------
   198 // ----------------------------------------------------------
   202 // CAutoLockModel::HandleActiveEventL()
   199 // CAutoLockModel::HandleActiveEventL()
   203 // Handles Active event. Called by ActivityManager
   200 // Handles Active event. Called by ActivityManager
   204 // ----------------------------------------------------------
   201 // ----------------------------------------------------------
   205 //
   202 //
   206 TInt CAutoLockModel::HandleActiveEventL(TAny* /*aPtr*/)
   203 TInt CAutoLockModel::HandleActiveEventL(TAny* /*aPtr*/)
   207 	{
   204   {
   208 	return KErrNone;
   205   return KErrNone;
   209 	}
   206   }
   210 
   207 
   211 //
   208 //
   212 // ----------------------------------------------------------
   209 // ----------------------------------------------------------
   213 // CAutoLockModel::HandleInactiveEventL()
   210 // CAutoLockModel::HandleInactiveEventL()
   214 // Handles InActive event. Called by ActivityManager
   211 // Handles InActive event. Called by ActivityManager
   215 // ----------------------------------------------------------
   212 // ----------------------------------------------------------
   216 //
   213 //
   217 TInt CAutoLockModel::HandleInactiveEventL(TAny* aPtr)
   214 TInt CAutoLockModel::HandleInactiveEventL(TAny* aPtr)
   218 	{
   215   {
   219 	if ( STATIC_CAST(CAutoLockModel*, aPtr)->AutoLockTimeout() )
   216   if ( STATIC_CAST(CAutoLockModel*, aPtr)->AutoLockTimeout() )
   220 		{
   217     {
   221 			TInt value(EStartupUiPhaseUninitialized);
   218       TInt value(EStartupUiPhaseUninitialized);
   222 			RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value);
   219       RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value);
   223 			//Don't lock unless boot is over.
   220       //Don't lock unless boot is over.
   224 	    if(value == EStartupUiPhaseAllDone)
   221       if(value == EStartupUiPhaseAllDone)
   225 		    {
   222         {
   226 		    #if defined(_DEBUG)
   223         #if defined(_DEBUG)
   227     		RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::HandleInactiveEventL() Boot over"));
   224         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::HandleInactiveEventL() Boot over"));
   228     		#endif
   225         #endif
   229 				#ifdef RD_REMOTELOCK
   226         #ifdef RD_REMOTELOCK
   230 				STATIC_CAST(CAutoLockModel*, aPtr)->LockSystemL(ETimerLocked);
   227         STATIC_CAST(CAutoLockModel*, aPtr)->LockSystemL(ETimerLocked);
   231 				#else
   228         #else
   232 				STATIC_CAST(CAutoLockModel*, aPtr)->LockSystemL(EAutolockOn);
   229         STATIC_CAST(CAutoLockModel*, aPtr)->LockSystemL(EAutolockOn);
   233 				#endif //RD_REMOTELOCK
   230         #endif //RD_REMOTELOCK
   234 			  }
   231         }
   235 			else
   232       else
   236 			{
   233       {
   237 				#if defined(_DEBUG)
   234         #if defined(_DEBUG)
   238     		RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::HandleInactiveEventL() In boot; don't lock"));
   235         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::HandleInactiveEventL() In boot; don't lock"));
   239     		#endif
   236         #endif
   240 			}
   237       }
   241 		}
   238     }
   242 	return KErrNone;
   239   return KErrNone;
   243 	}
   240   }
   244 
   241 
   245 //
   242 //
   246 // ----------------------------------------------------------
   243 // ----------------------------------------------------------
   247 // CAutoLockModel::LockSystemL()
   244 // CAutoLockModel::LockSystemL()
   248 // Locks system
   245 // Locks system
   249 // ----------------------------------------------------------
   246 // ----------------------------------------------------------
   250 //
   247 //
   251 void CAutoLockModel::LockSystemL(TInt aAutolockState)
   248 void CAutoLockModel::LockSystemL(TInt aAutolockState)
   252 	{
   249   {
   253 	#if defined(_DEBUG)
   250   #if defined(_DEBUG)
   254     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() BEGIN"));
   251     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() BEGIN"));
   255     #endif
   252     #endif
   256     // If already locked, do nothing. Otherwise we'll end up
   253     // If already locked, do nothing. Otherwise we'll end up
   257     // on top of Screensaver
   254     // on top of Screensaver
   258     // Check if iSideKey2 is zero or not (locked if nonzero)
   255     // Check if iSideKey2 is zero or not (locked if nonzero)
   259     // Also, phone should not be locked if PUK1 code query is up.
   256     // Also, phone should not be locked if PUK1 code query is up.
   260 #ifdef FF_STARTUP_OMA_DM_SUPPORT	// New booting order	Start	ID:	 MVKS-7PZDZ5
   257 #ifdef FF_STARTUP_OMA_DM_SUPPORT  // New booting order  Start ID:  MVKS-7PZDZ5
   261 		TInt autolock_value	=	0;
   258     TInt autolock_value = 0;
   262 		RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus,	autolock_value);	
   259     RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolock_value);  
   263 		if (autolock_value ==	EAutolockStatusUninitialized)
   260     if (autolock_value == EAutolockStatusUninitialized)
   264 		{
   261     {
   265 				return;					
   262         return;         
   266 		}		
   263     }   
   267 #endif	//End	ID:	 MVKS-7PZDZ5
   264 #endif  //End ID:  MVKS-7PZDZ5
   268     if (iAppUi->Locked() || iAppUi->IsPinBlocked())
   265     if (iAppUi->Locked() || iAppUi->IsPinBlocked())
   269         {
   266         {
   270         return;
   267         return;
   271         }
   268         }
   272 	
   269   
   273 	TInt lightStatus=EForcedLightsUninitialized; 
   270   TInt lightStatus=EForcedLightsUninitialized; 
   274 	RProperty::Get(KPSUidCoreApplicationUIs,KLightsVTForcedLightsOn,lightStatus ); 
   271   RProperty::Get(KPSUidCoreApplicationUIs,KLightsVTForcedLightsOn,lightStatus ); 
   275 	//If display is forced on. don't lock 
   272   //If display is forced on. don't lock 
   276 	if(lightStatus == EForcedLightsOn ) 
   273   if(lightStatus == EForcedLightsOn ) 
   277 		{
   274     {
   278 		#if defined(_DEBUG) 
   275     #if defined(_DEBUG) 
   279 		RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() Display is forced on. Device not locked")); 
   276     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() Display is forced on. Device not locked")); 
   280 		#endif 
   277     #endif 
   281 		return;
   278     return;
   282 		}
   279     }
   283 
   280 
   284     //Check which state we are in to see if it's OK to lock the phone
   281     //Check which state we are in to see if it's OK to lock the phone
   285     //In CDMA when there is no SIM (RUIM) support we should be able to lock
   282     //In CDMA when there is no SIM (RUIM) support we should be able to lock
   286     //the phone after reboot. In this case ESWStateNormal is too late to lock the phone
   283     //the phone after reboot. In this case ESWStateNormal is too late to lock the phone
   287     //and other states below are needed.
   284     //and other states below are needed.
   292     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || iAppUi->HiddenReset())
   289     if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) || iAppUi->HiddenReset())
   293         {
   290         {
   294         if( (sysState == ESwStateNormalRfOn       ||
   291         if( (sysState == ESwStateNormalRfOn       ||
   295             sysState == ESwStateNormalRfOff       ||
   292             sysState == ESwStateNormalRfOff       ||
   296              sysState == ESwStateCriticalPhaseOK) &&
   293              sysState == ESwStateCriticalPhaseOK) &&
   297             (aAutolockState > EAutolockOff) )	// EMKK-7N3G7R
   294             (aAutolockState > EAutolockOff) ) // EMKK-7N3G7R
   298             {
   295             {
   299             #if defined(_DEBUG)
   296             #if defined(_DEBUG)
   300             RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() LOCKED AFTER HIDDEN RESET"));
   297             RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() LOCKED AFTER HIDDEN RESET"));
   301             #endif
   298             #endif
   302             okToLock = ETrue;
   299             okToLock = ETrue;
   309             (aAutolockState > EAutolockOff) ) // EMKK-7N3G7R
   306             (aAutolockState > EAutolockOff) ) // EMKK-7N3G7R
   310             {
   307             {
   311             okToLock = ETrue;
   308             okToLock = ETrue;
   312             }
   309             }
   313         }
   310         }
   314    TInt tarmFlag;
   311    TInt tarmFlag=0;
   315 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))    
   312 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))    
   316 {
   313 {
   317     // Get the TARM admin flag value
   314     // Get the TARM admin flag value
   318 	TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag );
   315   TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag );
   319     
   316     
   320     if ( tRet != KErrNone )
   317     if ( tRet != KErrNone )
   321         {
   318         {
   322         #if defined(_DEBUG)
   319         #if defined(_DEBUG)
   323         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL():\
   320         RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL():\
   331             tarmFlag );
   328             tarmFlag );
   332         #endif
   329         #endif
   333         }
   330         }
   334 }
   331 }
   335     
   332     
   336     TInt callState;
   333     TInt callState=0;
   337     iProperty.Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
   334     iProperty.Get(KPSUidCtsyCallInformation, KCTsyCallState, callState);
   338 TBool isConditionSatisfied = EFalse;
   335 TBool isConditionSatisfied = EFalse;
   339 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
   336 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ))
   340 {        
   337 {        
   341     if ( ( callState != EPSCTsyCallStateNone ) && (!( tarmFlag & KSCPFlagAdminLock )) )    
   338     if ( ( callState != EPSCTsyCallStateNone ) && (!( tarmFlag & KSCPFlagAdminLock )) )    
   342     			isConditionSatisfied = ETrue;
   339           isConditionSatisfied = ETrue;
   343 }
   340 }
   344 else
   341 else
   345 {
   342 {
   346     if ( callState != EPSCTsyCallStateNone )
   343     if ( callState != EPSCTsyCallStateNone )
   347     		isConditionSatisfied = ETrue;
   344         isConditionSatisfied = ETrue;
   348 }
   345 }
   349 		if (isConditionSatisfied)
   346     if (isConditionSatisfied)
   350         {
   347         {
   351         TBool remoteLocked(EFalse);
   348         TBool remoteLocked(EFalse);
   352         #ifdef RD_REMOTELOCK
   349         #ifdef RD_REMOTELOCK
   353         remoteLocked = (aAutolockState == ERemoteLocked);
   350         remoteLocked = (aAutolockState == ERemoteLocked);
   354         #endif //RD_REMOTELOCK
   351         #endif //RD_REMOTELOCK
   367     if (!iAppUi->IsForeground() && okToLock)
   364     if (!iAppUi->IsForeground() && okToLock)
   368         {
   365         {
   369         #if defined(_DEBUG)
   366         #if defined(_DEBUG)
   370         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() LOCK PHONE"));
   367         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() LOCK PHONE"));
   371         #endif   
   368         #endif   
   372 		// close fast-swap window
   369     // close fast-swap window
   373 		CEikonEnv::Static()->DismissTaskList();
   370     CEikonEnv::Static()->DismissTaskList();
   374 		// inform Avokon & Other app that system is locked
   371     // inform Avokon & Other app that system is locked
   375 		// unless the value has already been set in secuisystemlock
   372     // unless the value has already been set in secuisystemlock
   376 		#ifdef RD_REMOTELOCK
   373     #ifdef RD_REMOTELOCK
   377 		if(aAutolockState != EManualLocked)
   374     if(aAutolockState != EManualLocked)
   378     		{
   375         {
   379     		    #if defined(_DEBUG)
   376             #if defined(_DEBUG)
   380                 RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() Timer/Remote locked: %d"), aAutolockState);
   377                 RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() Timer/Remote locked: %d"), aAutolockState);
   381                 #endif
   378                 #endif
   382     		    SetLockedL(aAutolockState);		    
   379             SetLockedL(aAutolockState);       
   383     		}
   380         }
   384 		else if((aAutolockState == EManualLocked)  && !iAppUi->Locked() && iAppUi->HiddenReset())
   381     else if((aAutolockState == EManualLocked)  && !iAppUi->Locked() && iAppUi->HiddenReset())
   385 		     {   //set the PubSub key if we are to be locked after a hidden reset has occurred.
   382          {   //set the PubSub key if we are to be locked after a hidden reset has occurred.
   386 		         #if defined(_DEBUG)
   383              #if defined(_DEBUG)
   387                  RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() HIDDEN RESET LOCK"));
   384                  RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() HIDDEN RESET LOCK"));
   388                  #endif
   385                  #endif
   389 		         SetLockedL(aAutolockState);	   
   386              SetLockedL(aAutolockState);     
   390 		     }
   387          }
   391 		else
   388     else
   392 		    {   //Normal manual lock from power key. Just set the CenRep key.
   389         {   //Normal manual lock from power key. Just set the CenRep key.
   393 		        iCenRepI->SetLockedL(okToLock);
   390             iCenRepI->SetLockedL(okToLock);
   394 		    }
   391         }
   395 		#else //! RD_REMOTELOCK
   392     #else //! RD_REMOTELOCK
   396 		SetLockedL(aAutolockState);
   393     SetLockedL(aAutolockState);
   397 		#endif//RD_REMOTELOCK
   394     #endif//RD_REMOTELOCK
   398 		// lock keys
   395     // lock keys
   399 		iAppUi->LockKeysL();
   396     iAppUi->LockKeysL();
   400 		// app to foreground
   397     // app to foreground
   401 		iAppUi->BringAppToForegroundL();
   398     iAppUi->BringAppToForegroundL();
   402          // Reset inactivity time so that Screensaver gets to
   399          // Reset inactivity time so that Screensaver gets to
   403         // run again after its timeout. We'll ignore the new
   400         // run again after its timeout. We'll ignore the new
   404         // inactivity timeout, if already locked
   401         // inactivity timeout, if already locked
   405         User::ResetInactivityTime();
   402         RDebug::Printf( "%s %s (%u) CR 428-469 avoid User::ResetInactivityTime=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
   406 		}
   403         // User::ResetInactivityTime();
       
   404     }
   407     #if defined(_DEBUG)
   405     #if defined(_DEBUG)
   408     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() END"));
   406     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::LockSystemL() END"));
   409     #endif
   407     #endif
   410 } 
   408 } 
   411 	
   409   
   412 //
   410 //
   413 // ----------------------------------------------------------
   411 // ----------------------------------------------------------
   414 // CAutoLockModel::SetLocked
   412 // CAutoLockModel::SetLocked
   415 // Sets lockvalue in Publish & Subscribe and Central Repository
   413 // Sets lockvalue in Publish & Subscribe and Central Repository
   416 // ----------------------------------------------------------
   414 // ----------------------------------------------------------
   417 //
   415 //
   418 void CAutoLockModel::SetLockedL(TInt aAutolockState)
   416 void CAutoLockModel::SetLockedL(TInt aAutolockState)
   419 	{
   417   {
   420 	#if defined(_DEBUG)
   418   #if defined(_DEBUG)
   421     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() begin"));
   419     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() begin"));
   422     #endif
   420     #endif
   423 	TBool locked = (aAutolockState > EAutolockOff);
   421   TBool locked = (aAutolockState > EAutolockOff);
   424 	if (locked)
   422   if (locked)
   425 		{
   423     {
   426         iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, aAutolockState);
   424         iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, aAutolockState);
   427         #if defined(_DEBUG)
   425         #if defined(_DEBUG)
   428         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() LOCK"));
   426         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() LOCK"));
   429         #endif
   427         #endif
   430 		}		
   428     }   
   431   else
   429   else
   432 		{				
   430     {       
   433         iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
   431         iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
   434         #if defined(_DEBUG)
   432         #if defined(_DEBUG)
   435         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() UNLOCK"));         
   433         RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() UNLOCK"));         
   436         #endif
   434         #endif
   437     }
   435     }
   438 
   436 
   439     iCenRepI->SetLockedL(locked);
   437     iCenRepI->SetLockedL(locked);
   440     #if defined(_DEBUG)
   438     #if defined(_DEBUG)
   441     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() end"));
   439     RDebug::Print(_L("(AUTOLOCK)CAutoLockModel::SetLockedL() end"));
   442     #endif
   440     #endif
   443 	}
   441   }
   444 
   442 
   445 // END OF FILE
   443 // END OF FILE