--- a/appfw/apparchitecture/apserv/APSSERV.CPP Thu Aug 19 10:05:08 2010 +0300
+++ b/appfw/apparchitecture/apserv/APSSERV.CPP Tue Aug 31 15:24:25 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
@@ -26,24 +26,38 @@
#include "APFREC.H"
#include "APSSES.H"
#include "APSSTD.H"
-#include "../aplist/aplappregfinder.h"
#include "../aplist/aplapplistitem.h"
#include "APSSCAN.H"
#include "APSSTD.H"
#include "APASVST.H"
#include <datastor.h>
#include "APSRECCACHE.h"
-#include "apsnnapps.h"
-#include "../apfile/apinstallationmonitor.h"
#include "../apgrfx/apprivate.h"
#include "apgnotif.h"
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+#include<usif/scr/scr.h>
+#include<usif/scr/appregentries.h>
+#include<swi/sisregistrysession.h>
+#else
+#include "../aplist/aplappregfinder.h"
+#include "apsnnapps.h"
+#include "../apfile/apinstallationmonitor.h"
+#endif
+
+
_LIT(KAppArcServerSemaphore,"AppArcServerSemaphore");
_LIT(KAppArcServerThread,"AppArcServerThread");
+
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
_LIT(KAppRegistrationFileImportLocation, "?:\\private\\10003a3f\\import\\apps\\");
_LIT(KAppResourceAppsLocation, "?:\\resource\\apps\\");
_LIT(KNonNativeApplicationTypeRegistry, ":\\private\\10003a3f\\NonNativeTypes.dat");
+//To monitor all drives.
+const TInt KApaMonitorAllDrives = 0x3FFFFFF;
+#endif
+
/*
* patchable const data values defined in ApsConstData.cpp
*/
@@ -55,9 +69,6 @@
const TUint8 KPolicyElementWriteDeviceData = 0;
-//To monitor all drives.
-const TInt KApaMonitorAllDrives = 0x3FFFFFF;
-
const TUint KRangeCount = 3;
const TInt KAppListServRanges[KRangeCount] =
@@ -139,8 +150,10 @@
iAppList(0),
iTypeStoreModified(0),
iLoadRecognizersOnDemand(KApaLoadDataRecognizersOnDemand),
- iLoadMbmIconsOnDemand(KApaLoadMbmIconsOnDemand),
- iForceRegistrationStatus(EForceRegistrationNone)
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+ iForceRegistrationStatus(EForceRegistrationNone),
+#endif
+ iLoadMbmIconsOnDemand(KApaLoadMbmIconsOnDemand)
{
#ifdef __WINS__
@@ -163,7 +176,16 @@
StartL(KAppListServerName);
User::LeaveIfError(Dll::SetTls(this));
User::LeaveIfError(iFs.Connect());
-
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+ //Connect to sisregistrysession to initially populate the applications information and
+ //store it to SCR.
+ Swi::RSisRegistrySession sisReg;
+ sisReg.Connect();
+ sisReg.Close();
+#endif
+
+
// Get the idle timeout delay from the commandline if specified. The default is 50000ms
const TInt cmdLineLen = User::CommandLineLength();
TInt idlePeriodicDelay=50000; //default value
@@ -226,12 +248,15 @@
iAppList=CApaAppList::NewL(iFs, iLoadMbmIconsOnDemand, idlePeriodicDelay); // takes ownership of scanner
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
// If the phone rebooted halfway through processing updates, there will be a log file left
// look for one and recover if neccessary
CApsNonNativeApplicationsManager::RecoverFromUpdateLogL(iFs);
+#endif
iMimeTypeRecognizer=CApaScanningDataRecognizer::NewL(iFs, !iLoadRecognizersOnDemand);
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
ConstructPathsToMonitorL();
if ( iAppFsMonitor )
@@ -239,6 +264,8 @@
iAppFsMonitor->Start(ENotifyFile);
iAppFsMonitor->SetBlocked(ETrue);
}
+#endif
+
TRAP_IGNORE(iAppList->InitListL(this));
//
@@ -260,22 +287,29 @@
iBaBackupSessionWrapper=CBaBackupSessionWrapper::NewL();
iBaBackupSessionWrapper->RegisterBackupOperationObserverL(*((MBackupOperationObserver*)this));
- //
- TChar sysDrive = RFs::GetSystemDriveChar();
- TInt maxSizeofFileName = KNonNativeApplicationTypeRegistry().Length() + 1;
- iNonNativeApplicationTypeRegistry.CreateL(maxSizeofFileName);
- iNonNativeApplicationTypeRegistry.Append(sysDrive);
- iNonNativeApplicationTypeRegistry.Append(KNonNativeApplicationTypeRegistry());
-
- TRAP_IGNORE(InternalizeNonNativeApplicationTypeArrayL()); // We don't want a corrupt file to prevent from starting
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+ TRAP_IGNORE(InitNonNativeApplicationTypeArrayL());
+#else
+ //
+ TChar sysDrive = RFs::GetSystemDriveChar();
+ TInt maxSizeofFileName = KNonNativeApplicationTypeRegistry().Length() + 1;
+ iNonNativeApplicationTypeRegistry.CreateL(maxSizeofFileName);
+ iNonNativeApplicationTypeRegistry.Append(sysDrive);
+ iNonNativeApplicationTypeRegistry.Append(KNonNativeApplicationTypeRegistry());
+
+ TRAP_IGNORE(InternalizeNonNativeApplicationTypeArrayL()); // We don't want a corrupt file to prevent from starting
+#endif
+
if(iLoadRecognizersOnDemand)
iRecognizerUnloadTimer=CPeriodic::NewL(EPriorityNormal);
- //
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
iAppInstallationMonitor = CApaAppInstallationMonitor::NewL(this);
iAppInstallationMonitor->Start();
+#endif
}
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
void CApaAppArcServer::ConstructPathsToMonitorL()
{
TInt drivesToMonitor = KApaDrivesToMonitor;
@@ -337,16 +371,20 @@
iAppFsMonitor->AddLocationL(KAppResourceAppsLocation);
}
}
-
+#endif
+
EXPORT_C CApaAppArcServer::~CApaAppArcServer()
{
if(iBaBackupSessionWrapper)
iBaBackupSessionWrapper->DeRegisterBackupOperationObserver(*this);
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
delete iAppInstallationMonitor;
+ delete iAppFsMonitor;
+ iNonNativeApplicationTypeRegistry.Close();
+#endif
delete iAppList; // deletes scanners
delete iMimeTypeRecognizer;
delete iMimeTypeToAppMappingsManager;
- delete iAppFsMonitor;
delete iTypeStoreMonitor;
delete iBaBackupSessionWrapper;
delete iRecognitionCache;
@@ -361,9 +399,9 @@
iNonNativeApplicationTypeArray.Close();
delete iRecognizerUnloadTimer;
- iNonNativeApplicationTypeRegistry.Close();
}
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
EXPORT_C void CApaAppArcServer::HandleInstallationStartEvent()
{
if ( iAppFsMonitor )
@@ -381,6 +419,7 @@
}
AppList().RestartScanL();
}
+#endif
CSession2* CApaAppArcServer::NewSessionL(const TVersion& aVersion,const RMessage2&/* aMessage*/) const
// Create a new server session.
@@ -396,7 +435,7 @@
//
// scanning code here
//
-
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
EXPORT_C TCallBack CApaAppArcServer::RescanCallBack()
{
return TCallBack(&AppFsNotifyWithForcedRegistrationsResetCallBack,this);
@@ -415,6 +454,7 @@
reinterpret_cast<CApaAppArcServer*>(aObject)->UpdateApps();
return KErrNone;
}
+#endif
TInt CApaAppArcServer::PlugInNotifyCallBack(TAny* aObject)
{
@@ -431,6 +471,7 @@
return KErrNone;
}
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
void CApaAppArcServer::UpdateApps()
// update the list
{
@@ -446,7 +487,8 @@
{
iForceRegistrationStatus|=EForceRegistrationRequested;
UpdateApps();
- }
+ }
+#endif
void CApaAppArcServer::NotifyUpdate(TInt aReason)
// tell all sessions to update their clients
@@ -480,10 +522,23 @@
if(modificationStatus)
TRAP_IGNORE(iMimeTypeToAppMappingsManager->StoreL());
}
-
+
// iterate through sessions
iSessionIter.SetToFirst();
CApaAppArcServSession* ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++));
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+ //Get the updated application information from iAppList
+ CArrayFixFlat<TApaAppUpdateInfo>* updatedAppsInfo=iAppList->UpdatedAppsInfo();
+
+ while (ses!=NULL)
+ {
+ //Call session object NotifyClients and pass the updated application information.
+ ses->NotifyClients(aReason, updatedAppsInfo);
+ ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++));
+ }
+#else
+
while (ses!=NULL)
{
if(iForceRegistrationStatus & EForceRegistrationRequested)
@@ -510,6 +565,7 @@
//If this function is called not because of force registration, clear force registration applist change status.
iForceRegistrationStatus &= (~EForceRegistrationAppListChanged);
}
+#endif
}
void CApaAppArcServer::UpdatePlugIns()
@@ -576,16 +632,20 @@
case MBackupOperationObserver::EAbort:
break;
case MBackupOperationObserver::EStart:
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
if ( iAppFsMonitor )
{
iAppFsMonitor->SetBlocked(ETrue);
}
+#endif
break;
case MBackupOperationObserver::EEnd:
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
if ( iAppFsMonitor )
{
iAppFsMonitor->SetBlocked(EFalse);
}
+#endif
break;
default:
Panic(EEventFromBackupObserverError);
@@ -595,10 +655,12 @@
void CApaAppArcServer::InitialListPopulationComplete()
{
+#ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
if ( iAppFsMonitor )
{
iAppFsMonitor->SetBlocked(EFalse);
}
+#endif
// notify clients (whoever is interested) that initial population of list is completed
iSessionIter.SetToFirst();
@@ -611,41 +673,90 @@
}
}
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+
+/*
+ * Cleanup RPointerArray
+ */
+void CleanupAndDestroyLauncherArray(TAny* aRPrray)
+ {
+ RPointerArray<Usif::CLauncherExecutable>* rpArray = (static_cast<RPointerArray<Usif::CLauncherExecutable>*>(aRPrray));
+ rpArray->ResetAndDestroy();
+ rpArray->Close();
+ }
+
+
+/*
+ * Gets non-native type to its run time mapping information from SCR and initialzes
+ * a mapping array
+ */
+void CApaAppArcServer::InitNonNativeApplicationTypeArrayL()
+ {
+ Usif::RSoftwareComponentRegistry scrSession;
+ User::LeaveIfError(scrSession.Connect());
+ CleanupClosePushL(scrSession);
+
+ RPointerArray<Usif::CLauncherExecutable> launchers;
+ //Get non-native type to its run-time mappings
+ scrSession.GetApplicationLaunchersL(launchers);
+ TCleanupItem cleanup(CleanupAndDestroyLauncherArray, &launchers);
+ CleanupStack::PushL(cleanup);
+
+ //Get each mapping and add it to mapping array
+ for(TInt index=0;index<launchers.Count();index++)
+ {
+ Usif::CLauncherExecutable* launcherInfo=launchers[index];
+ SNonNativeApplicationType nonNativeApplicationType;
+ nonNativeApplicationType.iTypeUid.iUid=launcherInfo->TypeId();
+ nonNativeApplicationType.iNativeExecutable=launcherInfo->Launcher().AllocLC();
+ iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType);
+ CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable);
+ }
+ CleanupStack::PopAndDestroy(2, &scrSession);
+ }
+
+void CApaAppArcServer::UpdateAppListL(RArray<TApaAppUpdateInfo>* aAppUpdateInfo, TUid aSecureID)
+{
+ iAppList->UpdateApplistL(this, aAppUpdateInfo, aSecureID);
+}
+#else
+
void CApaAppArcServer::RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable)
- {
- for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i)
- {
- if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid)
- User::Leave(KErrAlreadyExists);
- }
-
- SNonNativeApplicationType nonNativeApplicationType;
- nonNativeApplicationType.iTypeUid.iUid=aApplicationType.iUid;
- nonNativeApplicationType.iNativeExecutable=aNativeExecutable.AllocLC();
- iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType);
- CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable);
- CleanupStack::PushL(TCleanupItem(DeleteLastNonNativeApplicationType, this));
- ExternalizeNonNativeApplicationTypeArrayL();
- CleanupStack::Pop(this); // the TCleanupItem
- }
+ {
+ for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i)
+ {
+ if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid)
+ User::Leave(KErrAlreadyExists);
+ }
+
+ SNonNativeApplicationType nonNativeApplicationType;
+ nonNativeApplicationType.iTypeUid.iUid=aApplicationType.iUid;
+ nonNativeApplicationType.iNativeExecutable=aNativeExecutable.AllocLC();
+ iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType);
+ CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable);
+ CleanupStack::PushL(TCleanupItem(DeleteLastNonNativeApplicationType, this));
+ ExternalizeNonNativeApplicationTypeArrayL();
+ CleanupStack::Pop(this); // the TCleanupItem
+ }
void CApaAppArcServer::DeregisterNonNativeApplicationTypeL(TUid aApplicationType)
- {
- TInt i;
- for (i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i)
- {
- if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid)
- break;
- }
-
- if (i>=0)
- {
- ExternalizeNonNativeApplicationTypeArrayL(i);
- delete iNonNativeApplicationTypeArray[i].iNativeExecutable;
- iNonNativeApplicationTypeArray[i].iNativeExecutable = NULL;
- iNonNativeApplicationTypeArray.Remove(i);
- }
- }
+ {
+ TInt i;
+ for (i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i)
+ {
+ if (iNonNativeApplicationTypeArray[i].iTypeUid.iUid==aApplicationType.iUid)
+ break;
+ }
+
+ if (i>=0)
+ {
+ ExternalizeNonNativeApplicationTypeArrayL(i);
+ delete iNonNativeApplicationTypeArray[i].iNativeExecutable;
+ iNonNativeApplicationTypeArray[i].iNativeExecutable = NULL;
+ iNonNativeApplicationTypeArray.Remove(i);
+ }
+ }
void CApaAppArcServer::InternalizeNonNativeApplicationTypeArrayL()
{
@@ -673,37 +784,39 @@
CleanupStack::PopAndDestroy(&file);
}
+
void CApaAppArcServer::ExternalizeNonNativeApplicationTypeArrayL(TInt aIndexToIgnore/*=-1*/) const
- {
- RFs& fs=const_cast<RFs&>(iFs);
- fs.MkDirAll(iNonNativeApplicationTypeRegistry); // ignore any error
- RFile file;
- CleanupClosePushL(file);
- User::LeaveIfError(file.Replace(fs, iNonNativeApplicationTypeRegistry, EFileShareExclusive|EFileStream|EFileWrite));
- RFileWriteStream targetStream;
- 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)
- CleanupClosePushL(targetStream);
- const TInt arrayCount(iNonNativeApplicationTypeArray.Count());
- TInt arrayCountToExternalize=arrayCount;
- if (aIndexToIgnore>=0)
- --arrayCountToExternalize;
+ {
+ RFs& fs=const_cast<RFs&>(iFs);
+ fs.MkDirAll(iNonNativeApplicationTypeRegistry); // ignore any error
+ RFile file;
+ CleanupClosePushL(file);
+ User::LeaveIfError(file.Replace(fs, iNonNativeApplicationTypeRegistry, EFileShareExclusive|EFileStream|EFileWrite));
+ RFileWriteStream targetStream;
+ 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)
+ CleanupClosePushL(targetStream);
+ const TInt arrayCount(iNonNativeApplicationTypeArray.Count());
+ TInt arrayCountToExternalize=arrayCount;
+ if (aIndexToIgnore>=0)
+ --arrayCountToExternalize;
- TCardinality(arrayCountToExternalize).ExternalizeL(targetStream);
- for (TInt i=0; i<arrayCount; ++i)
- {
- if (i!=aIndexToIgnore)
- {
- const SNonNativeApplicationType& nonNativeApplicationType=iNonNativeApplicationTypeArray[i];
- targetStream.WriteUint32L(nonNativeApplicationType.iTypeUid.iUid);
- targetStream << *nonNativeApplicationType.iNativeExecutable;
- }
- }
-
- targetStream.CommitL();
- CleanupStack::PopAndDestroy(2, &file);
- }
+ TCardinality(arrayCountToExternalize).ExternalizeL(targetStream);
+ for (TInt i=0; i<arrayCount; ++i)
+ {
+ if (i!=aIndexToIgnore)
+ {
+ const SNonNativeApplicationType& nonNativeApplicationType=iNonNativeApplicationTypeArray[i];
+ targetStream.WriteUint32L(nonNativeApplicationType.iTypeUid.iUid);
+ targetStream << *nonNativeApplicationType.iNativeExecutable;
+ }
+ }
+
+ targetStream.CommitL();
+ CleanupStack::PopAndDestroy(2, &file);
+ }
+#endif
-TPtrC CApaAppArcServer::NativeExecutableL(TUid aNonNativeApplicationType) const
+TPtrC CApaAppArcServer::NativeExecutableL(TUid aNonNativeApplicationType)
{
for (TInt i=iNonNativeApplicationTypeArray.Count()-1; i>=0; --i)
{
@@ -711,11 +824,56 @@
if (nonNativeApplicationType.iTypeUid.iUid==aNonNativeApplicationType.iUid)
return *nonNativeApplicationType.iNativeExecutable;
}
-
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+ //If the mapping is not available in the list, search in SCR and add it to the list.
+ TPtrC nativeExecutableName=FindAndAddNonNativeRuntimeMappingL(aNonNativeApplicationType);
+ if(nativeExecutableName==KNullDesC())
+ User::Leave(KErrNotSupported); // not KErrNotFound
+
+ return nativeExecutableName;
+#else
User::Leave(KErrNotSupported); // not KErrNotFound
return KNullDesC();
+#endif
}
+
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+TPtrC CApaAppArcServer::FindAndAddNonNativeRuntimeMappingL(TUid aNonNativeApplicationType)
+{
+ //If non-native type to its runtime is not available search in SCR and update in list
+ Usif::RSoftwareComponentRegistry scrSession;
+ User::LeaveIfError(scrSession.Connect());
+ CleanupClosePushL(scrSession);
+
+ RPointerArray<Usif::CLauncherExecutable> launchers;
+ //Get non-native type to its run-time mappings
+ scrSession.GetApplicationLaunchersL(launchers);
+ TCleanupItem cleanup(CleanupAndDestroyLauncherArray, &launchers);
+ CleanupStack::PushL(cleanup);
+
+ //Search for mapping and add it mapping list.
+ for(TInt index=0;index<launchers.Count();index++)
+ {
+ Usif::CLauncherExecutable* launcherInfo=launchers[index];
+ if(aNonNativeApplicationType.iUid==launcherInfo->TypeId())
+ {
+ SNonNativeApplicationType nonNativeApplicationType;
+ nonNativeApplicationType.iTypeUid.iUid=launcherInfo->TypeId();
+ nonNativeApplicationType.iNativeExecutable=launcherInfo->Launcher().AllocLC();
+ iNonNativeApplicationTypeArray.AppendL(nonNativeApplicationType);
+ CleanupStack::Pop(nonNativeApplicationType.iNativeExecutable);
+ CleanupStack::PopAndDestroy(2, &scrSession);
+ return *nonNativeApplicationType.iNativeExecutable;
+ }
+ }
+
+ CleanupStack::PopAndDestroy(2, &scrSession);
+ return KNullDesC();
+}
+#endif
+
void CApaAppArcServer::DeleteLastNonNativeApplicationType(TAny* aThis)
{ // static
CApaAppArcServer& self=*static_cast<CApaAppArcServer*>(aThis);
@@ -736,6 +894,13 @@
// iterate through sessions
iSessionIter.SetToFirst();
CApaAppArcServSession* ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++));
+#ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
+ while (ses)
+ {
+ ses->NotifyScanComplete();
+ ses=static_cast<CApaAppArcServSession*>(&(*iSessionIter++));
+ }
+#else
while (ses)
{
if((iForceRegistrationStatus & EForceRegistrationRequested) ||
@@ -760,6 +925,7 @@
}
//Clear force registration request status
iForceRegistrationStatus &= (~EForceRegistrationRequested);
+#endif
}
/*