201025_02
authorhgs
Mon, 28 Jun 2010 11:25:21 +0300
changeset 31 b12d1c188e6e
parent 30 cc1cea6aabaf
child 32 b3e22c78f79e
201025_02
cpsecplugins/devicelockplugin/devicelockplugin.pro
cpsecplugins/devicelockplugin/rom/devicelockplugin.iby
cpsecplugins/devicelockplugin/rom/devicelockplugin_resources.iby
cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri
securitydialogs/lockclient/group/lockclient.pro
securitydialogs/lockclient/src/lockaccessextension.cpp
--- a/cpsecplugins/devicelockplugin/devicelockplugin.pro	Thu Jun 24 12:46:20 2010 +0300
+++ b/cpsecplugins/devicelockplugin/devicelockplugin.pro	Mon Jun 28 11:25:21 2010 +0300
@@ -31,7 +31,7 @@
 		 -lcentralrepository \
 		 -lRLockSettings \
 		 -lflogger
-// TRANSLATIONS += devicelocking.ts
+TRANSLATIONS += devicelocking.ts
 include ( ../cpplugincommon.pri )
 include ( devicelockplugin.pri )
 include ( rom/devicelockplugin_rom.pri )
--- a/cpsecplugins/devicelockplugin/rom/devicelockplugin.iby	Thu Jun 24 12:46:20 2010 +0300
+++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin.iby	Mon Jun 28 11:25:21 2010 +0300
@@ -18,11 +18,7 @@
 #ifndef __DEVICELOCKPLUGIN_IBY__
 #define __DEVICELOCKPLUGIN_IBY__
 
-#include <bldvariant.hrh>
-#include <data_caging_paths_for_iby.hrh>
-
 file=ABI_DIR\BUILD_DIR\devicelockplugin.dll    SHARED_LIB_DIR\devicelockplugin.dll
-
 data=\epoc32\data\c\resource\qt\plugins\controlpanel\devicelockplugin.qtplugin resource\qt\plugins\controlpanel\devicelockplugin.qtplugin
 
 #endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin_resources.iby	Mon Jun 28 11:25:21 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2009 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: 
+*
+*/
+
+#ifndef __DEVICELOCKPLUGIN_RESOURCES_IBY__
+#define __DEVICELOCKPLUGIN_RESOURCES_IBY__
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+// devicelockplugin is old.
+// data=DATAZ_\QT_TRANSLATIONS_DIR\devicelockplugin.qm QT_TRANSLATIONS_DIR\devicelockplugin.qm 
+data=DATAZ_\QT_TRANSLATIONS_DIR\devicelocking.qm QT_TRANSLATIONS_DIR\devicelocking.qm 
+
+#endif	// __DEVICELOCKPLUGIN_RESOURCES_IBY__
--- a/cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri	Thu Jun 24 12:46:20 2010 +0300
+++ b/cpsecplugins/devicelockplugin/rom/devicelockplugin_rom.pri	Mon Jun 28 11:25:21 2010 +0300
@@ -17,5 +17,6 @@
 symbian {
 	BLD_INF_RULES.prj_exports += \
 		"$${LITERAL_HASH}include<platform_paths.hrh>" \
-		"rom/devicelockplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin.iby)"
+		"rom/devicelockplugin.iby CORE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin.iby)" \
+		"rom/devicelockplugin_resources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(devicelockplugin_resources.iby)"
 }
\ No newline at end of file
--- a/securitydialogs/lockclient/group/lockclient.pro	Thu Jun 24 12:46:20 2010 +0300
+++ b/securitydialogs/lockclient/group/lockclient.pro	Mon Jun 28 11:25:21 2010 +0300
@@ -40,6 +40,8 @@
 
 LIBS += -lxqservice
 LIBS += -lxqserviceutil
+LIBS += -lapparc
+LIBS += -lapgrfx
 
 symbian*: { 
 	TARGET.EPOCALLOWDLLDATA = 1
--- a/securitydialogs/lockclient/src/lockaccessextension.cpp	Thu Jun 24 12:46:20 2010 +0300
+++ b/securitydialogs/lockclient/src/lockaccessextension.cpp	Mon Jun 28 11:25:21 2010 +0300
@@ -20,6 +20,9 @@
 #include <e32property.h> // P&S API
 #include <apgtask.h> // TApaTask, TApaTaskList
 #include <coemain.h> // CCoeEnv
+#include "../../Autolock/PubSub/securityuisprivatepskeys.h"
+#include <apgcli.h>
+#include <apacmdln.h>
 
 #include <xqservicerequest.h>
 #include <xqserviceutil.h>
@@ -75,8 +78,67 @@
 TInt RLockAccessExtension::EnsureConnected( )
 	{
 	TInt ret(KErrNone);
+
+	// Now we use QtHighway, but nevertheless need to be sure that only 1 process is running
+	// This is done because Autolock.exe should start at the beginning, but it might not be ready yet.
+	// As Qthighway will start it, it's better to give time for the first one to prepare itself.
+	TInt err = KErrNone;
+	TInt numAttempts = 0;
+	TInt numberOfInstances = 0;
+	do
+		{
+		numberOfInstances=0;
+		TFullName processName;
+		TFindThread find(_L("*utolock*"));	// first letter can can be uppercase or lowercase
+		while( find.Next( processName ) == KErrNone )
+		    {
+				// Autolock[100059b5]0002::Autolock		in device
+				// autolock.exe[100059b5]0002::Main		in emulator
+				RDEBUG("found process", 1);
+        numberOfInstances++;
+		    }	// end while
+		RDEBUG("numberOfInstances", numberOfInstances);
+		if(numberOfInstances<=0)
+			{
+			RDEBUG("Autolock.exe not running already. Starting.", 0 );
+	    RApaLsSession ls;
+	    User::LeaveIfError(ls.Connect());
+	    CleanupClosePushL(ls);
+	    RDEBUG("commandLine", 0); 
+	    CApaCommandLine* commandLine = CApaCommandLine::NewLC();
+	    commandLine->SetExecutableNameL(_L("autolock.exe"));
+	    commandLine->SetCommandL(EApaCommandRun);
+	    // Try to launch the application.
+	    RDEBUG("StartApp", 0); 
+	    TInt err = ls.StartApp(*commandLine); // this migh fail
+    	CleanupStack::PopAndDestroy(2); // commandLine, ls
+
+			RDEBUG("Autolock.exe launched. Waiting a bit. err", err );
+			User::After(1000*1000);
+			RDEBUG("re-verifying Autolock.exe process.", 1 );
+			}
+		} while (numAttempts++ <3 && numberOfInstances<=0);
+		
+
+
+	TInt value = -1;
+	err = KErrNone;
+	numAttempts = 0;
+	while( value<1 && numAttempts++ <10 )	// wait max 5 seconds
+		{
+		// process was started, but still not fully running. Give a bit more time
+		err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsLockInitiatorUID, value);
+		RDEBUG("err", err);
+		RDEBUG("value", value);
+		if(value<1)
+			{
+			RDEBUG("Autolock.exe has started but it's not fully running", value);
+			User::After(5*100*1000);	// half a second
+			}
+		}
+	RDEBUG("numAttempts", numAttempts);
 	/*
-	this is the old method. Now we use QtHighway
+	this is the old method. 
 	// we need CCoeEnv because of window group list
 	const TInt KTimesToConnectServer( 2);
 	const TInt KTimeoutBeforeRetrying( 50000);
@@ -108,7 +170,8 @@
 // ---------------------------------------------------------------------------
 TInt RLockAccessExtension::SendMessage( TInt aMessage )
 	{
-	TInt ret = EnsureConnected( );
+	RDEBUG("0", 0);
+	TInt ret = KErrNone;
 	if ( ret == KErrNone )
 		{
 		// ret = SendReceive( aMessage );
@@ -122,7 +185,8 @@
 // ---------------------------------------------------------------------------
 TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1 )
 	{
-	TInt ret = EnsureConnected( );
+	RDEBUG("0", 0);
+	TInt ret = KErrNone;
 	if ( ret == KErrNone )
 		{
 		// assign parameters to IPC argument
@@ -138,6 +202,7 @@
 // ---------------------------------------------------------------------------
 TInt RLockAccessExtension::SendMessage( TInt aMessage, TInt aParam1, TInt aParam2 )
 	{
+	RDEBUG("0", 0);
 	TInt ret = EnsureConnected( );
 	RDEBUG("ret", ret);
 	if ( ret == KErrNone )