featuremgmt/featuremgr/src/serverexe/featmgrsession.cpp
changeset 14 15018f1726c7
parent 0 08ec8eefde2f
child 15 3eacc0623088
equal deleted inserted replaced
1:c084286672be 14:15018f1726c7
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
   100     INFO_LOG1( "CFeatMgrSession::PanicClient(aPanic 0x%x)", aPanic);
   100     INFO_LOG1( "CFeatMgrSession::PanicClient(aPanic 0x%x)", aPanic);
   101 
   101 
   102 	aMessage.Panic( KPanicCategory, aPanic );
   102 	aMessage.Panic( KPanicCategory, aPanic );
   103     }
   103     }
   104 
   104 
       
   105 TBool CFeatMgrSession::IsWriteOperation( const TInt aFunction ) const
       
   106     {
       
   107         switch ( aFunction )
       
   108             {
       
   109             case EFeatMgrEnableFeature:
       
   110             case EFeatMgrDisableFeature:
       
   111             case EFeatMgrAddFeature:
       
   112             case EFeatMgrSetFeatureAndData:
       
   113             case EFeatMgrSetFeatureData:
       
   114             case EFeatMgrDeleteFeature:
       
   115             case EFeatMgrSWIStart:
       
   116             case EFeatMgrSWIEnd:
       
   117                 return ETrue;
       
   118             default:
       
   119                 return EFalse;
       
   120             }
       
   121     }
       
   122 
   105 // -----------------------------------------------------------------------------
   123 // -----------------------------------------------------------------------------
   106 // CFeatMgrSession::ServiceL
   124 // CFeatMgrSession::ServiceL
   107 // Calls request handling functions. Also traps any leaves and signals client if
   125 // Calls request handling functions. Also traps any leaves and signals client if
   108 // error occurs.
   126 // error occurs.
   109 // -----------------------------------------------------------------------------
   127 // -----------------------------------------------------------------------------
   110 //
   128 //
   111 void CFeatMgrSession::ServiceL( const RMessage2& aMessage )
   129 void CFeatMgrSession::ServiceL( const RMessage2& aMessage )
   112     {
   130     {
   113     FUNC_LOG
   131     FUNC_LOG
   114     
   132     // If plugins are not ready all request will be queued. 
   115     if ( !iFeatMgrServer.PluginsReady() )
   133     // During backup & restore operation, all write request 
       
   134     //  e.g. EnableFeature will return with KErrServerBusy
       
   135     TInt msgCmd = aMessage.Function();
       
   136     if ( !iFeatMgrServer.PluginsReady() || ( iFeatMgrServer.BURIsInProgress()  && IsWriteOperation( msgCmd ) ) )
   116         {
   137         {
   117         INFO_LOG( "CFeatMgrSession::ServiceL() - plugins not ready" );
   138         if ( iFeatMgrServer.BURIsInProgress() )
   118         iList.AddLast( *CFeatMgrPendingRequest::NewL( aMessage ) );        
   139             {
       
   140             INFO_LOG( "CFeatMgrSession::ServiceL() - backup/restore is in progress - no write operation allowed" );
       
   141             aMessage.Complete( KErrServerBusy );
       
   142             }
       
   143         else
       
   144             {
       
   145             INFO_LOG( "CFeatMgrSession::ServiceL() - plugins not ready" );
       
   146             iList.AddLast( *CFeatMgrPendingRequest::NewL( aMessage ) );
       
   147             }
   119         }
   148         }
   120     else
   149     else
   121         {
   150         {
   122         #if defined(FEATMGR_INFO_LOG_ENABLED)
   151         #if defined(FEATMGR_INFO_LOG_ENABLED)
   123             // check memory usage
   152             // check memory usage
   503     	    TPckgC<TInt> resPckg( getIdErr );
   532     	    TPckgC<TInt> resPckg( getIdErr );
   504             aMessage.WriteL( 0, resPckg );
   533             aMessage.WriteL( 0, resPckg );
   505             
   534             
   506     		break;
   535     		break;
   507     	    }
   536     	    }
   508     	    
   537 
   509 #ifdef EXTENDED_FEATURE_MANAGER_TEST
   538 #ifdef EXTENDED_FEATURE_MANAGER_TEST
       
   539     	    
       
   540         case EFeatMgrResourceMark:
       
   541             ResourceCountMarkStart();
       
   542             break;
       
   543             
       
   544         case EFeatMgrResourceCheck:
       
   545             ResourceCountMarkEnd(aMessage);
       
   546             break;
       
   547         
       
   548         case EFeatMgrResourceCount:
       
   549             {
       
   550             TInt retCode = CountResources();
       
   551             User::Leave(retCode);
       
   552             }
       
   553             break;
       
   554         
       
   555         case EFeatMgrSetHeapFailure:
       
   556             {
       
   557             RAllocator::TAllocFail mode = static_cast <RAllocator::TAllocFail> (aMessage.Int0());
       
   558             TInt failAllocNum = aMessage.Int1();
       
   559             if(mode == RHeap::EBurstFailNext || mode == RHeap::EBurstRandom || mode == RHeap::EBurstTrueRandom || mode == RHeap::EBurstDeterministic)
       
   560                 {
       
   561                 User::__DbgSetBurstAllocFail(RHeap::EUser, mode, failAllocNum, 20);
       
   562                 }
       
   563             else
       
   564                 {
       
   565                 User::__DbgSetAllocFail(RHeap::EUser, mode, failAllocNum);
       
   566                 }
       
   567             }
       
   568             break;
       
   569 
   510     	    // debug only API 
   570     	    // debug only API 
   511     	    // returns the size of the iNotifyFeatures array
   571     	    // returns the size of the iNotifyFeatures array
   512         case EFeatMgrNumberOfNotifyFeatures:
   572         case EFeatMgrNumberOfNotifyFeatures:
   513     	    {
   573     	    {
   514     	    TInt count = iNotifyFeatures.Count();
   574     	    TInt count = iNotifyFeatures.Count();
   568                 }
   628                 }
   569             }
   629             }
   570         }
   630         }
   571     }
   631     }
   572 
   632 
       
   633 TInt CFeatMgrSession::CountResources()
       
   634     {
       
   635     return User::CountAllocCells();
       
   636     }
   573 
   637 
   574 // ============================= LOCAL FUNCTIONS ===============================
   638 // ============================= LOCAL FUNCTIONS ===============================
   575 
   639 
   576 // ============================ MEMBER FUNCTIONS ===============================
   640 // ============================ MEMBER FUNCTIONS ===============================
   577 
   641