85
|
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: casrvappscanner.h
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef CASRVAPPSCANNER_H_
|
|
19 |
#define CASRVAPPSCANNER_H_
|
|
20 |
|
|
21 |
#include <e32base.h>
|
|
22 |
#include <apgcli.h>
|
|
23 |
#include <apgnotif.h>
|
|
24 |
#include <driveinfo.h>
|
94
|
25 |
#include <usif/scr/scr.h>
|
85
|
26 |
#include "cainstallnotifier.h"
|
|
27 |
#include "castorage_global.h"
|
|
28 |
|
|
29 |
class CCaSrvMmcHistory;
|
|
30 |
class CCaInnerEntry;
|
|
31 |
class CCaStorageProxy;
|
|
32 |
class CCaSrvEngUtils;
|
102
|
33 |
|
85
|
34 |
|
|
35 |
/**
|
|
36 |
* Application scanner.
|
|
37 |
* Using AppArc application information, keeps menu application
|
|
38 |
* items up-to-date.
|
|
39 |
*
|
|
40 |
* Operation is asynchronous (because AppArc startup is asynchronous):
|
|
41 |
* 1. ConstructL(): invokes iApaLsSession to build app list (async).
|
|
42 |
* 2. RunL(): App list is complete - appscanner update entries with application.
|
|
43 |
* 4. HandleAppListEvent(): change in app list, go back to step 2.
|
|
44 |
*
|
|
45 |
* App scanning does the following:
|
|
46 |
* - Applications present in the system but not appearing in the menu are added
|
|
47 |
* to the appropriate folder.
|
|
48 |
* - Hide hidden applications, show non-hidden applications (flag "hidden").
|
|
49 |
* - Hide / show MMC-related items, according to whether MMC is present or not
|
|
50 |
* (flag "missing"). Keep an MMC history, purge old MMC-based menu items
|
|
51 |
* (== missing menu items whose MMC card has not been seen for long).
|
|
52 |
* - Observing AppArc (and MMC, etc etc) to keep the menu data up
|
|
53 |
* to date continuously.
|
|
54 |
*/
|
|
55 |
|
99
|
56 |
NONSHARABLE_CLASS( CCaSrvAppScanner ) : public CActive
|
85
|
57 |
{
|
|
58 |
|
|
59 |
public:
|
|
60 |
// Constructor
|
|
61 |
|
|
62 |
/**
|
|
63 |
* Destructor.
|
|
64 |
*/
|
|
65 |
virtual ~CCaSrvAppScanner();
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Two-phased constructor.
|
|
69 |
* @param aCaStorageProxy storage.
|
102
|
70 |
* @param aSoftwareRegistry software component registry.
|
85
|
71 |
* @param aUtils storage utils.
|
|
72 |
*/
|
|
73 |
static CCaSrvAppScanner* NewL( CCaStorageProxy& aCaStorageProxy,
|
102
|
74 |
Usif::RSoftwareComponentRegistry& aSoftwareRegistry,
|
85
|
75 |
CCaSrvEngUtils& aUtils );
|
|
76 |
|
|
77 |
private:
|
|
78 |
// Constructors and destructor
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Constructor.
|
|
82 |
* @param aCaStorageProxy storage.
|
102
|
83 |
* @param aSoftwareRegistry software component registry.
|
85
|
84 |
* @param aUtils storage utils.
|
|
85 |
*/
|
|
86 |
CCaSrvAppScanner( CCaStorageProxy& aCaStorageProxy,
|
102
|
87 |
Usif::RSoftwareComponentRegistry& aSoftwareRegistry,
|
85
|
88 |
CCaSrvEngUtils& aUtils );
|
|
89 |
|
|
90 |
/**
|
|
91 |
* Second phased constructor.
|
|
92 |
*/
|
|
93 |
void ConstructL();
|
|
94 |
|
|
95 |
private:
|
|
96 |
// from CActive
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Request completed, schedule engine operation.
|
|
100 |
*/
|
|
101 |
void RunL();
|
|
102 |
|
|
103 |
/**
|
|
104 |
* Cancel request.
|
|
105 |
*/
|
|
106 |
void DoCancel();
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Error handling: ignore error.
|
94
|
110 |
* @param aError Error code.
|
85
|
111 |
*/
|
|
112 |
TInt RunError( TInt aError );
|
|
113 |
|
|
114 |
private:
|
|
115 |
// new methods
|
|
116 |
|
|
117 |
/**
|
94
|
118 |
* Gets collectionId of download collection.
|
|
119 |
* @result id of download collection.
|
85
|
120 |
*/
|
|
121 |
TInt GetCollectionDownloadIdL();
|
93
|
122 |
|
92
|
123 |
/**
|
94
|
124 |
* Gets collectionId of all collection.
|
|
125 |
* @result id of all collection.
|
92
|
126 |
*/
|
|
127 |
TInt GetAllCollectionIdL();
|
85
|
128 |
|
|
129 |
/**
|
94
|
130 |
* Adds application entry to downloaded collection.
|
85
|
131 |
* @param aEntryId application entry id.
|
|
132 |
*/
|
|
133 |
void AddEntryToDownloadedCollectionL( TInt aEntryId );
|
93
|
134 |
|
92
|
135 |
/**
|
94
|
136 |
* Add application entry to predefined collection.
|
92
|
137 |
* @param aEntry application entry.
|
94
|
138 |
* @param aUpdate is entry updated by a client.
|
92
|
139 |
*/
|
127
|
140 |
void AddEntryToPredefinedCollectionL( CCaInnerEntry* aEntry);
|
93
|
141 |
|
92
|
142 |
/**
|
94
|
143 |
* Create predefined collection.
|
92
|
144 |
* @param aGroupName group name.
|
94
|
145 |
* @result id of a newly created collection.
|
92
|
146 |
*/
|
|
147 |
TInt CreatePredefinedCollectionL( const TDesC& aGroupName );
|
93
|
148 |
|
92
|
149 |
/**
|
|
150 |
* Add collection to all collection.
|
|
151 |
* @param aCollectionId collection id to add.
|
|
152 |
*/
|
|
153 |
void AddCollectionToAllCollectionL( TInt aCollectionId );
|
85
|
154 |
|
|
155 |
/**
|
94
|
156 |
* Removes application entry from downloaded collection.
|
85
|
157 |
* @param aEntryId application entry id.
|
|
158 |
*/
|
|
159 |
void RemoveEntryFromDownloadedL( TInt aEntryId );
|
|
160 |
|
94
|
161 |
/**
|
|
162 |
* Updates application's removable and visible flags.
|
|
163 |
* @param aItem menu item.
|
102
|
164 |
* @param aMmcId MMC ID of currently inserted MMC, or 0.
|
94
|
165 |
* @return ETrue if flags were updated.
|
|
166 |
*/
|
102
|
167 |
TBool HandleRemovableFlagAndMmcAttrUpdateL( CCaInnerEntry* aItem, TUint aMmcId );
|
85
|
168 |
|
|
169 |
/**
|
99
|
170 |
* Removes application unninstall flag.
|
|
171 |
* @param aItem menu item.
|
|
172 |
* @return ETrue if flags were updated.
|
|
173 |
*/
|
|
174 |
TBool RemoveUninstallFlagL( CCaInnerEntry* aItem );
|
|
175 |
|
|
176 |
/**
|
93
|
177 |
* Updates application's missing and visible flags.
|
85
|
178 |
* @param aItem menu item.
|
94
|
179 |
* @return ETrue if flags were updated.
|
85
|
180 |
*/
|
102
|
181 |
TBool HandleMissingFlagsUpdate( CCaInnerEntry* aItem );
|
85
|
182 |
|
|
183 |
/**
|
93
|
184 |
* Updates visible flag.
|
85
|
185 |
* @param aItem menu item.
|
94
|
186 |
* @return ETrue if visible flag was updated.
|
85
|
187 |
*/
|
93
|
188 |
TBool HandleVisibleFlagUpdate( CCaInnerEntry* aItem );
|
85
|
189 |
|
|
190 |
/**
|
|
191 |
* Updates used flag.
|
|
192 |
* @param aItem menu item.
|
94
|
193 |
* @return ETrue if used flag was updated.
|
85
|
194 |
*/
|
93
|
195 |
TBool HandleUsedFlagUpdate( CCaInnerEntry* aItem );
|
94
|
196 |
|
85
|
197 |
/**
|
|
198 |
* Updates mmc attribute.
|
|
199 |
* @param aItem menu item.
|
|
200 |
* @param aMmcId MMC ID of currently inserted MMC, or 0.
|
94
|
201 |
* @return ETrue if mmc attribute was updated.
|
85
|
202 |
*/
|
102
|
203 |
TBool HandleMmcAttrUpdateL( const Usif::CComponentEntry* aEntry,
|
|
204 |
CCaInnerEntry* aItem, TUint aMmcId );
|
85
|
205 |
|
|
206 |
/**
|
94
|
207 |
* Get applications from AppArc.
|
|
208 |
* @param aArray RArray with applications' uids.
|
85
|
209 |
*/
|
94
|
210 |
void GetApaItemsL( RArray<TUint>& aArray );
|
85
|
211 |
|
|
212 |
/**
|
94
|
213 |
* Remove application from array (found in AppArc).
|
|
214 |
* @param aArray RArray with applications' uids.
|
|
215 |
* @param aUid uid of application to remove.
|
85
|
216 |
*/
|
94
|
217 |
void RemoveApp( RArray<TUint>& aArray, TInt32 aUid );
|
85
|
218 |
|
|
219 |
/**
|
94
|
220 |
* Get applications from CaStorage.
|
|
221 |
* @param aArray RPointerArray with CCaInnerEntries.
|
|
222 |
* contains applications.
|
85
|
223 |
*/
|
|
224 |
void GetCaAppEntriesL( RPointerArray<CCaInnerEntry>& aArray );
|
|
225 |
|
|
226 |
/**
|
94
|
227 |
* Remove sat application from array(found in CaStorage).
|
85
|
228 |
* @param aArray RPointerArray with CCaInnerEntries
|
94
|
229 |
* contains applications.
|
85
|
230 |
*/
|
|
231 |
void RemoveSatAppL( RPointerArray<CCaInnerEntry>& aArray );
|
92
|
232 |
|
87
|
233 |
/**
|
94
|
234 |
* Ensure that HsApplicaiton is not visible: Add HsApplication.
|
87
|
235 |
* as hidden to CaStorage or remove HsApplication entry
|
|
236 |
* from array (found in CaStorage).
|
|
237 |
* @param aArray RPointerArray with CCaInnerEntries
|
94
|
238 |
* contains application.
|
87
|
239 |
*/
|
|
240 |
void HandleHsAppEntryL( RPointerArray<CCaInnerEntry>& aArray );
|
|
241 |
|
85
|
242 |
/**
|
94
|
243 |
* Get application with specified uid from CaStorage.
|
|
244 |
* @param aUid RPointerArray with CCaInnerEntries.
|
85
|
245 |
* @param aArray RPointerArray with CCaInnerEntries
|
94
|
246 |
* contains application.
|
85
|
247 |
*/
|
|
248 |
void GetCaAppEntriesL( TInt aUid, RPointerArray<CCaInnerEntry>& aArray );
|
|
249 |
|
|
250 |
/**
|
|
251 |
* New application is found, no menu item refers to it.
|
|
252 |
* Add new menu item referring to this application.
|
|
253 |
* @param aUid Application capability.
|
|
254 |
* @param aCurrentMmcId MMC ID of currently inserted MMC, or 0.
|
99
|
255 |
* @return added item id
|
85
|
256 |
*/
|
99
|
257 |
TInt AddAppEntryL( TUint aUid, TUint aCurrentMmcId );
|
85
|
258 |
|
|
259 |
/**
|
102
|
260 |
* Set CWRT ettributes to entry.
|
|
261 |
* @param aEntry CCaInnerEntry with application.
|
|
262 |
* @return ETrue if app info was updatedd
|
|
263 |
*/
|
|
264 |
TBool SetCWRTAppL( CCaInnerEntry* aEntry );
|
|
265 |
|
|
266 |
/**
|
|
267 |
* Set Java attributes to entry.
|
|
268 |
* @param aEntry CCaInnerEntry with application.
|
|
269 |
* @return ETrue if app info was updatedd
|
|
270 |
*/
|
|
271 |
TBool SetJavaAppL( CCaInnerEntry* aEntry );
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Set information from TApaAppInfo to entry.
|
|
275 |
* @param aEntry CCaInnerEntry with application.
|
|
276 |
* @param info application informations from AppArc.
|
|
277 |
* @return ETrue if app info was updatedd
|
|
278 |
*/
|
|
279 |
TBool SetAppCaptionL( CCaInnerEntry* aEntry, TApaAppInfo* info );
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Gets component id from entry.
|
|
283 |
* @param aEntry CCaInnerEntry with application.
|
|
284 |
* @return component id
|
|
285 |
*/
|
|
286 |
TInt GetComponentIdFromEntryL( CCaInnerEntry* aEntry );
|
|
287 |
|
|
288 |
/**
|
|
289 |
* Sets new attribute value.
|
|
290 |
* @param aEntry CCaInnerEntry with application.
|
|
291 |
* @param aKey attribute name.
|
|
292 |
* @param aValue attribute value.
|
|
293 |
* @return ETrue if attribute was updated or added
|
|
294 |
*/
|
|
295 |
TBool AddAttributeL(
|
|
296 |
CCaInnerEntry* aEntry,
|
|
297 |
const TDesC& aKey,
|
|
298 |
const TDesC& aValue );
|
|
299 |
|
|
300 |
/**
|
|
301 |
* Removes attribute from entry.
|
|
302 |
* @param aEntry CCaInnerEntry with application.
|
|
303 |
* @param aKey attribute name.
|
|
304 |
* @return ETrue if attribute was removed
|
|
305 |
*/
|
|
306 |
TBool RemoveAttributeL( CCaInnerEntry* aEntry, const TDesC& aKey );
|
|
307 |
|
|
308 |
/**
|
94
|
309 |
* Set information from TApaAppInfo to entry.
|
85
|
310 |
* @param aEntry CCaInnerEntry with application.
|
|
311 |
* @return ETrue if app info was updatedd
|
|
312 |
*/
|
|
313 |
TBool SetApaAppInfoL( CCaInnerEntry* aEntry );
|
|
314 |
|
|
315 |
/**
|
94
|
316 |
* Handle items which are in the menu but no corresponding app is present:
|
|
317 |
* - Items that are on a recently used MMC get "missing" flag but kept.
|
85
|
318 |
* - Items that are not on MMC or the MMC is not recently used, are
|
94
|
319 |
* removed from the menu.
|
85
|
320 |
* @param aItems Missing items.
|
|
321 |
*/
|
|
322 |
void HandleMissingItemsL( RPointerArray<CCaInnerEntry>& aCaEnties );
|
|
323 |
|
|
324 |
/**
|
93
|
325 |
* Set "missing" flag.
|
85
|
326 |
* @param aEntry entry.
|
|
327 |
*/
|
93
|
328 |
void SetMissingFlagL( CCaInnerEntry* aEntry );
|
|
329 |
|
|
330 |
/**
|
102
|
331 |
* Clear all flags.
|
93
|
332 |
* @param aEntry entry.
|
|
333 |
*/
|
102
|
334 |
void ClearAllFlagsL( CCaInnerEntry* aEntry );
|
85
|
335 |
|
|
336 |
/**
|
|
337 |
* Check currently inserted MMC card, update and save MMC history.
|
|
338 |
* @return Current MMC id, or 0 if no MMC is inserted.
|
|
339 |
*/
|
|
340 |
TUint UpdateMmcHistoryL();
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Get current MMC id. 0 if no MMC is inserted, or in case of any errors.
|
94
|
344 |
* @return Current MMC id or 0.
|
85
|
345 |
*/
|
|
346 |
TUint CurrentMmcId() const;
|
102
|
347 |
|
85
|
348 |
/**
|
102
|
349 |
* Check if drive letter is on a given default drive type.
|
|
350 |
* @param aDriveLetter drive letter .
|
94
|
351 |
* @param aDefaultDrive default drive type
|
|
352 |
* @return ETrue if aFileName is on a given default drive type.
|
85
|
353 |
*/
|
102
|
354 |
TBool IsCharInDrive( const TChar& aDriveLetter,
|
85
|
355 |
const DriveInfo::TDefaultDrives& aDefaultDrive ) const;
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Check if drive's status is EDriveInUse.
|
|
359 |
* @param aDefaultDrive default drive type.
|
|
360 |
* @return ETrue if drive is in use.
|
|
361 |
*/
|
|
362 |
TBool IsDriveInUse( const DriveInfo::TDefaultDrives& aDefaultDrive );
|
|
363 |
|
|
364 |
/**
|
94
|
365 |
* Add application to storage or update entry if necessary.
|
|
366 |
* @param aCaEnties with applications from storage.
|
|
367 |
* @param aAppUid application uid.
|
|
368 |
* @param aMmcId unique mmc id.
|
85
|
369 |
*/
|
|
370 |
void UpdateApplicationEntryL( RPointerArray<CCaInnerEntry>& aCaEnties,
|
94
|
371 |
TUint aAppUid, TUint aMmcId );
|
85
|
372 |
|
|
373 |
/**
|
94
|
374 |
* Update entry from storage.
|
|
375 |
* @param aEntry application entry.
|
|
376 |
* @param aMmcId unique mmc id.
|
99
|
377 |
* @param aAlwaysUpdate item always should be updated.
|
85
|
378 |
*/
|
99
|
379 |
void UpdateAppEntryL( CCaInnerEntry* aEntry,
|
|
380 |
TUint aMmcId,
|
|
381 |
TBool aAlwaysUpdate = EFalse );
|
85
|
382 |
|
|
383 |
/**
|
94
|
384 |
* Get all applications from storage and visible from apparc
|
|
385 |
* and update if necessary.
|
85
|
386 |
*/
|
|
387 |
void UpdateApplicationEntriesL();
|
|
388 |
|
|
389 |
/**
|
92
|
390 |
* Make not empty collections with not hidden apps visible.
|
|
391 |
*/
|
|
392 |
void MakeNotEmptyCollectionsVisibleL();
|
93
|
393 |
|
92
|
394 |
/**
|
|
395 |
* Make collection visible if has visible entry.
|
94
|
396 |
* @param aEntry application entry.
|
92
|
397 |
*/
|
|
398 |
void MakeCollectionVisibleIfHasVisibleEntryL( CCaInnerEntry* aEntry );
|
99
|
399 |
|
94
|
400 |
/**
|
|
401 |
* Adds or updates component id attribute in entry based on SCR provided data
|
|
402 |
* @param aEntry entry being updated with component id attribute.
|
|
403 |
* @return ETrue when component id attribute of the entry has been added or changed.
|
|
404 |
*/
|
102
|
405 |
TBool UpdateComponentIdL( CCaInnerEntry& aEntry );
|
94
|
406 |
|
85
|
407 |
private:
|
|
408 |
// data
|
|
409 |
|
|
410 |
RApaLsSession iApaLsSession; ///< AppArc session. Own.
|
|
411 |
CCaSrvMmcHistory* iMmcHistory; ///< MMC history. Own.
|
|
412 |
RFs iFs; ///< File Server Session. Own.
|
102
|
413 |
|
94
|
414 |
CCaStorageProxy& iCaStorageProxy; ///< Not own
|
102
|
415 |
Usif::RSoftwareComponentRegistry& iSoftwareRegistry; ///< Not own
|
94
|
416 |
CCaSrvEngUtils& iSrvEngUtils; ///< Not own
|
85
|
417 |
|
|
418 |
TInt iCollectionDownloadId;
|
92
|
419 |
TInt iAllCollectionId;
|
99
|
420 |
|
85
|
421 |
CA_STORAGE_TEST_FRIEND_CLASS (T_casrvAppScaner)
|
|
422 |
|
|
423 |
};
|
|
424 |
|
|
425 |
#endif /* CASRVAPPSCANNER_H_ */
|