appfw/apparchitecture/apgrfx/APGCLI.CPP
branchRCL_3
changeset 62 924385140d98
parent 0 2e3d3ce01487
child 63 c2c61fdca848
child 69 dcd4152cfe55
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
     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".
    14 // apgcli.cpp
    14 // apgcli.cpp
    15 //
    15 //
    16 
    16 
    17 #include "../apserv/APSCLSV.H"
    17 #include "../apserv/APSCLSV.H"
    18 #include "../apserv/apsserv.h"
    18 #include "../apserv/apsserv.h"
       
    19 
       
    20 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
    21 #include "../apgrfx/apgcommonutils.h"
       
    22 #endif
    19 
    23 
    20 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
    21 #if !defined(__APA_INTERNAL_H__)
    25 #if !defined(__APA_INTERNAL_H__)
    22 #include "apainternal.h"
    26 #include "apainternal.h"
    23 #endif
    27 #endif
  1545 	}
  1549 	}
  1546 
  1550 
  1547 /** @publishedPartner */
  1551 /** @publishedPartner */
  1548 EXPORT_C void RApaLsSession::RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable)
  1552 EXPORT_C void RApaLsSession::RegisterNonNativeApplicationTypeL(TUid aApplicationType, const TDesC& aNativeExecutable)
  1549 	{
  1553 	{
       
  1554 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK    
  1550 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServRegisterNonNativeApplicationType, TIpcArgs(aApplicationType.iUid, &aNativeExecutable)));
  1555 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServRegisterNonNativeApplicationType, TIpcArgs(aApplicationType.iUid, &aNativeExecutable)));
       
  1556 #else
       
  1557 	(void)aApplicationType; //to make compiler happy
       
  1558 	(void)aNativeExecutable; 
       
  1559     User::Leave(KErrNotSupported);	
       
  1560 #endif	
  1551 	} //lint !e1762 Suppress member function could be made const
  1561 	} //lint !e1762 Suppress member function could be made const
  1552 
  1562 
  1553 /** @publishedPartner */
  1563 /** @publishedPartner */
  1554 EXPORT_C void RApaLsSession::DeregisterNonNativeApplicationTypeL(TUid aApplicationType)
  1564 EXPORT_C void RApaLsSession::DeregisterNonNativeApplicationTypeL(TUid aApplicationType)
  1555 	{
  1565 	{
       
  1566 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK    
  1556 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServDeregisterNonNativeApplicationType, TIpcArgs(aApplicationType.iUid)));
  1567 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServDeregisterNonNativeApplicationType, TIpcArgs(aApplicationType.iUid)));
       
  1568 #else
       
  1569 	(void)aApplicationType;	//to make compiler happy
       
  1570     User::Leave(KErrNotSupported); 
       
  1571 #endif	
  1557 	} //lint !e1762 Suppress member function could be made const
  1572 	} //lint !e1762 Suppress member function could be made const
  1558 	
  1573 	
  1559 /** @publishedPartner */
  1574 /** @publishedPartner */
  1560 EXPORT_C void RApaLsSession::PrepareNonNativeApplicationsUpdatesL()
  1575 EXPORT_C void RApaLsSession::PrepareNonNativeApplicationsUpdatesL()
  1561 	{
  1576 	{
       
  1577 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK    
  1562 	TIpcArgs ipcArgs(0, 0, 0, 0);
  1578 	TIpcArgs ipcArgs(0, 0, 0, 0);
  1563 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServPrepareNonNativeApplicationsUpdates, ipcArgs));
  1579 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServPrepareNonNativeApplicationsUpdates, ipcArgs));
       
  1580 #else
       
  1581     User::Leave(KErrNotSupported);
       
  1582 #endif
  1564 	} //lint !e1762 Suppress member function could be made const
  1583 	} //lint !e1762 Suppress member function could be made const
  1565 
  1584 
  1566 /** @publishedPartner */
  1585 /** @publishedPartner */
  1567 EXPORT_C void RApaLsSession::RegisterNonNativeApplicationL(TUid aApplicationType, const TDriveUnit& aDrive, CApaRegistrationResourceFileWriter& aRegistrationResourceFile, CApaLocalisableResourceFileWriter* aLocalisableResourceFile, const RFile* aIconFile)
  1586 EXPORT_C void RApaLsSession::RegisterNonNativeApplicationL(TUid aApplicationType, const TDriveUnit& aDrive, CApaRegistrationResourceFileWriter& aRegistrationResourceFile, CApaLocalisableResourceFileWriter* aLocalisableResourceFile, const RFile* aIconFile)
  1568 	{
  1587 	{
       
  1588 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK      
  1569 	TIpcArgs ipcArgs(0, 0, 0, 0);
  1589 	TIpcArgs ipcArgs(0, 0, 0, 0);
  1570 	RBuf8 ipcParameter0;
  1590 	RBuf8 ipcParameter0;
  1571 	CleanupClosePushL(ipcParameter0);
  1591 	CleanupClosePushL(ipcParameter0);
  1572 	RBuf8 ipcParameter1;
  1592 	RBuf8 ipcParameter1;
  1573 	CleanupClosePushL(ipcParameter1);
  1593 	CleanupClosePushL(ipcParameter1);
  1614 	const TDesC8& ipcParameter0_asConst=ipcParameter0;
  1634 	const TDesC8& ipcParameter0_asConst=ipcParameter0;
  1615 	ipcArgs.Set(0, &ipcParameter0_asConst);
  1635 	ipcArgs.Set(0, &ipcParameter0_asConst);
  1616 
  1636 
  1617 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServRegisterNonNativeApplication, ipcArgs));
  1637 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServRegisterNonNativeApplication, ipcArgs));
  1618 	CleanupStack::PopAndDestroy(2, &ipcParameter0);
  1638 	CleanupStack::PopAndDestroy(2, &ipcParameter0);
       
  1639 #else
       
  1640 	(void) aApplicationType; //to make compiler happy
       
  1641 	(void) aDrive;
       
  1642 	(void) aRegistrationResourceFile;
       
  1643 	(void) aRegistrationResourceFile;
       
  1644 	(void) aLocalisableResourceFile;
       
  1645 	(void) aIconFile;	
       
  1646     User::Leave(KErrNotSupported);  
       
  1647 #endif	
  1619 	} //lint !e1762 Suppress member function could be made const
  1648 	} //lint !e1762 Suppress member function could be made const
  1620 
  1649 
  1621 /** @publishedPartner */
  1650 /** @publishedPartner */
  1622 EXPORT_C void RApaLsSession::DeregisterNonNativeApplicationL(TUid aApplication)
  1651 EXPORT_C void RApaLsSession::DeregisterNonNativeApplicationL(TUid aApplication)
  1623 	{
  1652 	{
       
  1653 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK  
  1624 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServDeregisterNonNativeApplication, TIpcArgs(aApplication.iUid)));
  1654 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServDeregisterNonNativeApplication, TIpcArgs(aApplication.iUid)));
       
  1655 #else
       
  1656 	(void) aApplication;
       
  1657     User::Leave(KErrNotSupported);  	
       
  1658 #endif
  1625 	} //lint !e1762 Suppress member function could be made const
  1659 	} //lint !e1762 Suppress member function could be made const
  1626 	
  1660 	
  1627 /**
  1661 /**
  1628 Commits the non-native application updates. This is a synchronous method which waits 
  1662 Commits the non-native application updates. This is a synchronous method which waits 
  1629 until the application list is updated.
  1663 until the application list is updated.
  1633 @released
  1667 @released
  1634 */
  1668 */
  1635 
  1669 
  1636 EXPORT_C void RApaLsSession::CommitNonNativeApplicationsUpdatesL()
  1670 EXPORT_C void RApaLsSession::CommitNonNativeApplicationsUpdatesL()
  1637 	{
  1671 	{
       
  1672 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK      
  1638 	TIpcArgs ipcArgs(EFalse, 0, 0, 0);
  1673 	TIpcArgs ipcArgs(EFalse, 0, 0, 0);
  1639 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServCommitNonNativeApplications, ipcArgs));
  1674 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServCommitNonNativeApplications, ipcArgs));
       
  1675 #else
       
  1676     User::Leave(KErrNotSupported);
       
  1677 #endif	
  1640 	} //lint !e1762 Suppress member function could be made const
  1678 	} //lint !e1762 Suppress member function could be made const
  1641 	
  1679 	
  1642 
  1680 
  1643 /**
  1681 /**
  1644 Commits the non-native application updates. This is an asynchronous method which will not wait until 
  1682 Commits the non-native application updates. This is an asynchronous method which will not wait until 
  1651 @released
  1689 @released
  1652 */
  1690 */
  1653 
  1691 
  1654 EXPORT_C void RApaLsSession::ForceCommitNonNativeApplicationsUpdatesL()
  1692 EXPORT_C void RApaLsSession::ForceCommitNonNativeApplicationsUpdatesL()
  1655 	{
  1693 	{
       
  1694 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK      
  1656 	TIpcArgs ipcArgs(ETrue, 0, 0, 0);
  1695 	TIpcArgs ipcArgs(ETrue, 0, 0, 0);
  1657 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServCommitNonNativeApplications, ipcArgs));
  1696 	User::LeaveIfError(SendReceiveWithReconnect(EAppListServCommitNonNativeApplications, ipcArgs));
       
  1697 #else
       
  1698     User::Leave(KErrNotSupported);  	
       
  1699 #endif
  1658 	}
  1700 	}
  1659 
  1701 
  1660 /** 
  1702 /** 
  1661 Rolls back all changes made to the list of installed non-native applications since the last call to
  1703 Rolls back all changes made to the list of installed non-native applications since the last call to
  1662 PrepareNonNativeApplicationsUpdatesL().
  1704 PrepareNonNativeApplicationsUpdatesL().
  1666 
  1708 
  1667 @publishedPartner
  1709 @publishedPartner
  1668 */
  1710 */
  1669 EXPORT_C TInt RApaLsSession::RollbackNonNativeApplicationsUpdates()
  1711 EXPORT_C TInt RApaLsSession::RollbackNonNativeApplicationsUpdates()
  1670 	{
  1712 	{
       
  1713 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK      
  1671 	TIpcArgs ipcArgs(0, 0, 0, 0);
  1714 	TIpcArgs ipcArgs(0, 0, 0, 0);
  1672 	return SendReceiveWithReconnect(EAppListServRollbackNonNativeApplications, ipcArgs);
  1715 	return SendReceiveWithReconnect(EAppListServRollbackNonNativeApplications, ipcArgs);
       
  1716 #else
       
  1717     return KErrNotSupported;    
       
  1718 #endif
  1673 	} //lint !e1762 Suppress member function could be made const
  1719 	} //lint !e1762 Suppress member function could be made const
  1674 
  1720 
  1675 /**
  1721 /**
  1676 @internalTechnology 
  1722 @internalTechnology 
  1677 */
  1723 */
  1722 @internalAll
  1768 @internalAll
  1723 @released
  1769 @released
  1724 */
  1770 */
  1725 EXPORT_C TInt RApaLsSession::ForceRegistration(const RPointerArray<TDesC>& aRegFiles)
  1771 EXPORT_C TInt RApaLsSession::ForceRegistration(const RPointerArray<TDesC>& aRegFiles)
  1726 	{
  1772 	{
       
  1773 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK     
  1727 	CBufFlat* buffer = 0;
  1774 	CBufFlat* buffer = 0;
  1728 	TRAPD(err, buffer = CreateRegFilesBufferL(aRegFiles));
  1775 	TRAPD(err, buffer = CreateRegFilesBufferL(aRegFiles));
  1729 	if (err)
  1776 	if (err)
  1730 		return err;
  1777 		return err;
  1731 	
  1778 	
  1732 	TPtr8 ptr = buffer->Ptr(0);
  1779 	TPtr8 ptr = buffer->Ptr(0);
  1733 	const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
  1780 	const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
  1734 	delete buffer;
  1781 	delete buffer;
  1735 	return returnValue;
  1782 	return returnValue;
       
  1783 #else
       
  1784 	(void) aRegFiles;
       
  1785     return KErrNotSupported;	
       
  1786 #endif	
  1736 	} //lint !e1762 Suppress member function could be made const
  1787 	} //lint !e1762 Suppress member function could be made const
  1737 	
  1788 	
  1738 	
  1789 	
  1739 /**
  1790 /**
  1740 Make a call to AppArc server's aFunction, passing it aIpcArgs.
  1791 Make a call to AppArc server's aFunction, passing it aIpcArgs.
  1838 EXPORT_C void RApaLsSession::CancelNotifyOnDataMappingChange()
  1889 EXPORT_C void RApaLsSession::CancelNotifyOnDataMappingChange()
  1839 	{
  1890 	{
  1840 	SendReceive(ECancelNotifyOnDataMappingChange,TIpcArgs());
  1891 	SendReceive(ECancelNotifyOnDataMappingChange,TIpcArgs());
  1841 	} //lint !e1762 Suppress member function could be made const
  1892 	} //lint !e1762 Suppress member function could be made const
  1842 
  1893 
  1843 
  1894 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK 
  1844 CBufFlat* RApaLsSession::CreateRegFilesBufferL(const RPointerArray<TDesC>& aRegFiles)
  1895 CBufFlat* RApaLsSession::CreateRegFilesBufferL(const RPointerArray<TDesC>& aRegFiles)
  1845 	{
  1896 	{
  1846 	// Serialize the array
  1897 	// Serialize the array
  1847 	// Format of the buffer is :
  1898 	// Format of the buffer is :
  1848 	// 4 bytes for array item count
  1899 	// 4 bytes for array item count
  1871 	writeStream.CommitL();
  1922 	writeStream.CommitL();
  1872 	CleanupStack::PopAndDestroy(&writeStream);
  1923 	CleanupStack::PopAndDestroy(&writeStream);
  1873 	CleanupStack::Pop(buffer);
  1924 	CleanupStack::Pop(buffer);
  1874 	return buffer;
  1925 	return buffer;
  1875 	}
  1926 	}
       
  1927 #endif
       
  1928 
       
  1929 #ifdef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK
       
  1930 
       
  1931 /* This function is only for use by Installers.
       
  1932 
       
  1933 Installers can provide the information about installed, uninstaleld and upgraded applications using this function.
       
  1934 The function takes list of TApaAppUpdateInfo objects. TApaAppUpdateInfo object contains the application uid and
       
  1935 corresponding action done on that application like installed, uninstalled and upgraded.
       
  1936 
       
  1937 Apparc updates the application list based on the information provided in the list. 
       
  1938 
       
  1939 UpdateAppListL initiates applist update. It will not wait till the applist update completed.
       
  1940 
       
  1941 @param aAppUpdateInfo List of TApaAppUpdateInfo objects, which contains application uid and corresponding action information 
       
  1942 					  like installed, uninstalled and changed.
       
  1943 @return A standard error code.
       
  1944 @publishedAll
       
  1945 @released
       
  1946 */
       
  1947 
       
  1948 EXPORT_C TInt RApaLsSession::UpdateAppListL(RArray<TApaAppUpdateInfo>& aAppUpdateInfo)
       
  1949     {
       
  1950     //Create a buffer with the application UID and corresponding action information.
       
  1951     CBufFlat* buffer = 0;
       
  1952     TRAPD(err, buffer = CreateAppUpdateInfoBufferL(aAppUpdateInfo));
       
  1953     if (err)
       
  1954         return err;
       
  1955     
       
  1956     TPtr8 ptr = buffer->Ptr(0);
       
  1957     const TInt returnValue=SendReceiveWithReconnect(EAppListServUpdateAppList,TIpcArgs(&ptr));
       
  1958     delete buffer;
       
  1959     return returnValue;
       
  1960     }
       
  1961 
       
  1962 
       
  1963 /**
       
  1964 This function is only for use by Software Install.
       
  1965 
       
  1966 ForceRegistration allows Software Install to provide a list of application information that need to be 
       
  1967 included in apparc's application list even if they have not been marked as installed in the SISRegistry. 
       
  1968 The force registered applications will be removed from application list once Software Install notifies
       
  1969 the end of the installation by calling UpdateApplist.
       
  1970 
       
  1971 
       
  1972 @param aAppsData The list of application information needs to be added to application list. Apparc don't take the 
       
  1973 				 ownership of this array.
       
  1974 @return A standard error code.
       
  1975 @publishedAll
       
  1976 @released
       
  1977 */
       
  1978 
       
  1979 EXPORT_C TInt RApaLsSession::ForceRegistration(const RPointerArray<Usif::CApplicationRegistrationData>& aForceRegAppsInfo)
       
  1980 {
       
  1981     //If there are no applications to update, just return.
       
  1982     if(aForceRegAppsInfo.Count()==0)
       
  1983         return(KErrNone);
       
  1984     
       
  1985     //Create a buffer with the application uid and corresponding action information.
       
  1986     CBufFlat* buffer = 0;
       
  1987     TRAPD(err, buffer = CreateForceRegAppInfoBufferL(aForceRegAppsInfo));
       
  1988     if (err)
       
  1989         return err;
       
  1990     
       
  1991     TPtr8 ptr = buffer->Ptr(0);
       
  1992     const TInt returnValue=SendReceiveWithReconnect(EAppListServForceRegistration,TIpcArgs(&ptr));
       
  1993     delete buffer;
       
  1994     return returnValue;
       
  1995 }
       
  1996 
       
  1997 
       
  1998 /*
       
  1999  * Creates a buffer for applications uids and action information. 
       
  2000  */
       
  2001 CBufFlat* RApaLsSession::CreateAppUpdateInfoBufferL(RArray<TApaAppUpdateInfo>& aAppUpdateInfo)
       
  2002     {
       
  2003     TInt count=aAppUpdateInfo.Count();
       
  2004     TInt requiredBufferSize=sizeof(TInt32)+(count*sizeof(TApaAppUpdateInfo)); //Size of count + size of TApaAppUpdateInfo objects
       
  2005 
       
  2006     CBufFlat* const buffer = CBufFlat::NewL(requiredBufferSize);
       
  2007     CleanupStack::PushL(buffer);
       
  2008     buffer->ExpandL(0,requiredBufferSize);
       
  2009     RBufWriteStream writeStream;
       
  2010     writeStream.Open(*buffer);
       
  2011     CleanupClosePushL(writeStream);
       
  2012     
       
  2013 	//Write number of TApaAppUpdateInfo objects to stream.
       
  2014     writeStream.WriteUint32L(count);
       
  2015 
       
  2016     for(TInt index=0;index<count;index++)
       
  2017         {
       
  2018 		//Write one application information at a time
       
  2019         writeStream<<aAppUpdateInfo[index];
       
  2020         }
       
  2021 
       
  2022     writeStream.CommitL();
       
  2023     CleanupStack::PopAndDestroy(&writeStream);
       
  2024     CleanupStack::Pop(buffer);
       
  2025     
       
  2026     return buffer;
       
  2027     }
       
  2028 	
       
  2029 
       
  2030 /* Creates buffer for force registered application information array*/
       
  2031 
       
  2032 CBufFlat* RApaLsSession::CreateForceRegAppInfoBufferL(const RPointerArray<Usif::CApplicationRegistrationData>& aForceRegAppsInfo)
       
  2033     {
       
  2034     TInt count=aForceRegAppsInfo.Count();
       
  2035     TInt requiredBufferSize=sizeof(TInt32); //For count
       
  2036     
       
  2037     for(TInt index=0; index<count; index++)
       
  2038         {
       
  2039         //Get each application information size and add it to required size.
       
  2040         requiredBufferSize += GetObjectSizeL(aForceRegAppsInfo[index]);
       
  2041         }
       
  2042 
       
  2043     CBufFlat* const buffer = CBufFlat::NewL(requiredBufferSize);
       
  2044     CleanupStack::PushL(buffer);
       
  2045     buffer->ExpandL(0,requiredBufferSize);
       
  2046     
       
  2047     RBufWriteStream writeStream;
       
  2048     writeStream.Open(*buffer);
       
  2049     CleanupClosePushL(writeStream);
       
  2050     
       
  2051     //Write count to stream.
       
  2052     writeStream.WriteUint32L(count);
       
  2053 
       
  2054     for(TInt index=0;index<count;index++)
       
  2055         {
       
  2056         //Write one applciation information at a time to stream.
       
  2057         writeStream<<*aForceRegAppsInfo[index];
       
  2058         }
       
  2059 
       
  2060     writeStream.CommitL();
       
  2061     CleanupStack::PopAndDestroy(&writeStream);
       
  2062     CleanupStack::Pop(buffer);
       
  2063     
       
  2064     return buffer;    
       
  2065     }
       
  2066 
       
  2067 
       
  2068 
       
  2069 /* 
       
  2070 Provides updated application information after apparc notifies application list change. It provides list of TApaAppUpdateInfo
       
  2071 objects which contains the information about updated application UID and the action, i.e installed, uninstalled and changed.
       
  2072 
       
  2073 The function returns empty list if the application list is changed due to initial application list creation or because of phone 
       
  2074 language change. During that time the list of changed applications can be large.
       
  2075 
       
  2076 This function should be called only after the client receives the applist notification from AppArc registered through SetNotify(). Otherwise the 
       
  2077 return values are unpredictable.
       
  2078 
       
  2079 @param aUpdatedAppsInfo On return, provides the list of TApaAppUpdateInfo objects, which contains changed application uids and 
       
  2080                         corresponding action information like installed, uninstalled and changed. If this list is empty, then 
       
  2081                         the applist is updated because of initial applist creation or because of phone language change. In that 
       
  2082                         case use GetAllApps and GetNextApp APIs to retrieve the complete applist information.
       
  2083                            
       
  2084 @return A standard error code.
       
  2085 @publishedAll
       
  2086 @released
       
  2087 */
       
  2088 
       
  2089 EXPORT_C TInt RApaLsSession::UpdatedAppsInfoL(RArray<TApaAppUpdateInfo>& aUpdatedAppsInfo)
       
  2090     {
       
  2091     const TInt KDefaultUpdateAppEntries=10;
       
  2092   
       
  2093     //Create a buffer with default size
       
  2094     TInt sizeRequired=(KDefaultUpdateAppEntries * sizeof(TApaAppUpdateInfo)) + 2;
       
  2095     CBufFlat* buffer=CBufFlat::NewL(sizeRequired);
       
  2096     CleanupStack::PushL(buffer);
       
  2097     buffer->ExpandL(0, sizeRequired);
       
  2098     TPtr8 ptr = buffer->Ptr(0); 
       
  2099 
       
  2100     TPckgBuf<TInt> pckg(sizeRequired);
       
  2101     
       
  2102     //pass the buffer and size of the buffer.
       
  2103     TInt returnValue=SendReceiveWithReconnect(EAppListUpdatedAppsInfo,TIpcArgs(&ptr, &pckg));
       
  2104     
       
  2105     //If the size of the buffer is not enough expand it to required size and pass it again.
       
  2106     if(returnValue==KErrOverflow)
       
  2107         {
       
  2108         buffer->ExpandL(0, sizeRequired);
       
  2109         returnValue=SendReceiveWithReconnect(EAppListUpdatedAppsInfo,TIpcArgs(&ptr, &pckg));
       
  2110         }
       
  2111     
       
  2112     if(returnValue==KErrNone)
       
  2113         {
       
  2114         RBufReadStream readStream;
       
  2115         readStream.Open(*buffer);
       
  2116         
       
  2117         //Read count from the stream
       
  2118         TInt count=readStream.ReadUint32L();
       
  2119     
       
  2120         //Read updated applications information and add it to array 
       
  2121         for(TInt index=0; index<count; index++)
       
  2122             {
       
  2123             TApaAppUpdateInfo appUpdateInfo;
       
  2124             readStream>>appUpdateInfo;
       
  2125             aUpdatedAppsInfo.AppendL(appUpdateInfo);
       
  2126             }
       
  2127         }
       
  2128     
       
  2129     CleanupStack::PopAndDestroy(buffer);
       
  2130     return returnValue;
       
  2131     }
       
  2132 
       
  2133 #endif
       
  2134