appfw/apparchitecture/apgrfx/APGCLI.CPP
changeset 81 676b6116ca93
parent 71 9352913932ef
equal deleted inserted replaced
78:175a0d824084 81:676b6116ca93
    32 #include "APGCLI.H"
    32 #include "APGCLI.H"
    33 #include "APGSTD.H"
    33 #include "APGSTD.H"
    34 #include "APGICNFL.H"
    34 #include "APGICNFL.H"
    35 #include "APGPRIV.H"
    35 #include "APGPRIV.H"
    36 #include "apprivate.h"
    36 #include "apprivate.h"
       
    37 #include "OstTraceDefinitions.h"
       
    38 #ifdef OST_TRACE_COMPILER_IN_USE
       
    39 #include "APGCLITraces.h"
       
    40 #endif
    37 
    41 
    38 const TUint KInitialIconBufSize = sizeof(TSize)*6 + sizeof(TInt);
    42 const TUint KInitialIconBufSize = sizeof(TSize)*6 + sizeof(TInt);
    39 const TUint KInitialViewDataBufSize = sizeof(TApaAppViewInfo)*6 + sizeof(TInt);
    43 const TUint KInitialViewDataBufSize = sizeof(TApaAppViewInfo)*6 + sizeof(TInt);
    40 const TUint KInitialOwnedFilesBufSize = sizeof(TFileName)*6 + sizeof(TInt);
    44 const TUint KInitialOwnedFilesBufSize = sizeof(TFileName)*6 + sizeof(TInt);
    41 const TUint KDefaultBufSize = 0x400;
    45 const TUint KDefaultBufSize = 0x400;
   148 @return KErrNone if successful; otherwise, one of the system-wide error codes. 
   152 @return KErrNone if successful; otherwise, one of the system-wide error codes. 
   149 */
   153 */
   150 EXPORT_C TInt RApaLsSession::Connect()
   154 EXPORT_C TInt RApaLsSession::Connect()
   151 	{
   155 	{
   152 	TInt r=CreateSession(KAppListServerName,Version(),KAsyncMessageSlots);
   156 	TInt r=CreateSession(KAppListServerName,Version(),KAsyncMessageSlots);
       
   157 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_CONNECT, "RApaLsSession::Connect will return with r=%d", r );
   153 	return(r); 
   158 	return(r); 
   154 	}
   159 	}
   155 
   160 
   156 EXPORT_C void RApaLsSession::Close()
   161 EXPORT_C void RApaLsSession::Close()
   157 /** 
   162 /** 
   195 @param aCount On return, the total number of embeddable applications.
   200 @param aCount On return, the total number of embeddable applications.
   196 @return KErrNone, if successful, otherwise one of the system-wide error codes. 
   201 @return KErrNone, if successful, otherwise one of the system-wide error codes. 
   197 */
   202 */
   198 EXPORT_C TInt RApaLsSession::EmbeddableAppCount(TInt& aCount) const
   203 EXPORT_C TInt RApaLsSession::EmbeddableAppCount(TInt& aCount) const
   199 	{
   204 	{
       
   205     OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_EMBEDDABLEAPPCOUNT, "RApaLsSession::EmbeddableAppCount" );    
   200 	return DoAppCount(aCount, EAppListServEmbedCount);
   206 	return DoAppCount(aCount, EAppListServEmbedCount);
   201 	}
   207 	}
   202 
   208 
   203 
   209 
   204 TInt RApaLsSession::DoAppCount(TInt& aCount,TInt aCommand) const
   210 TInt RApaLsSession::DoAppCount(TInt& aCount,TInt aCommand) const
   205 // returns the number of embeddable apps in the server side list
   211 // returns the number of embeddable apps in the server side list
   206 	{
   212 	{
   207 	__ASSERT_DEBUG(aCommand==EAppListServEmbedCount || aCommand==EAppListServAppCount,Panic(EDPanicWrongCommand));
   213 	__ASSERT_DEBUG(aCommand==EAppListServEmbedCount || aCommand==EAppListServAppCount,Panic(EDPanicWrongCommand));
   208 	const TInt returnValue = SendReceiveWithReconnect(aCommand,TIpcArgs());
   214 	const TInt returnValue = SendReceiveWithReconnect(aCommand,TIpcArgs());
   209 	if (returnValue < 0)
   215 	if (returnValue < 0)
       
   216 	    {
       
   217         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_DOAPPCOUNT, "RApaLsSession::DoAppCount returned with (returnValue)=%d", returnValue );        
   210 		return returnValue;
   218 		return returnValue;
       
   219 	    }
   211 	
   220 	
   212 	aCount = returnValue;
   221 	aCount = returnValue;
       
   222 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_DOAPPCOUNT, "RApaLsSession::DoAppCount will return with KErrNone" );
   213 	return KErrNone;
   223 	return KErrNone;
   214 	}
   224 	}
   215 
   225 
   216 
   226 
   217 
   227 
   454 */
   464 */
   455 EXPORT_C TInt RApaLsSession::GetNextApp(TApaAppInfo& aInfo,TInt aScreenMode) const
   465 EXPORT_C TInt RApaLsSession::GetNextApp(TApaAppInfo& aInfo,TInt aScreenMode) const
   456 	{
   466 	{
   457 	TPckg<TApaAppInfo> info(aInfo);
   467 	TPckg<TApaAppInfo> info(aInfo);
   458 	TInt err = SendReceiveWithReconnect(EAppListServGetNextApp, TIpcArgs(aScreenMode,&info));
   468 	TInt err = SendReceiveWithReconnect(EAppListServGetNextApp, TIpcArgs(aScreenMode,&info));
       
   469 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_GETNEXTAPP, "SendReceiveWithReconnect returned with error returned from SendReceiveWithReconnect : err=%d", err );
       
   470 	
   459 	if (!err)
   471 	if (!err)
   460 		aInfo = info();
   472 		aInfo = info();
   461 	else if (err==KErrNotFound)
   473 	else if (err==KErrNotFound)
   462 		err = ENoMoreAppsInList;
   474 		err = ENoMoreAppsInList;
   463 	else if (err==KErrCorrupt)
   475 	else if (err==KErrCorrupt)
   464 		err = EAppListInvalid;
   476 		err = EAppListInvalid;
       
   477 	
       
   478 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP1_RAPALSSESSION_GETNEXTAPP, "RApaLsSession::GetNextApp will return with err=%d", err );
   465 	
   479 	
   466 	return err;
   480 	return err;
   467 	}
   481 	}
   468 
   482 
   469 
   483 
   514 */
   528 */
   515 EXPORT_C TInt RApaLsSession::GetDefaultScreenNumber(TInt& aDefaultScreenNumber, TUid aAppUid) const
   529 EXPORT_C TInt RApaLsSession::GetDefaultScreenNumber(TInt& aDefaultScreenNumber, TUid aAppUid) const
   516 	{
   530 	{
   517 	const TInt result = SendReceiveWithReconnect(EAppListServGetDefaultScreenNumber, TIpcArgs(aAppUid.iUid));
   531 	const TInt result = SendReceiveWithReconnect(EAppListServGetDefaultScreenNumber, TIpcArgs(aAppUid.iUid));
   518 	if (result < 0)
   532 	if (result < 0)
       
   533 	    {
       
   534         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG,APPARC_TRACE_NORMAL, RAPALSSESSION_GETDEFAULTSCREENNUMBER, "SendReceiveWithReconnect returned with result=%d. Return from here", result );
       
   535         
   519 		return result;
   536 		return result;
   520 
   537 	    }
       
   538 	
   521 	aDefaultScreenNumber = result;
   539 	aDefaultScreenNumber = result;
       
   540 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_GETDEFAULTSCREENNUMBER, "RApaLsSession::GetDefaultScreenNumber will return with KErrNone" );
   522 	return KErrNone;
   541 	return KErrNone;
   523 	}
   542 	}
   524 
   543 
   525 
   544 
   526 /** Gets the capabilities of the application with the specified UID.
   545 /** Gets the capabilities of the application with the specified UID.
   569 otherwise one of the other system wide error codes. 
   588 otherwise one of the other system wide error codes. 
   570 */
   589 */
   571 EXPORT_C TInt RApaLsSession::GetAppIconSizes(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const
   590 EXPORT_C TInt RApaLsSession::GetAppIconSizes(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const
   572 	{
   591 	{
   573 	TRAPD(error, DoGetAppIconSizesL(aAppUid,aArrayToFill));
   592 	TRAPD(error, DoGetAppIconSizesL(aAppUid,aArrayToFill));
       
   593 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG , APPARC_TRACE_FLOW, RAPALSSESSION_GETAPPICONSIZES, "RApaLsSession::GetAppIconSizes will return with error=%d", error );
   574 	return error;
   594 	return error;
   575 	}
   595 	}
   576 
   596 
   577 void RApaLsSession::DoGetAppIconSizesL(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const
   597 void RApaLsSession::DoGetAppIconSizesL(TUid aAppUid, CArrayFixFlat<TSize>& aArrayToFill) const
   578 	{
   598 	{
   596 	TPtr8 bufPtr = buffer->Ptr(0);
   616 	TPtr8 bufPtr = buffer->Ptr(0);
   597 	
   617 	
   598 	// Get the data from the AppArc server
   618 	// Get the data from the AppArc server
   599 	
   619 	
   600 	const TInt sizeRequired = SendReceiveWithReconnect(aOpcode,TIpcArgs(aAppUid.iUid,buffer->Size(),&bufPtr));
   620 	const TInt sizeRequired = SendReceiveWithReconnect(aOpcode,TIpcArgs(aAppUid.iUid,buffer->Size(),&bufPtr));
       
   621 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_INTERNAL, RAPALSSESSION_FETCHARRAYL, "SendReceiveWithReconnect returned with sizeRequired=%d", sizeRequired );
       
   622 	
   601 	User::LeaveIfError(sizeRequired); 	// Negative values are error codes
   623 	User::LeaveIfError(sizeRequired); 	// Negative values are error codes
   602 	if (sizeRequired > 0)	// If the initial buffer was too small...
   624 	if (sizeRequired > 0)	// If the initial buffer was too small...
   603 		{
   625 		{
   604 		// (This should really never happen - the code below is a backup for release builds only
   626 		// (This should really never happen - the code below is a backup for release builds only
   605 		ASSERT(0); // so panic any debug builds)
   627 		ASSERT(0); // so panic any debug builds)
   648 EXPORT_C TInt RApaLsSession::GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const
   670 EXPORT_C TInt RApaLsSession::GetAppIcon(TUid aAppUid, TSize aSize, CApaMaskedBitmap& aAppBitmap) const
   649 	{
   671 	{
   650 	SReturnData_AppIconByUidAndSize returnData = {0,0};
   672 	SReturnData_AppIconByUidAndSize returnData = {0,0};
   651 	TPckg<SReturnData_AppIconByUidAndSize> returnData_asDescriptor(returnData);
   673 	TPckg<SReturnData_AppIconByUidAndSize> returnData_asDescriptor(returnData);
   652 	TInt error = SendReceiveWithReconnect(EAppListServAppIconByUidAndSize, TIpcArgs(aAppUid.iUid,aSize.iWidth,aSize.iHeight,&returnData_asDescriptor));
   674 	TInt error = SendReceiveWithReconnect(EAppListServAppIconByUidAndSize, TIpcArgs(aAppUid.iUid,aSize.iWidth,aSize.iHeight,&returnData_asDescriptor));
       
   675 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_GETAPPICON, "SendReceiveWithReconnect returned with error=%d", error );
       
   676 	
   653 	if (!error)
   677 	if (!error)
   654 		{
   678 		{
   655 		error = aAppBitmap.Duplicate(returnData.iIcon);
   679 		error = aAppBitmap.Duplicate(returnData.iIcon);
       
   680 		OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP1_RAPALSSESSION_GETAPPICON, "aAppBitmap.Duplicate returned with error=%d", error );
       
   681 		
   656 		if (!error)
   682 		if (!error)
       
   683 		    {
   657 			error = aAppBitmap.Mask()->Duplicate(returnData.iIconMask);
   684 			error = aAppBitmap.Mask()->Duplicate(returnData.iIconMask);
       
   685 		    OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP2_RAPALSSESSION_GETAPPICON, "aAppBitmap.Mask->Duplicate returned with error=%d", error );
       
   686 		    }
   658 		}
   687 		}
   659 
   688 	
       
   689 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP3_RAPALSSESSION_GETAPPICON, "RApaLsSession::GetAppIcon will return with error=%d", error );
   660 	return error;
   690 	return error;
   661 	}
   691 	}
   662 
   692 
   663 
   693 
   664 /** 
   694 /** 
   682 	{
   712 	{
   683 	__ASSERT_ALWAYS((aSize>=0) && (aSize<3), Panic(EDPanicBadIconSize));
   713 	__ASSERT_ALWAYS((aSize>=0) && (aSize<3), Panic(EDPanicBadIconSize));
   684 	SReturnData_AppIconByUid returnData = {0,0};
   714 	SReturnData_AppIconByUid returnData = {0,0};
   685 	TPckg<SReturnData_AppIconByUid> returnData_asDescriptor(returnData);
   715 	TPckg<SReturnData_AppIconByUid> returnData_asDescriptor(returnData);
   686 	TInt error = SendReceiveWithReconnect(EAppListServAppIconByUid,TIpcArgs(aAppUid.iUid,aSize,&returnData_asDescriptor));
   716 	TInt error = SendReceiveWithReconnect(EAppListServAppIconByUid,TIpcArgs(aAppUid.iUid,aSize,&returnData_asDescriptor));
       
   717 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP5_RAPALSSESSION_GETAPPICON, "SendReceiveWithReconnect returned with error=%d", error );
       
   718 	
       
   719 	
   687 	if (!error)
   720 	if (!error)
   688 		{
   721 		{
   689 		error = aAppBitmap.Duplicate(returnData.iIcon);
   722 		error = aAppBitmap.Duplicate(returnData.iIcon);
       
   723 		OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP6_RAPALSSESSION_GETAPPICON, "aAppBitmap.Duplicate returned with error=%d", error );
       
   724 		
   690 		if (!error)
   725 		if (!error)
       
   726 		    {
   691 			error = aAppBitmap.Mask()->Duplicate(returnData.iIconMask);
   727 			error = aAppBitmap.Mask()->Duplicate(returnData.iIconMask);
       
   728 			OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP7_RAPALSSESSION_GETAPPICON, "aAppBitmap.Mask()->Duplicate returned with error=%d", error );
       
   729 		    }
   692 		}
   730 		}
   693 		
   731 	
       
   732 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP8_RAPALSSESSION_GETAPPICON, "RApaLsSession::GetAppIcon will return with error=%d", error );
   694 	return error;
   733 	return error;
   695 	}
   734 	}
   696 
   735 
   697 
   736 
   698 /** Gets an open shareable read only file handle to the application icon file for the 
   737 /** Gets an open shareable read only file handle to the application icon file for the 
   714 EXPORT_C TInt RApaLsSession::GetAppIcon(TUid aAppUid, RFile& aFile) const 
   753 EXPORT_C TInt RApaLsSession::GetAppIcon(TUid aAppUid, RFile& aFile) const 
   715 	{
   754 	{
   716 	__ASSERT_ALWAYS(aFile.SubSessionHandle() == KNullHandle, Panic(EDPanicHandleAlreadySet));
   755 	__ASSERT_ALWAYS(aFile.SubSessionHandle() == KNullHandle, Panic(EDPanicHandleAlreadySet));
   717 	TPckgBuf<TInt> fileHandle;
   756 	TPckgBuf<TInt> fileHandle;
   718 	TInt sessionHandleOrErrorCode = SendReceiveWithReconnect(EAppListServAppIconFileHandle, TIpcArgs(aAppUid.iUid, &fileHandle));
   757 	TInt sessionHandleOrErrorCode = SendReceiveWithReconnect(EAppListServAppIconFileHandle, TIpcArgs(aAppUid.iUid, &fileHandle));
       
   758 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP4_RAPALSSESSION_GETAPPICON, "SendReceiveWithReconnect returned with sessionHandleOrErrorCode=%d", sessionHandleOrErrorCode );
       
   759 	
   719 	if (sessionHandleOrErrorCode >= KErrNone)
   760 	if (sessionHandleOrErrorCode >= KErrNone)
   720 	    {
   761 	    {
   721 	    sessionHandleOrErrorCode = aFile.AdoptFromServer(sessionHandleOrErrorCode, fileHandle());
   762 	    sessionHandleOrErrorCode = aFile.AdoptFromServer(sessionHandleOrErrorCode, fileHandle());
       
   763 	    OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP9_RAPALSSESSION_GETAPPICON, "aFile.AdoptFromServer returned with sessionHandleOrErrorCode=%d", sessionHandleOrErrorCode );
   722 	    }
   764 	    }
       
   765 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP10_RAPALSSESSION_GETAPPICON, "RApaLsSession::GetAppIcon will return with sessionHandleOrErrorCode=%d", sessionHandleOrErrorCode );
   723 	return sessionHandleOrErrorCode;
   766 	return sessionHandleOrErrorCode;
   724 	}   
   767 	}   
   725 
   768 
   726 
   769 
   727 /** Gets the data (MIME) type of the data in the specified file and gets the UID 
   770 /** Gets the data (MIME) type of the data in the specified file and gets the UID 
   733 @param aDataType On return, the data (MIME) type.
   776 @param aDataType On return, the data (MIME) type.
   734 @return KErrNone, if successful; otherwise one of the other system-wide error 
   777 @return KErrNone, if successful; otherwise one of the other system-wide error 
   735 codes. */
   778 codes. */
   736 EXPORT_C TInt RApaLsSession::AppForDocument(const TDesC& aFileName, TUid& aAppUid, TDataType& aDataType) const
   779 EXPORT_C TInt RApaLsSession::AppForDocument(const TDesC& aFileName, TUid& aAppUid, TDataType& aDataType) const
   737 	{
   780 	{
   738 	return DoAppForDocumentOptionallySpecifyingService(aFileName, TUid::Null(), aAppUid, aDataType, EAppListServAppForDocument);
   781     OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_APPFORDOCUMENT, "RApaLsSession::AppForDocument" );
       
   782  	return DoAppForDocumentOptionallySpecifyingService(aFileName, TUid::Null(), aAppUid, aDataType, EAppListServAppForDocument);
   739 	}
   783 	}
   740 
   784 
   741 
   785 
   742 /** Gets the data (MIME) type of the data in the specified file and gets the UID 
   786 /** Gets the data (MIME) type of the data in the specified file and gets the UID 
   743 of an application that can handle this type.
   787 of an application that can handle this type.
   751 @return KErrNone, if successful; otherwise one of the other system-wide error 
   795 @return KErrNone, if successful; otherwise one of the other system-wide error 
   752 codes. 
   796 codes. 
   753 */
   797 */
   754 EXPORT_C TInt RApaLsSession::AppForDocument(const RFile& aFile, TUid& aAppUid, TDataType& aDataType) const
   798 EXPORT_C TInt RApaLsSession::AppForDocument(const RFile& aFile, TUid& aAppUid, TDataType& aDataType) const
   755 	{
   799 	{
   756 	return DoAppForDocumentOptionallySpecifyingService(aFile, TUid::Null(), aAppUid, aDataType, EAppListServAppForDocumentPassedByFileHandle);
   800     OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_APPFORDOCUMENT, "RApaLsSession::AppForDocument" );
       
   801  	return DoAppForDocumentOptionallySpecifyingService(aFile, TUid::Null(), aAppUid, aDataType, EAppListServAppForDocumentPassedByFileHandle);
   757 	}
   802 	}
   758 
   803 
   759 
   804 
   760 /** Tests whether the file is a native executable (DLL or EXE).
   805 /** Tests whether the file is a native executable (DLL or EXE).
   761 
   806 
   767 */
   812 */
   768 EXPORT_C TInt RApaLsSession::IsProgram(const TDesC& aFileName, TBool& aProgram) const
   813 EXPORT_C TInt RApaLsSession::IsProgram(const TDesC& aFileName, TBool& aProgram) const
   769 	{
   814 	{
   770 	_LIT(KLitSysBin, "\\sys\\bin\\");
   815 	_LIT(KLitSysBin, "\\sys\\bin\\");
   771 	aProgram=(TParsePtrC(aFileName).Path().CompareF(KLitSysBin)==0);
   816 	aProgram=(TParsePtrC(aFileName).Path().CompareF(KLitSysBin)==0);
       
   817 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_ISPROGRAM, "RApaLsSession::IsProgram will return with KErrNone" );
   772 	return KErrNone;
   818 	return KErrNone;
   773 	}
   819 	}
   774 
   820 
   775 
   821 
   776 /** Gets the preferred number of bytes of data to read from a file for the purpose 
   822 /** Gets the preferred number of bytes of data to read from a file for the purpose 
   787 @see GetMaxDataBufSize() */
   833 @see GetMaxDataBufSize() */
   788 EXPORT_C TInt RApaLsSession::GetPreferredBufSize(TInt& aPreferredBufSize) const
   834 EXPORT_C TInt RApaLsSession::GetPreferredBufSize(TInt& aPreferredBufSize) const
   789 	{
   835 	{
   790 	const TInt preferredBufSize = SendReceiveWithReconnect(EAppListServPreferredBufSize, TIpcArgs());
   836 	const TInt preferredBufSize = SendReceiveWithReconnect(EAppListServPreferredBufSize, TIpcArgs());
   791 	if (preferredBufSize < KErrNone)
   837 	if (preferredBufSize < KErrNone)
   792 		return preferredBufSize; // it's an error
   838 	    {
       
   839         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETPREFERREDBUFSIZE, "Error condition - RApaLsSession::GetPreferredBufSize will return with preferredBufSize=%d", preferredBufSize );
       
   840         return preferredBufSize; // it's an error
       
   841 	    }
   793 
   842 
   794 	aPreferredBufSize = preferredBufSize;
   843 	aPreferredBufSize = preferredBufSize;
       
   844 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_GETPREFERREDBUFSIZE, "RApaLsSession::GetPreferredBufSize will return with KErrNone" );
   795 	return KErrNone;
   845 	return KErrNone;
   796 	}
   846 	}
   797 
   847 
   798 
   848 
   799 /** Gets the maximum size of the data that can be read from a file for the purpose 
   849 /** Gets the maximum size of the data that can be read from a file for the purpose 
   810 @see GetPreferredBufSize() */
   860 @see GetPreferredBufSize() */
   811 EXPORT_C TInt RApaLsSession::GetMaxDataBufSize(TInt& aBufSize) const
   861 EXPORT_C TInt RApaLsSession::GetMaxDataBufSize(TInt& aBufSize) const
   812 	{
   862 	{
   813 	const TInt returnValue = SendReceiveWithReconnect(EAppListServGetBufSize, TIpcArgs());
   863 	const TInt returnValue = SendReceiveWithReconnect(EAppListServGetBufSize, TIpcArgs());
   814 	if (returnValue < 0)
   864 	if (returnValue < 0)
   815 		return returnValue;
   865 	    {
   816 
   866         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETMAXDATABUFSIZE, "RApaLsSession::GetMaxDataBufSize will return with returnValue=%d", returnValue );
       
   867  		return returnValue;
       
   868 	    }
   817 	aBufSize = returnValue;
   869 	aBufSize = returnValue;
       
   870 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_GETMAXDATABUFSIZE, "RApaLsSession::GetMaxDataBufSize will return with KErrNone" );
   818 	return KErrNone;
   871 	return KErrNone;
   819 	}
   872 	}
   820 
   873 
   821 
   874 
   822 /** Sets the maximum size of the data that can be read from a file for the purpose 
   875 /** Sets the maximum size of the data that can be read from a file for the purpose 
   836 @see RecognizeData()
   889 @see RecognizeData()
   837 @see RecognizeSpecificData() 
   890 @see RecognizeSpecificData() 
   838 */
   891 */
   839 EXPORT_C TInt RApaLsSession::SetMaxDataBufSize(TInt aBufSize)
   892 EXPORT_C TInt RApaLsSession::SetMaxDataBufSize(TInt aBufSize)
   840 	{
   893 	{
   841 	return SendReceiveWithReconnect(EAppListServSetBufSize,TIpcArgs(aBufSize));
   894     OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_SETMAXDATABUFSIZE, "RApaLsSession::SetMaxDataBufSize" );
       
   895  	return SendReceiveWithReconnect(EAppListServSetBufSize,TIpcArgs(aBufSize));
   842 	} //lint !e1762 Suppress member function could be made const
   896 	} //lint !e1762 Suppress member function could be made const
   843 
   897 
   844 
   898 
   845 /** Gets the icon for the specified view published by the application that has 
   899 /** Gets the icon for the specified view published by the application that has 
   846 the specified UID.
   900 the specified UID.
   861 	const TApaAppViewIconSizeData appViewIconSizeData(aAppUid, aViewUid, aSize);
   915 	const TApaAppViewIconSizeData appViewIconSizeData(aAppUid, aViewUid, aSize);
   862 	const TPckgC<TApaAppViewIconSizeData> inputData(appViewIconSizeData);
   916 	const TPckgC<TApaAppViewIconSizeData> inputData(appViewIconSizeData);
   863 	SReturnData_ViewIconByUidAndSize returnData = {0,0};
   917 	SReturnData_ViewIconByUidAndSize returnData = {0,0};
   864 	TPckg<SReturnData_ViewIconByUidAndSize> returnData_asDescriptor(returnData);
   918 	TPckg<SReturnData_ViewIconByUidAndSize> returnData_asDescriptor(returnData);
   865 	TInt error = SendReceiveWithReconnect(EAppListServViewIconByUidAndSize,TIpcArgs(&inputData,&returnData_asDescriptor));
   919 	TInt error = SendReceiveWithReconnect(EAppListServViewIconByUidAndSize,TIpcArgs(&inputData,&returnData_asDescriptor));
       
   920 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_GETAPPVIEWICON, "SendReceiveWithReconnect returned with error=%d", error );
       
   921 	
   866 	if (!error)
   922 	if (!error)
   867 		{
   923 		{
   868 		error = aViewBitmap.Duplicate(returnData.iIcon);
   924 		error = aViewBitmap.Duplicate(returnData.iIcon);
       
   925 		OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP1_RAPALSSESSION_GETAPPVIEWICON, "aViewBitmap.Duplicate returned with error=%d", error );
       
   926 		
   869 		if (!error)
   927 		if (!error)
   870 			error = aViewBitmap.Mask()->Duplicate(returnData.iIconMask);
   928 		    {
       
   929     		error = aViewBitmap.Mask()->Duplicate(returnData.iIconMask);
       
   930     	    OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP2_RAPALSSESSION_GETAPPVIEWICON, "aViewBitmap.Mask().Duplicate returned with error=%d", error );
       
   931     	    }
   871 		}
   932 		}
   872 		
   933 	
       
   934 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP3_RAPALSSESSION_GETAPPVIEWICON, "RApaLsSession::GetAppViewIcon will return with error=%d", error );
   873 	return error;
   935 	return error;
   874 	}
   936 	}
   875 
   937 
   876 
   938 
   877 /** Gets the views published by the application that has the specified UID.
   939 /** Gets the views published by the application that has the specified UID.
   887 @see TApaAppViewInfo 
   949 @see TApaAppViewInfo 
   888 */
   950 */
   889 EXPORT_C TInt RApaLsSession::GetAppViews(CApaAppViewArray& aAppViews, TUid aAppUid) const
   951 EXPORT_C TInt RApaLsSession::GetAppViews(CApaAppViewArray& aAppViews, TUid aAppUid) const
   890 	{
   952 	{
   891 	TRAPD(error,DoGetAppViewsL(aAppViews,aAppUid));
   953 	TRAPD(error,DoGetAppViewsL(aAppViews,aAppUid));
       
   954 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETAPPVIEWS, "DoGetAppViewsL returned.RApaLsSession::GetAppViews will return with error=%d", error );
   892 	return error;
   955 	return error;
   893 	}
   956 	}
   894 
   957 
   895 void RApaLsSession::DoGetAppViewsL(CApaAppViewArray& aArrayToFill, TUid aAppUid) const
   958 void RApaLsSession::DoGetAppViewsL(CApaAppViewArray& aArrayToFill, TUid aAppUid) const
   896 	{
   959 	{
   913 be found; otherwise one of the other system wide error codes. 
   976 be found; otherwise one of the other system wide error codes. 
   914 */
   977 */
   915 EXPORT_C TInt RApaLsSession::GetAppOwnedFiles(CDesCArray& aAppOwnedFiles, TUid aAppUid) const
   978 EXPORT_C TInt RApaLsSession::GetAppOwnedFiles(CDesCArray& aAppOwnedFiles, TUid aAppUid) const
   916 	{
   979 	{
   917 	TRAPD(error,DoGetAppOwnedFilesL(aAppOwnedFiles,aAppUid));
   980 	TRAPD(error,DoGetAppOwnedFilesL(aAppOwnedFiles,aAppUid));
       
   981 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETAPPOWNEDFILES, "DoGetAppOwnedFilesL returned.RApaLsSession::GetAppOwnedFiles will return with error=%d", error );
   918 	return error;
   982 	return error;
   919 	}
   983 	}
   920 
   984 
   921 
   985 
   922 /** Gets the number of icons defined by the app that has the specified UID
   986 /** Gets the number of icons defined by the app that has the specified UID
   930 KErrNotSupported, if the application provides icons in non-MBM format; otherwise one of 
   994 KErrNotSupported, if the application provides icons in non-MBM format; otherwise one of 
   931 the other system-wide error codes. 
   995 the other system-wide error codes. 
   932 */
   996 */
   933 EXPORT_C TInt RApaLsSession::NumberOfOwnDefinedIcons(TUid aAppUid, TInt& aCount) const
   997 EXPORT_C TInt RApaLsSession::NumberOfOwnDefinedIcons(TUid aAppUid, TInt& aCount) const
   934 	{
   998 	{
       
   999     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_NUMBEROFOWNDEFINEDICONS, "RApaLsSession::NumberOfOwnDefinedIcons: Application UID - aAppUid.iUid=%d", aAppUid.iUid );
       
  1000     
       
  1001     
   935 	TPckgBuf<TInt> pckg;
  1002 	TPckgBuf<TInt> pckg;
   936 	const TInt err = SendReceiveWithReconnect(EAppListServNumberOfOwnDefinedIcons,TIpcArgs(aAppUid.iUid,&pckg));
  1003 	const TInt err = SendReceiveWithReconnect(EAppListServNumberOfOwnDefinedIcons,TIpcArgs(aAppUid.iUid,&pckg));
   937 	if (!err)
  1004 	if (!err)
   938 		aCount = pckg();
  1005 		aCount = pckg();
   939 
  1006 	
       
  1007 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_NUMBEROFOWNDEFINEDICONS, "RApaLsSession::NumberOfOwnDefinedIcons will return with err=%d", err );
   940 	return err;
  1008 	return err;
   941 	}
  1009 	}
   942 
  1010 
   943 
  1011 
   944 /** Gets the full filename of a file containing application icons for the
  1012 /** Gets the full filename of a file containing application icons for the
   955 or an icon filename was not defined; KErrNotSupported, if the application does not
  1023 or an icon filename was not defined; KErrNotSupported, if the application does not
   956 provide an application registration file; otherwise one of the other system wide error codes. 
  1024 provide an application registration file; otherwise one of the other system wide error codes. 
   957 */
  1025 */
   958 EXPORT_C TInt RApaLsSession::GetAppIcon(TUid aAppUid, HBufC*& aFullFileName) const
  1026 EXPORT_C TInt RApaLsSession::GetAppIcon(TUid aAppUid, HBufC*& aFullFileName) const
   959 	{
  1027 	{
       
  1028     OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP11_RAPALSSESSION_GETAPPICON, "RApaLsSession::GetAppIcon;aAppUid=%d;aFullFileName=%S", aAppUid.iUid, *aFullFileName );
       
  1029     
   960 	TFileName fileName;
  1030 	TFileName fileName;
   961 	TPckg<TFileName> filenamePckg(fileName);
  1031 	TPckg<TFileName> filenamePckg(fileName);
   962 	const TInt err = SendReceiveWithReconnect(EAppListServAppIconFileName, TIpcArgs(aAppUid.iUid, &filenamePckg));
  1032 	const TInt err = SendReceiveWithReconnect(EAppListServAppIconFileName, TIpcArgs(aAppUid.iUid, &filenamePckg));
       
  1033 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP12_RAPALSSESSION_GETAPPICON, "SendReceiveWithReconnect returned with err=%d", err );
       
  1034 	
   963 	if (!err)
  1035 	if (!err)
   964 		{
  1036 		{
   965 		HBufC* fullFileName = HBufC::New(fileName.Length());
  1037 		HBufC* fullFileName = HBufC::New(fileName.Length());
   966 		if (fullFileName == NULL)
  1038 		if (fullFileName == NULL)
   967 			return KErrNoMemory;
  1039 		    {
       
  1040             OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP13_RAPALSSESSION_GETAPPICON, "RApaLsSession::GetAppIcon will return with KErrNoMemory" );
       
  1041             return KErrNoMemory;
       
  1042 		    }
   968 		else
  1043 		else
   969 			{
  1044 			{
   970 			*fullFileName = fileName;
  1045 			*fullFileName = fileName;
   971 			aFullFileName = fullFileName; // ownership transferred to caller
  1046 			aFullFileName = fullFileName; // ownership transferred to caller
   972 			}
  1047 			}
   973 		}
  1048 		}
   974 		
  1049 	
       
  1050 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP14_RAPALSSESSION_GETAPPICON, "RApaLsSession::GetAppIcon will retun with err=%d", err );
   975 	return err;
  1051 	return err;
   976 	}
  1052 	}
   977 
  1053 
   978 
  1054 
   979 /** Gets the full filename of a file containing view-specific icons for the application
  1055 /** Gets the full filename of a file containing view-specific icons for the application
   992 could be found, or a view icon filename was not defined; KErrNotSupported, if the application
  1068 could be found, or a view icon filename was not defined; KErrNotSupported, if the application
   993 does not provide an application registration file; otherwise one of the other system wide error codes. 
  1069 does not provide an application registration file; otherwise one of the other system wide error codes. 
   994 */
  1070 */
   995 EXPORT_C TInt RApaLsSession::GetAppViewIcon(TUid aAppUid, TUid aViewUid, HBufC*& aFullFileName) const
  1071 EXPORT_C TInt RApaLsSession::GetAppViewIcon(TUid aAppUid, TUid aViewUid, HBufC*& aFullFileName) const
   996 	{
  1072 	{
   997 	TFileName fileName;
  1073     OstTraceDefExt3( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP6_RAPALSSESSION_GETAPPVIEWICON, "RApaLsSession::GetAppViewIcon;aAppUid=%d;aViewUid=%d;aFullFileName=%S", aAppUid.iUid, aViewUid.iUid , *aFullFileName );
       
  1074     
       
  1075   	TFileName fileName;
   998 	TPckg<TFileName> filenamePckg(fileName);
  1076 	TPckg<TFileName> filenamePckg(fileName);
   999 	const TInt err = SendReceiveWithReconnect(EAppListServAppViewIconFileName, TIpcArgs(aAppUid.iUid, aViewUid.iUid, &filenamePckg));
  1077 	const TInt err = SendReceiveWithReconnect(EAppListServAppViewIconFileName, TIpcArgs(aAppUid.iUid, aViewUid.iUid, &filenamePckg));
       
  1078 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP4_RAPALSSESSION_GETAPPVIEWICON, "SendReceiveWithReconnect returned with err=%d", err );
       
  1079 	
  1000 	if (!err)
  1080 	if (!err)
  1001 		{
  1081 		{
  1002 		HBufC* fullFileName = HBufC::New(fileName.Length());
  1082 		HBufC* fullFileName = HBufC::New(fileName.Length());
  1003 		if (fullFileName == NULL)
  1083 		if (fullFileName == NULL)
  1004 			return KErrNoMemory;
  1084 		    {
       
  1085             OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP5_RAPALSSESSION_GETAPPVIEWICON, "RApaLsSession::GetAppViewIcon will return with KErrNoMemory" );
       
  1086  			return KErrNoMemory;
       
  1087 		    }
  1005 		else
  1088 		else
  1006 			{
  1089 			{
  1007 			*fullFileName = fileName;
  1090 			*fullFileName = fileName;
  1008 			aFullFileName = fullFileName; // ownership transferred to caller
  1091 			aFullFileName = fullFileName; // ownership transferred to caller
  1009 			}
  1092 			}
  1010 		}
  1093 		}
  1011 
  1094 
  1012 	return err;
  1095     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP7_RAPALSSESSION_GETAPPVIEWICON, "RApaLsSession::GetAppViewIcon will return with err=%d", err );
       
  1096  	return err;
  1013 	}
  1097 	}
  1014 
  1098 
  1015 
  1099 
  1016 /** Changes an existing data type mapping, or adds a new one.
  1100 /** Changes an existing data type mapping, or adds a new one.
  1017 
  1101 
  1070 	TPckgBuf<TBool> inserted(EFalse);
  1154 	TPckgBuf<TBool> inserted(EFalse);
  1071 	const TPckgC<TDataType> dataType(aDataType);
  1155 	const TPckgC<TDataType> dataType(aDataType);
  1072 	const TInt err = SendReceiveWithReconnect(EAppListInsertDataMappingIfHigher, TIpcArgs(&dataType, TInt(aPriority), aUid.iUid, &inserted));
  1156 	const TInt err = SendReceiveWithReconnect(EAppListInsertDataMappingIfHigher, TIpcArgs(&dataType, TInt(aPriority), aUid.iUid, &inserted));
  1073 	if(!err)
  1157 	if(!err)
  1074 		aInserted = inserted();
  1158 		aInserted = inserted();
  1075 		
  1159 	
       
  1160 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_INSERTDATAMAPPINGIFHIGHER, "RApaLsSession::InsertDataMappingIfHigher will return with error returned by SendReceiveWithReconnect : err=%d", err );
  1076 	return err;
  1161 	return err;
  1077 	} //lint !e1762 Suppress member function could be made const
  1162 	} //lint !e1762 Suppress member function could be made const
  1078 
  1163 
  1079 
  1164 
  1080 
  1165 
  1129 	{
  1214 	{
  1130 	const TPckgC<TDataType> dataType(aDataType);
  1215 	const TPckgC<TDataType> dataType(aDataType);
  1131 	TPckg<TUid> uid(aAppUid);
  1216 	TPckg<TUid> uid(aAppUid);
  1132 	const TInt returnValue = SendReceiveWithReconnect(EAppListServGetAppByDataType,TIpcArgs(&dataType, aServiceUid.iUid, &uid));
  1217 	const TInt returnValue = SendReceiveWithReconnect(EAppListServGetAppByDataType,TIpcArgs(&dataType, aServiceUid.iUid, &uid));
  1133 	if (returnValue < 0)
  1218 	if (returnValue < 0)
  1134 		return returnValue;
  1219 	    {
       
  1220         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETAPPBYDATATYPE, "RApaLsSession::GetAppByDataType will return with error returned by SendReceiveWithReconnect : returnValue=%d", returnValue );
       
  1221         return returnValue;
       
  1222 	    }
  1135 	
  1223 	
  1136 	return (aAppUid == KNullUid ? KErrNotFound : KErrNone);
  1224 	return (aAppUid == KNullUid ? KErrNotFound : KErrNone);
  1137 	} //lint !e1764 Suppress reference parameter 'aAppUid' could be declared const ref
  1225 	} //lint !e1764 Suppress reference parameter 'aAppUid' could be declared const ref
  1138 
  1226 
  1139 
  1227 
  1144 @return KErrNone, if successful; KErrNotFound, if a matching application could not be found; 
  1232 @return KErrNone, if successful; KErrNotFound, if a matching application could not be found; 
  1145 otherwise one of the other system wide error codes.
  1233 otherwise one of the other system wide error codes.
  1146 */
  1234 */
  1147 EXPORT_C TInt RApaLsSession::ApplicationLanguage(TUid aAppUid, TLanguage& aLanguage) const
  1235 EXPORT_C TInt RApaLsSession::ApplicationLanguage(TUid aAppUid, TLanguage& aLanguage) const
  1148 	{
  1236 	{
       
  1237     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_APPLICATIONLANGUAGE, "RApaLsSession::ApplicationLanguage;Application UID is aAppUid=%d", aAppUid.iUid );
       
  1238     
  1149 	TPckgBuf<TLanguage> pckg;
  1239 	TPckgBuf<TLanguage> pckg;
  1150 	const TInt err = SendReceiveWithReconnect(EAppListServApplicationLanguage, TIpcArgs(aAppUid.iUid, &pckg));
  1240 	const TInt err = SendReceiveWithReconnect(EAppListServApplicationLanguage, TIpcArgs(aAppUid.iUid, &pckg));
  1151 	if (!err)
  1241 	if (!err)
  1152 		aLanguage = pckg();
  1242 		aLanguage = pckg();
  1153 
  1243 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_INTERNAL, DUP2_RAPALSSESSION_APPLICATIONLANGUAGE, "Application language: aLanguage returned = %d", aLanguage );
       
  1244 	
       
  1245 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_APPLICATIONLANGUAGE, "RApaLsSession::ApplicationLanguage will return with err = %d", err );
  1154 	return err;
  1246 	return err;
  1155 	}
  1247 	}
  1156 
  1248 
  1157 
  1249 
  1158 /** Gets the services implemented by the application that has the specified
  1250 /** Gets the services implemented by the application that has the specified
  1353 @publishedPartner
  1445 @publishedPartner
  1354 @released
  1446 @released
  1355 */
  1447 */
  1356 EXPORT_C CApaAppServiceInfoArray* RApaLsSession::GetAppServiceOpaqueDataLC(TUid aAppUid, TUid aServiceUid) const
  1448 EXPORT_C CApaAppServiceInfoArray* RApaLsSession::GetAppServiceOpaqueDataLC(TUid aAppUid, TUid aServiceUid) const
  1357 	{
  1449 	{
  1358 	CArrayFixFlat<TApaAppServiceInfo>* serviceArray = new(ELeave) CArrayFixFlat<TApaAppServiceInfo>(4);
  1450     OstTraceDefExt2( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETAPPSERVICEOPAQUEDATALC, "RApaLsSession::GetAppServiceOpaqueDataLC;aAppUid=%d;aServiceUid=%d", aAppUid.iUid, aServiceUid.iUid );
       
  1451     CArrayFixFlat<TApaAppServiceInfo>* serviceArray = new(ELeave) CArrayFixFlat<TApaAppServiceInfo>(4);
  1359 	CleanupStack::PushL(TCleanupItem(CleanupAppServiceArray, serviceArray));
  1452 	CleanupStack::PushL(TCleanupItem(CleanupAppServiceArray, serviceArray));
  1360 	CBufBase* buffer = GetServiceBufferLC(EAppListServGetAppServiceOpaqueData, aAppUid, aServiceUid);
  1453 	CBufBase* buffer = GetServiceBufferLC(EAppListServGetAppServiceOpaqueData, aAppUid, aServiceUid);
  1361 	RBufReadStream readStream(*buffer);
  1454 	RBufReadStream readStream(*buffer);
  1362 	readStream >> *serviceArray;
  1455 	readStream >> *serviceArray;
  1363 	CleanupStack::PopAndDestroy(buffer);
  1456 	CleanupStack::PopAndDestroy(buffer);
  1431 TInt RApaLsSession::DoAppForDocumentOptionallySpecifyingService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const
  1524 TInt RApaLsSession::DoAppForDocumentOptionallySpecifyingService(const TDesC& aFileName, TUid aServiceUid, TUid& aAppUid, TDataType& aDataType, TInt aOpcode) const
  1432 	{
  1525 	{
  1433 	if (!aFileName.Length())
  1526 	if (!aFileName.Length())
  1434 		{
  1527 		{
  1435 		aAppUid = KNullUid;
  1528 		aAppUid = KNullUid;
       
  1529 		OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_DOAPPFORDOCUMENTOPTIONALLYSPECIFYINGSERVICE, "RApaLsSession::DoAppForDocumentOptionallySpecifyingService will return with KErrNone" );
  1436 		return KErrNone;
  1530 		return KErrNone;
  1437 		}
  1531 		}
  1438 		
  1532 		
  1439 	HBufC8* buffer = NULL;
  1533 	HBufC8* buffer = NULL;
  1440 	TInt error = GetNewBufferFromFile(buffer, aFileName);
  1534 	TInt error = GetNewBufferFromFile(buffer, aFileName);
  1441 	if (error)
  1535 	if (error)
  1442 		return error;
  1536 	    {
       
  1537         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP5_RAPALSSESSION_DOAPPFORDOCUMENTOPTIONALLYSPECIFYINGSERVICE, "RApaLsSession::DoAppForDocumentOptionallySpecifyingService will return with error return by GetNewBufferFromFile : error=%d", error );
       
  1538         return error;
       
  1539 	    }
  1443 
  1540 
  1444 	SReturnData_AppForDocument returnData;
  1541 	SReturnData_AppForDocument returnData;
  1445 	TPckg<SReturnData_AppForDocument> returnData_asDescriptor(returnData);
  1542 	TPckg<SReturnData_AppForDocument> returnData_asDescriptor(returnData);
  1446 	error = SendReceiveWithReconnect(aOpcode, TIpcArgs(&returnData_asDescriptor, aServiceUid.iUid, &aFileName, buffer));
  1543 	error = SendReceiveWithReconnect(aOpcode, TIpcArgs(&returnData_asDescriptor, aServiceUid.iUid, &aFileName, buffer));
  1447 	delete buffer;
  1544 	delete buffer;
  1450 	if (!error)
  1547 	if (!error)
  1451 		{
  1548 		{
  1452 		aAppUid = returnData.iUid;
  1549 		aAppUid = returnData.iUid;
  1453 		aDataType = returnData.iDataType;
  1550 		aDataType = returnData.iDataType;
  1454 		}
  1551 		}
  1455 
  1552 	
       
  1553 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP6_RAPALSSESSION_DOAPPFORDOCUMENTOPTIONALLYSPECIFYINGSERVICE, "RApaLsSession::DoAppForDocumentOptionallySpecifyingService will return with thr return value from SendReceiveWithReconnect : error=%d", error );
  1456 	return error;
  1554 	return error;
  1457 	}
  1555 	}
  1458 
  1556 
  1459 /**
  1557 /**
  1460 */
  1558 */
  1462 	{
  1560 	{
  1463 	SReturnData_AppForDocument returnData;
  1561 	SReturnData_AppForDocument returnData;
  1464 	TPckg<SReturnData_AppForDocument> returnData_asDescriptor(returnData);
  1562 	TPckg<SReturnData_AppForDocument> returnData_asDescriptor(returnData);
  1465 	TIpcArgs ipcArgs(&returnData_asDescriptor, aServiceUid.iUid);
  1563 	TIpcArgs ipcArgs(&returnData_asDescriptor, aServiceUid.iUid);
  1466 	TInt error = aFile.TransferToServer(ipcArgs, 2, 3);
  1564 	TInt error = aFile.TransferToServer(ipcArgs, 2, 3);
       
  1565 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP2_RAPALSSESSION_DOAPPFORDOCUMENTOPTIONALLYSPECIFYINGSERVICE, "aFile.TransferToServer returned with error=%d", error );
       
  1566 	
  1467 	if (!error)
  1567 	if (!error)
       
  1568 	    {
  1468 		error = SendReceiveWithReconnect(aOpcode, ipcArgs);
  1569 		error = SendReceiveWithReconnect(aOpcode, ipcArgs);
       
  1570 		OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP3_RAPALSSESSION_DOAPPFORDOCUMENTOPTIONALLYSPECIFYINGSERVICE, "SendReceiveWithReconnect returned with error=%d", error );
       
  1571 		}
  1469 
  1572 
  1470 	if (!error)
  1573 	if (!error)
  1471 		{
  1574 		{
  1472 		aAppUid = returnData.iUid;
  1575 		aAppUid = returnData.iUid;
  1473 		aDataType = returnData.iDataType;
  1576 		aDataType = returnData.iDataType;
  1474 		}
  1577 		}
  1475 		
  1578 	
       
  1579 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP4_RAPALSSESSION_DOAPPFORDOCUMENTOPTIONALLYSPECIFYINGSERVICE, "RApaLsSession::DoAppForDocumentOptionallySpecifyingService will return with error=%d", error );
  1476 	return error;
  1580 	return error;
  1477 	}
  1581 	}
  1478 
  1582 
  1479 /**
  1583 /**
  1480 */
  1584 */
  1481 TInt RApaLsSession::GetNewBufferFromFile(HBufC8*& aBuffer, const TDesC& aFileName) const
  1585 TInt RApaLsSession::GetNewBufferFromFile(HBufC8*& aBuffer, const TDesC& aFileName) const
  1482 	{
  1586 	{
  1483 	aBuffer = NULL;
  1587 	aBuffer = NULL;
  1484 	TInt preferredBufSize = 0;
  1588 	TInt preferredBufSize = 0;
  1485 	const TInt error = GetPreferredBufSize(preferredBufSize);
  1589 	const TInt error = GetPreferredBufSize(preferredBufSize);
       
  1590 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_GETNEWBUFFERFROMFILE, "GetPrefferredBufSize returned with error=%d", error );
       
  1591 	
  1486 	if (error < KErrNone)
  1592 	if (error < KErrNone)
  1487 		return error;
  1593 	    {
       
  1594         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_GETNEWBUFFERFROMFILE, "RApaLsSession::GetNewBufferFromFile returned with error=%d", error );
       
  1595   		return error;
       
  1596 	    }
  1488 
  1597 
  1489 	HBufC8* const buffer = HBufC8::New(Max(8, preferredBufSize)); // 8 is a sensible minimum
  1598 	HBufC8* const buffer = HBufC8::New(Max(8, preferredBufSize)); // 8 is a sensible minimum
  1490 	if (!buffer)
  1599 	if (!buffer)
  1491 		return KErrNoMemory;
  1600 	    {
       
  1601         OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP2_RAPALSSESSION_GETNEWBUFFERFROMFILE, "RApaLsSession::GetNewBufferFromFile will return with KErrNoMemory" );
       
  1602         return KErrNoMemory;
       
  1603 	    }
  1492 
  1604 
  1493 	const RFs* fsSession = FsSession();
  1605 	const RFs* fsSession = FsSession();
  1494 	RFs tempFsSession;
  1606 	RFs tempFsSession;
  1495 	if (!fsSession)
  1607 	if (!fsSession)
  1496 		{
  1608 		{
  1497 		const TInt error = tempFsSession.Connect();
  1609 		const TInt error = tempFsSession.Connect();
       
  1610 		OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP3_RAPALSSESSION_GETNEWBUFFERFROMFILE, "temFsSession.Connect() returned with error=%d", error );
       
  1611 		
  1498 		if (error)
  1612 		if (error)
  1499 			{
  1613 			{
  1500 			delete buffer;
  1614 			delete buffer;
       
  1615 			OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP4_RAPALSSESSION_GETNEWBUFFERFROMFILE, "RApaLsSession::GetNewBufferFromFile will return with error=%d", error );
  1501 			return error;
  1616 			return error;
  1502 			}
  1617 			}
  1503 
  1618 
  1504 		fsSession = &tempFsSession;
  1619 		fsSession = &tempFsSession;
  1505 		}
  1620 		}
  1506 		
  1621 		
  1507 	if (fsSession->IsValidName(aFileName))
  1622 	if (fsSession->IsValidName(aFileName))
  1508 		{
  1623 		{
  1509 		TPtr8 buffer_asWritable(buffer->Des());
  1624 		TPtr8 buffer_asWritable(buffer->Des());
  1510 		const TInt error = fsSession->ReadFileSection(aFileName, 0, buffer_asWritable, preferredBufSize);
  1625 		const TInt error = fsSession->ReadFileSection(aFileName, 0, buffer_asWritable, preferredBufSize);
       
  1626 		OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, DUP5_RAPALSSESSION_GETNEWBUFFERFROMFILE, "fsSession->ReadFileSection returned with error=%d", error );
       
  1627 		
  1511 		if (error)
  1628 		if (error)
  1512 			{
  1629 			{
  1513 			delete buffer;
  1630 			delete buffer;
  1514 			tempFsSession.Close();
  1631 			tempFsSession.Close();
       
  1632 			OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP6_RAPALSSESSION_GETNEWBUFFERFROMFILE, "RApaLsSession::GetNewBufferFromFile will return with error=%d", error );
  1515 			return error;
  1633 			return error;
  1516 			}
  1634 			}
  1517 		}
  1635 		}
  1518 		
  1636 		
  1519 	if (fsSession == &tempFsSession)
  1637 	if (fsSession == &tempFsSession)
  1520 		tempFsSession.Close();
  1638 		tempFsSession.Close();
  1521 		
  1639 		
  1522 	aBuffer = buffer;
  1640 	aBuffer = buffer;
       
  1641 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP7_RAPALSSESSION_GETNEWBUFFERFROMFILE, "RApaLsSession::GetNewBufferFromFile will return with KErrNone" );
  1523 	return KErrNone;
  1642 	return KErrNone;
  1524 	}
  1643 	}
  1525 
  1644 
  1526 
  1645 
  1527 /**
  1646 /**
  1652 	{
  1771 	{
  1653 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK  
  1772 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK  
  1654 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServDeregisterNonNativeApplication, TIpcArgs(aApplication.iUid)));
  1773 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServDeregisterNonNativeApplication, TIpcArgs(aApplication.iUid)));
  1655 #else
  1774 #else
  1656 	(void) aApplication;
  1775 	(void) aApplication;
  1657     User::Leave(KErrNotSupported);  	
  1776 	OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_DEREGISTERNONNATIVEAPPLICATIONL, "RApaLsSession::DeregisterNonNativeApplicationL will leave with KErrNotSupported" );
       
  1777 	User::Leave(KErrNotSupported);  	
  1658 #endif
  1778 #endif
  1659 	} //lint !e1762 Suppress member function could be made const
  1779 	} //lint !e1762 Suppress member function could be made const
  1660 	
  1780 	
  1661 /**
  1781 /**
  1662 Commits the non-native application updates. This is a synchronous method which waits 
  1782 Commits the non-native application updates. This is a synchronous method which waits 
  1742 @param aTypeUid On return contains the application's type
  1862 @param aTypeUid On return contains the application's type
  1743 @param aAppUid The application's UID passed into TIpcArgs	
  1863 @param aAppUid The application's UID passed into TIpcArgs	
  1744 */
  1864 */
  1745 EXPORT_C TInt RApaLsSession::GetAppType(TUid& aTypeUid, TUid aAppUid) const
  1865 EXPORT_C TInt RApaLsSession::GetAppType(TUid& aTypeUid, TUid aAppUid) const
  1746 	{
  1866 	{
  1747 	TPckg<TUid> uid(aTypeUid);
  1867     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_GETAPPTYPE, "Applicatio's uid of of which to get the application type : aAppUid=%d", aAppUid.iUid );
       
  1868     TPckg<TUid> uid(aTypeUid);
  1748 	return SendReceiveWithReconnect(EAppListServGetAppType,TIpcArgs(aAppUid.iUid,&uid));
  1869 	return SendReceiveWithReconnect(EAppListServGetAppType,TIpcArgs(aAppUid.iUid,&uid));
  1749 	} //lint !e1764 Suppress reference parameter 'aTypeUid' could be declared const ref
  1870 	} //lint !e1764 Suppress reference parameter 'aTypeUid' could be declared const ref
  1750 	
  1871 	
  1751 /**
  1872 /**
  1752 This function is only for use by Software Install.
  1873 This function is only for use by Software Install.
  1772 	{
  1893 	{
  1773 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK     
  1894 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK     
  1774 	CBufFlat* buffer = 0;
  1895 	CBufFlat* buffer = 0;
  1775 	TRAPD(err, buffer = CreateRegFilesBufferL(aRegFiles));
  1896 	TRAPD(err, buffer = CreateRegFilesBufferL(aRegFiles));
  1776 	if (err)
  1897 	if (err)
  1777 		return err;
  1898 	    {
       
  1899         return err;
       
  1900 	    }
  1778 	
  1901 	
  1779 	TPtr8 ptr = buffer->Ptr(0);
  1902 	TPtr8 ptr = buffer->Ptr(0);
  1780 	const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
  1903 	const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
  1781 	delete buffer;
  1904 	delete buffer;
  1782 	return returnValue;
  1905 	return returnValue;
  1793 TInt RApaLsSession::SendReceiveWithReconnect(TInt aFunction, const TIpcArgs& aIpcArgs) const
  1916 TInt RApaLsSession::SendReceiveWithReconnect(TInt aFunction, const TIpcArgs& aIpcArgs) const
  1794 	{
  1917 	{
  1795 	TInt ret = SendReceive(aFunction, aIpcArgs);
  1918 	TInt ret = SendReceive(aFunction, aIpcArgs);
  1796 	if(ret != KErrServerTerminated)
  1919 	if(ret != KErrServerTerminated)
  1797 		{
  1920 		{
  1798 		return ret;
  1921         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_SENDRECEIVEWITHRECONNECT, "RApaLsSession::SendReceiveWithReconnect will return with ret=%d", ret );
       
  1922   		return ret;
  1799 		}
  1923 		}
  1800 
  1924 
  1801 	RApaLsSession ls;
  1925 	RApaLsSession ls;
  1802 	TInt err=ls.Connect();
  1926 	TInt err=ls.Connect();
  1803 	if (err==KErrNone)
  1927 	if (err==KErrNone)
  1805 		RApaLsSession* const localThis = const_cast<RApaLsSession*>(this);
  1929 		RApaLsSession* const localThis = const_cast<RApaLsSession*>(this);
  1806 		localThis->Close();
  1930 		localThis->Close();
  1807 		localThis->iHandle=ls.iHandle;
  1931 		localThis->iHandle=ls.iHandle;
  1808 		ret = SendReceive(aFunction, aIpcArgs);
  1932 		ret = SendReceive(aFunction, aIpcArgs);
  1809 		}
  1933 		}
       
  1934 	
       
  1935 	OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_SENDRECEIVEWITHRECONNECT, "RApaLsSession::SendReceiveWithReconnect will return with ret=%d", ret );
       
  1936 	
  1810 	return ret;
  1937 	return ret;
  1811 	}
  1938 	}
  1812 
  1939 
  1813 void RApaLsSession::DoGetAppOwnedFilesL(CDesCArray& aArrayToFill, TUid aAppUid) const
  1940 void RApaLsSession::DoGetAppOwnedFilesL(CDesCArray& aArrayToFill, TUid aAppUid) const
  1814 	{
  1941 	{
  1948 EXPORT_C TInt RApaLsSession::UpdateAppListL(RArray<TApaAppUpdateInfo>& aAppUpdateInfo)
  2075 EXPORT_C TInt RApaLsSession::UpdateAppListL(RArray<TApaAppUpdateInfo>& aAppUpdateInfo)
  1949     {
  2076     {
  1950     //Create a buffer with the application UID and corresponding action information.
  2077     //Create a buffer with the application UID and corresponding action information.
  1951     CBufFlat* buffer = 0;
  2078     CBufFlat* buffer = 0;
  1952     TRAPD(err, buffer = CreateAppUpdateInfoBufferL(aAppUpdateInfo));
  2079     TRAPD(err, buffer = CreateAppUpdateInfoBufferL(aAppUpdateInfo));
       
  2080     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_ERROR, RAPALSSESSION_UPDATEAPPLISTL, "CreateAppUpdateInfoBufferL returned with error=%d", err );
       
  2081     
  1953     if (err)
  2082     if (err)
       
  2083         {
       
  2084         OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_UPDATEAPPLISTL, "RApaLsSession::UpdateAppListL will return with error returned from CreateAppUpdateInfoBufferL" );
  1954         return err;
  2085         return err;
       
  2086         }
  1955     
  2087     
  1956     TPtr8 ptr = buffer->Ptr(0);
  2088     TPtr8 ptr = buffer->Ptr(0);
  1957     const TInt returnValue=SendReceiveWithReconnect(EAppListServUpdateAppList,TIpcArgs(&ptr));
  2089     const TInt returnValue=SendReceiveWithReconnect(EAppListServUpdateAppList,TIpcArgs(&ptr));
  1958     delete buffer;
  2090     delete buffer;
       
  2091     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP2_RAPALSSESSION_UPDATEAPPLISTL, "RApaLsSession::UpdateAppListL will return with error from SendReceiveWithReconnect : returnValue=%d", returnValue );
  1959     return returnValue;
  2092     return returnValue;
  1960     }
  2093     }
  1961 
  2094 
  1962 
  2095 
  1963 /**
  2096 /**
  1978 
  2111 
  1979 EXPORT_C TInt RApaLsSession::ForceRegistration(const RPointerArray<Usif::CApplicationRegistrationData>& aForceRegAppsInfo)
  2112 EXPORT_C TInt RApaLsSession::ForceRegistration(const RPointerArray<Usif::CApplicationRegistrationData>& aForceRegAppsInfo)
  1980 {
  2113 {
  1981     //If there are no applications to update, just return.
  2114     //If there are no applications to update, just return.
  1982     if(aForceRegAppsInfo.Count()==0)
  2115     if(aForceRegAppsInfo.Count()==0)
       
  2116         {
       
  2117         OstTraceDef0( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_FORCEREGISTRATION, "RApaLsSession::ForceRegistration will return if there are no applications to update" );
  1983         return(KErrNone);
  2118         return(KErrNone);
       
  2119         }
  1984     
  2120     
  1985     //Create a buffer with the application uid and corresponding action information.
  2121     //Create a buffer with the application uid and corresponding action information.
  1986     CBufFlat* buffer = 0;
  2122     CBufFlat* buffer = 0;
  1987     TRAPD(err, buffer = CreateForceRegAppInfoBufferL(aForceRegAppsInfo));
  2123     TRAPD(err, buffer = CreateForceRegAppInfoBufferL(aForceRegAppsInfo));
  1988     if (err)
  2124     if (err)
       
  2125         {
       
  2126         OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP1_RAPALSSESSION_FORCEREGISTRATION, "RApaLsSession::ForceRegistration will return with error returned from CreateForceRegAppInfoBufferL : err=%d", err );
  1989         return err;
  2127         return err;
       
  2128         }
  1990     
  2129     
  1991     TPtr8 ptr = buffer->Ptr(0);
  2130     TPtr8 ptr = buffer->Ptr(0);
  1992     const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
  2131     const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
  1993     delete buffer;
  2132     delete buffer;
       
  2133     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, DUP2_RAPALSSESSION_FORCEREGISTRATION, "RApaLsSession::ForceRegistration will return with the return value of SendReceiveWithReconnect : returnValue=%d", returnValue );
  1994     return returnValue;
  2134     return returnValue;
  1995 }
  2135 }
  1996 
  2136 
  1997 
  2137 
  1998 /*
  2138 /*
  2127             aUpdatedAppsInfo.AppendL(appUpdateInfo);
  2267             aUpdatedAppsInfo.AppendL(appUpdateInfo);
  2128             }
  2268             }
  2129         }
  2269         }
  2130     
  2270     
  2131     CleanupStack::PopAndDestroy(buffer);
  2271     CleanupStack::PopAndDestroy(buffer);
       
  2272     OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, APPARC_TRACE_FLOW, RAPALSSESSION_UPDATEDAPPSINFOL, "RApaLsSession::UpdatedAppsInfoL will return with returnValue=%d", returnValue );
  2132     return returnValue;
  2273     return returnValue;
  2133     }
  2274     }
  2134 
  2275 
  2135 #endif
  2276 #endif
  2136     
  2277