31 #include <AknUtils.h> |
31 #include <AknUtils.h> |
32 #include <eikcba.h> |
32 #include <eikcba.h> |
33 #include <aknnotecontrol.h> |
33 #include <aknnotecontrol.h> |
34 #include <aknlayoutscalable_avkon.cdl.h> |
34 #include <aknlayoutscalable_avkon.cdl.h> |
35 |
35 |
36 #include <SecondaryDisplay/AknSecondaryDisplayDefs.h> |
36 #include <secondarydisplay/AknSecondaryDisplayDefs.h> |
37 #include <avkondomainpskeys.h> // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus |
37 #include <avkondomainpskeys.h> // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus |
38 #include <startupdomainpskeys.h> // KStartupSecurityCodeQueryStatus |
38 #include <startupdomainpskeys.h> // KStartupSecurityCodeQueryStatus |
39 #include <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus |
39 #include <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus |
40 #include <AknNotifySignature.h> |
40 #include <AknNotifySignature.h> |
41 #include "AknCapServerEntry.h" |
41 #include "AknCapServerEntry.h" |
1129 |
1129 |
1130 // --------------------------------------------------------------------------- |
1130 // --------------------------------------------------------------------------- |
1131 // Enable key lock. |
1131 // Enable key lock. |
1132 // --------------------------------------------------------------------------- |
1132 // --------------------------------------------------------------------------- |
1133 // |
1133 // |
1134 void CAknKeyLockControl::EnableKeylock( TBool aShowNote ) |
1134 void CAknKeyLockControl::EnableKeylock( TBool aShowNote, TBool aNotifySysApp ) |
1135 { |
1135 { |
1136 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock %d"), aShowNote); ) |
1136 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock %d"), aShowNote); ) |
1137 |
1137 |
1138 // Policy can be used to disable support for keyguard. |
1138 // Policy can be used to disable support for keyguard. |
1139 if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() ) |
1139 if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() ) |
1151 // Update keyguard status to P&S system. |
1151 // Update keyguard status to P&S system. |
1152 iStatusProperty.Set( iAutolockEnabled ? EKeyguardAutolockEmulation : |
1152 iStatusProperty.Set( iAutolockEnabled ? EKeyguardAutolockEmulation : |
1153 EKeyguardLocked ); |
1153 EKeyguardLocked ); |
1154 iKeyLockEnabled = ETrue; |
1154 iKeyLockEnabled = ETrue; |
1155 |
1155 |
1156 if ( !iAutolockEnabled ) |
1156 if ( !iAutolockEnabled && aNotifySysApp ) |
1157 { |
1157 { |
1158 SendMessageToSysAp( EEikKeyLockEnabled ); |
1158 SendMessageToSysAp( EEikKeyLockEnabled ); |
1159 } |
1159 } |
1160 |
1160 |
1161 if ( !AknLayoutUtils::PenEnabled() || iHardwareSupport == EKeyguardDefaultHardware) |
1161 if ( !AknLayoutUtils::PenEnabled() || iHardwareSupport == EKeyguardDefaultHardware) |
1206 { |
1206 { |
1207 Window().SetBackgroundColor( ~0 ); |
1207 Window().SetBackgroundColor( ~0 ); |
1208 } |
1208 } |
1209 } |
1209 } |
1210 |
1210 |
1211 // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. |
1211 // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. |
1212 // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 |
1212 // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 |
1213 if ( AknLayoutUtils::PenEnabled() ) |
1213 if ( AknLayoutUtils::PenEnabled() ) |
1214 { |
1214 { |
1215 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1215 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1216 #define KPhoneAppUid TUid::Uid(0x100058B3) |
1216 #define KPhoneAppUid TUid::Uid(0x100058B3) |
1217 |
1217 |
1218 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1218 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1219 if (apaTask.Exists()) |
1219 if (apaTask.Exists()) |
1220 { |
1220 { |
1221 #if defined(_DEBUG) |
1221 #if defined(_DEBUG) |
1222 RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock() Bring phone to background")); |
1222 RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock() Bring phone to background")); |
1223 #endif |
1223 #endif |
1224 // Bring phone to background |
1224 // Bring phone to background |
1225 apaTask.SendToBackground(); |
1225 apaTask.SendToBackground(); |
1226 } |
1226 } |
1227 } |
1227 } |
1228 |
1228 |
1229 // Start capturing system keys. |
1229 // Start capturing system keys. |
1230 CaptureSystemKeys(); |
1230 CaptureSystemKeys(); |
1231 |
1231 |
1232 // Capture all pointer events. |
1232 // Capture all pointer events. |
1264 |
1264 |
1265 // --------------------------------------------------------------------------- |
1265 // --------------------------------------------------------------------------- |
1266 // Disable key lock. |
1266 // Disable key lock. |
1267 // --------------------------------------------------------------------------- |
1267 // --------------------------------------------------------------------------- |
1268 // |
1268 // |
1269 void CAknKeyLockControl::DisableKeylock() |
1269 void CAknKeyLockControl::DisableKeylock(TBool aNotifySysApp) |
1270 { |
1270 { |
1271 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::DisableKeylock")); ) |
1271 TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::DisableKeylock")); ) |
1272 |
1272 |
1273 // Keep locking status in sync. |
1273 // Keep locking status in sync. |
1274 iKeylockScreenSaverObserver->SetLockStatus( EFalse, iAutolockEnabled ); |
1274 iKeylockScreenSaverObserver->SetLockStatus( EFalse, iAutolockEnabled ); |
1299 |
1299 |
1300 // Update keyguard status to P&S system. |
1300 // Update keyguard status to P&S system. |
1301 iStatusProperty.Set( EKeyguardNotActive ); |
1301 iStatusProperty.Set( EKeyguardNotActive ); |
1302 iKeyLockEnabled = EFalse; |
1302 iKeyLockEnabled = EFalse; |
1303 |
1303 |
1304 if ( !iAutolockEnabled ) // only when Autolock was user-activated |
1304 if ( !iAutolockEnabled ) // only when Autolock was user-activated |
1305 { |
1305 { |
1306 // in case Telephone-app was topmost and sent to background, then the user is confused because he expects to see it again. |
1306 // in case Telephone-app was topmost and sent to background, then the user is confused because he expects to see it again. |
1307 // therefore it's required to show it, by sending to foreground. |
1307 // therefore it's required to show it, by sending to foreground. |
1308 if ( AknLayoutUtils::PenEnabled() ) |
1308 if ( AknLayoutUtils::PenEnabled() ) |
1309 { |
1309 { |
1310 TInt callState; |
1310 TInt callState; |
1311 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
1311 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
1312 #if defined(_DEBUG) |
1312 #if defined(_DEBUG) |
1313 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
1313 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
1314 RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone ); |
1314 RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone ); |
1315 #endif |
1315 #endif |
1316 if (callState != EPSCTsyCallStateNone ) |
1316 if (callState != EPSCTsyCallStateNone ) |
1317 { |
1317 { |
1318 |
1318 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1319 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1319 #define KPhoneAppUid TUid::Uid(0x100058B3) |
1320 #define KPhoneAppUid TUid::Uid(0x100058B3) |
1320 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1321 |
1321 if (apaTask.Exists()) |
1322 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1322 { |
1323 if (apaTask.Exists()) |
1323 RDebug::Printf( "%s %s (%u) foreground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
1324 { |
1324 #if defined(_DEBUG) |
1325 RDebug::Printf( "%s %s (%u) foreground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
1325 RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Send phone to foreground")); |
1326 #if defined(_DEBUG) |
1326 #endif |
1327 RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Send phone to foreground")); |
1327 // Bring phone to foreground |
1328 #endif |
1328 apaTask.BringToForeground(); |
1329 // Bring phone to foreground |
1329 } |
1330 apaTask.BringToForeground(); |
1330 } |
1331 } |
1331 } // PenEnabled() |
1332 } |
1332 |
1333 } // PenEnabled() |
1333 if (aNotifySysApp) |
1334 |
1334 { |
1335 SendMessageToSysAp( EEikKeyLockDisabled ); |
1335 SendMessageToSysAp( EEikKeyLockDisabled ); |
|
1336 } |
1336 } |
1337 } |
1337 if ( iNotif ) |
1338 if ( iNotif ) |
1338 { |
1339 { |
1339 iNotif->NotifyStatusChange( EKeyLockDisabled ); |
1340 iNotif->NotifyStatusChange( EKeyLockDisabled ); |
1340 } |
1341 } |
2391 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn ) |
2392 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn ) |
2392 { |
2393 { |
2393 // We'll have to disable keylock if we are changing autolock status. |
2394 // We'll have to disable keylock if we are changing autolock status. |
2394 if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled ) |
2395 if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled ) |
2395 { |
2396 { |
2396 iKeyLockControl->DisableKeylock(); |
2397 iKeyLockControl->DisableKeylock(EFalse); |
2397 } |
2398 } |
2398 |
2399 |
2399 if ( !IsKeyLockEnabled() ) |
2400 if ( !IsKeyLockEnabled() ) |
2400 { |
2401 { |
2401 iKeyLockControl->AutolockEnabled( aAutoLockOn ); |
2402 iKeyLockControl->AutolockEnabled( aAutoLockOn ); |
2402 iKeyLockControl->EnableKeylock(); |
2403 iKeyLockControl->EnableKeylock(ETrue, EFalse); |
2403 } |
2404 } |
2404 } |
2405 } |
2405 |
2406 |
2406 |
2407 |
2407 // --------------------------------------------------------------------------- |
2408 // --------------------------------------------------------------------------- |