--- a/securitydialogs/Autolock/src/AutolockApp.cpp Fri Apr 16 15:53:24 2010 +0300
+++ b/securitydialogs/Autolock/src/AutolockApp.cpp Mon May 03 13:20:16 2010 +0300
@@ -20,7 +20,10 @@
#include "AutolockApp.h"
#include "AutolockDocument.h"
#include <eikstart.h>
-
+#include <apgcli.h>
+#include <apgtask.h>
+#include <coemain.h>
+#include <apacmdln.h>
// ================= MEMBER FUNCTIONS =======================
@@ -41,6 +44,7 @@
//
CApaDocument* CAutolockApp::CreateDocumentL()
{
+ RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
return CAutolockDocument::NewL( *this );
}
@@ -49,11 +53,45 @@
LOCAL_C CApaApplication* NewApplication()
{
+ RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
+
+ TInt use_old_autolock=1;
+ if(use_old_autolock)
+ {
+ // start autolocksrv instead of autolock . This is a backup solution to use in case that not all SysAp and Avkon changes are implemented
+ RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 );
+ CCoeEnv *env = CCoeEnv::Static();
+ TApaTaskList taskList( env->WsSession() );
+ RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
+ const TUid KAutolockSrvAppUid = { 0xE0022E73 };
+ TApaTask task( taskList.FindApp( KAutolockSrvAppUid ) );
+ RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
+ if ( !task.Exists() )
+ {
+ RDebug::Printf( "%s %s (%u) no KAutolockSrvAppUid found. Creating=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
+ RApaLsSession ls;
+ User::LeaveIfError(ls.Connect());
+ CleanupClosePushL(ls);
+
+ CApaCommandLine* commandLine = CApaCommandLine::NewLC();
+ commandLine->SetExecutableNameL( _L("autolocksrv.exe" ) );
+ commandLine->SetCommandL( EApaCommandRun );
+
+ // Try to launch the application.
+ User::LeaveIfError(ls.StartApp(*commandLine));
+ RDebug::Printf( "%s %s (%u) autolocksrv.exe created=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x7 );
+
+ CleanupStack::PopAndDestroy(2); // commandLine, ls
+ }
+ }
+ RDebug::Printf( "%s %s (%u) exiting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0x1 );
return new CAutolockApp;
}
GLDEF_C TInt E32Main()
{
+ RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 );
+
return EikStart::RunApplication(NewApplication);
}