appfw/apparchitecture/apserv/APSSES.CPP
changeset 29 6a787171e1de
parent 0 2e3d3ce01487
child 46 eea20ed08f4b
equal deleted inserted replaced
28:b0b858956ed5 29:6a787171e1de
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    36 #include <s32mem.h>
    36 #include <s32mem.h>
    37 #include <s32strm.h>
    37 #include <s32strm.h>
    38 #include <s32file.h>
    38 #include <s32file.h>
    39 #include "../apgrfx/apprivate.h"
    39 #include "../apgrfx/apprivate.h"
    40 #include "apgnotif.h"
    40 #include "apgnotif.h"
       
    41 #include "ApLaunchChecker.h"
       
    42 #include "../aplist/aplapplistitem.h"
       
    43 
       
    44 #include "apsecutils.h"
       
    45 
       
    46 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
    41 #include "../aplist/aplappregfinder.h"
    47 #include "../aplist/aplappregfinder.h"
    42 #include "ApLaunchChecker.h"
       
    43 #include "apsnnapps.h"
    48 #include "apsnnapps.h"
    44 #include "../aplist/aplapplistitem.h"
    49 #else
    45 
    50 #include "usif/scr/scr.h"
    46 #include "apsecutils.h"
    51 #endif
    47 
    52 
    48 const TInt KApaAppListServMaxBuffer=256;
    53 const TInt KApaAppListServMaxBuffer=256;
    49 #include "APSRECCACHE.h"
    54 #include "APSRECCACHE.h"
    50 const TInt KApaAppInfoArrayGranularity = 4;
    55 const TInt KApaAppInfoArrayGranularity = 4;
    51 const TInt KApaAppInfoDesMaxLength = sizeof(TApaAppInfo);
    56 const TInt KApaAppInfoDesMaxLength = sizeof(TApaAppInfo);
   145 	self->ConstructL();
   150 	self->ConstructL();
   146 	CleanupStack::Pop(self);
   151 	CleanupStack::Pop(self);
   147 	return self;
   152 	return self;
   148 	}
   153 	}
   149 
   154 
       
   155 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK  
   150 CApaAppListServSession::CApaAppListServSession(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList)
   156 CApaAppListServSession::CApaAppListServSession(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList)
   151  : iFs(aFs), iAppArcSrv(aAppArcSrv), iAppList(aAppList), iApaAppInfoArray(KApaAppInfoArrayGranularity)
   157  : iFs(aFs), iAppArcSrv(aAppArcSrv), iAppList(aAppList), iApaAppInfoArray(KApaAppInfoArrayGranularity)
   152 	{
   158 	{
   153 
   159 
   154 	}
   160 	}
       
   161 #else
       
   162 CApaAppListServSession::CApaAppListServSession(RFs& aFs, CApaAppArcServer& aAppArcSrv, CApaAppList& aAppList)
       
   163  : iFs(aFs), iAppArcSrv(aAppArcSrv), iAppList(aAppList), iApaAppInfoArray(KApaAppInfoArrayGranularity), 
       
   164    iNotificationRequested(EFalse)
       
   165 	{
       
   166 
       
   167 	}
       
   168 #endif
   155 
   169 
   156 void CApaAppListServSession::ConstructL()
   170 void CApaAppListServSession::ConstructL()
   157 	{
   171 	{
       
   172 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK    
   158 	iNonNativeApplicationsManager = CApsNonNativeApplicationsManager::NewL(iAppArcSrv,iFs);
   173 	iNonNativeApplicationsManager = CApsNonNativeApplicationsManager::NewL(iAppArcSrv,iFs);
       
   174 #endif
   159 	}
   175 	}
   160 	
   176 	
   161 
   177 
   162 CApaAppListServSession::~CApaAppListServSession()
   178 CApaAppListServSession::~CApaAppListServSession()
   163 	{
   179 	{
       
   180 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK    
   164 	delete iNonNativeApplicationsManager;
   181 	delete iNonNativeApplicationsManager;
       
   182 #endif
   165 	iApaAppInfoArray.ResetAndDestroy();
   183 	iApaAppInfoArray.ResetAndDestroy();
   166 	iApaAppInfoArray.Close();
   184 	iApaAppInfoArray.Close();
   167 	}
   185 	}
   168 
   186 
   169 CApaAppList& CApaAppListServSession::AppList()
   187 CApaAppList& CApaAppListServSession::AppList()
   249 		break;
   267 		break;
   250 	case EAppListServApplicationLanguage:
   268 	case EAppListServApplicationLanguage:
   251 		ApplicationLanguageL(aMessage);
   269 		ApplicationLanguageL(aMessage);
   252 		break;
   270 		break;
   253 	case EAppListServAppInfoProvidedByRegistrationFile: // private OpCode for CEikApplication's use only
   271 	case EAppListServAppInfoProvidedByRegistrationFile: // private OpCode for CEikApplication's use only
       
   272 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
   254 		AppInfoProvidedByRegistrationFileL(aMessage);
   273 		AppInfoProvidedByRegistrationFileL(aMessage);
       
   274 #else
       
   275 		ASSERT(0);  // panic debug only
       
   276         User::Leave(KErrNotSupported);
       
   277 #endif		
   255 		break;
   278 		break;
   256 	case EAppListServAppIconFileName:
   279 	case EAppListServAppIconFileName:
   257 		IconFileNameL(aMessage);
   280 		IconFileNameL(aMessage);
   258 		break;
   281 		break;
   259 	case EAppListServAppViewIconFileName:
   282 	case EAppListServAppViewIconFileName:
   260 		ViewIconFileNameL(aMessage);
   283 		ViewIconFileNameL(aMessage);
   261 		break;	
   284 		break;
   262 	case EAppListServPrepareNonNativeApplicationsUpdates:
   285 	case EAppListServPrepareNonNativeApplicationsUpdates:
       
   286 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   263 		iNonNativeApplicationsManager->PrepareNonNativeApplicationsUpdatesL();
   287 		iNonNativeApplicationsManager->PrepareNonNativeApplicationsUpdatesL();
       
   288 #else
       
   289         ASSERT(0);  // panic debug only
       
   290         User::Leave(KErrNotSupported);
       
   291 #endif		
   264 		break;
   292 		break;
   265 	case EAppListServRegisterNonNativeApplication:
   293 	case EAppListServRegisterNonNativeApplication:
       
   294 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   266 		iNonNativeApplicationsManager->RegisterNonNativeApplicationL(aMessage);
   295 		iNonNativeApplicationsManager->RegisterNonNativeApplicationL(aMessage);
       
   296 #else
       
   297         ASSERT(0);  // panic debug only
       
   298         User::Leave(KErrNotSupported);
       
   299 #endif		
   267 		break;
   300 		break;
   268 	case EAppListServDeregisterNonNativeApplication:
   301 	case EAppListServDeregisterNonNativeApplication:
       
   302 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   269 		iNonNativeApplicationsManager->DeregisterNonNativeApplicationL(aMessage);
   303 		iNonNativeApplicationsManager->DeregisterNonNativeApplicationL(aMessage);
       
   304 #else
       
   305         ASSERT(0);  // panic debug only
       
   306         User::Leave(KErrNotSupported);
       
   307 #endif
   270 		break;
   308 		break;
   271 	case EAppListServCommitNonNativeApplications:
   309 	case EAppListServCommitNonNativeApplications:
       
   310 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   272 		iNonNativeApplicationsManager->CommitNonNativeApplicationsUpdatesL(aMessage);
   311 		iNonNativeApplicationsManager->CommitNonNativeApplicationsUpdatesL(aMessage);
   273 		completeMessage=EFalse;
   312 		completeMessage=EFalse;
       
   313 #else
       
   314         ASSERT(0);  // panic debug only
       
   315         User::Leave(KErrNotSupported);
       
   316 #endif		
   274 		break;
   317 		break;
   275 	case EAppListServRollbackNonNativeApplications:
   318 	case EAppListServRollbackNonNativeApplications:
       
   319 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   276 		iNonNativeApplicationsManager->RollbackNonNativeApplicationsUpdates();
   320 		iNonNativeApplicationsManager->RollbackNonNativeApplicationsUpdates();
       
   321 #else
       
   322         ASSERT(0);  // panic debug only
       
   323         User::Leave(KErrNotSupported);
       
   324 #endif		
   277 		break;
   325 		break;
   278 	case EAppListServGetAppType:
   326 	case EAppListServGetAppType:
   279 		GetAppTypeL(aMessage);
   327 		GetAppTypeL(aMessage);
   280 		break;
   328 		break;
   281 	case EAppListServForceRegistration:
   329 	case EAppListServForceRegistration:
   282 		ForceRegistrationL(aMessage);
   330 		ForceRegistrationL(aMessage);
       
   331 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 		
   283 		completeMessage=EFalse;
   332 		completeMessage=EFalse;
       
   333 #endif		
   284 		break;
   334 		break;
   285 	case EMatchesSecurityPolicy:
   335 	case EMatchesSecurityPolicy:
   286 		MatchesSecurityPolicyL(aMessage);
   336 		MatchesSecurityPolicyL(aMessage);
   287 		break;
   337 		break;
   288 	case EAppListServSetAppShortCaption:
   338 	case EAppListServSetAppShortCaption:
   293 		iApaAppInfoArray.ResetAndDestroy();
   343 		iApaAppInfoArray.ResetAndDestroy();
   294 		iApaAppInfoArray.Compress();
   344 		iApaAppInfoArray.Compress();
   295 	#endif
   345 	#endif
   296 		break;
   346 		break;
   297 	case EDebugAddFailingNonNativeApplicationsUpdate:
   347 	case EDebugAddFailingNonNativeApplicationsUpdate:
       
   348 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   298 	#ifdef _DEBUG
   349 	#ifdef _DEBUG
   299 		iNonNativeApplicationsManager->ForceFailInNonNativeApplicationsUpdatesL();
   350 		iNonNativeApplicationsManager->ForceFailInNonNativeApplicationsUpdatesL();
   300 	#endif
   351 	#endif
       
   352 #endif
   301 		break;
   353 		break;
   302 	case EDebugAddPanicingNonNativeApplicationsUpdate:
   354 	case EDebugAddPanicingNonNativeApplicationsUpdate:
       
   355 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   303 	#ifdef _DEBUG
   356 	#ifdef _DEBUG
   304 		iNonNativeApplicationsManager->ForcePanicInNonNativeApplicationsUpdatesL();
   357 		iNonNativeApplicationsManager->ForcePanicInNonNativeApplicationsUpdatesL();
   305 	#endif
   358 	#endif
       
   359 #endif	
   306 		break;
   360 		break;
   307 	case EDebugAddRollbackPanicingNonNativeApplicationsUpdate:
   361 	case EDebugAddRollbackPanicingNonNativeApplicationsUpdate:
       
   362 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
   308 	#ifdef _DEBUG
   363 	#ifdef _DEBUG
   309 		iNonNativeApplicationsManager->ForcePanicInNonNativeApplicationsRollbackL();
   364 		iNonNativeApplicationsManager->ForcePanicInNonNativeApplicationsRollbackL();
   310 	#endif
   365 	#endif
   311 		break;
   366 #endif	
       
   367 		break;
       
   368 		
       
   369 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 		
       
   370 	case EAppListServUpdateAppList:
       
   371 	    UpdateAppListL(aMessage);
       
   372 	    break;
       
   373     case EAppListUpdatedAppsInfo:
       
   374         UpdatedAppsInfoL(aMessage);
       
   375         break;
       
   376 #endif	    
   312 	default:
   377 	default:
   313 		aMessage.Panic(KApaPanicCli,EClientBadRequest);
   378 		aMessage.Panic(KApaPanicCli,EClientBadRequest);
   314 		break;
   379 		break;
   315 		}
   380 	
   316 		
   381 		}
       
   382 	
   317 	if (completeMessage && !aMessage.IsNull())
   383 	if (completeMessage && !aMessage.IsNull())
   318 		aMessage.Complete(KErrNone);
   384 		aMessage.Complete(KErrNone);
   319 	}
   385 	}
   320 
   386 
   321 
   387 
   353 	delete iOpaqueData_pendingDispatchToClient;
   419 	delete iOpaqueData_pendingDispatchToClient;
   354 	}
   420 	}
   355 
   421 
   356 void CApaAppArcServSession::ServiceL(const RMessage2& aMessage)
   422 void CApaAppArcServSession::ServiceL(const RMessage2& aMessage)
   357 	{
   423 	{
       
   424 #ifdef _DEBUG    
       
   425     TFullName* name = new(ELeave) TFullName();
       
   426     RThread client;
       
   427     if ( aMessage.Client( client ) == KErrNone )
       
   428         {
       
   429         client.FullName( *name );
       
   430         client.Close();
       
   431         }
       
   432     RDebug::Print( _L("[Apparc] CApaAppListServSession::ServiceL(0x%08x) - START - op code: %04d, client: %S"), this, aMessage.Function(), name );
       
   433     delete name; 
       
   434 #endif
       
   435     
   358 	TBool completeMessage = ETrue;
   436 	TBool completeMessage = ETrue;
   359 	switch (aMessage.Function())
   437 	switch (aMessage.Function())
   360 		{
   438 		{
   361 	case EAppListServStartAppWithoutReturningThreadId:
   439 	case EAppListServStartAppWithoutReturningThreadId:
   362 		ASSERT(0);	// panic debug only
   440 		ASSERT(0);	// panic debug only
   470 		const TUid serviceUid(TUid::Uid(aMessage.Int1()));
   548 		const TUid serviceUid(TUid::Uid(aMessage.Int1()));
   471 		AppForDocumentPassedByFileHandleL(aMessage, &serviceUid);
   549 		AppForDocumentPassedByFileHandleL(aMessage, &serviceUid);
   472 		}
   550 		}
   473 		break;
   551 		break;
   474 	case EAppListServRegisterNonNativeApplicationType:
   552 	case EAppListServRegisterNonNativeApplicationType:
       
   553 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
   475 		RegisterNonNativeApplicationTypeL(aMessage);
   554 		RegisterNonNativeApplicationTypeL(aMessage);
       
   555 #else
       
   556         ASSERT(0);  // panic debug only
       
   557         User::Leave(KErrNotSupported);
       
   558 #endif
   476 		break;
   559 		break;
   477 	case EAppListServDeregisterNonNativeApplicationType:
   560 	case EAppListServDeregisterNonNativeApplicationType:
       
   561 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
   478 		DeregisterNonNativeApplicationTypeL(aMessage);
   562 		DeregisterNonNativeApplicationTypeL(aMessage);
       
   563 #else
       
   564         ASSERT(0);  // panic debug only
       
   565         User::Leave(KErrNotSupported);
       
   566 #endif		
   479 		break;
   567 		break;
   480 	case EAppListServPreferredBufSize:
   568 	case EAppListServPreferredBufSize:
   481 		aMessage.Complete(PreferredBufSize());
   569 		aMessage.Complete(PreferredBufSize());
   482 		break;
   570 		break;
   483 	case EAppListServRecognizeFiles:
   571 	case EAppListServRecognizeFiles:
   534 		REComSession::FinalClose();
   622 		REComSession::FinalClose();
   535 	#endif
   623 	#endif
   536 		break;
   624 		break;
   537 	default:
   625 	default:
   538 		iAppListSession->DoServiceL(aMessage);
   626 		iAppListSession->DoServiceL(aMessage);
       
   627 #ifdef _DEBUG   
       
   628 		RDebug::Print( _L("[Apparc] CApaAppListServSession::ServiceL(0x%08x) - END - op code: %04d, completeMessage: %d"), this, aMessage.Function(), completeMessage );
       
   629 #endif		
   539 		return;
   630 		return;
   540 		}
   631 		}
   541 		
   632 	
       
   633 #ifdef _DEBUG 	
       
   634     RDebug::Print( _L("[Apparc] CApaAppListServSession::ServiceL(0x%08x) - END - op code: %04d, completeMessage: %d"), this, aMessage.Function(), completeMessage );
       
   635 #endif	
   542 	if (completeMessage && !aMessage.IsNull())
   636 	if (completeMessage && !aMessage.IsNull())
   543 		aMessage.Complete(KErrNone);
   637 		aMessage.Complete(KErrNone);
   544 	}
   638 	}
   545 
   639 
   546 
   640 
   564 	TInt preferredBufferSize = 0;
   658 	TInt preferredBufferSize = 0;
   565 	TRAPD(err, preferredBufferSize = iServ.DataRecognizerPreferredBufSizeL());
   659 	TRAPD(err, preferredBufferSize = iServ.DataRecognizerPreferredBufSizeL());
   566 	return (err==KErrNone) ? Min(iMaxBufSize, preferredBufferSize) : iMaxBufSize;
   660 	return (err==KErrNone) ? Min(iMaxBufSize, preferredBufferSize) : iMaxBufSize;
   567 	}
   661 	}
   568 
   662 
       
   663 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
   569 void CApaAppArcServSession::RegisterNonNativeApplicationTypeL(const RMessage2& aMessage)
   664 void CApaAppArcServSession::RegisterNonNativeApplicationTypeL(const RMessage2& aMessage)
   570 	{
   665 	{
   571 	const TUid applicationType(TUid::Uid(aMessage.Int0()));
   666 	const TUid applicationType(TUid::Uid(aMessage.Int0()));
   572 	HBufC* const nativeExecutable=HBufC::NewLC(User::LeaveIfError(aMessage.GetDesLength(1)));
   667 	HBufC* const nativeExecutable=HBufC::NewLC(User::LeaveIfError(aMessage.GetDesLength(1)));
   573 	{TPtr nativeExecutable_asWritable(nativeExecutable->Des());
   668 	{TPtr nativeExecutable_asWritable(nativeExecutable->Des());
   579 void CApaAppArcServSession::DeregisterNonNativeApplicationTypeL(const RMessage2& aMessage)
   674 void CApaAppArcServSession::DeregisterNonNativeApplicationTypeL(const RMessage2& aMessage)
   580 	{
   675 	{
   581 	const TUid applicationType(TUid::Uid(aMessage.Int0()));
   676 	const TUid applicationType(TUid::Uid(aMessage.Int0()));
   582 	iServ.DeregisterNonNativeApplicationTypeL(applicationType);
   677 	iServ.DeregisterNonNativeApplicationTypeL(applicationType);
   583 	}
   678 	}
       
   679 #endif
   584 
   680 
   585 void CApaAppListServSession::GetAppTypeL(const RMessage2& aMessage)
   681 void CApaAppListServSession::GetAppTypeL(const RMessage2& aMessage)
   586 	{
   682 	{
       
   683     const TUid KTypeIDToNonNativeUidMapping[2][2]={ {TUid::Uid(0xB031C52A), TUid::Uid(0x10210E26)},  //Java
       
   684                                                     {TUid::Uid(0x7BDB6DA1), TUid::Uid(0x10282821)}}; //Widget 
       
   685    
   587 	TInt uid = aMessage.Int0();
   686 	TInt uid = aMessage.Int0();
   588 	CApaAppData* appData = iAppList.AppDataByUid(TUid::Uid(uid));
   687 	CApaAppData* appData = iAppList.AppDataByUid(TUid::Uid(uid));
   589 	if (!appData)
   688 	if (!appData)
       
   689 	    {
   590 		aMessage.Complete(KErrNotFound);
   690 		aMessage.Complete(KErrNotFound);
       
   691 	    }
   591 	else
   692 	else
   592 		{
   693 		{
   593 		TPckgBuf<TUid> typeUid(appData->NonNativeApplicationType());
   694 		TUid typeId(appData->NonNativeApplicationType());
   594 		aMessage.WriteL(1,typeUid);
   695 		
       
   696 		//Check if non-native type to non-native UID mapping available. Otherwise
       
   697 		//return whatever returned by NonNativeApplicationType.
       
   698 		TUid nonNativeUid=typeId;
       
   699 		TInt numMappings= (sizeof(KTypeIDToNonNativeUidMapping)/ (2*sizeof(TUid)));
       
   700 		
       
   701 		for(TInt index=0; index<numMappings; index++)
       
   702 		    {
       
   703             if(typeId == KTypeIDToNonNativeUidMapping[index][0])
       
   704                 {
       
   705                 nonNativeUid = KTypeIDToNonNativeUidMapping[index][1];
       
   706                 break;
       
   707                 }
       
   708 		    }
       
   709 		
       
   710 		TPckgBuf<TUid> nonNativeUidBuf(nonNativeUid);
       
   711 		aMessage.WriteL(1,nonNativeUidBuf);
   595 		aMessage.Complete(KErrNone);
   712 		aMessage.Complete(KErrNone);
   596 		}
   713 		}
   597 	}
   714 	}
   598 	
   715 
       
   716 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK  
       
   717 void CleanupAndDestroyAppInfoArray(TAny* aRPArray)
       
   718     {
       
   719     RPointerArray<Usif::CApplicationRegistrationData>* rpArray = (static_cast<RPointerArray<Usif::CApplicationRegistrationData>*>(aRPArray));
       
   720     rpArray->ResetAndDestroy();
       
   721     rpArray->Close();
       
   722     }
       
   723 #endif
       
   724 
   599 void CApaAppListServSession::ForceRegistrationL(const RMessage2& aMessage)
   725 void CApaAppListServSession::ForceRegistrationL(const RMessage2& aMessage)
   600 	{
   726 	{
       
   727 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK    
   601 	TInt bufferSize = aMessage.GetDesLength(0);
   728 	TInt bufferSize = aMessage.GetDesLength(0);
   602 	User::LeaveIfError(bufferSize);
   729 	User::LeaveIfError(bufferSize);
   603 	HBufC8* const buffer=HBufC8::NewLC(bufferSize);
   730 	HBufC8* const buffer=HBufC8::NewLC(bufferSize);
   604 	TPtr8 buffer_asWritable(buffer->Des());
   731 	TPtr8 buffer_asWritable(buffer->Des());
   605 	aMessage.ReadL(0,buffer_asWritable);
   732 	aMessage.ReadL(0,buffer_asWritable);
   621 	CleanupStack::PopAndDestroy(buffer);
   748 	CleanupStack::PopAndDestroy(buffer);
   622 	
   749 	
   623 	// Trigger a rescan, when rescan completes it will complete iNotifyOnScanCompleteMsg
   750 	// Trigger a rescan, when rescan completes it will complete iNotifyOnScanCompleteMsg
   624 	iNotifyOnScanCompleteMsg=aMessage;
   751 	iNotifyOnScanCompleteMsg=aMessage;
   625 	iAppArcSrv.UpdateAppsByForceRegistration();
   752 	iAppArcSrv.UpdateAppsByForceRegistration();
   626 	}
   753 #else
   627 	
   754 	const TUid KUidSisLaunchServer={0x1020473f};
       
   755 	
       
   756 	if(aMessage.SecureId().iId != KUidSisLaunchServer.iUid)
       
   757 	    User::Leave(KErrNotSupported);
       
   758 	
       
   759 	//Get the size of the updated apps info buffer
       
   760     TInt bufferSize = aMessage.GetDesLength(0);
       
   761 
       
   762     //Allocate the buffer of bufferSize and read.
       
   763     HBufC8* const buffer=HBufC8::NewLC(bufferSize);
       
   764     TPtr8 buffer_asWritable(buffer->Des());
       
   765     aMessage.ReadL(0,buffer_asWritable);
       
   766         
       
   767     RDesReadStream readStream(*buffer);
       
   768     CleanupClosePushL(readStream);
       
   769     
       
   770     //Read the number of application information available in the buffer.
       
   771     const TUint count=readStream.ReadUint32L();
       
   772 
       
   773     RPointerArray<Usif::CApplicationRegistrationData> appsInfo;
       
   774     TCleanupItem cleanup(CleanupAndDestroyAppInfoArray, &appsInfo); 
       
   775     CleanupStack::PushL(cleanup); 
       
   776     
       
   777     //Read one applciation information at a time and create list of application information.
       
   778     for(TUint index=0; index<count; index++)
       
   779         {
       
   780         Usif::CApplicationRegistrationData* appData= Usif::CApplicationRegistrationData::NewL();
       
   781         CleanupStack::PushL(appData);
       
   782         readStream>>*appData;
       
   783         appsInfo.AppendL(appData);
       
   784         CleanupStack::Pop(appData);
       
   785         }
       
   786     CleanupStack::Pop(); //Remove cleanup
       
   787     CleanupStack::PopAndDestroy(2, buffer); //delete readStream, buffer	
       
   788 
       
   789     iAppList.UpdateApplistByForceRegAppsL(appsInfo);
       
   790 #endif	
       
   791 	}
       
   792 
   628 void CApaAppArcServSession::AppForDocumentPassedByFileHandleL(const RMessage2& aMessage, const TUid* aServiceUid)
   793 void CApaAppArcServSession::AppForDocumentPassedByFileHandleL(const RMessage2& aMessage, const TUid* aServiceUid)
   629 	{
   794 	{
   630 #if defined(__PROFILE)
   795 #if defined(__PROFILE)
   631 	TProfile profile;
   796 	TProfile profile;
   632 	RDebug::ProfileReset(5,1);
   797 	RDebug::ProfileReset(5,1);
   755 	TApaAppEntry dummy;
   920 	TApaAppEntry dummy;
   756 	CApaAppData* app = NULL;
   921 	CApaAppData* app = NULL;
   757 	if (!FindAppInList(app, dummy, aUid))
   922 	if (!FindAppInList(app, dummy, aUid))
   758 		User::Leave(KErrNotFound);
   923 		User::Leave(KErrNotFound);
   759 
   924 
   760 	return *app;
   925     return *app;
   761 	}
   926     }
       
   927 
       
   928 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
   929 /**
       
   930 locate app in list, return EFalse if it isn't present
       
   931 search is regardless of screen mode.
       
   932 @internalComponent
       
   933 */
       
   934 TBool CApaAppListServSession::FindAppInList(CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid)
       
   935     {
       
   936     // Look for the app with aAppUid in the applist we keep
       
   937     const CApaAppList& list = iAppList;
       
   938     aApp = list.AppDataByUid(aAppUid);
       
   939     if (aApp)
       
   940         aEntry = aApp->AppEntry();
       
   941     
       
   942     // If the app list is currently in flux, try to nail down the app by looking for it specifically
       
   943     const TBool appPendingOnLangChange = (aApp && list.IsLanguageChangePending() && aApp->IsPending());
       
   944 
       
   945     if ((!aApp || appPendingOnLangChange) && !list.IsIdleUpdateComplete())
       
   946         {
       
   947         // 1. App wasn't found, but an app scan is currently in progress,
       
   948         // so try to find and add the specific app we're looking for to the list
       
   949         
       
   950         // 2. On language change event, current app scan could not yet update the found app, 
       
   951         // so try to update the specific app we're looking for, in the list.
       
   952         if(aAppUid != KNullUid)
       
   953             {
       
   954             CApaAppData* app = NULL;
       
   955             TRAPD(err, app = FindSpecificAppL(aAppUid));
       
   956             if (!err && app)
       
   957                 {
       
   958                 // app has been found and added to the app list
       
   959                 aApp = app;
       
   960                 aEntry = aApp->AppEntry();
       
   961                 }
       
   962             }
       
   963         }
       
   964 
       
   965     return (aApp != NULL);
       
   966     }
       
   967 
       
   968 #else
       
   969 /**
       
   970 locate app in list, return EFalse if it isn't present
       
   971 search is regardless of screen mode.
       
   972 @internalComponent
       
   973 */
       
   974 TBool CApaAppListServSession::FindAppInList(CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid)
       
   975     {
       
   976     // Look for the application with aAppUid in the applist
       
   977     const CApaAppList& list = iAppList;
       
   978     aApp = list.AppDataByUid(aAppUid);
       
   979    
       
   980     TBool appListChanging= (list.IsLanguageChangePending()||!list.IsIdleUpdateComplete());
       
   981    //If the application is not in the applist and applist is still getting updated then find the 
       
   982    //requested application specifically and add to applist.
       
   983     TInt err=KErrNone;
       
   984     if( (!aApp && appListChanging) || (aApp && aApp->IsLangChangePending()))
       
   985         TRAP(err, aApp=FindSpecificAppL(aAppUid));
       
   986 
       
   987     if (!err && aApp)
       
   988         aEntry = aApp->AppEntry(); 
       
   989     
       
   990     return (aApp != NULL);
       
   991     }
       
   992 
       
   993 #endif
   762 
   994 
   763 void CApaAppListServSession::SendArrayL(const MArrayItemWriter& aArrayItemWriter,const RMessage2& aMessage) const
   995 void CApaAppListServSession::SendArrayL(const MArrayItemWriter& aArrayItemWriter,const RMessage2& aMessage) const
   764 	{
   996 	{
   765 	const TInt sizeOfBuffer=aMessage.Int1();
   997 	const TInt sizeOfBuffer=aMessage.Int1();
   766 	const TInt arrayItemCount=aArrayItemWriter.ArrayItemCount();
   998 	const TInt arrayItemCount=aArrayItemWriter.ArrayItemCount();
  1025                   priority = KDataTypePriorityNormal;
  1257                   priority = KDataTypePriorityNormal;
  1026                   }
  1258                   }
  1027               }
  1259               }
  1028           else
  1260           else
  1029               {
  1261               {
       
  1262 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK          
       
  1263               Usif::RSoftwareComponentRegistry scrCon;
       
  1264               User::LeaveIfError(scrCon.Connect());
       
  1265               CleanupClosePushL(scrCon);
       
  1266               TApaAppEntry appEntry=appData->AppEntry();
       
  1267               
       
  1268 			  //If component id of an application is non-zero then it is installed by installer
       
  1269 			  //after phone marketed.
       
  1270               TBool isInstalledApp=(scrCon.GetComponentIdForAppL(appEntry.iUidType[2])!=0);
       
  1271 
       
  1272               //data priority for UnTrusted apps would be capped if it is greater than the threshold priority i.e, KMaxTInt16.
       
  1273               if (!isSidTrusted && isInstalledApp) 
       
  1274                   {
       
  1275                   priority = KDataTypeUnTrustedPriorityThreshold; 
       
  1276                   }
       
  1277               CleanupStack::PopAndDestroy(); //scrCon
       
  1278 #else
  1030               TPtrC registrationFilePath = appData->RegistrationFileName();
  1279               TPtrC registrationFilePath = appData->RegistrationFileName();
  1031               TInt match = registrationFilePath.MatchF (
  1280               TInt match = registrationFilePath.MatchF (
  1032                                           KLitPathForUntrustedRegistrationResourceFiles );
  1281                                           KLitPathForUntrustedRegistrationResourceFiles );
  1033               //Check if registration file is in path for untrusted apps 
  1282               //Check if registration file is in path for untrusted apps 
  1034               //and its SID is untrusted
  1283               //and its SID is untrusted
  1036                   {
  1285                   {
  1037                   // "cap" the priority if UnTrusted apps claim for priority higher 
  1286                   // "cap" the priority if UnTrusted apps claim for priority higher 
  1038                   // than UnTrusted apps Threshold priority
  1287                   // than UnTrusted apps Threshold priority
  1039                   priority = KDataTypeUnTrustedPriorityThreshold;
  1288                   priority = KDataTypeUnTrustedPriorityThreshold;
  1040                   }
  1289                   }
       
  1290 #endif
  1041               }
  1291               }
  1042           }
  1292           }
  1043 	   else
  1293 	   else
  1044 		  {
  1294 		  {
  1045               //if the application is not present in the applist 
  1295               //if the application is not present in the applist 
  1670 	TApaAppCapabilityBuf capabilityBuf;
  1920 	TApaAppCapabilityBuf capabilityBuf;
  1671 	aAppData.Capability(capabilityBuf);
  1921 	aAppData.Capability(capabilityBuf);
  1672 	return (capabilityBuf().iAttributes & TApaAppCapability::EControlPanelItem);
  1922 	return (capabilityBuf().iAttributes & TApaAppCapability::EControlPanelItem);
  1673 	}
  1923 	}
  1674 
  1924 
  1675 /**
       
  1676 locate app in list, return EFalse if it isn't present
       
  1677 search is regardless of screen mode.
       
  1678 @internalComponent
       
  1679 */
       
  1680 TBool CApaAppListServSession::FindAppInList(CApaAppData*& aApp, TApaAppEntry& aEntry, TUid aAppUid)
       
  1681 	{
       
  1682 	// Look for the app with aAppUid in the app list we keep
       
  1683 	const CApaAppList& list = iAppList;
       
  1684 	aApp = list.AppDataByUid(aAppUid);
       
  1685 	if (aApp)
       
  1686 		aEntry = aApp->AppEntry();
       
  1687 	
       
  1688 	// If the app list is currently in flux, try to nail down the app by looking for it specifically
       
  1689 	const TBool appPendingOnLangChange = (aApp && list.IsLanguageChangePending() && aApp->IsPending());	
       
  1690 	if ((!aApp || appPendingOnLangChange) && !list.IsIdleUpdateComplete())
       
  1691 		{
       
  1692 		// 1. App wasn't found, but an app scan is currently in progress,
       
  1693 		// so try to find and add the specific app we're looking for to the list
       
  1694 		
       
  1695 		// 2. On language change event, current app scan could not yet update the found app, 
       
  1696 		// so try to update the specific app we're looking for, in the list.
       
  1697 		if(aAppUid != KNullUid)
       
  1698 			{
       
  1699 			CApaAppData* app = NULL;
       
  1700 			TRAPD(err, app = FindSpecificAppL(aAppUid));
       
  1701 			if (!err && app)
       
  1702 				{
       
  1703 				// app has been found and added to the app list
       
  1704 				aApp = app;
       
  1705 				aEntry = aApp->AppEntry();
       
  1706 				}
       
  1707  			}
       
  1708  		}
       
  1709 
       
  1710 	return (aApp != NULL);
       
  1711 	}
       
  1712 
  1925 
  1713 CApaAppData* CApaAppListServSession::FindSpecificAppL(TUid aAppUid)
  1926 CApaAppData* CApaAppListServSession::FindSpecificAppL(TUid aAppUid)
  1714 	{
  1927 	{
  1715 	//Scans the drives and folder lists for the specific app
  1928 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1716 	CApaAppRegFinder* regFinder = CApaAppRegFinder::NewLC(iFs);
  1929     CApaAppData* app = iAppList.FindAndAddSpecificAppL(aAppUid);	
  1717 	CApaAppData* app = iAppList.FindAndAddSpecificAppL(regFinder, aAppUid);
  1930 #else
  1718 	CleanupStack::PopAndDestroy(regFinder);
  1931     //Scans the drives and folder lists for the specific app
       
  1932     CApaAppRegFinder* regFinder = CApaAppRegFinder::NewLC(iFs);    
       
  1933     CApaAppData* app = iAppList.FindAndAddSpecificAppL(regFinder, aAppUid);
       
  1934     CleanupStack::PopAndDestroy(regFinder);
       
  1935 #endif
  1719 	return app;
  1936 	return app;
  1720 	}
  1937 	}
  1721 
  1938 
  1722 void CApaAppListServSession::GetAppInfoL(const RMessage2& aMessage)
  1939 void CApaAppListServSession::GetAppInfoL(const RMessage2& aMessage)
  1723 	{
  1940 	{
  1759 	if (!iNotifyMessage.IsNull())
  1976 	if (!iNotifyMessage.IsNull())
  1760 		aMessage.Panic(KApaPanicCli,ENotifierAlreadyPresent);
  1977 		aMessage.Panic(KApaPanicCli,ENotifierAlreadyPresent);
  1761 	else
  1978 	else
  1762 		{
  1979 		{
  1763 		const TBool completeImmediatelyIfNoScanImpendingOrInProgress=aMessage.Int0();
  1980 		const TBool completeImmediatelyIfNoScanImpendingOrInProgress=aMessage.Int0();
  1764 		if ((!completeImmediatelyIfNoScanImpendingOrInProgress) ||
  1981 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1765 			iAppArcSrv.AppFsMonitor().AnyNotificationImpending() ||
  1982         if ((!completeImmediatelyIfNoScanImpendingOrInProgress) ||
  1766 			iAppList.AppScanInProgress())
  1983             iAppList.AppScanInProgress())   
       
  1984 #else
       
  1985         if ((!completeImmediatelyIfNoScanImpendingOrInProgress) ||
       
  1986             iAppArcSrv.AppFsMonitor().AnyNotificationImpending() ||
       
  1987             iAppList.AppScanInProgress())		
       
  1988 #endif
  1767 			iNotifyMessage=aMessage;
  1989 			iNotifyMessage=aMessage;
  1768 		else
  1990 		else
  1769 			aMessage.Complete(KErrNone);
  1991 			aMessage.Complete(KErrNone);
  1770 		}
  1992 		}
  1771 	}
  1993 	
  1772 
  1994 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 	
       
  1995 	iNotificationRequested=ETrue;
       
  1996 #endif	
       
  1997 	}
       
  1998 
       
  1999 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
       
  2000 void CApaAppArcServSession::NotifyClients(TInt aReason, CArrayFixFlat<TApaAppUpdateInfo>* aUpdatedAppsInfo)
       
  2001 #else
  1773 void CApaAppArcServSession::NotifyClients(TInt aReason)
  2002 void CApaAppArcServSession::NotifyClients(TInt aReason)
  1774 	{
  2003 #endif
  1775 	iAppListSession->NotifyClients(aReason);
  2004 
  1776 	}
  2005 	{
       
  2006 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2007 	iAppListSession->NotifyClients(aReason, aUpdatedAppsInfo);
       
  2008 #else
       
  2009 	iAppListSession->NotifyClients(aReason);	
       
  2010 #endif
       
  2011 	}
       
  2012 
  1777 
  2013 
  1778 void CApaAppListServSession::CancelNotify()
  2014 void CApaAppListServSession::CancelNotify()
  1779 	{
  2015 	{
       
  2016 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK     
       
  2017 	NotifyClients(KErrCancel, NULL);
       
  2018 #else
  1780 	NotifyClients(KErrCancel);
  2019 	NotifyClients(KErrCancel);
  1781 	}
  2020 #endif
  1782 
  2021 	}
       
  2022 
       
  2023 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
       
  2024 void CApaAppListServSession::NotifyClients(TInt aReason, CArrayFixFlat<TApaAppUpdateInfo>* aUpdatedAppsInfo)
       
  2025 #else
  1783 void CApaAppListServSession::NotifyClients(TInt aReason)
  2026 void CApaAppListServSession::NotifyClients(TInt aReason)
       
  2027 #endif
  1784 	{
  2028 	{
  1785 	if (!iNotifyMessage.IsNull())
  2029 	if (!iNotifyMessage.IsNull())
  1786 		iNotifyMessage.Complete(aReason);
  2030 		iNotifyMessage.Complete(aReason);
  1787 	
  2031 	
  1788 	//Notify client for scan complete.
  2032 	//Notify client for scan complete.
  1789 	NotifyScanComplete();
  2033 	NotifyScanComplete();
  1790 	}
  2034 	
  1791 
  2035 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
       
  2036 	if(aUpdatedAppsInfo && iNotificationRequested)
       
  2037 	    {
       
  2038         //Append the updated applications information to iAppsUpdated
       
  2039         TInt count=aUpdatedAppsInfo->Count();
       
  2040         for(TInt index=0; index<count; index++)
       
  2041             {
       
  2042             TRAPD(err, iAppsUpdated.AppendL((*aUpdatedAppsInfo)[index]));
       
  2043             if(err != KErrNone)
       
  2044                 {
       
  2045                 iAppsUpdated.Reset();
       
  2046                 break;
       
  2047                 }
       
  2048             }
       
  2049 	    }
       
  2050 #endif	
       
  2051 	}
       
  2052 
       
  2053 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
  1792 void CApaAppListServSession::AppInfoProvidedByRegistrationFileL(const RMessage2& aMessage)
  2054 void CApaAppListServSession::AppInfoProvidedByRegistrationFileL(const RMessage2& aMessage)
  1793 	{
  2055 	{
  1794 	// get UID of required app
  2056 	// get UID of required app
  1795 	const TUid uid = TUid::Uid(aMessage.Int0());
  2057 	const TUid uid = TUid::Uid(aMessage.Int0());
  1796 
  2058 
  1799 	
  2061 	
  1800 	const TBool registrationFileUsed = app.RegistrationFileUsed();
  2062 	const TBool registrationFileUsed = app.RegistrationFileUsed();
  1801 	TPckgC<TBool> pckg(registrationFileUsed);
  2063 	TPckgC<TBool> pckg(registrationFileUsed);
  1802 	aMessage.WriteL(1, pckg);
  2064 	aMessage.WriteL(1, pckg);
  1803 	}
  2065 	}
       
  2066 #endif
       
  2067 
  1804 
  2068 
  1805 void CApaAppListServSession::IconFileNameL(const RMessage2& aMessage)
  2069 void CApaAppListServSession::IconFileNameL(const RMessage2& aMessage)
  1806 	{
  2070 	{
  1807 	// get UID of required app
  2071 	// get UID of required app
  1808 	const TUid uid=TUid::Uid(aMessage.Int0());
  2072 	const TUid uid=TUid::Uid(aMessage.Int0());
  1809 
  2073 
  1810 	// locate app in list
  2074 	// locate app in list
  1811 	const CApaAppData& app = FindAppInListL(uid);
  2075 	const CApaAppData& app = FindAppInListL(uid);
  1812 
  2076 
  1813 	if (!app.RegistrationFileUsed())
  2077 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
  1814 		User::Leave(KErrNotSupported);
  2078 	if (!app.RegistrationFileUsed())     
  1815 	else
  2079 	    User::Leave(KErrNotSupported);     
  1816 		{
  2080 	 else     
  1817 		TPtrC iconFileName(app.IconFileName());
  2081 	 { 
  1818 		if (iconFileName.Length() == 0)
  2082 #endif
  1819 			User::Leave(KErrNotFound);
  2083 	 
  1820 		else
  2084         TPtrC iconFileName(app.IconFileName());
  1821 			{
  2085         if (iconFileName.Length() == 0)
  1822 			TFileName fileName = iconFileName;
  2086             User::Leave(KErrNotFound);
  1823 			TPckgC<TFileName> pckg(fileName);
  2087         else
  1824 			aMessage.WriteL(1, pckg);
  2088             {
  1825 			}
  2089             TFileName fileName = iconFileName;
  1826 		}
  2090             TPckgC<TFileName> pckg(fileName);
       
  2091             aMessage.WriteL(1, pckg);
       
  2092             }
       
  2093         
       
  2094 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2095 	 }
       
  2096 #endif
       
  2097 	
  1827 	}
  2098 	}
  1828 
  2099 
  1829 void CApaAppListServSession::ViewIconFileNameL(const RMessage2& aMessage)
  2100 void CApaAppListServSession::ViewIconFileNameL(const RMessage2& aMessage)
  1830 	{
  2101 	{
  1831 	// get UID of required app
  2102 	// get UID of required app
  1836 	TPtrC viewIconFileName;
  2107 	TPtrC viewIconFileName;
  1837 
  2108 
  1838 	// locate app in list
  2109 	// locate app in list
  1839 	const CApaAppData& app = FindAppInListL(uid);
  2110 	const CApaAppData& app = FindAppInListL(uid);
  1840 
  2111 
  1841 	if (!app.RegistrationFileUsed())
  2112 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
  1842 		User::Leave(KErrNotSupported);
  2113     if (!app.RegistrationFileUsed())     
  1843 	else
  2114         User::Leave(KErrNotSupported);     
  1844 		{
  2115      else     
  1845 		const CArrayPtr<CApaAppViewData>& viewDataArray = *app.Views();
  2116      { 
  1846 		const TInt count = viewDataArray.Count();
  2117 #endif
  1847 		for (TInt ii=0; ii<count; ii++)
  2118 	
  1848 			{
  2119         const CArrayPtr<CApaAppViewData>& viewDataArray = *app.Views();
  1849 			const CApaAppViewData& appViewData = *viewDataArray[ii];
  2120         const TInt count = viewDataArray.Count();
  1850 			if (appViewData.Uid() == viewUid)
  2121         for (TInt ii=0; ii<count; ii++)
  1851 				{
  2122             {
  1852 				viewIconFileName.Set(appViewData.IconFileName());
  2123             const CApaAppViewData& appViewData = *viewDataArray[ii];
  1853 				break;
  2124             if (appViewData.Uid() == viewUid)
  1854 				}
  2125                 {
  1855 			}
  2126                 viewIconFileName.Set(appViewData.IconFileName());
  1856 
  2127                 break;
  1857 		if (viewIconFileName.Length() == 0)
  2128                 }
  1858 			User::Leave(KErrNotFound);
  2129             }
  1859 		else
  2130     
  1860 			{
  2131         if (viewIconFileName.Length() == 0)
  1861 			TFileName fileName = viewIconFileName;
  2132             User::Leave(KErrNotFound);
  1862 			TPckgC<TFileName> pckg(fileName);
  2133         else
  1863 			aMessage.WriteL(2, pckg);
  2134             {
  1864 			}
  2135             TFileName fileName = viewIconFileName;
  1865 		}
  2136             TPckgC<TFileName> pckg(fileName);
       
  2137             aMessage.WriteL(2, pckg);
       
  2138             }
       
  2139 
       
  2140 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2141      }
       
  2142 #endif
       
  2143     
  1866 	}
  2144 	}
  1867 
  2145 
  1868 void CApaAppArcServSession::GetAppServicesL(const RMessage2& aMessage)
  2146 void CApaAppArcServSession::GetAppServicesL(const RMessage2& aMessage)
  1869 	{
  2147 	{
  1870 	const TInt initialBufSize = aMessage.Int2();
  2148 	const TInt initialBufSize = aMessage.Int2();
  2059 	//See if the session is intrested in scan complete notification.
  2337 	//See if the session is intrested in scan complete notification.
  2060 	if (!iNotifyOnScanCompleteMsg.IsNull())
  2338 	if (!iNotifyOnScanCompleteMsg.IsNull())
  2061 		{
  2339 		{
  2062 		iNotifyOnScanCompleteMsg.Complete(KErrNone);
  2340 		iNotifyOnScanCompleteMsg.Complete(KErrNone);
  2063 		}
  2341 		}
       
  2342 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK	
  2064 	iNonNativeApplicationsManager->NotifyScanComplete();
  2343 	iNonNativeApplicationsManager->NotifyScanComplete();
       
  2344 #endif	
  2065 	} //lint !e1762 Suppress member function could be made const
  2345 	} //lint !e1762 Suppress member function could be made const
  2066 	
  2346 	
       
  2347 
       
  2348 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  2349 
       
  2350 //Update applist based on the information provided by the installers.
       
  2351 void CApaAppListServSession::UpdateAppListL(const RMessage2& aMessage)
       
  2352 {
       
  2353     //Create the update info array from the buffer.
       
  2354     TInt bufferSize = aMessage.GetDesLength(0);
       
  2355     User::LeaveIfError(bufferSize);
       
  2356     HBufC8* const buffer=HBufC8::NewLC(bufferSize);
       
  2357     TPtr8 buffer_asWritable(buffer->Des());
       
  2358     aMessage.ReadL(0,buffer_asWritable);
       
  2359         
       
  2360     RDesReadStream readStream(*buffer);
       
  2361     CleanupClosePushL(readStream);
       
  2362     const TUint count=readStream.ReadUint32L();
       
  2363 
       
  2364     RArray<TApaAppUpdateInfo> *appUpdateInfo=new (ELeave) RArray<TApaAppUpdateInfo>(5);
       
  2365     CleanupStack::PushL(appUpdateInfo);
       
  2366     
       
  2367     for(TUint index=0; index<count; index++)
       
  2368         {
       
  2369         TApaAppUpdateInfo appInfo;
       
  2370         readStream>>appInfo;
       
  2371         appUpdateInfo->AppendL(appInfo);
       
  2372         }
       
  2373     CleanupStack::Pop(appUpdateInfo);
       
  2374     CleanupStack::PopAndDestroy(2, buffer); //delete readStream, buffer
       
  2375     
       
  2376     iAppArcSrv.UpdateAppListL(appUpdateInfo, TUid::Uid(aMessage.SecureId()));
       
  2377 }
       
  2378 
       
  2379 
       
  2380 void CApaAppListServSession::UpdatedAppsInfoL(const RMessage2& aMessage)
       
  2381     {
       
  2382     //Read the buffer size
       
  2383     TInt sizeOfBuffer=aMessage.Int1();
       
  2384     TInt count=iAppsUpdated.Count();
       
  2385     TInt sizeRequired= sizeof(TInt)+(sizeof(TApaAppUpdateInfo) * count);
       
  2386 
       
  2387     TPckgBuf<TInt> pckg(sizeRequired);
       
  2388     
       
  2389     //If size of the buffer is not enough write the required size and leave.
       
  2390     if(sizeOfBuffer<sizeRequired)
       
  2391         {
       
  2392         aMessage.WriteL(1, pckg);    
       
  2393         User::Leave(KErrOverflow);
       
  2394         }
       
  2395     
       
  2396     //If the passed buffer size is enough, create a buffer to write updates application information.
       
  2397     CBufFlat* buffer=CBufFlat::NewL(sizeRequired);
       
  2398     CleanupStack::PushL(buffer);
       
  2399     buffer->ExpandL(0, sizeRequired);
       
  2400     
       
  2401     RBufWriteStream writeStream;
       
  2402     writeStream.Open(*buffer);
       
  2403     
       
  2404     //Write count to stream.
       
  2405     writeStream.WriteUint32L(count);
       
  2406     
       
  2407     //Write updated applications information to stream.
       
  2408     for(TInt index=0; index<count; index++)
       
  2409         {
       
  2410         writeStream<<iAppsUpdated[index];
       
  2411         }
       
  2412     //Write the buffer into passed buffer.
       
  2413     aMessage.WriteL(0, buffer->Ptr(0));
       
  2414     //Write size of the buffer
       
  2415     aMessage.WriteL(1, pckg);
       
  2416     
       
  2417     CleanupStack::PopAndDestroy(buffer); 
       
  2418     iAppsUpdated.Reset();
       
  2419     iNotificationRequested=EFalse;
       
  2420     }
       
  2421 #endif
       
  2422 
  2067 // TSizeArrayItemWriter
  2423 // TSizeArrayItemWriter
  2068 
  2424 
  2069 TInt TSizeArrayItemWriter::ArrayItemCount() const
  2425 TInt TSizeArrayItemWriter::ArrayItemCount() const
  2070 	{
  2426 	{
  2071 	return iArray.Count();
  2427 	return iArray.Count();