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