# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277127519 -10800 # Node ID 2ca12c9f635bdacf650468220121be9e17044c1e # Parent fabe5ded361acb1650782395b8a9510f2923da02 Revision: 201023 Kit: 2010125 diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/inc/AutoKeyguardObserver.h --- a/securitydialogs/Autolock/inc/AutoKeyguardObserver.h Wed Jun 09 10:38:11 2010 +0300 +++ b/securitydialogs/Autolock/inc/AutoKeyguardObserver.h Mon Jun 21 16:38:39 2010 +0300 @@ -25,6 +25,7 @@ class CUserActivityManager; class CAutoKeyguardCenRepI; +class MAutolockAppUiInterface; class CAutoKeyguardObserver : public CBase { @@ -34,7 +35,7 @@ * * @return Returns the instance just created. */ - static CAutoKeyguardObserver* NewL(); + static CAutoKeyguardObserver* NewL( MAutolockAppUiInterface* aAppUiI ); /** * Symbian OS constructor. */ @@ -56,7 +57,7 @@ /** * C++ default constructor. */ - CAutoKeyguardObserver(); + CAutoKeyguardObserver( MAutolockAppUiInterface* aAppUiI ); private: /** * Return current autokeyguard period @@ -97,6 +98,7 @@ private: //data CUserActivityManager* iActivityManager; CAutoKeyguardCenRepI* iCenRepI; + MAutolockAppUiInterface* iAppUiI; }; #endif // END OF FILE diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/inc/AutolockAppUiInterface.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/securitydialogs/Autolock/inc/AutolockAppUiInterface.h Mon Jun 21 16:38:39 2010 +0300 @@ -0,0 +1,29 @@ +/* +* Copyright (c) 2010 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" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Interface to App Ui from helper classes +* +*/ +#ifndef AUTOLOCKAPPUIINTERFACE_H +#define AUTOLOCKAPPUIINTERFACE_H + +class MAutolockAppUiInterface + { + public: + virtual TInt DeviceLockQueryStatus() = 0; + virtual TInt DeviceLockStatus() = 0; + virtual void CancelDeviceLockQuery() = 0; + }; + +#endif // AUTOLOCKAPPUIINTERFACE_H diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/inc/AutolockAppUiPS.h --- a/securitydialogs/Autolock/inc/AutolockAppUiPS.h Wed Jun 09 10:38:11 2010 +0300 +++ b/securitydialogs/Autolock/inc/AutolockAppUiPS.h Mon Jun 21 16:38:39 2010 +0300 @@ -35,6 +35,7 @@ #include "AutolockGripStatusObserver.h" #include "AutolockFpsStatusObserver.h" +#include "AutolockAppUiInterface.h" // FORWARD DECLARATIONS class CAutolockContainer; @@ -95,7 +96,7 @@ * */ class CAutolockAppUi : public CAknViewAppUi, public MAknEcsObserver, - public MAutolockGripStatusObserver, + public MAutolockAppUiInterface, public MAutolockFpsStatusObserver { public: // // Constructors and destructor @@ -111,12 +112,14 @@ ~CAutolockAppUi(); /** - * From MAutolockGripStatusObserver + * From MAutolockAppUiInterface */ TBool DeviceLockQueryStatus(); TBool DeviceLockStatus(); + void CancelDeviceLockQuery(); + /** * From MAutolockFpsStatusObserver */ diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/inc/AutolockGripStatusObserver.h --- a/securitydialogs/Autolock/inc/AutolockGripStatusObserver.h Wed Jun 09 10:38:11 2010 +0300 +++ b/securitydialogs/Autolock/inc/AutolockGripStatusObserver.h Mon Jun 21 16:38:39 2010 +0300 @@ -24,36 +24,24 @@ #include #include -//CONSTANTS -const TInt KCancelKeyCode( 165 ); - -class MAutolockGripStatusObserver - { - public: - /** - * Implement this method to be notified when grip status - * changes. - */ - IMPORT_C virtual TInt DeviceLockQueryStatus() = 0; - IMPORT_C virtual TInt DeviceLockStatus() = 0; - }; +class MAutolockAppUiInterface; class CAutolockGripStatusObserver : public CActive { public: - IMPORT_C static CAutolockGripStatusObserver* NewL( MAutolockGripStatusObserver* aObserver, RWsSession& aSession ); + IMPORT_C static CAutolockGripStatusObserver* NewL( MAutolockAppUiInterface* aObserver, RWsSession& aSession ); void RunL(); void DoCancel(); ~CAutolockGripStatusObserver(); private: - void ConstructL( MAutolockGripStatusObserver* aObserver ); + void ConstructL( MAutolockAppUiInterface* aObserver ); CAutolockGripStatusObserver( RWsSession& aSession ); void GripStatusChangedL( TInt aGripStatus ); private: - MAutolockGripStatusObserver* iObserver; + MAutolockAppUiInterface* iObserver; RProperty iGripStatus; RWsSession& iSession; }; diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/src/AutoKeyguardObserver.cpp --- a/securitydialogs/Autolock/src/AutoKeyguardObserver.cpp Wed Jun 09 10:38:11 2010 +0300 +++ b/securitydialogs/Autolock/src/AutoKeyguardObserver.cpp Mon Jun 21 16:38:39 2010 +0300 @@ -34,6 +34,7 @@ #include "AutoKeyguardCenRepI.h" #include "AutoKeyguardObserver.h" #include "AutolockPrivateCRKeys.h" +#include "AutolockAppUiInterface.h" const TInt AutoKeyguardOff(60000); // Screensaver "On" status value @@ -50,13 +51,13 @@ // ---------------------------------------------------------- // -CAutoKeyguardObserver* CAutoKeyguardObserver::NewL() +CAutoKeyguardObserver* CAutoKeyguardObserver::NewL( MAutolockAppUiInterface* aAppUiI ) { #ifdef RD_AUTO_KEYGUARD #if defined(_DEBUG) RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::NewL() BEGIN")); #endif - CAutoKeyguardObserver* self = new (ELeave) CAutoKeyguardObserver(); + CAutoKeyguardObserver* self = new (ELeave) CAutoKeyguardObserver( aAppUiI ); CleanupStack::PushL(self); self->ConstructL(self); CleanupStack::Pop(); //self @@ -74,7 +75,8 @@ // C++ default constructor // ---------------------------------------------------------- // -CAutoKeyguardObserver::CAutoKeyguardObserver() +CAutoKeyguardObserver::CAutoKeyguardObserver( MAutolockAppUiInterface* aAppUiI ): + iAppUiI( aAppUiI ) { } @@ -341,6 +343,7 @@ TBool screenSaverOn = EFalse; TBool screenSaverStertedFromIdle = EFalse; TBool startupOver = EFalse; + TBool codeQueryOpen = EFalse; //Get keyguard status RProperty::Get(KPSUidAvkonDomain, KAknKeyguardStatus, value); keylockOn = (value == EKeyguardLocked); @@ -374,8 +377,24 @@ RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() startupOver: %d"), startupOver); RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Startup state: %d"), value); #endif + //See if the lock code query is open + codeQueryOpen = iAppUiI->DeviceLockQueryStatus(); + #if defined(_DEBUG) + RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() codeQueryOpen: %d"), codeQueryOpen); + RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() autolockOn: %d"), autolockOn); + #endif if (startupOver) { + // If lock code query is open and device lock is on, cancel the query. + // AppUi will enable keylock when the query is cancelled + if (autolockOn && codeQueryOpen) + { + #if defined(_DEBUG) + RDebug::Print(_L("(AUTOLOCK)CAutoKeyguardObserver::LockKeysL() Query open, cancel it")); + #endif + iAppUiI->CancelDeviceLockQuery(); + return; + } // If keylock is already ON, there is a ongoing call, // autolock is already ON or phone is not in idle, don't lock. if (keylockOn || (callState > EPSCTsyCallStateNone) || autolockOn || !idle) diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/src/AutolockAppUi.cpp --- a/securitydialogs/Autolock/src/AutolockAppUi.cpp Wed Jun 09 10:38:11 2010 +0300 +++ b/securitydialogs/Autolock/src/AutolockAppUi.cpp Mon Jun 21 16:38:39 2010 +0300 @@ -65,6 +65,8 @@ const TInt KTriesToConnectServer( 2 ); const TInt KTimeBeforeRetryingServerConnection( 50000 ); const TInt PhoneIndex( 0 ); +const TInt KCancelKeyScanCode( EStdKeyDevice1 ); // 165 + // ================= MEMBER FUNCTIONS ======================= // @@ -79,7 +81,7 @@ RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL")); #endif - BaseConstructL( EAknEnableSkin | EAknEnableMSK ); + BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknDisableAnimationBackground ); //Disable priority control so that Autolock process priority isn't set to "background" by //window server when it is not active. @@ -268,7 +270,7 @@ //Autokeyguard Period observer #ifdef RD_AUTO_KEYGUARD - iKeyguardObserver = CAutoKeyguardObserver::NewL(); + iKeyguardObserver = CAutoKeyguardObserver::NewL(this); #else //!RD_AUTO_KEYGUARD iKeyguardObserver = NULL; #endif //RD_AUTO_KEYGUARD @@ -1245,7 +1247,10 @@ void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination ) { const TInt type = aEvent.Type(); - + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); + #endif + switch ( type ) { case KAknFullOrPartialForegroundLost: // partial or full fg lost @@ -1366,6 +1371,9 @@ // Emergency detector only handles key down events if ( iEmergencySupportReady ) iEcsDetector->HandleWsEventL( aEvent, aDestination); + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + #endif } TBool CAutolockAppUi::DeviceLockQueryStatus() @@ -1378,6 +1386,18 @@ return iLocked; } +void CAutolockAppUi::CancelDeviceLockQuery() + { + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); + #endif + TRawEvent rawEvent; + rawEvent.Set( TRawEvent::EKeyDown, KCancelKeyScanCode ); + iCoeEnv->WsSession().SimulateRawEvent( rawEvent ); + rawEvent.Set( TRawEvent::EKeyUp, KCancelKeyScanCode ); + iCoeEnv->WsSession().SimulateRawEvent( rawEvent ); + } + TBool CAutolockAppUi::DeviceFpsLock(TInt iStatus) { if(iStatus) @@ -1388,6 +1408,9 @@ } void CAutolockAppUi::HandleWindowGroupListChange() { + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) iLocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLocked ); + #endif if ( !iLocked ) { // System is not locked, make sure app is not on the foreground. @@ -1471,6 +1494,9 @@ } } + #if defined(_DEBUG) + RDebug::Printf( "%s %s (%u) ret=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ret ); + #endif return ret; } diff -r fabe5ded361a -r 2ca12c9f635b securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp --- a/securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp Wed Jun 09 10:38:11 2010 +0300 +++ b/securitydialogs/Autolock/src/AutolockGripStatusObserver.cpp Mon Jun 21 16:38:39 2010 +0300 @@ -21,10 +21,11 @@ #include #include "AutolockGripStatusObserver.h" #include "AutolockApp.h" +#include "AutolockAppUiInterface.h" #include -EXPORT_C CAutolockGripStatusObserver* CAutolockGripStatusObserver::NewL( MAutolockGripStatusObserver* aObserver, RWsSession& aSession ) +EXPORT_C CAutolockGripStatusObserver* CAutolockGripStatusObserver::NewL( MAutolockAppUiInterface* aObserver, RWsSession& aSession ) { CAutolockGripStatusObserver* self = new (ELeave) CAutolockGripStatusObserver( aSession ); CleanupStack::PushL( self ); @@ -33,7 +34,7 @@ return self; } -void CAutolockGripStatusObserver::ConstructL( MAutolockGripStatusObserver* aObserver ) +void CAutolockGripStatusObserver::ConstructL( MAutolockAppUiInterface* aObserver ) { #if defined(_DEBUG) RDebug::Print(_L("(AUTOLOCK)CAutolockGripStatusObserver::ConstructL") ); @@ -146,9 +147,7 @@ #endif //the device lock query is on top //generate cancel key event - TRawEvent rawEvent; - rawEvent.Set( TRawEvent::EKeyDown, KCancelKeyCode ); - iSession.SimulateRawEvent( rawEvent ); + iObserver->CancelDeviceLockQuery(); } } }