launcher/inc/launcherengine.h
changeset 0 d6fe6244b863
child 5 685c7418c584
equal deleted inserted replaced
-1:000000000000 0:d6fe6244b863
       
     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 <SendUi.h>
       
    28 #include <aknprogressdialog.h>
       
    29 #include <maknfileselectionobserver.h>
       
    30 
       
    31 class CLauncherAppUi;
       
    32 class CLauncherContainerApps;
       
    33 class CLauncherContainerOutput;
       
    34 
       
    35 class CLauncherXMLParser;
       
    36 class CLauncherDLLParser;
       
    37 
       
    38 class CAppThreadChecker;
       
    39 class CAppRunningChecker;
       
    40 
       
    41 class CAknGlobalNote;
       
    42 
       
    43 
       
    44 class CLauncherEngine : public CActive, public MLauncherParserObserver, public MProgressDialogCallback
       
    45 	{
       
    46 public:
       
    47 	static CLauncherEngine* NewL(CLauncherAppUi* aAppUi);
       
    48 	~CLauncherEngine();
       
    49 
       
    50 public:
       
    51     void SetContainerApps(CLauncherContainerApps* aContainerApps);
       
    52     void SetContainerOutput(CLauncherContainerOutput* aContainerOutput);
       
    53 
       
    54     CDesCArray* ListOfAllAppsL();
       
    55     void StartAppLaunchingL(const CArrayFix<TInt>* aSelectedApps, TBool aAutoClose);
       
    56     void CheckWhyThreadDiedL();
       
    57     void CheckIfAppIsRunningL();
       
    58     TInt DeleteLogFile();
       
    59     TInt DeleteBCLogFile();
       
    60     TBool LogFileExists();
       
    61     TBool BCLogFileExists();
       
    62     void AnalyseDLLsL();
       
    63     void StopLaunchingL();
       
    64     void SendLogViaSendUiL(CSendUi* aSendUi);
       
    65     void SendListOfSystemDllsViaSendUiL(CSendUi* aSendUi);
       
    66     TBool SelectRequiredDLLsFileL();
       
    67         
       
    68     // From MLauncherParserObserver
       
    69     void ElementParsedL(const CLauncherDLLElement& aDllElement);
       
    70     void DocumentParsedL(TInt aErrorCode);
       
    71     void ParsingProgressedL(TInt aBytes);
       
    72     
       
    73     // From MProgressDialogCallback
       
    74     void DialogDismissedL( TInt aButtonId );    
       
    75     
       
    76 private:
       
    77 	CLauncherEngine();
       
    78 	void ConstructL(CLauncherAppUi* aAppUi);
       
    79 
       
    80 	void RunL();
       
    81 	void DoCancel();
       
    82 
       
    83 	void IssueLaunch();
       
    84 	void LaunchApplicationL();
       
    85 	void DoLaunchApplicationL();
       
    86 		
       
    87     void CheckForMoreAppsL();
       
    88     void WriteInitialStuffToTheLogL(const TDesC& aOwnData, RFile& aFile);
       
    89     TInt FindFilesRecursiveL(const TDesC& aFileName, const TDesC& aPath);
       
    90     TInt FindFiles(const TDesC& aFileName, const TDesC& aPath);
       
    91     TInt ReadLineFromFileL(RFile& aFile, TDes& aReadBuf);
       
    92     void ChangeFocusToOutputView();
       
    93     
       
    94     /**
       
    95      * Performs binary compatibility analysis based on reference data given
       
    96      * in XML-file.
       
    97      */
       
    98     void DoBCAnalysisL();
       
    99     
       
   100     /**
       
   101      * Compares given DLL list to system DLLs
       
   102      */
       
   103     void DoCompareDLLListsL();
       
   104     
       
   105     /**
       
   106      * IsCurrentThreadOpen
       
   107      */
       
   108     TBool IsCurrentThreadOpen() const;
       
   109         
       
   110     CDesCArray* DependencyCheckForE32ImageL();
       
   111     
       
   112 private:
       
   113 	RTimer          iTimer;
       
   114 	CEikonEnv*      iEnv;
       
   115 	RApaLsSession   iLs;
       
   116     RWsSession      iWs;
       
   117     HBufC8*         iLogWriteBuf;    
       
   118     RFile           iLogFile;
       
   119     RFile           iBCLogFile;  
       
   120     TFileName       iLogFilePath;
       
   121     TFileName       iBCLogFilePath;
       
   122     TFileName       iSystemDllsFilePath;
       
   123     TFileName       iRequiredDllsFilePath;        
       
   124     
       
   125     CDesCArray*     iAppsArray;
       
   126     CDesCArray*     iAllAppsArray;
       
   127     CDesCArray*     iSystemDllArray;
       
   128     CDesCArray*     iRequiredDllArray;
       
   129 
       
   130     TBool           iLaunchingIsActive;
       
   131     TBool           iDLLAnalysisIsActive;
       
   132     TBool           iSkipHiddenAndEmbedOnly;
       
   133     TBool           iAutoClose;
       
   134     TInt            iAppLaunchCounter;
       
   135     TInt            iFailedCases;
       
   136     TInt            iOkCases;
       
   137     TInt            iSkippedCases;
       
   138     TInt            iTotalNumberOfCases;
       
   139 
       
   140     TUid            iCurrentAppUid;
       
   141     TThreadId       iCurrentAppThreadId;
       
   142     TBuf<128>       iCurrentAppNameAndExt;
       
   143     RThread         iCurrentAppThread;
       
   144 
       
   145     CAppThreadChecker*          iAppThreadChecker;
       
   146     CAppRunningChecker*         iAppRunningChecker;
       
   147 
       
   148     CLauncherAppUi*             iAppUi;
       
   149     CLauncherContainerApps*     iContainerApps;
       
   150     CLauncherContainerOutput*   iContainerOutput;
       
   151     
       
   152     CLauncherXMLParser*     iXMLParser;
       
   153     CLauncherDLLParser*     iDLLParser;
       
   154     CLauncherDLLElement*    iDLLElement;
       
   155     
       
   156     CEikProgressInfo*       iProgressInfo;
       
   157     CAknProgressDialog*     iWaitDialog;
       
   158     TInt                    iWaitDialogId;    
       
   159     TInt                iFoundBCIssues;
       
   160     HBufC*              iBCIssuesBigBuffer;
       
   161 
       
   162 public:
       
   163     inline TBool LaunchingIsActive()                   { return iLaunchingIsActive; };
       
   164     inline TBool SkipHiddenAndEmbedOnly()              { return iSkipHiddenAndEmbedOnly; };
       
   165     inline void SetSkipHiddenAndEmbedOnly(TBool aSkip) { iSkipHiddenAndEmbedOnly = aSkip; };
       
   166     inline CAppThreadChecker*  AppThreadChecker()      { return iAppThreadChecker; };
       
   167     inline CAppRunningChecker* AppRunningChecker()     { return iAppRunningChecker; };
       
   168 	};
       
   169 
       
   170 
       
   171 class CAppRunningChecker : public CActive
       
   172 	{
       
   173 public:
       
   174 	static CAppRunningChecker* NewL(CLauncherEngine* aLauncherEngine);
       
   175 	~CAppRunningChecker();
       
   176 
       
   177 	void StartTesting();
       
   178 
       
   179 private:
       
   180 	CAppRunningChecker();
       
   181 	void ConstructL(CLauncherEngine* aLauncherEngine);
       
   182 
       
   183 	void RunL();
       
   184 	void DoCancel();
       
   185 
       
   186 private:
       
   187 	RTimer iTimer;
       
   188 	CEikonEnv* iEnv;
       
   189     CLauncherEngine* iLauncherEngine;
       
   190 	};
       
   191 
       
   192 
       
   193 class CAppThreadChecker : public CActive
       
   194 	{
       
   195 public:
       
   196 	static CAppThreadChecker* NewL(CLauncherEngine* aLauncherEngine);
       
   197 	~CAppThreadChecker();
       
   198 
       
   199 	void ActivateChecking();
       
   200 
       
   201 private:
       
   202 	CAppThreadChecker();
       
   203 	void ConstructL(CLauncherEngine* aLauncherEngine);
       
   204 
       
   205 	void RunL();
       
   206 	void DoCancel();
       
   207 
       
   208 private:
       
   209 	CEikonEnv* iEnv;
       
   210     CLauncherEngine* iLauncherEngine;
       
   211 	};
       
   212 
       
   213 #endif // __LAUNCHER_ENGINE_H__