95 RChangeNotifier iLangNotifier; |
82 RChangeNotifier iLangNotifier; |
96 CApaAppList& iAppList; |
83 CApaAppList& iAppList; |
97 TLanguage iPrevLanguage; |
84 TLanguage iPrevLanguage; |
98 }; |
85 }; |
99 |
86 |
100 |
87 |
101 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
102 |
|
103 enum TApaSCRFetchAction |
|
104 { |
|
105 EGetAllAppsInfo, //Fetch all application the information from SCR |
|
106 EGetSpecificAppsInfo //Fetch only provided application uids information |
|
107 }; |
|
108 |
|
109 /* |
|
110 * Contain information about appliations to be fetched from SCR. |
|
111 */ |
|
112 |
|
113 NONSHARABLE_CLASS(CApaAppSCRFetchInfo : public CBase) |
|
114 { |
|
115 public: |
|
116 static CApaAppSCRFetchInfo* NewL(TApaSCRFetchAction aSCRFetchAction, RArray<TApaAppUpdateInfo>* aAppUpdateInfo); |
|
117 ~CApaAppSCRFetchInfo(); |
|
118 RArray<TApaAppUpdateInfo>* AppUpdateInfo(); |
|
119 TApaSCRFetchAction SCRFetchAction(); |
|
120 |
|
121 private: |
|
122 CApaAppSCRFetchInfo(TApaSCRFetchAction aSCRFetchAction, RArray<TApaAppUpdateInfo>* aAppUpdateInfo); |
|
123 |
|
124 private: |
|
125 TApaSCRFetchAction iSCRFetchAction; |
|
126 RArray<TApaAppUpdateInfo>* iAppUpdateInfo; |
|
127 }; |
|
128 |
|
129 |
|
130 /* |
|
131 * Reads multiple application information from SCR and caches it. When requested provides one application |
|
132 * information at a time. |
|
133 */ |
|
134 NONSHARABLE_CLASS(CApaAppList::CApaScrAppInfo) |
|
135 { |
|
136 public: |
|
137 static CApaScrAppInfo* NewL(const Usif::RSoftwareComponentRegistry& aScrCon, TInt aNumEntries); |
|
138 void GetAllAppsInfoL(); |
|
139 void GetSpecificAppsInfoL(RArray<TApaAppUpdateInfo>* aAppUpdateInfo); |
|
140 TUid GetNextApplicationInfo(TApaAppUpdateInfo::TApaAppAction& aAppAction, Usif::CApplicationRegistrationData*& aAppData); |
|
141 TApaSCRFetchAction GetSCRFetchAction(); |
|
142 ~CApaScrAppInfo(); |
|
143 |
|
144 private: |
|
145 void ConstructL(); |
|
146 CApaScrAppInfo(const Usif::RSoftwareComponentRegistry& aScr, TInt aNumEntries); |
|
147 void GetAppUidListL(RArray<TApaAppUpdateInfo>& aAppUpdateInfoArr, RArray<TUid>& aAppUids); |
|
148 TUid GetAllAppsNextApplicationInfoL(TApaAppUpdateInfo::TApaAppAction& aAppAction, Usif::CApplicationRegistrationData*& aAppData); |
|
149 TUid GetSpecificAppsNextApplicationInfoL(TApaAppUpdateInfo::TApaAppAction& aAppAction, Usif::CApplicationRegistrationData*& aAppData); |
|
150 private: |
|
151 Usif::RApplicationRegistryView iScrAppView; |
|
152 RPointerArray<Usif::CApplicationRegistrationData> iAppInfo; |
|
153 RPointerArray<CApaAppSCRFetchInfo> iSCRFetchInfoQueue; |
|
154 const Usif::RSoftwareComponentRegistry& iSCR; |
|
155 TBool iIsSCRRegViewOpen; |
|
156 TInt iSpecificAppsIndex; |
|
157 CApaAppSCRFetchInfo* iAppSCRFetchInfo; |
|
158 TBool iMoreAppInfo; |
|
159 TInt iNumEntriesToFetch; |
|
160 }; |
|
161 |
|
162 |
|
163 |
|
164 CApaAppSCRFetchInfo* CApaAppSCRFetchInfo::NewL(TApaSCRFetchAction aSCRFetchAction, RArray<TApaAppUpdateInfo>* aAppUpdateInfo) |
|
165 { |
|
166 //Ownership of aAppUpdateInfo is transfered to this object. |
|
167 CApaAppSCRFetchInfo* self=new (ELeave) CApaAppSCRFetchInfo(aSCRFetchAction, aAppUpdateInfo); |
|
168 return(self); |
|
169 } |
|
170 |
|
171 |
|
172 CApaAppSCRFetchInfo::CApaAppSCRFetchInfo(TApaSCRFetchAction aSCRFetchAction, RArray<TApaAppUpdateInfo>* aAppUpdateInfo): |
|
173 iSCRFetchAction(aSCRFetchAction), |
|
174 iAppUpdateInfo(aAppUpdateInfo) |
|
175 { |
|
176 } |
|
177 |
|
178 CApaAppSCRFetchInfo::~CApaAppSCRFetchInfo() |
|
179 { |
|
180 delete iAppUpdateInfo; |
|
181 } |
|
182 |
|
183 RArray<TApaAppUpdateInfo>* CApaAppSCRFetchInfo::AppUpdateInfo() |
|
184 { |
|
185 return iAppUpdateInfo; |
|
186 } |
|
187 |
|
188 |
|
189 TApaSCRFetchAction CApaAppSCRFetchInfo::SCRFetchAction() |
|
190 { |
|
191 return iSCRFetchAction; |
|
192 } |
|
193 |
|
194 |
|
195 //CApaAppList::CApaScrAppInfo |
|
196 |
|
197 CApaAppList::CApaScrAppInfo* CApaAppList::CApaScrAppInfo::NewL(const Usif::RSoftwareComponentRegistry& aScrCon, TInt aNumEntries) |
|
198 { |
|
199 CApaScrAppInfo* self=new(ELeave) CApaScrAppInfo(aScrCon, aNumEntries); |
|
200 CleanupStack::PushL(self); |
|
201 self->ConstructL(); |
|
202 CleanupStack::Pop(); |
|
203 return self; |
|
204 } |
|
205 |
|
206 |
|
207 CApaAppList::CApaScrAppInfo::CApaScrAppInfo(const Usif::RSoftwareComponentRegistry& aScr, TInt aNumEntries): |
|
208 iSCR(aScr), |
|
209 iIsSCRRegViewOpen(EFalse), |
|
210 iSpecificAppsIndex(-1), |
|
211 iAppSCRFetchInfo(NULL), |
|
212 iMoreAppInfo(EFalse), |
|
213 iNumEntriesToFetch(aNumEntries) |
|
214 |
|
215 { |
|
216 } |
|
217 |
|
218 void CApaAppList::CApaScrAppInfo::ConstructL() |
|
219 { |
|
220 } |
|
221 |
|
222 |
|
223 CApaAppList::CApaScrAppInfo::~CApaScrAppInfo() |
|
224 { |
|
225 if(iAppSCRFetchInfo) |
|
226 { |
|
227 delete iAppSCRFetchInfo; |
|
228 iAppSCRFetchInfo=NULL; |
|
229 } |
|
230 |
|
231 iAppInfo.ResetAndDestroy(); |
|
232 iSCRFetchInfoQueue.ResetAndDestroy(); |
|
233 iScrAppView.Close(); |
|
234 } |
|
235 |
|
236 /* |
|
237 * Gets all the application information available in the SCR. It adds SCR fetch info with action EGetAllAppsInfo to a queue |
|
238 * to get all the application information. The information can be obtained one at a time by calling GetNextApplicationInfoL |
|
239 * function. |
|
240 */ |
|
241 void CApaAppList::CApaScrAppInfo::GetAllAppsInfoL() |
|
242 { |
|
243 CApaAppSCRFetchInfo* appSCRFetchInfo = CApaAppSCRFetchInfo::NewL(EGetAllAppsInfo, NULL); |
|
244 CleanupStack::PushL(appSCRFetchInfo); |
|
245 iSCRFetchInfoQueue.AppendL(appSCRFetchInfo); |
|
246 CleanupStack::Pop(); |
|
247 } |
|
248 |
|
249 |
|
250 /* |
|
251 * Gets specific application information from the SCR. It adds SCR fetch info request with action EGetSpecificAppsInfo |
|
252 * along with the required uid list to the queue. The information can be obtained one at a time by calling GetNextApplicationInfoL |
|
253 * function. |
|
254 */ |
|
255 void CApaAppList::CApaScrAppInfo::GetSpecificAppsInfoL(RArray<TApaAppUpdateInfo>* aAppUpdateInfo) |
|
256 { |
|
257 CApaAppSCRFetchInfo* appSCRFetchInfo=CApaAppSCRFetchInfo::NewL(EGetSpecificAppsInfo, aAppUpdateInfo); |
|
258 CleanupStack::PushL(appSCRFetchInfo); |
|
259 iSCRFetchInfoQueue.AppendL(appSCRFetchInfo); |
|
260 CleanupStack::Pop(); |
|
261 } |
|
262 |
|
263 /* |
|
264 * Create array of uids from TApaAppUpdateInfo array. |
|
265 */ |
|
266 void CApaAppList::CApaScrAppInfo::GetAppUidListL(RArray<TApaAppUpdateInfo>& aAppUpdateInfoArr, RArray<TUid>& aAppUids) |
|
267 { |
|
268 TInt count=aAppUpdateInfoArr.Count(); |
|
269 |
|
270 for(TInt index=0;index<count;index++) |
|
271 { |
|
272 TApaAppUpdateInfo appUpdateInfo=aAppUpdateInfoArr[index]; |
|
273 aAppUids.AppendL(appUpdateInfo.iAppUid); |
|
274 } |
|
275 } |
|
276 |
|
277 |
|
278 TApaSCRFetchAction CApaAppList::CApaScrAppInfo::GetSCRFetchAction() |
|
279 { |
|
280 return iAppSCRFetchInfo->SCRFetchAction(); |
|
281 } |
|
282 |
|
283 |
|
284 /* |
|
285 * Provides one application information at a time. Returns Null UID if no more application information available. |
|
286 * Ownership of aAppData is transfered to calling function. |
|
287 */ |
|
288 TUid CApaAppList::CApaScrAppInfo::GetNextApplicationInfo(TApaAppUpdateInfo::TApaAppAction& aAppAction, Usif::CApplicationRegistrationData*& aAppData) |
|
289 { |
|
290 aAppData=NULL; |
|
291 TUid appUid=KNullUid; |
|
292 |
|
293 while(appUid==KNullUid) |
|
294 { |
|
295 //If there is no valid current SCR fetch information, get it from SCR fetch info queue |
|
296 if(!iAppSCRFetchInfo) |
|
297 { |
|
298 if(iSCRFetchInfoQueue.Count()>0) |
|
299 { |
|
300 //Get next SCR fetch info |
|
301 iAppSCRFetchInfo=iSCRFetchInfoQueue[0]; |
|
302 iSCRFetchInfoQueue.Remove(0); |
|
303 iMoreAppInfo=ETrue; |
|
304 } |
|
305 else |
|
306 { |
|
307 //No more SCR fetch information avaialable. |
|
308 break; |
|
309 } |
|
310 } |
|
311 |
|
312 //Get next application information |
|
313 if(iAppSCRFetchInfo->SCRFetchAction()==EGetAllAppsInfo) |
|
314 { |
|
315 //If there is a leave with current SCR fetch info, ignore and proceed with next SCR fetch info |
|
316 TRAP_IGNORE(appUid=GetAllAppsNextApplicationInfoL(aAppAction, aAppData)); |
|
317 } |
|
318 else |
|
319 { |
|
320 //If there is a leave with current SCR fetch info, ignore and proceed with next SCR fetch info |
|
321 TRAP_IGNORE(appUid=GetSpecificAppsNextApplicationInfoL(aAppAction, aAppData)); |
|
322 } |
|
323 |
|
324 if(appUid==KNullUid) |
|
325 { |
|
326 //If no application information avaialble with current fetch action reset the values for next SCR fetch action. |
|
327 delete iAppSCRFetchInfo; |
|
328 iAppSCRFetchInfo=NULL; |
|
329 iScrAppView.Close(); |
|
330 iIsSCRRegViewOpen=EFalse; |
|
331 } |
|
332 } |
|
333 |
|
334 return(appUid); |
|
335 } |
|
336 |
|
337 TUid CApaAppList::CApaScrAppInfo::GetAllAppsNextApplicationInfoL(TApaAppUpdateInfo::TApaAppAction& aAppAction, Usif::CApplicationRegistrationData*& aAppData) |
|
338 { |
|
339 TUid appUid=KNullUid; |
|
340 |
|
341 if(iAppInfo.Count()==0 && iMoreAppInfo) |
|
342 { |
|
343 //Open registry view if its not open. |
|
344 if(!iIsSCRRegViewOpen) |
|
345 { |
|
346 TInt err=KErrNone; |
|
347 TInt timeOut=KSCRConnectionWaitTime; |
|
348 |
|
349 //Retry if an error occurs while opening a SCR view. |
|
350 while(timeOut < KSCRConnectionWaitTime*8) |
|
351 { |
|
352 TRAP(err, iScrAppView.OpenViewL(iSCR)); |
|
353 if(err != KErrNone) |
|
354 { |
|
355 User::After(timeOut); |
|
356 timeOut= (2*timeOut); |
|
357 } |
|
358 else |
|
359 { |
|
360 break; |
|
361 } |
|
362 } |
|
363 User::LeaveIfError(err); |
|
364 iIsSCRRegViewOpen=ETrue; |
|
365 } |
|
366 |
|
367 //Get next available applications information. |
|
368 iScrAppView.GetNextApplicationRegistrationInfoL(iNumEntriesToFetch, iAppInfo); |
|
369 if(iAppInfo.Count()<KNumAppEntriesFromSCR) |
|
370 iMoreAppInfo=EFalse; |
|
371 } |
|
372 |
|
373 //If no application information avaialble, return Null UID. |
|
374 if(iAppInfo.Count()==0) |
|
375 return KNullUid; |
|
376 |
|
377 aAppData=iAppInfo[0]; |
|
378 aAppAction=TApaAppUpdateInfo::EAppPresent; |
|
379 iAppInfo.Remove(0); |
|
380 appUid=aAppData->AppUid(); |
|
381 return appUid; |
|
382 } |
|
383 |
|
384 |
|
385 /* |
|
386 * Gets next application information when specific applications information requested. |
|
387 */ |
|
388 TUid CApaAppList::CApaScrAppInfo::GetSpecificAppsNextApplicationInfoL(TApaAppUpdateInfo::TApaAppAction& aAppAction, Usif::CApplicationRegistrationData*& aAppData) |
|
389 { |
|
390 TUid appUid=KNullUid; |
|
391 TApaAppUpdateInfo::TApaAppAction action = TApaAppUpdateInfo::EAppNotPresent; //To make compiler happy |
|
392 Usif::CApplicationRegistrationData* appData=NULL; |
|
393 |
|
394 while(appUid==KNullUid) |
|
395 { |
|
396 if(iAppInfo.Count()==0 && iMoreAppInfo) |
|
397 { |
|
398 //Open registry view if its not open and also provides application uid list for which applist needs to be updated. |
|
399 if(!iIsSCRRegViewOpen) |
|
400 { |
|
401 RArray<TUid> appUids; |
|
402 CleanupClosePushL(appUids); |
|
403 //Get application uids list. |
|
404 GetAppUidListL(*iAppSCRFetchInfo->AppUpdateInfo(), appUids); |
|
405 |
|
406 TInt err=KErrNone; |
|
407 do |
|
408 { |
|
409 TRAP(err, iScrAppView.OpenViewL(iSCR, appUids)); |
|
410 if(err) |
|
411 User::After(KSCRConnectionWaitTime); |
|
412 } |
|
413 while(err!=KErrNone); |
|
414 |
|
415 CleanupStack::PopAndDestroy(); |
|
416 iIsSCRRegViewOpen=ETrue; |
|
417 iSpecificAppsIndex=0; |
|
418 } |
|
419 |
|
420 //Get next available applications information. |
|
421 iScrAppView.GetNextApplicationRegistrationInfoL(iNumEntriesToFetch,iAppInfo); |
|
422 if(iAppInfo.Count()<KNumAppEntriesFromSCR) |
|
423 iMoreAppInfo=EFalse; |
|
424 } |
|
425 |
|
426 RArray<TApaAppUpdateInfo>& appUpdateInfo=*iAppSCRFetchInfo->AppUpdateInfo(); |
|
427 |
|
428 |
|
429 if(iSpecificAppsIndex<appUpdateInfo.Count()) |
|
430 { |
|
431 appUid=appUpdateInfo[iSpecificAppsIndex].iAppUid; |
|
432 action=appUpdateInfo[iSpecificAppsIndex].iAction; |
|
433 |
|
434 //If application information avaialable, and if application action is not uninstalled or |
|
435 //If application action is uninstalled and the uninstalled application exists in SCR, |
|
436 //then get the info and assign to aAppData. |
|
437 if(iAppInfo.Count()>0) |
|
438 { |
|
439 if(iAppInfo[0]->AppUid()==appUid) |
|
440 { |
|
441 appData=iAppInfo[0]; |
|
442 iAppInfo.Remove(0); |
|
443 } |
|
444 } |
|
445 |
|
446 iSpecificAppsIndex++; |
|
447 |
|
448 //If action is not uninstalled, there should be application data in SCR. Otherwise skip the application action. |
|
449 if((action!=TApaAppUpdateInfo::EAppNotPresent) && appData==NULL) |
|
450 { |
|
451 appUid=KNullUid; |
|
452 } |
|
453 |
|
454 } |
|
455 //If there are no more applications in the current update applist, break the loop; |
|
456 if(appUpdateInfo.Count()==iSpecificAppsIndex) |
|
457 break; |
|
458 } |
|
459 |
|
460 aAppData=appData; |
|
461 aAppAction=action; |
|
462 return appUid; |
|
463 } |
|
464 |
|
465 #endif |
|
466 |
|
467 // |
88 // |
468 // Local functions |
89 // Local functions |
469 // |
90 // |
470 |
91 |
471 void CleanupServiceArray(TAny* aServiceArray) |
92 void CleanupServiceArray(TAny* aServiceArray) |
485 // |
106 // |
486 // Class CApaAppList |
107 // Class CApaAppList |
487 // |
108 // |
488 |
109 |
489 EXPORT_C CApaAppList* CApaAppList::NewL(RFs& aFs, TBool aLoadMbmIconsOnDemand, TInt aIdlePeriodicDelay) |
110 EXPORT_C CApaAppList* CApaAppList::NewL(RFs& aFs, TBool aLoadMbmIconsOnDemand, TInt aIdlePeriodicDelay) |
490 { |
111 { |
491 CApaAppList* self=new (ELeave) CApaAppList(aFs, aLoadMbmIconsOnDemand, aIdlePeriodicDelay); |
112 CApaAppList* self=new (ELeave) CApaAppList(aFs, aLoadMbmIconsOnDemand, aIdlePeriodicDelay); |
492 CleanupStack::PushL(self); |
113 CleanupStack::PushL(self); |
493 self->ConstructL(); |
114 self->ConstructL(); |
494 CleanupStack::Pop(self); |
115 CleanupStack::Pop(self); |
495 return self; |
116 return self; |
496 } |
117 } |
497 |
118 |
498 CApaAppList::CApaAppList(RFs& aFs, TBool aLoadMbmIconsOnDemand, TInt aIdlePeriodicDelay) |
119 CApaAppList::CApaAppList(RFs& aFs, TBool aLoadMbmIconsOnDemand, TInt aIdlePeriodicDelay) |
499 :iFs(aFs), |
120 :iFs(aFs), |
500 iFlags(0), |
121 iFlags(0), |
501 iIdlePeriodicDelay(aIdlePeriodicDelay), |
122 iIdlePeriodicDelay(aIdlePeriodicDelay), |
502 iLoadMbmIconsOnDemand(aLoadMbmIconsOnDemand), |
123 iLoadMbmIconsOnDemand(aLoadMbmIconsOnDemand), |
503 iUninstalledApps(NULL) |
124 iUninstalledApps(NULL) |
504 { |
125 { |
505 } |
126 } |
506 |
|
507 |
127 |
508 void CApaAppList::ConstructL() |
128 void CApaAppList::ConstructL() |
509 { |
129 { |
510 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
511 iAppRegFinder = CApaAppRegFinder::NewL(iFs); |
130 iAppRegFinder = CApaAppRegFinder::NewL(iFs); |
512 #endif |
|
513 |
131 |
514 User::LeaveIfError(iFsShareProtected.Connect()); |
132 User::LeaveIfError(iFsShareProtected.Connect()); |
515 User::LeaveIfError(iFsShareProtected.ShareProtected()); |
133 User::LeaveIfError(iFsShareProtected.ShareProtected()); |
516 User::LeaveIfError(Dll::SetTls(this)); |
134 User::LeaveIfError(Dll::SetTls(this)); |
517 |
135 |
518 //Start language change monitor. |
136 //Start language change monitor. |
519 iAppLangMonitor = CApaLangChangeMonitor::NewL(*this); |
137 iAppLangMonitor = CApaLangChangeMonitor::NewL(*this); |
520 |
|
521 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
522 const TInt KArrayGranularity = 128; |
138 const TInt KArrayGranularity = 128; |
523 iForcedRegistrations = new (ELeave) CDesCArraySeg(KArrayGranularity); |
139 iForcedRegistrations = new (ELeave) CDesCArraySeg(KArrayGranularity); |
524 #endif |
|
525 |
140 |
526 // Init the AppsList cache paths |
141 // Init the AppsList cache paths |
527 _LIT(KAppsListCacheFileName, ":\\private\\10003a3f\\AppsListCache\\AppsList.bin"); |
142 _LIT(KAppsListCacheFileName, ":\\private\\10003a3f\\AppsListCache\\AppsList.bin"); |
528 _LIT(KAppsListCacheBackUpFileName, ":\\private\\10003a3f\\AppsListCache\\AppsList_Backup.bin"); |
143 _LIT(KAppsListCacheBackUpFileName, ":\\private\\10003a3f\\AppsListCache\\AppsList_Backup.bin"); |
529 _LIT(KAppsListCachePath, ":\\private\\10003a3f\\AppsListCache\\"); |
144 _LIT(KAppsListCachePath, ":\\private\\10003a3f\\AppsListCache\\"); |
663 { |
278 { |
664 iAppIdler=CPeriodic::NewL(CActive::EPriorityStandard); |
279 iAppIdler=CPeriodic::NewL(CActive::EPriorityStandard); |
665 } |
280 } |
666 SetPending(iAppData); |
281 SetPending(iAppData); |
667 iAppRegFinder->FindAllAppsL(CApaAppRegFinder::EScanAllDrives); |
282 iAppRegFinder->FindAllAppsL(CApaAppRegFinder::EScanAllDrives); |
668 // DEF072701 |
283 |
669 // If this is the first scan i.e the boot scan then it may take some time. Thus |
284 // DEF072701 |
670 // the periodic delay value should be used so that this process will stop periodically |
285 // If this is the first scan i.e the boot scan then it may take some time. Thus |
671 // to allow time for other processes. |
286 // the periodic delay value should be used so that this process will stop periodically |
672 // If this is just a re-scan it should take much less time. Therefore it should just |
287 // to allow time for other processes. |
673 // be completed in one go rather than periodically delayed. Thus the delay value |
288 // If this is just a re-scan it should take much less time. Therefore it should just |
674 // should be set to 0. |
289 // be completed in one go rather than periodically delayed. Thus the delay value |
675 iAppIdler->Start(KIdleStartDelay, IsFirstScanComplete()? 0 : iIdlePeriodicDelay, TCallBack(IdleUpdateCallbackL, this)); |
290 // should be set to 0. |
676 #else |
291 iAppIdler->Start(KIdleStartDelay, IsFirstScanComplete()? 0 : iIdlePeriodicDelay, TCallBack(IdleUpdateCallbackL, this)); |
677 |
292 } |
678 iAppIdler=CPeriodic::NewL(CActive::EPriorityStandard); |
|
679 iAppIdler->Start(KIdleStartDelay, IsFirstScanComplete()? 0 : iIdlePeriodicDelay, TCallBack(IdleUpdateCallbackL, this)); |
|
680 |
|
681 #endif |
|
682 } |
|
683 |
|
684 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
685 EXPORT_C void CApaAppList::InitializeApplistL(MApaAppListObserver* aObserver) |
|
686 { |
|
687 if(!iScr.Handle()) |
|
688 User::LeaveIfError(iScr.Connect()); |
|
689 |
|
690 if(iScrAppInfo==NULL) |
|
691 iScrAppInfo=CApaScrAppInfo::NewL(iScr, KNumAppEntriesFromSCR); |
|
692 |
|
693 iScrAppInfo->GetAllAppsInfoL(); |
|
694 |
|
695 StartIdleUpdateL(aObserver); |
|
696 } |
|
697 |
|
698 |
|
699 void CApaAppList::InitializeLangAppListL() |
|
700 { |
|
701 if(!iScr.Handle()) |
|
702 User::LeaveIfError(iScr.Connect()); |
|
703 |
|
704 if(iScrAppInfo==NULL) |
|
705 iScrAppInfo=CApaScrAppInfo::NewL(iScr, KNumAppEntriesFromSCR); |
|
706 |
|
707 iScrAppInfo->GetAllAppsInfoL(); |
|
708 |
|
709 // set iIsLangChangePending=ETrue, to all the application present in the applist |
|
710 CApaAppData* appData=iAppData; |
|
711 while(appData) |
|
712 { |
|
713 appData->iIsLangChangePending=ETrue; |
|
714 appData=appData->iNext; |
|
715 } |
|
716 } |
|
717 |
|
718 |
|
719 EXPORT_C void CApaAppList::UpdateApplistL(MApaAppListObserver* aObserver, RArray<TApaAppUpdateInfo>* aAppUpdateInfo, TUid aSecureID) |
|
720 { |
|
721 //If update applist is called by SWI, clear force registrations from applist. |
|
722 if(aSecureID == KUidSisLaunchServer) |
|
723 { |
|
724 TInt count=iForceRegAppUids.Count(); |
|
725 for(TInt index=0; index<count; index++) |
|
726 FindAndDeleteApp(iForceRegAppUids[index]); |
|
727 iForceRegAppUids.Reset(); |
|
728 } |
|
729 |
|
730 if(aAppUpdateInfo->Count() == 0) |
|
731 return; |
|
732 |
|
733 //If SCR connection is not valid then connect. |
|
734 if(!iScr.Handle()) |
|
735 User::LeaveIfError(iScr.Connect()); |
|
736 |
|
737 if(iScrAppInfo==NULL) |
|
738 iScrAppInfo=CApaScrAppInfo::NewL(iScr, KNumAppEntriesFromSCR); |
|
739 |
|
740 iScrAppInfo->GetSpecificAppsInfoL(aAppUpdateInfo); |
|
741 |
|
742 if(IsIdleUpdateComplete()) |
|
743 StartIdleUpdateL(aObserver); |
|
744 } |
|
745 |
|
746 void CleanupAndDestroyAppInfoArray(TAny* aRPArray) |
|
747 { |
|
748 RPointerArray<Usif::CApplicationRegistrationData>* rpArray = (static_cast<RPointerArray<Usif::CApplicationRegistrationData>*>(aRPArray)); |
|
749 rpArray->ResetAndDestroy(); |
|
750 rpArray->Close(); |
|
751 } |
|
752 |
|
753 |
|
754 EXPORT_C void CApaAppList::UpdateApplistByForceRegAppsL(RPointerArray<Usif::CApplicationRegistrationData>& aForceRegAppsInfo) |
|
755 { |
|
756 //Get number of force registered application information. |
|
757 TInt count=aForceRegAppsInfo.Count(); |
|
758 Usif::RSoftwareComponentRegistry scr; |
|
759 User::LeaveIfError(scr.Connect()); |
|
760 CleanupClosePushL(scr); |
|
761 |
|
762 //As this function takes the ownership of aForceRegAppsInfo, this needs to be destroyed if any leave occurs. |
|
763 TCleanupItem cleanup(CleanupAndDestroyAppInfoArray, &aForceRegAppsInfo); |
|
764 CleanupStack::PushL(cleanup); |
|
765 |
|
766 //Get each force registered application information and add it to applist. |
|
767 for(TInt index=0; index<count; index++) |
|
768 { |
|
769 Usif::CApplicationRegistrationData* appInfo=aForceRegAppsInfo[index]; |
|
770 CApaAppData* appData = CApaAppData::NewL(*appInfo, iFs, scr); |
|
771 TUid appUid=appInfo->AppUid(); |
|
772 |
|
773 //Delete if the application already exist in the applist. |
|
774 FindAndDeleteApp(appUid); |
|
775 AddToList(appData); |
|
776 //Maintain added force registered application uids so that it can be cleared from applist |
|
777 //once installation complete. |
|
778 iForceRegAppUids.AppendL(appUid); |
|
779 } |
|
780 |
|
781 CleanupStack::PopAndDestroy(2); //cleanup, scr |
|
782 } |
|
783 |
|
784 |
|
785 // The function transfers ownership of the pointer owned by a CApaAppList to the caller |
|
786 // to avoid copying the array. |
|
787 EXPORT_C CArrayFixFlat<TApaAppUpdateInfo>* CApaAppList::UpdatedAppsInfo() |
|
788 { |
|
789 CArrayFixFlat<TApaAppUpdateInfo>* updatedAppsInfo=iAppsUpdated; |
|
790 iAppsUpdated=NULL; |
|
791 return updatedAppsInfo; |
|
792 } |
|
793 |
|
794 #endif |
|
795 |
293 |
796 EXPORT_C void CApaAppList::StartIdleUpdateL(MApaAppListObserver* aObserver) |
294 EXPORT_C void CApaAppList::StartIdleUpdateL(MApaAppListObserver* aObserver) |
797 /** Updates the list asynchronously, using an idle time active object |
295 /** Updates the list asynchronously, using an idle time active object |
798 and an observer. When the update is finished, the resulting app list |
296 and an observer. When the update is finished, the resulting app list |
799 is stored and the observer is notified with an MApaAppListServObserver::EAppListChanged |
297 is stored and the observer is notified with an MApaAppListServObserver::EAppListChanged |
1072 if (iFlags & EAppListHasChanged || iFlags & ENotifyUpdateOnFirstScanComplete) |
585 if (iFlags & EAppListHasChanged || iFlags & ENotifyUpdateOnFirstScanComplete) |
1073 iObserver->NotifyUpdate(MApaAppListServObserver::EAppListChanged); // NotifyUpdate will notify clients for both list update and scan complete. |
586 iObserver->NotifyUpdate(MApaAppListServObserver::EAppListChanged); // NotifyUpdate will notify clients for both list update and scan complete. |
1074 else |
587 else |
1075 iObserver->NotifyScanComplete(); // NotifyScanComplete will notify clients for scan complete. |
588 iObserver->NotifyScanComplete(); // NotifyScanComplete will notify clients for scan complete. |
1076 |
589 |
1077 //iObserver=NULL; |
590 iObserver=NULL; |
1078 } |
591 } |
1079 } |
592 } |
1080 |
593 |
1081 void CApaAppList::StopIdler() |
594 void CApaAppList::StopIdler() |
1082 { |
595 { |
1083 delete iAppIdler; |
596 delete iAppIdler; |
1084 iAppIdler=NULL; |
597 iAppIdler=NULL; |
1085 } |
598 } |
1086 |
599 |
1087 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
1088 |
|
1089 // returns ETrue if there more application information avaialable. |
|
1090 TInt CApaAppList::IdleUpdateL() |
|
1091 { |
|
1092 |
|
1093 Usif::CApplicationRegistrationData* appInfo=NULL; |
|
1094 TApaAppUpdateInfo::TApaAppAction action=TApaAppUpdateInfo::EAppPresent; //to make compiler happy. Actual value is assigned by GetNextApplicationInfo |
|
1095 TUid appUid; |
|
1096 |
|
1097 //Ownership of appInfo is transfered to this function. |
|
1098 appUid=iScrAppInfo->GetNextApplicationInfo(action,appInfo); |
|
1099 |
|
1100 if(appUid==KNullUid) |
|
1101 return EFalse; |
|
1102 |
|
1103 CleanupStack::PushL(appInfo); |
|
1104 CApaAppData *appData=NULL; |
|
1105 CApaAppData* app = NULL; |
|
1106 |
|
1107 switch(action) |
|
1108 { |
|
1109 case TApaAppUpdateInfo::EAppNotPresent: |
|
1110 if(appInfo==NULL) |
|
1111 { |
|
1112 TInt ret=FindAndDeleteApp(appUid); |
|
1113 if(ret==KErrNone) |
|
1114 iFlags |= EAppListHasChanged; |
|
1115 |
|
1116 //Add uninstalled application UID to a list |
|
1117 if(iUninstalledApps==NULL) |
|
1118 iUninstalledApps=new(ELeave) CArrayFixFlat<TUid>(1); |
|
1119 |
|
1120 iUninstalledApps->AppendL(appUid); |
|
1121 } |
|
1122 break; |
|
1123 |
|
1124 case TApaAppUpdateInfo::EAppPresent: |
|
1125 // holds the application information from Applist |
|
1126 app = AppDataByUid(appInfo->AppUid()); |
|
1127 |
|
1128 if( app && IsLanguageChangePending() && (iScrAppInfo->GetSCRFetchAction() == EGetAllAppsInfo)) |
|
1129 { |
|
1130 //Application needs to be updated because of language change |
|
1131 RPointerArray<Usif::CLocalizableAppInfo> localisationInfo; |
|
1132 localisationInfo=appInfo->LocalizableAppInfoList(); |
|
1133 ASSERT(!(localisationInfo.Count()>1)); |
|
1134 |
|
1135 if((localisationInfo.Count()>0) && (app->ApplicationLanguage() != localisationInfo[0]->ApplicationLanguage())) |
|
1136 { |
|
1137 // holds the application information read from SCR db |
|
1138 appData=CApaAppData::NewL(*appInfo, iFs, iScr); |
|
1139 FindAndDeleteApp(appUid); |
|
1140 AddToList(appData); |
|
1141 iFlags |= EAppListHasChanged; |
|
1142 } |
|
1143 else |
|
1144 { |
|
1145 app->iIsLangChangePending=EFalse; |
|
1146 } |
|
1147 } |
|
1148 else |
|
1149 { |
|
1150 // holds the application information read from SCR db |
|
1151 appData=CApaAppData::NewL(*appInfo, iFs, iScr); |
|
1152 if(app) |
|
1153 { |
|
1154 //Application found in applist. Delete existing application information from applist and create new |
|
1155 //application information object and add to the applist. |
|
1156 FindAndDeleteApp(appUid); |
|
1157 AddToList( appData ); |
|
1158 } |
|
1159 else |
|
1160 { |
|
1161 AddToList( appData ); |
|
1162 } |
|
1163 iFlags |= EAppListHasChanged; |
|
1164 } |
|
1165 |
|
1166 break; |
|
1167 |
|
1168 case TApaAppUpdateInfo::EAppInfoChanged: |
|
1169 appData=CApaAppData::NewL(*appInfo, iFs, iScr); |
|
1170 //Delete existing application information from applist and create new application information object and |
|
1171 //add to the applist. |
|
1172 FindAndDeleteApp(appUid); |
|
1173 AddToList( appData ); |
|
1174 iFlags |= EAppListHasChanged; |
|
1175 break; |
|
1176 } |
|
1177 |
|
1178 //If first scan not complete or if phone language is changed then clear the updated application list |
|
1179 //Otherwise add application updated apps list |
|
1180 if(!(iFlags&EFirstScanComplete) || (iFlags&ELangChangePending)) |
|
1181 { |
|
1182 if(!iAppsUpdated) |
|
1183 delete iAppsUpdated; |
|
1184 iAppsUpdated=NULL; |
|
1185 } |
|
1186 else |
|
1187 { |
|
1188 if(!iAppsUpdated) |
|
1189 iAppsUpdated= new(ELeave) CArrayFixFlat<TApaAppUpdateInfo>(1); |
|
1190 |
|
1191 TApaAppUpdateInfo appUpdateInfo(appUid, action); |
|
1192 iAppsUpdated->AppendL(appUpdateInfo); |
|
1193 } |
|
1194 |
|
1195 CleanupStack::PopAndDestroy(appInfo); |
|
1196 return ETrue; |
|
1197 } |
|
1198 |
|
1199 |
|
1200 |
|
1201 /* |
|
1202 * Finds and delete an application from applist. |
|
1203 */ |
|
1204 TInt CApaAppList::FindAndDeleteApp(TUid aAppUid) |
|
1205 { |
|
1206 CApaAppData* appData=iAppData; |
|
1207 CApaAppData* prevAppData=NULL; |
|
1208 |
|
1209 while(appData && appData->iUidType[2] != aAppUid) |
|
1210 { |
|
1211 prevAppData=appData; |
|
1212 appData=appData->iNext; |
|
1213 } |
|
1214 |
|
1215 if(appData) |
|
1216 { |
|
1217 if(prevAppData) |
|
1218 { |
|
1219 //If the application position is not the first application in the list |
|
1220 prevAppData->iNext=appData->iNext; |
|
1221 } |
|
1222 else |
|
1223 { |
|
1224 //If the application position is first in the list |
|
1225 iAppData=appData->iNext; |
|
1226 } |
|
1227 |
|
1228 #ifdef APPARC_SHOW_TRACE |
|
1229 if(appData) |
|
1230 { |
|
1231 RDebug::Print(_L("[Apparc] Application with UID: %X is deleted from applist"), appData->iUidType[2]); |
|
1232 } |
|
1233 #endif |
|
1234 |
|
1235 delete appData; |
|
1236 return(KErrNone); |
|
1237 } |
|
1238 |
|
1239 //if application not found, return KErrNotFound |
|
1240 return(KErrNotFound); |
|
1241 } |
|
1242 |
|
1243 /** |
|
1244 @internalComponent |
|
1245 */ |
|
1246 EXPORT_C CApaAppData* CApaAppList::FindAndAddSpecificAppL(TUid aAppUid) |
|
1247 { |
|
1248 Usif::RSoftwareComponentRegistry scrCon; |
|
1249 //If SCR connection not avaialable then connect to SCR. Otherwise use the |
|
1250 //existing connection. |
|
1251 if(!iScr.Handle()) |
|
1252 { |
|
1253 User::LeaveIfError(scrCon.Connect()); |
|
1254 CleanupClosePushL(scrCon); |
|
1255 } |
|
1256 else |
|
1257 scrCon=iScr; |
|
1258 |
|
1259 |
|
1260 //Pass 1 as number of entries to fetch from SCR as only specific application information is required. |
|
1261 CApaScrAppInfo *scrAppInfo=CApaScrAppInfo::NewL(scrCon, 1); |
|
1262 CleanupStack::PushL(scrAppInfo); |
|
1263 |
|
1264 RArray<TApaAppUpdateInfo>* appUpdateInfoList=new (ELeave) RArray<TApaAppUpdateInfo>(1); |
|
1265 CleanupStack::PushL(appUpdateInfoList); |
|
1266 TApaAppUpdateInfo appUpdateInfo(aAppUid, TApaAppUpdateInfo::EAppPresent) ; |
|
1267 appUpdateInfoList->AppendL(appUpdateInfo); |
|
1268 |
|
1269 scrAppInfo->GetSpecificAppsInfoL(appUpdateInfoList); |
|
1270 CleanupStack::Pop(appUpdateInfoList); |
|
1271 |
|
1272 Usif::CApplicationRegistrationData* appInfo=NULL; |
|
1273 TApaAppUpdateInfo::TApaAppAction action; |
|
1274 TUid uid; |
|
1275 uid=scrAppInfo->GetNextApplicationInfo(action, appInfo); |
|
1276 CleanupStack::PushL(appInfo); |
|
1277 |
|
1278 CApaAppData *appData=NULL; |
|
1279 if(appInfo) |
|
1280 { |
|
1281 appData=CApaAppData::NewL(*appInfo, iFs, scrCon); |
|
1282 FindAndDeleteApp(uid); |
|
1283 AddToList(appData); |
|
1284 iFlags |= EAppListHasChanged; |
|
1285 } |
|
1286 CleanupStack::PopAndDestroy(2, scrAppInfo); |
|
1287 |
|
1288 //If SCR session established in this function, then close it. |
|
1289 if(!iScr.Handle()) |
|
1290 CleanupStack::PopAndDestroy(); |
|
1291 |
|
1292 return appData; |
|
1293 } |
|
1294 |
|
1295 #else |
|
1296 TInt CApaAppList::IdleUpdateL() |
600 TInt CApaAppList::IdleUpdateL() |
1297 // returns ETrue if there is more scanning to be done. |
601 // returns ETrue if there is more scanning to be done. |
1298 { |
602 { |
1299 |
|
1300 TBool more=EFalse; |
603 TBool more=EFalse; |
1301 TApaAppEntry currentApp = TApaAppEntry(); |
604 TApaAppEntry currentApp = TApaAppEntry(); |
1302 TRAPD(err, more = iAppRegFinder->NextL(currentApp, *iForcedRegistrations)); |
605 TRAPD(err, more = iAppRegFinder->NextL(currentApp, *iForcedRegistrations)); |
1303 if (err!=KErrNone) |
606 if (err!=KErrNone) |
1304 { |
607 { |
1330 iFlags |= EAppListHasChanged; |
633 iFlags |= EAppListHasChanged; |
1331 |
634 |
1332 return more; |
635 return more; |
1333 } |
636 } |
1334 |
637 |
|
638 EXPORT_C TBool CApaAppList::IsIdleUpdateComplete() const |
|
639 /** Tests whether an asynchronous update of the list is currently in progress. |
|
640 |
|
641 @return True if no asynchronous update of the list is currently in progress, |
|
642 otherwise false. */ |
|
643 { |
|
644 return iAppIdler == NULL; |
|
645 } |
|
646 |
|
647 void CApaAppList::SetPending(CApaAppData* aAppData) |
|
648 // set all apps to pending update - we'll find them again as we scan |
|
649 { |
|
650 for (; aAppData; aAppData = aAppData->iNext) |
|
651 aAppData->SetAppPending(); |
|
652 } |
|
653 |
|
654 void CApaAppList::SetNotFound(CApaAppData* aAppData, TBool& aHasChanged) |
|
655 // mark any unfound apps not present |
|
656 { |
|
657 while (aAppData) |
|
658 { |
|
659 if (aAppData->IsPending()) |
|
660 { |
|
661 aAppData->iIsPresent = CApaAppData::ENotPresent; |
|
662 aHasChanged = ETrue; |
|
663 } |
|
664 aAppData = aAppData->iNext; |
|
665 } |
|
666 } |
|
667 |
|
668 void CApaAppList::AddToList( CApaAppData* aAppData ) |
|
669 { |
|
670 __ASSERT_DEBUG(aAppData, Panic(EPanicNullPointer)); |
|
671 aAppData->iNext=iAppData; |
|
672 iAppData=aAppData; |
|
673 } |
|
674 |
1335 void CApaAppList::UpdateNextAppL(const TApaAppEntry& aAppEntry,TBool& aHasChanged) |
675 void CApaAppList::UpdateNextAppL(const TApaAppEntry& aAppEntry,TBool& aHasChanged) |
1336 { |
676 { |
1337 CApaAppData* appData=AppDataByUid(aAppEntry.iUidType[2]); |
677 CApaAppData* appData=AppDataByUid(aAppEntry.iUidType[2]); |
1338 if (appData==NULL) |
678 if (appData==NULL) |
1339 {// not in list, so add it at the start |
679 {// not in list, so add it at the start |
1340 TRAPD(err,appData=CApaAppData::NewL(aAppEntry, iFs)); |
680 TRAPD(err,appData=CApaAppData::NewL(aAppEntry, iFs)); |
1341 if (err==KErrNone) |
681 if (err==KErrNone) |
1342 { |
682 { |
1343 AddToList( appData ); |
683 AddToList( appData ); |
1344 aHasChanged=ETrue; |
684 aHasChanged=ETrue; |
1345 } |
685 } |
1346 } |
686 } |
1347 else if (appData->IsPending()) |
687 else if (appData->IsPending()) |
1348 { // not found yet during current scan - we may need to override this one |
688 { // not found yet during current scan - we may need to override this one |
1349 |
689 |
1350 // On a system which scans for registration .RSC files (V2 apps) first, followed by |
690 // On a system which scans for registration .RSC files (V2 apps) first, followed by |
1351 // .APP files (V1 apps), it's valid for a V1 app to override a V2 app (if the V2 app |
691 // .APP files (V1 apps), it's valid for a V1 app to override a V2 app (if the V2 app |
1352 // has just been removed). If this is the case, assume it's ok to compare the V1 .APP filename, |
692 // has just been removed). If this is the case, assume it's ok to compare the V1 .APP filename, |
1353 // with the V2 .RSC filename as their filenames will never match (which is what we want in this case). |
693 // with the V2 .RSC filename as their filenames will never match (which is what we want in this case). |
1354 TPtrC currentFileName; |
694 TPtrC currentFileName; |
1355 if (appData->RegistrationFileUsed()) |
695 if (appData->RegistrationFileUsed()) |
1356 currentFileName.Set(*appData->iRegistrationFile); |
696 currentFileName.Set(*appData->iRegistrationFile); |
1357 else |
697 else |
1358 currentFileName.Set(*appData->iFullName); |
698 currentFileName.Set(*appData->iFullName); |
1359 |
699 |
1360 if (aAppEntry.iFullName.CompareF(currentFileName)!=0) |
700 if (aAppEntry.iFullName.CompareF(currentFileName)!=0) |
1361 { |
701 { |
1362 delete appData->iSuccessor; |
702 delete appData->iSuccessor; |
1363 appData->iSuccessor = NULL; |
703 appData->iSuccessor = NULL; |
1364 appData->iSuccessor = CApaAppEntry::NewL(aAppEntry); |
704 appData->iSuccessor = CApaAppEntry::NewL(aAppEntry); |
1365 |
705 |
1366 appData->iIsPresent = CApaAppData::ESuperseded; |
706 appData->iIsPresent = CApaAppData::ESuperseded; |
1367 aHasChanged=ETrue; |
707 aHasChanged=ETrue; |
1368 } |
708 } |
1369 else |
709 else |
1370 { |
710 { |
1371 if (appData->Update() || appData->iIsPresent==CApaAppData::ENotPresentPendingUpdate) |
711 if (appData->Update() || appData->iIsPresent==CApaAppData::ENotPresentPendingUpdate) |
1372 aHasChanged=ETrue; |
712 aHasChanged=ETrue; |
1373 |
713 |
1374 appData->iIsPresent = CApaAppData::EIsPresent; |
714 appData->iIsPresent = CApaAppData::EIsPresent; |
1375 } |
715 } |
1376 } |
716 } |
1377 } |
717 } |
1378 |
718 |
1379 void CApaAppList::SetPending(CApaAppData* aAppData) |
719 /** |
1380 // set all apps to pending update - we'll find them again as we scan |
720 @internalComponent |
1381 { |
721 */ |
1382 for (; aAppData; aAppData = aAppData->iNext) |
722 EXPORT_C CApaAppData* CApaAppList::FindAndAddSpecificAppL(CApaAppRegFinder* aFinder, TUid aAppUid) |
1383 aAppData->SetAppPending(); |
723 { |
1384 } |
724 //Scans and adds the specified application to the app list if found |
1385 |
725 __ASSERT_DEBUG(aFinder, Panic(EPanicNullPointer)); |
1386 void CApaAppList::SetNotFound(CApaAppData* aAppData, TBool& aHasChanged) |
726 TBool found = EFalse; |
1387 // mark any unfound apps not present |
727 TApaAppEntry appEntry; |
1388 { |
728 aFinder->FindAllAppsL(CApaAppRegFinder::EScanAllDrives); |
1389 while (aAppData) |
729 while (aFinder->NextL(appEntry, *iForcedRegistrations)) |
1390 { |
730 { |
1391 if (aAppData->IsPending()) |
731 if (appEntry.iUidType[2] == aAppUid) |
1392 { |
732 { |
1393 aAppData->iIsPresent = CApaAppData::ENotPresent; |
733 found = ETrue; |
1394 aHasChanged = ETrue; |
734 break; |
1395 } |
735 } |
1396 aAppData = aAppData->iNext; |
736 } |
1397 } |
737 |
1398 } |
738 CApaAppData* app = NULL; |
|
739 if (found) |
|
740 { |
|
741 // add the app to the list |
|
742 TBool hasChanged = EFalse; |
|
743 CApaAppData* prevFirstAppInList = iAppData; |
|
744 UpdateNextAppL(appEntry, hasChanged); |
|
745 if (iAppData != prevFirstAppInList) |
|
746 app = iAppData; // assume the new app was added to the list |
|
747 |
|
748 if (hasChanged) |
|
749 iFlags |= EAppListHasChanged; |
|
750 } |
|
751 |
|
752 return app; |
|
753 } |
1399 |
754 |
1400 EXPORT_C void CApaAppList::PurgeL() |
755 EXPORT_C void CApaAppList::PurgeL() |
1401 /** Removes any applications from the list if they are no longer present |
756 /** Removes any applications from the list if they are no longer present |
1402 on the phone. It updates applications that have been |
757 on the phone. It updates applications that have been |
1403 superceded. */ |
758 superceded. */ |
1404 { |
759 { |
1405 CApaAppData* appData=iAppData; |
760 CApaAppData* appData=iAppData; |
1406 CApaAppData* prev=NULL; |
761 CApaAppData* prev=NULL; |
1407 while (appData) |
762 while (appData) |
1408 { |
763 { |
1409 CApaAppData* next=appData->iNext; |
764 CApaAppData* next=appData->iNext; |
1410 if (appData->iIsPresent==CApaAppData::ENotPresent) |
765 if (appData->iIsPresent==CApaAppData::ENotPresent) |
1411 { |
766 { |
1412 if (prev) |
767 if (prev) |
1413 prev->iNext=next; |
768 prev->iNext=next; |
1414 else |
769 else |
1415 iAppData=next; |
770 iAppData=next; |
1416 |
771 |
1417 //Add uninstalled application UID to a list |
772 //Add uninstalled application UID to a list |
1418 if(iUninstalledApps==NULL) |
773 if(iUninstalledApps==NULL) |
1419 iUninstalledApps=new(ELeave) CArrayFixFlat<TUid>(1); |
774 iUninstalledApps=new(ELeave) CArrayFixFlat<TUid>(1); |
1420 |
775 |
1421 iUninstalledApps->AppendL(appData->AppEntry().iUidType[2]); |
776 iUninstalledApps->AppendL(appData->AppEntry().iUidType[2]); |
1422 |
777 |
1423 delete appData; |
778 delete appData; |
1424 } |
779 } |
1425 else if (appData->iIsPresent==CApaAppData::ESuperseded) |
780 else if (appData->iIsPresent==CApaAppData::ESuperseded) |
1426 { |
781 { |
1427 CApaAppData* newApp=NULL; |
782 CApaAppData* newApp=NULL; |
1428 TApaAppEntry appEntry; |
783 TApaAppEntry appEntry; |
1429 appData->iSuccessor->Get(appEntry); |
784 appData->iSuccessor->Get(appEntry); |
1430 TRAPD(err,newApp=CApaAppData::NewL(appEntry, iFs)); |
785 TRAPD(err,newApp=CApaAppData::NewL(appEntry, iFs)); |
1431 if (err==KErrNone) |
786 if (err==KErrNone) |
1432 { |
787 { |
1433 // remove the old one and add the new one in its place |
788 // remove the old one and add the new one in its place |
1434 if (prev) |
789 if (prev) |
1435 prev->iNext=newApp; |
790 prev->iNext=newApp; |
1436 else |
791 else |
1437 iAppData=newApp; |
792 iAppData=newApp; |
1438 |
793 |
1439 newApp->iNext = appData->iNext; |
794 newApp->iNext = appData->iNext; |
1440 delete appData; |
795 delete appData; |
1441 // increment the iterator |
796 // increment the iterator |
1442 prev = newApp; |
797 prev = newApp; |
1443 } |
798 } |
1444 } |
799 } |
1445 else |
800 else |
1446 prev=appData; |
801 prev=appData; |
1447 |
802 |
1448 appData=next; |
803 appData=next; |
1449 } |
804 } |
1450 } |
805 } |
1451 |
|
1452 void CApaAppList::ScanRemovableDrivesAndUpdateL() |
|
1453 /** Rename Appslist.bin file to AppsList_Backup.bin, so that it can be renamed back, |
|
1454 if the update scan on removable media drives does not change applist. */ |
|
1455 { |
|
1456 const TArray<const TDriveUnitInfo> listOfRemovableMediaDrives = iAppRegFinder->DriveList(); |
|
1457 const TInt count = listOfRemovableMediaDrives.Count(); |
|
1458 |
|
1459 // Removable media scan would take place only if removable drives are present. |
|
1460 if (count) |
|
1461 { |
|
1462 CApaAppData* appData = iAppData; |
|
1463 while (appData) |
|
1464 { |
|
1465 for (TInt driveIndex = 0; driveIndex < count; ++driveIndex) |
|
1466 { |
|
1467 if (TParsePtrC(*appData->iRegistrationFile).Drive() == listOfRemovableMediaDrives[driveIndex].iUnit.Name()) |
|
1468 { |
|
1469 appData->SetAppPending(); |
|
1470 break; |
|
1471 } |
|
1472 } |
|
1473 appData = appData->iNext; |
|
1474 } |
|
1475 |
|
1476 while (IdleUpdateL()) |
|
1477 { // It updates the removable media apps present in AppList if it has changed. |
|
1478 |
|
1479 }; |
|
1480 } |
|
1481 } |
|
1482 |
|
1483 void CApaAppList::UndoSetPending(CApaAppData* aAppData) |
|
1484 // Reset all apps to pevious pending state so they don't get purged |
|
1485 { |
|
1486 for (; aAppData; aAppData = aAppData->iNext) |
|
1487 { |
|
1488 if (aAppData->iIsPresent == CApaAppData::EPresentPendingUpdate) |
|
1489 { |
|
1490 aAppData->iIsPresent = CApaAppData::EIsPresent; |
|
1491 } |
|
1492 } |
|
1493 } |
|
1494 |
|
1495 /** |
|
1496 @internalComponent |
|
1497 */ |
|
1498 EXPORT_C CApaAppData* CApaAppList::FindAndAddSpecificAppL(CApaAppRegFinder* aFinder, TUid aAppUid) |
|
1499 { |
|
1500 //Scans and adds the specified application to the app list if found |
|
1501 __ASSERT_DEBUG(aFinder, Panic(EPanicNullPointer)); |
|
1502 TBool found = EFalse; |
|
1503 TApaAppEntry appEntry; |
|
1504 aFinder->FindAllAppsL(CApaAppRegFinder::EScanAllDrives); |
|
1505 while (aFinder->NextL(appEntry, *iForcedRegistrations)) |
|
1506 { |
|
1507 if (appEntry.iUidType[2] == aAppUid) |
|
1508 { |
|
1509 found = ETrue; |
|
1510 break; |
|
1511 } |
|
1512 } |
|
1513 |
|
1514 CApaAppData* app = NULL; |
|
1515 if (found) |
|
1516 { |
|
1517 // add the app to the list |
|
1518 TBool hasChanged = EFalse; |
|
1519 CApaAppData* prevFirstAppInList = iAppData; |
|
1520 UpdateNextAppL(appEntry, hasChanged); |
|
1521 if (iAppData != prevFirstAppInList) |
|
1522 app = iAppData; // assume the new app was added to the list |
|
1523 |
|
1524 if (hasChanged) |
|
1525 iFlags |= EAppListHasChanged; |
|
1526 } |
|
1527 |
|
1528 return app; |
|
1529 return NULL; |
|
1530 } |
|
1531 |
|
1532 #endif |
|
1533 |
|
1534 EXPORT_C TBool CApaAppList::IsIdleUpdateComplete() const |
|
1535 /** Tests whether an asynchronous update of the list is currently in progress. |
|
1536 |
|
1537 @return True if no asynchronous update of the list is currently in progress, |
|
1538 otherwise false. */ |
|
1539 { |
|
1540 return iAppIdler == NULL; |
|
1541 } |
|
1542 |
|
1543 |
|
1544 void CApaAppList::AddToList( CApaAppData* aAppData ) |
|
1545 { |
|
1546 __ASSERT_DEBUG(aAppData, Panic(EPanicNullPointer)); |
|
1547 aAppData->iNext=iAppData; |
|
1548 iAppData=aAppData; |
|
1549 |
|
1550 #ifdef APPARC_SHOW_TRACE |
|
1551 RDebug::Print(_L("[Apparc] Application with UID: %X is added to applist"), aAppData->iUidType[2]); |
|
1552 #endif |
|
1553 |
|
1554 } |
|
1555 |
|
1556 |
806 |
1557 EXPORT_C TInt CApaAppList::Count() const |
807 EXPORT_C TInt CApaAppList::Count() const |
1558 /** Gets the count of applications present in the app list. |
808 /** Gets the count of applications present in the app list. |
1559 |
809 |
1560 @return The number of applications in the list. */ |
810 @return The number of applications in the list. */ |