# HG changeset patch # User hgs # Date 1278669501 -28800 # Node ID a26669f87b462034ebc18f25912de78c297d07c7 # Parent 3ae5cb0b4c02e8e70ad2851743719c0df4134c00 201027_03 diff -r 3ae5cb0b4c02 -r a26669f87b46 backupandrestore/backupengine/src/absession.cpp --- a/backupandrestore/backupengine/src/absession.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/backupandrestore/backupengine/src/absession.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -148,7 +148,12 @@ iCallbackWatchdog = NULL; // Remove this session from the server's session map - Server().RemoveElement(iClientSID); + // Use dynamic_cast in case that ABServer is deconstructing + CABServer *pServer = dynamic_cast(const_cast(CSession2::Server())); + if(pServer) + { + pServer->RemoveElement(iClientSID); + } // Clear up any outstanding message HandleIPCClosingDownCallback(); @@ -159,7 +164,10 @@ // If the client has detached properly, they should // have done this - but just in case. //DoCancelWaitForCallback(); - Server().DropSession(); + if(pServer) + { + pServer->DropSession(); + } } void CABSession::CreateL() diff -r 3ae5cb0b4c02 -r a26669f87b46 backupandrestore/backupengine/src/sbecompressionandencryption.cpp --- a/backupandrestore/backupengine/src/sbecompressionandencryption.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/backupandrestore/backupengine/src/sbecompressionandencryption.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -709,7 +709,7 @@ iEncryptionHeader.iEncrypted, iEncryptionHeader.iBufferSize, iEncryptionHeader.iTotalSize); // Check we have a sensible encryption header - if ((iEncryptionHeader.iBufferSize < 0) || + if ((iEncryptionHeader.iBufferSize < 0) || (iEncryptionHeader.iBufferSize >= KMaxTInt/2) || (iEncryptionHeader.iTotalSize < 0)) { __LOG("CSBEDecompressAndEncrypt::CreateCipherL() - Corrupt data"); diff -r 3ae5cb0b4c02 -r a26669f87b46 localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp --- a/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/localconnectivityservice/dun/atext/src/DunAtCmdHandler.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -1413,9 +1413,25 @@ { iDecodeInfo.iExtendedIndex = aEndIndex; SaveFoundCharDecodeState( aCharacter ); - FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border) complete") )); + FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border normal) complete") )); return EFalse; } + // Now suspect border found so peek the next character after the suspected + // extended character. If it is not alphabetical character, return with EFalse. + // This case is to detect the cases such as "AT+VTS={*,3000}", where '*' would + // be the start of the next command in normal cases. + TInt peekIndex = aEndIndex + 1; + TInt lineLength = iLineBuffer.Length(); + if ( peekIndex < lineLength ) + { + TChar nextCharacter = iLineBuffer[peekIndex]; + if ( !nextCharacter.IsAlpha() ) + { + SaveFoundCharDecodeState( aCharacter ); + FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (no border special) complete") )); + return EFalse; + } + } aEndIndex--; FTRACE(FPrint( _L("CDunAtCmdHandler::IsExtendedBorder() (border) complete") )); return ETrue; diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledpexclusionmgr.cpp --- a/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledpexclusionmgr.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpfileandfolderdp/src/cmtpfiledpexclusionmgr.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -96,7 +96,7 @@ formatcode = playbackFormatExclusionList[index]; if(KErrNotFound == capFormatExclusionList.FindInOrder(formatcode)) { - capFormatExclusionList.InsertInOrder(formatcode); + capFormatExclusionList.InsertInOrderL(formatcode); } } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedp.h Fri Jul 09 17:58:21 2010 +0800 @@ -67,6 +67,7 @@ void HandleDeleteObjectsArray(); void IncreaseNewPictures(TInt aCount); void DecreaseNewPictures(TInt aCount); + void ResetNewPictures(); void HandleMdeSessionCompleteL(TInt aError); public: // From CMTPDataProviderPlugin @@ -129,6 +130,7 @@ TBool iEnumerationNotified; RPointerArray iDeleteObjectsArray; + RArray iNewPicHandles; }; #endif // CMTPIMAGEDP_H diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h --- a/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/inc/cmtpimagedpgetobject.h Fri Jul 09 17:58:21 2010 +0800 @@ -42,6 +42,7 @@ void ServiceL(); TBool DoHandleCompletingPhaseL(); + TMTPResponseCode CheckRequestL(); private: diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedp.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -121,7 +121,7 @@ //Define RProperty of new pictures for status data provider _LIT_SECURITY_POLICY_PASS(KAllowReadAll); - TInt error = RProperty::Define(KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll); + TInt error = RProperty::Define(TUid::Uid(KMTPServerUID), KMTPNewPicKey, RProperty::EInt, KAllowReadAll, KAllowReadAll); if (error != KErrNone && error != KErrAlreadyExists) { __FLOG_1(_L8("CMTPImageDataProvider::ConstructL - RProperty define error:%d"), error); @@ -165,6 +165,7 @@ //Try to delete objects in array HandleDeleteObjectsArray(); iDeleteObjectsArray.ResetAndDestroy(); + iNewPicHandles.Reset(); __FLOG(_L8("<< ~CMTPImageDataProvider")); __FLOG_CLOSE; @@ -610,8 +611,7 @@ /** * Get image object count from framework and calculate the new pictures */ - TUint newPictures = QueryImageObjectCountL(); - RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, newPictures); + TUint newPictures = QueryImageObjectCountL(); iNewPicNotifier->SetNewPictures(newPictures); __FLOG_1(_L16("CMTPImageDpEnumerator::CompleteEnumeration - New Pics: %d"), newPictures); iEnumerated = EFalse; @@ -693,6 +693,8 @@ CleanupClosePushL(context); CleanupClosePushL(handles); + iNewPicHandles.Reset(); + do { /* @@ -712,6 +714,7 @@ if (MTPImageDpUtilits::IsNewPicture(*objMetadata)) { ++newPictures; + iNewPicHandles.Append(handles[i]); } } @@ -765,6 +768,32 @@ __FLOG(_L8("<< DecreaseNewPictures ")); } +void CMTPImageDataProvider::ResetNewPictures() + { + __FLOG(_L8(">> ResetNewPictures ")); + + iNewPicNotifier->SetNewPictures(0); + + TInt count = iNewPicHandles.Count(); + if (!count) + { + return; + } + + CMTPObjectMetaData* objMetadata = CMTPObjectMetaData::NewLC(); + + for (TInt i(0); i> HandleMdeSessionComplete")); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpcopyobject.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -190,7 +190,7 @@ GetPreviousPropertiesL(aOldFileName); User::LeaveIfError(iFileMan->Copy(aOldFileName, *iDest)); - iRollbackActionL.Append(RollBackFromFsL); + iRollbackActionL.AppendL(RollBackFromFsL); SetPreviousPropertiesL(aNewFileName); iFramework.ObjectMgr().InsertObjectL(*iTargetObjectInfo); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpdeleteobject.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -205,7 +205,7 @@ iFramework.ObjectMgr().GetObjectHandlesL( params, context, handles ); for ( TInt i = 0; i < handles.Count(); i++) { - iObjectsToDelete.Append( handles[i] ); + iObjectsToDelete.AppendL( handles[i] ); } } while ( !context.QueryComplete() ); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobject.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -93,7 +93,22 @@ __FLOG(_L8(">> CMTPImageDpGetObject::ConstructL")); __FLOG(_L8("<< CMTPImageDpGetObject::ConstructL")); } - +TMTPResponseCode CMTPImageDpGetObject::CheckRequestL() + { + __FLOG(_L8(">> CMTPImageDpGetObject::CheckRequestL")); + TMTPResponseCode responseCode = CMTPRequestProcessor::CheckRequestL(); + + TUint32 handle(Request().Uint32(TMTPTypeRequest::ERequestParameter1)); + if ( handle != KMTPHandleAll ) + { + CMTPObjectMetaData* ObjectMeta = CMTPObjectMetaData::NewL(); + responseCode = MTPImageDpUtilits::VerifyObjectHandleL( + iFramework, handle, *ObjectMeta); + delete ObjectMeta; + } + __FLOG(_L8("<< CMTPImageDpGetObject::CheckRequestL")); + return responseCode; + } /** GetObject request handler */ @@ -140,7 +155,7 @@ { //update new picture status MTPImageDpUtilits::UpdateObjectStatusToOldL(iFramework, *objectInfo); - iDataProvider.DecreaseNewPictures(1); + iDataProvider.ResetNewPictures(); } } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectinfo.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -114,17 +114,17 @@ iObjectPropertyMgr.SetCurrentObjectL(*iObjectMeta, EFalse); //1. storage id - TUint32 storageId; + TUint32 storageId(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeStorageID, storageId); iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EStorageID, storageId); //2. object format - TUint16 format; + TUint16 format(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeObjectFormat, format); iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EObjectFormat, format); //3. protection status, - TUint16 protection; + TUint16 protection(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeProtectionStatus, protection); iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EProtectionStatus, protection); @@ -138,7 +138,7 @@ //9. image pix width //10. image pix height //11. image bit depth - TUint16 thumbFormat; + TUint16 thumbFormat(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeRepresentativeSampleFormat, thumbFormat); iObjectInfoToBuild->SetUint16L(CMTPTypeObjectInfo::EThumbFormat, thumbFormat); TUint32 value(0); @@ -157,7 +157,7 @@ iObjectInfoToBuild->SetUint32L(CMTPTypeObjectInfo::EImageBitDepth, value); //12. Parent object - TUint32 parent; + TUint32 parent(0); iObjectPropertyMgr.GetPropertyL(EMTPObjectPropCodeParentObject, parent); if(KMTPHandleNoParent == parent) { diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpgetobjectproplist.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -207,7 +207,7 @@ } else { - iHandles.Append( handle ); + iHandles.AppendL( handle ); } __FLOG(_L8("<< CMTPImageDpGetObjectPropList::GetObjectHandlesL")); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpnewpicturesnotifier.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -44,6 +44,7 @@ void CMTPImageDpNewPicturesNotifier::SetNewPictures(TInt aValue) { iNewPictures = aValue; + RProperty::Set(TUid::Uid(KMTPServerUID), KMTPNewPicKey, iNewPictures); } void CMTPImageDpNewPicturesNotifier::IncreaseCount(TInt aValue) diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp --- a/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpdataproviders/mtpimagedp/src/cmtpimagedpsendobjectinfo.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -23,7 +23,6 @@ #include #include - #include #include #include @@ -515,7 +514,7 @@ iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); //prepare for rollback - iRollbackList.Append(RemoveObjectFromDb); + iRollbackList.AppendL(RemoveObjectFromDb); ReceiveDataL(*iFileReceived); @@ -1196,7 +1195,7 @@ iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); // prepare for rollback - iRollbackList.Append(UnreserveObject); + iRollbackList.AppendL(UnreserveObject); __FLOG(_L8("CMTPImageDpSendObjectInfo::ReserveObjectL - Exit")); } @@ -1257,7 +1256,7 @@ delete iFileReceived; iFileReceived = NULL; //prepare for rollback - iRollbackList.Append(RemoveObjectFromFs); + iRollbackList.AppendL(RemoveObjectFromFs); iFileReceived = CMTPTypeFile::NewL(iFramework.Fs(), iFullPath, EFileWrite); iFileReceived->SetSizeL(iObjectSize); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/common/inc/UiklafInternalCRKeys.h --- a/mtpfws/mtpfw/common/inc/UiklafInternalCRKeys.h Fri Jun 25 16:54:01 2010 +0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -/* -* Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Internal Central Repository keys. -* -*/ - - -#ifndef __UIKLAF_INTERNAL_CR_KEYS_H__ -#define __UIKLAF_INTERNAL_CR_KEYS_H__ - -const TUid KCRUidUiklaf = { 0x101F8774 }; - -// Helper constants for free disk space levels. -#define DISK_SPACE_OK 0 -#define DISK_SPACE_WARNING -1 -#define DISK_SPACE_CRITICAL -2 - -/** - * Use KUikOODDiskFreeSpaceWarningNoteLevel instead of this!! - * Threshold for disk space warning level (bytes). - * Read-only key. Default value: 196608 - */ -const TUint32 KUikOODDiskWarningThreshold = 0x00000001; - -/** - * Threshold for disk space critical level (bytes). - * Read-only key. Default value: 131072 - */ -const TUint32 KUikOODDiskCriticalThreshold = 0x00000002; - -/** - * Threshold for low RAM level (bytes). - * Read-only key. Default value: 750000 - */ -const TUint32 KUikOOMRamLowThreshold = 0x00000003; - -/** - * Threshold for good RAM level (bytes). - * Read-only key. Default value: 1000000 - */ -const TUint32 KUikOOMRamGoodThreshold = 0x00000004; - -/** - * Timeout for application exit (milliseconds). - * Read-only key. Default value: 1000000 - */ -const TUint32 KUikOOMMaxAppExitTime = 0x00000005; - -/** - * Threshold for disk space warning note level as percent of used disk space. - * Read-only key. Default value: 95 - */ -const TUint32 KUikOODDiskFreeSpaceWarningNoteLevel = 0x00000006; - -/** - * Threshold for disk space warning note level for mass memory. - * Read-only key. Default value: 20971520 - */ -const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007; - -#ifdef __MTP_NAVIENGINE_TEST -//The free size of C-Drive of NaviEngine env is less than 21M, -//it will block many ONB test cases -const TInt KFreeSpaceThreshHoldDefaultValue(0); -const TInt KFreeSpaceExtraReserved(0); - -#else -//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor -//popup 'Out of memory' note.When syncing music through ovi player, -//sometimes device screen get freeze with this note -//Be default, this value is read from Central Respository, if error while -//reading, use this one -const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes - -//Beside the OOD threshold value, we need to reserve extra disk space -//for harvest server do the harvest, set this as 1M -const TInt KFreeSpaceExtraReserved(1024*1024);//1M bytes - -#endif - -#endif __UIKLAF_INTERNAL_CR_KEYS_H__ - -// End of file diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h --- a/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/inc/cmtpgetnumobjects.h Fri Jul 09 17:58:21 2010 +0800 @@ -49,10 +49,12 @@ CMTPGetNumObjects(MMTPDataProviderFramework& aFramework, MMTPConnection& aConnection); void ConstructL(); + void HandleObjectHandlesUnderMacL(CMTPTypeArray &aObjectHandles); private: TBool IsSupportedFormatL(TUint32 aFormatCode); + void GetObjectHandlesByFormatCodeL(TUint32 aFormatCode, CMTPTypeArray &aObjectHandles); protected: /** diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedp.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -388,7 +388,7 @@ if(extnpluginMap ) { - iExtnPluginMapArray.Append(extnpluginMap); + iExtnPluginMapArray.AppendL(extnpluginMap); } } @@ -481,7 +481,7 @@ __ASSERT_ALWAYS( isFolder, User::Leave( KErrArgument )); __ASSERT_ALWAYS( aParentHandle != KMTPHandleNone, User::Leave( KErrArgument )); - __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Invariant()); + __ASSERT_ALWAYS( Framework().StorageMgr().ValidStorageId( aStorageId ), User::Leave( KErrArgument )); __FLOG_VA((_L16("Add Entry for Path:%S"), &aPath )); aObjectInfo.SetUint( CMTPObjectMetaData::EDataProviderId, Framework().DataProviderId() ); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedpconfigmgr.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedpconfigmgr.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpdevicedpconfigmgr.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -256,7 +256,7 @@ //Ignore the duplicate value. if( aOrderInfoArray.Find(formatInt) == KErrNotFound ) { - aOrderInfoArray.Append(formatInt); + aOrderInfoArray.AppendL(formatInt); } } } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetdeviceinfo.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -318,7 +318,7 @@ { supportedCaptureFormats.Remove(index); //insert at insertindex position to make sure that value inserted at begening. - supportedCaptureFormats.Insert(orderedFormats[orderedElements], insertIndex); + supportedCaptureFormats.InsertL(orderedFormats[orderedElements], insertIndex); insertIndex++; }//else nothing } @@ -381,7 +381,7 @@ { supportedPlaybackFormats.Remove(index); //insert at insertindex position to make sure that value inserted at begening. - supportedPlaybackFormats.Insert(orderedFormats[orderedElements], insertIndex); + supportedPlaybackFormats.InsertL(orderedFormats[orderedElements], insertIndex); insertIndex++; }//else nothing } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetnumobjects.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -13,6 +13,7 @@ // Description: // + #include #include #include @@ -153,18 +154,11 @@ if(iDevDpSingletons.DeviceDataStore().IsConnectMac() &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2))) { - //get folder count - TMTPObjectMgrQueryParams paramsFolder(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeAssociation, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - TUint32 count = iFramework.ObjectMgr().CountL(paramsFolder); - __FLOG_VA((_L8("ConnectMac and Fetch all, folder count = %d"), count)); - - //get script count - TMTPObjectMgrQueryParams paramsScript(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeScript, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - count += iFramework.ObjectMgr().CountL(paramsScript); - - //get Image file count - TMTPObjectMgrQueryParams paramsImage(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeEXIFJPEG, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - count += iFramework.ObjectMgr().CountL(paramsImage); + TUint32 count(0); + CMTPTypeArray *handles = CMTPTypeArray::NewLC(EMTPTypeAUINT32); + HandleObjectHandlesUnderMacL(*handles); + count = handles->NumElements(); + CleanupStack::PopAndDestroy(handles); __FLOG_VA((_L8("ConnectMac and Fetch all, total count = %d"), count)); SendResponseL(EMTPRespCodeOK, 1, &count); } @@ -201,26 +195,106 @@ } - - - - - - - - - - +/** +Handle special case under Mac. +Only expose the Folder, Image File and Viedo, Script under Drive:\Images, Drive\Viedos +*/ +void CMTPGetNumObjects::HandleObjectHandlesUnderMacL(CMTPTypeArray &aObjectHandles) + { + __FLOG(_L8("HandleObjectHandlesUnderMacL - Entry")); + + CMTPTypeArray* totalHandles = CMTPTypeArray::NewLC(EMTPTypeAUINT32); + + //get folder object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeAssociation,*totalHandles); + + //get image/jpeg object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeEXIFJPEG,*totalHandles); + //get image/bmp object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeBMP,*totalHandles); + //get image/jif object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeGIF,*totalHandles); + //get image/jpeg object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodePNG,*totalHandles); + + //get video/mp4 object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeMP4Container,*totalHandles); + //get video/3gp object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCode3GPContainer,*totalHandles); + //get video/wmv object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeWMV,*totalHandles); + //get video/asf object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeASF,*totalHandles); + + //Filer the folder list, ?:\\Images\\* and ?:\\Videos\\* + _LIT(KImagesFolderPre, "?:\\Images\\*"); + _LIT(KViedosFolderPre, "?:\\Videos\\*"); + + const TUint KCount(totalHandles->NumElements()); + + for (TUint i(0); (i < KCount); i++)//handles loop + { + CMTPObjectMetaData* object(CMTPObjectMetaData::NewLC()); + iFramework.ObjectMgr().ObjectL(totalHandles->ElementUint(i),*object); + const TDesC& suid(object->DesC(CMTPObjectMetaData::ESuid)); + +#ifdef __FLOG_ACTIVE + TBuf8 tmp; + tmp.Copy(suid); + __FLOG_VA((_L8("HandleObjectHandlesUnderMacL - suid: %S"), &tmp)); +#endif // __FLOG_ACTIVE + if((KErrNotFound != suid.MatchF(KImagesFolderPre)) || + (KErrNotFound != suid.MatchF(KViedosFolderPre))) + { + _LIT(KComma,","); + _LIT(KLineation,"-"); + _LIT(KUnderline,"_"); + _LIT(Ksemicolon ,";"); + if((KErrNotFound != suid.Find(KComma))|| + (KErrNotFound != suid.Find(KLineation))|| + (KErrNotFound != suid.Find(KUnderline))|| + (KErrNotFound != suid.Find(Ksemicolon))) + { + __FLOG(_L8("HandleObjectHandlesUnderMacL - Skip handle")); + } + else + { + __FLOG_VA((_L8("HandleObjectHandlesUnderMacL - Add handle: %x"), totalHandles->ElementUint(i))); + RArray tmphandles; + CleanupClosePushL(tmphandles); + tmphandles.AppendL(totalHandles->ElementUint(i)); + aObjectHandles.AppendL(tmphandles); + CleanupStack::PopAndDestroy(&tmphandles); + } + } + CleanupStack::PopAndDestroy(object); + } + + CleanupStack::PopAndDestroy(totalHandles); + //get script object handles + GetObjectHandlesByFormatCodeL(EMTPFormatCodeScript,aObjectHandles); + + __FLOG(_L8("HandleObjectHandlesUnderMacL - Exit")); + } +/** +Get Object Handles by format code +*/ +void CMTPGetNumObjects::GetObjectHandlesByFormatCodeL(TUint32 aFormatCode, CMTPTypeArray &aObjectHandles) + { + __FLOG_VA((_L8("GetObjectHandlesByFormatCodeL - Entry FormatCode: %x"), aFormatCode)); + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL(context); + CleanupClosePushL(handles); + TMTPObjectMgrQueryParams paramsFolder(Request().Uint32(TMTPTypeRequest::ERequestParameter1), aFormatCode, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); + do + { + iFramework.ObjectMgr().GetObjectHandlesL(paramsFolder, context, handles); + aObjectHandles.AppendL(handles); + } + while (!context.QueryComplete()); + CleanupStack::PopAndDestroy(&context); + CleanupStack::PopAndDestroy(&handles); + __FLOG(_L8("GetObjectHandlesByFormatCode - Exit")); + } - - - - - - - - - - - - diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetobjecthandles.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -107,10 +107,6 @@ iTimeoutCount = 0; - RMTPObjectMgrQueryContext context; - RArray handles; - CleanupClosePushL(context); - CleanupClosePushL(handles); delete iHandles; iHandles = CMTPTypeArray::NewL(EMTPTypeAUINT32); @@ -119,47 +115,14 @@ &&(KMTPFormatsAll == Request().Uint32(TMTPTypeRequest::ERequestParameter2))) { __FLOG(_L8("ConnectMac and Fetch all.")); - //get folder object handles - TMTPObjectMgrQueryParams paramsFolder(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeAssociation, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - do - { - iFramework.ObjectMgr().GetObjectHandlesL(paramsFolder, context, handles); - iHandles->AppendL(handles); - } - while (!context.QueryComplete()); - - //get script object handles - RMTPObjectMgrQueryContext contextScript; - RArray handlesScript; - CleanupClosePushL(contextScript); - CleanupClosePushL(handlesScript); - TMTPObjectMgrQueryParams paramsScript(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeScript, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - do - { - iFramework.ObjectMgr().GetObjectHandlesL(paramsScript, contextScript, handlesScript); - iHandles->AppendL(handlesScript); - } - while (!contextScript.QueryComplete()); - CleanupStack::PopAndDestroy(&contextScript); - CleanupStack::PopAndDestroy(&handlesScript); - - //get image object handles - RMTPObjectMgrQueryContext contextImage; - RArray handlesImage; - CleanupClosePushL(contextImage); - CleanupClosePushL(handlesImage); - TMTPObjectMgrQueryParams paramsImage(Request().Uint32(TMTPTypeRequest::ERequestParameter1), EMTPFormatCodeEXIFJPEG, Request().Uint32(TMTPTypeRequest::ERequestParameter3)); - do - { - iFramework.ObjectMgr().GetObjectHandlesL(paramsImage, contextImage, handlesImage); - iHandles->AppendL(handlesImage); - } - while (!contextImage.QueryComplete()); - CleanupStack::PopAndDestroy(&contextImage); - CleanupStack::PopAndDestroy(&handlesImage); + HandleObjectHandlesUnderMacL(*iHandles); } else { + RMTPObjectMgrQueryContext context; + RArray handles; + CleanupClosePushL(context); + CleanupClosePushL(handles); TMTPObjectMgrQueryParams params(Request().Uint32(TMTPTypeRequest::ERequestParameter1), Request().Uint32(TMTPTypeRequest::ERequestParameter2), Request().Uint32(TMTPTypeRequest::ERequestParameter3)); do { @@ -185,7 +148,7 @@ if ( index != KErrNotFound ) { handles.Remove(index); - handles.Insert(handle,0); + handles.InsertL(handle,0); } } delete StorageSuid; @@ -194,13 +157,11 @@ } iHandles->AppendL(handles); } - while (!context.QueryComplete()); + while (!context.QueryComplete()); + CleanupStack::PopAndDestroy(&handles); + CleanupStack::PopAndDestroy(&context); } - - - - CleanupStack::PopAndDestroy(&handles); - CleanupStack::PopAndDestroy(&context); + SendDataL(*iHandles); __FLOG(_L8("ServiceL - Exit")); } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp --- a/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/devdp/src/cmtpgetstorageinfo.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -26,10 +26,7 @@ #include "rmtpdevicedpsingletons.h" #include "cmtpdevicedpconfigmgr.h" #include "mtpframeworkconst.h" - -//This file is exported from s60 sdk, now just copy it -//to make sure onb can run -#include "UiklafInternalCRKeys.h" +#include "mtpcommonconst.h" // Class constants. __FLOG_STMT(_LIT8(KComponent,"GetStorageInfo");) diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpfsenumerator.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -122,7 +122,7 @@ const TUint KCount(storages.Count()); for (TUint i(0); (i < KCount); i++) { - iStorages.Insert(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); + iStorages.InsertL(storages[i]->Uint(CMTPStorageMetaData::EStorageId),0); __FLOG_VA((_L8("FileEnumerator is doing storage id = %x\r\n"), storages[i]->Uint(CMTPStorageMetaData::EStorageId) )); } CleanupStack::PopAndDestroy(&storages); @@ -396,18 +396,27 @@ TInt CMTPFSEnumerator::RunError(TInt aError) { __FLOG_VA((_L8("RunError - entry with error %d"), aError)); - if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos])) - { - __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] )); - if (iStorages.Count()>1) - { - //Not necessary to process any entry on the storage, since the storage removed. - //Then need to start from root dir of next storage if there is. - //So, the dir stack is popped to bottom. - iDirStack.Reset(); - } - iSkipCurrentStorage = ETrue; - } + + // avoid to access overflow of iStorages + if (iScanPos < iStorages.Count()) + { + if(!iFramework.StorageMgr().ValidStorageId(iStorages[iScanPos])) + { + __FLOG_VA((_L8("Invalid StorageID = %d"),iStorages[iScanPos] )); + if (iStorages.Count()>1) + { + //Not necessary to process any entry on the storage, since the storage removed. + //Then need to start from root dir of next storage if there is. + //So, the dir stack is popped to bottom. + iDirStack.Reset(); + } + iSkipCurrentStorage = ETrue; + } + } + else + { + iSkipCurrentStorage = ETrue; + } // Reschedule ourselves TRequestStatus* status = &iStatus; @@ -501,7 +510,7 @@ ++len; format = EMTPFormatCodeAssociation; AddEntryL(iCurrentPath, handle, format, KMTPDeviceDPID, entry, iStorages[iScanPos], iParentHandle); - iDirStack.Append(TStackItem(iCurrentPath, handle)); + iDirStack.AppendL(TStackItem(iCurrentPath, handle)); } } else @@ -548,10 +557,16 @@ __FLOG_VA((_L("mime %S"), mime)); DpId = iDpSingletons.MTPUtility().GetDpIdL(parse.Ext().Mid(1),*mime); __FLOG_VA((_L("DpId find %d"), DpId)); + + format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime); + AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], + iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime)); } - format = iDpSingletons.MTPUtility().GetFormatCodeByMimeTypeL(parse.Ext().Mid(1),*mime); - AddFileEntryForOtherDpL(iCurrentPath, handle, format, DpId, entry, iStorages[iScanPos], - iParentHandle, iDpSingletons.MTPUtility().GetSubFormatCodeL(parse.Ext().Mid(1),*mime)); + else + { + AddEntryL(iCurrentPath, handle, EMTPFormatCodeUndefined, iDpID, entry, iStorages[iScanPos], iParentHandle); + } + CleanupStack::PopAndDestroy(mime); } else diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpknowledgehandler.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -747,7 +747,7 @@ TInt count = sizeof(KMTPFullEnumSyncKnowledgeObjectProperties) / sizeof(KMTPFullEnumSyncKnowledgeObjectProperties[0]); for (TInt i = 0; i < count; i++) { - aPropCodes.Append(KMTPFullEnumSyncKnowledgeObjectProperties[i]); + aPropCodes.AppendL(KMTPFullEnumSyncKnowledgeObjectProperties[i]); } } else if(2 == aGroupId) diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpmoveobject.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -36,7 +36,7 @@ */ const TMTPRequestElementInfo KMTPMoveObjectPolicy[] = { - {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir | EMTPElementAttrWrite, 0, 0, 0}, + {TMTPTypeRequest::ERequestParameter1, EMTPElementTypeObjectHandle, EMTPElementAttrFileOrDir, 0, 0, 0}, {TMTPTypeRequest::ERequestParameter2, EMTPElementTypeStorageId, EMTPElementAttrWrite, 0, 0, 0}, {TMTPTypeRequest::ERequestParameter3, EMTPElementTypeObjectHandle, EMTPElementAttrDir, 1, 0, 0} }; diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/cmtpsendobjectinfo.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -540,7 +540,7 @@ } } - if (result) + if (result && !iIsFolder) { result &= !Exists(iFullPath); if (!result) @@ -613,7 +613,7 @@ } } - if (result) + if (result && !iIsFolder) { result = !Exists(iFullPath); if (!result) @@ -1100,18 +1100,28 @@ iReceivedObject->SetUint(CMTPObjectMetaData::EStorageId, iStorageId); iReceivedObject->SetDesCL(CMTPObjectMetaData::ESuid, iFullPath); - iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); - if(iIsFolder) { - SetPropertiesL(); - iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); + SetPropertiesL(); + TUint32 handle = iFramework.ObjectMgr().HandleL(iFullPath); + if (handle != KMTPHandleNone) + { + // The folder is already in DB + iReceivedObject->SetUint(CMTPObjectMetaData::EHandle, handle); + iFramework.ObjectMgr().ModifyObjectL(*iReceivedObject); + } + else + { + iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); + iFramework.ObjectMgr().CommitReservedObjectHandleL(*iReceivedObject); + } } else - { - iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId); - iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); - } + { + iFramework.ObjectMgr().ReserveObjectHandleL(*iReceivedObject, iObjectSize); + iExpectedSendObjectRequest.SetUint32(TMTPTypeRequest::ERequestSessionID, iSessionId); + iFramework.RouteRequestRegisterL(iExpectedSendObjectRequest, iConnection); + } TUint32 parameters[3]; parameters[0] = iStorageId; parameters[1] = iParentHandle; @@ -1124,7 +1134,10 @@ { if (iIsFolder) { - User::LeaveIfError(iFramework.Fs().MkDirAll(iFullPath)); + if (!Exists(iFullPath)) + { + User::LeaveIfError(iFramework.Fs().MkDirAll(iFullPath)); + } } else { diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp --- a/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/dputility/src/rmtputility.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -526,6 +526,7 @@ if (KErrNone != iFramework->Fs().Entry(entryName, entry)) { // Skip objects that don't use the file path as SUID. + CleanupStack::PopAndDestroy(&rightPartName); CleanupStack::PopAndDestroy(&entryName); continue; } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp --- a/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/dataproviders/proxydp/src/cmtpdeleteobjectproplist.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -148,7 +148,7 @@ dpid = iSingletons.ObjectMgr().ObjectOwnerId( temp.Uint32(TMTPTypeDataPair::EOwnerHandle) ); if ( tmpDpid != dpid ) { - iTargetDps.Append(dpid); + iTargetDps.AppendL(dpid); CMTPTypeDeleteObjectPropList* dataset = CMTPTypeDeleteObjectPropList::NewLC(); iSubDatasets.AppendL( dataset ); dataset->AppendL( element); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp --- a/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/datatypes/group/mtpdatatypes.mmp Fri Jul 09 17:58:21 2010 +0800 @@ -37,8 +37,8 @@ MW_LAYER_SYSTEMINCLUDE_SYMBIAN USERINCLUDE ../inc -//For UiklafInternalCRKeys.h,should be removed, after we switched to DFs -USERINCLUDE ../../common/inc +USERINCLUDE ../../inc + SOURCEPATH ../src diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp --- a/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/datatypes/src/cmtptypefile.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -21,9 +21,7 @@ #include #include -//This file is exported from s60 sdk, now just copy it -//to make sure onb can run -#include "UiklafInternalCRKeys.h" +#include "mtpcommonconst.h" // File type constants. const TInt KMTPFileChunkSizeForLargeFile(0x00080000); // 512K diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/inc/mtpcommonconst.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mtpfws/mtpfw/inc/mtpcommonconst.h Fri Jul 09 17:58:21 2010 +0800 @@ -0,0 +1,53 @@ +// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// + +/** + @file + @internalComponent +*/ + +#ifndef MTPCOMMONCONST_H +#define MTPCOMMONCONST_H + +#ifdef __SERIES60_ +#include +#else +//Following is copied from 'UiklafInternalCRKeys.h', which is +//exported from S60 sdk, in Symbian CBR, this file does not exist. +const TUid KCRUidUiklaf = { 0x101F8774 }; +const TUint32 KUikOODDiskFreeSpaceWarningNoteLevel = 0x00000006; +const TUint32 KUikOODDiskFreeSpaceWarningNoteLevelMassMemory = 0x00000007; +#endif + +#ifdef __MTP_NAVIENGINE_TEST +//The free size of C-Drive of NaviEngine env is less than 21M, +//it will block many ONB test cases +const TInt KFreeSpaceThreshHoldDefaultValue(0); +const TInt KFreeSpaceExtraReserved(0); + +#else +//MTP should reserve some disk space to prevent OOD(Out of Disk) monitor +//popup 'Out of memory' note.When syncing music through ovi player, +//sometimes device screen get freeze with this note +//Be default, this value is read from Central Respository, if error while +//reading, use this one +const TInt KFreeSpaceThreshHoldDefaultValue(20*1024*1024);//20M bytes + +//Beside the OOD threshold value, we need to reserve extra disk space +//for harvest server,Thumbnail manager to store their data, set this as 7M +const TInt KFreeSpaceExtraReserved(7*1024*1024);//7M bytes + +#endif +#endif //MTPCOMMONCONST_H diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/src/cmtpconnection.cpp --- a/mtpfws/mtpfw/src/cmtpconnection.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/src/cmtpconnection.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -94,6 +94,12 @@ } iSessions.ResetAndDestroy(); + + if (iTransportConnection != NULL) + { + iTransportConnection->Unbind(*this); + } + //close the property iProperty.Close(); // delete the ‘name?property @@ -357,7 +363,7 @@ CompleteCloseConnection(); ret = ETrue; } - + SetState(EStateShutdown); PublishConnState(EDisconnectedFromHost); } @@ -372,10 +378,6 @@ CloseAllSessions(); iSessions.Reset(); - if (iTransportConnection != NULL) - { - iTransportConnection->Unbind(*this); - } //notify ConnectionMgr and corresponding transports of completion of connection close iSingletons.ConnectionMgr().ConnectionCloseComplete(iConnectionId); @@ -405,8 +407,12 @@ */ SessionOpenedL(KMTPSessionNone); + if (iTransportConnection != NULL) + { + iTransportConnection->Unbind(*this); + } iTransportConnection = &aTransportConnection; - iTransportConnection->BindL(*this); + iTransportConnection->BindL(*this); SetState(EStateOpen); } @@ -707,7 +713,7 @@ iEventQ(_FOFF(CMTPEventLink, iLink)), iTransportConnection(&aTransportConnection) { - + iTransportConnection->BindL(*this); } /** diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp --- a/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/src/cmtpdataprovidercontroller.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -185,7 +185,7 @@ if ((iDataProviders[index]->DataProviderId() != iDpIdDeviceDp) && (iDataProviders[index]->DataProviderId() != iDpIdProxyDp)) { - iDataProviderIds.Append(iDataProviders[index]->DataProviderId()); + iDataProviderIds.AppendL(iDataProviders[index]->DataProviderId()); } } @@ -484,7 +484,7 @@ Cancel(); //clean the root level snapshot - iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue); + TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(ETrue)); //Schedule again to scan subdir iEnumerationState = EEnumeratingSubDirFiles; @@ -500,9 +500,7 @@ { Cancel(); iEnumerationState = EEnumeratingCleanDBSnapshot; - iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(EFalse); - - + TRAP_IGNORE(iSingletons.ObjectMgr().ObjectStore().CleanDBSnapshotL(EFalse)); } else { diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/src/cmtpobjectstore.cpp --- a/mtpfws/mtpfw/src/cmtpobjectstore.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/src/cmtpobjectstore.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -442,6 +442,12 @@ TBool needUpdateOwner = EFalse; TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); + if ((aObject.DesC(CMTPObjectMetaData::ESuid)).Length() > KMaxFileName) + { + // The length of object uid should not excceeds KMaxFileName + User::Leave( KErrBadName ); + } + TFileName suid; suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); TUint32 suidHash = DefaultHash::Des16(suid); @@ -478,7 +484,8 @@ aObject.SetUint(CMTPObjectMetaData::EHandle, handle); id = iEnumeratingCacheObjList[found]->iPOUID; aObject.SetUint(CMTPObjectMetaData::EIdentifier, id); - if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode)) + if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode) || + iEnumeratingCacheObjList[found]->iObjParentId != aObject.Uint(CMTPObjectMetaData::EParentHandle)) {//have different owner needUpdateOwner = ETrue; } @@ -523,6 +530,7 @@ needToInsert = ETrue; __FLOG_VA((_L8("InsertObjectL After enmueration, needUpdateOwner %d needToInsert %d"), needUpdateOwner, needToInsert)); } + if (needToInsert)//needToInsert and needUpdateOwner can't be true at same time { TUint32 parentHandle(aObject.Uint(CMTPObjectMetaData::EParentHandle)); @@ -562,6 +570,7 @@ iBatched.SetColL(EObjectStoreModes, aObject.Uint(CMTPObjectMetaData::EModes)); iBatched.SetColL(EObjectStoreNonConsumable, aObject.Uint(CMTPObjectMetaData::ENonConsumable)); iBatched.SetColL(EObjectStoreName, aObject.DesC(CMTPObjectMetaData::EName)); + iBatched.SetColL(EObjectStoreParentHandle, aObject.Uint(CMTPObjectMetaData::EParentHandle)); iBatched.PutL(); CleanupStack::Pop(&iBatched); IncTranOpsNumL(); @@ -938,6 +947,14 @@ { err = iDatabase.Recover(); } + if(KErrNone == err) + { + err = iDatabase.Compact(); + if(KErrNone != err) + {//the DB file is corrupt + BaflUtils::DeleteFile(iSingletons.Fs(), fullName); + } + } } if (err != KErrNone) diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/src/cmtpreferencemgr.cpp --- a/mtpfws/mtpfw/src/cmtpreferencemgr.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/src/cmtpreferencemgr.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -136,7 +136,7 @@ for(TInt i = 0; i < count; i++) { TUint32 toHandle = iObjectStore.HandleL(aToSuids[i]); - toHandles.Append(toHandle); + toHandles.AppendL(toHandle); } SetReferencesL(fromHandle, toHandles); @@ -336,7 +336,7 @@ TInt count = aToHandles.NumElements(); for(TInt i = 0; i < count; i++) { - tempArray.Append(aToHandles.ElementUint(i)); + tempArray.AppendL(aToHandles.ElementUint(i)); } SetReferencesL(aFromHandle.Value(), tempArray); CleanupStack::PopAndDestroy(&tempArray); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/src/cmtpserviceconfig.cpp --- a/mtpfws/mtpfw/src/cmtpserviceconfig.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/src/cmtpserviceconfig.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -237,7 +237,7 @@ TUint num = reader.ReadInt16(); while( num-- ) { - aNamespaces.Append( ReadGUID(reader) ); + aNamespaces.AppendL( ReadGUID(reader) ); } CleanupStack::PopAndDestroy(buffer); diff -r 3ae5cb0b4c02 -r a26669f87b46 mtpfws/mtpfw/src/ruidmapper.cpp --- a/mtpfws/mtpfw/src/ruidmapper.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtpfws/mtpfw/src/ruidmapper.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -50,7 +50,7 @@ for (TInt n = 0 ; n < entries; ++n) { TUint transportId(resourceReader.ReadInt32()); - st.iTransportUidList.Append(transportId); + st.iTransportUidList.AppendL(transportId); } InsertToMappingStruct(st); } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h --- a/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Fri Jun 25 16:54:01 2010 +0800 +++ b/mtptransports/mtpusbtransport/usbsic_imp/inc/cmtpusbepbase.h Fri Jul 09 17:58:21 2010 +0800 @@ -55,6 +55,7 @@ void FlushRxDataL(); void FlushBufferedRxDataL(); + void FlushOnePacketL(); protected: diff -r 3ae5cb0b4c02 -r a26669f87b46 mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp --- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbconnection.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -636,7 +636,11 @@ { __FLOG(_L8("SendInterruptDataCompleteL - Entry")); iEventPending = EFalse; + + if ( NULL != iProtocolLayer) + { BoundProtocolLayer().SendEventCompleteL(aError, iMTPEvent); + } __FLOG(_L8("SendInterruptDataCompleteL - Exit")); } @@ -1358,7 +1362,17 @@ { // Invalid bulk transaction state, close the connection. __FLOG_VA((_L8("Expected bulk transaction state = %d"), aExpectedTransactionState)); + + //if transaction is in request phase, while the container type of data we received is other transaction phase, + //just ignore the data and initiate another request receiving. + if (ERequestPhase == iBulkTransactionState) + { + InitiateBulkRequestSequenceL(); + } + else + { CloseConnection(); + } } __FLOG(_L8("BulkRequestTransactionStateValid - Exit")); return valid; @@ -1503,6 +1517,7 @@ __FLOG(_L8("BulkEndpointsStallL - Entry")); EndpointStallL(EMTPUsbEpBulkIn); EndpointStallL(EMTPUsbEpBulkOut); + SetDeviceStatus(EMTPUsbDeviceStatusTransactionCancelled); __FLOG(_L8("BulkEndpointsStallL - Exit")); } diff -r 3ae5cb0b4c02 -r a26669f87b46 mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp --- a/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Fri Jun 25 16:54:01 2010 +0800 +++ b/mtptransports/mtpusbtransport/usbsic_imp/src/cmtpusbepbase.cpp Fri Jul 09 17:58:21 2010 +0800 @@ -596,19 +596,11 @@ // USB Header validation if (!ValidateUSBHeaderL()) { - //trash data, continue to flush. - TRequestStatus status; - RBuf8 readBuf; - readBuf.CreateL(KMaxPacketTypeBulkHS); - Connection().Ldd().ReadPacket(status, EndpointNumber(), readBuf, KMaxPacketTypeBulkHS); - User::WaitForRequest(status); - RDebug::Print(_L("CMTPUsbEpBase::ProcessFirstReceivedChunkL(), trash data length = %d"), readBuf.Length()); - readBuf.Close(); + //trash data, continue to flush by one packet. + FlushOnePacketL(); InitiateFirstChunkReceiveL(); return; - - } if ((iDataLength - KUSBHeaderSize) == 0) @@ -617,7 +609,14 @@ SetStreamState(EReceiveComplete); } } - else if (iReceiveChunkData.MaxLength() == iReceiveChunkData.Length()) + else if (iReceiveChunkData.MaxLength() == KUSBHeaderSize + && iReceiveChunkData.Length() < KUSBHeaderSize) + { + //trash data received, just diacard it and initiate next receiving + InitiateFirstChunkReceiveL(); + return; + } + else if (iReceiveChunkData.MaxLength() == iReceiveChunkData.Length()) { // USB Control request setup or data packet is received from Control EP. // All the desired data should be received. @@ -692,7 +691,7 @@ // 1. MTP file receiving: MTP type file never returns KMTPChunkSequenceCompletion,It can be received // one part after another. Also it can be commited mutiple times. // 2. Other MTP datatype receiving during the middle of data stream - __FLOG(_L8("Commiting write data chunk")); + __FLOG(_L8("Commiting write data chunk - 1")); needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); lastChunkCommited = ETrue; } @@ -702,7 +701,7 @@ { // It should be the end of MTP type file receiving since it never returns KMTPChunkSequenceCompletion. // it can be commited mutiple times. - __FLOG(_L8("Commiting write data chunk")); + __FLOG(_L8("Commiting write data chunk - 2")); needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); } else if ((iChunkStatus == KMTPChunkSequenceCompletion) @@ -711,9 +710,22 @@ { // The last chunk data which type is any other MTP data type than MTP file type. // It will not be commited until all the chunk data is received. - __FLOG(_L8("Commiting write data chunk")); + __FLOG(_L8("Commiting write data chunk - 3")); needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); - } + } + else if ((iChunkStatus == KMTPChunkSequenceCompletion) + && !endStream + && (iReceiveChunkData.Length() == iReceiveChunkData.MaxLength())) + { + // The last chunk data is received and chunk has been filled up: + // just flush one packet and set endStream true and commit received data. + // This condition tries to make MTP more robust if DP forgets to handle data-out phase. + __FLOG(_L8("Commiting write data chunk - 4")); + + FlushOnePacketL(); + endStream = ETrue; + needCommit = iReceiveDataSink->CommitChunkL(iReceiveChunkData); + } } // Fetch the next read data chunk. @@ -1110,3 +1122,15 @@ readBuf.Close(); } } + +void CMTPUsbEpBase::FlushOnePacketL() + { + //trash data, continue to flush. + TRequestStatus status; + RBuf8 readBuf; + readBuf.CreateL(KMaxPacketTypeBulkHS); + Connection().Ldd().ReadPacket(status, EndpointNumber(), readBuf, KMaxPacketTypeBulkHS); + User::WaitForRequest(status); + RDebug::Print(_L("CMTPUsbEpBase::ProcessFirstReceivedChunkL(), trash data length = %d"), readBuf.Length()); + readBuf.Close(); + }