securitydialogs/Autolock/src/Autolock.cpp
changeset 66 67b3e3c1fc87
parent 63 989397f9511c
equal deleted inserted replaced
63:989397f9511c 66:67b3e3c1fc87
    33 
    33 
    34 #include <HbIndicator>
    34 #include <HbIndicator>
    35 #include <hbdevicemessagebox.h>
    35 #include <hbdevicemessagebox.h>
    36 
    36 
    37 #include <lockappclientserver.h>
    37 #include <lockappclientserver.h>
       
    38 #include <centralrepository.h>
    38 
    39 
    39 #include "Autolock.h"
    40 #include "Autolock.h"
    40 #include <xqserviceutil.h>
    41 #include <xqserviceutil.h>
    41 #include "autolockuseractivityservice.h"
    42 #include "autolockuseractivityservice.h"
    42 #include <settingsinternalcrkeys.h>     // CenRep keys
    43 #include <settingsinternalcrkeys.h>     // CenRep keys
    85     ESnsrViewTypeDisabled,
    86     ESnsrViewTypeDisabled,
    86     };
    87     };
    87 static const char *KSnsrCmdUnlock = "unlock";
    88 static const char *KSnsrCmdUnlock = "unlock";
    88 static const char *KSnsrCmdSwitchLights = "switch_lights";
    89 static const char *KSnsrCmdSwitchLights = "switch_lights";
    89 static const char *KSnsrCmdSwitchLowPower = "switch_low_power";
    90 static const char *KSnsrCmdSwitchLowPower = "switch_low_power";
       
    91 static const char *KSnsrCmdResetActiveModeTimer = "resetActiveModeTimer";
    90 
    92 
    91 Autolock::Autolock(QWidget *parent, Qt::WFlags f) :
    93 Autolock::Autolock(QWidget *parent, Qt::WFlags f) :
    92     QWidget(parent, f),
    94     QWidget(parent, f),
    93     mService(NULL),
    95     mService(NULL),
    94     mPowerKeyCaptureHandle(0),
    96     mPowerKeyCaptureHandle(0),
   121     ret = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState);
   123     ret = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState);
   122     RDEBUG("Get KCoreAppUIsAutolockStatus", ret);
   124     RDEBUG("Get KCoreAppUIsAutolockStatus", ret);
   123     RDEBUG("autolockState", autolockState);
   125     RDEBUG("autolockState", autolockState);
   124     if (autolockState == EAutolockStatusUninitialized)
   126     if (autolockState == EAutolockStatusUninitialized)
   125         {
   127         {
   126         autolockState = EAutolockOff; // not-initialized means taht the unlock-query hasn't been displayed. Therefore the device should not stay locked.
   128         autolockState = EAutolockOff; // not-initialized means that the unlock-query hasn't been displayed. Therefore the device should not stay locked.
   127         }
   129         }
   128     ret = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); // this might re-set it. That's not bad. It will re-notify all listeners.
   130     ret = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); // this might re-set it. That's not bad. It will re-notify all listeners.
   129     RDEBUG("Set KCoreAppUIsAutolockStatus", ret);
   131     RDEBUG("Set KCoreAppUIsAutolockStatus", ret);
   130 
   132 
   131     ret = RProperty::Define(KPSUidAvkonDomain, KAknKeyguardStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), KWritePolicy);
   133     ret = RProperty::Define(KPSUidAvkonDomain, KAknKeyguardStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), KWritePolicy);
   144 
   146 
   145     ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsDismissDialog, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), TSecurityPolicy(
   147     ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsDismissDialog, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), TSecurityPolicy(
   146             TSecurityPolicy::EAlwaysPass));
   148             TSecurityPolicy::EAlwaysPass));
   147     RDEBUG("defined KSecurityUIsDismissDialog", ret);
   149     RDEBUG("defined KSecurityUIsDismissDialog", ret);
   148 
   150 
   149 		// call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query.
   151     ret = RProperty::Define(KPSUidSecurityUIs, KSecurityUIsScreenSaverStatus, RProperty::EInt, TSecurityPolicy(TSecurityPolicy::EAlwaysPass), writePolicy);
   150 		// Note: this is fast : 0.02 seconds
   152     RDEBUG("defined KSecurityUIsScreenSaverStatus", ret);
   151 		RSCPClient scpClientConfiguration;
       
   152 		User::LeaveIfError( scpClientConfiguration.Connect() );
       
   153 	  CleanupClosePushL( scpClientConfiguration );
       
   154 		RDEBUG("call CheckConfiguration KSCPComplete", KSCPComplete);
       
   155 		TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete );
       
   156 		RDEBUG("finalConfStatus", finalConfStatus);
       
   157 		CleanupStack::PopAndDestroy();	// scpClientConfiguration
       
   158 
   153 
   159     mService = new AutolockService(this);
   154     mService = new AutolockService(this);
   160 
   155 
   161     /* Adjust the palette */
   156     /* Adjust the palette */
   162 #if defined(Q_WS_S60)
   157     RDEBUG( "Palette", 1 );
   163     // this is defined.
       
   164     RDEBUG( "Q_WS_S60", 1 );
       
   165     QPalette p = qApp->palette();
   158     QPalette p = qApp->palette();
   166     QColor color(192,192,192);
   159     QColor color(192,192,192);
   167     QColor bg(201,250,250);
   160     QColor bg(201,250,250);
   168     p.setColor(QPalette::Highlight, color.lighter(200));
   161     p.setColor(QPalette::Highlight, color.lighter(200));
   169     p.setColor(QPalette::Text, Qt::black);
   162     p.setColor(QPalette::Text, Qt::black);
   173     p.setColor(QPalette::ButtonText, Qt::black);
   166     p.setColor(QPalette::ButtonText, Qt::black);
   174     p.setColor(QPalette::Button, color.lighter(150));
   167     p.setColor(QPalette::Button, color.lighter(150));
   175     p.setColor(QPalette::Link, QColor(240,40,40));
   168     p.setColor(QPalette::Link, QColor(240,40,40));
   176 
   169 
   177     qApp->setPalette(p);
   170     qApp->setPalette(p);
   178 #endif
       
   179 
   171 
   180     RDEBUG("connect", 1);
   172     RDEBUG("connect", 1);
   181 
   173 
   182 #if defined(Q_WS_X11) || defined(Q_WS_WIN)
   174 #if defined(Q_WS_X11) || defined(Q_WS_WIN)
   183 		RDEBUG( "Q_WS_X11", 1 );
   175 		RDEBUG( "Q_WS_X11", 1 );
   184     setFixedSize(QSize(360,640)); // nHD
   176     setFixedSize(QSize(360,640)); // nHD
   185 #elif defined(Q_WS_S60)
   177 #else
   186     // this doesn't work well
   178     // this doesn't work well
   187     // showMaximized();
   179     // showMaximized();
   188     showFullScreen();
   180     showFullScreen();
   189 #endif
   181 #endif
   190 
   182 
   196     CRepository* repository = NULL;
   188     CRepository* repository = NULL;
   197     TInt cRresult = 0;
   189     TInt cRresult = 0;
   198     iLockCodeQueryInDisplay = EFalse;
   190     iLockCodeQueryInDisplay = EFalse;
   199     Q_UNUSED(cRresult);
   191     Q_UNUSED(cRresult);
   200     TInt err = 0;
   192     TInt err = 0;
       
   193     err = err;
   201 
   194 
   202 		iProcessingEvent = -1;
   195 		iProcessingEvent = -1;
   203     iLockStatusPrev = ELockNotActive;
   196     iLockStatusPrev = ELockNotActive;
   204     iLockStatus = ELockNotActive;
   197     iLockStatus = ELockNotActive;
       
   198     iSCPConfigured = 0;
   205     QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidSecuritySettings));
   199     QT_TRAP_THROWING(repository = CRepository::NewL(KCRUidSecuritySettings));
   206     cRresult = repository->Get(KSettingsAutolockStatus, lockValue);
   200     cRresult = repository->Get(KSettingsAutolockStatus, lockValue);
   207     RDEBUG("KSettingsAutolockStatus", KSettingsAutolockStatus);
   201     RDEBUG("KSettingsAutolockStatus", KSettingsAutolockStatus);
   208     RDEBUG("cRresult", cRresult);
   202     RDEBUG("cRresult", cRresult);
   209     RDEBUG("lockValue", lockValue);
   203     RDEBUG("lockValue", lockValue);
   321 
   315 
   322 // when detected some settings change, syncronize all of them
   316 // when detected some settings change, syncronize all of them
   323 void Autolock::adjustInactivityTimers(int aReason)
   317 void Autolock::adjustInactivityTimers(int aReason)
   324     {
   318     {
   325     RDEBUG("aReason", aReason);
   319     RDEBUG("aReason", aReason);
       
   320     aReason = aReason;
   326     TInt keyguardTime = 0;
   321     TInt keyguardTime = 0;
   327     TInt lockTime = 0;
   322     TInt lockTime = 0;
   328     CRepository* repository = NULL;
   323     CRepository* repository = NULL;
   329     TInt cRresult = 0;
   324     TInt cRresult = 0;
   330     Q_UNUSED(cRresult);
   325     Q_UNUSED(cRresult);
   401 // Adjust the lights. It uses P&S, honoured by SysAp
   396 // Adjust the lights. It uses P&S, honoured by SysAp
   402 int Autolock::TurnLights(int aMode, int aReason, int aCaller)
   397 int Autolock::TurnLights(int aMode, int aReason, int aCaller)
   403     {
   398     {
   404     RDEBUG("aMode", aMode);
   399     RDEBUG("aMode", aMode);
   405     RDEBUG("aReason", aReason);
   400     RDEBUG("aReason", aReason);
       
   401     aReason = aReason;
   406     RDEBUG("aCaller", aCaller);
   402     RDEBUG("aCaller", aCaller);
       
   403     aCaller = aCaller;
   407     TInt err = 0;
   404     TInt err = 0;
   408     if(aMode!=ESecurityUIsLightsLockOffRequest && aMode!=ELockAppDisableKeyguard)
   405     if(aMode!=ESecurityUIsLightsLockOffRequest && aMode!=ELockAppDisableKeyguard)
   409     	{
   406     	{
   410     	RDEBUG("KLightsSSForcedLightsOn", KLightsSSForcedLightsOn);
   407     	RDEBUG("KLightsSSForcedLightsOn", KLightsSSForcedLightsOn);
   411     	err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, 30);
   408     	err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, 30);
   580     }
   577     }
   581 // This was used when Autolock-debug had a label to display the request. Not in use any more
   578 // This was used when Autolock-debug had a label to display the request. Not in use any more
   582 void Autolock::setLabelNumber(QString label, QString number)
   579 void Autolock::setLabelNumber(QString label, QString number)
   583     {
   580     {
   584     RDEBUG("0", 0);
   581     RDEBUG("0", 0);
       
   582     label = label;
       
   583     number = number;
   585     }
   584     }
   586 
   585 
   587 // Used on debug environment for printing the Request in understandable format
   586 // Used on debug environment for printing the Request in understandable format
   588 void Autolock::DebugRequest(int aReason)
   587 void Autolock::DebugRequest(int aReason)
   589     {
   588     {
   873             	err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
   872             	err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
   874             	RDEBUG("err", err);
   873             	RDEBUG("err", err);
   875             	}
   874             	}
   876             else
   875             else
   877             	{
   876             	{
   878             	RDEBUG("not set KCoreAppUIsAutolockStatus because already ", EAutolockOff);
   877             	RDEBUG("not set KCoreAppUIsAutolockStatus because already EAutolockOff", EAutolockOff);
   879             	}
   878             	}
   880 			// Not needed. SysAp turns the lights when keyguard is disabled
   879 			// Not needed. SysAp turns the lights when keyguard is disabled
   881             // TurnLights(ESecurityUIsLightsLockOnRequest, aReason, 0x14);
   880             // TurnLights(ESecurityUIsLightsLockOnRequest, aReason, 0x14);
   882 
   881 
   883             // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0);    // the settings remains. Only ISA changes, as well as the P&S
   882             // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0);    // the settings remains. Only ISA changes, as well as the P&S
   895 	                err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
   894 	                err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
   896   	              RDEBUG("KCoreAppUIsAutolockStatus err", err);
   895   	              RDEBUG("KCoreAppUIsAutolockStatus err", err);
   897   	            	}
   896   	            	}
   898 		            else
   897 		            else
   899 		            	{
   898 		            	{
   900 		            	RDEBUG("not set KCoreAppUIsAutolockStatus because already ", EAutolockOff);
   899 		            	RDEBUG("not set KCoreAppUIsAutolockStatus because already EAutolockOff", EAutolockOff);
   901 		            	}
   900 		            	}
   902                 TurnLights(ESecurityUIsLightsLockOffRequest, aReason, 0x16);	// same for keyguard and devicelock
   901                 TurnLights(ESecurityUIsLightsLockOffRequest, aReason, 0x16);	// same for keyguard and devicelock
   903                 // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0);
   902                 // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 0);
   904                 cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 1);
   903                 cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 1);
   905                 RDEBUG("cRresult", cRresult);
   904                 RDEBUG("cRresult", cRresult);
   913 	                err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked);
   912 	                err = RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked);
   914   	              RDEBUG("KCoreAppUIsAutolockStatus err", err);
   913   	              RDEBUG("KCoreAppUIsAutolockStatus err", err);
   915   	            	}
   914   	            	}
   916 		            else
   915 		            else
   917 		            	{
   916 		            	{
   918 		            	RDEBUG("not set KCoreAppUIsAutolockStatus because already ", EManualLocked);
   917 		            	RDEBUG("not set KCoreAppUIsAutolockStatus because already EManualLocked", EManualLocked);
   919 		            	}
   918 		            	}
   920                 TurnLights(ESecurityUIsLightsQueryOnRequest, aReason, 0x18);
   919                 TurnLights(ESecurityUIsLightsQueryOnRequest, aReason, 0x18);
   921                 // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 1);
   920                 // cRresult = repositoryDevicelock->Set(KSettingsAutolockStatus, 1);
   922                 cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0); // keyguard disabled, so that user can type and DeviceF can be captured
   921                 cRresult = repositoryKeyguard->Set(KSysApKeyguardActive, 0); // keyguard disabled, so that user can type and DeviceF can be captured
   923                 RDEBUG("cRresult", cRresult);
   922                 RDEBUG("cRresult", cRresult);
   925             }
   924             }
   926         }
   925         }
   927     delete repositoryDevicelock;
   926     delete repositoryDevicelock;
   928     delete repositoryKeyguard;
   927     delete repositoryKeyguard;
   929     // this is the real point where everything is done.
   928     // this is the real point where everything is done.
       
   929     RDEBUG("iLockStatusPrev", iLockStatusPrev);
   930     iLockStatusPrev = iLockStatus;
   930     iLockStatusPrev = iLockStatus;
   931     iLockStatus = aReason;
   931     iLockStatus = aReason;
   932     RDEBUG("setting iLockStatus", iLockStatus);
   932     RDEBUG("setting iLockStatus", iLockStatus);
   933     return KErrNone;
   933     return KErrNone;
   934     }
   934     }
  1176                 iShowKeyguardNote = 1; // this is not sent as parameter, so we need to fake it: ON
  1176                 iShowKeyguardNote = 1; // this is not sent as parameter, so we need to fake it: ON
  1177                 showNoteIfRequested( EKeyguardActive);
  1177                 showNoteIfRequested( EKeyguardActive);
  1178                 }
  1178                 }
  1179             }
  1179             }
  1180             break;
  1180             break;
       
  1181         case 0x100: // Start/confirm server
       
  1182             {
       
  1183 						// call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query.
       
  1184 						// Note: this is fast : 0.02 seconds
       
  1185 						TInt secuiOperation=mParam1;
       
  1186 						TInt iStartup=0;	// this comes as a flag, part of secuiOperation
       
  1187 						iStartup = iStartup;
       
  1188 						RDEBUG("secuiOperation", secuiOperation);
       
  1189 						RDEBUG("iSCPConfigured", iSCPConfigured);
       
  1190 						errorInProcess = KErrNone;
       
  1191 						if(secuiOperation>=0x1000)
       
  1192 							{
       
  1193 							iStartup=1;
       
  1194 							secuiOperation-=0x1000;
       
  1195 							}
       
  1196 						if(secuiOperation==0 /*unknown*/ || secuiOperation==2 /*PIN*/)
       
  1197 							{
       
  1198 							// nothing to do. SCP should not be verified on PIN ; only on lock-query at boot
       
  1199 							RDEBUG("nothing to do because secuiOperation", secuiOperation);
       
  1200 							RDEBUG("KErrCompletion", KErrCompletion);
       
  1201 							errorInProcess = KErrCompletion;
       
  1202 							}
       
  1203 						else
       
  1204 							{
       
  1205 								// usually secuiOperation=6
       
  1206 							if(!iSCPConfigured)
       
  1207 								{
       
  1208 								RSCPClient scpClientConfiguration;
       
  1209 								User::LeaveIfError( scpClientConfiguration.Connect() );
       
  1210 							  CleanupClosePushL( scpClientConfiguration );
       
  1211 								RDEBUG("call CheckConfiguration KSCPComplete", KSCPComplete);
       
  1212 								TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete );
       
  1213 								RDEBUG("finalConfStatus", finalConfStatus);
       
  1214 								CleanupStack::PopAndDestroy();	// scpClientConfiguration
       
  1215 								iSCPConfigured=1;
       
  1216 								errorInProcess = KErrNone;
       
  1217 								}
       
  1218 							else
       
  1219 								{
       
  1220 								RDEBUG("nothing to do because iSCPConfigured", iSCPConfigured);
       
  1221 								RDEBUG("KErrAlreadyExists", KErrAlreadyExists);
       
  1222 								errorInProcess = KErrAlreadyExists;
       
  1223 								}
       
  1224 							}
       
  1225             }
       
  1226             break;
  1181         default:
  1227         default:
  1182             {
  1228             {
  1183             RDEBUG("default", ret);
  1229             RDEBUG("default", ret);
  1184             errorInProcess = KErrNotSupported;
  1230             errorInProcess = KErrNotSupported;
  1185             }
  1231             }
  1202 
  1248 
  1203     RWindowGroup& groupWin = CEikonEnv::Static()->RootWin();
  1249     RWindowGroup& groupWin = CEikonEnv::Static()->RootWin();
  1204 
  1250 
  1205     if (target == EDeviceDialogDestroyed || target == EDeviceDialogScreenSaverHidden) // hide
  1251     if (target == EDeviceDialogDestroyed || target == EDeviceDialogScreenSaverHidden) // hide
  1206         {
  1252         {
       
  1253         /*
       
  1254         This doesn't work since Avkon deprecations
  1207         RDEBUG("ReleaseContext", R_AVKON_DEFAULT_SKEY_LIST);
  1255         RDEBUG("ReleaseContext", R_AVKON_DEFAULT_SKEY_LIST);
  1208         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->ReleaseContext();
  1256         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->ReleaseContext();
  1209         RDEBUG("PopContext", 0x90);
  1257         RDEBUG("PopContext", 0x90);
  1210         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->PopContext();
  1258         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->PopContext();
  1211         RDEBUG("ReleaseContext done", 0x92);
  1259         RDEBUG("ReleaseContext done", 0x92);
       
  1260         */
  1212 
  1261 
  1213         // aReason is not important here, but let's check nevertheless
  1262         // aReason is not important here, but let's check nevertheless
  1214         if (aReason != ELockAppDisableKeyguard && aReason != ELockAppDisableDevicelock && aReason != ELockAppOfferDevicelock)
  1263         if (aReason != ELockAppDisableKeyguard && aReason != ELockAppDisableDevicelock && aReason != ELockAppOfferDevicelock)
  1215             {
  1264             {
  1216             RDEBUG("!!!!****!!!!! error. target=0 but aReason", aReason);
  1265             RDEBUG("!!!!****!!!!! error. target=0 but aReason", aReason);
  1275             setDeviceDialogStatus( target );
  1324             setDeviceDialogStatus( target );
  1276             }
  1325             }
  1277         }
  1326         }
  1278     else if (target == EDeviceDialogCreated || target == EDeviceDialogScreenSaverReDisplay) // show
  1327     else if (target == EDeviceDialogCreated || target == EDeviceDialogScreenSaverReDisplay) // show
  1279         {
  1328         {
       
  1329         /*
       
  1330         This doesn't work since Avkon deprecations
       
  1331 
  1280         RDEBUG("PushContextL", R_AVKON_DEFAULT_SKEY_LIST);
  1332         RDEBUG("PushContextL", R_AVKON_DEFAULT_SKEY_LIST);
  1281         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST);
  1333         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->PushContextL(R_AVKON_SILENT_SKEY_LIST);
  1282         RDEBUG("BringToForeground", 0x90);
  1334         RDEBUG("BringToForeground", 0x90);
  1283         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->BringToForeground();
  1335         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->BringToForeground();
  1284         RDEBUG("LockContext", 0x91);
  1336         RDEBUG("LockContext", 0x91);
  1285         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->LockContext();
  1337         static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi())->KeySounds()->LockContext();
  1286         RDEBUG("PushContextL Done", 0x92);
  1338         RDEBUG("PushContextL Done", 0x92);
       
  1339         */
  1287 
  1340 
  1288         // secUiOriginatedQuery should be ESecurityUIsSecUIOriginatedUninitialized . If not, the validation is not correctly filtering it
  1341         // secUiOriginatedQuery should be ESecurityUIsSecUIOriginatedUninitialized . If not, the validation is not correctly filtering it
  1289         QVariantMap params;
  1342         QVariantMap params;
  1290         TBool err=EFalse;
  1343         TBool err=EFalse;
       
  1344         err = err;
  1291 
  1345 
  1292         if (aReason == ELockAppEnableKeyguard)
  1346         if (aReason == ELockAppEnableKeyguard)
  1293             params.insert("type", ESecUiTypeKeyguard);
  1347             params.insert("type", ESecUiTypeKeyguard);
  1294         else if (aReason == ELockAppEnableDevicelock)
  1348         else if (aReason == ELockAppEnableDevicelock)
  1295             params.insert("type", ESecUiTypeDeviceLock);
  1349             params.insert("type", ESecUiTypeDeviceLock);
  1536     }
  1590     }
  1537 
  1591 
  1538 void Autolock::switchScreensaverToPowerSaveMode()
  1592 void Autolock::switchScreensaverToPowerSaveMode()
  1539     {
  1593     {
  1540     RDEBUG("0", 0);
  1594     RDEBUG("0", 0);
  1541 	// This crashes IVE3. TODO : restore when it works again.
  1595 	  // This works again and doesn't crash IVE3
  1542     //switchScreensaverMode( ESnsrViewTypeStandby);
  1596     switchScreensaverMode( ESnsrViewTypeStandby);
  1543     RDEBUG("99", 0x99);
  1597     RDEBUG("99", 0x99);
  1544     }
  1598     }
  1545 
  1599 
  1546 void Autolock::handleMessageFromScreensaver(const QVariantMap &data)
  1600 void Autolock::handleMessageFromScreensaver(const QVariantMap &data)
  1547     {
  1601     {
  1559         {
  1613         {
  1560         int lightStatus = it.value().toInt();
  1614         int lightStatus = it.value().toInt();
  1561         RDEBUG("switching screen lights . lightStatus", lightStatus);
  1615         RDEBUG("switching screen lights . lightStatus", lightStatus);
  1562         int err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, lightStatus);
  1616         int err = RProperty::Set(KPSUidCoreApplicationUIs, KLightsSSForcedLightsOn, lightStatus);
  1563         RDEBUG("err", err);
  1617         RDEBUG("err", err);
       
  1618         }
       
  1619 
       
  1620     it = data.find(KSnsrCmdResetActiveModeTimer);
       
  1621     if (it != data.end() && iLockStatus != ELockNotActive)
       
  1622         {
       
  1623         RDEBUG("calling switchScreensaverMode ESnsrViewTypeActive", ESnsrViewTypeActive);
       
  1624         switchScreensaverMode( ESnsrViewTypeActive );
       
  1625         RDEBUG("done", 1);
  1564         }
  1626         }
  1565 
  1627 
  1566     it = data.find(KSnsrCmdSwitchLowPower);
  1628     it = data.find(KSnsrCmdSwitchLowPower);
  1567     if (it != data.end())
  1629     if (it != data.end())
  1568         {
  1630         {
  1602 
  1664 
  1603 void Autolock::handleScreensaverClosed()
  1665 void Autolock::handleScreensaverClosed()
  1604     {
  1666     {
  1605     RDEBUG("0", 0);
  1667     RDEBUG("0", 0);
  1606     int err(0);
  1668     int err(0);
       
  1669     err = err;
  1607     // Screensaver (usually) cannot send anymore any commands when
  1670     // Screensaver (usually) cannot send anymore any commands when
  1608     // it's being closed. Thus, we need to ensure here that screen has lights and
  1671     // it's being closed. Thus, we need to ensure here that screen has lights and
  1609     // full-power mode once screensaver is closed.
  1672     // full-power mode once screensaver is closed.
  1610 
  1673 
  1611     // handled now directly by screensaver
  1674     // handled now directly by screensaver
  1947 // got API request from lockaccessextension
  2010 // got API request from lockaccessextension
  1948 int AutolockService::service(const QString& number, const QString& aParam1, const QString& aParam2)
  2011 int AutolockService::service(const QString& number, const QString& aParam1, const QString& aParam2)
  1949     {
  2012     {
  1950     RDEBUG("0", 0);
  2013     RDEBUG("0", 0);
  1951     TInt err = KErrNone;
  2014     TInt err = KErrNone;
       
  2015     err = err;
  1952     RDEBUG("number", number.toInt());
  2016     RDEBUG("number", number.toInt());
  1953     RDEBUG("aParam1", aParam1.toInt());
  2017     RDEBUG("aParam1", aParam1.toInt());
  1954     RDEBUG("aParam2", aParam2.toInt());
  2018     RDEBUG("aParam2", aParam2.toInt());
  1955     mAsyncAnswer = false;
  2019     mAsyncAnswer = false;
  1956     XQRequestInfo info = requestInfo();
  2020     XQRequestInfo info = requestInfo();