|
1 /* |
|
2 * Copyright (c) 2010 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 LAUNCHERENGINE_H |
|
19 #define LAUNCHERENGINE_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include <apgcli.h> |
|
23 #include <w32std.h> |
|
24 #include <e32std.h> |
|
25 |
|
26 #include "launcherparserobserver.h" |
|
27 |
|
28 // CONSTANTS |
|
29 // None |
|
30 |
|
31 // MACROS |
|
32 // None |
|
33 |
|
34 // DATA TYPES |
|
35 // None |
|
36 |
|
37 // FUNCTION PROTOTYPES |
|
38 // None |
|
39 |
|
40 // FORWARD DECLARATIONS |
|
41 class CEikonEnv; |
|
42 class CAppThreadChecker; |
|
43 class CAppRunningChecker; |
|
44 class CLauncherXMLParser; |
|
45 class CLauncherDLLParser; |
|
46 |
|
47 |
|
48 // INFERFACE FOR COMMUNICATION WITH UI |
|
49 |
|
50 class MLauncherUI |
|
51 { |
|
52 public: |
|
53 /** |
|
54 * Method for writing text to output window. |
|
55 * @param aText A text to be written. |
|
56 * @return None. |
|
57 */ |
|
58 virtual void PrintText(const TDesC& aText) = 0; |
|
59 |
|
60 /** |
|
61 * Shows info message with text |
|
62 * @param aText An text to be shown in message. |
|
63 * @return None. |
|
64 */ |
|
65 virtual void ShowInfoMessage(const TDesC& aText) = 0; |
|
66 |
|
67 /** |
|
68 * Shows error message with error text |
|
69 * @param aText An error text to be shown in message. |
|
70 * @return None. |
|
71 */ |
|
72 virtual void ShowErrorMessage(const TDesC& aText) = 0; |
|
73 |
|
74 /** |
|
75 * Shows progress bar with text |
|
76 * @param aText A text to be shown at top of the progress bar. |
|
77 * @param aMinimum A minimum progress bar value. |
|
78 * @param aMaximum A maximum progress bar value. |
|
79 * @return None. |
|
80 */ |
|
81 virtual void ShowProgressBar(const TDesC& aText, TInt aMinimum, TInt aMaximum ) = 0; |
|
82 |
|
83 /** |
|
84 * Sets progress bar value |
|
85 * @param aValue A value between min and max value of the progress bar range |
|
86 * @return None. |
|
87 */ |
|
88 virtual void SetProgressBarValue(TInt aValue) = 0; |
|
89 |
|
90 /** |
|
91 * Hides progress bar |
|
92 * @return None. |
|
93 */ |
|
94 virtual void HideProgressBar() = 0; |
|
95 |
|
96 /** |
|
97 * Shows wait dialog with text |
|
98 * @param aText A text to be shown at top of the wait bar. |
|
99 * @return None. |
|
100 */ |
|
101 virtual void ShowWaitDialog(const TDesC& aText) = 0; |
|
102 |
|
103 /** |
|
104 * Hides wait dialog |
|
105 * @return None. |
|
106 */ |
|
107 virtual void HideWaitDialog() = 0; |
|
108 |
|
109 /** |
|
110 * Changes focus to output view |
|
111 * @return None. |
|
112 */ |
|
113 virtual void ChangeFocusToOutputView() = 0; |
|
114 |
|
115 }; |
|
116 |
|
117 // CLASS DECLARATION |
|
118 |
|
119 class CLauncherEngine: public CActive, public MLauncherParserObserver |
|
120 { |
|
121 |
|
122 public: |
|
123 static CLauncherEngine* NewL(MLauncherUI *aLauncherUI); |
|
124 ~CLauncherEngine(); |
|
125 CDesCArray* ListOfAllAppsL(); |
|
126 void StartAppLaunchingL(const CArrayFix<TInt>* aSelectedApps, TBool aAutoClose); |
|
127 void CheckIfAppIsRunningL(); |
|
128 void CheckWhyThreadDiedL(); |
|
129 void StopLaunchingL(); |
|
130 TBool LogFileExists(); |
|
131 TBool BCLogFileExists(); |
|
132 |
|
133 TInt DeleteLogFile(); |
|
134 TInt DeleteBCLogFile(); |
|
135 |
|
136 void AnalyseDLLsL( const TDesC& aFileName ); |
|
137 |
|
138 void ElementParsedL(const CLauncherDLLElement& aDllElement); |
|
139 void DocumentParsedL(TInt aErrorCode); |
|
140 void ParsingProgressedL(TInt aBytes); |
|
141 TInt ReadLineFromFileL(RFile& aFile, TDes& aReadBuf); |
|
142 |
|
143 const TDesC& RequiredDllsFilePath() const { return iRequiredDllsFilePath; }; |
|
144 |
|
145 void CancelBCAnalysis(); |
|
146 |
|
147 private: |
|
148 CLauncherEngine(); |
|
149 void ConstructL(MLauncherUI *aLauncherUI); |
|
150 |
|
151 void RunL(); |
|
152 void DoCancel(); |
|
153 |
|
154 TInt FindFiles(const TDesC& aFileName, const TDesC& aPath); |
|
155 void IssueLaunch(); |
|
156 void WriteInitialStuffToTheLogL(const TDesC& aOwnData, RFile& aFile); |
|
157 void CheckForMoreAppsL(); |
|
158 void LaunchApplicationL(); |
|
159 void DoLaunchApplicationL(); |
|
160 CDesCArray* DependencyCheckForE32ImageL(); |
|
161 |
|
162 /** |
|
163 * Performs binary compatibility analysis based on reference data given |
|
164 * in XML-file. |
|
165 */ |
|
166 void DoBCAnalysisL(); |
|
167 |
|
168 /** |
|
169 * Compares given DLL list to system DLLs |
|
170 */ |
|
171 void DoCompareDLLListsL(); |
|
172 |
|
173 private: |
|
174 |
|
175 MLauncherUI *iLauncherUI; |
|
176 |
|
177 RTimer iTimer; |
|
178 CEikonEnv* iEnv; |
|
179 RApaLsSession iLs; |
|
180 RWsSession iWs; |
|
181 HBufC8* iLogWriteBuf; |
|
182 RFile iLogFile; |
|
183 RFile iBCLogFile; |
|
184 TFileName iLogFilePath; |
|
185 TFileName iBCLogFilePath; |
|
186 TFileName iSystemDllsFilePath; |
|
187 TFileName iRequiredDllsFilePath; |
|
188 |
|
189 CDesCArray* iAppsArray; |
|
190 CDesCArray* iAllAppsArray; |
|
191 CDesCArray* iSystemDllArray; |
|
192 // CDesCArray* iRequiredDllArray; |
|
193 |
|
194 TBool iLaunchingIsActive; |
|
195 TBool iDLLAnalysisIsActive; |
|
196 TBool iSkipHiddenAndEmbedOnly; |
|
197 TBool iAutoClose; |
|
198 TInt iAppLaunchCounter; |
|
199 TInt iFailedCases; |
|
200 TInt iOkCases; |
|
201 TInt iSkippedCases; |
|
202 TInt iTotalNumberOfCases; |
|
203 |
|
204 TUid iCurrentAppUid; |
|
205 TThreadId iCurrentAppThreadId; |
|
206 TBuf<128> iCurrentAppNameAndExt; |
|
207 RThread iCurrentAppThread; |
|
208 // |
|
209 CAppThreadChecker* iAppThreadChecker; |
|
210 CAppRunningChecker* iAppRunningChecker; |
|
211 |
|
212 CLauncherXMLParser* iXMLParser; |
|
213 CLauncherDLLParser* iDLLParser; |
|
214 CLauncherDLLElement* iDLLElement; |
|
215 |
|
216 TInt iFoundBCIssues; |
|
217 HBufC* iBCIssuesBigBuffer; |
|
218 |
|
219 |
|
220 public: |
|
221 inline TBool SkipHiddenAndEmbedOnly() { return iSkipHiddenAndEmbedOnly; }; |
|
222 inline void SetSkipHiddenAndEmbedOnly(TBool aSkip) { iSkipHiddenAndEmbedOnly = aSkip; }; |
|
223 inline const TDesC& LogFilePath() { return iLogFilePath; } |
|
224 inline const TDesC& BCLogFilePath() { return iBCLogFilePath; } |
|
225 inline const TDesC& SystemDllsFilePath() { return iSystemDllsFilePath; } |
|
226 }; |
|
227 |
|
228 |
|
229 |
|
230 class CAppRunningChecker : public CActive |
|
231 { |
|
232 public: |
|
233 static CAppRunningChecker* NewL(CLauncherEngine* aLauncherEngine); |
|
234 ~CAppRunningChecker(); |
|
235 |
|
236 void StartTesting(); |
|
237 |
|
238 private: |
|
239 CAppRunningChecker(); |
|
240 void ConstructL(CLauncherEngine* aLauncherEngine); |
|
241 |
|
242 void RunL(); |
|
243 void DoCancel(); |
|
244 |
|
245 private: |
|
246 RTimer iTimer; |
|
247 CEikonEnv* iEnv; |
|
248 CLauncherEngine* iLauncherEngine; |
|
249 }; |
|
250 |
|
251 class CAppThreadChecker : public CActive |
|
252 { |
|
253 public: |
|
254 static CAppThreadChecker* NewL(CLauncherEngine* aLauncherEngine); |
|
255 ~CAppThreadChecker(); |
|
256 |
|
257 void ActivateChecking(); |
|
258 void CheckIfAppIsRunningL(); |
|
259 |
|
260 private: |
|
261 CAppThreadChecker(); |
|
262 void ConstructL(CLauncherEngine* aLauncherEngine); |
|
263 |
|
264 void RunL(); |
|
265 void DoCancel(); |
|
266 |
|
267 private: |
|
268 CEikonEnv* iEnv; |
|
269 CLauncherEngine* iLauncherEngine; |
|
270 }; |
|
271 |
|
272 |
|
273 #endif //LAUNCHERENGINE_H |