52 // sysap uid and message enums defined in eikon.hrh |
52 // sysap uid and message enums defined in eikon.hrh |
53 // for sending messages to sysap |
53 // for sending messages to sysap |
54 #include <eikon.hrh> |
54 #include <eikon.hrh> |
55 #include <apgwgnam.h> |
55 #include <apgwgnam.h> |
56 #include <aknlayoutscalable_avkon.cdl.h> |
56 #include <aknlayoutscalable_avkon.cdl.h> |
|
57 |
|
58 #include <AknCapServerDefs.h> |
|
59 #include <apgtask.h> |
57 |
60 |
58 // LOCAL CONSTANTS AND MACROS |
61 // LOCAL CONSTANTS AND MACROS |
59 #define KSysApUid TUid::Uid(0x100058F3) |
62 #define KSysApUid TUid::Uid(0x100058F3) |
60 #define KPhoneAppUid TUid::Uid(0x100058B3) |
63 #define KPhoneAppUid TUid::Uid(0x100058B3) |
61 |
64 |
672 // |
675 // |
673 TKeyResponse CAutolockAppUi::HandleKeyEventL( |
676 TKeyResponse CAutolockAppUi::HandleKeyEventL( |
674 const TKeyEvent& aKeyEvent,TEventCode aType) |
677 const TKeyEvent& aKeyEvent,TEventCode aType) |
675 { |
678 { |
676 |
679 |
677 if ( aKeyEvent.iCode == EKeyBell || (aType == EEventKeyUp && aKeyEvent.iScanCode == EStdKeyDeviceF) ) |
680 if ( aKeyEvent.iCode == EKeyBell || (aType == EEventKeyUp && aKeyEvent.iScanCode == EStdKeyDeviceF) || (aKeyEvent.iCode == EKeyDeviceF) ) |
678 { |
681 { |
679 if(iLocked) |
682 if(iLocked) |
680 HandleCommandL(ESecUiCmdUnlock); |
683 HandleCommandL(ESecUiCmdUnlock); |
681 return EKeyWasConsumed; |
684 return EKeyWasConsumed; |
682 } |
685 } |
1052 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockSideKeyL()")); |
1055 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockSideKeyL()")); |
1053 #endif |
1056 #endif |
1054 if (!iSideKey1) |
1057 if (!iSideKey1) |
1055 { |
1058 { |
1056 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1059 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1057 iSideKey1 = groupWin.CaptureKey(EKeySide,0,0); |
1060 iSideKey1 = groupWin.CaptureKey(EKeyDeviceF,0,0); // EKeySide -> EKeyDeviceF |
1058 iSideKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDevice6, 0, 0); |
1061 #if defined(_DEBUG) |
|
1062 RDebug::Printf( "%s %s (%u) capturing EStdKeyDeviceF=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyDeviceF ); |
|
1063 #endif |
|
1064 iSideKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDeviceF, 0, 0); // EStdKeyDevice6 -> EStdKeyDeviceF |
1059 } |
1065 } |
1060 } |
1066 } |
1061 |
1067 |
1062 // ------------------------------------------------------------------------------------------------------------- |
1068 // ------------------------------------------------------------------------------------------------------------- |
1063 // part of emergency call handling when telephony+devicelock is active |
1069 // part of emergency call handling when telephony+devicelock is active |
1352 } |
1358 } |
1353 break; |
1359 break; |
1354 case EEventKeyUp: // on touch devices, this happens only for the switch-key, which should turn on the lights. |
1360 case EEventKeyUp: // on touch devices, this happens only for the switch-key, which should turn on the lights. |
1355 case EEventKey: |
1361 case EEventKey: |
1356 case EEventKeyDown: |
1362 case EEventKeyDown: |
1357 if(iLocked) |
1363 if(iLocked) |
1358 SendMessageToSysAp( EEikSecurityQueryLights ); |
1364 { // need to capture the switch-key for the case activeCall because Autolock stays on top, even over Akn |
1359 break; |
1365 TKeyEvent *key = aEvent.Key(); |
|
1366 #if defined(_DEBUG) |
|
1367 RDebug::Printf( "%s %s (%u) key->iCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iCode ); |
|
1368 RDebug::Printf( "%s %s (%u) key->iScanCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iScanCode ); |
|
1369 #endif |
|
1370 if ( (key->iScanCode == EStdKeyDeviceF) || (key->iCode == EKeyDeviceF) ) |
|
1371 { |
|
1372 #if defined(_DEBUG) |
|
1373 RDebug::Printf( "%s %s (%u) good key=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
1374 #endif |
|
1375 RWsSession& ws = iEikonEnv->WsSession(); |
|
1376 TApaTaskList tasklist( ws ); |
|
1377 TApaTask capserver = tasklist.FindApp( KAknCapServerUid ); |
|
1378 if( capserver.Exists() ) |
|
1379 { |
|
1380 #if defined(_DEBUG) |
|
1381 RDebug::Printf( "%s %s (%u) found KAknCapServerUid=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KAknCapServerUid ); |
|
1382 #endif |
|
1383 capserver.SendKey( *key ); |
|
1384 } |
|
1385 SendMessageToSysAp( EEikSecurityQueryLights ); |
|
1386 } |
|
1387 } |
|
1388 break; |
1360 default: |
1389 default: |
1361 iGotEventDownDuringCall=0; // any other event invalidates the Press inside the BigRedButton |
1390 iGotEventDownDuringCall=0; // any other event invalidates the Press inside the BigRedButton |
1362 break; |
1391 break; |
1363 } |
1392 } |
1364 |
1393 |