remerge Symbian Splash Screen and shutdown screen support (bug 2414 Bug 2524) also fix for Bug 2850 RCL_3 PDK_3.0.1
authorandy simpson <andrews@symbian.org>
Mon, 12 Jul 2010 15:58:51 +0100
branchRCL_3
changeset 50 49762640db60
parent 47 312d2b433792 (diff)
parent 44 2904da99c26d (current diff)
child 59 72869d76c629
remerge Symbian Splash Screen and shutdown screen support (bug 2414 Bug 2524) also fix for Bug 2850
--- a/appfw/apparchitecture/apgrfx/apgrecog.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/appfw/apparchitecture/apgrfx/apgrecog.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-2010 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"
@@ -403,11 +403,15 @@
 
 /** Gets the data (MIME) type of data passed by buffer.
 
-@param aBuffer A buffer containing data 
+@param aBuffer A buffer containing data; Provide preferred size of buffer. 
+If MIME type could not be recognized using this buffer, provide a buffer of 
+larger size.
 @param aDataType On return, contains the result of the attempt to recognize 
 data. 
 @return KErrNone, if successful; otherwise one of the other system-wide error 
 codes. 
+
+@see RApaLsSession::GetPreferredBufSize()
 */
 EXPORT_C TInt RApaLsSession::RecognizeData(const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const
     {
@@ -417,12 +421,15 @@
 /** Gets the data (MIME) type for data taken from a file with a specified name.
 
 @param aName The full filename, including drive and path, of the file containing the data.
-@param aBuffer A buffer containing data taken from the specified file; typically 
-the data is read from the beginning of the file.
+@param aBuffer A buffer containing data taken from the specified file; Provide preferred size of buffer 
+from beginning of the file. If MIME type could not be recognized using this buffer, provide a buffer of 
+larger size.
 @param aDataType On return, contains the result of the attempt to recognize 
 data. 
 @return KErrNone, if successful; otherwise one of the other system-wide error 
 codes. 
+
+@see RApaLsSession::GetPreferredBufSize()
 */
 EXPORT_C TInt RApaLsSession::RecognizeData(const TDesC& aName, const TDesC8& aBuffer, TDataRecognitionResult& aDataType) const
 	{
@@ -453,15 +460,18 @@
 
 
 /** Tests whether data taken from a named file has the specified 
-data (MIME) type.
+ * data (MIME) type.
 
 @param aName The name of the file containing the data.
-@param aBuffer A buffer containing data taken from the specified file; typically 
-the data is read from the beginning of the file.
+@param aBuffer A buffer containing data taken from the specified file; Provide preferred size of buffer 
+from beginning of the file. If MIME type could not be recognized using this buffer, provide a buffer of 
+larger size.
 @param aDataType The data (MIME) type.
 @param aResult On return, contains the result of the test.
 @return KErrNone, if successful; otherwise one of the other system-wide error 
 codes. 
+
+@see RApaLsSession::GetPreferredBufSize()
 */
 EXPORT_C TInt RApaLsSession::RecognizeSpecificData(const TDesC& aName, const TDesC8& aBuffer, const TDataType& aDataType, TBool& aResult) const
 	{
--- a/appfw/apparchitecture/apserv/APSSES.CPP	Mon Jun 28 17:46:35 2010 +0100
+++ b/appfw/apparchitecture/apserv/APSSES.CPP	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-2010 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"
@@ -1206,28 +1206,57 @@
 	aInfo.iShortCaption = app->ShortCaption();
 	}
 	
-void CApaAppArcServSession::DoRecognizeUnpackLC(HBufC*& aName, HBufC8*& aBuffer, const RMessage2& aMessage)
+TPtrC8 CApaAppArcServSession::DoRecognizeUnpackLC(HBufC*& aName, RChunk& aLocalChunk, const RMessage2& aMessage)
 	{
-	ASSERT(aName==NULL);
-	ASSERT(aBuffer==NULL);
-	aName=HBufC::NewLC(User::LeaveIfError(aMessage.GetDesLength(1)));
-	TPtr name(aName->Des());
-	aMessage.ReadL(1, name);
-	aBuffer=HBufC8::NewLC(User::LeaveIfError(aMessage.GetDesLength(2)));
-	TPtr8 buffer(aBuffer->Des());
-	aMessage.ReadL(2, buffer);
+    ASSERT(aName==NULL);
+    
+    aName=HBufC::NewLC(User::LeaveIfError(aMessage.GetDesLength(1)));
+    TPtr name(aName->Des());
+    aMessage.ReadL(1, name);
+    
+    HBufC8* buffer=NULL;
+    TInt error=KErrNone;
+    TInt bufferSize= aMessage.GetDesLength(2);
+    User::LeaveIfError(bufferSize);
+    //Allocate memory in apparc's process heap.
+    TRAP(error, buffer=HBufC8::NewL(bufferSize));
+
+    if(error==KErrNone)
+        {
+        CleanupStack::PushL(buffer);
+        TPtr8 bufPtr(buffer->Des());
+        aMessage.ReadL(2, bufPtr);   
+        return bufPtr;
+        }
+    else if(error==KErrNoMemory)
+        {
+        //If memory is not available in apparc's process heap, then allocate in kernel heap
+        User::LeaveIfError(aLocalChunk.CreateLocal(bufferSize,bufferSize));
+        CleanupClosePushL(aLocalChunk);
+        TPtr8 bufPtr(aLocalChunk.Base(), bufferSize);
+        aMessage.ReadL(2, bufPtr); 
+        return bufPtr;        
+        }
+    else
+        {
+        User::Leave(error);
+        }
+    
+    TPtrC8 bufPtr(NULL,0); //Never executed. To make compiler happy
+    return bufPtr;
 	}
 
 void CApaAppArcServSession::RecognizeDataL(const RMessage2& aMessage)
 // Recognize the data type of an object
 	{
 	HBufC* name=NULL;
-	HBufC8* buffer=NULL;
-	DoRecognizeUnpackLC(name,buffer,aMessage);
+    RChunk localChunk;
+    
+	TPtrC8 bufPtr=DoRecognizeUnpackLC(name, localChunk, aMessage);
 
-	const TDataRecognitionResult result = iServ.RecognizeDataL(*name, *buffer);
+	const TDataRecognitionResult result = iServ.RecognizeDataL(*name, bufPtr);
 
-	CleanupStack::PopAndDestroy(2); // name & buffer
+	CleanupStack::PopAndDestroy(2); // name & buffer or localChunk
 	aMessage.WriteL(0,TPckgC<TDataRecognitionResult>(result));
 	}
 
@@ -1506,13 +1535,14 @@
 // Determine whether an object is of a specific data type
 	{
 	HBufC* name=NULL;
-	HBufC8* buffer=NULL;
-	DoRecognizeUnpackLC(name,buffer,aMessage);
+	RChunk localChunk;
+	
+	TPtrC8 bufPtr=DoRecognizeUnpackLC(name, localChunk, aMessage);
 	TDataType dataType;
 	{TPckg<TDataType> dataType_asDescriptor(dataType);
 	aMessage.ReadL(0, dataType_asDescriptor);}
-	aMessage.Complete(iServ.RecognizeDataL(*name,*buffer,dataType));
-	CleanupStack::PopAndDestroy(2); // name & buffer
+	aMessage.Complete(iServ.RecognizeDataL(*name,bufPtr,dataType));
+	CleanupStack::PopAndDestroy(2); // name & buffer or localChunk
 	}
 
 void CApaAppArcServSession::RecognizeSpecificDataPassedByFileHandleL(const RMessage2& aMessage)
--- a/appfw/apparchitecture/apserv/APSSES.H	Mon Jun 28 17:46:35 2010 +0100
+++ b/appfw/apparchitecture/apserv/APSSES.H	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-2010 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"
@@ -157,7 +157,7 @@
 	void RecognizeDataPassedByFileHandleL(const RMessage2& aMessage);
 	void RecognizeSpecificDataL(const RMessage2& aMessage);
 	void RecognizeSpecificDataPassedByFileHandleL(const RMessage2& aMessage);
-	static void DoRecognizeUnpackLC(HBufC*& aName, HBufC8*& aBuffer, const RMessage2& aMessage);
+	static TPtrC8 DoRecognizeUnpackLC(HBufC*& aName, RChunk& aLocalChunk, const RMessage2& aMessage);
 
 	void AppForDataTypeL(const RMessage2& aMessage);
 	TUid AppForDataTypeL(const TDataType& aDataType, const TUid* aServiceUid);
--- a/appfw/viewserver/server/VWSERVER.CPP	Mon Jun 28 17:46:35 2010 +0100
+++ b/appfw/viewserver/server/VWSERVER.CPP	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 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"
@@ -206,7 +206,8 @@
 		iEnableBoostAppPriorityBeforePanic = valueOfKVwsBoostAppPriorityBeforePanic;
 		}
 #endif
-	
+	LOG3(CVwsLog::EQuiet,_L("CVwsServer::IsPriorityBoostBeforePanicEnabled(): iEnableBoostAppPriorityBeforePanic = [%d] "),iEnableBoostAppPriorityBeforePanic);
+		
 	if (iEnableBoostAppPriorityBeforePanic)
 		{
 		CVwsStartupAware* startupAware = new(ELeave)CVwsStartupAware(*this);
@@ -837,7 +838,7 @@
 		{
 		return;
 		}
-		
+	
 	if (starved.ProcessPriority() < EPriorityForeground)
 		{
 		RProcess owningProcess;
--- a/appfw/viewserver/server/VWSEVENT.CPP	Mon Jun 28 17:46:35 2010 +0100
+++ b/appfw/viewserver/server/VWSEVENT.CPP	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 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"
@@ -127,6 +127,7 @@
 		firstDelay=iServerEventTimeOut;
 		}
 
+	LOG3(CVwsLog::EQuiet,_L("CVwsEventTimer::Start : firstDelay [%d] "),firstDelay.Int());
 	TTimeIntervalMicroSeconds32 delay(firstDelay);
 	iPeriodic->Start(delay,delay,TCallBack(TimerCallBack,this));	
 	iScreenDeviceChangeEvent = aScreenDeviceChangeEvent;
@@ -167,7 +168,7 @@
 			else
 				{
 				//Delay of KTimeoutValueForPreemptedProcess is given after boosting priority of an application
-				TUint8 patchableConst = KTimeoutValueForPreemptedProcess;
+				TInt patchableConst = KTimeoutValueForPreemptedProcess;
 				#ifdef __WINS__
 				// For the emulator allow the constant to be patched via epoc.ini
 				UserSvr::HalFunction(EHalGroupEmulator, EEmulatorHalIntProperty,
@@ -175,8 +176,9 @@
 				#endif
 				delay = patchableConst;
 				iTimeOutState = EServerEventTimeOut;
+                LOG2(CVwsLog::ELoud,_L("CVwsEventTimer::DoTimerCallBack : iTimeOutState == EIntermediateEventTimeOut"));
 				}
-			
+            LOG3(CVwsLog::EQuiet,_L("CVwsEventTimer::DoTimerCallBack : delay = [%d] "),delay.Int());
             iPeriodic->Start(delay,delay,TCallBack(TimerCallBack,this));
 			}
 		}
--- a/appfw/viewserver/server/vwspatchdata.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/appfw/viewserver/server/vwspatchdata.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 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"
@@ -15,6 +15,6 @@
 
 #include <e32std.h>
 
-EXPORT_C extern const TInt KVwsBoostAppPriorityBeforePanic = 0;
+EXPORT_C extern const TInt KVwsBoostAppPriorityBeforePanic = 1;
 
 EXPORT_C extern const TInt KTimeoutValueForPreemptedProcess = 4*1000*1000; //4 seconds
--- a/commonappservices/alarmserver/Client/Source/ASCliSession.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/commonappservices/alarmserver/Client/Source/ASCliSession.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -65,7 +65,7 @@
 	TInt startupAttempts = KNumberOfServerStartupAttempts;
 	for(;;)
 		{
-		TInt ret = CreateSession(ASCliDefinitions::ServerAndThreadName(), ASCliDefinitions::Version(), KAlarmServerAsynchronousSlotCount);
+		TInt ret = CreateSession(ASCliDefinitions::ServerAndThreadName(), ASCliDefinitions::Version());
 
 		if	(ret != KErrNotFound && ret != KErrServerTerminated)
 			{
Binary file contextframework/cfw/conf/contextframework.confml has changed
Binary file contextframework/cfw/conf/contextframework_10282BCD.crml has changed
--- a/contextframework/cfw/src/cfserver/cfphasebase.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/contextframework/cfw/src/cfserver/cfphasebase.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -95,8 +95,10 @@
     FUNC_LOG;
 
     __ASSERT_DEBUG( iStarterRequest, Panic( ENoRequestToComplete ) );
-    
-    User::RequestComplete( iStarterRequest, KErrCancel );
+    if ( iStarterRequest )
+		{
+		User::RequestComplete( iStarterRequest, KErrCancel );
+		}
     }
 
 //-----------------------------------------------------------------------------
--- a/coreapplicationuis/SysAp/Group/SysAp.mmp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Group/SysAp.mmp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2005-2010 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"
@@ -83,6 +83,7 @@
 SOURCE SysApSimChanged.cpp
 LIBRARY logcli.lib
 
+LIBRARY hal.lib
 SOURCE SysApAccessoryObserver.cpp
 LIBRARY AccClient.lib
 
--- a/coreapplicationuis/SysAp/Inc/SysApAppUi.h	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Inc/SysApAppUi.h	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2005-2010 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"
@@ -1444,7 +1444,18 @@
     void AddMmcMenuItemsL( CDesCArray*& aProfileNameCDesCArray,
                            RArray<TInt>& aItemIdArray, 
                            TInt& aPowerMenuItemIndex );
-
+						   
+	public:
+	/**
+    * Starts the charging animation in the battery pane.
+    */
+	void StartChargingBatteryL();
+	
+	/**
+    * Stops the charging animation in the battery pane.
+    */
+	void StopChargingBatteryL();
+	
 private:
     //Data members
 
--- a/coreapplicationuis/SysAp/Inc/sysapdefaultkeyhandler.h	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Inc/sysapdefaultkeyhandler.h	Mon Jul 12 15:58:51 2010 +0100
@@ -22,6 +22,7 @@
 #include <e32base.h>
 #include <coedef.h>
 #include <AknCapServerClient.h>
+#include <e32property.h>
 
 class MSysapCallback;
 class RAknKeylock2;
@@ -236,6 +237,11 @@
          */
         CRepository* iSlideRepository;
         TBool iKeypadWasLocked;
+
+        /**
+          * Call status P&S for slide handling
+          */
+        RProperty iCallStateProperty;
     };
 
 #endif // SYSAPDEFAULTKEYHANDLER_H
--- a/coreapplicationuis/SysAp/Inc/sysapremconobserver.h	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Inc/sysapremconobserver.h	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007-2010 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"
@@ -54,7 +54,16 @@
         * Destructor.
         */
         virtual ~CSysApRemConObserver();
-
+        
+        /**
+         * Open remcon interface and reserve the volume keys
+         */
+        void StartRemconInterface();
+        
+        /**
+         * close the remcon interface and release the volume keys
+         */
+        void StopRemconInterface();
     protected: // Functions from base classes
 
         /**
--- a/coreapplicationuis/SysAp/Src/SysApAppUi.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Src/SysApAppUi.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -737,13 +737,26 @@
             TRACES( RDebug::Print( _L( "CSysApAppUi::HandleKeyEventL(): aType == EEventKeyUp, PowerKeyIsLockKey = %d, iLastPowerKeyWasShort = %d, iPowerKeyPopupMenuActive = %d, iCharging = %d" ), iSysApFeatureManager->PowerKeyIsLockKey(), iLastPowerKeyWasShort, iPowerKeyPopupMenuActive, iCharging ) );
             if ( iSysApFeatureManager->PowerKeyIsLockKey()
                  && iLastPowerKeyWasShort 
-				 				 && !iPowerKeyPopupMenuActive
+				 && !iPowerKeyPopupMenuActive
                  && !haveStatusPane  
                  && ( aKeyEvent.iScanCode == EStdKeyDevice2 ) )
                 {
                 //if the power key is the lock key && the last keypress was short && the power menu is not active
                 //then lock the phone
-                KeyLock().EnableWithoutNote();
+                TInt alarmState=0, securityQueryState=0;
+         		TInt errorCode = RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, alarmState );
+				TInt errorCode2 = RProperty::Get( KPSUidStartup, KStartupSecurityCodeQueryStatus, securityQueryState);
+            	TRACES( RDebug::Print( _L( "CSysApAppUi::HandleKeyEventL(): Reading value of KCoreAppUIsDisableKeyguard - State Value: %d"),alarmState));
+            	TRACES( RDebug::Print( _L( "CSysApAppUi::HandleKeyEventL(): Reading value of KStartupSecurityCodeQueryStatus - State Value: %d"),securityQueryState));
+				//Disable keylock if Alarm is active or if a Security code query is active on the display
+				if ( alarmState == ECoreAppUIsDisableKeyguard || securityQueryState == ESecurityQueryActive )
+                 	{
+					KeyLock().DisableWithoutNote();               	
+                 	}
+			    else
+         		 	{
+         			KeyLock().EnableWithoutNote();
+         			}
                 }
             else
                 {
@@ -1688,16 +1701,16 @@
         {
         TRACES( RDebug::Print( _L("SysAp: charger removed") ) );
         iSysApLightsController->ChargerConnectedL( EFalse );    
-        iSysApUsbChargerDetector.Reset();
-        
+                
         if ( !iSysApUsbChargerDetector.HostOnlyUsbChargingUsed() &&
              iSysApFeatureManager->Supported( KSysApFeatureIdChargerReminderNotes ) )
             {
-		if(showNote)
+			if(showNote)
                 {
                 ShowUiNoteL( EUnplugChargerNote );
                 }
             }
+		iSysApUsbChargerDetector.Reset();
         }
     else if ( aValue == EChargingStatusNotCharging )
         {
@@ -6890,4 +6903,25 @@
             }
         }
     }
+	
+// ----------------------------------------------------------------------------
+// CSysApAppUi::StartChargingBatteryL
+// ----------------------------------------------------------------------------
+//
+void CSysApAppUi::StartChargingBatteryL() 
+	{
+	TRACES( RDebug::Print( _L("CSysApAppUi::StartChargingBatteryL") ) );
+    iBatteryNotify->StartChargingL();
+    }
+	
+// ----------------------------------------------------------------------------
+// CSysApAppUi::StopChargingBatteryL
+// ----------------------------------------------------------------------------
+//
+void CSysApAppUi::StopChargingBatteryL()
+	{
+	TRACES( RDebug::Print( _L("CSysApAppUi::StopChargingBatteryL") ) );
+    iBatteryNotify->StopChargingL();
+    }
+	
 // End of File
--- a/coreapplicationuis/SysAp/Src/SysApLightsController.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Src/SysApLightsController.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2005-2010 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"
@@ -29,6 +29,8 @@
 #endif // RD_LIGHT_CONTROL_CHANGE
 
 #include "SysApFeatureManager.h"
+#include "startupdomainpskeys.h"
+#include <hal.h>
 
 // CONSTANTS
 
@@ -216,7 +218,13 @@
         {
         iLightPluginHandler->HandleEventNoAction( SysApLightExtension::EChargerConnection, TPckgBuf<TBool>(aConnected) );
         }        
-#endif // RD_LIGHT_CONTROL_CHANGE           
+#endif // RD_LIGHT_CONTROL_CHANGE 
+	TInt state( 0 );
+	TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+    if ( error == KErrNone && state == ESwStateCharging ) 
+		{
+		EnableActivityManagerL();
+		}		
     }
 
 // ----------------------------------------------------------------------------
@@ -969,16 +977,28 @@
         return;
         }
 
-    TInt err(KErrNone);
+	TInt err(KErrNone);
+    TInt state( 0 );
+    TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
     
-#ifdef RD_LIGHT_CONTROL_CHANGE
-    if ( !iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandOff ) )
+    if ( error == KErrNone && state != ESwStateCharging ) 
         {
-        TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
-        }
+#ifdef RD_LIGHT_CONTROL_CHANGE
+		if ( !iLightPluginHandler->HandleCommand( SysApLightExtension::ELightCommandOff ) )
+			{
+			TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
+			}
 #else //  RD_LIGHT_CONTROL_CHANGE
-    TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
-#endif // RD_LIGHT_CONTROL_CHANGE            
+		TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
+#endif // RD_LIGHT_CONTROL_CHANGE  
+		}
+	else
+		{
+		TRAP(err, iLight->LightOffL(CHWRMLight::ESystemTarget));
+		iSysApAppUi.StopChargingBatteryL();
+		//To switch off the display 
+		TInt result = HAL::Set( HALData::EDisplayState, 0 );
+		}            
     // Ignore unreserved in use warnings.
     if ( err != KErrNone && err != KErrInUse )
         {
@@ -1078,6 +1098,15 @@
                 iLightsCurrentlyOn = ETrue;
                 iLastLightsOnTime.HomeTime(); 
                 }
+				
+			TInt state( 0 );
+			TInt error = RProperty::Get( KPSUidStartup, KPSGlobalSystemState, state );
+    		if ( error == KErrNone && state == ESwStateCharging ) 
+				{
+				iSysApAppUi.StartChargingBatteryL();
+				//To switch on the display 
+				TInt result = HAL::Set( HALData::EDisplayState, 1 );
+				}	
             }
         else
             {
--- a/coreapplicationuis/SysAp/Src/SysApPubSubObserver.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Src/SysApPubSubObserver.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2005-2010 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"
@@ -712,7 +712,24 @@
                 break;                
                             
             }
-            
+        
+        if ( aValue == EFmTxStateActive )
+            {
+            if(iFmTxRemConObserver)
+                {
+                //Open Remcon and reserve the volume keys
+                iFmTxRemConObserver->StartRemconInterface();
+                }
+            }
+        else 
+            {
+            if(iFmTxRemConObserver)
+                {
+                //Disconnect from Remcon and release keys for other apps like phone app during call
+                iFmTxRemConObserver->StopRemconInterface();
+                }
+            }
+        
         if ( isFmTxTurnedOn )
             {
             if ( !iFmTxRemConObserver )
--- a/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Src/sysapdefaultkeyhandler.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -37,6 +37,7 @@
 #include <centralrepository.h> //for CRepository
 #include <settingsinternalcrkeys.h>
 #include <keylockpolicyapi.h>
+#include <ctsydomainpskeys.h>
 #include "sysapdefaultkeyhandler.h"
 #include "sysapcallback.h"
 #include "SysAp.hrh"
@@ -128,6 +129,9 @@
     //Load keylock slide handling CR 
     TRAP_IGNORE( iSlideRepository = CRepository::NewL( KCRUidSlideSettings ) );
     iKeylockPolicy = CKeyLockPolicyApi::NewL( EPolicyActivateKeyguard );
+
+    //Load PhoneCallStatus P&S  
+    TInt err = iCallStateProperty.Attach(KPSUidCtsyCallInformation, KCTsyCallState);
     }
 
 // ---------------------------------------------------------------------------
@@ -216,26 +220,41 @@
 					}
 				else
 					{ // keylock action is defined by user setting
-					TInt keyGuardSetting;
-					iSlideRepository->Get( KSlideKeyguard, keyGuardSetting );
-					switch( ( TSlideSettingKeyguard ) keyGuardSetting )
-						{
-						case ESlideSettingsKeyguardActivatingOn: 
-						    iKeylock->EnableKeyLock();
-						    break;
-						case ESlideSettingsKeyguardActivatingAskMe: 
-						    iKeylock->OfferKeyLock();
-							break;
-						case ESlideSettingsKeyguardActivatingOff: 
-						    //do nothing
-						    break;
-						case ESlideSettingsKeyguardActivatingAutomatic: 
-						    if( iKeypadWasLocked )
-							    {
-								iKeylock->EnableKeyLock();
-								}
-							break;
-						}
+                    TInt status(0);
+                    TInt err = iCallStateProperty.Get( status );
+                    if (err == KErrNone)
+                        {
+                        switch ( status )
+                            {
+                            case EPSCTsyCallStateUninitialized:
+                            case EPSCTsyCallStateNone:
+                                {
+    
+                                TInt keyGuardSetting;
+                                iSlideRepository->Get( KSlideKeyguard, keyGuardSetting );
+                                switch( ( TSlideSettingKeyguard ) keyGuardSetting )
+                                    {
+                                    case ESlideSettingsKeyguardActivatingOn: 
+                                        iKeylock->EnableKeyLock();
+                                        break;
+                                    case ESlideSettingsKeyguardActivatingAskMe: 
+                                        iKeylock->OfferKeyLock();
+                                        break;
+                                    case ESlideSettingsKeyguardActivatingOff: 
+                                        //do nothing
+                                        break;
+                                    case ESlideSettingsKeyguardActivatingAutomatic: 
+                                        if( iKeypadWasLocked )
+                                            {
+                                            iKeylock->EnableKeyLock();
+                                            }
+                                        break;
+                                    }
+                                }
+                            default: // any other state
+                                break;
+                            }
+                        }
 					}
                 // apply default light control
                 iCallback.ExecCommandL( MSysapCallback::EUpdateLights, TUpdateLightsBuf(EKeyGripClose) );
--- a/coreapplicationuis/SysAp/Src/sysapremconobserver.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/SysAp/Src/sysapremconobserver.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007-2010 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"
@@ -47,12 +47,6 @@
 void CSysApRemConObserver::ConstructL()
     {
     TRACES( RDebug::Print( _L("CSysApRemConObserver::ConstructL") ) );  
-    
-    iInterfaceSelector = CRemConInterfaceSelector::NewL();
-    
-    iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
-    
-    iInterfaceSelector->OpenTargetL();
     }
 
 // -----------------------------------------------------------------------------
@@ -81,7 +75,6 @@
 CSysApRemConObserver::~CSysApRemConObserver()
     {
     TRACES( RDebug::Print( _L("CSysApRemConObserver::~CSysApRemConObserver") ) );
-    delete iInterfaceSelector; // Internally deletes iCoreTarget 
     }
     
 // -----------------------------------------------------------------------------
@@ -112,4 +105,31 @@
 	    }
 	}
 
+/**
+ * Reserve the volume keys
+ */
+void CSysApRemConObserver::StartRemconInterface()
+    {
+    TRACES( RDebug::Print( _L("CSysApRemConObserver::BlockKeys")));
+    if(!iInterfaceSelector)
+        {
+        iInterfaceSelector = CRemConInterfaceSelector::NewL();
+        iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
+        iInterfaceSelector->OpenTargetL();
+        }
+    }
+
+/**
+ * Release the volume keys for other application like phone app during call
+ */
+void CSysApRemConObserver::StopRemconInterface()
+    {
+    TRACES( RDebug::Print( _L("CSysApRemConObserver::UnBlockKeys")));
+    if(iInterfaceSelector)
+        {
+        delete iInterfaceSelector;
+        iInterfaceSelector = NULL;
+        }
+    }
+
 //  End of File 
--- a/coreapplicationuis/advancedtspcontroller/data/keyevent.rul	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/advancedtspcontroller/data/keyevent.rul	Mon Jul 12 15:58:51 2010 +0100
@@ -22,9 +22,9 @@
             />
             
             <Tsp
-            routingTable='01'            
+            routingTable='01'           
+	    ruleActiveAudio='00' 
             ruleForeground='01'
-            ruleActiveAudio='00'
             ruleLastPlayedAudio='03'
             ruleDefaultApp='02'
             defaultApplicationPhone='100058B3'
@@ -113,9 +113,8 @@
             ruleActiveAudio='00'
             ruleLastPlayedAudio='03'
             ruleForeground='01' 
-            ruleDefaultApp='02'
-            defaultApplicationPhone='100058B3'
-            transparentApplicationBTAudioMan='10208971'
+	    ruleLaunchDefaultApp='04'
+            defaultLaunchApp='102072C3'
             />
             
             <Tsp
@@ -130,7 +129,6 @@
             ruleLastPlayedAudio='03'
             ruleDefaultApp='02'
             defaultApplicationPhone='100058B3'
-            transparentApplicationBTAudioMan='10208971'
 	    />
             
             <Tsp
--- a/coreapplicationuis/advancedtspcontroller/group/RemConTspController.mmp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/advancedtspcontroller/group/RemConTspController.mmp	Mon Jul 12 15:58:51 2010 +0100
@@ -29,7 +29,8 @@
 SOURCE          remcontspcontrollermain.cpp
 SOURCE          remcontspcontroller.cpp
 SOURCE          remconidlelistener.cpp
-SOURCE          remconeventtable.cpp
+SOURCE          remconeventtable.cpp 
+SOURCE          tsptriggerevents.cpp
 
 START RESOURCE  ../data/10282CD5.rss
 target          AdvancedTspController.rsc
--- a/coreapplicationuis/advancedtspcontroller/inc/remcontspcontroller.h	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/advancedtspcontroller/inc/remcontspcontroller.h	Mon Jul 12 15:58:51 2010 +0100
@@ -29,9 +29,10 @@
 #include <cfclient.h>
 #include <cflistener.h>
 #include <AudioClientsListPSData.h>
+#include <remcon/clientinfo.h>
 #include "remconidlelistener.h"
 #include "remconeventtable.h"
-
+#include "tsptriggerevents.h"
 // CONSTANTS
 
 // MACROS
@@ -57,7 +58,10 @@
 class CRemConTspController : public CRemConTargetSelectorPlugin,
                  public MRemConTargetSelectorPluginInterfaceV2,
                  public MRemConTargetSelectorPluginInterfaceV3,
-			     public MCFListener
+                 public MRemConTargetSelectorPluginInterfaceV4,
+                 public MRemConTargetSelectorPluginInterfaceV5,
+			     public MCFListener,
+                 public MTspRulesTriggerObserver
 	{
 	public:		// Constructors and destructor
 		
@@ -243,6 +247,85 @@
                 const TClientInfo& aSender,
                 const TRemConAddress& aConnection);
         
+        /**
+        Called by RemCon to get the TSP to permit an incoming command. This is called
+        if the bearer has provided a target client for the command.  
+        
+        The implementor should decide if they wish to allow this command and then call
+        IncomingCommandPermitted on the observer with a suitable error. 
+        
+        @param aInterfaceUid The UID of the client interface.
+        @param aOperationId The operation ID of the command.
+        @param aClient a TClientInfo referring to the selected client
+        */
+        virtual void PermitIncomingCommand(
+            TUid aInterfaceUid,
+            TUint aOperationId, 
+            const TClientInfo& aClient);
+        
+        /**
+        Called by RemCon to get the TSP to permit an incoming Notify. This is called
+        if the bearer has provided a target client for the Notify.  
+        
+        The implementor should decide if they wish to allow this Notify and then call
+        IncomingNotifyPermitted on the observer with a suitable error. 
+        
+        @param aInterfaceUid The UID of the client interface.
+        @param aOperationId The operation ID of the Notify.
+        @param aClient a TClientInfo referring to the selected client
+        */
+        virtual void PermitIncomingNotify(
+            TUid aInterfaceUid,
+            TUint aOperationId, 
+            const TClientInfo& aClient);
+
+        /** 
+        Called by RemCon when a bearer that can address commands wishes to
+        inform the system that there has been a remote user action to 
+        select a different addressed client.
+        
+        The bearer will then route addressed commands to this client until
+        such time as SetRemoteAddressedClient is called again or the TSP
+        calls SetLocalAddressedClient.
+        
+        @param aBearerUid The bearer that has changed its addressed client
+        @param aClient The RemCon client that is now selected by the bearer
+        */
+        virtual void SetRemoteAddressedClient(const TUid& aBearerUid, 
+                const TClientInfo& aClient);
+        /** Called by RemCon when a new target client has connected.
+         
+         @aClientInfo The information about the new client.
+         */
+        void TargetClientAvailable(const TClientInfo& aClientInfo);
+        
+        /** Called by RemCon when a target client has disconnected. 
+         
+         @aClientInfo The information about the client that has disconnected.
+         */
+        void TargetClientUnavailable(const TClientInfo& aClientInfo);
+        
+        /** Called by RemCon when a bearer wishes to begin being informed when
+        the locally addressed player changes.  Once this function has been called
+        the TSP should inform RemCon via SetLocalAddressedPlayer each time the
+        player to which incoming commands from aBearer would be routed changes.
+        This might occur for example if a new application is launched, or if the
+        foreground application changes, depending on what the TSP's rules are
+        for deciding the target of the incoming message.  These updates should
+        occur until UnregisterLocalAddressedClientObserver is called.
+        
+        @param aBearerUid The bearer that wishes to be informed of updates
+        */
+        TInt RegisterLocalAddressedClientObserver(const TUid& aBearerUid);
+
+        /** Called by RemCon when a bearer wishes to stop being informed of 
+        changes to the local addresse client.
+        
+        @param aBearerUid The bearer that no longer wishes to be informed of updates
+        */
+        TInt UnregisterLocalAddressedClientObserver(const TUid& aBearerUid);
+
+        
 	    // From MCFListener
 	    
 	    /**
@@ -291,6 +374,8 @@
             const TDesC& aSource,
             const TDesC& aType );
             
+        // from MTspRulesTriggerObserver
+        void MtrtoEvaluateRoutingRules();
         /**
         * Gets the foreground application.
         * 
@@ -329,8 +414,9 @@
 	    void GetCorrectClientL(
             TUid aInterfaceUid,
         	TUint aKeyEvent,
-        	TSglQue<TClientInfo>& aClients );
-        
+        	TSglQue<TClientInfo>& aClients,
+        	TBool aLaunchingNewApplicationAllowed);
+
         void SetKeyEventTableL( const CCFActionIndication& aActionToExecute );        
 
         void ActivateApplicationL( const TUid aUid ) const;
@@ -352,12 +438,26 @@
         */
         TBool DeviceLocked() const;
 
-	private:    // Data
-	    
-	    // owned
-		CRemConIdleListener* iIdle;
-		
-		// Interface to P&S key that returns call state
+        /**
+         * Decide if locally addressed client should be updated.
+         */
+        TClientInfo* GetLocalAddressedClient();
+
+private:
+        NONSHARABLE_STRUCT(TClientObserver)
+            {
+        public:
+            TClientObserver(TUid aBearerUid) : iBearerUid(aBearerUid) {};
+        public:
+            TUid iBearerUid;
+            TSglQueLink iClientObserverQueLink;
+            };
+
+private:    // Data
+        // owned
+        CRemConIdleListener* iIdle;
+
+        // Interface to P&S key that returns call state
         RProperty iProperty;
         
         CCFClient* iCFClient;
@@ -371,6 +471,16 @@
         TProcessId iProcessIdActive;
 
         RPointerArray<CRemConEventTable> iArrayOfStoredTables;
+        
+        TSglQue<TClientObserver> iClientObservers;
+        
+        TSglQue<TClientInfo> iAvailableTargets;
+        
+        TSglQue<TClientInfo> iTargetsForAddressing;
+        
+        TClientInfo* iLocalAddressedClient;
+        
+        CTspTriggerEventsWatcher* iTriggerEventsWatcher;
 	
 	public:     // Friend classes
 	
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/advancedtspcontroller/inc/tsptriggerevents.h	Mon Jul 12 15:58:51 2010 +0100
@@ -0,0 +1,104 @@
+/*
+* Copyright (c) 2010 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: Observes changes in the default player that should be used for a bearer
+*/
+
+#include <e32base.h>
+#include <e32property.h>
+#include <w32std.h>
+
+
+NONSHARABLE_CLASS(MTspRulesTriggerObserver)
+    {
+public:
+    virtual void MtrtoEvaluateRoutingRules() = 0;
+    };
+
+NONSHARABLE_CLASS(CActiveAudioClientObserver) : public CActive
+    {
+public:
+    static CActiveAudioClientObserver* NewL(MTspRulesTriggerObserver& aObserver);
+    ~CActiveAudioClientObserver();
+
+private:
+    // from CActive
+    void RunL();
+    void DoCancel();
+    
+    CActiveAudioClientObserver(MTspRulesTriggerObserver& aObserver);
+    void ConstructL();
+
+private:
+    MTspRulesTriggerObserver& iObserver;
+    RProperty iAudioApplication;
+    };
+
+NONSHARABLE_CLASS(CTspClientMapperObserver) : public CActive
+    {
+public:
+    static CTspClientMapperObserver* NewL(MTspRulesTriggerObserver& aObserver);
+    ~CTspClientMapperObserver();
+
+private:
+    // from CActive
+    void RunL();
+    void DoCancel();
+    
+    CTspClientMapperObserver(MTspRulesTriggerObserver& aObserver);
+    void ConstructL();
+
+private:
+    MTspRulesTriggerObserver& iObserver;
+    RProperty iPlayingClients;
+    };
+
+NONSHARABLE_CLASS(CWsEventsObserver) : public CActive
+    {
+public:
+    static CWsEventsObserver* NewL(MTspRulesTriggerObserver& aObserver);
+    ~CWsEventsObserver();
+    
+private:
+    // from CActive
+    void RunL();
+    void DoCancel();
+    
+    CWsEventsObserver(MTspRulesTriggerObserver& aObserver);
+    void ConstructL();
+    
+private:
+    MTspRulesTriggerObserver& iObserver;
+    RWsSession iWsSession;
+    RWindowGroup iWindowGroup;
+    };
+
+NONSHARABLE_CLASS(CTspTriggerEventsWatcher) : public CBase
+    {
+public:
+    static CTspTriggerEventsWatcher* NewL(MTspRulesTriggerObserver& aObserver);
+    ~CTspTriggerEventsWatcher();
+    TInt AddBearer(TUid& aBearerUid);
+    TInt RemoveBearer(TUid& aBearerUid);
+
+private:
+    CTspTriggerEventsWatcher(MTspRulesTriggerObserver& aObserver);
+    void ConstructL();
+
+private:
+    MTspRulesTriggerObserver& iObserver;
+    CActiveAudioClientObserver* iAudioClientObserver;
+    CWsEventsObserver* iWsEventsObserver;
+    CTspClientMapperObserver* iClientMapperObserver;
+    };
+
--- a/coreapplicationuis/advancedtspcontroller/src/remcontspcontroller.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/advancedtspcontroller/src/remcontspcontroller.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -61,6 +61,8 @@
 // LOCAL CONSTANTS AND MACROS
 
 const TUint32 KUid3MusicPlayer = 0x102072C3;
+const TUint32 KUid3PhoneApp = 0x100058B3; 
+const TUint32 KUid3VoiceCmdApp = 0x102818e7;
 
 //#define __MODULE_TEST__
 
@@ -108,9 +110,11 @@
 // -----------------------------------------------------------------------------
 //
 
-CRemConTspController::CRemConTspController( 
-								MRemConTargetSelectorPluginObserver& aObserver )
-:	CRemConTargetSelectorPlugin( aObserver )
+CRemConTspController::CRemConTspController(MRemConTargetSelectorPluginObserver& aObserver )
+    : CRemConTargetSelectorPlugin( aObserver )
+    , iClientObservers(_FOFF(TClientObserver, iClientObserverQueLink))
+    , iAvailableTargets(_FOFF(TClientInfo, iLink))
+    , iTargetsForAddressing(_FOFF(TClientInfo, iLink2))
 	{
 	}
     
@@ -154,6 +158,24 @@
 	    }
     iArrayOfTables.ResetAndDestroy();
     iArrayOfStoredTables.ResetAndDestroy();
+    
+    TClientInfo* clientInfo;
+    while(!iAvailableTargets.IsEmpty())
+        {
+        clientInfo = iAvailableTargets.First();
+        iAvailableTargets.Remove(*clientInfo);
+        delete clientInfo;
+        }
+
+    TClientObserver* clientObserver;
+    while(!iClientObservers.IsEmpty())
+        {
+        clientObserver = iClientObservers.First();
+        iClientObservers.Remove(*clientObserver);
+        delete clientObserver;
+        }
+    iTargetsForAddressing.Reset(); 
+    delete iTriggerEventsWatcher;
 	COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::~CRemConTspController() - return" );
 	}
 
@@ -186,6 +208,16 @@
 		ret = reinterpret_cast<TAny*>(
 			static_cast<MRemConTargetSelectorPluginInterfaceV3*>(this) );
 		}
+    else if ( aUid == TUid::Uid(KRemConTargetSelectorInterface4) )
+        {
+        ret = reinterpret_cast<TAny*>(
+            static_cast<MRemConTargetSelectorPluginInterfaceV4*>(this) );
+        }
+    else if ( aUid == TUid::Uid(KRemConTargetSelectorInterface5) )
+        {
+        ret = reinterpret_cast<TAny*>(
+            static_cast<MRemConTargetSelectorPluginInterfaceV5*>(this) );
+        }
 	COM_TRACE_1( "[REMCONTSPCONTROLLER] CRemConTspController::GetInterface() this=%d", ret );
 	return ret;
 	}
@@ -338,9 +370,7 @@
 #ifdef _DEBUG	
 	TraceRemconTargets( aClients );
 #endif
-	
-	TRAPD( err, GetCorrectClientL( aInterfaceUid, aOperationId, aClients ) );
-	
+	TRAPD( err, GetCorrectClientL( aInterfaceUid, aOperationId, aClients, ETrue ) );
 	Observer().IncomingCommandAddressed( err );
 	
 	COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::AddressIncomingCommand() ends" );
@@ -397,6 +427,228 @@
     }
 
 // -----------------------------------------------------------------------------
+// CRemConTspController::PermitIncomingCommand
+// By default, permit all incoming addressed commands.  Check if the command
+// comes from the AVRCP bearer an if so launch the music player.
+// -----------------------------------------------------------------------------
+void CRemConTspController::PermitIncomingCommand(
+    TUid aInterfaceUid,
+    TUint aOperationId, 
+    const TClientInfo& aClient)
+    {
+	(void) aClient;  // Not used. 
+    // Here we need to check the incoming command.  If it is an AVRCP play
+    // command and there is no sensible handler running we should launch the
+    // MPX Music Player.  This is the same as for AddressIncomingCommand.
+    // Check if appropriate handler running
+    if ((aInterfaceUid != TUid::Uid(KRemConCoreApiUid)) ||
+         (aOperationId != ERemConCoreApiPlay) ||
+         GetLocalAddressedClient())
+        {
+        // no action needed, allow commmand
+        Observer().IncomingCommandPermitted(ETrue);
+        }
+     else 
+        {
+        // Launch an appropriate player in playing state. 
+        TRAPD(err, ActivateApplicationL(TUid::Uid(KUid3MusicPlayer)))
+        if(err != KErrNone)
+            {
+
+            }
+
+        //deny this command
+        Observer().IncomingCommandPermitted(EFalse);
+
+        // We will be informed when the MPX music player connects its client 
+        // session.  That will trigger a rules evaluation which will result in
+        // us informing interested bearers of the new local addressed player.
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRemConTspController::PermitIncomingNotify
+// By default, permit all incoming addressed commands.  Check if the command
+// comes from the AVRCP bearer an if so launch the music player.
+// -----------------------------------------------------------------------------
+void CRemConTspController::PermitIncomingNotify(
+    TUid /*aInterfaceUid*/,
+    TUint /*aOperationId*/, 
+    const TClientInfo& /*aClient*/)
+    {
+    // No reason to stop these, just allow all
+    Observer().IncomingNotifyPermitted(ETrue);
+    }
+
+// -----------------------------------------------------------------------------
+// CRemConTspController::SetRemoteAddressedClient
+// Ignore this event.  We don't use what the remote has selected to influence
+// our routing policy.
+// -----------------------------------------------------------------------------
+void CRemConTspController::SetRemoteAddressedClient(const TUid& /*aBearerUid*/, 
+        const TClientInfo& /*aClient*/)
+    {
+    }
+
+// -----------------------------------------------------------------------------
+// CRemConTspController::TargetClientAvailable
+// A new client has connected.  Trigger a rule evaluation to see if we want to switch
+// to this client.
+// -----------------------------------------------------------------------------
+void CRemConTspController::TargetClientAvailable(const TClientInfo& aClientInfo)
+    {
+    COM_TRACE_1("[REMCONTSPCONTROLLER] CRemConTspController::TargetClientAvailable aClientInfo.SecureId=0x%x", aClientInfo.SecureId().iId);
+
+    TClientInfo* clientInfo;
+    TSglQueIter<TClientInfo> iter(iAvailableTargets);
+    
+    while((clientInfo = iter++) != NULL)
+        {
+        if(clientInfo->SecureId() == aClientInfo.SecureId())
+            {
+            // Found a client and clientInfo points to that now. 
+            break; 
+            }
+        }
+    
+    // If clientInfo was not found, create it and add to the available targets queue. 
+    if(!clientInfo)
+        {
+        TClientInfo* newTarget = new TClientInfo();
+        if(newTarget)
+            {
+            newTarget->ProcessId() = aClientInfo.ProcessId();
+            newTarget->SecureId() = aClientInfo.SecureId();
+            
+            // Add to our list of available targets
+            iAvailableTargets.AddLast(*newTarget);
+            }
+        }
+
+    // Re-evaluate what the default addressed player should be if someone is interested to know 
+    if(!iClientObservers.IsEmpty())
+        {
+        MtrtoEvaluateRoutingRules();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRemConTspController::TargetClientUnavailable
+// A client has disconnected.  Trigger a rule evaluation to see if our default
+// player has changed.
+// -----------------------------------------------------------------------------
+void CRemConTspController::TargetClientUnavailable(const TClientInfo& aClientInfo)
+    {
+    COM_TRACE_1("[REMCONTSPCONTROLLER] CRemConTspController::TargetClientUnavailable aClientInfo.SecureId=0x%x", aClientInfo.SecureId().iId);
+
+    // Remove this from our list of available targets
+    if(!iAvailableTargets.IsEmpty())
+        {
+        TClientInfo* clientInfo;
+        TSglQueIter<TClientInfo> iter(iAvailableTargets);
+        while((clientInfo = iter++) != NULL)
+            {
+            if(clientInfo->SecureId() == aClientInfo.SecureId())
+                {
+                iAvailableTargets.Remove(*clientInfo);
+                delete clientInfo;
+                break;
+                }
+            }
+        }
+
+    if(!iClientObservers.IsEmpty())
+        {
+        // Re-evaluate what the default addressed player should be if someone is listening. 
+        MtrtoEvaluateRoutingRules();
+        }
+    }
+
+// -----------------------------------------------------------------------------
+// CRemConTspController::RegisterLocalAddressedClientObserver
+// A bearer is interested in what the local addressed player is.  Start observing.
+// -----------------------------------------------------------------------------
+TInt CRemConTspController::RegisterLocalAddressedClientObserver(const TUid& aBearerUid)
+    {
+    COM_TRACE_1("[REMCONTSPCONTROLLER] CRemConTspController::RegisterLocalAddressedClientObserver aBearerUid.SecureId=0x%x", aBearerUid.iUid);
+    TInt err = KErrNone;
+    // Add this to our list of bearers interested in the default addressed player
+    TClientObserver* clientObserver = new TClientObserver(aBearerUid);
+
+    if(!clientObserver)
+        {
+        err = KErrNoMemory; 
+        }
+
+    // If this is our first interested bearer kick off the trigger events watcher.
+    // This will let us know if any event occurs that should trigger us to re-evaluate
+    // our addressing rules
+    if(!iTriggerEventsWatcher && err == KErrNone)
+        {
+        TRAP(err, iTriggerEventsWatcher = CTspTriggerEventsWatcher::NewL(*this));
+        if(err != KErrNone)
+            {
+            // If we couldn't create the events watcher the client Observer is not needed either.
+            delete clientObserver;
+            }
+        }
+
+    if(err == KErrNone)
+        {
+        // Finally add the observer to the queue if it's not there yet. 
+        TSglQueIter<TClientObserver> iter(iClientObservers);
+        TClientObserver* obsInQueue;
+        while((obsInQueue = iter++) != NULL)
+            {
+            if(obsInQueue->iBearerUid == aBearerUid)
+                {
+                err = KErrAlreadyExists; 
+                break;
+                }
+            }
+
+        if(!obsInQueue)
+            {
+            iClientObservers.AddLast(*clientObserver);
+            MtrtoEvaluateRoutingRules();
+            }
+        }
+
+    return err;
+    }
+
+// -----------------------------------------------------------------------------
+// CRemConTspController::UnregisterLocalAddressedClientObserver
+// The bearer is no longer interested in observering default client changes.
+// -----------------------------------------------------------------------------
+TInt CRemConTspController::UnregisterLocalAddressedClientObserver(const TUid& aBearerUid)
+    {
+    COM_TRACE_1("[REMCONTSPCONTROLLER] CRemConTspController::UnregisterLocalAddressedClientObserver aBearerUid.SecureId=0x%x", aBearerUid.iUid);
+    // Remove this from our list of bearers interested in the default addressed player.
+    // If there are no interested bearers left then we can stop watching for rules
+    // triggers.
+    TSglQueIter<TClientObserver> iter(iClientObservers);
+    TClientObserver* clientObserver;
+    while((clientObserver = iter++) != NULL)
+        {
+        if(clientObserver->iBearerUid == aBearerUid)
+            {
+            iClientObservers.Remove(*clientObserver);
+	    delete clientObserver;
+            break;
+            }
+        }
+    
+    if(iClientObservers.IsEmpty())
+        {
+        delete iTriggerEventsWatcher;
+        iTriggerEventsWatcher = NULL;
+        }
+    
+    return KErrNone;
+    }
+
+// -----------------------------------------------------------------------------
 // CRemConTspController::GetCorrectClientL
 // Defines remote targets to which command will be sent.
 // (other items were commented in a header).
@@ -405,10 +657,12 @@
 void CRemConTspController::GetCorrectClientL(
     TUid aInterfaceUid,
 	TUint aKeyEvent,
-	TSglQue<TClientInfo>& aClients )
+	TSglQue<TClientInfo>& aClients,
+	TBool aLaunchingNewApplicationAllowed)
 	{
 	COM_TRACE_1( "[REMCONTSPCONTROLLER] CRemConTspController::GetCorrectClientL() Start aInterfaceUid %d", aInterfaceUid );
 	COM_TRACE_1( "[REMCONTSPCONTROLLER] CRemConTspController::GetCorrectClientL() Start aKeyEvent %d", aKeyEvent );
+
     TInt numOfTables = iArrayOfTables.Count();
     RArray<TInt> rulesArray;
     CleanupClosePushL( rulesArray );
@@ -513,6 +767,7 @@
             	    TProcessId processId = target->ProcessId();
             	    if( iProcessIdForeground == processId )
             	        {
+                        COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::GetCorrectClientL() Foreground client found" );
             	        aClients.Reset();
             	        aClients.AddFirst( *target );
             	        found = ETrue;
@@ -613,7 +868,7 @@
             case CRemConEventTable::ELaunchDefaultApp:
                 {
                 COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::GetCorrectClientL() Launch default application" );                
-                if ( !DeviceLocked() )
+                if ( !DeviceLocked() && aLaunchingNewApplicationAllowed )
                     {
                     TUid defaultLaunchAppUid;
                     
@@ -648,6 +903,9 @@
         else if( rulesArray.Count() - 1 == i )
             {
             COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::GetCorrectClientL() No client found");
+            // Reset the list to reflect the fact that no clients were found. 
+            // The possible transparent clients will be added still. 
+            aClients.Reset();
             }
         }
 
@@ -657,7 +915,8 @@
         TClientInfo* target = transparentClients[ i ];
         if ( !FindRemconConnection( target->SecureId(), aClients ) ) // Add client only if not already found
             {
-            aClients.AddFirst( *target );
+            // Add to the end of the list, any other client should take priority over the transparent clients. 
+            aClients.AddLast( *target );  
             COM_TRACE_1( "[REMCONTSPCONTROLLER] CRemConTspController::GetCorrectClientL() transparent client 0x%x added", target->SecureId().iId );
             }
         }
@@ -1059,6 +1318,40 @@
     }
 
 // -----------------------------------------------------------------------------
+// CRemConTspController::MtrtoEvaluateRoutingRules
+// Evaluates the TSP's routing rules to determine if the local addressed player
+// has changed, and if so informs interested bearers
+// -----------------------------------------------------------------------------
+void CRemConTspController::MtrtoEvaluateRoutingRules()
+    {
+    COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::MtrtoEvaluateRoutingRules() - Enter" ); 
+    TClientInfo* localAddressedClient = GetLocalAddressedClient();
+
+    if(!localAddressedClient)
+        {
+        // If there's no suitable client, then there's nothing to do here.   
+        COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::MtrtoEvaluateRoutingRules() No local addressed client found" ); 
+        return; 
+        }
+
+    if(!iLocalAddressedClient || (localAddressedClient->SecureId() != iLocalAddressedClient->SecureId()))
+        {
+        // Local addressed player has changed (or wasn't set before).  
+        iLocalAddressedClient = localAddressedClient;
+        COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::MtrtoEvaluateRoutingRules() Local addressed client has changed" ); 
+        TSglQueIter<TClientObserver> iter(iClientObservers);
+        TClientObserver* clientObserver;
+        while((clientObserver = iter++) != NULL)
+            {
+            COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::MtrtoEvaluateRoutingRules() - informing observer" ); 
+            Observer().SetLocalAddressedClient(clientObserver->iBearerUid, *iLocalAddressedClient);
+            }
+        }
+    COM_TRACE_1( "[REMCONTSPCONTROLLER] CRemConTspController::MtrtoEvaluateRoutingRules() Local addressed client SID = 0x%x",  iLocalAddressedClient->SecureId().iId);
+    COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::MtrtoEvaluateRoutingRules() - Return" ); 
+    }
+
+// -----------------------------------------------------------------------------
 // CRemConTspController::CreateAfterIdleL
 // Define the contexts when idle state has been loaded.
 // (other items were commented in a header).
@@ -1485,4 +1778,50 @@
     return EFalse;
     }
 
+//----------------------------------------------------------------------------------
+// CRemConTspController::GetLocalAddressedClient
+// Uses TSP rules to determine what local addressed client should be.
+//-----------------------------------------------------------------------------------
+TClientInfo* CRemConTspController::GetLocalAddressedClient()
+    {
+    COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::GetLocalAddressedClient() Entry");
+    // Create list of available clients to allow re-use of existing rule 
+    // evaluation function, GetCorrectClientL
+    iTargetsForAddressing.Reset();
+    TSglQueIter<TClientInfo> iter(iAvailableTargets);
+    TClientInfo* clientInfo;
+    while((clientInfo = iter++) != NULL)
+        {
+        iTargetsForAddressing.AddLast(*clientInfo);
+        }
+    
+#ifdef _DEBUG   
+    TraceRemconTargets( iTargetsForAddressing );
+#endif
+    
+    TRAPD(err, GetCorrectClientL(TUid::Uid(KRemConCoreApiUid), ERemConCoreApiPlay, iTargetsForAddressing, EFalse));
+    if(iTargetsForAddressing.IsEmpty() || err)
+        {
+        clientInfo = NULL;
+        COM_TRACE_( "[REMCONTSPCONTROLLER] CRemConTspController::GetLocalAddressedClient() No target Found");
+        }
+    else
+        {
+        // We don't want to set the phone application or voice command handler as local addressed client. 
+        // So choose the first item that is neither of those. The clientInfo may be NULL in the end. 
+        TSglQueIter<TClientInfo> localAddressedIter(iTargetsForAddressing);
+        while((clientInfo = localAddressedIter++) != NULL)
+            {
+            if( clientInfo->SecureId() != TSecureId(KUid3PhoneApp) || 
+                clientInfo->SecureId() != TSecureId(KUid3VoiceCmdApp) )
+                {
+                COM_TRACE_1( "[REMCONTSPCONTROLLER] CRemConTspController::GetLocalAddressedClient() Local addressed client SID = %08x",  clientInfo->SecureId().iId);
+                break;
+                }
+            }
+        }
+
+    return clientInfo;
+    }
+
 // End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/advancedtspcontroller/src/tsptriggerevents.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2010 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: Observes changes in the default player that should be used for a bearer
+*/
+
+#include <AudioClientsListPSKeys.h>
+#include "tsptriggerevents.h"
+#include "RemConDebug.h"
+//-----------------------------------------------------------------------
+// CTspTriggerEventsWatcher
+//-----------------------------------------------------------------------
+CTspTriggerEventsWatcher* CTspTriggerEventsWatcher::NewL(MTspRulesTriggerObserver& aObserver)
+    {
+    CTspTriggerEventsWatcher* self = new(ELeave)CTspTriggerEventsWatcher(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CTspTriggerEventsWatcher::CTspTriggerEventsWatcher(MTspRulesTriggerObserver& aObserver)
+    : iObserver(aObserver)
+    {
+    }
+
+void CTspTriggerEventsWatcher::ConstructL()
+    {
+    // Create WServ event watcher
+    iWsEventsObserver = CWsEventsObserver::NewL(iObserver);
+    
+    // Create observer for audio routing
+    iAudioClientObserver = CActiveAudioClientObserver::NewL(iObserver);
+    
+    // Create observer for TSP client mapper
+    iClientMapperObserver = CTspClientMapperObserver::NewL(iObserver);
+    }
+
+CTspTriggerEventsWatcher::~CTspTriggerEventsWatcher()
+    {
+    delete iAudioClientObserver;
+    delete iWsEventsObserver;
+    delete iClientMapperObserver;
+    }
+
+//-----------------------------------------------------------------------
+// CWsEventsObserver
+//-----------------------------------------------------------------------
+CWsEventsObserver* CWsEventsObserver::NewL(MTspRulesTriggerObserver& aObserver)
+    {
+    CWsEventsObserver* self = new(ELeave)CWsEventsObserver(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CWsEventsObserver::~CWsEventsObserver()
+    {
+    Cancel(); 
+    iWindowGroup.Close(); 
+    iWsSession.Close();
+    }
+
+CWsEventsObserver::CWsEventsObserver(MTspRulesTriggerObserver& aObserver)
+    : CActive(CActive::EPriorityStandard), iObserver(aObserver), iWsSession(), iWindowGroup(iWsSession)
+    {
+    }
+
+void CWsEventsObserver::ConstructL()
+    {
+    // Register to recieve WServ events
+    CActiveScheduler::Add(this);    
+    User::LeaveIfError(iWsSession.Connect());
+    iWindowGroup = RWindowGroup(iWsSession); 
+    User::LeaveIfError(iWindowGroup.Construct(reinterpret_cast<TUint32>(this), EFalse));
+    iWindowGroup.SetOrdinalPosition(-1); 
+    iWindowGroup.DefaultOwningWindow(); 
+    iWindowGroup.EnableReceiptOfFocus(EFalse);    
+    iWindowGroup.EnableGroupListChangeEvents(); // For changes in z-order 
+    iWsSession.EventReady(&iStatus);
+    SetActive(); 
+    }
+
+
+void CWsEventsObserver::RunL()
+    {
+    COM_TRACE_( "[REMCONTSPCONTROLLER] CWsEventsObserver::RunL" );
+    TWsEvent event;
+    iWsSession.GetEvent(event);
+    iWsSession.EventReady(&iStatus);
+    SetActive(); 
+    if(event.Type() == EEventWindowGroupListChanged)
+        {
+        COM_TRACE_( "[REMCONTSPCONTROLLER] CWsEventsObserver::RunL - EEventWindowGroupListChanged" );
+        iObserver.MtrtoEvaluateRoutingRules();
+        }
+    }
+
+void CWsEventsObserver::DoCancel()
+    {
+    iWsSession.EventReadyCancel();
+    }
+
+//-----------------------------------------------------------------------
+// CActiveAudioClientObserver
+//-----------------------------------------------------------------------
+CActiveAudioClientObserver* CActiveAudioClientObserver::NewL(MTspRulesTriggerObserver& aObserver)
+    {
+    CActiveAudioClientObserver* self = new(ELeave)CActiveAudioClientObserver(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CActiveAudioClientObserver::~CActiveAudioClientObserver()
+    {
+    Cancel(); 
+    iAudioApplication.Close();
+    }
+
+CActiveAudioClientObserver::CActiveAudioClientObserver(MTspRulesTriggerObserver& aObserver)
+    : CActive(CActive::EPriorityStandard), iObserver(aObserver)
+    {
+    }
+
+void CActiveAudioClientObserver::ConstructL()
+    {
+    User::LeaveIfError(iAudioApplication.Attach(KPSUidMMFAudioServer, KAudioPolicyApplicationAudioStatePlaying));
+    CActiveScheduler::Add(this);    
+    iAudioApplication.Subscribe(iStatus);
+    SetActive(); 
+    }
+
+
+void CActiveAudioClientObserver::RunL()
+    {
+    // Doesn't matter what the value is - that'll be checked when evaluation
+    // the TSP target rules.  Inform the TSP of the value change and 
+    // re-subscribe.
+    COM_TRACE_( "[REMCONTSPCONTROLLER] CWsEventsObserver::RunL" );
+    iAudioApplication.Subscribe(iStatus);
+    SetActive(); 
+    iObserver.MtrtoEvaluateRoutingRules();
+    }
+
+void CActiveAudioClientObserver::DoCancel()
+    {
+    iAudioApplication.Cancel();
+    }
+
+//-----------------------------------------------------------------------
+// CTspClientMapperObserver
+//-----------------------------------------------------------------------
+CTspClientMapperObserver* CTspClientMapperObserver::NewL(MTspRulesTriggerObserver& aObserver)
+    {
+    CTspClientMapperObserver* self = new(ELeave)CTspClientMapperObserver(aObserver);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CTspClientMapperObserver::~CTspClientMapperObserver()
+    {
+    Cancel(); 
+    }
+
+CTspClientMapperObserver::CTspClientMapperObserver(MTspRulesTriggerObserver& aObserver)
+    : CActive(CActive::EPriorityStandard), iObserver(aObserver)
+    {
+    }
+
+void CTspClientMapperObserver::ConstructL()
+    {
+    const TUid KTspClientMapperProperty = { 0x10200C70 };
+    const TUint32 KTspClientMapperKeyPlaying = 0x00000001;
+    User::LeaveIfError(iPlayingClients.Attach(KTspClientMapperProperty, KTspClientMapperKeyPlaying));
+    CActiveScheduler::Add(this);    
+    iPlayingClients.Subscribe(iStatus);
+    SetActive(); 
+    }
+
+
+void CTspClientMapperObserver::RunL()
+    {
+    // Doesn't matter what the value is - that'll be checked when evaluating
+    // the TSP target rules.  Inform the TSP of the value change and 
+    // re-subscribe.
+    COM_TRACE_( "[REMCONTSPCONTROLLER] CWsEventsObserver::RunL" );
+    iPlayingClients.Subscribe(iStatus);
+    SetActive(); 
+    iObserver.MtrtoEvaluateRoutingRules();
+    }
+
+void CTspClientMapperObserver::DoCancel()
+    {
+    iPlayingClients.Cancel();
+    }
+
+
--- a/coreapplicationuis/powersaveutilities/group/bld.inf	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/powersaveutilities/group/bld.inf	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2009-2010 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"
@@ -28,6 +28,7 @@
 ../conf/powersaveutilities_2001011A.crml    MW_LAYER_CRML(powersaveutilities_2001011A.crml)
 
 ../rom/powersaveutilities.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(powersaveutilities.iby)
+../rom/powersaveutilitiesresources.iby  LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(powersaveutilitiesresources.iby)
 ../bsutil/inc/bsutil.h          |../../inc/bsutil.h
 
 // batterypopupcontrol
--- a/coreapplicationuis/powersaveutilities/loc/batindicatorpaneplugin.loc	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/powersaveutilities/loc/batindicatorpaneplugin.loc	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007-2010 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"
@@ -50,4 +50,5 @@
 // l: popup_battery_window_t1
 // r:5.0
 //
-#define qtn_battery_status_popup    "%N %"
\ No newline at end of file
+#define qtn_battery_status_popup    "%N %"
+
--- a/coreapplicationuis/powersaveutilities/rom/powersaveutilities.iby	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/powersaveutilities/rom/powersaveutilities.iby	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2007-2010 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"
@@ -26,7 +26,6 @@
 ECOM_PLUGIN( batindicatorpaneplugin.dll, batindicatorpaneplugin.rsc )
 
 data=DATAZ_\ECOM_RESOURCE_DIR\batindicatorpaneplugin.rsc   ECOM_RESOURCE_DIR\batindicatorpaneplugin.rsc
-data=DATAZ_\ECOM_RESOURCE_DIR\batindpaneplugin.rsc         ECOM_RESOURCE_DIR\batindpaneplugin.rsc
 data=DATAZ_\APP_RESOURCE_DIR\batterypopupcontrol.mif			 APP_RESOURCE_DIR\batterypopupcontrol.mif
 
 #endif // __POWERSAVEUTILITIES_IBY__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/coreapplicationuis/powersaveutilities/rom/powersaveutilitiesresources.iby	Mon Jul 12 15:58:51 2010 +0100
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2010 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:  powesaveutilities resources 
+*
+*/
+
+
+#ifndef __POWERSAVEUTILITIES_RESOURCES_IBY__
+#define __POWERSAVEUTILITIES_RESOURCES_IBY__
+
+data=DATAZ_\ECOM_RESOURCE_DIR\batindpaneplugin.rsc         ECOM_RESOURCE_DIR\batindpaneplugin.rsc
+
+
+#endif // __POWERSAVEUTILITIES_RESOURCES_IBY__
+
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/formatterrfsplugin.mmp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/formatterrfsplugin.mmp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -44,4 +44,3 @@
 LIBRARY         efsrv.lib               // File Server
 LIBRARY         euser.lib               // Base library
 LIBRARY         platformenv.lib         // PathInfo
-LIBRARY			sisregistryclient.lib   // RSisRegistrySession
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/secureformatter.mmp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/group/secureformatter.mmp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -23,9 +23,11 @@
 TARGETTYPE      exe
 SECUREID        0x20002486
 
-CAPABILITY      ALLFILES TCB // TCB required to delete c:/sys and c:/resource
+CAPABILITY      ALLFILES TCB ReadUserData // TCB required to delete c:/sys and c:/resource
 VENDORID        VID_DEFAULT
 
+EPOCHEAPSIZE    0x1000 0x200000 // if the excludelist entries are more , we need the heapsize of 2MB
+
 SOURCEPATH      ../src
 SOURCE          dirstackentry.cpp
 SOURCE          excludelistentry.cpp
@@ -39,3 +41,4 @@
 
 LIBRARY         efsrv.lib // File Server
 LIBRARY         euser.lib
+LIBRARY			sisregistryclient.lib   // RSisRegistrySession
\ No newline at end of file
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/formatterrfsplugincommon.h	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/formatterrfsplugincommon.h	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2009-10 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"
@@ -27,12 +27,6 @@
 _LIT( KExcludeList, "\\private\\100059C9\\excludelist.txt" );
 
 /**
-* Exclude list path and file which has the entries of the NR-flagged applications which are installed in c:\ drive and the RFS operation
-* is based on this file itself
-*/
-_LIT( KExcludeListcache, "\\private\\100059C9\\excludelistcache.txt" );
-
-/**
 * Application exclude list path
 */
 _LIT( KApplicationExcludeListPath, "?:\\private\\102073ea\\excludes\\" );
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/selectiveformatter.h	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/inc/selectiveformatter.h	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -115,6 +115,16 @@
     */
     void HandleAppExcludeListsOnDriveL( TPtr aBuf, TChar aDrive );
 
+    /**
+    * Handles NR-Application specific exclude list loading.       
+    */
+    void HandleNrExcludeListsL();
+
+    /**
+    * Append the list of nr-files to the excludelist entry.
+    */
+    void AppendNrlisttoExcludeListL(RPointerArray<HBufC> &nrFileList);
+
 private: // Data
 
     /** File server session. */
@@ -136,4 +146,35 @@
     TBool iValidExcludeListFound;
     };
 
+/** 
+Template class CleanupResetAndDestroy to clean up the array
+of implementation information from the cleanup stack.
+*/
+
+template <class T>
+class CleanupResetAndDestroy
+    {
+public:
+    /**
+    Puts an item on the cleanup stack.
+
+    @param  aRef 
+            The implementation information to be put on the cleanup stack.
+    */
+    inline static void PushL(T& aRef);
+private:
+    static void ResetAndDestroy(TAny *aPtr);
+    };
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef);
+template <class T>
+inline void CleanupResetAndDestroy<T>::PushL(T& aRef)
+    {CleanupStack::PushL(TCleanupItem(&ResetAndDestroy,&aRef));}
+template <class T>
+void CleanupResetAndDestroy<T>::ResetAndDestroy(TAny *aPtr)
+    {(STATIC_CAST(T*,aPtr))->ResetAndDestroy();}
+template <class T>
+inline void CleanupResetAndDestroyPushL(T& aRef)
+    {CleanupResetAndDestroy<T>::PushL(aRef);}
+
 #endif // C_SELECTIVEFORMATTER_H
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/formatterrfsplugin.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -19,11 +19,9 @@
 // SYSTEM INCLUDE
 #include <centralrepository.h>
 #include <driveinfo.h>
-#include <swi/sisregistrysession.h>
-#include <swi/sisregistryentry.h>
-#include <swi/sisregistrypackage.h>
-#include <mmf/common/mmfcontrollerpluginresolver.h>
+
 #include <starterdomaincrkeys.h>
+
 // USER INCLUDE
 #include "formatterrfsplugin.h"
 #include "formatterrfspluginprivatecrkeys.h"
@@ -39,210 +37,17 @@
 
 // ================= LOCAL FUNCTIONS =======================
 
-// ---------------------------------------------------------------------------
-// ExcludeListNameL
-// ---------------------------------------------------------------------------
-//
-static void FileWriteL(RPointerArray<HBufC> &files)
-    {
-    RFs fileSession;
-    RFile file;
-    User::LeaveIfError(fileSession.Connect());
-    TInt err = file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
-        
-    if ( err != KErrNone )
-        {
-        RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , FileWrite : Failed to open the file"));
-        return;
-        }
-
-    TInt pos = 0;
-    file.Seek(ESeekEnd,pos);
-    TInt size = files.Count();
-    RBuf filenameBuf;
-
-    for ( TInt i=0; i < size; i++)
-        {
-        HBufC8* fileName = HBufC8::NewLC(files[i]->Size());
-        TPtr8 fileNamePtr(fileName->Des());
-        fileNamePtr.Copy(*files[i]);
-
-        filenameBuf.Create(fileNamePtr.Length());
-        filenameBuf.Copy(fileNamePtr);
-        TFileText fileText ;
-        fileText.Set(file) ;
-        fileText.Seek(ESeekStart);
-        fileText.Write(filenameBuf);
-        CleanupStack::PopAndDestroy();//Filename
-        file.Flush();
-        }
-
-    file.Close();
-    fileSession.Close();    
-    }
-
-static void MergeFilesL()
-    {
-    
-    RFs fileSession;
-    RFile excludeFileName;
-    
-    User::LeaveIfError(fileSession.Connect());
-    TInt ret = excludeFileName.Open(fileSession,_L("c:\\private\\100059C9\\excludelist.txt"),EFileRead);
-
-		if(ret != KErrNone)
-			{
-			RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL , MergeFiles : Failed to open the file"));
-			return;
-			}
-    excludeFileName.Close();
-
-    CFileMan* fileMan=CFileMan::NewL(fileSession);
-    CleanupStack::PushL(fileMan);
- 
-    TInt result=fileMan->Copy(_L("c:\\private\\100059C9\\excludelist.txt"),_L("c:\\private\\100059C9\\excludelistcache.txt"),CFileMan::EOverWrite);
-		RDebug::Print(_L("CFormatterRFSPlugin::MergeFilesL copying the excludelist.txt to excludelistcache.txt , CFileMan::Copy returned = %d"), result);   
-    CleanupStack::PopAndDestroy(fileMan);
-
-    fileSession.Close();
-    }
 
 static HBufC* ExcludeListNameL( TChar aSystemDrive )
     {
     FUNC_LOG;
 		
-    RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL"));
-    
-    RFs fileSession;
-    RFile file;
-    
-    _LIT8(KFileName, "c:\\private\\100059C9\\excludelistcache.txt\n");
-    TBuf8 <50> fileName;
-    fileName.Copy(KFileName);
-
-    User::LeaveIfError(fileSession.Connect());
-    
-    RDir dir;
-    if(dir.Open(fileSession,_L("c:\\private\\100059C9\\"),KEntryAttNormal) != KErrNone)
-        {
-        User::LeaveIfError(fileSession.MkDir(_L("c:\\private\\100059C9\\")));
-        }
-    
-    TInt rev = file.Replace(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText);
-    
-    RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL, Replace returned %d"),rev);
-    
-    file.Flush();
-    file.Close();
-    dir.Close();
-    fileSession.Close();
-
-    Swi::RSisRegistrySession session;
-    CleanupClosePushL(session);
-    User::LeaveIfError(session.Connect());
-    
-    // Get the installed application UIDs
-    RArray<TUid> uids;
-    CleanupClosePushL(uids);
-    session.InstalledUidsL(uids);
-    TInt uidcount = uids.Count(); 
-    
-    Swi::RSisRegistryEntry entry;
-    Swi::RSisRegistryEntry entry2;
-    CleanupClosePushL(entry);
-    CleanupClosePushL(entry2);
-    
-    RPointerArray<HBufC> registryFiles;
-    RPointerArray<HBufC> augmentedRegistryFiles;
-    RPointerArray<HBufC> nonRemovableFiles;
-    RPointerArray<HBufC> nonRemovableAugmentedFiles;
-    CleanupResetAndDestroyPushL(registryFiles);
-    CleanupResetAndDestroyPushL(augmentedRegistryFiles);
-    CleanupResetAndDestroyPushL(nonRemovableFiles);
-    CleanupResetAndDestroyPushL(nonRemovableAugmentedFiles);
-    
-     TInt count;
-     RPointerArray<Swi::CSisRegistryPackage> augmentationPackages;
-     CleanupResetAndDestroyPushL(augmentationPackages);
-     for ( TInt iter=0; iter<uidcount; iter++)
-         {
-         User::LeaveIfError(entry.Open(session,uids[iter]));
-         if(EFalse == entry.RemovableL())
-             {
-             entry.FilesL(nonRemovableFiles);
-             entry.RegistryFilesL(registryFiles);
-             TInt fileCount = nonRemovableFiles.Count(); 
-             for (TInt z=fileCount-1; z>=0;z--)
-                 {
-                 TPtr firstChar(nonRemovableFiles[z]->Des());
-                 if(firstChar.Mid(0,1) == _L("z"))
-                     {
-                     delete nonRemovableFiles[z];
-                     nonRemovableFiles.Remove(z);
-                     }
-                 }
-             // Look for augmentations.
-             if(entry.IsAugmentationL())
-                 {
-                 entry.AugmentationsL(augmentationPackages);
-                 count = entry.AugmentationsNumberL();
-                 for (TInt i=0; i < count; ++i)
-                     {
-                     User::LeaveIfError(entry2.OpenL(session,*augmentationPackages[i]));
-                     if(EFalse == entry2.RemovableL())
-                         {
-                         entry2.FilesL(nonRemovableAugmentedFiles);
-                         entry2.RegistryFilesL(augmentedRegistryFiles);
-                         for (TInt c=0; c<nonRemovableAugmentedFiles.Count();c++)
-                               {
-                               TPtr firstChar(nonRemovableAugmentedFiles[c]->Des());
-                               if(firstChar.Mid(0,1) == _L("z"))
-                                   {
-                                   delete nonRemovableAugmentedFiles[c];
-                                   nonRemovableAugmentedFiles.Remove(c);
-                                   }
-                               }
-											}
-                     	entry2.Close();
-                     	}
-                 }
-             }
-         entry.Close();
-         }
-     RDebug::Print(_L("CFormatterRFSPlugin::ExcludeListNameL Writing the file names to the excludelist.txt"));
- 
-     MergeFilesL();
-		 FileWriteL(nonRemovableAugmentedFiles);
-		 FileWriteL(augmentedRegistryFiles);
-		 FileWriteL(nonRemovableFiles);
- 		 FileWriteL(registryFiles);
-
-     TInt pos = 0;
-     User::LeaveIfError(fileSession.Connect());
-     User::LeaveIfError(file.Open(fileSession,_L("c:\\private\\100059C9\\excludelistcache.txt"),EFileWrite|EFileStreamText));
-          
-     file.Seek(ESeekEnd,pos);
-
-     TBuf<KMaxFileName> configurationLine ;
-     TFileText fileText ;
-     fileText.Set(file) ;
-     fileText.Seek(ESeekStart);
-     configurationLine.Format(_L("c:\\private\\100059C9\\excludelistcache.txt")) ;
-     fileText.Write(configurationLine);
-     
-     file.Flush();
-     file.Close();
-     fileSession.Close();
-    
-     
-     CleanupStack::PopAndDestroy(9,&session);
-
-     HBufC* buf = HBufC::NewLC( KExcludeListcache().Length() + KExcludeListPathNameLenExt );
-     TPtr bufPtr = buf->Des();
-     bufPtr.Append( aSystemDrive );
-     bufPtr.Append( KDriveDelimiter );
-     bufPtr.Append( KExcludeListcache );
-     CleanupStack::Pop( buf );
+    HBufC* buf = HBufC::NewLC( KExcludeList().Length() + KExcludeListPathNameLenExt );
+    TPtr bufPtr = buf->Des();
+    bufPtr.Append( aSystemDrive );
+    bufPtr.Append( KDriveDelimiter );
+    bufPtr.Append( KExcludeList );
+    CleanupStack::Pop( buf );
     return buf;
     }
 
--- a/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/selectiveformatter.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/FormatterRFSPlugin/src/selectiveformatter.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2010 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"
@@ -17,6 +17,9 @@
 
 
 #include <f32file.h>
+#include <swi/sisregistrysession.h>
+#include <swi/sisregistryentry.h>
+#include <swi/sisregistrypackage.h>
 
 #include "dirstackentry.h"
 #include "selectiveformatter.h"
@@ -24,6 +27,7 @@
 #include "rfsfileman.h"
 #include "trace.h"
 
+_LIT(KZDrive,"z");
 // ================= MEMBER FUNCTIONS =======================
 
 // ---------------------------------------------------------------------------
@@ -125,6 +129,9 @@
     // Handle app specific files
     HandleAppExcludeListsL();
     
+    // Handle NR-Applications
+    HandleNrExcludeListsL();
+    
     if( !iValidExcludeListFound )
         {
         User::Leave( KErrInvalidExcList );
@@ -329,3 +336,130 @@
         dir = NULL;
         }
     }
+
+// ---------------------------------------------------------------------------
+// CSelectiveFormatter::HandleNrExcludeListsL
+// ---------------------------------------------------------------------------
+//
+void CSelectiveFormatter::HandleNrExcludeListsL()
+    {
+    INFO( "CSelectiveFormatter::HandleNrExcludeListsL() START ");
+    
+    Swi::RSisRegistrySession session;
+    CleanupClosePushL(session);
+    User::LeaveIfError(session.Connect());
+    
+    INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() RSisRegistrySession::Connect() established");
+    // Get the installed application UIDs
+    RArray<TUid> uids;
+    CleanupClosePushL(uids);
+    session.InstalledUidsL(uids);
+    TInt uidcount = uids.Count(); 
+    
+    Swi::RSisRegistryEntry regEntry;
+    Swi::RSisRegistryEntry augmentForRegEntry;
+    CleanupClosePushL(regEntry);
+    CleanupClosePushL(augmentForRegEntry);
+    
+    // Array of registry files i.e., .reg and .ctl for the installed apps
+    RPointerArray<HBufC> registryFiles;
+    
+    // Array of registry files i.e., .reg and .ctl for the augmented apps
+    RPointerArray<HBufC> augmentedRegistryFiles;
+    
+    // Array of files installed through package.
+    RPointerArray<HBufC> nonRemovableFiles;
+    
+    // Array of augmented files installed through package.
+    RPointerArray<HBufC> nonRemovableAugmentedFiles;
+    
+    CleanupResetAndDestroyPushL(registryFiles);
+    CleanupResetAndDestroyPushL(augmentedRegistryFiles);
+    CleanupResetAndDestroyPushL(nonRemovableFiles);
+    CleanupResetAndDestroyPushL(nonRemovableAugmentedFiles);
+    
+    TInt count;
+    
+    //Array of augmented packages
+    RPointerArray<Swi::CSisRegistryPackage> augmentationPackages;
+    CleanupResetAndDestroyPushL(augmentationPackages);
+        
+    for ( TInt iter=0; iter<uidcount; iter++)
+     {
+     User::LeaveIfError(regEntry.Open(session,uids[iter]));
+     if(EFalse == regEntry.RemovableL())
+         {
+         INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() get the nonRemovable and registry files");
+         
+         regEntry.FilesL(nonRemovableFiles);
+         regEntry.RegistryFilesL(registryFiles);
+         TInt fileCount = nonRemovableFiles.Count(); 
+         for (TInt nonRemovableFilesCount=fileCount-1; nonRemovableFilesCount>=0;nonRemovableFilesCount--)
+             {
+             TPtr nrFileName(nonRemovableFiles[nonRemovableFilesCount]->Des());
+             if(nrFileName.Left(1) == KZDrive )
+                 {
+                 delete nonRemovableFiles[nonRemovableFilesCount];
+                 nonRemovableFiles.Remove(nonRemovableFilesCount);
+                 }
+             }
+         // Look for augmentations.
+         if(regEntry.IsAugmentationL())
+             {
+             regEntry.AugmentationsL(augmentationPackages);
+             count = regEntry.AugmentationsNumberL();
+             for (TInt augPkgCount=0; augPkgCount < count; ++augPkgCount)
+                 {
+                 User::LeaveIfError(augmentForRegEntry.OpenL(session,*augmentationPackages[augPkgCount]));
+                 if(EFalse == augmentForRegEntry.RemovableL())
+                     {
+                     INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() get the augmented nonRemovable and registry files");
+                     augmentForRegEntry.FilesL(nonRemovableAugmentedFiles);
+                     augmentForRegEntry.RegistryFilesL(augmentedRegistryFiles);
+                     }
+                 augmentForRegEntry.Close();
+                 }
+             }
+         }
+     AppendNrlisttoExcludeListL(nonRemovableFiles);
+     nonRemovableFiles.ResetAndDestroy();
+     regEntry.Close();
+     }
+    INFO( "In CSelectiveFormatter::HandleNrExcludeListsL() append the list of files to the excludelist ");
+    
+    AppendNrlisttoExcludeListL(nonRemovableAugmentedFiles);
+    AppendNrlisttoExcludeListL(augmentedRegistryFiles);
+    AppendNrlisttoExcludeListL(registryFiles);
+    
+    CleanupStack::PopAndDestroy(9,&session);
+    INFO( "CSelectiveFormatter::HandleNrExcludeListsL() End");
+    }
+
+// ---------------------------------------------------------------------------
+// CSelectiveFormatter::HandleNrExcludeListsL
+// ---------------------------------------------------------------------------
+//
+
+void CSelectiveFormatter::AppendNrlisttoExcludeListL(RPointerArray<HBufC> &aFileNameArr)
+    {
+    INFO( "CSelectiveFormatter::AppendNrlisttoExcludeListL() START ");
+    TInt size = aFileNameArr.Count();
+    CExcludeListEntry* entry;
+    TInt err;
+    for ( TInt i=0; i < size; i++)
+        {
+        entry = CExcludeListEntry::NewL( aFileNameArr[i]->Des() );
+        err = iExcludeList.InsertInOrder( entry, CExcludeListEntry::Compare ); // take ownership
+        if( err != KErrNone )
+            {
+            delete entry; // delete entry if ownership not transferred
+            
+            if( err != KErrAlreadyExists )
+                {
+                INFO_1( "CSelectiveFormatter::AppendNrlisttoExcludeListL() leaves with error code %d",err);
+                User::Leave( err );
+                }
+            }            
+        }
+    INFO( "CSelectiveFormatter::AppendNrlisttoExcludeListL() END ");
+    }
Binary file coreapplicationuis/rfsplugins/StarterRFSPlugin/conf/starterrfsplugin.confml has changed
--- a/coreapplicationuis/rfsplugins/tsrc/rfspluginstest/rfstestapp/data/rfstestapp.rss	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/tsrc/rfspluginstest/rfstestapp/data/rfstestapp.rss	Mon Jul 12 15:58:51 2010 +0100
@@ -21,8 +21,8 @@
 #include <appinfo.rh>
 #include <avkon.rh>
 #include <avkon.rsg>
-#include <commondialogs.hrh>
-#include <commondialogs.rh>
+//#include <commondialogs.hrh>
+//#include <commondialogs.rh>
 #include <eikon.rh>
 #include <avkon.loc>
 #include "rfstestappcmds.hrh"
@@ -120,17 +120,19 @@
 // r_rfstestapp_memory_selection
 // ---------------------------------------------------------------------------
 //
+/*
 RESOURCE MEMORYSELECTIONDIALOG r_rfstestapp_memory_selection
     {
     title = "";
     softkey_1 = "Ok";
     }
-
+*/
 
 // ---------------------------------------------------------------------------
 // r_rfstestapp_specfile_selection
 // ---------------------------------------------------------------------------
 //
+/*
 RESOURCE FILESELECTIONDIALOG r_rfstestapp_specfile_selection
     {
     title = "Select Data Specification File";
@@ -147,13 +149,14 @@
             filter_data = { "*.spc" };
             }
         };
-    }
+    }*/
 
 
 // ---------------------------------------------------------------------------
 // r_rfstestapp_excludelist_selection
 // ---------------------------------------------------------------------------
 //
+/*
 RESOURCE FILESELECTIONDIALOG r_rfstestapp_excludelist_selection
     {
     title = "Select Exclude List File";
@@ -171,7 +174,7 @@
             }
         };
     }
-
+*/
 
 // ---------------------------------------------------------------------------
 // r_rfstestapp_progress
--- a/coreapplicationuis/rfsplugins/tsrc/rfspluginstest/rfstestapp/src/rfstestappui.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/coreapplicationuis/rfsplugins/tsrc/rfspluginstest/rfstestapp/src/rfstestappui.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -16,9 +16,9 @@
 */
 
 
-#include <akncommondialogsdynmem.h>
+//#include <akncommondialogsdynmem.h>
 #include <aknwaitdialog.h>
-#include <commondialogs.hrh>
+//#include <commondialogs.hrh>
 #include <rfstestapp.rsg>
 #include <aknlists.h>
 #include <aknpopup.h>
@@ -63,13 +63,13 @@
     TParsePtr parse( aPath );
     TPtrC rootFolder = parse.DriveAndPath();
     INFO_1( "Root folder for opening test files: %S", &rootFolder );
-    TBool ret = AknCommonDialogsDynMem::RunSelectDlgLD(
-        AknCommonDialogsDynMem::EMemoryTypePhone |
-        AknCommonDialogsDynMem::EMemoryTypeMMC,
-        aPath,
-        rootFolder,
-        R_RFSTESTAPP_MEMORY_SELECTION,
-        aResId );
+   TBool ret =ETrue;// = AknCommonDialogsDynMem::RunSelectDlgLD(
+        //AknCommonDialogsDynMem::EMemoryTypePhone |
+        //AknCommonDialogsDynMem::EMemoryTypeMMC,
+        //aPath,
+        //rootFolder,
+        //R_RFSTESTAPP_MEMORY_SELECTION,
+        //aResId );
 
     return ret;
     }
@@ -234,6 +234,7 @@
     HBufC* specFile = HBufC::NewLC( KMaxFileName );
     TPtr specFileDes = specFile->Des();
     specFileDes = aSpec;
+    /*
     if ( AskPathL( specFileDes, R_RFSTESTAPP_SPECFILE_SELECTION ) )
         {
         HBufC* excludeFile = HBufC::NewLC( KMaxFileName );
@@ -278,7 +279,7 @@
             }
 
         CleanupStack::PopAndDestroy( excludeFile );
-        }
+        }*/
     CleanupStack::PopAndDestroy( specFile );
     }
 
Binary file systemsettings/gssensorplugin/conf/sensorplugin_10282DF0.crml has changed
--- a/tzservices/tzloc/src/TzLocalizationDbAccessor.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/tzservices/tzloc/src/TzLocalizationDbAccessor.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2004-2010 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"
@@ -111,12 +111,15 @@
 		}
 	User::LeaveIfError(error);
 	// Check if both tables are created.
-	TRAP(error, iLocalizedTimeZoneDb.ColSetL(KCZTableName));
+	CDbColSet *colSet = NULL;
+	TRAP(error, colSet = iLocalizedTimeZoneDb.ColSetL(KCZTableName));
+	delete colSet;
 	if (error)
 		{
 		User::LeaveIfError(CreateFrequentlyUsedZoneTableL());
 		}
-	TRAP(error, iLocalizedTimeZoneDb.ColSetL(KUCTableName));
+	TRAP(error, colSet = iLocalizedTimeZoneDb.ColSetL(KUCTableName));
+	delete colSet;
 	if (error)
 	        {
 		User::LeaveIfError(CreateUserCityTableL());
--- a/tzservices/tzserver/Server/Source/timezonesession.cpp	Mon Jun 28 17:46:35 2010 +0100
+++ b/tzservices/tzserver/Server/Source/timezonesession.cpp	Mon Jul 12 15:58:51 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1997-2010 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"
@@ -698,19 +698,23 @@
  TInt CTzServerSession::doGetUserTimeZoneNamesL(const RMessage2& aMessage)
 	{
 	TInt size = iTzUserDataCache->SizeOfNames();
-	CBufFlat* buffer = CBufFlat::NewL(size);
-	CleanupStack::PushL(buffer);
-	buffer->ExpandL(0,size);
-	
-	RBufWriteStream writeStream;
-	CleanupClosePushL(writeStream);
-	writeStream.Open(*buffer);
-	const CTzUserNames& names = iTzUserDataCache->GetNames();
-	writeStream << names;
-	writeStream.CommitL();
-	aMessage.WriteL(0, buffer->Ptr(0));
-	CleanupStack::PopAndDestroy(2, buffer);
-	return KErrNone;
+	if ( size > 0 )
+		{
+		CBufFlat* buffer = CBufFlat::NewL(size);
+		CleanupStack::PushL(buffer);
+		buffer->ExpandL(0,size);
+		
+		RBufWriteStream writeStream;
+		CleanupClosePushL(writeStream);
+		writeStream.Open(*buffer);
+		const CTzUserNames& names = iTzUserDataCache->GetNames();
+		writeStream << names;
+		writeStream.CommitL();
+		aMessage.WriteL(0, buffer->Ptr(0));
+		CleanupStack::PopAndDestroy(2, buffer);
+		return KErrNone;
+		}
+	return KErrArgument;
 	}
 	
 /**