uifw/AknGlobalUI/OldStyleNotif/Src/aknkeylocknotifier.cpp
branchRCL_3
changeset 19 aecbbf00d063
parent 15 c52421ed5f07
child 20 d48ab3b357f1
--- a/uifw/AknGlobalUI/OldStyleNotif/Src/aknkeylocknotifier.cpp	Thu Aug 19 10:11:06 2010 +0300
+++ b/uifw/AknGlobalUI/OldStyleNotif/Src/aknkeylocknotifier.cpp	Tue Aug 31 15:28:30 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2002-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -33,7 +33,7 @@
 #include <aknnotecontrol.h>
 #include <aknlayoutscalable_avkon.cdl.h>
 
-#include <secondarydisplay/AknSecondaryDisplayDefs.h>
+#include <SecondaryDisplay/AknSecondaryDisplayDefs.h>
 #include <avkondomainpskeys.h> // KPSUidAvkonDomain, KAknKeyguardStatus, TAknKeyguardStatus
 #include <startupdomainpskeys.h> // KStartupSecurityCodeQueryStatus
 #include <coreapplicationuisdomainpskeys.h> // KCoreAppUIsAutolockStatus
@@ -42,7 +42,6 @@
 #include <aknglobalpopupprioritycontroller.h>
 #include "GlobalWindowPriorities.h"
 #include <keylockpolicyapi.h>
-#include <ScreensaverInternalPSKeys.h>
 
 #include <PSVariables.h>   // Property values
 #include <coreapplicationuisdomainpskeys.h>
@@ -50,7 +49,7 @@
 #include <ctsydomainpskeys.h>
 #include <bafindf.h>
 #include "AknNotifyPlugin.hrh"
-#include "akntrace.h"
+
 
 
 #ifdef _DEBUG
@@ -89,429 +88,9 @@
 _LIT_SECURITY_POLICY_C1( KWritePolicy, ECapabilityWriteDeviceData );
 
 
-/**
- *  CAknKeylockScreenSaverObserver captures primary keys
- *  from screensaver when screen saver is active.
- *
- *  @lib   aknoldstylenotif.lib
- *  @since 3.2
- */
-NONSHARABLE_CLASS( CAknKeylockScreenSaverObserver ): public CActive
-    {
-public:
-
-    /**
-    * Creates instance of the CAknKeylockScreenSaverObserver class.
-    *
-    * @param aWindowGroup application window group used to capture primary keys
-    * @return Returns the instance just created.
-    */
-    static CAknKeylockScreenSaverObserver* NewL( RWindowGroup& aWindowGroup );
-
-    /**
-    * Destructor.
-    */
-    ~CAknKeylockScreenSaverObserver();
-
-public:
-
-    /**
-    * Starts asynchronic listening KUidCurrentCall event
-    *
-    * @return KErrNone: if no errors
-    * @return KErrInUse: if already listening
-    */
-    TInt Start();
-
-    /**
-    * Stops asynchronic listening KUidAutolockStatus event
-    */
-    void Stop();
-
-public:
-
-    /**
-     *  Method handles the lock state changes.
-     *
-     * @param aStatus The new lock state
-     */
-    void SetLockStatus( TBool aKeylockEnabled, TBool aAutolockEnabled );
-
-private: // constructors
-
-    /**
-    * C++ default constructor.
-    *
-    * @param aAppUi (pointer to autolock appui)
-    */
-    CAknKeylockScreenSaverObserver( RWindowGroup& aWindowGroup );
-
-    /**
-    * Symbian OS constructor.
-    */
-    void ConstructL();
-
-private: // from CActive
-
-    /** @see CActive::RunL() */
-    void RunL();
-
-    /** @see CActive::DoCancel() */
-    void DoCancel();
-
-private:
-
-    /**
-    * Used to capture primary keys defined in keylocking policies
-    */
-    void CapturePrimaryKeys( TBool aCapture );
-
-private: // data
-
-    // screen saver on property
-    RProperty  iScreenSaverActiveProperty;
-
-    // if screensaver is active or not
-    TBool iScreenSaverActive;
-
-    // if primary keys have been captured
-    TBool iCaptured;
-
-    // locking states
-    TBool iKeylockEnabled;
-    TBool iAutolockEnabled;
-
-    // left softkey capture
-    TInt iLeftSoftKey;
-
-    // a reference to application window group
-    RWindowGroup& iWindowGroup;
-
-    // keylockpolicy support (not owned)
-    CKeyLockPolicyApi* iUnlockPolicyApi;
-
-    // keylockpolicy support (not owned)
-    CKeyLockPolicyApi* iDevicelockPolicyApi;
-
-    // primary key captures
-    RArray<TUint> iPrimaryKeyCaptures;
-    };
-
-// ===========================================================================
-// class CAknKeylockScreenSaverObserver
-// ===========================================================================
-
-// ---------------------------------------------------------------------------
-// Constructs a new entry with given values.
-// ---------------------------------------------------------------------------
-//
-CAknKeylockScreenSaverObserver* CAknKeylockScreenSaverObserver::NewL(
-    RWindowGroup& aWindowGroup )
-    {
-    CAknKeylockScreenSaverObserver* self =
-        new (ELeave) CAknKeylockScreenSaverObserver( aWindowGroup );
-    CleanupStack::PushL( self );
-    self->ConstructL();
-    CleanupStack::Pop( self );
-    return self;
-    }
-
-
-// ---------------------------------------------------------------------------
-// Destructor
-// ---------------------------------------------------------------------------
-//
-CAknKeylockScreenSaverObserver::~CAknKeylockScreenSaverObserver()
-    {
-    Cancel();
-
-    // Close the property handle.
-    iScreenSaverActiveProperty.Close();
-
-    // Release key captures.
-    CapturePrimaryKeys( EFalse );
-
-    // Delete policies.
-    delete iUnlockPolicyApi;
-    delete iDevicelockPolicyApi;
-    }
-
-
-// ---------------------------------------------------------------------------
-// Starts listening to the KScreenSaverOn event.
-// ---------------------------------------------------------------------------
-//
-TInt CAknKeylockScreenSaverObserver::Start()
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    if ( IsActive() )
-        {
-        return KErrInUse;
-        }
-    iStatus = KRequestPending;
-    iScreenSaverActiveProperty.Subscribe( iStatus );
-    SetActive();
-    
-    _AKNTRACE_FUNC_EXIT;
-    
-    return KErrNone;
-    }
-
-
-// ---------------------------------------------------------------------------
-// Stops listening to the KScreenSaverOn event.
-// ---------------------------------------------------------------------------
-//
-void CAknKeylockScreenSaverObserver::Stop()
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    if ( !IsActive() )
-        {
-        return;
-        }
-    Cancel();
-    iScreenSaverActiveProperty.Cancel();
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
-
-
-// ---------------------------------------------------------------------------
-// C++ constructor
-// ---------------------------------------------------------------------------
-//
-CAknKeylockScreenSaverObserver::CAknKeylockScreenSaverObserver(
-    RWindowGroup& aWindowGroup )
-    : CActive( 0 ),
-      iScreenSaverActive( EFalse ),
-      iCaptured( EFalse ),
-      iKeylockEnabled( EFalse ),
-      iAutolockEnabled( EFalse ),
-      iLeftSoftKey( NULL ),
-      iWindowGroup( aWindowGroup )
-    {
-    }
 
 
-// ---------------------------------------------------------------------------
-// Second phase constructor.
-// ---------------------------------------------------------------------------
-//
-void CAknKeylockScreenSaverObserver::ConstructL()
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    // Add this active object to the scheduler.
-    CActiveScheduler::Add( this );
-    User::LeaveIfError( iScreenSaverActiveProperty.Attach( KPSUidScreenSaver,
-                                                           KScreenSaverOn ) );
 
-    // We need policies to poll primary keys.
-    iUnlockPolicyApi = CKeyLockPolicyApi::NewL( EPolicyDeactivateKeyguard );
-    if ( !iUnlockPolicyApi->HasConfiguration() )
-        {
-        delete iUnlockPolicyApi;
-        iUnlockPolicyApi = NULL;
-        }
-
-    // we need policies to poll primary keys
-    iDevicelockPolicyApi = CKeyLockPolicyApi::NewL( EPolicyDevicelockQuery );
-    if ( !iDevicelockPolicyApi->HasConfiguration() )
-        {
-        delete iDevicelockPolicyApi;
-        iDevicelockPolicyApi = NULL;
-        }
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
-
-
-// ---------------------------------------------------------------------------
-// From base class CActive.
-// Handles change in the screen saver state.
-// ---------------------------------------------------------------------------
-//
-void CAknKeylockScreenSaverObserver::RunL()
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    if ( iKeylockEnabled || iAutolockEnabled )
-        {
-        // Resubscribe before processing new value to prevent missing updates.
-        Start();
-        }
-
-    TInt screenSaverState;
-    iScreenSaverActiveProperty.Get( screenSaverState );
-    // Primary keys are captured from screensaver when screensaver
-    // is the top most application.
-    if ( screenSaverState > NULL )
-        {
-         __ASSERT_DEBUG( !iCaptured,
-                         Panic( EAknPanicKeyLockObserverAlreadyExists ) );
-        iScreenSaverActive = ETrue;
-        CapturePrimaryKeys( ETrue );
-        }
-    else
-        {
-        // If screensaver is disabled, stop capturing primary key events.
-        if ( iScreenSaverActive )
-            {
-            CapturePrimaryKeys( EFalse );
-            }
-        iScreenSaverActive = EFalse;
-        }
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
-
-
-// ---------------------------------------------------------------------------
-// Set the lock status.
-// ---------------------------------------------------------------------------
-//
-void CAknKeylockScreenSaverObserver::SetLockStatus( TBool aKeylockEnabled,
-                                                    TBool aAutolockEnabled )
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    iKeylockEnabled  = aKeylockEnabled;
-    iAutolockEnabled = aAutolockEnabled;
-
-    if ( iKeylockEnabled || iAutolockEnabled )
-        {
-        // Start observing screensaver activation.
-        Start();
-        }
-    else
-        {
-        if ( iScreenSaverActive )
-            {
-            CapturePrimaryKeys( EFalse );
-            }
-        // Screensaver is only observed when keylock is enabled.
-        Stop();
-        }
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
-
-
-// ---------------------------------------------------------------------------
-// Capture or uncapture primary keys.
-// ---------------------------------------------------------------------------
-//
-void CAknKeylockScreenSaverObserver::CapturePrimaryKeys( TBool aCapture )
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    if ( aCapture )
-        {
-        if ( iScreenSaverActive && !iCaptured )
-            {
-            if ( iKeylockEnabled && !iAutolockEnabled )
-                {
-                iCaptured = ETrue;
-                // If no unlocking policy has been defined,
-                // the default primary key is the left soft key.
-                if ( !iUnlockPolicyApi )
-                    {
-                    // Capture LSK (starts unlock prosess, capturing
-                    // bypasses screensaver)
-                    iLeftSoftKey = iWindowGroup.CaptureKey( EKeyDevice0, 0, 0 );
-                    }
-                else
-                    {
-                    iPrimaryKeyCaptures.Reset();
-                    TUint32 index( 0 );
-                    TUint32 primaryKey( 0 );
-                    TUint32 secondaryKey( 0 );
-                    while ( iUnlockPolicyApi->GetKeyCombination( index,
-                                                                 primaryKey,
-                                                                 secondaryKey ) == KErrNone )
-                        {
-                        if (KErrNone != iPrimaryKeyCaptures.Append(iWindowGroup.CaptureKeyUpAndDowns(primaryKey, 0, 0)))
-                            {
-                            return;
-                            }
-                        index++;
-                        }
-                    }
-                }
-            else
-                {
-                if ( iKeylockEnabled && iAutolockEnabled )
-                    {
-                    iCaptured = ETrue;
-                    // If no devicelock query policy has been defined,
-                    // the default primary key is the left soft key.
-                    if ( !iDevicelockPolicyApi )
-                        {
-                        // Capture LSK (starts unlock prosess,
-                        // capturing bypasses screensaver).
-                        iLeftSoftKey = iWindowGroup.CaptureKey( EKeyDevice0, 0, 0 );
-                        }
-                    else
-                        {
-                        iPrimaryKeyCaptures.Reset();
-                        TUint32 index( 0 );
-                        TUint32 primaryKey( 0 );
-                        TUint32 secondaryKey( 0 );
-                        while ( iDevicelockPolicyApi->GetKeyCombination( index, primaryKey, secondaryKey ) == KErrNone )
-                            {
-                            if (KErrNone != iPrimaryKeyCaptures.Append(iWindowGroup.CaptureKeyUpAndDowns(primaryKey, 0, 0)))
-                                {
-                                return;
-                                }
-                            index++;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-    else
-        {
-        if (iCaptured)
-            {
-            if (iLeftSoftKey > 0)
-                {
-                iWindowGroup.CancelCaptureKey(iLeftSoftKey); 
-                }
-            iLeftSoftKey = 0;
-            
-            if (iPrimaryKeyCaptures.Count() > 0)
-                {
-                for (TInt x = 0; x < iPrimaryKeyCaptures.Count(); x++)
-                    {
-                    iWindowGroup.CancelCaptureKeyUpAndDowns(iPrimaryKeyCaptures[x]);
-                    }
-                iPrimaryKeyCaptures.Reset();
-                }
-            
-            iCaptured = EFalse;
-            }
-        }
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
-
-
-// ---------------------------------------------------------------------------
-// From base class CActive.
-// Cancels event listening.
-// ---------------------------------------------------------------------------
-//
-void CAknKeylockScreenSaverObserver::DoCancel()
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    iScreenSaverActiveProperty.Cancel();
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
 
 
 // ===========================================================================
@@ -538,16 +117,11 @@
 //
 TBool CAknLockedNote::OkToExitL( TInt aCommand )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     iLocked = EFalse;
     if ( iCommandObserver )
         {
         iCommandObserver->ProcessCommandL( aCommand );
         }
-    
-    _AKNTRACE_FUNC_EXIT;
-    
     return ETrue;
     }
 
@@ -569,16 +143,12 @@
 //
 void CAknLockedNote::CancelNote()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( iTimer )
         {
         iTimer->Cancel();
         }
     ExitSleepingDialog();
     iLocked = EFalse;
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -589,14 +159,10 @@
 //
 void CAknLockedNote::FocusChanged( TDrawNow /*aDrawNow*/ )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( !IsFocused() && iCommandObserver )
         {
         TRAP_IGNORE( iCommandObserver->ProcessCommandL( KNoteCmdFocusLost ) )
         }
-  
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -677,14 +243,9 @@
 //
 TInt CAknSleepingNote::ShowNote( const TInt aTimeout, const TTone aTone )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     TRAP_IGNORE(AknGlobalPopupPriorityController::SetPopupPriorityL( *this, KGlobalWindowPriority_KeyLock ));
     iTimeoutInMicroseconds = aTimeout;
     iTone = aTone;
-    
-    _AKNTRACE_FUNC_EXIT;
-    
     return RouseSleepingDialog();
     }
 
@@ -696,15 +257,10 @@
 //
 TBool CAknSleepingNote::OkToExitL( TInt aCommand )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( iCommandObserver )
         {
         iCommandObserver->ProcessCommandL( aCommand );
         }
-
-    _AKNTRACE_FUNC_EXIT;
-
     return ETrue;
     }
 
@@ -716,8 +272,6 @@
 //
 void CAknSleepingNote::HandleResourceChange( TInt aType )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( aType == KAknsMessageSkinChange )
         {
         TInt animationRes( 0 );
@@ -771,8 +325,6 @@
         }
 
     CAknNoteDialog::HandleResourceChange( aType );
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -865,8 +417,6 @@
 //
 void CAknEcsNote::SetEmergencyNumber( const TDesC& aMatchedNumber )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     TRect mainPane;
     AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EPopupParent,
                                        mainPane );
@@ -930,8 +480,6 @@
 
     number.Append( aMatchedNumber );
     TRAP_IGNORE( SetTextL( number ) );
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -941,16 +489,12 @@
 //
 void CAknEcsNote::SleepNote()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( iNoteOnScreen )
         {
         // Causes flicker to other notes if called when note is not on screen.
         ExitSleepingDialog();
         }
     iNoteOnScreen = EFalse;
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -977,11 +521,7 @@
 CAknKeyLockControl::CAknKeyLockControl( CAknKeyLockNotifierSubject* aNotif ) :
     iNotif( aNotif )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     AKNTASHOOK_ADD( this, "CAknKeyLockControl" );
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -991,8 +531,6 @@
 //
 CAknKeyLockControl::~CAknKeyLockControl()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     AKNTASHOOK_REMOVE();
     // We implicitely trust that Eikon env exists
     // (though in practice it does not make the
@@ -1017,9 +555,6 @@
     delete iOfferLockNote;
     delete iEcsNote; // Ecs change
     delete iKeylockApi;
-    delete iKeylockScreenSaverObserver;
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1029,7 +564,7 @@
 //
 void CAknKeyLockControl::ConstructL()
     {
-    _AKNTRACE_FUNC_ENTER;
+    TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::ConstructL ")); )
 
     FeatureManager::InitializeLibL();
     iFeatureKeypadNoSlider =
@@ -1066,7 +601,8 @@
 
     TBool touchEnabled( AknLayoutUtils::PenEnabled() );
 
-    TBool hasSlider = HasSliderKey();
+	TBool hasSlider(iHardwareSupport != EKeyguardDefaultHardware);
+
     iKeyLockCba = CEikButtonGroupContainer::NewL(
                     CEikButtonGroupContainer::ECba,
                     CEikButtonGroupContainer::EHorizontal,
@@ -1183,9 +719,6 @@
         iKeylockApi = NULL;
         }
 
-    iKeylockScreenSaverObserver =
-        CAknKeylockScreenSaverObserver::NewL( groupWin );
-
     // Define P&S key that is used to publish the keyguard status.
     RProperty::Define( KPSUidAvkonDomain,
                        KAknKeyguardStatus,
@@ -1195,8 +728,6 @@
 
     iStatusProperty.Attach( KPSUidAvkonDomain, KAknKeyguardStatus );
     iStatusProperty.Set( EKeyguardNotActive );
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1204,20 +735,17 @@
 // Enable key lock.
 // ---------------------------------------------------------------------------
 //
-void CAknKeyLockControl::EnableKeylock( TBool aShowNote, TBool aNotifySysApp )
+void CAknKeyLockControl::EnableKeylock( TBool aShowNote )
     {
-    _AKNTRACE_FUNC_ENTER;
-    _AKNTRACE("aShowNote:%d",aShowNote);
-    _AKNTRACE("aNotifySysApp:%d",aNotifySysApp);
-    
+    TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock %d"), aShowNote); )
+
     // Policy can be used to disable support for keyguard.
     if ( !iAutolockEnabled && !CKeyLockPolicyApi::KeyguardAllowed() )
         {
         // Keylock Disabled
         return;
         }
-    // Keylock Enabled
-    iKeylockScreenSaverObserver->SetLockStatus( ETrue, iAutolockEnabled );
+
     if ( iOfferLockEnabled )
         {
         iOfferLockNote->CancelNote();
@@ -1228,12 +756,12 @@
                                             EKeyguardLocked );
     iKeyLockEnabled = ETrue;
 
-    if ( !iAutolockEnabled && aNotifySysApp )
+    if ( !iAutolockEnabled )
         {
         SendMessageToSysAp( EEikKeyLockEnabled );
         }
-    TBool hasSliderKey = HasSliderKey();
-    if ( !AknLayoutUtils::PenEnabled() || !hasSliderKey)
+
+    if ( !AknLayoutUtils::PenEnabled() || iHardwareSupport == EKeyguardDefaultHardware)
         {
         iKeyLockCba->MakeVisible( ETrue );
         }
@@ -1265,7 +793,7 @@
         DisplayLockedNote();
         }
 
-    if ( !AknLayoutUtils::PenEnabled() || !hasSliderKey)
+    if ( !AknLayoutUtils::PenEnabled() || iHardwareSupport == EKeyguardDefaultHardware)
         {
         ShowKeylockCba();
         }
@@ -1283,23 +811,23 @@
             }
         }
 
-        // in case Telephone-app is topmost, then the user is confused because he sees but can't use it.
-        // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105
-        if ( AknLayoutUtils::PenEnabled() )
-            {
-            TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession());
-            #define KPhoneAppUid TUid::Uid(0x100058B3)
+		// in case Telephone-app is topmost, then the user is confused because he sees but can't use it.
+		// therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105
+		if ( AknLayoutUtils::PenEnabled() )
+       	{ 		
+	   			TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession());
+	   			#define KPhoneAppUid TUid::Uid(0x100058B3)
 
-            TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid);
-            if (apaTask.Exists())
-                {
-                #if defined(_DEBUG)
-                RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock() Bring phone to background"));
-                #endif
-                // Bring phone to background
-                apaTask.SendToBackground();
-                }
-            }
+     			TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid);
+     			if (apaTask.Exists())
+         	{
+				 		#if defined(_DEBUG)
+				 			RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::EnableKeylock() Bring phone to background"));
+				 		#endif
+         		// Bring phone to background
+         		apaTask.SendToBackground();
+         	}
+				}
 
     // Start capturing system keys.
     CaptureSystemKeys();
@@ -1334,8 +862,6 @@
     // leave, but we trap it in just in case.
     TRAP_IGNORE( static_cast<CAknCapAppServerAppUi*>( iEikonEnv->EikAppUi() )->HandleResourceChangeL(
             KAknInternalFSWClose ); );
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1343,13 +869,10 @@
 // Disable key lock.
 // ---------------------------------------------------------------------------
 //
-void CAknKeyLockControl::DisableKeylock(TBool aNotifySysApp)
+void CAknKeyLockControl::DisableKeylock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    _AKNTRACE("aShowNote:%d",aNotifySysApp);
+    TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::DisableKeylock")); )
 
-    // Keep locking status in sync.
-    iKeylockScreenSaverObserver->SetLockStatus( EFalse, iAutolockEnabled );
     if ( iSoundsMuted )
         {
         CAknAppUiBase* appUi= iAvkonAppUiBase;
@@ -1379,42 +902,40 @@
     iStatusProperty.Set( EKeyguardNotActive );
     iKeyLockEnabled = EFalse;
 
-    if ( !iAutolockEnabled )    // only when Autolock was user-activated
+    if ( !iAutolockEnabled )	// only when Autolock was user-activated
         {
-        // in case Telephone-app was topmost and sent to background, then the user is confused because he expects to see it again.
-        // therefore it's required to show it, by sending to foreground. 
-        if ( AknLayoutUtils::PenEnabled() )
-            {       
-            TInt callState;
-            RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
-            #if defined(_DEBUG)
-            RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState );
-            RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone );
-            #endif
-            if (callState != EPSCTsyCallStateNone )
-                {
-                TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession());
-                #define KPhoneAppUid TUid::Uid(0x100058B3)
-                TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid);
-                if (apaTask.Exists())
-                    {
-                    RDebug::Printf( "%s %s (%u) foreground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 );
-                    #if defined(_DEBUG)
-                    RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Send phone to foreground"));
-                    #endif
-                    // Bring phone to foreground
-                    apaTask.BringToForeground();
-                    }
-                }
-            }   // PenEnabled()
+		    // in case Telephone-app was topmost and sent to background, then the user is confused because he expects to see it again.
+				// therefore it's required to show it, by sending to foreground. 
+				if ( AknLayoutUtils::PenEnabled() )
+		     	{ 		
+    	    TInt callState;
+    	    RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState );
+    	    #if defined(_DEBUG)
+						RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState );
+						RDebug::Printf( "%s %s (%u) EPSCTsyCallStateNone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSCTsyCallStateNone );
+					#endif
+          if (callState != EPSCTsyCallStateNone )
+              {
+                	
+				   			TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession());
+				   			#define KPhoneAppUid TUid::Uid(0x100058B3)
+				
+				   			TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid);
+				   			if (apaTask.Exists())
+				       	{
+									RDebug::Printf( "%s %s (%u) foreground=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 );
+							 		#if defined(_DEBUG)
+							 			RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Send phone to foreground"));
+							 		#endif
+				       		// Bring phone to foreground
+				       		apaTask.BringToForeground();
+				       	}
+		       		}
+					}	// PenEnabled()
+
+        SendMessageToSysAp( EEikKeyLockDisabled );
         }
-
-	if (aNotifySysApp)
-		{
-		SendMessageToSysAp( EEikKeyLockDisabled );
-		}
-
-	if ( iNotif )
+    if ( iNotif )
         {
         iNotif->NotifyStatusChange( EKeyLockDisabled );
         }
@@ -1424,8 +945,6 @@
         iEikonEnv->EikAppUi() )->SuppressAppSwitching( EFalse );
 
     iAutolockEnabled = EFalse;
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1435,8 +954,6 @@
 //
 void CAknKeyLockControl::SendMessageToSysAp( TInt aMessage )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     RWsSession& ws = iEikonEnv->WsSession();
     TInt wgId = 0;
     CApaWindowGroupName::FindByAppUid( KSysApUid, ws, wgId );
@@ -1447,8 +964,6 @@
         event.SetTimeNow();
         ws.SendEventToWindowGroup( wgId, event );
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1458,13 +973,9 @@
 //
 void CAknKeyLockControl::OfferKeylock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     iOfferLockNote->ShowNote( (CAknNoteDialog::TTimeout)KAknOfferKeyLockTimeout,
                               CAknNoteDialog::ENoTone );
     iOfferLockEnabled = ETrue;
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1476,6 +987,8 @@
     {
     if ( !iAutolockEnabled )
         {
+        iKeypadLockedNote->ShowNote( KKeyLockCustomShortTimeout,
+                                     CAknNoteDialog::ENoTone );
         }
     }
 
@@ -1488,6 +1001,8 @@
     {
     if ( !iAutolockEnabled )
         {
+        iKeypadUnlockedNote->ShowNote( KKeyLockCustomShortTimeout,
+                                       CAknNoteDialog::ENoTone );
         }
     }
 
@@ -1498,12 +1013,8 @@
 //
 void CAknKeyLockControl::DoUnlock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     DisableKeylock();
     DisplayKeyActiveNote();
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1514,9 +1025,6 @@
 //
 void CAknKeyLockControl::HandleResourceChange( TInt aType )
     {
-    _AKNTRACE_FUNC_ENTER;
-    _AKNTRACE("aType:%d",aType);
-
     if ( aType == KEikDynamicLayoutVariantSwitch )
         {
         TRect screenRect;
@@ -1539,8 +1047,6 @@
                 }
             }
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1551,8 +1057,7 @@
 //
 void CAknKeyLockControl::ProcessCommandL( TInt aCommandId )
     {
-    _AKNTRACE_FUNC_ENTER;
-    _AKNTRACE("aCommandId:%d",aCommandId);
+    TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::ProcessCommandL %d"), aCommandId); )
 
     switch ( aCommandId )
         {
@@ -1613,8 +1118,6 @@
             break;
             }
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1660,8 +1163,8 @@
 //
 void CAknKeyLockControl::LeftSoftKeyPressed()
     {
-    _AKNTRACE_FUNC_ENTER; 
-    
+    TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::LeftSoftKeyPressed")); )
+
     // Check that the confirmation note exists, as it's not created on
     // startup if touch layout is in use. In emulator this might cause
     // a problem, as layout can be changed to a non-touch one, and
@@ -1684,8 +1187,6 @@
         SendMessageToSysAp( EEikKeyLockLightsOnRequest );
         iUnlockConfirmation = ETrue;
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1697,17 +1198,15 @@
 TKeyResponse CAknKeyLockControl::OfferKeyEventL( const TKeyEvent& aKeyEvent,
                                                  TEventCode aType )
     {
-    _AKNTRACE_FUNC_ENTER; 
-    
     if ( AknLayoutUtils::PenEnabled() )
         {
-        _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: PenEnabled");
+        TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: PenEnabled"));)
         if ( iAutolockEnabled )
             { // The case when touch device is locked and so must be unlocked by hold switch.
-            _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: Autolock Enabled");
+            TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: Autolock Enabled"));)
             if ( aType == EEventKey && aKeyEvent.iCode == EKeyDeviceF )
                 {
-                _AKNTRACE("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: SysAp message");
+                TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: SysAp message"));)
                 SendMessageToSysAp( EEikKeyLockLightsOnRequest );
                 if ( iAutolockEnabled && !iKeylockApi )
                     {
@@ -1723,7 +1222,7 @@
                         autolocktask.SendKey( keyEvent );
                         }
                     }
-                _AKNTRACE_FUNC_EXIT;
+                TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::OfferKeyEventL: return EKeyWasConsumed"));)
                 return EKeyWasConsumed;
                 }
             }
@@ -1928,7 +1427,7 @@
             ShowLockedNote();
             }
         }
-    _AKNTRACE_FUNC_EXIT;
+
     return EKeyWasConsumed;
     }
 
@@ -1939,14 +1438,10 @@
 //
 void CAknKeyLockControl::ShowLockedNote()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( !iLockedNoteDisplayed )
         {
         DoShowLockedNote();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1958,6 +1453,9 @@
     {
     if ( !iAutolockEnabled )
         {
+        iLockedNote->ShowNote( KKeyLockDisplayLockedTimeout,
+                               CAknNoteDialog::ENoTone );
+        iLockedNoteDisplayed = ETrue;
         }
     }
 
@@ -1968,15 +1466,11 @@
 //
 void CAknKeyLockControl::ShowKeylockCba()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     RDrawableWindow* cbaWindow =
         iKeyLockCba->ButtonGroup()->AsControl()->DrawableWindow();
     cbaWindow->SetFaded( EFalse, RWindowTreeNode::EFadeWindowOnly );
     cbaWindow->SetOrdinalPosition( 0, 1 );
     cbaWindow->SetNonFading( ETrue );
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -1986,8 +1480,6 @@
 //
 void CAknKeyLockControl::CaptureSystemKeys()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( !iKeysCaptured )
         {
         RWindowGroup& groupWin = iCoeEnv->RootWin();
@@ -2015,17 +1507,15 @@
 
         if ( AknLayoutUtils::PenEnabled() )
             {
-             _AKNTRACE("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys PenEnabled");
+            TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys PenEnabled"));)
             if ( iAutolockEnabled )
                 { //Capture Hold Switch
-             _AKNTRACE("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys iAutolockEnabled");
+                TRACES( RDebug::Print(_L("(KeyGuard)CAknKeyLockControl::CaptureSystemKeys iAutolockEnabled"));)
                 iHoldSwitch = groupWin.CaptureKey( EKeyDeviceF, 0, 0 );
                 }
             }
         iKeysCaptured = ETrue;
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2035,8 +1525,6 @@
 //
 void CAknKeyLockControl::UnCaptureSystemKeys()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( iKeysCaptured )
         {
         RWindowGroup& groupWin = iCoeEnv->RootWin();
@@ -2057,8 +1545,6 @@
 
         iKeysCaptured = EFalse;
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2070,8 +1556,6 @@
 void CAknKeyLockControl::HandleEcsEvent( CAknEcsDetector* aEcsDetector,
                                          CAknEcsDetector::TState aState )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     switch ( aState )
         {
         case CAknEcsDetector::ECompleteMatchThenSendKey:
@@ -2080,7 +1564,6 @@
             break;
             }
         case CAknEcsDetector::ECompleteMatch:
-        case CAknEcsDetector::EServiceNumMatch:
             {
             iEcsNote->SetEmergencyNumber( aEcsDetector->CurrentMatch() );
             iEcsNote->ShowNote( CAknNoteDialog::ENoTimeout,
@@ -2116,8 +1599,6 @@
             break;
             }
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2127,11 +1608,7 @@
 //
 void CAknKeyLockControl::DoExitOfferKeylock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     iOfferLockNote->CancelNote();
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2141,11 +1618,7 @@
 //
 void CAknKeyLockControl::OfferTimerExpired()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     DoExitOfferKeylock();
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2155,11 +1628,7 @@
 //
 void CAknKeyLockControl::AutolockEnabled( TBool aAutoLockOn )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     iAutolockEnabled = aAutoLockOn;
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2187,15 +1656,11 @@
 //
 void CAknKeyLockControl::CapturePointerEvents()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( AknLayoutUtils::PenEnabled() )
         {
         Window().SetPointerCapture( RWindowBase::TCaptureDragDrop );
         Window().ClaimPointerGrab( ETrue );
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2205,31 +1670,11 @@
 //
 void CAknKeyLockControl::UnCapturePointerEvents()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( AknLayoutUtils::PenEnabled() )
         {
         Window().SetPointerCapture( RWindowBase::TCaptureDisabled );
         Window().ClaimPointerGrab( EFalse );
         }
-    
-    _AKNTRACE_FUNC_EXIT;
-    }
-
-TBool CAknKeyLockControl::HasSliderKey()
-    {
-    _AKNTRACE_FUNC_ENTER;
-    
-    TBool hasSlider(iHardwareSupport != EKeyguardDefaultHardware);
-    if( FeatureManager::FeatureSupported( KFeatureIdFfPowerKeyAsKeyguard ) )
-        {
-        hasSlider = ETrue;  // the only purpose is to display empty sotkeys
-        }
-    
-    _AKNTRACE( "hasSlider:%d",hasSlider);
-    _AKNTRACE_FUNC_EXIT;
-    
-    return hasSlider;
     }
 
 
@@ -2343,8 +1788,6 @@
 //
 TPtrC8 CAknKeyLockNotifierSubject::StartL( const TDesC8& aBuffer )
     {
-    _AKNTRACE_FUNC_ENTER; 
-    
     SAknNotifierPackage<SAknKeyLockNotifierParams>* params =
         ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr();
 
@@ -2355,8 +1798,6 @@
         User::Leave( KErrArgument );
         }
 
-    _AKNTRACE( "params->iParamData.iReason:%d",params->iParamData.iReason);
-        
     switch ( params->iParamData.iReason )
         {
         case ELockEnabled:
@@ -2382,8 +1823,6 @@
             }
         }
 
-    _AKNTRACE_FUNC_EXIT;
-    
     return iRetPckg;
     }
 
@@ -2397,8 +1836,6 @@
                                          TInt /*aReplySlot*/,
                                          const RMessagePtr2& aMessage )
     {
-    _AKNTRACE_FUNC_ENTER; 
-    
     SAknNotifierPackage<SAknKeyLockNotifierParams>* params =
         ( SAknNotifierPackage<SAknKeyLockNotifierParams>*)aBuffer.Ptr();
 
@@ -2409,8 +1846,6 @@
         User::Leave( KErrArgument );
         }
 
-    _AKNTRACE( "params->iParamData.iReason:%d",params->iParamData.iReason);
-    
     switch ( params->iParamData.iReason )
         {
         case ELockEnabled:
@@ -2494,8 +1929,6 @@
             }
         };
 
-    _AKNTRACE_FUNC_EXIT;
-    
     aMessage.Complete( KErrNone );
     }
 
@@ -2550,14 +1983,10 @@
 //
 void CAknKeyLockNotifierSubject::UnlockKeys()
     {
-    _AKNTRACE_FUNC_ENTER; 
-    
     if ( IsKeyLockEnabled() )
         {
         iKeyLockControl->DisableKeylock();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2568,22 +1997,17 @@
 //
 void CAknKeyLockNotifierSubject::LockKeys( TBool aAutoLockOn )
     {
-    _AKNTRACE_FUNC_ENTER; 
-    _AKNTRACE( "aAutoLockOn:%d",aAutoLockOn);
-    
     // We'll have to disable keylock if we are changing autolock status.
     if ( IsKeyLockEnabled() && aAutoLockOn != iKeyLockControl->iAutolockEnabled )
         {
-        iKeyLockControl->DisableKeylock(EFalse);
+        iKeyLockControl->DisableKeylock();
         }
 
     if ( !IsKeyLockEnabled() )
         {
         iKeyLockControl->AutolockEnabled( aAutoLockOn );
-        iKeyLockControl->EnableKeylock(ETrue, EFalse);
+        iKeyLockControl->EnableKeylock();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2594,8 +2018,6 @@
 //
 void CAknKeyLockNotifierSubject::AddObserverL( MAknKeyLockObserver* aObserver )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
 #if defined(_DEBUG)
     TInt count = iObserverList->Count();
     for ( TInt index = 0; index < count; index++ )
@@ -2610,8 +2032,6 @@
 
     // Make sure that the observer isn't obscuring the keylock CBA
     ShowKeylockCba();
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2622,8 +2042,6 @@
 //
 void CAknKeyLockNotifierSubject::RemoveObserver( MAknKeyLockObserver* aObserver )
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     TInt count = iObserverList->Count();
     for ( TInt index = 0; index < count; index++ )
         {
@@ -2636,8 +2054,6 @@
 #if defined(_DEBUG)
     Panic( EAknPanicKeyLockObserverNotFound );
 #endif
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2647,16 +2063,11 @@
 //
 void CAknKeyLockNotifierSubject::NotifyStatusChange( TKeyLockStatus aStatus )
     {
-    _AKNTRACE_FUNC_ENTER;
-    _AKNTRACE( "aStatus:%d",aStatus);
-    
     TInt count = iObserverList->Count();
     for ( TInt index = count - 1; index >= 0; index-- )
         {
         ((*iObserverList)[index])->KeyLockStatusChange( aStatus );
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2666,14 +2077,10 @@
 //
 void CAknKeyLockNotifierSubject::ShowKeylockCba()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( IsKeyLockEnabled() )
         {
         iKeyLockControl->ShowKeylockCba();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2683,14 +2090,10 @@
 //
 void CAknKeyLockNotifierSubject::DoEnableKeyLock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( !IsKeyLockEnabled() )
         {
         iKeyLockControl->EnableKeylock();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2700,8 +2103,6 @@
 //
 void CAknKeyLockNotifierSubject::DoDisableKeyLock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( IsKeyLockEnabled() )
         {
         iKeyLockControl->DisableKeylock();
@@ -2713,8 +2114,6 @@
         // Remove the offer key lock CBA.
         iKeyLockControl->OfferTimerExpired();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }
 
 
@@ -2724,13 +2123,9 @@
 //
 void CAknKeyLockNotifierSubject::DoOfferKeyLock()
     {
-    _AKNTRACE_FUNC_ENTER;
-    
     if ( !IsKeyLockEnabled() )
         {
         NotifyStatusChange( EKeyLockOffered );
         iKeyLockControl->OfferKeylock();
         }
-    
-    _AKNTRACE_FUNC_EXIT;
     }