coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp
branchRCL_3
changeset 1 0fdb7f6b0309
parent 0 2e3d3ce01487
child 2 7645e9ce10dc
equal deleted inserted replaced
0:2e3d3ce01487 1:0fdb7f6b0309
    18 
    18 
    19 #include <e32property.h>
    19 #include <e32property.h>
    20 #include <eikon.hrh>
    20 #include <eikon.hrh>
    21 #include <coemain.h>
    21 #include <coemain.h>
    22 #include <aknkeylock.h>
    22 #include <aknkeylock.h>
    23 #include <AknTaskList.h>
    23 #include <akntasklist.h>
    24 #include <apgtask.h>
    24 #include <apgtask.h>
    25 #include <apgcli.h>
    25 #include <apgcli.h>
    26 #include <apgwgnam.h>
    26 #include <apgwgnam.h>
    27 #include <apacmdln.h>
    27 #include <apacmdln.h>
    28 #include <AiwPoCParameters.h>
    28 #include <aiwpocparameters.h>
    29 #include <AiwServiceHandler.h>
    29 #include <aiwservicehandler.h>
    30 #include <featmgr.h>
    30 #include <featmgr.h>
    31 #include <coreapplicationuisdomainpskeys.h>
    31 #include <coreapplicationuisdomainpskeys.h>
    32 #include <PSVariables.h>
    32 #include <psvariables.h>
    33 #include <startupdomainpskeys.h>
    33 #include <startupdomainpskeys.h>
    34 #include <hwrmdomainpskeys.h>
    34 #include <hwrmdomainpskeys.h>
    35 #include <u32hal.h>
    35 #include <u32hal.h>
    36 #include <SysAp.rsg>
    36 #include <sysap.rsg>
       
    37 #include <centralrepository.h> //for CRepository
       
    38 #include <settingsinternalcrkeys.h>
       
    39 #include <keylockpolicyapi.h>
    37 #include "sysapdefaultkeyhandler.h"
    40 #include "sysapdefaultkeyhandler.h"
    38 #include "sysapcallback.h"
    41 #include "sysapcallback.h"
    39 #include "SysAp.hrh"
    42 #include "SysAp.hrh"
    40 #include "AknSgcc.h"
    43 #include "aknsgcc.h"
    41 
    44 
    42 
    45 
    43 const TInt KModifierMask( 0 );
    46 const TInt KModifierMask( 0 );
    44 
    47 
    45 // ======== MEMBER FUNCTIONS ========
    48 // ======== MEMBER FUNCTIONS ========
    88     FeatureManager::UnInitializeLib();
    91     FeatureManager::UnInitializeLib();
    89     
    92     
    90     TKeyLockBuf lockBuf;
    93     TKeyLockBuf lockBuf;
    91     iCallback.ExecQueryL( MSysapCallback::EGetKeylock, lockBuf );  
    94     iCallback.ExecQueryL( MSysapCallback::EGetKeylock, lockBuf );  
    92     iKeylock = lockBuf();
    95     iKeylock = lockBuf();
       
    96     
       
    97     iKeypadWasLocked = iKeylock->IsKeyLockEnabled();
    93     
    98     
    94     __ASSERT_DEBUG( iKeylock, User::Panic( _L("CSysApDefaultKeyHandler::ConstructL: iKeylock not initialized"), KErrBadHandle ) );
    99     __ASSERT_DEBUG( iKeylock, User::Panic( _L("CSysApDefaultKeyHandler::ConstructL: iKeylock not initialized"), KErrBadHandle ) );
    95     
   100     
    96     if ( iCoverDisplaySupported ) // if flip status is monitored, set the initial flip status now
   101     if ( iCoverDisplaySupported ) // if flip status is monitored, set the initial flip status now
    97         {
   102         {
   117                     // set display state only if the current flip position is known
   122                     // set display state only if the current flip position is known
   118                     break;
   123                     break;
   119                 }
   124                 }
   120             }
   125             }
   121         }
   126         }
       
   127     
       
   128     //Load keylock slide handling CR 
       
   129     TRAP_IGNORE( iSlideRepository = CRepository::NewL( KCRUidSlideSettings ) );
       
   130     iKeylockPolicy = CKeyLockPolicyApi::NewL( EPolicyActivateKeyguard );
   122     }
   131     }
   123 
   132 
   124 // ---------------------------------------------------------------------------
   133 // ---------------------------------------------------------------------------
   125 // CSysApDefaultKeyHandler::NewL
   134 // CSysApDefaultKeyHandler::NewL
   126 // ---------------------------------------------------------------------------
   135 // ---------------------------------------------------------------------------
   152     groupWin.CancelCaptureKey( iCapturedEKeyTwistOpen );
   161     groupWin.CancelCaptureKey( iCapturedEKeyTwistOpen );
   153     groupWin.CancelCaptureKey( iCapturedEKeyTwistClose );
   162     groupWin.CancelCaptureKey( iCapturedEKeyTwistClose );
   154     groupWin.CancelCaptureKey( iCapturedEKeyGripOpen );
   163     groupWin.CancelCaptureKey( iCapturedEKeyGripOpen );
   155     groupWin.CancelCaptureKey( iCapturedEKeyGripClose );
   164     groupWin.CancelCaptureKey( iCapturedEKeyGripClose );
   156     groupWin.CancelCaptureKey( iCapturedEKeyPoC );
   165     groupWin.CancelCaptureKey( iCapturedEKeyPoC );
   157     
   166     delete iSlideRepository;
       
   167     delete iKeylockPolicy;
   158     }
   168     }
   159     
   169     
   160 
   170 
   161 // ----------------------------------------------------------------------------
   171 // ----------------------------------------------------------------------------
   162 // CSysApDefaultKeyHandler::HandleKeyEventL()
   172 // CSysApDefaultKeyHandler::HandleKeyEventL()
   178         switch ( aKeyEvent.iCode )
   188         switch ( aKeyEvent.iCode )
   179             {
   189             {
   180             case EKeyGripOpen:
   190             case EKeyGripOpen:
   181                 TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripOpen") ) );
   191                 TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripOpen") ) );
   182                 RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripOpen );
   192                 RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripOpen );
       
   193                 iKeypadWasLocked = iKeylock->IsKeyLockEnabled();
       
   194                 iKeylockPolicy->DisableKeyguardFeature();
   183                 if (!IsDeviceLocked())
   195                 if (!IsDeviceLocked())
   184                     {
   196                     {
   185                     iCallback.ExecCommandL( MSysapCallback::EResetKeyguardState );
   197                     iCallback.ExecCommandL( MSysapCallback::EResetKeyguardState );
   186                     iKeylock->DisableKeyLock();
   198                     iKeylock->DisableKeyLock();
   187                     iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
   199                     iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
   191                 break;
   203                 break;
   192             
   204             
   193             case EKeyGripClose:
   205             case EKeyGripClose:
   194                 TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripClosed") ) );
   206                 TRACES( RDebug::Print(_L("CSysApDefaultKeyHandler::HandleKeyEventL: EKeyGripClosed") ) );
   195                 RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripClosed );
   207                 RProperty::Set( KPSUidHWRM, KHWRMGripStatus, EPSHWRMGripClosed );
       
   208                 iKeylockPolicy->EnableKeyguardFeature();
   196                 iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
   209                 iCallback.ExecCommandL( MSysapCallback::ECancelPowermenu );
   197                 if ( !IsDeviceLocked() && UiReady() )
   210 				if( !iSlideRepository )
   198                     {
   211 					{ // default behavior is to always ask for keylock
   199                     iKeylock->OfferKeyLock();
   212 					if ( !IsDeviceLocked() && UiReady() )
   200                     }
   213 						{
       
   214 						iKeylock->OfferKeyLock();
       
   215 						}
       
   216 					}
       
   217 				else
       
   218 					{ // keylock action is defined by user setting
       
   219 					TInt keyGuardSetting;
       
   220 					iSlideRepository->Get( KSlideKeyguard, keyGuardSetting );
       
   221 					switch( ( TSlideSettingKeyguard ) keyGuardSetting )
       
   222 						{
       
   223 						case ESlideSettingsKeyguardActivatingOn: 
       
   224 						    iKeylock->EnableKeyLock();
       
   225 						    break;
       
   226 						case ESlideSettingsKeyguardActivatingAskMe: 
       
   227 						    iKeylock->OfferKeyLock();
       
   228 							break;
       
   229 						case ESlideSettingsKeyguardActivatingOff: 
       
   230 						    //do nothing
       
   231 						    break;
       
   232 						case ESlideSettingsKeyguardActivatingAutomatic: 
       
   233 						    if( iKeypadWasLocked )
       
   234 							    {
       
   235 								iKeylock->EnableKeyLock();
       
   236 								}
       
   237 							break;
       
   238 						}
       
   239 					}
   201                 // apply default light control
   240                 // apply default light control
   202                 iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyGripClose) );
   241                 iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyGripClose) );
   203                 break;
   242                 break;
   204             
   243             
   205             case EKeyFlipOpen: // simulated key event
   244             case EKeyFlipOpen: // simulated key event