24 #include <u32hal.h> |
24 #include <u32hal.h> |
25 #include "apsserv.h" |
25 #include "apsserv.h" |
26 #include "APFREC.H" |
26 #include "APFREC.H" |
27 #include "APSSES.H" |
27 #include "APSSES.H" |
28 #include "APSSTD.H" |
28 #include "APSSTD.H" |
|
29 #include "../aplist/aplappregfinder.h" |
29 #include "../aplist/aplapplistitem.h" |
30 #include "../aplist/aplapplistitem.h" |
30 #include "APSSCAN.H" |
31 #include "APSSCAN.H" |
31 #include "APSSTD.H" |
32 #include "APSSTD.H" |
32 #include "APASVST.H" |
33 #include "APASVST.H" |
33 #include <datastor.h> |
34 #include <datastor.h> |
34 #include "APSRECCACHE.h" |
35 #include "APSRECCACHE.h" |
|
36 #include "apsnnapps.h" |
|
37 #include "../apfile/apinstallationmonitor.h" |
35 #include "../apgrfx/apprivate.h" |
38 #include "../apgrfx/apprivate.h" |
36 #include "apgnotif.h" |
39 #include "apgnotif.h" |
37 |
40 |
38 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
39 #include<usif/scr/scr.h> |
|
40 #include<usif/scr/appregentries.h> |
|
41 #include<swi/sisregistrysession.h> |
|
42 #else |
|
43 #include "../aplist/aplappregfinder.h" |
|
44 #include "apsnnapps.h" |
|
45 #include "../apfile/apinstallationmonitor.h" |
|
46 #endif |
|
47 |
|
48 |
|
49 _LIT(KAppArcServerSemaphore,"AppArcServerSemaphore"); |
41 _LIT(KAppArcServerSemaphore,"AppArcServerSemaphore"); |
50 _LIT(KAppArcServerThread,"AppArcServerThread"); |
42 _LIT(KAppArcServerThread,"AppArcServerThread"); |
51 |
|
52 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
53 _LIT(KAppRegistrationFileImportLocation, "?:\\private\\10003a3f\\import\\apps\\"); |
43 _LIT(KAppRegistrationFileImportLocation, "?:\\private\\10003a3f\\import\\apps\\"); |
54 _LIT(KAppResourceAppsLocation, "?:\\resource\\apps\\"); |
44 _LIT(KAppResourceAppsLocation, "?:\\resource\\apps\\"); |
55 _LIT(KNonNativeApplicationTypeRegistry, ":\\private\\10003a3f\\NonNativeTypes.dat"); |
45 _LIT(KNonNativeApplicationTypeRegistry, ":\\private\\10003a3f\\NonNativeTypes.dat"); |
56 |
|
57 //To monitor all drives. |
|
58 const TInt KApaMonitorAllDrives = 0x3FFFFFF; |
|
59 #endif |
|
60 |
46 |
61 /* |
47 /* |
62 * patchable const data values defined in ApsConstData.cpp |
48 * patchable const data values defined in ApsConstData.cpp |
63 */ |
49 */ |
64 |
50 |
148 CApaAppArcServer::CApaAppArcServer(TInt aPriority) |
137 CApaAppArcServer::CApaAppArcServer(TInt aPriority) |
149 : CPolicyServer(aPriority,KApaServPolicy), |
138 : CPolicyServer(aPriority,KApaServPolicy), |
150 iAppList(0), |
139 iAppList(0), |
151 iTypeStoreModified(0), |
140 iTypeStoreModified(0), |
152 iLoadRecognizersOnDemand(KApaLoadDataRecognizersOnDemand), |
141 iLoadRecognizersOnDemand(KApaLoadDataRecognizersOnDemand), |
153 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
142 iLoadMbmIconsOnDemand(KApaLoadMbmIconsOnDemand), |
154 iForceRegistrationStatus(EForceRegistrationNone), |
143 iForceRegistrationStatus(EForceRegistrationNone) |
155 #endif |
|
156 iLoadMbmIconsOnDemand(KApaLoadMbmIconsOnDemand) |
|
157 { |
144 { |
158 |
145 |
159 #ifdef __WINS__ |
146 #ifdef __WINS__ |
160 // KApaLoadDataRecognizersOnDemand and KApaloadIconsOnDemand are Rom patchable constants, |
147 // KApaLoadDataRecognizersOnDemand and KApaloadIconsOnDemand are Rom patchable constants, |
161 // so need an emulator equivalent |
148 // so need an emulator equivalent |
246 iRuleBasedPlugIns = CApaScanningRuleBasedPlugIns::NewL(); |
224 iRuleBasedPlugIns = CApaScanningRuleBasedPlugIns::NewL(); |
247 } |
225 } |
248 |
226 |
249 iAppList=CApaAppList::NewL(iFs, iLoadMbmIconsOnDemand, idlePeriodicDelay); // takes ownership of scanner |
227 iAppList=CApaAppList::NewL(iFs, iLoadMbmIconsOnDemand, idlePeriodicDelay); // takes ownership of scanner |
250 |
228 |
251 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
252 // If the phone rebooted halfway through processing updates, there will be a log file left |
229 // If the phone rebooted halfway through processing updates, there will be a log file left |
253 // look for one and recover if neccessary |
230 // look for one and recover if neccessary |
254 CApsNonNativeApplicationsManager::RecoverFromUpdateLogL(iFs); |
231 CApsNonNativeApplicationsManager::RecoverFromUpdateLogL(iFs); |
255 #endif |
|
256 |
232 |
257 iMimeTypeRecognizer=CApaScanningDataRecognizer::NewL(iFs, !iLoadRecognizersOnDemand); |
233 iMimeTypeRecognizer=CApaScanningDataRecognizer::NewL(iFs, !iLoadRecognizersOnDemand); |
258 |
234 |
259 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
260 ConstructPathsToMonitorL(); |
235 ConstructPathsToMonitorL(); |
261 |
236 |
262 if ( iAppFsMonitor ) |
237 if ( iAppFsMonitor ) |
263 { |
238 { |
264 iAppFsMonitor->Start(ENotifyFile); |
239 iAppFsMonitor->Start(ENotifyFile); |
265 iAppFsMonitor->SetBlocked(ETrue); |
240 iAppFsMonitor->SetBlocked(ETrue); |
266 } |
241 } |
267 #endif |
|
268 |
|
269 TRAP_IGNORE(iAppList->InitListL(this)); |
242 TRAP_IGNORE(iAppList->InitListL(this)); |
270 |
243 |
271 // |
244 // |
272 iRecEcomMonitor=CApaEComMonitor::NewL(TCallBack(&PlugInNotifyCallBack,this)); |
245 iRecEcomMonitor=CApaEComMonitor::NewL(TCallBack(&PlugInNotifyCallBack,this)); |
273 iRecEcomMonitor->Start(); |
246 iRecEcomMonitor->Start(); |
285 |
258 |
286 // |
259 // |
287 iBaBackupSessionWrapper=CBaBackupSessionWrapper::NewL(); |
260 iBaBackupSessionWrapper=CBaBackupSessionWrapper::NewL(); |
288 iBaBackupSessionWrapper->RegisterBackupOperationObserverL(*((MBackupOperationObserver*)this)); |
261 iBaBackupSessionWrapper->RegisterBackupOperationObserverL(*((MBackupOperationObserver*)this)); |
289 |
262 |
290 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
263 // |
291 TRAP_IGNORE(InitNonNativeApplicationTypeArrayL()); |
264 TChar sysDrive = RFs::GetSystemDriveChar(); |
292 #else |
265 TInt maxSizeofFileName = KNonNativeApplicationTypeRegistry().Length() + 1; |
293 // |
266 iNonNativeApplicationTypeRegistry.CreateL(maxSizeofFileName); |
294 TChar sysDrive = RFs::GetSystemDriveChar(); |
267 iNonNativeApplicationTypeRegistry.Append(sysDrive); |
295 TInt maxSizeofFileName = KNonNativeApplicationTypeRegistry().Length() + 1; |
268 iNonNativeApplicationTypeRegistry.Append(KNonNativeApplicationTypeRegistry()); |
296 iNonNativeApplicationTypeRegistry.CreateL(maxSizeofFileName); |
269 |
297 iNonNativeApplicationTypeRegistry.Append(sysDrive); |
270 TRAP_IGNORE(InternalizeNonNativeApplicationTypeArrayL()); // We don't want a corrupt file to prevent from starting |
298 iNonNativeApplicationTypeRegistry.Append(KNonNativeApplicationTypeRegistry()); |
|
299 |
|
300 TRAP_IGNORE(InternalizeNonNativeApplicationTypeArrayL()); // We don't want a corrupt file to prevent from starting |
|
301 #endif |
|
302 |
|
303 if(iLoadRecognizersOnDemand) |
271 if(iLoadRecognizersOnDemand) |
304 iRecognizerUnloadTimer=CPeriodic::NewL(EPriorityNormal); |
272 iRecognizerUnloadTimer=CPeriodic::NewL(EPriorityNormal); |
305 |
273 |
306 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
274 // |
307 iAppInstallationMonitor = CApaAppInstallationMonitor::NewL(this); |
275 iAppInstallationMonitor = CApaAppInstallationMonitor::NewL(this); |
308 iAppInstallationMonitor->Start(); |
276 iAppInstallationMonitor->Start(); |
309 #endif |
277 } |
310 } |
278 |
311 |
|
312 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
313 void CApaAppArcServer::ConstructPathsToMonitorL() |
279 void CApaAppArcServer::ConstructPathsToMonitorL() |
314 { |
280 { |
315 TInt drivesToMonitor = KApaDrivesToMonitor; |
281 TInt drivesToMonitor = KApaDrivesToMonitor; |
316 #ifdef __WINS__ |
282 #ifdef __WINS__ |
317 // KApaDrivesToMonitor is a Rom patchable constant, so need an emulator equivalent |
283 // KApaDrivesToMonitor is a Rom patchable constant, so need an emulator equivalent |
369 { |
335 { |
370 iAppFsMonitor=CApaFsMonitor::NewL(iFs, KAppRegistrationFileImportLocation, TCallBack(&AppFsNotifyCallBack, this)); |
336 iAppFsMonitor=CApaFsMonitor::NewL(iFs, KAppRegistrationFileImportLocation, TCallBack(&AppFsNotifyCallBack, this)); |
371 iAppFsMonitor->AddLocationL(KAppResourceAppsLocation); |
337 iAppFsMonitor->AddLocationL(KAppResourceAppsLocation); |
372 } |
338 } |
373 } |
339 } |
374 #endif |
340 |
375 |
|
376 EXPORT_C CApaAppArcServer::~CApaAppArcServer() |
341 EXPORT_C CApaAppArcServer::~CApaAppArcServer() |
377 { |
342 { |
378 if(iBaBackupSessionWrapper) |
343 if(iBaBackupSessionWrapper) |
379 iBaBackupSessionWrapper->DeRegisterBackupOperationObserver(*this); |
344 iBaBackupSessionWrapper->DeRegisterBackupOperationObserver(*this); |
380 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
381 delete iAppInstallationMonitor; |
345 delete iAppInstallationMonitor; |
382 delete iAppFsMonitor; |
|
383 iNonNativeApplicationTypeRegistry.Close(); |
|
384 #endif |
|
385 delete iAppList; // deletes scanners |
346 delete iAppList; // deletes scanners |
386 delete iMimeTypeRecognizer; |
347 delete iMimeTypeRecognizer; |
387 delete iMimeTypeToAppMappingsManager; |
348 delete iMimeTypeToAppMappingsManager; |
|
349 delete iAppFsMonitor; |
388 delete iTypeStoreMonitor; |
350 delete iTypeStoreMonitor; |
389 delete iBaBackupSessionWrapper; |
351 delete iBaBackupSessionWrapper; |
390 delete iRecognitionCache; |
352 delete iRecognitionCache; |
391 delete iRecEcomMonitor; |
353 delete iRecEcomMonitor; |
392 |
354 |
520 |
478 |
521 //If service registry is modified, store it to a file |
479 //If service registry is modified, store it to a file |
522 if(modificationStatus) |
480 if(modificationStatus) |
523 TRAP_IGNORE(iMimeTypeToAppMappingsManager->StoreL()); |
481 TRAP_IGNORE(iMimeTypeToAppMappingsManager->StoreL()); |
524 } |
482 } |
525 |
483 |
526 // iterate through sessions |
484 // iterate through sessions |
527 iSessionIter.SetToFirst(); |
485 iSessionIter.SetToFirst(); |
528 CApaAppArcServSession* ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
486 CApaAppArcServSession* ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
529 |
|
530 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
531 //Get the updated application information from iAppList |
|
532 CArrayFixFlat<TApaAppUpdateInfo>* updatedAppsInfo=iAppList->UpdatedAppsInfo(); |
|
533 |
|
534 while (ses!=NULL) |
|
535 { |
|
536 //Call session object NotifyClients and pass the updated application information. |
|
537 ses->NotifyClients(aReason, updatedAppsInfo); |
|
538 ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
|
539 } |
|
540 #else |
|
541 |
|
542 while (ses!=NULL) |
487 while (ses!=NULL) |
543 { |
488 { |
544 if(iForceRegistrationStatus & EForceRegistrationRequested) |
489 if(iForceRegistrationStatus & EForceRegistrationRequested) |
545 { |
490 { |
546 //Notify clients about completion of force registration. |
491 //Notify clients about completion of force registration. |
630 { |
574 { |
631 case MBackupOperationObserver::ENone: |
575 case MBackupOperationObserver::ENone: |
632 case MBackupOperationObserver::EAbort: |
576 case MBackupOperationObserver::EAbort: |
633 break; |
577 break; |
634 case MBackupOperationObserver::EStart: |
578 case MBackupOperationObserver::EStart: |
635 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
636 if ( iAppFsMonitor ) |
579 if ( iAppFsMonitor ) |
637 { |
580 { |
638 iAppFsMonitor->SetBlocked(ETrue); |
581 iAppFsMonitor->SetBlocked(ETrue); |
639 } |
582 } |
640 #endif |
|
641 break; |
583 break; |
642 case MBackupOperationObserver::EEnd: |
584 case MBackupOperationObserver::EEnd: |
643 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
644 if ( iAppFsMonitor ) |
585 if ( iAppFsMonitor ) |
645 { |
586 { |
646 iAppFsMonitor->SetBlocked(EFalse); |
587 iAppFsMonitor->SetBlocked(EFalse); |
647 } |
588 } |
648 #endif |
|
649 break; |
589 break; |
650 default: |
590 default: |
651 Panic(EEventFromBackupObserverError); |
591 Panic(EEventFromBackupObserverError); |
652 break; |
592 break; |
653 } |
593 } |
654 } |
594 } |
655 |
595 |
656 void CApaAppArcServer::InitialListPopulationComplete() |
596 void CApaAppArcServer::InitialListPopulationComplete() |
657 { |
597 { |
658 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
659 if ( iAppFsMonitor ) |
598 if ( iAppFsMonitor ) |
660 { |
599 { |
661 iAppFsMonitor->SetBlocked(EFalse); |
600 iAppFsMonitor->SetBlocked(EFalse); |
662 } |
601 } |
663 #endif |
|
664 |
602 |
665 // notify clients (whoever is interested) that initial population of list is completed |
603 // notify clients (whoever is interested) that initial population of list is completed |
666 iSessionIter.SetToFirst(); |
604 iSessionIter.SetToFirst(); |
667 CApaAppArcServSession* ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
605 CApaAppArcServSession* ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
668 // iterate through sessions |
606 // iterate through sessions |
671 ses->NotifyClientForCompletionOfListPopulation(); |
609 ses->NotifyClientForCompletionOfListPopulation(); |
672 ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
610 ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++)); |
673 } |
611 } |
674 } |
612 } |
675 |
613 |
676 |
|
677 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
678 |
|
679 /* |
|
680 * Cleanup RPointerArray |
|
681 */ |
|
682 void CleanupAndDestroyLauncherArray(TAny* aRPrray) |
|
683 { |
|
684 RPointerArray<Usif::CLauncherExecutable>* rpArray = (static_cast<RPointerArray<Usif::CLauncherExecutable>*>(aRPrray)); |
|
685 rpArray->ResetAndDestroy(); |
|
686 rpArray->Close(); |
|
687 } |
|
688 |
|
689 |
|
690 /* |
|
691 * Gets non-native type to its run time mapping information from SCR and initialzes |
|
692 * a mapping array |
|
693 */ |
|
694 void CApaAppArcServer::InitNonNativeApplicationTypeArrayL() |
|
695 { |
|
696 Usif::RSoftwareComponentRegistry scrSession; |
|
697 User::LeaveIfError(scrSession.Connect()); |
|
698 CleanupClosePushL(scrSession); |
|
699 |
|
700 RPointerArray<Usif::CLauncherExecutable> launchers; |
|
701 //Get non-native type to its run-time mappings |
|
702 scrSession.GetApplicationLaunchersL(launchers); |
|
703 TCleanupItem cleanup(CleanupAndDestroyLauncherArray, &launchers); |
|
704 CleanupStack::PushL(cleanup); |
|
705 |
|
706 //Get each mapping and add it to mapping array |
|
707 for(TInt index=0;index<launchers.Count();index++) |
|
708 { |
|
709 Usif::CLauncherExecutable* launcherInfo=launchers[index]; |
|
710 SNonNativeApplicationType nonNativeApplicationType; |
|
711 nonNativeApplicationType.iTypeUid.iUid=launcherInfo->TypeId(); |
|
712 nonNativeApplicationType.iNativeExecutable=launcherInfo->Launcher().AllocLC(); |
|
713 iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType); |
|
714 CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable); |
|
715 } |
|
716 CleanupStack::PopAndDestroy(2, &scrSession); |
|
717 } |
|
718 |
|
719 void CApaAppArcServer::UpdateAppListL(RArray<TApaAppUpdateInfo>* aAppUpdateInfo, TUid aSecureID) |
|
720 { |
|
721 iAppList->UpdateApplistL(this, aAppUpdateInfo, aSecureID); |
|
722 } |
|
723 #else |
|
724 |
|
725 void CApaAppArcServer::RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable) |
614 void CApaAppArcServer::RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable) |
726 { |
615 { |
727 for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i) |
616 for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i) |
728 { |
617 { |
729 if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid) |
618 if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid) |
730 User::Leave(KErrAlreadyExists); |
619 User::Leave(KErrAlreadyExists); |
731 } |
620 } |
732 |
621 |
733 SNonNativeApplicationType nonNativeApplicationType; |
622 SNonNativeApplicationType nonNativeApplicationType; |
734 nonNativeApplicationType.iTypeUid.iUid=aApplicationType.iUid; |
623 nonNativeApplicationType.iTypeUid.iUid=aApplicationType.iUid; |
735 nonNativeApplicationType.iNativeExecutable=aNativeExecutable.AllocLC(); |
624 nonNativeApplicationType.iNativeExecutable=aNativeExecutable.AllocLC(); |
736 iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType); |
625 iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType); |
737 CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable); |
626 CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable); |
738 CleanupStack::PushL(TCleanupItem(DeleteLastNonNativeApplicationType, this)); |
627 CleanupStack::PushL(TCleanupItem(DeleteLastNonNativeApplicationType, this)); |
739 ExternalizeNonNativeApplicationTypeArrayL(); |
628 ExternalizeNonNativeApplicationTypeArrayL(); |
740 CleanupStack::Pop(this); // the TCleanupItem |
629 CleanupStack::Pop(this); // the TCleanupItem |
741 } |
630 } |
742 |
631 |
743 void CApaAppArcServer::DeregisterNonNativeApplicationTypeL(TUid aApplicationType) |
632 void CApaAppArcServer::DeregisterNonNativeApplicationTypeL(TUid aApplicationType) |
744 { |
633 { |
745 TInt i; |
634 TInt i; |
746 for (i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i) |
635 for (i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i) |
747 { |
636 { |
748 if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid) |
637 if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid) |
749 break; |
638 break; |
750 } |
639 } |
751 |
640 |
752 if (i>=0) |
641 if (i>=0) |
753 { |
642 { |
754 ExternalizeNonNativeApplicationTypeArrayL(i); |
643 ExternalizeNonNativeApplicationTypeArrayL(i); |
755 delete iNonNativeApplicationTypeArray[i].iNativeExecutable; |
644 delete iNonNativeApplicationTypeArray[i].iNativeExecutable; |
756 iNonNativeApplicationTypeArray[i].iNativeExecutable = NULL; |
645 iNonNativeApplicationTypeArray[i].iNativeExecutable = NULL; |
757 iNonNativeApplicationTypeArray.Remove(i); |
646 iNonNativeApplicationTypeArray.Remove(i); |
758 } |
647 } |
759 } |
648 } |
760 |
649 |
761 void CApaAppArcServer::InternalizeNonNativeApplicationTypeArrayL() |
650 void CApaAppArcServer::InternalizeNonNativeApplicationTypeArrayL() |
762 { |
651 { |
763 RFile file; |
652 RFile file; |
764 CleanupClosePushL(file); |
653 CleanupClosePushL(file); |
782 } |
671 } |
783 |
672 |
784 CleanupStack::PopAndDestroy(&file); |
673 CleanupStack::PopAndDestroy(&file); |
785 } |
674 } |
786 |
675 |
787 |
|
788 void CApaAppArcServer::ExternalizeNonNativeApplicationTypeArrayL(TInt aIndexToIgnore/*=-1*/) const |
676 void CApaAppArcServer::ExternalizeNonNativeApplicationTypeArrayL(TInt aIndexToIgnore/*=-1*/) const |
789 { |
677 { |
790 RFs& fs=const_cast<RFs&>(iFs); |
678 RFs& fs=const_cast<RFs&>(iFs); |
791 fs.MkDirAll(iNonNativeApplicationTypeRegistry); // ignore any error |
679 fs.MkDirAll(iNonNativeApplicationTypeRegistry); // ignore any error |
792 RFile file; |
680 RFile file; |
793 CleanupClosePushL(file); |
681 CleanupClosePushL(file); |
794 User::LeaveIfError(file.Replace(fs, iNonNativeApplicationTypeRegistry, EFileShareExclusive|EFileStream|EFileWrite)); |
682 User::LeaveIfError(file.Replace(fs, iNonNativeApplicationTypeRegistry, EFileShareExclusive|EFileStream|EFileWrite)); |
795 RFileWriteStream targetStream; |
683 RFileWriteStream targetStream; |
796 targetStream.Attach(file); // file gets closed by this call, but that's okay, we don't need it any more (targetStream has its own copy of this RFile object that it owns) |
684 targetStream.Attach(file); // file gets closed by this call, but that's okay, we don't need it any more (targetStream has its own copy of this RFile object that it owns) |
797 CleanupClosePushL(targetStream); |
685 CleanupClosePushL(targetStream); |
798 const TInt arrayCount(iNonNativeApplicationTypeArray.Count()); |
686 const TInt arrayCount(iNonNativeApplicationTypeArray.Count()); |
799 TInt arrayCountToExternalize=arrayCount; |
687 TInt arrayCountToExternalize=arrayCount; |
800 if (aIndexToIgnore>=0) |
688 if (aIndexToIgnore>=0) |
801 --arrayCountToExternalize; |
689 --arrayCountToExternalize; |
802 |
690 |
803 TCardinality(arrayCountToExternalize).ExternalizeL(targetStream); |
691 TCardinality(arrayCountToExternalize).ExternalizeL(targetStream); |
804 for (TInt i=0; i<arrayCount; ++i) |
692 for (TInt i=0; i<arrayCount; ++i) |
805 { |
693 { |
806 if (i!=aIndexToIgnore) |
694 if (i!=aIndexToIgnore) |
807 { |
695 { |
808 const SNonNativeApplicationType& nonNativeApplicationType=iNonNativeApplicationTypeArray[i]; |
696 const SNonNativeApplicationType& nonNativeApplicationType=iNonNativeApplicationTypeArray[i]; |
809 targetStream.WriteUint32L(nonNativeApplicationType.iTypeUid.iUid); |
697 targetStream.WriteUint32L(nonNativeApplicationType.iTypeUid.iUid); |
810 targetStream << *nonNativeApplicationType.iNativeExecutable; |
698 targetStream << *nonNativeApplicationType.iNativeExecutable; |
811 } |
699 } |
812 } |
700 } |
813 |
701 |
814 targetStream.CommitL(); |
702 targetStream.CommitL(); |
815 CleanupStack::PopAndDestroy(2, &file); |
703 CleanupStack::PopAndDestroy(2, &file); |
816 } |
704 } |
817 #endif |
705 |
818 |
706 TPtrC CApaAppArcServer::NativeExecutableL(TUid aNonNativeApplicationType) const |
819 TPtrC CApaAppArcServer::NativeExecutableL(TUid aNonNativeApplicationType) |
|
820 { |
707 { |
821 for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i) |
708 for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i) |
822 { |
709 { |
823 const SNonNativeApplicationType& nonNativeApplicationType=iNonNativeApplicationTypeArray[i]; |
710 const SNonNativeApplicationType& nonNativeApplicationType=iNonNativeApplicationTypeArray[i]; |
824 if (nonNativeApplicationType.iTypeUid.iUid==aNonNativeApplicationType.iUid) |
711 if (nonNativeApplicationType.iTypeUid.iUid==aNonNativeApplicationType.iUid) |
825 return *nonNativeApplicationType.iNativeExecutable; |
712 return *nonNativeApplicationType.iNativeExecutable; |
826 } |
713 } |
827 |
714 |
828 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
829 //If the mapping is not available in the list, search in SCR and add it to the list. |
|
830 TPtrC nativeExecutableName=FindAndAddNonNativeRuntimeMappingL(aNonNativeApplicationType); |
|
831 if(nativeExecutableName==KNullDesC()) |
|
832 User::Leave(KErrNotSupported); // not KErrNotFound |
|
833 |
|
834 return nativeExecutableName; |
|
835 #else |
|
836 User::Leave(KErrNotSupported); // not KErrNotFound |
715 User::Leave(KErrNotSupported); // not KErrNotFound |
837 return KNullDesC(); |
716 return KNullDesC(); |
838 #endif |
717 } |
839 } |
|
840 |
|
841 |
|
842 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
843 TPtrC CApaAppArcServer::FindAndAddNonNativeRuntimeMappingL(TUid aNonNativeApplicationType) |
|
844 { |
|
845 //If non-native type to its runtime is not available search in SCR and update in list |
|
846 Usif::RSoftwareComponentRegistry scrSession; |
|
847 User::LeaveIfError(scrSession.Connect()); |
|
848 CleanupClosePushL(scrSession); |
|
849 |
|
850 RPointerArray<Usif::CLauncherExecutable> launchers; |
|
851 //Get non-native type to its run-time mappings |
|
852 scrSession.GetApplicationLaunchersL(launchers); |
|
853 TCleanupItem cleanup(CleanupAndDestroyLauncherArray, &launchers); |
|
854 CleanupStack::PushL(cleanup); |
|
855 |
|
856 //Search for mapping and add it mapping list. |
|
857 for(TInt index=0;index<launchers.Count();index++) |
|
858 { |
|
859 Usif::CLauncherExecutable* launcherInfo=launchers[index]; |
|
860 if(aNonNativeApplicationType.iUid==launcherInfo->TypeId()) |
|
861 { |
|
862 SNonNativeApplicationType nonNativeApplicationType; |
|
863 nonNativeApplicationType.iTypeUid.iUid=launcherInfo->TypeId(); |
|
864 nonNativeApplicationType.iNativeExecutable=launcherInfo->Launcher().AllocLC(); |
|
865 iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType); |
|
866 CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable); |
|
867 CleanupStack::PopAndDestroy(2, &scrSession); |
|
868 return *nonNativeApplicationType.iNativeExecutable; |
|
869 } |
|
870 } |
|
871 |
|
872 CleanupStack::PopAndDestroy(2, &scrSession); |
|
873 return KNullDesC(); |
|
874 } |
|
875 #endif |
|
876 |
718 |
877 void CApaAppArcServer::DeleteLastNonNativeApplicationType(TAny* aThis) |
719 void CApaAppArcServer::DeleteLastNonNativeApplicationType(TAny* aThis) |
878 { // static |
720 { // static |
879 CApaAppArcServer& self=*static_cast<CApaAppArcServer*>(aThis); |
721 CApaAppArcServer& self=*static_cast<CApaAppArcServer*>(aThis); |
880 const TInt arrayIndex=self.iNonNativeApplicationTypeArray.Count()-1; |
722 const TInt arrayIndex=self.iNonNativeApplicationTypeArray.Count()-1; |