launcher/inc/launcherengine.h
branchRCL_3
changeset 21 b3cee849fa46
parent 20 48060abbbeaf
child 22 fad26422216a
equal deleted inserted replaced
20:48060abbbeaf 21:b3cee849fa46
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef __LAUNCHER_ENGINE_H__
       
    19 #define __LAUNCHER_ENGINE_H__
       
    20 
       
    21 #include "launcher.hrh"
       
    22 #include "launcherparserobserver.h"
       
    23 
       
    24 #include <aknappui.h>
       
    25 #include <e32base.h>
       
    26 #include <apgcli.h>
       
    27 #include "../symbian_version.hrh"
       
    28 #if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
    29 #include <sendui.h>
       
    30 #endif 
       
    31 #include <AknProgressDialog.h>
       
    32 #include <MAknFileSelectionObserver.h>
       
    33 
       
    34 class CLauncherAppUi;
       
    35 class CLauncherContainerApps;
       
    36 class CLauncherContainerOutput;
       
    37 
       
    38 class CLauncherXMLParser;
       
    39 class CLauncherDLLParser;
       
    40 
       
    41 class CAppThreadChecker;
       
    42 class CAppRunningChecker;
       
    43 
       
    44 class CAknGlobalNote;
       
    45 
       
    46 
       
    47 class CLauncherEngine : public CActive, public MLauncherParserObserver, public MProgressDialogCallback
       
    48 	{
       
    49 public:
       
    50 	static CLauncherEngine* NewL(CLauncherAppUi* aAppUi);
       
    51 	~CLauncherEngine();
       
    52 
       
    53 public:
       
    54     void SetContainerApps(CLauncherContainerApps* aContainerApps);
       
    55     void SetContainerOutput(CLauncherContainerOutput* aContainerOutput);
       
    56 
       
    57     CDesCArray* ListOfAllAppsL();
       
    58     void StartAppLaunchingL(const CArrayFix<TInt>* aSelectedApps, TBool aAutoClose);
       
    59     void CheckWhyThreadDiedL();
       
    60     void CheckIfAppIsRunningL();
       
    61     TInt DeleteLogFile();
       
    62     TInt DeleteBCLogFile();
       
    63     TBool LogFileExists();
       
    64     TBool BCLogFileExists();
       
    65     void AnalyseDLLsL();
       
    66     void StopLaunchingL();
       
    67 	#if ( SYMBIAN_VERSION_SUPPORT < SYMBIAN_4 )
       
    68     void SendLogViaSendUiL(CSendUi* aSendUi);
       
    69     void SendListOfSystemDllsViaSendUiL(CSendUi* aSendUi);
       
    70 	#endif 
       
    71     TBool SelectRequiredDLLsFileL();
       
    72         
       
    73     // From MLauncherParserObserver
       
    74     void ElementParsedL(const CLauncherDLLElement& aDllElement);
       
    75     void DocumentParsedL(TInt aErrorCode);
       
    76     void ParsingProgressedL(TInt aBytes);
       
    77     
       
    78     // From MProgressDialogCallback
       
    79     void DialogDismissedL( TInt aButtonId );    
       
    80     
       
    81 private:
       
    82 	CLauncherEngine();
       
    83 	void ConstructL(CLauncherAppUi* aAppUi);
       
    84 
       
    85 	void RunL();
       
    86 	void DoCancel();
       
    87 
       
    88 	void IssueLaunch();
       
    89 	void LaunchApplicationL();
       
    90 	void DoLaunchApplicationL();
       
    91 		
       
    92     void CheckForMoreAppsL();
       
    93     void WriteInitialStuffToTheLogL(const TDesC& aOwnData, RFile& aFile);
       
    94     TInt FindFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath);
       
    95     TInt FindFiles(const TDesC& aFileName, const TDesC& aPath);
       
    96     TInt ReadLineFromFileL(RFile& aFile, TDes& aReadBuf);
       
    97     void ChangeFocusToOutputView();
       
    98     
       
    99     /**
       
   100      * Performs binary compatibility analysis based on reference data given
       
   101      * in XML-file.
       
   102      */
       
   103     void DoBCAnalysisL();
       
   104     
       
   105     /**
       
   106      * Compares given DLL list to system DLLs
       
   107      */
       
   108     void DoCompareDLLListsL();
       
   109     
       
   110     /**
       
   111      * IsCurrentThreadOpen
       
   112      */
       
   113     TBool IsCurrentThreadOpen() const;
       
   114         
       
   115     CDesCArray* DependencyCheckForE32ImageL();
       
   116     
       
   117 private:
       
   118 	RTimer          iTimer;
       
   119 	CEikonEnv*      iEnv;
       
   120 	RApaLsSession   iLs;
       
   121     RWsSession      iWs;
       
   122     HBufC8*         iLogWriteBuf;    
       
   123     RFile           iLogFile;
       
   124     RFile           iBCLogFile;  
       
   125     TFileName       iLogFilePath;
       
   126     TFileName       iBCLogFilePath;
       
   127     TFileName       iSystemDllsFilePath;
       
   128     TFileName       iRequiredDllsFilePath;        
       
   129     
       
   130     CDesCArray*     iAppsArray;
       
   131     CDesCArray*     iAllAppsArray;
       
   132     CDesCArray*     iSystemDllArray;
       
   133     CDesCArray*     iRequiredDllArray;
       
   134 
       
   135     TBool           iLaunchingIsActive;
       
   136     TBool           iDLLAnalysisIsActive;
       
   137     TBool           iSkipHiddenAndEmbedOnly;
       
   138     TBool           iAutoClose;
       
   139     TInt            iAppLaunchCounter;
       
   140     TInt            iFailedCases;
       
   141     TInt            iOkCases;
       
   142     TInt            iSkippedCases;
       
   143     TInt            iTotalNumberOfCases;
       
   144 
       
   145     TUid            iCurrentAppUid;
       
   146     TThreadId       iCurrentAppThreadId;
       
   147     TBuf<128>       iCurrentAppNameAndExt;
       
   148     RThread         iCurrentAppThread;
       
   149 
       
   150     CAppThreadChecker*          iAppThreadChecker;
       
   151     CAppRunningChecker*         iAppRunningChecker;
       
   152 
       
   153     CLauncherAppUi*             iAppUi;
       
   154     CLauncherContainerApps*     iContainerApps;
       
   155     CLauncherContainerOutput*   iContainerOutput;
       
   156     
       
   157     CLauncherXMLParser*     iXMLParser;
       
   158     CLauncherDLLParser*     iDLLParser;
       
   159     CLauncherDLLElement*    iDLLElement;
       
   160     
       
   161     CEikProgressInfo*       iProgressInfo;
       
   162     CAknProgressDialog*     iWaitDialog;
       
   163     TInt                    iWaitDialogId;    
       
   164     TInt                iFoundBCIssues;
       
   165     HBufC*              iBCIssuesBigBuffer;
       
   166 
       
   167 public:
       
   168     inline TBool LaunchingIsActive()                   { return iLaunchingIsActive; };
       
   169     inline TBool SkipHiddenAndEmbedOnly()              { return iSkipHiddenAndEmbedOnly; };
       
   170     inline void SetSkipHiddenAndEmbedOnly(TBool aSkip) { iSkipHiddenAndEmbedOnly = aSkip; };
       
   171     inline CAppThreadChecker*  AppThreadChecker()      { return iAppThreadChecker; };
       
   172     inline CAppRunningChecker* AppRunningChecker()     { return iAppRunningChecker; };
       
   173 	};
       
   174 
       
   175 
       
   176 class CAppRunningChecker : public CActive
       
   177 	{
       
   178 public:
       
   179 	static CAppRunningChecker* NewL(CLauncherEngine* aLauncherEngine);
       
   180 	~CAppRunningChecker();
       
   181 
       
   182 	void StartTesting();
       
   183 
       
   184 private:
       
   185 	CAppRunningChecker();
       
   186 	void ConstructL(CLauncherEngine* aLauncherEngine);
       
   187 
       
   188 	void RunL();
       
   189 	void DoCancel();
       
   190 
       
   191 private:
       
   192 	RTimer iTimer;
       
   193 	CEikonEnv* iEnv;
       
   194     CLauncherEngine* iLauncherEngine;
       
   195 	};
       
   196 
       
   197 
       
   198 class CAppThreadChecker : public CActive
       
   199 	{
       
   200 public:
       
   201 	static CAppThreadChecker* NewL(CLauncherEngine* aLauncherEngine);
       
   202 	~CAppThreadChecker();
       
   203 
       
   204 	void ActivateChecking();
       
   205 
       
   206 private:
       
   207 	CAppThreadChecker();
       
   208 	void ConstructL(CLauncherEngine* aLauncherEngine);
       
   209 
       
   210 	void RunL();
       
   211 	void DoCancel();
       
   212 
       
   213 private:
       
   214 	CEikonEnv* iEnv;
       
   215     CLauncherEngine* iLauncherEngine;
       
   216 	};
       
   217 
       
   218 #endif // __LAUNCHER_ENGINE_H__