# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1271251443 -10800 # Node ID 82c0024438c83c0da73878507e9f92c28d4ca0a0 # Parent 50de4d668bb609327f97c0832acce4f71158ffc8 Revision: 201013 Kit: 201015 diff -r 50de4d668bb6 -r 82c0024438c8 clfwrapper/ClientSrc/CCLFQueryAdapter.cpp --- a/clfwrapper/ClientSrc/CCLFQueryAdapter.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFQueryAdapter.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -205,8 +205,8 @@ } aStatus = KRequestPending; - iStatusArray.Append( &aStatus ); - iQueryArray.Append( aQuery ); + iStatusArray.AppendL( &aStatus ); + iQueryArray.AppendL( aQuery ); // Check that we can actually execute the query. We can if we have at least one query condition. if ( rootCondition.Count() > 0 ) diff -r 50de4d668bb6 -r 82c0024438c8 clfwrapper/ClientSrc/CCLFServerProxy.cpp --- a/clfwrapper/ClientSrc/CCLFServerProxy.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/clfwrapper/ClientSrc/CCLFServerProxy.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -187,7 +187,7 @@ { iWasNotificationHandled = EFalse; - const TInt index = iIdsPendingUpdate.Find( aId ); + const TInt index = iIdsPendingUpdate.FindInOrder( aId ); if ( index != KErrNotFound ) { iWasNotificationHandled = ETrue; @@ -213,9 +213,9 @@ const TInt idCount( aItemIDArray.Count() ); for ( TInt i = 0; i < idCount; ++i ) { - if ( iIdsPendingUpdate.Find( aItemIDArray[ i ] ) == KErrNotFound ) + if ( iIdsPendingUpdate.FindInOrder( aItemIDArray[ i ] ) == KErrNotFound ) { - iIdsPendingUpdate.Append( aItemIDArray[ i ] ); + iIdsPendingUpdate.InsertInOrder( aItemIDArray[ i ] ); } } } @@ -271,7 +271,7 @@ if ( id != KNoId ) { - iIdsPendingRemoval.Append( id ); + iIdsPendingRemoval.InsertInOrder( id ); } } iObjectsPendingRemoval.ResetAndDestroy(); @@ -287,7 +287,7 @@ if ( aType == ENotifyRemove ) { - const TInt index = iIdsPendingRemoval.Find( aId ); + const TInt index = iIdsPendingRemoval.FindInOrder( aId ); if ( index != KErrNotFound ) { iWasNotificationHandled = ETrue; @@ -420,7 +420,7 @@ if ( aType == ENotifyRemove ) { - const TInt index = iIdsPendingRemoval.Find( aId ); + const TInt index = iIdsPendingRemoval.FindInOrder( aId ); if ( index != KErrNotFound ) { @@ -430,12 +430,12 @@ } else if ( aType == ENotifyAdd || aType == ENotifyModify ) { - const TInt index = iIdsPendingUpdate.Find( aId ); + const TInt index = iIdsPendingUpdate.FindInOrder( aId ); if ( index != KErrNotFound ) { iIdsPendingUpdate.Remove( index ); - const TInt handledIndex = iIdsHandled.Find( aId ); + const TInt handledIndex = iIdsHandled.FindInOrder( aId ); if( handledIndex != KErrNotFound ) { iIdsHandled.Remove( handledIndex ); @@ -444,7 +444,7 @@ } else if( iHarvestingOngoing ) { - iIdsHandled.Append( aId ); + iIdsHandled.InsertInOrder( aId ); iWasNotificationHandled = ETrue; } } @@ -596,7 +596,7 @@ id = iMdESession.RemoveObjectL( object.Id() ); if ( id != KNoId ) { - iIdsPendingRemoval.Append( id ); + iIdsPendingRemoval.InsertInOrder( id ); } } } @@ -687,14 +687,14 @@ object = iMdESession.GetObjectL( aUri ); if( object ) { - const TInt index = iIdsHandled.Find( object->Id() ); + const TInt index = iIdsHandled.FindInOrder( object->Id() ); if( index != KErrNotFound ) { iIdsHandled.Remove( index ); } else { - iIdsPendingUpdate.Append( object->Id() ); + iIdsPendingUpdate.InsertInOrder( object->Id() ); } } } diff -r 50de4d668bb6 -r 82c0024438c8 contextengine/plugins/calendarplugin/src/CalendarContextPlugin.cpp --- a/contextengine/plugins/calendarplugin/src/CalendarContextPlugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/contextengine/plugins/calendarplugin/src/CalendarContextPlugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -240,6 +240,14 @@ WRITELOG1( "CCalendarContextPlugin::AddMetaDataL -- instanceCount: %d", instanceCount ); + if( instanceCount == 0 ) + { + CleanupStack::PopAndDestroy( &instances ); + + WRITELOG( "CCalendarContextPlugin::AddMetaDataL - no calendar items found -- RETURN" ); + return; + } + // required object properties WRITELOG( "CCalendarContextPlugin::AddMetaDataL" ); User::LeaveIfNull( iMdeSession ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/blacklistclient/src/blacklistclient.cpp --- a/harvester/blacklistclient/src/blacklistclient.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/blacklistclient/src/blacklistclient.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -116,7 +116,7 @@ } User::WaitForRequest( status ); - error = server.ExitType() == EExitPanic ? KErrGeneral : status.Int(); + error = server.ExitType() == EExitPanic ? KErrCommsBreak : status.Int(); server.Close(); WRITELOG( "RBlacklistClient::StartServer - end" ); @@ -287,7 +287,7 @@ { if ( modified == aLastModifiedTime.Int64() ) { - WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is different" ); + WRITELOG( "RBlacklistClient::IsBlacklistedL - file is blacklisted, modification time is the same" ); return ETrue; } else diff -r 50de4d668bb6 -r 82c0024438c8 harvester/blacklistserver/src/blacklistserver.cpp --- a/harvester/blacklistserver/src/blacklistserver.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/blacklistserver/src/blacklistserver.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -154,13 +154,8 @@ { WRITELOG( "CBlacklistServer::ConstructL - begin" ); - const TInt error = Start( KBlacklistServerName ); + StartL( KBlacklistServerName ); - if ( error != KErrNone ) - { - __ASSERT_DEBUG( EFalse, User::Panic( KBlacklistServerName, error )); - } - iSqLiteConnection = CMdSSqLiteConnection::NewL(); WRITELOG( "CBlacklistServer::ConstructL - end" ); @@ -232,21 +227,25 @@ void CBlacklistServer::ExeMainL() { WRITELOG( "CBlacklistServer::ExeMainL - begin" ); + User::LeaveIfError( User::RenameThread(KBlacklistServerName) ); + // Construct active scheduler + CActiveScheduler* activeScheduler = new ( ELeave ) CActiveScheduler; + CleanupStack::PushL( activeScheduler ); // Install active scheduler - CActiveScheduler* scheduler = new( ELeave ) CActiveScheduler; - CleanupStack::PushL( scheduler ); - CActiveScheduler::Install( scheduler ); + // We don't need to check whether an active scheduler is already installed + // as this is a new thread, so there won't be one + CActiveScheduler::Install( activeScheduler ); - CBlacklistServer::NewLC(); + // Construct our server + CBlacklistServer::NewLC(); // Anonymous - User::LeaveIfError( User::RenameThread( KBlacklistServerName ) ); RProcess::Rendezvous( KErrNone ); + // Start handling requests CActiveScheduler::Start(); - CleanupStack::PopAndDestroy( 2, scheduler ); - + CleanupStack::PopAndDestroy( 2, activeScheduler ); WRITELOG( "CBlacklistServer::ExeMainL - end" ); } @@ -256,21 +255,18 @@ // TInt E32Main() { - WRITELOG( "CBlacklistServer::E32Main - begin" ); - + WRITELOG( "CBlacklistServer::E32Main - begin" ); __UHEAP_MARK; - - CTrapCleanup* cleanup = CTrapCleanup::New(); - - TRAPD( error, CBlacklistServer::ExeMainL() ); - __ASSERT_ALWAYS( !error, User::Panic( KBlacklistServerName, error ) ); - - delete cleanup; + CTrapCleanup* cleanup=CTrapCleanup::New(); + TInt result = KErrNoMemory; + if (cleanup) + { + TRAP(result, CBlacklistServer::ExeMainL()); + delete cleanup; + } __UHEAP_MARKEND; - WRITELOG( "CBlacklistServer::E32Main - end" ); - - return 0; + return result; } diff -r 50de4d668bb6 -r 82c0024438c8 harvester/client/src/harvesterclient.cpp --- a/harvester/client/src/harvesterclient.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/client/src/harvesterclient.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -523,19 +523,14 @@ { WRITELOG( "CreateServerProcess() - begin" ); RProcess server; - TInt result = server.Create( KHarvesterServerExe, KNullDesC ); - - if( result == KErrAlreadyExists ) - { - return KErrNone; - } - + TInt result = server.Create( KHarvesterServerExe, KNullDesC ); if ( result != KErrNone ) { WRITELOG1( "CreateServerProcess() - failed to create server process, error: %d", result ); return result; } + // Process created successfully TRequestStatus stat( 0 ); server.Rendezvous( stat ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/common/group/harvesterdata.mmp --- a/harvester/common/group/harvesterdata.mmp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/common/group/harvesterdata.mmp Wed Apr 14 16:24:03 2010 +0300 @@ -47,5 +47,5 @@ PAGED BYTEPAIRCOMPRESSTARGET -OPTION ARMCC -O3 -OTime +OPTION ARMCC -O2 -OTime diff -r 50de4d668bb6 -r 82c0024438c8 harvester/common/inc/harvestereventmanager.h --- a/harvester/common/inc/harvestereventmanager.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/common/inc/harvestereventmanager.h Wed Apr 14 16:24:03 2010 +0300 @@ -129,6 +129,8 @@ HarvesterEventObserverType aObserverType, HarvesterEventState aEventState, TUint aItemsLeft ); + static TInt CompareProperties(const THarvesterEventQueue& aFirst, const THarvesterEventQueue& aSecond); + private: RArray iEventStatuses; diff -r 50de4d668bb6 -r 82c0024438c8 harvester/common/src/harvestereventmanager.cpp --- a/harvester/common/src/harvestereventmanager.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/common/src/harvestereventmanager.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -329,11 +329,10 @@ THarvesterEventQueue* msgQueue = new (ELeave) THarvesterEventQueue; CleanupStack::PushL( msgQueue ); - TInt err = msgQueue->Open( aMessage, 1 ); + User::LeaveIfError( msgQueue->Open( aMessage, 1 ) ); - User::LeaveIfError( err ); - - iEventQueues.AppendL( msgQueue ); + User::LeaveIfError( iEventQueues.InsertInOrderAllowRepeats(msgQueue, + TLinearOrder(CHarvesterEventManager::CompareProperties))); observerInfo->iQueuePtr = msgQueue; CleanupStack::Pop( msgQueue ); @@ -396,17 +395,31 @@ // was the last observer which used it if( !otherObserverFound ) { - for(TInt i = iEventQueues.Count(); --i >= 0;) - { - THarvesterEventQueue* queue = iEventQueues[i]; - if( queue->Handle() == serverQueueHandle ) - { - iEventQueues.Remove( i ); - queue->Close(); - delete queue; - break; - } - } + TInt low( 0 ); + TInt high( iEventQueues.Count() ); + + while( low < high ) + { + TInt mid( (low+high)>>1 ); + + const TInt compare( serverQueueHandle - iEventQueues[mid]->Handle() ); + if( compare == 0 ) + { + THarvesterEventQueue* queue = iEventQueues[mid]; + iEventQueues.Remove( mid ); + queue->Close(); + delete queue; + break; + } + else if( compare > 0 ) + { + low = mid + 1; + } + else + { + high = mid; + } + } iEventQueues.Compress(); } @@ -460,3 +473,9 @@ // deprecated method, just return something return 0; } + +TInt CHarvesterEventManager::CompareProperties(const THarvesterEventQueue& aFirst, const THarvesterEventQueue& aSecond) + { + return aFirst.Handle() - aSecond.Handle(); + } + diff -r 50de4d668bb6 -r 82c0024438c8 harvester/common/src/harvesterexifutil.cpp --- a/harvester/common/src/harvesterexifutil.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/common/src/harvesterexifutil.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -1817,7 +1817,7 @@ const CExifTag* refTag = aReader->GetTagL( EIfdGps, KIdGpsAltitudeRef ); - TBuf8<1> altitudeRef = refTag->Data(); + TBuf8<2> altitudeRef = refTag->Data(); const CExifTag* altitudeTag = aReader->GetTagL( EIfdGps, KIdGpsAltitude ); TBuf8 altitudeBuf = altitudeTag->Data(); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h --- a/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/inc/harvesteraudioplugin.h Wed Apr 14 16:24:03 2010 +0300 @@ -154,6 +154,8 @@ CThumbnailManager* iTNM; TBool iHarvestAlbumArt; + + TInt iMaxTextLength; }; diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp --- a/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/AudioPlugin/src/harvesteraudioplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -279,6 +279,8 @@ { CMdEObjectDef& objectDef = mdeObject.Def(); iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } CMdeObjectWrapper::HandleObjectPropertyL( @@ -312,6 +314,8 @@ { CMdEObjectDef& objectDef = mdeObject.Def(); iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( objectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, @@ -342,6 +346,8 @@ { CMdEObjectDef& audioObjectDef = mdeObject.Def(); iPropDefs = CHarvesterAudioPluginPropertyDefs::NewL( audioObjectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } TPtrC ext; @@ -393,35 +399,35 @@ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTimeOffsetPropertyDef, &timeOffsetMinutes, aIsAdd ); if ( song.Length() > 0 - && song.Length() < iPropDefs->iTitlePropertyDef->MaxTextLengthL() ) + && song.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iTitlePropertyDef, &song, EFalse ); } if ( artist.Length() > 0 - && artist.Length() < iPropDefs->iArtistPropertyDef->MaxTextLengthL() ) + && artist.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iArtistPropertyDef, &artist, aIsAdd ); } if ( album.Length() > 0 - && album.Length() < iPropDefs->iAlbumPropertyDef->MaxTextLengthL() ) + && album.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iAlbumPropertyDef, &album, aIsAdd ); } if ( genre.Length() > 0 - && genre.Length() < iPropDefs->iGenrePropertyDef->MaxTextLengthL() ) + && genre.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iGenrePropertyDef, &genre, aIsAdd ); } if ( composer.Length() > 0 - && composer.Length() < iPropDefs->iComposerPropertyDef->MaxTextLengthL() ) + && composer.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iComposerPropertyDef, &composer, aIsAdd ); @@ -440,7 +446,7 @@ } if ( orgArtist.Length() > 0 - && orgArtist.Length() < iPropDefs->iOriginalArtistPropertyDef->MaxTextLengthL() ) + && orgArtist.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iOriginalArtistPropertyDef, &orgArtist, aIsAdd ); @@ -471,7 +477,7 @@ } if ( copyright.Length() > 0 - && copyright.Length() < iPropDefs->iCopyrightPropertyDef->MaxTextLengthL() ) + && copyright.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL( mdeObject, *iPropDefs->iCopyrightPropertyDef, ©right, aIsAdd ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h --- a/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/ImagePlugin/inc/harvesterimageplugin.h Wed Apr 14 16:24:03 2010 +0300 @@ -197,6 +197,8 @@ RArray< TMimeTypeMapping > iMimeTypeMappings; CHarvesterImagePluginPropertyDefs* iPropDefs; + + TInt iMaxTextLength; }; #endif diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp --- a/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/ImagePlugin/src/harvesterimageplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -385,6 +385,8 @@ if( !iPropDefs ) { iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( objectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } aMetadataObject.Property( *iPropDefs->iSizePropertyDef, prop ); @@ -679,6 +681,8 @@ if( !iPropDefs ) { iPropDefs = CHarvesterImagePluginPropertyDefs::NewL( mdeObject.Def() ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); @@ -775,16 +779,25 @@ if ( aFileData.iExifSupported ) { // MediaObject - Description - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aHd.iDescription16, aIsAdd ); + if( aHd.iDescription16 && aHd.iDescription16->Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aHd.iDescription16, aIsAdd ); + } // MediaObject - Comment (user comment) - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCommentPropertyDef, aHd.iComment16, aIsAdd ); + if( aHd.iComment16 && aHd.iComment16->Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCommentPropertyDef, aHd.iComment16, aIsAdd ); + } // MediaObject - Release date CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iReleaseDatePropertyDef, &localModifiedDate, aIsAdd ); // MediaObject - Copyright - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aHd.iCopyright16, aIsAdd ); + if( aHd.iCopyright16 && aHd.iCopyright16->Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aHd.iCopyright16, aIsAdd ); + } // Data & time original if ( aHd.iDateOriginal8 ) @@ -818,7 +831,10 @@ } // Artist - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aHd.iArtist, aIsAdd ); + if( aHd.iArtist && aHd.iArtist->Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aHd.iArtist, aIsAdd ); + } // Image - White balance if ( aHd.iStoreWhiteBalance ) @@ -838,11 +854,17 @@ CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iExposureProgramPropertyDef, &aHd.iExposureProgram, aIsAdd ); } - // Make string - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMakePropertyDef, aHd.iMake, aIsAdd ); + // Make string + if( aHd.iMake && aHd.iMake->Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iMakePropertyDef, aHd.iMake, aIsAdd ); + } // Model string - CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iModelPropertyDef, aHd.iModel, aIsAdd ); + if( aHd.iModel && aHd.iModel->Length() < iMaxTextLength ) + { + CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iModelPropertyDef, aHd.iModel, aIsAdd ); + } // Orientation if ( aHd.iStoreOrientation ) @@ -980,7 +1002,7 @@ } // Related soundfile - if ( aHd.iRelatedSoundFile && aHd.iRelatedSoundFile->Length() > 0 ) + if ( aHd.iRelatedSoundFile && aHd.iRelatedSoundFile->Length() > 0 && aHd.iRelatedSoundFile->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iRelatedSoundFilePropertyDef, aHd.iRelatedSoundFile, aIsAdd ); } diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp --- a/harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/MessagePlugin/src/harvestermessageplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -30,7 +30,6 @@ #include #include "harvestermessageplugin.h" -#include "harvestercommon.h" #include "harvesterlog.h" #include "mdsutils.h" #include "mdeobjectdef.h" diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h --- a/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/OMADRMPlugin/inc/harvesteromadrmplugin.h Wed Apr 14 16:24:03 2010 +0300 @@ -155,6 +155,8 @@ private: CHarvesterOmaDrmPluginPropertyDefs* iPropDefs; + + TInt iMaxTextLength; }; #endif // __CHarvesterOMADRMPlugin_H__ diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp --- a/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/OMADRMPlugin/src/harvesteromadrmplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -264,6 +264,8 @@ { CMdEObjectDef& objectDef = mdeObject.Def(); iPropDefs = CHarvesterOmaDrmPluginPropertyDefs::NewL( objectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL(); } TTimeIntervalSeconds timeOffset = User::UTCOffset(); @@ -301,25 +303,25 @@ *iPropDefs->iDrmPropertyDef, &aVHD.iDrmProtected, aIsAdd ); // Title (is set from URI by default) - if(aVHD.iTitle.Length() > 0) + if( aVHD.iTitle.Length() > 0 && aVHD.iTitle.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, &aVHD.iTitle, EFalse ); } // Description - if(aVHD.iDescription.Length() > 0) + if( aVHD.iDescription.Length() > 0 && aVHD.iDescription.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, &aVHD.iDescription, aIsAdd ); } // Author - if(aVHD.iAuthor.Length() > 0) + if( aVHD.iAuthor.Length() > 0 && aVHD.iAuthor.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAuthorPropertyDef, &aVHD.iAuthor, aIsAdd ); } // Genre - if(aVHD.iGenre.Length() > 0) + if( aVHD.iGenre.Length() > 0 && aVHD.iGenre.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iGenrePropertyDef, &aVHD.iGenre, aIsAdd ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h --- a/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/VideoPlugin/inc/harvestervideoplugin.h Wed Apr 14 16:24:03 2010 +0300 @@ -22,6 +22,7 @@ #include "harvesterplugin.h" #include "mimetypemapping.h" +#include "harvestermediaidutil.h" // FORWARD DECLARATION class CMdEObjectDef; @@ -228,6 +229,11 @@ RArray iMimeTypeMappings; CHarvesterVideoPluginPropertyDefs* iPropDefs; + + TInt iMaxTextLength; + + // not own + CHarvesterMediaIdUtil* iMediaIdUtil; }; #endif // __CHARVESTERVIDEOPLUGIN_H__ diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp --- a/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/VideoPlugin/src/harvestervideoplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -161,6 +161,7 @@ { delete iPropDefs; iMimeTypeMappings.Close(); + RMediaIdUtil::ReleaseInstance(); WRITELOG("CHarvesterVideoPlugin::CHarvesterVideoPlugin()"); } @@ -268,6 +269,7 @@ KMimeTypeWmv(), KMimeTypeWmv() ) ), cmp ) ); + iMediaIdUtil = &RMediaIdUtil::GetInstanceL(); } @@ -948,6 +950,8 @@ { CMdEObjectDef& objectDef = mdeObject.Def(); iPropDefs = CHarvesterVideoPluginPropertyDefs::NewL( objectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iCopyrightPropertyDef->MaxTextLengthL(); } TTimeIntervalSeconds timeOffsetSeconds = User::UTCOffset(); @@ -1045,33 +1049,33 @@ } } } - + // Copyright - if( aVHD.iCopyright ) + if( aVHD.iCopyright && aVHD.iCopyright->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iCopyrightPropertyDef, aVHD.iCopyright, aIsAdd ); } // Author - if( aVHD.iAuthor ) + if( aVHD.iAuthor && aVHD.iAuthor->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAuthorPropertyDef, aVHD.iAuthor, aIsAdd ); } // Genre - if( aVHD.iGenre ) + if( aVHD.iGenre && aVHD.iGenre->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iGenrePropertyDef, aVHD.iGenre, aIsAdd ); } // Artist - if( aVHD.iPerformer ) + if( aVHD.iPerformer && aVHD.iPerformer->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iArtistPropertyDef, aVHD.iPerformer, aIsAdd ); } // Description - if( aVHD.iDescription ) + if( aVHD.iDescription && aVHD.iDescription->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, aVHD.iDescription, aIsAdd ); } @@ -1083,7 +1087,7 @@ } // Title - if( aVHD.iTitle ) + if( aVHD.iTitle && aVHD.iTitle->Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, aVHD.iTitle, EFalse ); } @@ -1143,6 +1147,29 @@ CHXMetaDataUtility* helixMetadata = CHXMetaDataUtility::NewL(); CleanupStack::PushL( helixMetadata ); + TFileName tempName; + TUint32 mediaId( 0 ); + TInt blackListError( KErrNone ); + + if( iBlacklist ) + { + WRITELOG( "CHarvesterVideoPlugin::GetRmTypeL - Adding URI to blacklist" ); + blackListError = aFile.FullName( tempName ); + if( blackListError == KErrNone ) + { + blackListError = iMediaIdUtil->GetMediaId( tempName, mediaId ); + if( blackListError == KErrNone ) + { + TTime modified ( 0 ); + blackListError = iFs.Modified( tempName, modified ); + if( blackListError == KErrNone ) + { + iBlacklist->AddFile( tempName, mediaId, modified ); + } + } + } + } + TRAPD( err, helixMetadata->OpenFileL( aFile ) ); if( err == KErrNone ) @@ -1226,6 +1253,12 @@ { aType.Copy( KVideo ); } + + if ( iBlacklist && blackListError == KErrNone ) + { + WRITELOG( "CHarvesterVideoPlugin::GetRmTypeL - Removing URI from blacklist" ); + iBlacklist->RemoveFile( tempName, mediaId ); + } helixMetadata->ResetL(); CleanupStack::PopAndDestroy( helixMetadata ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h --- a/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/WMVPlugin/inc/harvesterwmvplugin.h Wed Apr 14 16:24:03 2010 +0300 @@ -182,6 +182,8 @@ private: // data CHarvesterWmvPluginPropertyDefs* iPropDefs; + + TInt iMaxTextLength; }; #endif // C_HARVESTERWMVPLUGIN_H diff -r 50de4d668bb6 -r 82c0024438c8 harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp --- a/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/harvesterplugins/WMVPlugin/src/harvesterwmvplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -281,6 +281,8 @@ { CMdEObjectDef& objectDef = mdeObject.Def(); iPropDefs = CHarvesterWmvPluginPropertyDefs::NewL( objectDef ); + // Prefetch max text lengt for validity checking + iMaxTextLength = iPropDefs->iGenrePropertyDef->MaxTextLengthL(); } if( ! mdeObject.Placeholder() ) @@ -308,25 +310,25 @@ *iPropDefs->iDrmPropertyDef, &aClipDetails.iDrmProtected, aIsAdd ); } // Title (is set from URI by default) - if(aClipDetails.iTitle.Length() > 0) + if( aClipDetails.iTitle.Length() > 0 && aClipDetails.iTitle.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iTitlePropertyDef, &aClipDetails.iTitle, EFalse ); } // Description - if(aClipDetails.iDescription.Length() > 0) + if( aClipDetails.iDescription.Length() > 0 && aClipDetails.iDescription.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iDescriptionPropertyDef, &aClipDetails.iDescription, aIsAdd ); } // Author - if(aClipDetails.iAuthor.Length() > 0) + if( aClipDetails.iAuthor.Length() > 0 && aClipDetails.iAuthor.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iAuthorPropertyDef, &aClipDetails.iAuthor, aIsAdd ); } // Genre - if(aClipDetails.iGenre.Length() > 0) + if( aClipDetails.iGenre.Length() > 0 && aClipDetails.iGenre.Length() < iMaxTextLength ) { CMdeObjectWrapper::HandleObjectPropertyL(mdeObject, *iPropDefs->iGenrePropertyDef, &aClipDetails.iGenre, aIsAdd ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/monitorplugins/fileplugin/inc/processoriginmapper.h --- a/harvester/monitorplugins/fileplugin/inc/processoriginmapper.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/inc/processoriginmapper.h Wed Apr 14 16:24:03 2010 +0300 @@ -162,6 +162,8 @@ */ void WriteProcessOriginPairL( TUid& aProcessId, TOrigin& aOrigin ); + static TInt Compare(const TProcessOriginPair& aFirst, const TProcessOriginPair& aSecond); + private: // data /** diff -r 50de4d668bb6 -r 82c0024438c8 harvester/monitorplugins/fileplugin/src/movetimer.cpp --- a/harvester/monitorplugins/fileplugin/src/movetimer.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/movetimer.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -55,11 +55,10 @@ TPtrC nameExt; if( MdsUtils::GetNameExt( aUri, nameExt ) ) - { - + { // check if harvester queue contains harvesting request // with same file name and extension - for (int i = iHDArray.Count(); --i >= 0; ) + for (TInt i = iHDArray.Count(); --i >= 0; ) { CHarvesterData* hd = iHDArray[i]; diff -r 50de4d668bb6 -r 82c0024438c8 harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp --- a/harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/monitorplugins/fileplugin/src/processoriginmapper.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -99,7 +99,7 @@ if ( index < 0 ) // not found { TProcessOriginPair pair = { aProcessId, aOrigin }; - iProcessOriginMap.AppendL( pair ); + User::LeaveIfError( iProcessOriginMap.InsertInOrder(pair, TLinearOrder(CProcessOriginMapper::Compare))); } else if ( index < iProcessOriginMap.Count() ) { @@ -320,12 +320,25 @@ // TInt CProcessOriginMapper::FindProcess( const TUid& aProcessId ) { - const TInt count = iProcessOriginMap.Count(); - for ( TInt i( 0 ); i < count; i++ ) + TInt low( 0 ); + TInt high( iProcessOriginMap.Count() ); + + while( low < high ) { - if ( iProcessOriginMap[i].iProcessId == aProcessId ) + TInt mid( (low+high)>>1 ); + + const TInt compare( aProcessId.iUid - iProcessOriginMap[mid].iProcessId.iUid ); + if( compare == 0 ) { - return i; + return mid; + } + else if( compare > 0 ) + { + low = mid + 1; + } + else + { + high = mid; } } @@ -419,3 +432,8 @@ iWriteStream.WriteL( KLineFeed ); } +TInt CProcessOriginMapper::Compare(const TProcessOriginPair& aFirst, const TProcessOriginPair& aSecond) + { + return aFirst.iProcessId.iUid - aSecond.iProcessId.iUid; + } + diff -r 50de4d668bb6 -r 82c0024438c8 harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h --- a/harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/monitorplugins/mdsfileserverplugin/inc/mdsfileserverplugin.h Wed Apr 14 16:24:03 2010 +0300 @@ -134,6 +134,8 @@ void PrintDebugEvents( TInt aFunction ); #endif + static TInt Compare(const TDesC& aFirst, const TDesC& aSecond); + private: CFsPluginConnRequest* iNotification; diff -r 50de4d668bb6 -r 82c0024438c8 harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp --- a/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/monitorplugins/mdsfileserverplugin/src/mdsfileserverplugin.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -25,7 +25,7 @@ /* Server name */ _LIT( KHarvesterServerName, "HarvesterServer" ); -const TInt KCleanQueueTreshoald( 1000 ); +const TInt KCleanQueueTreshold( 1000 ); //----------------------------------------------------------------------------- // CMdsFileServerPlugin implementation @@ -753,7 +753,7 @@ TInt CMdsFileServerPlugin::AddNotificationPath( const CFsPluginConnRequest& aRequest ) { WRITELOG( "CMdsFileServerPlugin::AddNotificationPath()" ); - TInt err = KErrNone; + TInt err( KErrNone ); TMdsFSPStatusPckg pckg; TRAP( err, aRequest.ReadParam1L(pckg) ); @@ -767,22 +767,20 @@ if ( status.iFileName.Length() > 0 ) { - // check if already exists - const TInt count( iPaths.Count() ); - for ( TInt i = count; --i >= 0; ) + // check if already exist + const TInt ret = iPaths.FindInOrder(&status.iFileName, + TLinearOrder(CMdsFileServerPlugin::Compare)); + + if( ret >= 0 ) { - TDesC* tf = iPaths[i]; - if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 ) - { - return KErrNone; - } - } + return KErrNone; + } WRITELOG1( "CMdsFileServerPlugin::AddNotificationPath() - add path: %S", &status.iFileName ); HBufC* fn = status.iFileName.Alloc(); if ( fn ) { - iPaths.Append( fn ); + iPaths.InsertInOrder(fn, TLinearOrder(CMdsFileServerPlugin::Compare)); } else { @@ -804,7 +802,7 @@ TInt CMdsFileServerPlugin::RemoveNotificationPath( const CFsPluginConnRequest& aRequest ) { WRITELOG( "CMdsFileServerPlugin::RemoveNotificationPath()" ); - TInt err = KErrNone; + TInt err( KErrNone ); TMdsFSPStatusPckg pckg; TRAP( err, aRequest.ReadParam1L(pckg) ); @@ -818,17 +816,16 @@ if ( status.iFileName.Length() > 0 ) { - for ( TInt i = iPaths.Count(); --i >= 0; ) + const TInt ret = iPaths.FindInOrder(&status.iFileName, + TLinearOrder(CMdsFileServerPlugin::Compare)); + + if( ret >= 0 ) { - TDesC* tf = iPaths[i]; - if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 ) - { - WRITELOG1( "CMdsFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName ); - delete tf; - tf = NULL; - iPaths.Remove( i ); - } - } + WRITELOG1( "CMdsFileServerPlugin::RemoveNotificationPath() - remove path: %S", &status.iFileName ); + delete iPaths[ret]; + iPaths[ret] = NULL; + iPaths.Remove( ret ); + } iPaths.Compress(); } else @@ -846,7 +843,7 @@ TInt CMdsFileServerPlugin::AddIgnorePath( const CFsPluginConnRequest& aRequest ) { WRITELOG( "CMdsFileServerPlugin::AddIgnorePath()" ); - TInt err = KErrNone; + TInt err( KErrNone ); TMdsFSPStatusPckg pckg; TRAP( err, aRequest.ReadParam1L(pckg) ); @@ -861,20 +858,19 @@ if ( status.iFileName.Length() > 0 ) { // check if already exist - for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) + const TInt ret = iIgnorePaths.FindInOrder(&status.iFileName, + TLinearOrder(CMdsFileServerPlugin::Compare)); + + if( ret >= 0 ) { - TDesC* tf = iIgnorePaths[i]; - if ( MdsUtils::Compare( status.iFileName, *tf ) == 0 ) - { - return KErrNone; - } + return KErrNone; } WRITELOG1( "CMdsFileServerPlugin::AddIgnorePath() - add path: %S", &status.iFileName ); HBufC* fn = status.iFileName.Alloc(); if ( fn ) { - iIgnorePaths.Append( fn ); // ownership is transferred + iIgnorePaths.InsertInOrder(fn, TLinearOrder(CMdsFileServerPlugin::Compare)); } else { @@ -896,7 +892,7 @@ TInt CMdsFileServerPlugin::RemoveIgnorePath( const CFsPluginConnRequest& aRequest ) { WRITELOG( "CMdsFileServerPlugin::RemoveIgnorePath()" ); - TInt err = KErrNone; + TInt err( KErrNone ); TMdsFSPStatusPckg pckg; TRAP( err, aRequest.ReadParam1L(pckg) ); @@ -910,18 +906,16 @@ if ( status.iFileName.Length() > 0 ) { - // check if already exist - for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) + const TInt ret = iIgnorePaths.FindInOrder(&status.iFileName, + TLinearOrder(CMdsFileServerPlugin::Compare)); + + if( ret >= 0 ) { - TDesC* tf = iIgnorePaths[i]; - if ( MdsUtils::Compare(status.iFileName, *tf ) == 0 ) - { - WRITELOG1( "CMdsFileServerPlugin::RemoveIgnorePath() - remove path: %S", &status.iFileName ); - delete tf; - tf = NULL; - iIgnorePaths.Remove( i ); - } - } + WRITELOG1( "CMdsFileServerPlugin::RemoveIgnorePath() - remove path: %S", &status.iFileName ); + delete iIgnorePaths[ret]; + iIgnorePaths[ret] = NULL; + iIgnorePaths.Remove( ret ); + } iIgnorePaths.Compress(); } else @@ -938,8 +932,15 @@ // TBool CMdsFileServerPlugin::CheckPath( const TDesC& aFilename ) const { - // check if ignored pathlist - for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) + // check if ignored pathlist +#ifdef __WINSCW__ + // start checking from beginning of list as if the path is ignored, there + // is higher possibility that it is located on beginning side of the list + const TInt count( iIgnorePaths.Count() ); + for ( TInt i = 0; i < count; i++ ) +#else + for ( TInt i = iIgnorePaths.Count(); --i >= 0; ) +#endif { TDesC* pathName = iIgnorePaths[i]; if ( MdsUtils::Find( aFilename, *pathName ) != KErrNotFound ) @@ -951,7 +952,14 @@ // check if notification path if ( iPaths.Count() > 0 ) { +#ifdef __WINSCW__ + // start checking from beginning of list as if the path is supported, there + // is higher possibility that it is located on beginning side of the list + const TInt count( iPaths.Count() ); + for ( TInt i = 0; i < count; i++ ) +#else for ( TInt i = iPaths.Count(); --i >= 0; ) +#endif { TDesC* pathName = iPaths[i]; if ( MdsUtils::Find( aFilename, *pathName ) != KErrNotFound ) @@ -1042,7 +1050,7 @@ { WRITELOG( "CMdsFileServerPlugin::CheckHarvesterStatus() - begin" ); - if( iPendingEvents <= KCleanQueueTreshoald ) + if( iPendingEvents <= KCleanQueueTreshold ) { WRITELOG( "CMdsFileServerPlugin::CheckHarvesterStatus() - end" ); return ETrue; @@ -1287,3 +1295,9 @@ } } #endif + +TInt CMdsFileServerPlugin::Compare(const TDesC& aFirst, const TDesC& aSecond) + { + return aFirst.CompareF( aSecond ); + } + diff -r 50de4d668bb6 -r 82c0024438c8 harvester/server/inc/harvesterao.h --- a/harvester/server/inc/harvesterao.h Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/server/inc/harvesterao.h Wed Apr 14 16:24:03 2010 +0300 @@ -299,6 +299,8 @@ * From MHarvesterOomObserver */ void MemoryGood(); + + void RemoveBlacklistedFile( CHarvesterData* aItem ); private: diff -r 50de4d668bb6 -r 82c0024438c8 harvester/server/src/harvesterao.cpp --- a/harvester/server/src/harvesterao.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/server/src/harvesterao.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -232,12 +232,6 @@ CActiveScheduler::Add( this ); User::LeaveIfError( iFs.Connect() ); - - // Pump up priority for getting the MDE session up as fast as possible for other - // initialization to continue - RProcess process; - process.SetPriority( EPriorityForeground ); - process.Close(); // Setting up MdE Session iMdESession = CMdESession::NewL( *this ); @@ -1263,11 +1257,6 @@ { WRITELOG( "HarvesterThread::HandleSessionOpened()" ); - // Revert back to default Harvester process priority when MDE Session is up and running - RProcess process; - process.SetPriority( EPriorityBackground ); - process.Close(); - if ( KErrNone == aError ) { TBool isTNMDaemonEnabled( EFalse ); @@ -1424,7 +1413,7 @@ // --------------------------------------------------------------------------- // void CHarvesterAO::HandleSessionError( CMdESession& /*aSession*/, TInt aError ) - { + { if ( KErrNone != aError ) { WRITELOG1( "HarvesterThread::HandleSessionError() - Error: %d!", aError ); @@ -2834,3 +2823,11 @@ return EFalse; } +void CHarvesterAO::RemoveBlacklistedFile( CHarvesterData* aItem ) + { + if( iMdeSessionInitialized ) + { + TRAP_IGNORE( iMdESession->RemoveObjectL( aItem->Uri() ) ); + } + } + diff -r 50de4d668bb6 -r 82c0024438c8 harvester/server/src/harvesterqueue.cpp --- a/harvester/server/src/harvesterqueue.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/server/src/harvesterqueue.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -148,6 +148,11 @@ aItem->Uri(), mediaId, time ) ) { WRITELOG( "CHarvesterQueue::Append() - found a blacklisted file" ); + if( aItem->EventType() == EHarvesterEdit ) + { + // Remove possible placeholder items from DB if file was blacklisted during harvesting + iHarvesterAO->RemoveBlacklistedFile( aItem ); + } delete aItem; aItem = NULL; return; diff -r 50de4d668bb6 -r 82c0024438c8 harvester/server/src/mdeobjecthandler.cpp --- a/harvester/server/src/mdeobjecthandler.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/server/src/mdeobjecthandler.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -187,7 +187,7 @@ if( error != KErrNone ) { #ifdef _DEBUG - if( error == KErrInUse || error || KErrLocked ) + if( error == KErrInUse || error == KErrLocked ) { TPtrC fileName( aHD.Uri().Mid(2) ); WRITELOG1( "CMdeObjectHandler :: Checking open file handles to %S", &fileName ); diff -r 50de4d668bb6 -r 82c0024438c8 harvester/server/src/reharvesterao.cpp --- a/harvester/server/src/reharvesterao.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/harvester/server/src/reharvesterao.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -199,7 +199,7 @@ for( TInt i = iItems.Count(); --i >= 0; ) { CHarvesterData* item = iItems[i]; - if ( aItem.Uri().CompareC( item->Uri(), 1, NULL ) != 0 ) + if ( aItem.Uri().CompareF( item->Uri() ) != 0 ) { continue; } diff -r 50de4d668bb6 -r 82c0024438c8 inc/mdscommoninternal.h --- a/inc/mdscommoninternal.h Wed Mar 31 22:19:07 2010 +0300 +++ b/inc/mdscommoninternal.h Wed Apr 14 16:24:03 2010 +0300 @@ -47,6 +47,7 @@ const TInt KMaxUint64ValueLength = 20; _LIT( KMdSServerName,"MdSServer" ); // Server name +_LIT( KMdSServerProcessString,"MdSServer*" ); _LIT( KSchemaChunkName, "MdSSchema" ); _LIT( KCMediaIdKey, "CDriveMediaId" ); diff -r 50de4d668bb6 -r 82c0024438c8 locationmanager/client/src/rlocationmanager.cpp --- a/locationmanager/client/src/rlocationmanager.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/locationmanager/client/src/rlocationmanager.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -32,12 +32,10 @@ TInt LaunchServer() { LOG( "RLocationManager::LaunchServer begin" ); - TParse parser; - parser.Set( KLocServerFileName, &KDC_PROGRAMS_DIR, NULL ); // DLL launch RProcess server; - const TInt ret = server.Create( parser.FullName(), KNullDesC ); + TInt ret = server.Create( KLocServerFileName, KNullDesC ); if ( ret != KErrNone ) // Loading failed. { @@ -51,18 +49,20 @@ { LOG( "RLocationManager::LaunchServer Failed" ); server.Kill( 0 ); // Abort startup. - server.Close(); - return KErrGeneral; } else { server.Resume(); // Logon OK - start the server. } - User::WaitForRequest( status ); + User::WaitForRequest( status ); // wait for start or death + // we can't use the 'exit reason' if the server panicked as this + // is the panic 'reason' and may be '0' wehich cannot be distinguished + // from KErrNone + ret = ( server.ExitType() == EExitPanic ) ? KErrCommsBreak : status.Int(); server.Close(); LOG( "RLocationManager::LaunchServer end" ); - return status.Int(); + return ret; } // -------------------------------------------------------------------------- @@ -82,17 +82,17 @@ EXPORT_C TInt RLocationManager::Connect() { LOG( "RLocationManager::Connect(), begin" ); - TInt ret = CreateSession( KLocServerName, Version(), KSessionSlotCount); - if ( ret != KErrNone ) + + TInt error = LaunchServer(); + + if ( error == KErrNone || error == KErrAlreadyExists ) { - ret = LaunchServer(); - if ( ret == KErrNone ) - { - ret = CreateSession( KLocServerName, Version() ); - } + error = CreateSession( KLocServerName, Version(), KSessionSlotCount ); } + LOG( "RLocationManager::Connect(), end" ); - return ret; + + return error; } // -------------------------------------------------------------------------- diff -r 50de4d668bb6 -r 82c0024438c8 locationmanager/server/src/clocationmanagerserver.cpp --- a/locationmanager/server/src/clocationmanagerserver.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/locationmanager/server/src/clocationmanagerserver.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -155,6 +155,14 @@ iLocManStopRemapDelay = KLocationTrailRemapShutdownDelay; } + TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); + if ( error != KErrNone ) + { + LOG("CLocationManagerServer::ConstructL - iTimer not created"); + iTimer = NULL; + } + + LOG ("CLocationManagerServer::ConstructL() end"); } @@ -326,8 +334,7 @@ if ( iTimer ) { - delete iTimer; - iTimer = NULL; + iTimer->Cancel(); } iLocationRecord->StartL( aCaptureSetting ); @@ -348,19 +355,26 @@ if( state != RLocationTrail::ETrailStopped && state != RLocationTrail::ETrailStopping ) { - TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); - - if ( error != KErrNone ) + if(!iTimer) { - // If timer can't be created we stop the location trail immediately. + TRAPD( error, iTimer = CPeriodic::NewL( CActive::EPriorityUserInput ) ); + if ( error != KErrNone ) + { + LOG("CLocationManagerServer::StopGPSPositioningL() - iTimer not created"); + iTimer = NULL; + } + } + if(iTimer) + { + iTimer->Cancel(); + iLocationRecord->SetStateToStopping(); + iTimer->Start( iLocManStopDelay * 1000000, 0, TCallBack( CheckForRemappingCallback, this ) ); + } + else + { iLocationRecord->Stop(); - StopTrackLogL(); - return; - } - - iLocationRecord->SetStateToStopping(); - iTimer->Start( iLocManStopDelay * 1000000, 0, TCallBack( CheckForRemappingCallback, this ) ); - } + } + } // Always stop tracklog. StopTrackLogL(); @@ -375,8 +389,11 @@ LOG( "CLocationManagerServer::StopRecording()" ); iWaitForPositioningStopTimeout = EFalse; iLocationRecord->Stop(); - delete iTimer; - iTimer = NULL; + if(iTimer) + { + iTimer->Cancel(); + } + } // -------------------------------------------------------------------------- diff -r 50de4d668bb6 -r 82c0024438c8 mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg --- a/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg Wed Mar 31 22:19:07 2010 +0300 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterClientTest/conf/HarvesterClientTestScripter.cfg Wed Apr 14 16:24:03 2010 +0300 @@ -122,7 +122,7 @@ [Test] title HarvestFile 2 -timeout 300000 +timeout 500000 create HarvesterClientTestScripter test request Session test SetUp @@ -365,3 +365,48 @@ delete test [Endtest] +[Test] +title Harvester Client Long Session +timeout 500000 +create HarvesterClientTestScripter test +request Session +test SetUp +wait Session +test HarvesterClientConnect +test SetHarvesterObserver +test AddHarvesterEventObserver 1 +test AddObjectObserver +test SetUpHarvesting e:\testing\data\GIF87testimage.gif +request Continue +test HarvestFile e:\testing\data\GIF87testimage.gif +wait Continue +test EndHarvesterSession +test HarvesterClientPause +test HarvesterClientResume +request Query +test QueryImageObjectByIdIndex 0 +wait Query +test RemoveObject e:\testing\data\GIF87testimage.gif +test Results +test SetUpHarvesting e:\testing\data\bmp_burst.bmp +test SetUpHarvesting e:\testing\data\MBMtestimage.mbm +test HarvestFile e:\testing\data\bmp_burst.bmp +test HarvestFile e:\testing\data\MBMtestimage.mbm +test HarvestFileWithUID e:\testing\data\00001.mp3 +test EndHarvesterSession +test RemoveObject e:\testing\data\bmp_burst.bmp +test RemoveObject e:\testing\data\G4.TIF +test RemoveObject e:\testing\data\PNGtestimage.png +test RemoveObject e:\testing\data\GIF87testimage.gif +test RemoveObject e:\testing\data\ota_bmpiso.ota +test RemoveObject e:\testing\data\MBMtestimage.mbm +test RemoveObject e:\testing\data\Liverpool.jpg +test RemoveObject e:\testing\data\00001.mp3 +test RemoveHarvesterEventObserver 1 +test RemoveHarvesterObserver +test RemoveObjectObserver +test HarvesterClientClose +test TearDown +delete test +[Endtest] + diff -r 50de4d668bb6 -r 82c0024438c8 mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/conf/HarvesterPluginTest.cfg --- a/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/conf/HarvesterPluginTest.cfg Wed Mar 31 22:19:07 2010 +0300 +++ b/mds_plat/harvester_framework_api/tsrc/HarvesterPluginTest/conf/HarvesterPluginTest.cfg Wed Apr 14 16:24:03 2010 +0300 @@ -34,21 +34,13 @@ test BeginTestSession wait Session test LoadPlugins -request Harvest test TestFunctions e:\testing\data\Jpg.jpg -wait Harvest test TestFunctions e:\testing\data\Animated.gif -wait Harvest test TestFunctions e:\testing\data\Mbm.mbm -wait Harvest test TestFunctions e:\testing\data\H263.3gp -wait Harvest test TestFunctions e:\testing\data\MPEG4.3gp -wait Harvest test TestFunctions e:\testing\data\MPEG4.mp4 -wait Harvest test TestFunctions e:\testing\data\00001.mp3 -wait Harvest test EndTestSession delete test [Endtest] diff -r 50de4d668bb6 -r 82c0024438c8 mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg --- a/mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg Wed Mar 31 22:19:07 2010 +0300 +++ b/mds_plat/metadata_engine_api/tsrc/conf/MdETestScripter.cfg Wed Apr 14 16:24:03 2010 +0300 @@ -115,6 +115,10 @@ test RemoveObjectObserverL allownextresult KErrNotFound test RemoveObjectObserverL +test AddObjectObserverWithUriL +test RemoveObjectObserverWithUriL +allownextresult KErrNotFound +test RemoveObjectObserverWithUriL test AddObjectPresentObserverL test RemoveObjectPresentObserverL allownextresult KErrNotFound @@ -1880,6 +1884,77 @@ [Endtest] [Test] +title Edit Object 36: AddObjectL, AddObjectsL, RemoveObjectL, UriL, SetUriL +create MdETestScripter test +waittestclass test +test GetDefaultNamespaceDefL defaultNs + +// Create four objects. +test GetObjectDefL videoObjDef defaultNs Video +test NewObjectL obj0 videoObjDef KL +test GetPropertyDefL creaDatePropDef0 videoObjDef CreationDate +test AddTimePropertyL obj0 creaDatePropDef0 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef0 videoObjDef LastModifiedDate +test AddTimePropertyL obj0 lastModDatePropDef0 20081130:235959.999999 +test SetGuidL EObject obj0 000007 000001 +test NewObjectL obj1 videoObjDef KL +test GetPropertyDefL creaDatePropDef1 videoObjDef CreationDate +test AddTimePropertyL obj1 creaDatePropDef1 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef1 videoObjDef LastModifiedDate +test AddTimePropertyL obj1 lastModDatePropDef1 20081130:235959.999999 +test SetGuidL EObject obj1 000007 000002 +test NewObjectL obj2 videoObjDef KL +test GetPropertyDefL creaDatePropDef2 videoObjDef CreationDate +test AddTimePropertyL obj2 creaDatePropDef2 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef2 videoObjDef LastModifiedDate +test AddTimePropertyL obj2 lastModDatePropDef2 20081130:235959.999999 +test SetGuidL EObject obj2 000007 000003 +test NewObjectL obj3 videoObjDef KL +test GetPropertyDefL creaDatePropDef3 videoObjDef CreationDate +test AddTimePropertyL obj3 creaDatePropDef3 20081130:235959.999999 +test GetPropertyDefL lastModDatePropDef3 videoObjDef LastModifiedDate +test AddTimePropertyL obj3 lastModDatePropDef3 20081130:235959.999999 +test SetGuidL EObject obj3 000007 000004 + +// Test objects' SetUri & Uri +test SetUriL obj0 e:\testing\data\TestVideo1.3gp +test UriL obj0 e:\testing\data\testvideo1.3gp +test SetUriL obj1 e:\testing\data\TestVideo2.mp4 +test UriL obj1 e:\testing\data\testvideo2.mp4 + +// Add the objects to the database, observe the additions and verify the observed results. +test AddObjectObserverWithUriL +test AddObjectL obj0 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test AddObjectsL obj1 3 +waittestclass test +test VerifyObserverNotificationTypeL ENotifyAdd +test RemoveObjectObserverWithUriL +test VerifyTItemIdsL EObject 0 4 + +// Remove the objects, observe the removals and verify the observed results. +test AddObjectObserverWithUriL +test RemoveObjectL obj0 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj1 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj2 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectL obj3 KById +waittestclass test +test VerifyObserverNotificationTypeL ENotifyRemove +test RemoveObjectObserverWithUriL +test VerifyTItemIdsL EObject 0 4 + +// Final cleanup. +delete test +[Endtest] + +[Test] title Query 1: Object create MdETestScripter test waittestclass test diff -r 50de4d668bb6 -r 82c0024438c8 mds_plat/metadata_engine_api/tsrc/inc/MdETestScripter.h --- a/mds_plat/metadata_engine_api/tsrc/inc/MdETestScripter.h Wed Mar 31 22:19:07 2010 +0300 +++ b/mds_plat/metadata_engine_api/tsrc/inc/MdETestScripter.h Wed Apr 14 16:24:03 2010 +0300 @@ -115,6 +115,7 @@ NONSHARABLE_CLASS(CMdETestScripter) : public CScriptBase, public MMdESchemaObserver, public MMdEObjectObserver, + public MMdEObjectObserverWithUri, public MMdEObjectPresentObserver, public MMdERelationObserver, public MMdERelationItemObserver, @@ -193,6 +194,8 @@ virtual TInt RemoveSchemaObserverL( CStifItemParser& aItem ); virtual TInt AddObjectObserverL( CStifItemParser& aItem ); virtual TInt RemoveObjectObserverL( CStifItemParser& aItem ); + virtual TInt AddObjectObserverWithUriL( CStifItemParser& aItem ); + virtual TInt RemoveObjectObserverWithUriL( CStifItemParser& aItem ); virtual TInt AddObjectPresentObserverL( CStifItemParser& aItem ); virtual TInt RemoveObjectPresentObserverL( CStifItemParser& aItem ); virtual TInt AddRelationObserverL( CStifItemParser& aItem ); @@ -377,6 +380,10 @@ void HandleObjectNotification( CMdESession& aSession, TObserverNotificationType aType, const RArray& aObjectIdArray ); + void HandleUriObjectNotification(CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray, + const RPointerArray& aObjectUriArray); void HandleObjectPresentNotification(CMdESession& aSession, TBool aPresent, const RArray& aObjectIdArray); void HandleRelationNotification( CMdESession& aSession, diff -r 50de4d668bb6 -r 82c0024438c8 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterBlocks.cpp --- a/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterBlocks.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterBlocks.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -188,6 +188,8 @@ ENTRY( "RemoveSchemaObserverL", CMdETestScripter::RemoveSchemaObserverL ), ENTRY( "AddObjectObserverL", CMdETestScripter::AddObjectObserverL ), ENTRY( "RemoveObjectObserverL", CMdETestScripter::RemoveObjectObserverL ), + ENTRY( "AddObjectObserverWithUriL", CMdETestScripter::AddObjectObserverWithUriL ), + ENTRY( "RemoveObjectObserverWithUriL", CMdETestScripter::RemoveObjectObserverWithUriL ), ENTRY( "AddObjectPresentObserverL", CMdETestScripter::AddObjectPresentObserverL ), ENTRY( "RemoveObjectPresentObserverL", CMdETestScripter::RemoveObjectPresentObserverL ), ENTRY( "AddRelationObserverL", CMdETestScripter::AddRelationObserverL ), @@ -421,6 +423,27 @@ } // ----------------------------------------------------------------------------- +// CHarvesterPluginTestScripter::HandleUriObjectNotification +// ----------------------------------------------------------------------------- +// +void CMdETestScripter::HandleUriObjectNotification( CMdESession& aSession, + TObserverNotificationType aType, + const RArray& aObjectIdArray, + const RPointerArray& /* aObjectUriArray */ ) + { + iLog->Log(_L( "HandleUriObjectNotification" )); + + iNotificationSession = &aSession; + iNotificationType = aType; + for ( TInt i = 0; i < aObjectIdArray.Count(); ++i ) + { + iNotificationItemIdArray.Append( aObjectIdArray[ i ] ); + } + + Signal(); + } + +// ----------------------------------------------------------------------------- // CHarvesterPluginTestScripter::HandleObjectPresentNotification // ----------------------------------------------------------------------------- // diff -r 50de4d668bb6 -r 82c0024438c8 mds_plat/metadata_engine_api/tsrc/src/MdETestScripterSchemaCommands.cpp --- a/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterSchemaCommands.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/mds_plat/metadata_engine_api/tsrc/src/MdETestScripterSchemaCommands.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -68,6 +68,28 @@ } // ----------------------------------------------------------------------------- +// CMdETestScripter::AddObjectObserverWithUriL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::AddObjectObserverWithUriL( CStifItemParser& /* aItem */ ) + { + iMdeSession->AddObjectObserverWithUriL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- +// CMdETestScripter::RemoveObjectObserverWithUriL +// ----------------------------------------------------------------------------- +// +TInt CMdETestScripter::RemoveObjectObserverWithUriL( CStifItemParser& /* aItem */ ) + { + iMdeSession->RemoveObjectObserverWithUriL( *this ); + + return KErrNone; + } + +// ----------------------------------------------------------------------------- // CMdETestScripter::AddObjectPresentObserverL // ----------------------------------------------------------------------------- // diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/inc/mdeenginesession.h --- a/metadataengine/client/inc/mdeenginesession.h Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/inc/mdeenginesession.h Wed Apr 14 16:24:03 2010 +0300 @@ -33,10 +33,6 @@ // 27 = 1 asynchronous find + max.25 pending notifier hooks + 1 extra const TUint KMetadataMessageSlots = 27; -const TUid KServerUid3 = { 0x0765EEC3 }; // Server UID - -_LIT( KMdSServerFilename, "MdSServer" ); - // FORWARD DECLARATIONS class CMdESessionImpl; class CMdESchemaItem; @@ -68,14 +64,14 @@ * Connects to the server. * @return Error code. */ - void OpenL(TRequestStatus& aStatus); + void OpenL(); /** * Cancel server opening. * Cancels server opening. * @return Error code. */ - void OpenCancel(TRequestStatus& aStatus); + void OpenCancel(); /** * Connect session to server. @@ -87,9 +83,8 @@ /** * Shut down session * Performs session shutdown activities in server end - * @return Error code. */ - TInt Shutdown(); + void Shutdown(); /** * Version. diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/inc/mdesessionstartupao.h --- a/metadataengine/client/inc/mdesessionstartupao.h Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/inc/mdesessionstartupao.h Wed Apr 14 16:24:03 2010 +0300 @@ -108,6 +108,8 @@ /** the session */ RMdEEngineSession& iSession; + + RTimer iTimer; }; #endif //__MDESESSIONSTARTUPAO_H__ diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/src/mdeenginesession.cpp --- a/metadataengine/client/src/mdeenginesession.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/src/mdeenginesession.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -32,46 +32,57 @@ iIsSessionProcessOpen = EFalse; } -void RMdEEngineSession::OpenL(TRequestStatus& aStatus) +void RMdEEngineSession::OpenL() { TFindServer findMdEServer( KMdSServerName ); TFullName name; - - const TInt result = findMdEServer.Next( name ); + + TInt result = findMdEServer.Next( name ); + // Server already running if( result == KErrNone ) { - // Server already running - iIsSessionProcessOpen = ETrue; - - TRequestStatus* status = &aStatus; - User::RequestComplete( status, KErrNone ); - - return; + TFindProcess findProcess( KMdSServerProcessString ); + result = findProcess.Next( name ); + if ( result == KErrNone ) + { + result = iServerProcess.Open( name ); + if( result != KErrNone ) + { + User::Leave( KErrNotReady ); + } + iIsSessionProcessOpen = ETrue; + return; + } + else + { + User::Leave( KErrNotReady ); + } } - User::LeaveIfError( iServerProcess.Create( KMdSServerFilename, - KNullDesC ) ); - - iIsSessionProcessOpen = ETrue; - - iServerProcess.Rendezvous( aStatus ); - - if( aStatus != KRequestPending ) + User::LeaveIfError( iServerProcess.Create( KMdSServerName, + KNullDesC ) ); + + TRequestStatus stat( 0 ); + iServerProcess.Rendezvous( stat ); + + if( stat != KRequestPending ) { iServerProcess.Kill( 0 ); // abort startup } else { iServerProcess.Resume(); // logon OK - start the server - } + } + + User::WaitForRequest( stat ); + + iIsSessionProcessOpen = ETrue; } -void RMdEEngineSession::OpenCancel(TRequestStatus& aStatus) +void RMdEEngineSession::OpenCancel() { if( iIsSessionProcessOpen ) { - iServerProcess.RendezvousCancel( aStatus ); - iServerProcess.Close(); iIsSessionProcessOpen = EFalse; @@ -82,7 +93,7 @@ { if( iIsSessionProcessOpen ) { - TBool error = (iServerProcess.ExitType() != EExitPending); + const TBool error = (iServerProcess.ExitType() != EExitPending); iServerProcess.Close(); @@ -109,23 +120,17 @@ } } -TInt RMdEEngineSession::Shutdown() +void RMdEEngineSession::Shutdown() { - TInt err = KErrNone; - if( iIsSessionOpen ) { - err = SendReceive( EShutdown ); + SendReceive( EShutdown ); } if( iIsSessionProcessOpen ) { iServerProcess.Close(); - - iIsSessionProcessOpen = EFalse; } - - return err; } TVersion RMdEEngineSession::Version() const diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/src/mdenotifierao.cpp --- a/metadataengine/client/src/mdenotifierao.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/src/mdenotifierao.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -126,7 +126,6 @@ void CMdENotifierAO::DoCancel() { TRAP_IGNORE( iSession.DoUnregisterL( Id() ) ); - // the current pending call will return with KErrCancel } void CMdENotifierAO::RunL() diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/src/mdequery.cpp --- a/metadataengine/client/src/mdequery.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/src/mdequery.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -409,10 +409,8 @@ { iResults[firstNewItemIndex + i].iOwned = ETrue; } - - const TInt observerCount = iObservers.Count(); - for (i = 0; i < observerCount; i++) + for( TInt i = iObservers.Count() - 1; i >=0; i-- ) { MMdEQueryObserver* observer = iObservers[i]; observer->HandleQueryNewResults( *this, firstNewItemIndex, newCount ); @@ -426,7 +424,6 @@ TMdEPanic::Panic(TMdEPanic::EInternal)); TInt firstNewItemIndex = iIdResults.Count(); - TInt i = 0; const TInt oldCount = iIdResults.Count(); @@ -441,10 +438,8 @@ // Leave with the same error. User::Leave(err); } - - const TInt observerCount = iObservers.Count(); - for (i = 0; i < observerCount; i++) + for( TInt i = iObservers.Count() - 1; i >=0; i-- ) { MMdEQueryObserver* observer = iObservers[i]; observer->HandleQueryNewResults(*this, firstNewItemIndex, @@ -455,7 +450,6 @@ void CMdEQuery::NotifyNewResultsL( const CDesCArray& aNewResults ) { TInt firstNewItemIndex = aNewResults.Count(); - TInt i = 0; TInt oldCount = 0; if( iDistinctResults ) @@ -479,9 +473,7 @@ User::Leave(err); } - const TInt observerCount = iObservers.Count(); - - for (i = 0; i < observerCount; i++) + for( TInt i = iObservers.Count() - 1; i >=0; i-- ) { MMdEQueryObserver* observer = iObservers[i]; observer->HandleQueryNewResults( *this, firstNewItemIndex, diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/src/mdesessionimpl.cpp --- a/metadataengine/client/src/mdesessionimpl.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/src/mdesessionimpl.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -2276,8 +2276,8 @@ CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession ); notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.AppendL( notifier ); CleanupStack::PopAndDestroy( aCondition ); } @@ -2303,8 +2303,8 @@ notifier->RegisterL( EObjectNotifyPresent | EObjectNotifyNotPresent, &aObserver, NULL, namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.AppendL( notifier ); } void CMdESessionImpl::AddRelationObserverL( MMdERelationObserver& aObserver, @@ -2359,8 +2359,8 @@ CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession ); notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.AppendL( notifier ); CleanupStack::PopAndDestroy( aCondition ); } @@ -2416,8 +2416,8 @@ CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession ); notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.AppendL( notifier ); CleanupStack::PopAndDestroy( aCondition ); } @@ -2445,8 +2445,8 @@ notifier->RegisterL( ERelationNotifyPresent | ERelationNotifyNotPresent, &aObserver, NULL, namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.AppendL( notifier ); } void CMdESessionImpl::AddEventObserverL( MMdEEventObserver& aObserver, @@ -2502,8 +2502,8 @@ CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession ); notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.AppendL( notifier ); CleanupStack::PopAndDestroy( aCondition ); } @@ -2996,8 +2996,8 @@ CMdENotifierAO* notifier = CMdENotifierAO::NewLC( *this, iSession ); notifier->RegisterL( type, &aObserver, aCondition, *namespaceDef ); + iNotifiers.AppendL( notifier ); CleanupStack::Pop( notifier ); - iNotifiers.Append( notifier ); CleanupStack::PopAndDestroy( aCondition ); } diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/client/src/mdesessionstartupao.cpp --- a/metadataengine/client/src/mdesessionstartupao.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/client/src/mdesessionstartupao.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -20,6 +20,9 @@ #include "mdeenginesession.h" #include "mdesessionimpl.h" +const TInt KRetryDelay = 2; // 2 seconds +const TInt KMillion = 1000000; + // ========================= MEMBER FUNCTIONS ================================== CMdESessionStartupAO* CMdESessionStartupAO::NewL( @@ -54,6 +57,7 @@ void CMdESessionStartupAO::ConstructL() { + iTimer.CreateLocal(); SetActive(); TRequestStatus* status = &iStatus; User::RequestComplete( status, KErrNone ); @@ -62,26 +66,28 @@ CMdESessionStartupAO::~CMdESessionStartupAO() { Cancel(); // Causes call to DoCancel() + iTimer.Close(); } void CMdESessionStartupAO::DoCancel() { - iSession.OpenCancel( iStatus ); + iTimer.Cancel(); + iSession.OpenCancel(); } void CMdESessionStartupAO::RunL() { - const TInt status = iStatus.Int(); - switch ( iState ) { case EStartupOpenServer: { - iSession.OpenL( iStatus ); + iSession.OpenL(); iState = EStartupConnect; SetActive(); + TRequestStatus* status = &iStatus; + User::RequestComplete( status, KErrNone ); break; } @@ -125,7 +131,41 @@ TInt CMdESessionStartupAO::RunError(TInt aError) { - iSessionImpl.NotifyError( aError ); + // If server was not fully initialized when session was tried to be + // created, try to establish session again + if( iState == EStartupOpenServer && + (aError == KErrNotReady || + aError == KErrAlreadyExists ) ) + { + TTimeIntervalMicroSeconds32 delay( KRetryDelay * KMillion ); + iState = EStartupOpenServer; + iTimer.After( iStatus, delay ); + SetActive(); + } + else if( iState == EStartupConnect && + ( aError == KErrCommsBreak || + aError == KErrServerTerminated || + aError == KErrNotReady ) ) + { + TTimeIntervalMicroSeconds32 delay( KRetryDelay * KMillion ); + iState = EStartupOpenServer; + iTimer.After( iStatus, delay ); + SetActive(); + } + // If schema was not loaded already when it was + // attempted to be loaded, try to load schema again + else if( iState == EStartupLoadSchema && + aError == KErrNotReady ) + { + TTimeIntervalMicroSeconds32 delay( KRetryDelay * KMillion ); + iState = EStartupLoadSchema; + iTimer.After( iStatus, delay ); + SetActive(); + } + else + { + iSessionImpl.NotifyError( aError ); + } return KErrNone; } diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/inc/mdsserver.h --- a/metadataengine/server/inc/mdsserver.h Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/inc/mdsserver.h Wed Apr 14 16:24:03 2010 +0300 @@ -101,19 +101,6 @@ static TInt ThreadFunction( TAny* aStarted ); /** - * IncrementSessions. - * Increments the count of the active sessions for this server. - */ - void IncrementSessions(); - - /** - * DecrementSessions. - * Decrements the count of the active sessions for this server. - * If no more sessions are in use the server terminates. - */ - void DecrementSessions(); - - /** * Reference to the schema */ CMdsSchema& Schema(); diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/src/mdsmaintenanceengine.cpp --- a/metadataengine/server/src/mdsmaintenanceengine.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/src/mdsmaintenanceengine.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -119,6 +119,12 @@ __LOG1( ELogAlways, "Trying to validate MDS DB, error expected if not created(first boot): %d", 0 ); if ( !(iMaintenance->ValidateL( ) ) ) { + // Pump up priority to load the MDS DB up as fast as possible to + // enable client side session connections + RProcess process; + process.SetPriority( EPriorityForeground ); + + __LOG1( ELogAlways, "MDS DB not valid, creating tables: %d", 0 ); // first-time init: re-form the database completely iMaintenance->CreateDatabaseL( ); const TUint KMdSServerUid = 0x0320e65f; // temporal uid @@ -156,6 +162,12 @@ TRAP_IGNORE( ImportMetadataL( aManipulate, aSchema, KMdsDefaultRomImportFile ) ); } + __LOG1( ELogAlways, "MDS DB tables created %d", 0 ); + + // Revert back to default MDS server priority when server is up and running + process.SetPriority( EPriorityBackground ); + process.Close(); + StoreDriveMediaIdsL(); } else @@ -168,6 +180,7 @@ User::Leave( err ); } } + __LOG1( ELogAlways, "CMdSMaintenanceEngine::InstallL complete: %d", 0 ); } // ------------------------------------------------ @@ -247,17 +260,22 @@ if( massStorageError == KErrNone ) { TVolumeInfo massStorageVolumeInfo; - User::LeaveIfError( fs.Volume( massStorageVolumeInfo, drive ) ); - const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID ); - massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); + massStorageError = fs.Volume( massStorageVolumeInfo, drive ); if( massStorageError == KErrNone ) { - User::LeaveIfError( fs.Volume( massStorageVolumeInfo, drive ) ); - // Update mass storage media id if the mass storage is not memory card - if( massStorageVolumeInfo.iUniqueID != massStorageMediaId && massStorageMediaId != 0 ) + const TUint32 massStorageMediaId( massStorageVolumeInfo.iUniqueID ); + massStorageError = DriveInfo::GetDefaultDrive( DriveInfo::EDefaultRemovableMassStorage, drive ); + if( massStorageError == KErrNone ) { - MMdsPreferences::InsertL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet, - (TUint32) massStorageMediaId ); + massStorageError = fs.Volume( massStorageVolumeInfo, drive ); + // Update mass storage media id if the mass storage is not memory card + if( massStorageError == KErrNone && + massStorageVolumeInfo.iUniqueID != massStorageMediaId && + massStorageMediaId != 0 ) + { + MMdsPreferences::InsertL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet, + (TUint32) massStorageMediaId ); + } } } } diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/src/mdsmanipulationengine.cpp --- a/metadataengine/server/src/mdsmanipulationengine.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/src/mdsmanipulationengine.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -812,7 +812,7 @@ TFilePresentStates placeHolder; TBool notPresentState( EFalse ); - const TItemId objectId = iManipulate->SearchNotPresentFileL( /*reservation(), */ + const TItemId objectId = iManipulate->SearchNotPresentFileL( aMediaId, uri, fileInfo, placeHolder, notPresentState ); if ( placeHolder != EMdsNotFound ) { diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/src/mdsnotifier.cpp --- a/metadataengine/server/src/mdsnotifier.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/src/mdsnotifier.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -466,7 +466,7 @@ TDefId aNamespaceDefId, CMdSServerSession& aSession, TBool aConfidential ) { TEntry entry = TEntry( aId, aType, aSerializedBuffer, aNamespaceDefId, aSession, aConfidential ); - User::LeaveIfError( iEntries.InsertInOrder( entry, TLinearOrder(CMdSNotifier::Compare) ) ); + User::LeaveIfError( iEntries.InsertInOrderAllowRepeats( entry, TLinearOrder(CMdSNotifier::Compare) ) ); return FindEntryL( aId ); } @@ -548,7 +548,6 @@ { e->TriggerError( KErrCancel ); } - if ( e->iSerializedCondition ) { delete e->iSerializedCondition; diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/src/mdsserver.cpp --- a/metadataengine/server/src/mdsserver.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/src/mdsserver.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -354,10 +354,6 @@ __INIT_LOGGER; StartL( KMdSServerName ); __LOGLB( ELogAlways, "Server start" ); - - RProcess process; - process.SetPriority( EPriorityBackground ); - process.Close(); CheckInitSriptL(); @@ -388,7 +384,7 @@ // create shutdown observer iShutdownObserver = CMDSShutdownObserver::NewL( *this ); - iShutdown = EFalse; + iShutdown = EFalse; } void CMdSServer::InitializeL() @@ -495,26 +491,6 @@ return CMdSServerSession::NewL( *const_cast ( this ) ); } - -void CMdSServer::IncrementSessions() - { - iSessionCount++; - } - - -void CMdSServer::DecrementSessions() - { - iSessionCount--; - if ( iSessionCount <= 0 ) - { - if (!iShutdown) - { - CActiveScheduler::Stop(); - iShutdown = ETrue; - } - } - } - CMdsSchema& CMdSServer::Schema() { return *iSchema; diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/src/mdsserversession.cpp --- a/metadataengine/server/src/mdsserversession.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/src/mdsserversession.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -69,7 +69,6 @@ // void CMdSServerSession::ConstructL() { - iServer.IncrementSessions(); } // --------------------------------------------------------------------------- @@ -92,7 +91,6 @@ iServer.LockList().UnlockBySession( *this ); iServer.Notifier().RemoveEntriesBySession( *this ); - iServer.DecrementSessions(); // purge any pending notifications iNotificationCache.ResetAndDestroy(); @@ -105,12 +103,25 @@ // void CMdSServerSession::ServiceL( const RMessage2& aMessage ) { - __LOG2( ELogServer, "ServiceL message: %d uid: %.8x", + __LOG2( ELogServer, "ServiceL message: %d uid: %d", aMessage.Function(), - aMessage.Identity()); - + aMessage.Identity().iUid); + if( iServer.BackupOrRestoreRunning() ) { + // Open client applications are closed during backup/restore, + // thus registered observers that would be removed during + // shutdown on clients, must be allowed to be removed even + // if backup/restore is running + if( aMessage.Function() == EUnregister ) + { + TRAPD( err, ServiceFunctionL( aMessage ) ); + if( err != KErrNone ) + { + aMessage.Complete( err ); + } + return; + } aMessage.Complete( KErrServerBusy ); return; } diff -r 50de4d668bb6 -r 82c0024438c8 metadataengine/server/src/mdssqlobjectmanipulate.cpp --- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp Wed Mar 31 22:19:07 2010 +0300 +++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp Wed Apr 14 16:24:03 2010 +0300 @@ -1067,9 +1067,8 @@ CleanupClosePushL( objectIds ); MMdsPreferences::UpdateL( KMassStorageMediaIdKey, MMdsPreferences::EPreferenceValueSet, (TUint32) aMediaId ); SetFilesToNotPresentL( oldMediaId, EFalse, objectIds ); - objectIds.Reset(); - RemoveFilesNotPresentL( oldMediaId, &objectIds ); CleanupStack::PopAndDestroy( &objectIds ); + RemoveFilesNotPresentL( oldMediaId, NULL ); } } diff -r 50de4d668bb6 -r 82c0024438c8 sis/mds/mds_stub.sis Binary file sis/mds/mds_stub.sis has changed diff -r 50de4d668bb6 -r 82c0024438c8 sis/mds/package.pkg --- a/sis/mds/package.pkg Wed Mar 31 22:19:07 2010 +0300 +++ b/sis/mds/package.pkg Wed Apr 14 16:24:03 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 10, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 11, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r 50de4d668bb6 -r 82c0024438c8 sis/mds/package_separate.pkg --- a/sis/mds/package_separate.pkg Wed Mar 31 22:19:07 2010 +0300 +++ b/sis/mds/package_separate.pkg Wed Apr 14 16:24:03 2010 +0300 @@ -17,7 +17,7 @@ &EN ;packet-header (name, uid, major, minor, build, type) -#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 10, TYPE=SA, RU +#{"Metadata System Upgrade"},(0x200009F5), 9, 20, 11, TYPE=SA, RU ; Localised vendor name %{"Nokia"} diff -r 50de4d668bb6 -r 82c0024438c8 sis/mds/stub.pkg --- a/sis/mds/stub.pkg Wed Mar 31 22:19:07 2010 +0300 +++ b/sis/mds/stub.pkg Wed Apr 14 16:24:03 2010 +0300 @@ -17,7 +17,7 @@ &EN ; Header -#{"Metadata System"}, (0x200009F5), 9, 20, 10, TYPE=SA +#{"Metadata System"}, (0x200009F5), 9, 20, 11, TYPE=SA ; Localised Vendor name %{"Nokia"}