Revision: 201007 RCL_3 PDK_3.0.h
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 22 Feb 2010 17:57:49 +0200
branchRCL_3
changeset 3 d8a3531bc6b8
parent 0 15bf7259bb7c
child 5 433cbbb6a04b
Revision: 201007
layers.sysdef.xml
rom/alfred.iby
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiTimedValue.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiVisual.h
uiaccelerator_plat/alf_visual_api/group/bld.inf
uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h
uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorsession.h
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp
uiacceltk/hitchcock/AlfRenderStage/group/alfnonsupportedwscommands.rss
uiacceltk/hitchcock/AlfRenderStage/group/alfrenderstage.rss
uiacceltk/hitchcock/AlfRenderStage/group/alfrenderstageplugin.mmp
uiacceltk/hitchcock/AlfRenderStage/group/bld.inf
uiacceltk/hitchcock/AlfRenderStage/inc/alfasynchgoomsession.h
uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstage.h
uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstagefactory.h
uiacceltk/hitchcock/AlfRenderStage/inc/alfrsgc.h
uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h
uiacceltk/hitchcock/AlfRenderStage/src/alfasynchgoomsession.cpp
uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp
uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstagefactory.cpp
uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstageplugin.cpp
uiacceltk/hitchcock/AlfRenderStage/src/alfrsgc.cpp
uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp
uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF
uiacceltk/hitchcock/Client/eabi/alfclientu.DEF
uiacceltk/hitchcock/Client/inc/alfcrppluginclient.h
uiacceltk/hitchcock/Client/src/alfclient.mmp
uiacceltk/hitchcock/Client/src/alfcrppluginclient.cpp
uiacceltk/hitchcock/Client/src/alfdrawer.cpp
uiacceltk/hitchcock/Client/src/alfenv.cpp
uiacceltk/hitchcock/Client/src/alfmappingfunctions.cpp
uiacceltk/hitchcock/Client/src/alftextstylemanager.cpp
uiacceltk/hitchcock/Client/src/alftexturegroup.cpp
uiacceltk/hitchcock/Client/src/alftextvisual.cpp
uiacceltk/hitchcock/CommonInc/alfbridgecommands.h
uiacceltk/hitchcock/CommonInc/alfmoduletest.h
uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h
uiacceltk/hitchcock/CommonInc/huisynchronizationobserver.h
uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h
uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h
uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp
uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp
uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp
uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h
uiacceltk/hitchcock/coretoolkit/inc/HuiRenderSurface.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h
uiacceltk/hitchcock/coretoolkit/inc/huiextension.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10PBufferSurface.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10RenderSurface.h
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10PBufferSurface.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10RenderSurface.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiAnchorLayout.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiAnimatedTexture.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCmdBufferBrush.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectParser.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiLayout.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvasgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp
uiacceltk/hitchcock/goommonitor/bwins/goommonitoru.DEF
uiacceltk/hitchcock/goommonitor/data/goomconfig.xml
uiacceltk/hitchcock/goommonitor/eabi/goommonitoru.DEF
uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h
uiacceltk/hitchcock/goommonitor/inc/goomactionref.h
uiacceltk/hitchcock/goommonitor/inc/goomapplicationconfig.h
uiacceltk/hitchcock/goommonitor/inc/goomcloseapp.h
uiacceltk/hitchcock/goommonitor/inc/goomcloseappconfig.h
uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h
uiacceltk/hitchcock/goommonitor/inc/goommonitorclientserver.h
uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.h
uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h
uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
uiacceltk/hitchcock/goommonitor/src/goomactionref.cpp
uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp
uiacceltk/hitchcock/goommonitor/src/goomconfigparser.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp
uiacceltk/hitchcock/goommonitor/src/goommonitorsession.cpp
uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp
uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
uiacceltk/hitchcock/group/bld.inf
uiacceltk/hitchcock/group/core_exports.inc
uiacceltk/hitchcock/plugins/alfcrpplugin/group/alfcrpplugin.mmp
uiacceltk/hitchcock/plugins/alfcrpplugin/group/bld.inf
uiacceltk/hitchcock/plugins/alfcrpplugin/inc/alfcrpplugin.h
uiacceltk/hitchcock/plugins/alfcrpplugin/inc/alfsynchronizer.h
uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfcrpplugin.cpp
uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfcrpplugin.rss
uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfsynchronizer.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfpolicyhandler.cpp
--- a/layers.sysdef.xml	Tue Feb 02 07:56:43 2010 +0200
+++ b/layers.sysdef.xml	Mon Feb 22 17:57:49 2010 +0200
@@ -7,8 +7,14 @@
   <systemModel>
     <layer name="mw_layer">
       <module name="uiaccelerator">
-        <unit unitID="abs.uiaccelerator" mrp="" bldFile="&layer_real_source_path;/group" name="uiaccelerator" />
+        <unit unitID="nga.uiaccelerator" mrp="" bldFile="&layer_real_source_path;/group" name="uiaccelerator" />
+      </module>
+    </layer>
+    
+   <layer name="unit_test_layer">
+      <module name="uiaccelerator_test">
+        <unit unitID="nga.uiaccererator.unittest" mrp="" bldFile="&layer_real_source_path;/tsrc/group" name="uiaccelerator_test" />
       </module>
     </layer>
   </systemModel>
-</SystemDefinition>
+</SystemDefinition>
\ No newline at end of file
--- a/rom/alfred.iby	Tue Feb 02 07:56:43 2010 +0200
+++ b/rom/alfred.iby	Mon Feb 22 17:57:49 2010 +0200
@@ -51,6 +51,7 @@
 file=ABI_DIR\BUILD_DIR\alfhintplugin.dll               	SHARED_LIB_DIR\alfhintplugin.dll
 
 ECOM_PLUGIN(alfoogmplugin.dll, alfoogmplugin.RSC)
+ECOM_PLUGIN(alfcrpplugin.dll, alfcrpplugin.RSC)
 
 data=DATAZ_\ECOM_RESOURCE_DIR\alfnonsupportedwscommands.rsc     ECOM_RESOURCE_DIR\alfnonsupportedwscommands.rsc
 
@@ -133,6 +134,8 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/taskswapper_app_start_rect.fxml RESOURCE_FILES_DIR/effects/taskswapper_app_start_rect.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/taskswapper_appear.fxml RESOURCE_FILES_DIR/effects/taskswapper_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/taskswapper_disappear.fxml RESOURCE_FILES_DIR/effects/taskswapper_disappear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/toolbar_ext_appear.fxml RESOURCE_FILES_DIR/effects/toolbar_ext_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/toolbar_ext_disappear.fxml RESOURCE_FILES_DIR/effects/toolbar_ext_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_close.fxml RESOURCE_FILES_DIR/effects/touchinput_close.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_open.fxml RESOURCE_FILES_DIR/effects/touchinput_open.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/waitnote_appear.fxml RESOURCE_FILES_DIR/effects/waitnote_appear.fxml
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Mon Feb 22 17:57:49 2010 +0200
@@ -399,10 +399,13 @@
 
 public:    
     IMPORT_C void StoreRenderBufferL();
-    void DrawStoredVisualRenderBuffer() const;
-    void DrawStoredFullScreenRenderBuffer(CHuiGc& aGc) const;
+    void DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const;
+    void DrawStoredFullScreenRenderBuffer(TInt aCanvasDrawMode, CHuiGc& aGc) const;
     IMPORT_C void FreeRenderBuffer();
-        
+
+protected:
+    virtual void VisualExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
+
 private:
        
     THuiCanvasPaintedArea CanvasPaintedArea(TInt aIndex) const;
@@ -411,6 +414,10 @@
     void DrawCanvasChildren(CHuiGc& aGc, TInt aIncludeCanvasFlags, TInt aExcludeCanvasFlags) const;
     TBool ChildTreeChanged(TInt aExcludeCanvasFlags) const;
     
+    static TBool RecursiveChildTreeChanged(CHuiVisual* aVisual, TInt aExcludeCanvasFlags);
+    static TBool RecursiveIsExternalContentDrawingEnabled(CHuiVisual* aVisual);
+    static TBool RecursiveHasCommandBuffers(CHuiVisual* aVisual);
+    
 private: 
 
     struct THuiCanvasVisualData;
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Mon Feb 22 17:57:49 2010 +0200
@@ -677,7 +677,7 @@
      *
      * @return  Pointer to native window, or <code>NULL</code>.
      */
-    RDrawableWindow* NativeWindow();
+    IMPORT_C RDrawableWindow* NativeWindow();
 
     /**
      * Returns the rendering surface of the display.
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h	Mon Feb 22 17:57:49 2010 +0200
@@ -51,6 +51,7 @@
 class CHuiThemeManager;
 class CHuiCanvasTextureCache;
 class CHuiFxEngine;
+class MHuiSynchronizationObserver;
 
 class CHighResTimer;
 const TInt KHuiEnvReleasedActionId = 0x200100F8;
@@ -759,6 +760,20 @@
 
     CHuiCanvasTextureCache& CanvasTextureCache() const;
 
+    /**
+	 * Performs drawing synchronization.
+	 * @internal
+	 * @param aId identifier.
+	 * @param aObserver observer to be informed of completion.
+	 */
+    IMPORT_C void Synchronize(TInt aId, MHuiSynchronizationObserver* aObserver);
+
+     /**
+     	 * Removes the controlgroup
+	 * @param aId identifier.
+
+     */	   	
+     void RemoveTheControlGroup(TInt aId); 		
 public:
 
     /* Implementaton of MHuiTextureLoadingCompletedObserver: */
@@ -988,6 +1003,10 @@
     IMPORT_C void NotifyMemoryLevel(THuiMemoryLevel aMemoryLevel);
     IMPORT_C THuiMemoryLevel MemoryLevel();
     
+    void DoSynchronize();
+private:
+    MHuiSynchronizationObserver* iSynchObserver;
+    TInt iSynchId;
     };
 
 #endif  // __HUIENV_H__
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h	Mon Feb 22 17:57:49 2010 +0200
@@ -421,6 +421,11 @@
     IMPORT_C virtual void SetDimmingFog(const TRgb& aColor, TReal32 aAmount) __SOFTFP = 0;
 
     /**
+     * Clear rect using the current pen color
+     */
+    IMPORT_C virtual void Clear(const TRect& aRect) = 0;
+    
+    /**
      * Clear using the current pen color.
      */
     IMPORT_C virtual void Clear() = 0;
@@ -938,12 +943,12 @@
     IMPORT_C CHuiGc();
 
     /* Methods. */
-
+    
     /**
      * Determines the projection viewport.
      */
     IMPORT_C TRect ProjectionViewport() const;
-
+    
     /**
      * Determines the display area not affected by orientation.
      */
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h	Mon Feb 22 17:57:49 2010 +0200
@@ -57,12 +57,12 @@
 
 
 	/* Methods from MAknsSkinChangeObserver */
-	  void SkinContentChanged();
+	IMPORT_C void SkinContentChanged();
 
-	  void SkinConfigurationChanged(
+	IMPORT_C void SkinConfigurationChanged(
 	          const TAknsSkinStatusConfigurationChangeReason aReason );
 	  
-	  void SkinPackageChanged(
+	IMPORT_C void SkinPackageChanged(
 	         const TAknsSkinStatusPackageChangeReason aReason );
 public:
 
@@ -127,6 +127,9 @@
 	}
     void UpdateBackgroundsL(const RArray<THuiDisplayBackgroundItem>& aItems);
     IMPORT_C CHuiTexture* BackgroundTexture(const TAknsItemID& aID);
+    
+    TRect SkinRect(const TAknsItemID& aID);
+    
 protected: // from CHuiSkin
     IMPORT_C void SkinExtension(const TUid& aExtensionUid, TAny** aExtensionParameters);
     void FreeBackgrounds();
@@ -143,6 +146,7 @@
      */
     void UpdateBackgroundL();
 
+
 private:
 
     /** Control context for the skin. */
@@ -150,6 +154,8 @@
 
     /** Background texture from S60. */
     CHuiTexture* iBackgroundTexture;
+    CFbsBitmap* iBackgroundBitmap;
+    TRect iBackgroundRect;
 
     /** To get CallBack from SkinServer when skin is changed */
     RAknsSrvSession iSkinSrvSession;
@@ -158,8 +164,29 @@
     /** Background should be reloaded the next time it is needed. */
     TBool iReloadBackground;
     TBool iSkinChanged;
-    CFbsBitmap* iBackgroundBitmap;
+
+    class CSkinItem : public CBase
+        {
+        public :
+        
+        ~CSkinItem()
+            {
+            delete iBitmap;
+            };
+        TAknsItemID iId;
+        TRect iSkinRect;
+        CFbsBitmap* iBitmap;
+        };
+    RPointerArray<CSkinItem> iCachedSkinItems;
+    
     TAny* iSpare;    
-    };
+
+private: // helpers
+    
+    TInt SearchCachedSkinItemIndex(const TAknsItemID& aId);
+    TRect SearchCachedSkinItemRect(const TAknsItemID& aId);
+    CFbsBitmap* SearchCachedSkinItemBitmap(const TAknsItemID& aId);
+	};
+
 
 #endif  // __HUIS60SKIN_H__
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiTimedValue.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiTimedValue.h	Mon Feb 22 17:57:49 2010 +0200
@@ -451,6 +451,7 @@
 private:
     TInt iTimeRemainingWhenSuspended;
     TInt iSpare2;
+    friend class CHuiVisual;
     };
 
 
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiVisual.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiVisual.h	Mon Feb 22 17:57:49 2010 +0200
@@ -195,7 +195,8 @@
     EHuiVisualFlagShouldBeUnderOpaqueHint = 0x20000000,
     
     EHuiVisualFlagShouldBeShown = 0x40000000,
-    
+    // visual that is used only by wserv
+    EHuiVisualFlagWserv = 0x80000000,
     EHuiVisualFlagLast = 0xFFFFFFFF
     };
 
@@ -1443,6 +1444,24 @@
         {
         iLoadingEffect = aLoading;
         };
+
+    /**
+     * Queries canvas flags of the visual, returns result
+     * @internal
+     */    
+    TInt QueryCanvasFlags();
+
+    /**
+     * Checks if external content drawing is enabled for this visual, returns result
+     * @internal
+     */    
+    TBool QueryExternalContentDrawingEnabled();
+    
+    /**
+     * Checks if visual has something to draw, returns result
+     * @internal
+     */    
+    TBool QueryHasDrawableContent();
     
 protected:
 
--- a/uiaccelerator_plat/alf_visual_api/group/bld.inf	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_visual_api/group/bld.inf	Mon Feb 22 17:57:49 2010 +0200
@@ -100,4 +100,6 @@
 ../inc/goommonitor/goommonitorplugin.hrh     MW_LAYER_PLATFORM_EXPORT_PATH(goommonitorplugin.hrh)
 
 ../inc/alf/alfcompositionclient.h	MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfcompositionclient.h)
-../inc/alf/alfcompositionutility.h	MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfcompositionutility.h)
\ No newline at end of file
+../inc/alf/alfcompositionutility.h	MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfcompositionutility.h)
+
+../inc/alf/alfdrawer.h     MW_LAYER_PLATFORM_EXPORT_PATH(alf/alfdrawer.h)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,59 @@
+/*
+* 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:   
+*
+*/
+#ifndef __ALFDRAWER_H__
+#define __ALFDRAWER_H__
+
+#include <e32base.h>
+
+/**
+ * This provides additional alf drawing synchronization.
+ * 
+ * This class requires application environment (CCoeEnv) to exist.
+ */
+NONSHARABLE_CLASS( CAlfDrawer ) : public CBase
+    {
+public:
+    /**
+     * Creates new CAlfDrawer instance.
+     * @return newly created instance.
+     */
+    IMPORT_C static CAlfDrawer* NewL();
+    
+    /**
+     * Destructor.
+     */
+    IMPORT_C ~CAlfDrawer();
+
+public:
+    /**
+     * Finishes drawing. 
+     * This will perform similar operation as RWsSession::Finish
+     * and then wait for all pending drawing to be finished.
+     * @return error code, KErrNone upon success.
+     */
+    IMPORT_C TInt Finish();
+
+private:
+    CAlfDrawer();
+    void ConstructL();
+
+private:
+    struct TAlfDrawerData;
+    TAlfDrawerData* iData;
+    };
+
+#endif // __ALFDRAWER_H__
--- a/uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorsession.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorsession.h	Mon Feb 22 17:57:49 2010 +0200
@@ -169,6 +169,11 @@
     * @param aAppUid application UID being started.
     */
     IMPORT_C void AppAboutToStart(TRequestStatus& aStatus, const TUid& aAppUid);
+    
+    /**
+    * Notify the GOOM monitor that this application has finished allocating memory.  
+    */
+    IMPORT_C void MemoryAllocationsComplete();
 
 private://data 
     TInt iFlags;
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -92,8 +92,8 @@
 	    	        KAlfServerThreadName,
 	    	        AlfThreadFucntion,
 	    	        16384, // magic
-	    	        20000, // uses own heap for now
-	    	        10000000,
+	    	        4*1024*1024, // uses own heap for now
+	    	        10*1024*1024,
 	    	        0,
 	    	        EOwnerThread));
 	    	    
--- a/uiacceltk/hitchcock/AlfRenderStage/group/alfnonsupportedwscommands.rss	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/group/alfnonsupportedwscommands.rss	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/group/alfrenderstage.rss	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/group/alfrenderstage.rss	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2001 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/group/alfrenderstageplugin.mmp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/group/alfrenderstageplugin.mmp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/group/bld.inf	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/group/bld.inf	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfasynchgoomsession.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfasynchgoomsession.h	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstage.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstage.h	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -55,7 +55,8 @@
     public MWsTextCursor,
     public MAlfCompositionAgnosticWindowTreeObserver,
     public MAlfHintObserver,
-    public MWsDrawAnnotationObserver
+    public MWsDrawAnnotationObserver,
+    public MAlfSynchronizationInterface
         {
 public:
 
@@ -146,6 +147,10 @@
 	void WindowGroupChainBrokenAfter(const MWsWindowTreeNode& aWindowGroupNode);
 	void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded);
 	
+public: // from MAlfSynchronizationInterface
+    	
+	TInt Synchronize(TInt& aId);
+	
 public: // from MWsDrawAnnotationObserver
 	void WindowRedrawStart(const MWsWindowTreeNode& aWindowTreeNode, const TRegion& aRegion);
 	void WindowRedrawEnd(const MWsWindowTreeNode& aWindowTreeNode);
@@ -295,7 +300,9 @@
         };
     // Sprite flash setting for iSpriteRedraw
     TSpriteFlash iSpriteRedrawFlash;
-    
+
+    // Synchronization identifier.
+    TInt iSyncId;
 	};
 
 #endif //__ALFRENDERSTAGE_H__
--- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstagefactory.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfrenderstagefactory.h	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfrsgc.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfrsgc.h	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -374,6 +374,12 @@
          * @return Previous command
          */
         inline TInt PreviousCommand(){ return iPreviousCommand; } 
+      
+        /**
+         * Synchronize.
+         * @param aId id to pass forward.
+         */
+        void Synchronize(TInt aId);
         
     public: // From CActive
 
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfasynchgoomsession.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfasynchgoomsession.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -140,6 +140,8 @@
 			
     	case MWsDrawAnnotationObserver::EWsObjectInterfaceId:
     	    return static_cast<MWsDrawAnnotationObserver*>(this);
+        case KAlfSynchronizationInterfaceUid:
+            return static_cast<MAlfSynchronizationInterface*>(this);
     	default:
     	    return CWsRenderStage::ResolveObjectInterface(aTypeId);
 		}
@@ -164,6 +166,22 @@
 	}
 
 // ---------------------------------------------------------------------------
+// Synchronize
+// ---------------------------------------------------------------------------
+//
+TInt CAlfRenderStage::Synchronize(TInt& aId)
+    {
+    if ( iAlfSendBuffer )
+        {
+        ++iSyncId;
+        aId = iSyncId;
+        iAlfSendBuffer->Synchronize(iSyncId);
+        return KErrNone;
+        }
+    return KErrGeneral;
+    }
+
+// ---------------------------------------------------------------------------
 // End
 // ---------------------------------------------------------------------------
 //
@@ -420,7 +438,8 @@
             if( iScreenNumber == 0 )
 		        {          
                 if ( secureId != 0x10207218 && // Capserver / AKA goom
-                     secureId != 0x10204c27 )  // Policy server 
+                     secureId != 0x10204c27 && // Policy server
+                     secureId != 0x2000f85a )  // IAD application updater
                     {
                     // Todo: Must actually check whether the configuration uses goom
                     // would create drastic performance hit in a system that does not need
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstagefactory.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstagefactory.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstageplugin.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstageplugin.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrsgc.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrsgc.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). 
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
@@ -862,6 +862,19 @@
     }
 
 // ---------------------------------------------------------------------------
+// Synchronize
+// ---------------------------------------------------------------------------
+//
+void CAlfRsSendBuffer::Synchronize(TInt aId)
+    {
+    if ( iAlfBridgerClient )
+        {
+        TIpcArgs args(aId);
+        iAlfBridgerClient->SendSynch(EAlfSynchronize, args); // error ignored
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // ConnectL
 // ---------------------------------------------------------------------------
 //
--- a/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF	Mon Feb 22 17:57:49 2010 +0200
@@ -1105,4 +1105,7 @@
 	?EnableLowMemoryState@RAlfDirectClient@@QAEXH@Z @ 1104 NONAME ; void RAlfDirectClient::EnableLowMemoryState(int)
 	?SetGroupEffectL@CAlfVisual@@QAEXABVTDesC16@@H@Z @ 1105 NONAME ; void CAlfVisual::SetGroupEffectL(class TDesC16 const &, int)
 	?ForceSwRendering@RAlfDirectClient@@QAEHH@Z @ 1106 NONAME ; int RAlfDirectClient::ForceSwRendering(int)
+	?Finish@CAlfDrawer@@QAEHXZ @ 1107 NONAME ; int CAlfDrawer::Finish(void)
+	??1CAlfDrawer@@UAE@XZ @ 1108 NONAME ; CAlfDrawer::~CAlfDrawer(void)
+	?NewL@CAlfDrawer@@SAPAV1@XZ @ 1109 NONAME ; class CAlfDrawer * CAlfDrawer::NewL(void)
 
--- a/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF	Mon Feb 22 17:57:49 2010 +0200
@@ -1338,4 +1338,9 @@
 	_ZN16RAlfDirectClient20EnableLowMemoryStateEi @ 1337 NONAME
 	_ZN10CAlfVisual15SetGroupEffectLERK7TDesC16i @ 1338 NONAME
 	_ZN16RAlfDirectClient16ForceSwRenderingEi @ 1339 NONAME
+	_ZN10CAlfDrawer4NewLEv @ 1340 NONAME
+	_ZN10CAlfDrawer6FinishEv @ 1341 NONAME
+	_ZN10CAlfDrawerD0Ev @ 1342 NONAME
+	_ZN10CAlfDrawerD1Ev @ 1343 NONAME
+	_ZN10CAlfDrawerD2Ev @ 1344 NONAME
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/Client/inc/alfcrppluginclient.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,53 @@
+/*
+* 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".
+*/
+
+#ifndef ALFCRPPLUGINCLIENT_H
+#define ALFCRPPLUGINCLIENT_H
+
+#include <e32base.h>
+#include <w32std.h>
+
+/**
+ * Client for ALF window server extension
+ */
+NONSHARABLE_CLASS( CAlfCrpPluginClient ) : public CWsGraphic
+    {
+public:
+    /**
+     * Constructor.
+     */
+    CAlfCrpPluginClient();
+    
+    /**
+     * 2nd phase constructor.
+     */
+    void ConstructL();
+    
+    /**
+     * Destructor.
+     */
+    virtual ~CAlfCrpPluginClient();
+    
+public:
+    
+    /**
+     * Synchronizes drawing.
+     */
+    void Synchronize();
+
+public: // from CWsGraphic
+    
+    virtual void HandleMessage(const TDesC8& aData);
+    virtual void OnReplace();
+        
+    };
+
+#endif // ALFCRPPLUGINCLIENT_H
+
+// End of file
--- a/uiacceltk/hitchcock/Client/src/alfclient.mmp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alfclient.mmp	Mon Feb 22 17:57:49 2010 +0200
@@ -105,6 +105,10 @@
 SOURCE                  alfcanvasvisual.cpp 
 SOURCE                  alfclientwindow.cpp
 SOURCE                  alfdirectclient.cpp
+
+SOURCE                  alfdrawer.cpp
+SOURCE                  alfcrppluginclient.cpp
+
 USERINCLUDE             ../inc
 USERINCLUDE             ../../CommonInc
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/Client/src/alfcrppluginclient.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,74 @@
+/*
+* 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:   ALF window server client extension implementation.
+*
+*/
+
+#include "alfcrppluginclient.h"
+
+// --------------------------------------------------------------------------
+// CAlfCrpPluginClient::CAlfCrpPluginClient
+// --------------------------------------------------------------------------
+//
+CAlfCrpPluginClient::CAlfCrpPluginClient()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPluginClient::~CAlfCrpPluginClient
+// --------------------------------------------------------------------------
+//
+CAlfCrpPluginClient::~CAlfCrpPluginClient()
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPluginClient::ConstructL
+// --------------------------------------------------------------------------
+//
+void CAlfCrpPluginClient::ConstructL()
+    {
+    const TUid id = { 0x2002C358 };
+    BaseConstructL( id, KNullDesC8 );
+    }    
+
+// --------------------------------------------------------------------------
+// CAlfCrpPluginClient::Synchronize
+// --------------------------------------------------------------------------
+//    
+void CAlfCrpPluginClient::Synchronize()
+    {
+    TPckgC<TInt> buf(0);
+    SendMessage(buf);
+    Flush();
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPluginClient::HandleMessage
+// --------------------------------------------------------------------------
+//    
+void CAlfCrpPluginClient::HandleMessage(const TDesC8& /*aData*/)
+    {
+    }
+    
+// --------------------------------------------------------------------------
+// CAlfCrpPluginClient::OnReplace
+// --------------------------------------------------------------------------
+//    
+void CAlfCrpPluginClient::OnReplace()
+    {
+    }
+
+// End of file
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/Client/src/alfdrawer.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,143 @@
+/*
+* 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:   CAlfDrawer implementation.
+*
+*/
+
+
+
+
+#include <alf/alfdrawer.h>
+#include "alfcrppluginclient.h"
+
+#include <coemain.h>
+#include <w32std.h>
+
+// Class to hold internal alf drawer data.
+NONSHARABLE_CLASS( CAlfDrawer::TAlfDrawerData )
+    {
+public:
+    TAlfDrawerData();
+        
+public:
+    CAlfCrpPluginClient* iClient;
+    };
+
+// Creates CAlfCrpPluginClient instance, returns error code.
+static TInt CreateAlfCrpClient(CAlfCrpPluginClient*& aClient);
+// Creates CAlfCrpPluginClient instance.
+static CAlfCrpPluginClient* CreateAlfCrpClientL();
+
+
+// ---------------------------------------------------------------------------
+// NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CAlfDrawer* CAlfDrawer::NewL()
+    {
+    CAlfDrawer* self = new (ELeave) CAlfDrawer;
+    CleanupStack::PushL( self );
+    self->ConstructL();
+    CleanupStack::Pop( self );    
+    return self;
+    }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CAlfDrawer::~CAlfDrawer()
+    {
+    if ( iData )
+        {
+        delete iData->iClient;
+        delete iData;
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// Finish
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CAlfDrawer::Finish()
+    {
+    // First perform RWsSession finish operation to ensure
+    // that all drawing commands have been issued to renderstage.
+    TInt err = CCoeEnv::Static()->WsSession().Finish();
+
+    // Then create CRP instance (if needed).
+    if ( err == KErrNone && !iData->iClient ) 
+        {
+        err = CreateAlfCrpClient( iData->iClient );
+        }
+
+    // Finally, wait until alf side has finished rendering.
+    if ( err == KErrNone && iData->iClient )
+        {
+        iData->iClient->Synchronize();
+        }
+        
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAlfDrawer::CAlfDrawer()
+    {
+    }
+    
+// ---------------------------------------------------------------------------
+// ConstructL
+// ---------------------------------------------------------------------------
+//
+void CAlfDrawer::ConstructL()
+    {
+    iData = new (ELeave) TAlfDrawerData;
+    CreateAlfCrpClient( iData->iClient );
+    }
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CAlfDrawer::TAlfDrawerData::TAlfDrawerData()
+    : iClient( NULL )
+    {
+    }
+
+// ---------------------------------------------------------------------------
+// CreateAlfCrpClient
+// ---------------------------------------------------------------------------
+//
+static TInt CreateAlfCrpClient(CAlfCrpPluginClient*& aClient)
+    {
+    TRAPD(err, aClient = CreateAlfCrpClientL());
+    return err;
+    }
+
+// ---------------------------------------------------------------------------
+// CreateAlfCrpClientL
+// ---------------------------------------------------------------------------
+//
+static CAlfCrpPluginClient* CreateAlfCrpClientL()
+    {
+    CAlfCrpPluginClient* client = new (ELeave) CAlfCrpPluginClient;
+    CleanupStack::PushL( client );
+    client->ConstructL();
+    CleanupStack::Pop( client );
+    return client;
+    }
+
--- a/uiacceltk/hitchcock/Client/src/alfenv.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alfenv.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -953,6 +953,11 @@
 //   
 EXPORT_C void CAlfEnv::SetRefreshMode( TAlfRefreshMode aMode )
     {
+    if(aMode == EAlfRefreshModeAutomatic)
+        {
+        // syncronoushly rasterize all the changed text visuals
+        iData->iTextStyleManager->RefreshAllVisuals();
+        }
     Client().EnvSetRefreshMode( aMode );
     iData->iRefreshMode = TAlfRefreshMode(aMode);
     }
--- a/uiacceltk/hitchcock/Client/src/alfmappingfunctions.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alfmappingfunctions.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -663,7 +663,7 @@
     if (!inverted)
         {
         // Find closest pre-calculated value...
-        for (i=0; i<KAlfTableMappingNumberOfMappedValues;i++)
+        for (i=0; i<KAlfTableMappingNumberOfMappedValues-1;i++)
             {
             if ((!inverted && aValue < iData->iParams.iValues[i]) ||
                 inverted && (aValue > iData->iParams.iValues[i]))
--- a/uiacceltk/hitchcock/Client/src/alftextstylemanager.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alftextstylemanager.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -116,6 +116,11 @@
 
     void DoRefreshMesh()
         {
+        if( IsActive() )
+            {
+            Cancel();
+            }
+        
         for (TInt p = iVisuals.Count()-1; p >= 0; p--)
             {
             iVisuals[p]->PrepareForUpdateMesh();
@@ -337,7 +342,7 @@
 #ifdef ALF_RASTER_TEXT
     for(TInt i = 0 ; i < iData->iTextStyles.Count() ; i++ )
         {
-        iData->iTextStyles[i]->RefreshMesh();
+        iData->iTextStyles[i]->DoRefreshMesh();
         }
 #else
     return;
--- a/uiacceltk/hitchcock/Client/src/alftexturegroup.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alftexturegroup.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -109,23 +109,24 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C CAlfTextureGroup::~CAlfTextureGroup()
-	{
-    while (Count())
+    {
+    if ( iData )
         {
-        RemoveTexture(Texture(Count()-1));
-        }
+        while (Count())
+            {
+            RemoveTexture(Texture(Count()-1));
+            }
+    
+        iData->iLoadObserverQueue.Close();	
+	iData->iTextures.Close();		    
+	    
+	delete iData->iTextureLoadObserver;
+	iData->iTextureLoadObserver = NULL;
+	}	
 
-	if ( iData )
-	    {
-	    iData->iLoadObserverQueue.Close();	
-	    iData->iTextures.Close();		    
-	    
-	    delete iData->iTextureLoadObserver;
-	    iData->iTextureLoadObserver = NULL;
-	    }	
+    delete iData;
+    }
 
-	delete iData;
-	}
 // ---------------------------------------------------------------------------
 // NewL
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/Client/src/alftextvisual.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alftextvisual.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -416,10 +416,12 @@
 
 void CAlfTextVisual::PrepareForUpdateMesh()
     {
+#ifdef ALF_RASTER_TEXT
     if(!iTextVisualData->iMeshUptoDate)
         {
         iTextVisualData->iMesh->PrepareForRasterize();
         }
+#endif // ALF_RASTER_TEXT    
     }
 
 void CAlfTextVisual::UpdateMesh(TBool aSynch)
@@ -458,6 +460,7 @@
     {
 #ifdef ALF_RASTER_TEXT
     iTextVisualData->iMesh->ResetLines(ETrue);
+    iTextVisualData->iMeshUptoDate = EFalse;
 #endif
     }
 	
--- a/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h	Mon Feb 22 17:57:49 2010 +0200
@@ -73,15 +73,14 @@
     EAlfEffectFxEndSyncronizedGroup,
     EAlfDSSetCapturingBitmap,
     EAlfDSSetCoveringBitmap,
+    
+    //140
     EAlfDSSetFadeEffect,
     EAlfReleaseTemporaryChunk,
-
-    // 140
     EAlfBridgeSetScreenRotation,
+    EAlfDSSynchronize,
 
     KUnInitialized
-    
-    
     };
 
 #endif /* ALFBRIDGECOMMANDS_H_ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,163 @@
+#include "e32base.h"
+#include "e32debug.h"
+
+#ifndef ALFMODULETEST_H
+#define ALFMODULETEST_H
+
+// Define this to build module testing enchanced version of ALF
+//#define USE_MODULE_TEST_HOOKS_FOR_ALF
+
+#if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL)
+
+#define AMT_FUNC(func)                                
+#define AMT_FUNC_EXC(func)    
+#define AMT_INC_COUNTER(member)
+#define AMT_DEC_COUNTER(member)
+#define AMT_SET_VALUE(member, val)
+#define AMT_GET_VALUE(x, member)
+#define AMT_PRINT_STATE()
+
+#ifndef AMT_CONTROL
+#error "Error: you need to define AMT_CONTROL macro in your code to be able to use ALF module test system!"
+// The user have to define AMT_CONTROL, e.g. like this:
+// #define AMT_CONTROL()                static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+// or
+// #define AMT_CONTROL()                iMyModuleTestDataControl
+#endif
+
+#else
+
+
+//  *** Use these macros to access global memory chunk
+
+
+// Note: If you read/write a large block of data members, it is advisable not use the AMT_FUNC_EXC() based macros below. 
+//       Use Lock() and Unlock() around the block explicitely, and use AMT_FUNC() macro.
+//       That is to avoid unnecessary nested lock-unlock sequences (even if nested locks are working ok).
+
+// Note: Be careful not to lock the the mutex for a long time as it will halt other processes if they are using the lock during that time!
+
+// Generic macros
+#define AMT_DATA()                  AMT_CONTROL()->iModuleTestData
+#define AMT_FUNC(func)              if (AMT_DATA()->iIsEnabled) {func;}                                         
+#define AMT_FUNC_EXC(func)          {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();}        
+
+// Single operation macros, that will do lock/unlock.
+#define AMT_INC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member++)
+#define AMT_DEC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member--)
+#define AMT_SET_VALUE(member, val)  AMT_FUNC_EXC(AMT_DATA()->member=(val))
+#define AMT_GET_VALUE(x, member)    AMT_FUNC_EXC((x) = AMT_DATA()->member)
+#define AMT_PRINT_STATE()           AMT_FUNC_EXC(AMT_DATA()->PrintState())
+
+// *** Global object names
+_LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
+_LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
+
+/*
+ *  Class CAlfModuleTestData
+ */
+
+NONSHARABLE_CLASS(CAlfModuleTestData) : public CBase
+    {
+public:
+    void PrintState()
+        {
+        RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
+        RDebug::Print(_L("iTotalLayerCount[0]=%d"), iTotalLayerCount[0]);
+        RDebug::Print(_L("iTotalLayerCount[1]=%d"), iTotalLayerCount[1]);
+        RDebug::Print(_L("iCloneLayerCount=%d"), iCloneLayerCount);
+        RDebug::Print(_L("iTotalNodeCount=%d"), iTotalNodeCount);
+        RDebug::Print(_L("iWindowGroupNodeCount=%d"), iWindowGroupNodeCount);
+        RDebug::Print(_L("iWindowNodeCount=%d"), iWindowNodeCount);
+        RDebug::Print(_L("iAnimNodeCount=%d"), iAnimNodeCount);
+        RDebug::Print(_L("iTotalVisualCount=%d"), iTotalVisualCount);
+        RDebug::Print(_L("iVisibleVisualCount=%d"), iVisibleVisualCount);
+        RDebug::Print(_L("iActiveVisualCount=%d"), iActiveVisualCount);
+        RDebug::Print(_L("iPassiveVisualCount=%d"), iPassiveVisualCount);
+        RDebug::Print(_L("iTextureCount=%d"), iTextureCount);
+        RDebug::Print(_L("iRenderBufferCount=%d"), iRenderBufferCount);
+        RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
+        }
+    
+    
+public:
+    TBool iIsEnabled;           // *** not yet implemented. For run-time enabling/disabling of the test system.  
+    
+    // Alf Render Stage
+    TInt iScreenCount;          // *** not yet implemented
+    TInt iTotalLayerCount[10];  // For each screen
+    TInt iCloneLayerCount;      // ** not yet implemented
+    
+    // Alf Streamer
+    TInt iTotalNodeCount;       // *** not yet implemented
+    TInt iWindowGroupNodeCount; // *** not yet implemented
+    TInt iWindowNodeCount;      // *** not yet implemented
+    TInt iAnimNodeCount;        // *** not yet implemented
+    
+    // Alf Server
+    TInt iTotalVisualCount;     // *** not yet implemented
+    TInt iVisibleVisualCount;   // *** not yet implemented
+    TInt iActiveVisualCount;    // Active visual count
+    TInt iPassiveVisualCount;   // Passive visual count
+    TInt iTextureCount;         // *** not yet implemented
+    TInt iRenderBufferCount;    // *** not yet implemented
+    };
+
+
+/*
+ *  Class CAlfModuleTestDataControl
+ */
+NONSHARABLE_CLASS(CAlfModuleTestDataControl) : public CBase
+    {
+public:
+    /*
+     * Destructor
+     */
+    ~CAlfModuleTestDataControl()
+        {
+        iModuleTestMutex.Close();
+        iModuleTestChunk.Close();
+        }
+
+    /*
+     * Open global chunk and mutex created elsewhere
+     */
+    TInt OpenGlobalObjects()
+        {
+        // Open global module testing chunk
+        TBool isReadOnly = EFalse;
+        TInt err = iModuleTestChunk.OpenGlobal(KAlfModuleTestChunkName, isReadOnly);
+        if (!err)
+            {
+            // Create global module testing mutex
+            err = iModuleTestMutex.OpenGlobal(KAlfModuleTestMutexName);
+            if (!err)
+                {
+                iModuleTestData = reinterpret_cast<CAlfModuleTestData*>(iModuleTestChunk.Base());
+                }
+            }
+        RDebug::Print(_L("CAlfModuleTestDataControl::OpenGlobalObjects. err=%d"), err);
+        return err;
+        }
+
+    /*
+     * Lock access to global memory
+     */
+    void Lock() {iModuleTestMutex.Wait();}
+ 
+    /*
+     * Unlock access to global memory
+     */
+    void Unlock() {iModuleTestMutex.Signal();}
+    
+public:
+    RChunk iModuleTestChunk;
+    RMutex iModuleTestMutex;
+    CAlfModuleTestData* iModuleTestData; // Not owned
+    };
+
+#endif
+
+#endif // ALFMODULETEST_H
+
+// End of File
--- a/uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h	Mon Feb 22 17:57:49 2010 +0200
@@ -18,6 +18,10 @@
 #ifndef _ALFRSUAPI_H_
 #define _ALFRSUAPI_H_
 
+#include <e32std.h>
+
+class MWsWindowTreeNode;
+
 const TInt KAlfCompositionAgnosticWindowTreeObserverInterfaceId(0x2002BCFB);
     
 class MAlfCompositionAgnosticWindowTreeObserver
@@ -78,7 +82,7 @@
     virtual void MovedToWindowGroup(const MWsWindowTreeNode& aWindowTreeNode, const MWsWindowTreeNode& aNewWindowGroupNode) = 0;
     virtual void WindowGroupChained(const MWsWindowTreeNode& aParent, const MWsWindowTreeNode& aChild) = 0;
     virtual void WindowGroupChainBrokenAfter(const MWsWindowTreeNode& aWindowGroupNode) = 0;
-    virtual void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded) = 0;
+    virtual void FadeAllChildren(const MWsWindowTreeNode& aWindowTreeNode, TBool aFaded) = 0;    
     };
 
 class RAlfBridgerClient;
@@ -99,4 +103,34 @@
     virtual RAlfBridgerClient* Client() = 0;
     };
 
+/**
+ * Synchronization interface
+ */
+class MAlfSynchronizationInterface
+    {
+public:
+    /**
+     * Start synchronization. 
+     * @param aId This will contain identifier for this synchronization.
+     * @return error code, KErrNone if synchronization is started.
+     */
+    virtual TInt Synchronize(TInt& aId) = 0;
+    };
+
+/**
+ * Use this UID as parameter when resolving MAlfSynchronizationInterface 
+ * interface.
+ */
+const TUint32 KAlfSynchronizationInterfaceUid = 0x2002C357;
+
+/**
+ * Category for P&S variable for synchronization finished indication.
+ */
+const TUid KAlfPSUidSynchronizer = { 0x10003B20 };
+
+/**
+ * Key for P&S variable for synchronization finished indication.
+ */
+const TUint32 KAlfPSKeySynchronizer = 0x2002C357;
+
 #endif // _ALFRSUAPI_H_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/CommonInc/huisynchronizationobserver.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:   
+*
+*/
+
+#ifndef HUISYNCHRONIZATIONOBSERVER_H
+#define HUISYNCHRONIZATIONOBSERVER_H
+
+#include <e32std.h>
+
+/**
+ * Synchronization observer interface
+ */
+class MHuiSynchronizationObserver
+    {
+public:
+    /**
+     * Informs of completion of synchronization. 
+     * @param aId Id of completed synchronization.
+     */
+    virtual void Synchronized(TInt aId) = 0;
+    };
+
+#endif // HUISYNCHRONIZATIONOBSERVER_H
--- a/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h	Mon Feb 22 17:57:49 2010 +0200
@@ -170,4 +170,7 @@
         EAlfTransparentContentFlush = 0x02
         };
 
+// drawing commands for the window should be ignored 
+#define KWindowIsDSAHost 2
+
 #endif /* HUIWSCANVASCOMMANDS_H_ */
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Mon Feb 22 17:57:49 2010 +0200
@@ -22,6 +22,9 @@
 
 #include <e32hashtab.h>
 
+#define AMT_CONTROL()                static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 #include "alfscreen.h"
 #include "alfstreamerbridge.h"
 #include "alfdecoderserverclient.h"
@@ -29,6 +32,7 @@
 #include <alf/alfconstants.h>
 
 #include "HuiFxEffect.h"
+#include "huisynchronizationobserver.h"
 #include <alf/AlfTransEffectPlugin.h>
 #include <uiacceltk/HuiDisplay.h>
 
@@ -45,7 +49,8 @@
     public MHuiDisplayRefreshObserver, 
     public MHuiBitmapProvider,
     public MAlfGfxEffectObserver,
-    public MHuiRosterObserver
+    public MHuiRosterObserver,
+    public MHuiSynchronizationObserver
     {
 	// Helper class for keeping ongoing effects in order. Kept in iEffectCleanupStack
     private:
@@ -224,6 +229,9 @@
     void NotifyRosterDrawStart(CHuiDisplay& aDisplay);
     void NotifyRosterDrawEnd(CHuiDisplay& aDisplay);
     
+    // From MHuiSynchronizationObserver
+    void Synchronized(TInt aId);
+    
 private:    
     
     class CFullScreenEffectState;
@@ -384,10 +392,26 @@
      */
     CHuiLayout* FindLayoutByEffectHandle(TInt aHandle);
     
-    /*
+    /**
      * HasActiveEffect
+	 *
+	 *	Note. The visual might not have effect, but it is child for visual that has effect. 
+	 *	In both cases, this method returns ETrue. Otherwise EFalse.
+	 *
+	 *	@param	aVisual	Visual to be checked for effect participation.
      */
     TBool HasActiveEffect(CHuiVisual* aVisual);
+
+    /**
+     * HasActiveEffect
+	 *
+	 *	Note. The visual might not have effect, but it is child for visual that has effect. 
+	 *	In both cases, this method returns ETrue. Otherwise EFalse.
+	 *
+	 *	@param	aVisual	Visual to be checked for effect participation.
+	 *	@param  aIndex	Index of the effect item in iEffectCleanupStack, if found. Otherwise KErrNotFound
+     */    
+    TBool HasActiveEffect(CHuiVisual* aVisual, TInt& aIndex);
     
    /*
 	*	FindEffectHandle
@@ -627,6 +651,7 @@
             CHuiControlGroup& aGroup);
     
     void VisualizeControlGroupOrderL(
+            CAlfScreen& aScreen,
             CHuiRoster& aRoster, 
             CHuiControlGroup& aGroup);
     
@@ -715,9 +740,6 @@
     // with visuals in iFullscreenEffectControlGroup
     RArray<TEffectCleanupStruct> iEffectCleanupStack;
     
-    // Effects that have finished by their own, or framework requested to end them
-    RArray<TInt> iFinishedEffects;
-    
     // Same as iEffectCleanupStack, but only the ones that can be now cleaned away.
     // See method RemoveTemporaryPresenterVisuals.
     RArray<TInt> iFinishedCleanupStackEffects;
@@ -896,6 +918,11 @@
     TBool iForcedSwRendering;
     TBool iLowMemoryMode;
     THuiMemoryLevel iCurrentMemoryLevel;
+    
+    #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    TInt iTempTotalActiveVisualCount;
+    TInt iTempTotalPassiveVisualCount;
+    #endif
     };    
 
 #endif // __ALF_BRIDGE_H__
\ No newline at end of file
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h	Mon Feb 22 17:57:49 2010 +0200
@@ -42,6 +42,9 @@
 
     /** Group for showing effects */
     EAlfFullScreenEffectContainer,
+    
+    /** Group for FPS indicator */
+    EAlfFpsIndicatorContainer
     };
 
 NONSHARABLE_CLASS( TAlfControlGroupEntry )  
@@ -107,6 +110,11 @@
          */
         TBool IsVisualTreeVisibilityChanged();
 
+        /**
+         * Returns amount of fixed control groups.
+         */
+        TInt FixedControlGroupCount() const;
+        
 	public:
 	        	   
 	    RArray<TAlfControlGroupEntry> iControlGroups;
@@ -115,6 +123,7 @@
 	   	CHuiDisplay* iDisplay; 
 	    CHuiControlGroup* iFloatingSpriteControlGroup; 
 	    CHuiControlGroup* iFullscreenEffectControlGroup; 
+	    CHuiControlGroup* iFpsControlGroup;
 	    
 	    TBool iVisualTreeVisibilityChanged;
 	    TInt iScreenNum;
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Mon Feb 22 17:57:49 2010 +0200
@@ -37,7 +37,8 @@
     EDsNotifyNativeWindowData,
     EAlfBridgerBlindSend,
     EAlfSetScreenRotation, 
-    EAlfGetNativeWindowHandles
+    EAlfGetNativeWindowHandles,
+    EAlfSynchronize
     };
 
 enum TAlfCompOps{
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -940,16 +940,18 @@
 // 
 void CAlfAppSrvSessionBase::GetSystemEvents(const RMessage2* aMessage)
     {
-    if (aMessage && iData->iSystemEvent.IsNull())
+    __ASSERT_DEBUG(aMessage, USER_INVARIANT());
+    if (aMessage)
         {
-        iData->iSystemEvent = *aMessage;
+        if (iData->iSystemEvent.IsNull())
+            {
+            iData->iSystemEvent = *aMessage;
+            }
+        else 
+            {
+            aMessage->Complete(KErrInUse);
+            }
         }
-    else 
-        {
-	    __ASSERT_DEBUG(aMessage, USER_INVARIANT());
-        aMessage->Complete(KErrInUse);
-        }
-        
     }
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -665,6 +665,10 @@
 //
 EXPORT_C CAlfAppUi::~CAlfAppUi()
     {
+    #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    delete AMT_CONTROL();
+    #endif
+    
     delete iData;
     }
   
@@ -763,6 +767,17 @@
 EXPORT_C void CAlfAppUi::ConstructL()
     {
     __ALFLOGSTRING( "CAlfAppUi::ConstructL start" )
+    
+    #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    __ALFLOGSTRING( "CAlfAppUi::ConstructL. Open and initialize ALF module test chunk. " )
+    // Initiliaze global data in TLS. 
+    User::LeaveIfError(Dll::SetTls(new(ELeave) CAlfModuleTestDataControl()));
+    // Open global module testing chunk and mutex
+    User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects());
+    __ALFLOGSTRING( "CAlfAppUi::ConstructL. ALF module test chunk ready. " )
+    #endif
+     
+  
     TInt flags = EStandardApp|ENoScreenFurniture|ENonStandardResourceFile|EAknEnableSkin;
     CCoeEnv* coe = CCoeEnv::Static();
     iData =  new (ELeave) CAlfAppUiData();
@@ -903,6 +918,10 @@
 	// Load Tfx server client API plugin, if exists
 	iData->iServer->CreateTfxServerPlugin();
     
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+    iData->iBridgeObj->ForceSwRendering(ETrue);
+#endif
+
     __ALFLOGSTRING( "CAlfAppUi::ConstructL end" )
     }
     
--- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -70,6 +70,8 @@
 #include "huicanvasgc.h"
 #include "huicanvasrenderbuffer.h"
 
+#include "alfrenderstageutils.h" // for KAlfPSUidSynchronizer & KAlfPSKeySynchronizer
+
 #ifdef HUI_DEBUG_TRACK_DRAWING
 #include <alfcommanddebug.h>
 #endif
@@ -88,7 +90,6 @@
 //const TReal32 KAlfVisualDefaultOpacity = 0.5f;
 
 _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP");
-const TInt KAlfNumberOfFixedControlGroups = 2;
 
 // This debug option prints window group order with __ALFLOGSTRING
 //#define ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
@@ -598,7 +599,6 @@
 	    delete iAlfRegisteredEffects[i].iEffectFile;
 	    }
 	iAlfRegisteredEffects.Close();
-    iFinishedEffects.Close();
     delete iEffectEndTimer;
     iDeadControlGroups.Close();
     iEffectWindowGroups.Close();
@@ -739,9 +739,14 @@
 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFloatingSpriteControlGroup), KHuiRosterShowAtTop, screenNumber); 
 	ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFullscreenEffectControlGroup), KHuiRosterShowAtTop, screenNumber); 
     
-	
 	screen->iFloatingSpriteControlGroup->SetAcceptInput(EFalse);
 	screen->iFullscreenEffectControlGroup->SetAcceptInput(EFalse);
+	
+	if ( screen->iFpsControlGroup )
+	    {
+	    ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFpsControlGroup), KHuiRosterShowAtTop, screenNumber); 
+	    screen->iFpsControlGroup->SetAcceptInput(EFalse);
+	    }
     }
 
 //------------------------------------------------------------------------------
@@ -762,6 +767,12 @@
     
     screen->iFloatingSpriteControlGroup->SetAcceptInput(EFalse);
     screen->iFullscreenEffectControlGroup->SetAcceptInput(EFalse);
+    
+    if ( screen->iFpsControlGroup )
+	    {
+	    ShowControlGroupL(screen->iDisplay->Roster(), *(screen->iFpsControlGroup), KHuiRosterShowAtTop, screenNumber); 
+	    screen->iFpsControlGroup->SetAcceptInput(EFalse);
+	    }
     }
 
 
@@ -957,8 +968,15 @@
                 // is cleared when effect has finished.
                 RPointerArray<CHuiLayout> familyTree;
                 ListFamilyTreeL(familyTree, layout); // recursively dig the family tree
+                TBool anyVisualHasEffect(EFalse);
+                TInt familyIndex(0);
+                TInt familySize = familyTree.Count();
+                while(familyIndex < familySize && !anyVisualHasEffect)
+                    {
+                    anyVisualHasEffect = HasActiveEffect(familyTree[familyIndex++]);
+                    }
                 
-                if (HasActiveEffect(layout))
+                if (anyVisualHasEffect)
                     {
                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
@@ -1120,7 +1138,7 @@
             // has been solved by deleting the tag when window server wants to delete
             // the group. Window server no longer has it, but we keep it alive for a while
             // to show the effect. The group will be deleted when the effect ends.
-            aWhere = aRoster.Count() - KAlfNumberOfFixedControlGroups;
+            aWhere = aRoster.Count() - screen->FixedControlGroupCount();
             }
         }
 
@@ -1146,7 +1164,7 @@
 #endif
 
 #ifdef ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
-        VisualizeControlGroupOrderL(aRoster, aGroup);
+        VisualizeControlGroupOrderL(*screen, aRoster, aGroup);
 #endif
     
     }
@@ -1240,13 +1258,13 @@
     else if (aWhere == KHuiRosterShowAtTop)
         {
         // Topmost
-        aRoster.ShowL(aGroup, aRoster.Count() - KAlfNumberOfFixedControlGroups);
+        aRoster.ShowL(aGroup, aRoster.Count() - screen->FixedControlGroupCount());
         }
     else
         {
         TInt index = 0; // Index for Window group control groups
         TBool added = EFalse;
-        for (TInt i=0; i<aRoster.Count() - KAlfNumberOfFixedControlGroups; i++)
+        for (TInt i=0; i<aRoster.Count() - screen->FixedControlGroupCount(); i++)
             {
             if (index == aWhere)
                 {
@@ -1266,7 +1284,7 @@
         if (!added)
             {
             // Topmost
-            for (TInt i=aRoster.Count()-KAlfNumberOfFixedControlGroups; i >= 0; i--)
+            for (TInt i=aRoster.Count() - screen->FixedControlGroupCount(); i >= 0; i--)
                 {
                 if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer)
                     {
@@ -1455,10 +1473,25 @@
     }
 
 // ---------------------------------------------------------------------------
+// Check if effect has been flagged as opaque
+// ---------------------------------------------------------------------------
+// 
+static TBool IsOpaqueEffect(CHuiFxEffect* aEffect)
+    {
+    return aEffect && (aEffect->EffectFlags() & KHuiFxOpaqueHint);
+    }
+
+// ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // 
 TBool CAlfBridge::IsVisualOpaque(CHuiVisual& aVisual)
     {
+    // Effect with opaque hint overrides everything else.
+    if (IsOpaqueEffect( aVisual.Effect() ))
+        {
+        return ETrue; // Opaque
+        }    
+
     TBool transparent = EFalse;
     
     // TODO: We should check transformation too and perhaps parent transformations as well ?
@@ -1592,8 +1625,29 @@
     //iActiveVisualCount = 0;
     iBgSurfaceFound = EFalse;
     //iPaintedArea = 0;  
+    
+    // Check if effect group has an effect with opaque hint.
+    CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup);
+    CHuiControl& fxcontrol = fxcontrolgroup.Control(0);
+    CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0);
+    CHuiVisual* fxExternalContent = fxlayout->ExternalContent();
+    
+    if (fxlayout && IsOpaqueEffect(fxlayout->Effect()))
+        {
+        fullscreenCovered = ETrue;    
+        }
+    else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect()))
+        {
+        fullscreenCovered = ETrue;
+        }    
+    
+    #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    iTempTotalActiveVisualCount = 0;
+    iTempTotalPassiveVisualCount = 0;
+    #endif
+	
     // skip the topmost (effect) layer, start from floating sprite group
-    for (TInt j=screen->iDisplay->Roster().Count() - 2; j>=0; j--)
+    for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--)
         {                
 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
         TInt activevisualcount = 0;
@@ -1602,6 +1656,13 @@
 
         CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
         CHuiControl& control = controlgroup.Control(0);
+
+        if (control.Role() == EAlfFpsIndicatorContainer)
+            {
+            // FPS container doesn't contain canvas visuals
+            continue;
+            }
+
         CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
 #ifdef HUI_DEBUG_TRACK_DRAWING	
         if ( layout->Tracking() )
@@ -1609,7 +1670,7 @@
             RDebug::Print(_L("CAlfBridge::HandleVisualVisibility: tracked visual 0x%x"), canvasVisual);
             }
 #endif            
-
+            
         // Dont mess with alf control group visuals, alf session handling does it for us
         // just add the rect to covered region because alf draws solid background.
         if (control.Role() == EAlfSessionContainer)
@@ -1641,6 +1702,12 @@
         TBool subTreeCovered = EFalse;
         TBool hasActiveVisualsInVisualTree = HandleLayoutVisualVisibility( layout, controlgroup, control, fullscreenCovered, fullscreen, screen, subTreeCovered, IsVisualOpaque(*layout)  );    
         TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree);        
+
+        // If root visuals effect is marked as opaque, then add whole screen area as covered.
+        if (!fullscreenCovered)
+            {
+            fullscreenCovered = IsOpaqueEffect(layout->Effect());
+            }                    
         
 		// If we layout is active setup the fade effects. Also if it is inactive, but has been
 		// flagged as containing fade effect, then run the setup as well so that effects which
@@ -1708,11 +1775,11 @@
     if (fadeEffectInScreen)
         {
         TBool firstFadedWindowGroupFound = EFalse;
-        for (TInt j=0; j<screen->iDisplay->Roster().Count() - 2; j++) // skip the topmost (effect) layer 
+        for (TInt j=0; j<screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer 
             {                
             CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
             CHuiControl& control = controlgroup.Control(0);
-            CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
+            CHuiVisual* layout = &control.Visual(0);
             if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag))
                 {
                 if (firstFadedWindowGroupFound)
@@ -1725,6 +1792,11 @@
                 }
             }
         }
+
+    AMT_FUNC_EXC(AMT_DATA()->iActiveVisualCount = iTempTotalActiveVisualCount;
+                 AMT_DATA()->iPassiveVisualCount = iTempTotalPassiveVisualCount;
+                 AMT_DATA()->PrintState()
+                 );
     }
 
 TBool CAlfBridge::HandleLayoutVisualVisibility(
@@ -1851,6 +1923,10 @@
                 aScreen->iDisplay->SetDirty();
                 }                
             
+            #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+            iTempTotalPassiveVisualCount++;
+            #endif
+            
     #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
             passivevisualcount++;
     #endif
@@ -1946,10 +2022,17 @@
                     iTempRegion.Tidy();                                    
                     }
                 }
+            
+            // If effect is marked as opaque, then add whole visual area as covered.
+            if (IsOpaqueEffect(canvasVisual->Effect()))
+                {
+                iTempRegion.AddRect(visualDisplayRect);
+                iTempRegion.Tidy();
+                }            
             }                                        
-        }
-    
-    visualTreeActive |= visualIsActive; 
+        visualTreeActive |= visualIsActive;
+        } // for loop end : children checking loop
+     
     return visualTreeActive;
     }
 
@@ -1963,17 +2046,18 @@
         return;
             
     CAlfScreen* screen = iAlfScreens[0]; // TODO  
-    for (TInt j=screen->iDisplay->Roster().Count() - 2; j>=0; j--) // skip the topmost (effect) layer 
+    for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) // skip the topmost (effect) layer 
         {                
         CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j);
         CHuiControl& control = controlgroup.Control(0);
 
-        if ( control.Role() == EAlfSessionContainer )
+        if ( control.Role() == EAlfSessionContainer ||
+             control.Role() == EAlfFpsIndicatorContainer )
             {
             continue;
             }
         
-        CHuiLayout* layout = (CHuiLayout*)&control.Visual(0);
+        CHuiVisual* layout = &control.Visual(0);
         for (TInt i=layout->Count()-1; i >= 0; i--)
             {
             CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)(&layout->Visual(i));
@@ -2046,6 +2130,16 @@
 
         switch (data.iOp)
             {
+            case EAlfDSSynchronize:
+                {
+                TInt id = data.iInt1;
+                if ( iHuiEnv )
+                    {
+                    iHuiEnv->Synchronize( id, this );
+                    }
+                }
+                break;
+                
             case EAlfDSCreateNewDisplay:
                 {
                 AddNewScreenL(NULL);
@@ -2330,6 +2424,10 @@
     
     iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFloatingSpriteControlGroup)); 
     iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup));
+    if ( iAlfScreens[aScreenNumber]->iFpsControlGroup )
+        {
+        iAlfScreens[aScreenNumber]->iDisplay->Roster().Hide(*(iAlfScreens[aScreenNumber]->iFpsControlGroup));
+        }
     delete iAlfScreens[aScreenNumber];
     iAlfScreens.Remove( aScreenNumber );
     }
@@ -2464,7 +2562,17 @@
 // 
 void CAlfBridge::DestroyWindow(CHuiVisual* aVisual, TBool aUseForce)
     {
-    if ( !aUseForce && HasActiveEffect(aVisual) )
+    TInt index;
+    TBool visualParticipatingInEffect = HasActiveEffect(aVisual, index);
+    
+    TBool effectIsExitEffect(ETrue);
+    if (index != KErrNotFound)
+        {
+        effectIsExitEffect = iEffectCleanupStack[index].iHideWhenFinished;
+        }
+    // effects inside application may need to destroy window to get the new content visible. 
+    // Even when there is effect on the layout, destruction of a child window must be allowed.
+    if ( !aUseForce && visualParticipatingInEffect && effectIsExitEffect )
         {
         // this visual will be destroyed on the effect call back.
         __ALFFXLOGSTRING1("CAlfBridge::DestroyWindow - not destroying 0x%x", aVisual);
@@ -2488,7 +2596,22 @@
     // check if visual is having an effect at the moment. This could occur, if options menu is exited (with effect) and then 
     // application is exited. EHuiVisualFlagDrawOnlyAsExternalContent is indication that
     // there might be effect on this visual. It is not guaranteen.
-
+    
+    if (!aUseForce)
+        {
+        // we can remove from iEffectCleanupStack only when this method was called from HandleDestroyWindow. Otherwise
+        // messing iEffectCleanupStack is likely to cause forever loop in some RemoveTemporaryPresenterVisuals method
+        for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
+            {
+            TEffectCleanupStruct& effectItem = iEffectCleanupStack[i];
+            if (aVisual == effectItem.iEffectedVisual)
+                {
+                iEffectCleanupStack.Remove(i);
+                AMT_DEC_COUNTER(iAlfBridgeEffectCleanupStackCount);
+                break;
+                }
+            }
+        }
     delete aVisual;
     }
 // ---------------------------------------------------------------------------
@@ -2894,7 +3017,8 @@
 // 
 void CAlfBridge::SetWindowActiveL(CHuiVisual* aVisual, TBool aActive)
     {
-    if (!HasActiveEffect(aVisual))
+    TInt effectIndex;
+    if (!HasActiveEffect(aVisual, effectIndex))
         {
         // Does not have effect
         if (aActive)
@@ -2915,7 +3039,15 @@
         if (aActive)
             {
 			// this prevents windows appearing before their "effected" time
-            aVisual->SetFlag(EHuiVisualFlagShouldBeShown);
+            if (!iEffectCleanupStack[effectIndex].iHideWhenFinished)
+                {
+                // this is appear effect. Lets show it
+                aVisual->iOpacity.Set(KAlfVisualDefaultOpacity);
+                }
+            else
+                {
+                aVisual->SetFlag(EHuiVisualFlagShouldBeShown);
+                }
             aVisual->ClearFlag(EHuiVisualFlagShouldBeHidden);
             }
         else
@@ -3661,11 +3793,14 @@
     {
     TInt windowNodeId = aData.iInt1;  
     TBool faded = aData.iInt2;
-
-    CHuiVisual* viz = (CHuiVisual*)FindVisual(windowNodeId);    
-    if (!viz)
+    MWsWindowTreeNode::TType type = (MWsWindowTreeNode::TType)(TInt)aData.iPtr;
+    CHuiVisual* viz = NULL;
+    if (type != MWsWindowTreeNode::EWinTreeNodeGroup)
         {
-        // Visual not found, it could be window group. It must be searched with other method.
+        viz = (CHuiVisual*)FindVisual(windowNodeId);
+        }
+    else
+        {
         CHuiControlGroup* cg = FindControlGroup(windowNodeId, 0); // TODO: Screen            
         if (cg) 
             {
@@ -3913,8 +4048,6 @@
                     if ( aEvent.iAction != AknTransEffect::EApplicationExit && aToLayout->Flags() & EHuiVisualFlagInactive)
                         {
                         aToLayout->iOpacity.Set(1.0f);
-                        failed = ETrue;
-                        return failed;
                         }
                         
                     if (aToLayout)
@@ -3939,11 +4072,11 @@
                             {
                             if (aEvent.iRect != TRect())
                                 {
-                                TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle ) );
+                                TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ));
                                 }
                             else
                                 {
-                                TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle ) );
+                                TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) );
                                 }
                             effect = NULL;
                             // only use the effect if the effect file was correctly parsed
@@ -4424,6 +4557,11 @@
     CHuiCanvasVisual* temporaryPresenterVisual = NULL;
     TInt enableEffect = ETrue;
     
+    if (aSourceVisual->iOpacity.Now() >= 0.01)
+        {
+        aSourceVisual->SetFlag(EHuiVisualFlagShouldBeShown);
+        }
+    
     aSourceVisual->ClearFlags(EHuiVisualFlagShouldBeInactive | EHuiVisualFlagShouldBeUnderOpaqueHint);
     if (aIsExitEffect) 
         {
@@ -4463,7 +4601,7 @@
                     aSourceVisual, 
                     temporaryPresenterVisual,
                     ETrue,
-                    EFalse);
+                    aIsExitEffect);
             iEffectCleanupStack.AppendL(item);
             }
         else
@@ -4472,7 +4610,7 @@
             // aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
             TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle,
                         aSourceVisual, NULL, EFalse,
-                        EFalse);
+                        aIsExitEffect);
             iEffectCleanupStack.AppendL(item);
             }
      }
@@ -4533,7 +4671,7 @@
         }
     else
         {
-        AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, ETrue, itemsDestroyed, EFalse);
+        AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse);
         __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout);
         }
     iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue;
@@ -4573,7 +4711,6 @@
 
 void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data )
     {
-    TInt err = KErrNone;
     TInt action = data.iInt1;
     TInt length = data.iInt2;
     __ALFFXLOGSTRING1("HandleGfxControlEffectsL - Reading bridge data %d", (TInt)data.iPtr);
@@ -4612,16 +4749,8 @@
         return;
         }
     iAlfScreens[0]->iDisplay->SetDirty();
-
     iHuiEnv->ContinueRefresh();
 
-    if (visual && err != KErrNone)
-        {
-        // if the effect loading failed too soon, we must call our callback ourselves
-        //        RDebug::Print(_L("HandleGfxControlEffectsL - effect not set - going directly to callback"));
-        AlfGfxEffectEndCallBack(fxData->iHandle);
-        }
-
     delete iControlEffectData;
     iControlEffectData = NULL;
 
@@ -4675,7 +4804,7 @@
             }
         if (layoutEffectable)
             {
-            TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle ) );
+            TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) );
             }
         else
             {
@@ -4731,11 +4860,7 @@
         sourceViz->iOpacity.Set(0.0f);
         sourceViz->ClearFlag(EHuiVisualFlagShouldBeHidden); // it is now hidden
         }
-	else
-		{
-        // visual may be transparent after manipulation of the effect
-	   	sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity); 
-		}
+	
     if (showVisual)
         {
         sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity);
@@ -4875,10 +5000,18 @@
 
 TBool CAlfBridge::HasActiveEffect(CHuiVisual* aVisual)
     {
+    TInt dummy;
+    return HasActiveEffect(aVisual, dummy);
+    }
+
+TBool CAlfBridge::HasActiveEffect(CHuiVisual* aVisual, TInt& aIndex)
+    {
+    aIndex = KErrNotFound;
     for (TInt i = 0; i < iEffectCleanupStack.Count(); i++)
         {
         if (aVisual == iEffectCleanupStack[i].iEffectedVisual)
             {
+            aIndex = i;
             return ETrue;
             }
         }
@@ -4935,7 +5068,10 @@
                     {
                     itemsRemoved++;
                     }
-                iEffectCleanupStack.Remove(i);
+                if (iEffectCleanupStack.Count() > i)
+                    {
+                    iEffectCleanupStack.Remove(i);
+                    }
                 iFinishedCleanupStackEffects.Remove(0);
                 i--;
                 }
@@ -4970,7 +5106,7 @@
     {
     // We need a delay to prevent the refresh from being messed up
     // We try a short delay before clearing everything up.
-    __ALFFXLOGSTRING1("AlfGfxEffectEndCallBack, append handle %d", aHandle );
+    __ALFFXLOGSTRING1("AlfGfxEffectEndCallBack, handle %d", aHandle );
     //    RDebug::Print(_L("AlfGfxEffectEndCallBack, append handle %d"), aHandle );
     // If the handle cannot be appended, the function returns an error.
     // However, if the memory is low, there is nothing we can do about it.
@@ -4978,10 +5114,7 @@
     // If there are already other handles in the queue, the handler will not
     // be called for this handle, but all handles that have been left hanging
     // around will be cleared when HandleGfxStopEffectsL is called
-  
-    
-    iFinishedEffects.Append(aHandle);
-    	
+
     // iFinishedCleanupStackEffects.Append(aHandle);
     if (!iEffectEndTimer->IsActive())
         {
@@ -5105,6 +5238,14 @@
             __ALFLOGSTRING1(">> %d EFFECT GROUP", i);                                                                
 #endif
             }
+        else if (indexedGroup.Control(0).Role() == EAlfFpsIndicatorContainer)
+            {
+#ifdef  HUI_DEBUG_TRACK_DRAWING
+            __ALFLOGSTRING3(">> %d FPS GROUP %S, %d", i, &processName, clientWindowGroupId );                                                                
+#else
+            __ALFLOGSTRING1(">> %d FPS GROUP", i);                                                                
+#endif
+            }
         else 
             {
 #ifdef  HUI_DEBUG_TRACK_DRAWING
@@ -5146,15 +5287,16 @@
 #endif        
 
 #ifdef ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
-void CAlfBridge::VisualizeControlGroupOrderL(CHuiRoster& aRoster, CHuiControlGroup& /*aGroup*/)
+void CAlfBridge::VisualizeControlGroupOrderL(CAlfScreen& aScreen, CHuiRoster& aRoster, CHuiControlGroup& /*aGroup*/)
     {       
     TInt nbrofcolums = 3;
     TInt nbrofrows = 3;
     TInt gridIndex = 0;
     TBool skipEmpty = EFalse;
-    if (aRoster.Count() > 3)
+    TInt skipCount = aScreen.FixedControlGroupCount() + 1;
+    if (aRoster.Count() > skipCount)
         {
-        for (TInt i=aRoster.Count() - 3; i>0; i--)
+        for (TInt i=aRoster.Count() - skipCount; i>0; i--)
             {
             CHuiControl& control = aRoster.ControlGroup(i).Control(0);
             if (skipEmpty)
@@ -5187,7 +5329,7 @@
     iAlfScreens[0]->iDisplay->SetClearBackgroundL(CHuiDisplay::EClearWithSkinBackground);            
     }
 #else
-void CAlfBridge::VisualizeControlGroupOrderL(CHuiRoster& /*aRoster*/, CHuiControlGroup& /*aGroup*/)
+void CAlfBridge::VisualizeControlGroupOrderL(CAlfScreen& /*aScreen*/, CHuiRoster& /*aRoster*/, CHuiControlGroup& /*aGroup*/)
     {       
     }
 #endif    
@@ -5389,7 +5531,7 @@
             aScreen->iSwRenderingTarget = new CFbsBitmap;
             if (aScreen->iSwRenderingTarget)
                 {
-                aScreen->iSwRenderingTarget->Create(aScreen->Size(), EColor16MA);
+                aScreen->iSwRenderingTarget->Create(aScreen->Size(), EColor16MAP); 
                 modified = ETrue;
                 }
             }
@@ -5510,4 +5652,13 @@
     TRAP_IGNORE(UploadSwRenderingTargetL(iAlfScreens[screenNumber]));
     }
 
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// 
+void CAlfBridge::Synchronized(TInt aId)
+    {
+    // Use P&S for now.
+    RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId );
+    }
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -233,6 +233,13 @@
 			aMessage.Complete( EAlfBridgerSendChunk );
             return;
             }
+        case EAlfSynchronize:
+            {
+            iServer.Bridge()->AddData( EAlfDSSynchronize, aMessage.Int0() );
+            aMessage.Complete( KErrNone );
+            }
+            break;
+            
         default:
             {
             doComplete= ETrue;
@@ -978,11 +985,16 @@
     TUint32 nodeId = (TUint32)iStream->ReadUint32L();
     TRect extent = TRect(0,0,0,0);
     ReadRectL(extent, iStream); 
+    TBool isDSA = (TUint32)iStream->ReadUint32L();
     CAlfNodeVisual* node = (CAlfNodeVisual*)FindNode( nodeId );
     if ( node && node->Window() )
         {
         // SetSurfaceExtent is not supported for image visual
         node->Window()->SetSurfaceExtent( extent );
+        if (isDSA)
+            {
+            node->Window()->SetLayerUsesAplhaFlag(KWindowIsDSAHost);
+            }
         }
     else if( node ) // this would mean that node has being orphaneded but not yet deleted
         {
--- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -255,7 +255,7 @@
             {
             CAlfNode* parentNode = iModel->FindNode( iParent->iId );
             __ASSERT_DEBUG(parentNode, USER_INVARIANT());
-            if (parentNode->HasChildren())
+            if (parentNode  && parentNode->HasChildren())
                 {
                 // parent node is not added to the list
                 // the anims, cursor and sprites directly in this parent are added to the list
@@ -838,7 +838,7 @@
         }
     // starting from the first child, loop until this one is found.
     
-    while( previousSibling->iSibling != this)
+    while( previousSibling && previousSibling->iSibling != this)
         {
         previousSibling = previousSibling->iSibling;
         }
@@ -879,7 +879,7 @@
         }
     if (iFadeState != iPostedFadeState)
         {
-        iModel->Server().Bridge()->AddData( EAlfDSSetFadeEffect, iId , iFadeState);
+        iModel->Server().Bridge()->AddData( EAlfDSSetFadeEffect, iId , iFadeState, (TAny*)iType);
         iPostedFadeState = iFadeState;
         }
     }
--- a/uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -48,6 +48,7 @@
 _LIT8(KAlfFullScreenEffectContainerControlTag, "EFFECT");
 //_LIT8(KAlfWindowGroupTemporaryRemoveControlTag, "WGTEMP");
 
+const TInt KAlfNumberOfFixedControlGroups = 2;
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -163,8 +164,17 @@
     _LIT(KRDSupport, "c:\\resource\\errrd" );
     if (CHuiStatic::FsSession().Handle() && BaflUtils::FileExists( CHuiStatic::FsSession(), KRDSupport ))
         {
+        iFpsControlGroup = &aHuiEnv.NewControlGroupL(0xDEADBEEF + 20 + iScreenNum); // TODO
+    	
+    	CHuiControl* fpsCntrl = new (ELeave) CHuiControl(aHuiEnv);	    
+	    CleanupStack::PushL(fpsCntrl);
+	    fpsCntrl->ConstructL();
+	    fpsCntrl->SetRole(EAlfFpsIndicatorContainer);
+	    iFpsControlGroup->AppendL(fpsCntrl);
+	    CleanupStack::Pop(fpsCntrl);
+        
         // FPS Counter with hitchcock drawing
-        iFPSText = CHuiTextVisual::AddNewL(*effectCntrl, effectLayout);
+        iFPSText = CHuiTextVisual::AddNewL(*fpsCntrl, NULL);
         iFPSText->SetColor(KRgbBlue);
         iFPSText->SetFlag(EHuiVisualFlagManualLayout);
         iFPSText->SetPos(THuiRealPoint(300,20)); // could be adjusted
@@ -194,6 +204,8 @@
 	// this deletes also control and layout
 	delete iFloatingSpriteControlGroup;
 	
+	delete iFpsControlGroup;
+	
 	delete iDisplay;
 	iControlGroups.Close();
 	
@@ -222,3 +234,12 @@
     return iVisualTreeVisibilityChanged;    
     }
      
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// 
+TInt CAlfScreen::FixedControlGroupCount() const
+    {
+    return !iFpsControlGroup ? 
+        KAlfNumberOfFixedControlGroups :
+        KAlfNumberOfFixedControlGroups + 1;
+    }
--- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -610,6 +610,7 @@
         case EAlfBridgerRequestDataBlock:
         case EAlfBridgerAsyncronousData:
         case EDsNotifyNativeWindowData:
+        case EAlfSynchronize:
             {
             server->WindowTree()->HandleMessageL( aMessage );
             return;
--- a/uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -611,7 +611,7 @@
 
 void CBgAnimHost::DataReceived( CSensrvChannel& aChannel, TInt aCount, TInt aDataLost )
     {
-    if (iPlugin && iPlugin->receivesensordata);
+    if (iPlugin && iPlugin->receivesensordata)
         {
         iPlugin->receivesensordata((void*)&aChannel, aCount, aDataLost);
         }
--- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Mon Feb 22 17:57:49 2010 +0200
@@ -1581,4 +1581,8 @@
 	?SetForegroundBitmapL@CHuiDisplay@@QAEXPAVCFbsBitmap@@@Z @ 1580 NONAME ; void CHuiDisplay::SetForegroundBitmapL(class CFbsBitmap *)
 	?ForegroundBitmap@CHuiDisplay@@QBEPAVCFbsBitmap@@XZ @ 1581 NONAME ; class CFbsBitmap * CHuiDisplay::ForegroundBitmap(void) const
 	?HasCommandBuffers@CHuiCanvasVisual@@QBEHH@Z @ 1582 NONAME ; int CHuiCanvasVisual::HasCommandBuffers(int) const
+	?SkinContentChanged@CHuiS60Skin@@UAEXXZ @ 1583 NONAME ; void CHuiS60Skin::SkinContentChanged(void)
+	?SkinPackageChanged@CHuiS60Skin@@UAEXW4TAknsSkinStatusPackageChangeReason@@@Z @ 1584 NONAME ; void CHuiS60Skin::SkinPackageChanged(enum TAknsSkinStatusPackageChangeReason)
+	?SkinConfigurationChanged@CHuiS60Skin@@UAEXW4TAknsSkinStatusConfigurationChangeReason@@@Z @ 1585 NONAME ; void CHuiS60Skin::SkinConfigurationChanged(enum TAknsSkinStatusConfigurationChangeReason)
+	?Synchronize@CHuiEnv@@QAEXHPAVMHuiSynchronizationObserver@@@Z @ 1586 NONAME ; void CHuiEnv::Synchronize(int, class MHuiSynchronizationObserver *)
 
--- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Mon Feb 22 17:57:49 2010 +0200
@@ -1979,4 +1979,11 @@
 	_ZTI15MHuiFxParameter @ 1978 NONAME
 	_ZTV15MHuiFxParameter @ 1979 NONAME
 	_ZNK16CHuiCanvasVisual17HasCommandBuffersEi @ 1980 NONAME
+	_ZN11CHuiS60Skin18SkinContentChangedEv @ 1981 NONAME
+	_ZN11CHuiS60Skin18SkinPackageChangedE34TAknsSkinStatusPackageChangeReason @ 1982 NONAME
+	_ZN11CHuiS60Skin24SkinConfigurationChangedE40TAknsSkinStatusConfigurationChangeReason @ 1983 NONAME
+	_ZThn28_N11CHuiS60Skin18SkinContentChangedEv @ 1984 NONAME
+	_ZThn28_N11CHuiS60Skin18SkinPackageChangedE34TAknsSkinStatusPackageChangeReason @ 1985 NONAME
+	_ZThn28_N11CHuiS60Skin24SkinConfigurationChangedE40TAknsSkinStatusConfigurationChangeReason @ 1986 NONAME
+	_ZN7CHuiEnv11SynchronizeEiP27MHuiSynchronizationObserver @ 1987 NONAME
 
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h	Mon Feb 22 17:57:49 2010 +0200
@@ -37,6 +37,7 @@
 const TInt KHuiFxDelayRunUntilFirstFrameHasBeenDrawn = 0x10;
 const TInt KHuiFxDisableBackground = 0x20;
 const TInt KHuiFxAlwaysBlend = 0x40;
+const TInt KHuiFxOpaqueHint = 0x80;
 
 class MAlfGfxEffectObserver
     {
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h	Mon Feb 22 17:57:49 2010 +0200
@@ -62,6 +62,7 @@
         };
     
     MHuiFxEffectCacheNode *Find(MHuiFxEffectCacheNode *aNode);
+    MHuiFxEffectCacheNode *FindDuplicate(MHuiFxEffectCacheNode *aNode);
     static bool Compare(MHuiFxEffectCacheNode *aNode1, MHuiFxEffectCacheNode *aNode2);
     void Remove(RPointerArray<MHuiFxEffectCacheNode> &aEffects, MHuiFxEffectCacheNode *aNode);
     void Remove(RHashMap<TInt, MHuiFxEffectCacheNode*> &aMap, MHuiFxEffectCacheNode *aNode);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h	Mon Feb 22 17:57:49 2010 +0200
@@ -155,6 +155,10 @@
     TInt             iBuffersInUse;
     
 private:
+    
+    TBool FxmlUsesInput1(CHuiFxEffect& aEffect);
+    
+private:
     // Render buffer management --- native implementations
     virtual CHuiFxRenderbuffer* AcquireNativeRenderbuffer(const TSize& aDesiredSize) = 0;
     virtual void ReleaseNativeRenderbuffer(CHuiFxRenderbuffer* aBuffer) = 0;
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiRenderSurface.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiRenderSurface.h	Mon Feb 22 17:57:49 2010 +0200
@@ -104,6 +104,12 @@
     virtual void SwapBuffers() = 0;
 
     /**
+     * Synchronizes the context. All rendering calls for the currently bound context are guaranteed 
+     * to be executed, when thsi method returns.
+     */
+    virtual void Finish() = 0;
+
+    /**
      * Binds a texture to the surface to be used during subsequent drawing
      * operations.
      *
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h	Mon Feb 22 17:57:49 2010 +0200
@@ -379,6 +379,9 @@
 #ifdef HUI_DEBUG_TRACK_DRAWING
     CAlfCommandDebug* iCommandDebugger;
 #endif
+    
+    // Boolean flag indicating if render buffer ought to be used.
+    TBool iEnableRenderBuffer;
   };
     
 #endif  // __HUICANVASWSPAINTER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,52 @@
+/*
+* 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:   Internal extensions
+*
+*/
+
+
+
+#ifndef __HUIEXTENSION_H__
+#define __HUIEXTENSION_H__
+
+
+#include <e32std.h>
+
+// Uid for Query visual extension
+const TUid KHuiVisualQueryUid = { 0x2002C36B };
+
+// Parameter structure for Query visual extension
+struct THuiVisualQueryParams
+    {
+    enum TQueryType
+        {
+        // iResult contains canvas flags
+        EQueryCanvasFlags,
+        // iResult contains positive value if external content drawing enabled, 0 otherwise.
+        EQueryExternalContentDrawingEnabled,
+        // iResult contains positive value if this has something to draw, 0 otherwise.
+        EQueryHasDrawableContent
+        };
+
+    // Query type (in)
+    TQueryType iQueryType;
+        
+    // Result of query (out)
+    TInt iValue;
+    
+    // Error code (out). This should be filled with KErrNotSupported by caller and visual should modify to KErrNone.
+    TInt iResult;
+    };
+
+#endif // __HUIEXTENSION_H__
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h	Mon Feb 22 17:57:49 2010 +0200
@@ -150,6 +150,11 @@
     void SetDimmingFog(const TRgb& aColor, TReal32 aAmount) __SOFTFP;
 
     /**
+     * Clear rect using the current pen color
+     */
+    void Clear(const TRect& aRect);
+    
+    /**
      * Clear using the current pen color.
      */
     void Clear();
@@ -553,7 +558,8 @@
     
     /** Default fill and stroke paint */
 	VGPaint iPaint;
-
+	TUint32 iPaintColor;
+	
     /** Gradient fill paint */
     VGPaint iGradientPaint;
     
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10PBufferSurface.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10PBufferSurface.h	Mon Feb 22 17:57:49 2010 +0200
@@ -118,6 +118,12 @@
     void SwapBuffers();
 
     /**
+     * Synchronizes the context. All rendering calls for the currently bound context are guaranteed 
+     * to be executed, when thsi method returns.
+     */
+    void Finish();
+
+    /**
      * Binds a texture to the surface to be used during subsequent drawing
      * operations.
      */
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10RenderSurface.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10RenderSurface.h	Mon Feb 22 17:57:49 2010 +0200
@@ -65,6 +65,8 @@
 
     virtual void SwapBuffers();
 
+    virtual void Finish();
+
     virtual void BindTexture(TInt aTextureUnit,
                              const MHuiSegmentedTexture& aTexture,
                              TInt aSegment);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -300,6 +300,8 @@
     iArcPath = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, 0.0f, 
                             2, 7, VG_PATH_CAPABILITY_APPEND_TO);
     iPaint = vgCreatePaint();
+    iPaintColor = 0;
+    vgSetColor(iPaint, iPaintColor);
     iGradientPaint = vgCreatePaint();
     iBlendMode = VG_BLEND_SRC_OVER;
 
@@ -707,6 +709,42 @@
     // Fog not supported
     }
 
+void CHuiVg10Gc::Clear(const TRect& aRect)
+    {
+    HUI_VG_INVARIANT();
+    
+    UpdateClientMatrix();
+
+    THuiRealRect transformed = aRect;
+    iMatrixStack->Current().Multiply(transformed.iTl);
+    iMatrixStack->Current().Multiply(transformed.iBr);
+        
+    // Normalize the rectangle
+    if (transformed.iTl.iX > transformed.iBr.iX)
+        {
+        TReal32 tmp = transformed.iTl.iX;
+        transformed.iTl.iX = transformed.iBr.iX;
+        transformed.iBr.iX = tmp;
+        }
+    if (transformed.iTl.iY > transformed.iBr.iY)
+        {
+        TReal32 tmp = transformed.iTl.iY;
+        transformed.iTl.iY = transformed.iBr.iY;
+        transformed.iBr.iY = tmp;
+        }            
+    VGfloat scale = 1.0f / 255.0f;
+    VGfloat color[] = 
+        {
+        PenColor().Red()   * scale,
+        PenColor().Green() * scale,
+        PenColor().Blue()  * scale,
+        PenAlpha() * scale
+        };
+
+    vgSetfv(VG_CLEAR_COLOR, 4, color);
+    vgClear(transformed.iTl.iX, transformed.iTl.iY, transformed.Width(), transformed.Height());
+    HUI_VG_INVARIANT();
+    }
 
 void CHuiVg10Gc::Clear()
     {
@@ -941,7 +979,12 @@
 #endif
     
     // Update the color of the current paint
-    vgSetColor(iPaint, color);
+    // if required
+    if (iPaintColor != color)
+        {
+        vgSetColor(iPaint, color);
+        iPaintColor = color;
+        }
     
     // Detect white fully opaque color
     if (color == 0xffffffff)
@@ -1050,7 +1093,7 @@
     vgTranslate(-srcX, -srcY);
 
 #ifdef __NVG
-    if ( isExtended && texture.IsNvgContent())
+    if ( isExtended )
         {
         // Determine the size to which we want to draw the NVG icon paths
         TSize contentSize( HUI_ROUND_FLOAT_TO_INT(aDestRect.Width()),
@@ -1163,7 +1206,7 @@
     const CHuiVg10Texture& texture = static_cast<const CHuiVg10Texture&>( aTexture );
     TBool isExtended = texture.IsExtended();
     
-    if (isExtended && texture.IsNvgContent())
+    if (isExtended)
         {
         UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
         TSize contentSize(0, 0);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10PBufferSurface.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10PBufferSurface.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -409,6 +409,10 @@
     // Pbuffers consist of a single buffer only (no front/back buffers to swap).
     }
 
+void CHuiVg10PBufferSurface::Finish()
+    {
+    vgFinish();
+    }
 
 void CHuiVg10PBufferSurface::BindTexture(TInt aTextureUnit,
                                            const MHuiSegmentedTexture& aTexture,
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10RenderSurface.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10RenderSurface.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -185,6 +185,9 @@
     EGLint attriblist[] = 
         {
         EGL_VG_ALPHA_FORMAT, EGL_VG_ALPHA_FORMAT_PRE,
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+        EGL_RENDER_BUFFER, EGL_SINGLE_BUFFER,
+#endif
         EGL_NONE
         };
     attriblistPtr = &attriblist[0];
@@ -296,6 +299,10 @@
     eglSwapBuffers(iEglDisplay, iEglSurface);
     }
 
+void CHuiVg10RenderSurface::Finish()
+    {
+    vgFinish();
+    }
 
 void CHuiVg10RenderSurface::BindTexture(TInt /*aTextureUnit*/,
                                         const MHuiSegmentedTexture& aTexture,
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1082,7 +1082,7 @@
         image = CreateRenderedImage(&nvgEngine, dataBuf, Size());
         
         // New functionality for checking the mask
-        if (header.GetBitmapId() != maskHeader.GetBitmapId() &&
+        if (header.GetBitmapId() != maskHeader.GetBitmapId() && maskDataBuf &&
             CompareNvgData(dataBuf, maskDataBuf) != 0)
             {
             VGImage maskImg = VG_INVALID_HANDLE;
@@ -1436,14 +1436,7 @@
 TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext)
     {
     HUI_VG_INVARIANT();
-    // If the icon is also a current EGL surface, the getImageSubData
-    // won't succeed and return "image in use" -error..
-    if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE )
-        {
-        HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError());
-        return aSize;
-        }
-    
+        
 #ifndef __WINS__ // Should possibly query the supported mode instead?
     VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE;
 #else
@@ -1470,7 +1463,7 @@
     TReal R = 1.0;
     TInt HaN = Ha;
     
-    const TInt lastColumn = aSize.iHeight - 1;
+    const TInt lastColumn = aSize.iWidth - 1;
     for (TInt curRow = 0; curRow < lValidMargin; curRow++)
         {
         const TInt y = (aSize.iHeight - 1) - curRow; // h - 1 is the last line
@@ -1493,13 +1486,6 @@
     delete buf;
     HUI_VG_INVARIANT();
     
-    // Make the PBuffer surface current again 
-    if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE )
-        {
-        HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError());
-        return aSize;
-        }
-    
     // If icon size has to be changed, clear out old area for new DrawNVG round!
     if(aSize.iHeight > HaN)
         {
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiAnchorLayout.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiAnchorLayout.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -713,7 +713,9 @@
             Mem::FillZ(anchor, sizeof(*anchor));
             }
         }
-        
+    
+    ASSERT(anchor);
+    
     TEdgeAnchor* edge(NULL);
     TAxis& axis = anchor->Axis(axisId);
     error = axis.AddEdge(edgeProximity, edge);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiAnimatedTexture.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiAnimatedTexture.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -56,7 +56,7 @@
     
 EXPORT_C MHuiSegmentedTexture* CHuiAnimatedTexture::SegmentedTexture()
     {
-    return this;
+    return iTexture;
     }
     
     
@@ -68,7 +68,7 @@
 
 EXPORT_C const MHuiSegmentedTexture* CHuiAnimatedTexture::SegmentedTexture() const
     {
-    return this;
+    return iTexture;
     }
     
     
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -285,6 +285,8 @@
 
 CHuiCanvasTextImage::~CHuiCanvasTextImage()
     {
+    delete iText;
+    iText = NULL;
     }
 
 TBool CHuiCanvasTextImage::UseColorModulation() const
@@ -2191,6 +2193,7 @@
     iSearchedGraphicImageEntry->iBitmapTouchCount = KHuiInitialBitmapTouchCount;
     iSearchedGraphicImageEntry->iMaskTouchCount = KHuiInitialBitmapTouchCount;
     iSearchedGraphicImageEntry->iGcParams = aCachedImageParams.iGcParams;
+    iSearchedGraphicImageEntry->iCache = this;
     
     cachedEntry = iCachedImages.FindInOrder(iSearchedGraphicImageEntry, ImageOrderFunc);
     if (cachedEntry == KErrNotFound)
@@ -2219,6 +2222,7 @@
     iSearchedGraphicImageEntry->Reset();
     iSearchedGraphicImageEntry->iGcParams = aGcParams;
     iSearchedGraphicImageEntry->iImageSize = aImageSize;
+    iSearchedGraphicImageEntry->iCache = this;
     
     
     for (TInt i=0; i<aCachedImageParams.Count();i++)
@@ -2294,13 +2298,14 @@
     iSearchedGraphicImageEntry->iBitmapTouchCount = KHuiInitialBitmapTouchCount;
     iSearchedGraphicImageEntry->iMaskTouchCount = KHuiInitialBitmapTouchCount;
     iSearchedGraphicImageEntry->iGcParams = aCachedImageParams.iGcParams;
+    iSearchedGraphicImageEntry->iCache = this;
     
     cachedEntry = iCachedImages.FindInOrder(iSearchedGraphicImageEntry, ImageOrderFunc);
     if (cachedEntry == KErrNotFound)
         {
         // Create new entry object
         CHuiCanvasGraphicImage* newEntry = new (ELeave) CHuiCanvasGraphicImage; 
-        CleanupStack::PushL(newEntry);                    
+        CleanupStack::PushL(newEntry);
         
         newEntry->CopyAttributes(*iSearchedGraphicImageEntry);
         
@@ -2311,7 +2316,7 @@
         User::LeaveIfError(iCachedImages.InsertInOrder(newEntry, ImageOrderFunc));
         cachedEntry = iCachedImages.FindInOrder(newEntry, ImageOrderFunc);
         CleanupStack::Pop(newEntry);
-        needUpdate = ETrue;            
+        needUpdate = ETrue;
         }
     else
         {
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -46,6 +46,9 @@
 
 #include "HuiFxEffect.h"
 #include "HuiCmdBufferBrush.h"
+#include "huiextension.h"
+
+#include "huiwscanvascommands.h"
 
 /** Flag to convienintly disable/enable canvas render buffer usage if needed */
 /* Turned to EFalse as DFS77 was having booting problems in wk26 */
@@ -93,7 +96,9 @@
 void CHuiCanvasVisual::ConstructL()
     {
     CHuiLayout::ConstructL();
-        
+
+    SetFlags(EHuiVisualFlagWserv);
+    
     iCanvasVisualData = new (ELeave) THuiCanvasVisualData;
     iCanvasVisualData->iCommandSetType = ECommandBufferWs;
     iCanvasVisualData->iCanvasFlags = 0;   
@@ -101,13 +106,13 @@
     iCanvasVisualData->iParentCanvas = NULL;
     iCanvasVisualData->iBackground = NULL;
     iCanvasVisualData->iCanvasPainter = NULL;
+    iCanvasVisualData->iStoredRenderBuffer = 0;
     
     iCanvasVisualData->iBackground = CHuiCanvasBackground::NewL();
     iCanvasVisualData->iBackground->SetVisual(this);
     
     iCanvasVisualData->iCanvasPainter = CHuiCanvasWsPainter::NewL();
     iCanvasVisualData->iCanvasPainter->SetVisual(this);
-    iCanvasVisualData->iStoredRenderBuffer = 0;
     
     TBool useCanvasRenderBuffer = CHuiStatic::Renderer().Allows(EHuiRenderPluginAllowVisualPBufferSurfaces);    
     iCanvasVisualData->iCanvasPainter->EnableRenderBuffer(useCanvasRenderBuffer); 
@@ -116,26 +121,34 @@
     iCanvasVisualData->iLayerExtent = TRect();
     
     // subwindow effects
-    EnableBrushesL(ETrue);
+    //EnableBrushesL(ETrue);
     }
 
 
 CHuiCanvasVisual::~CHuiCanvasVisual()
     {
-    FreeRenderBuffer();
-    if(iCanvasVisualData->iExternalContentVisual)
-    	{
-    	// Allow the external content visual to be drawn normally
-    	iCanvasVisualData->iExternalContentVisual->ClearFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
-    	}
-    	
+   
+    FreeRenderBuffer();	
     if (iCanvasVisualData)
         {
+        if(iCanvasVisualData->iExternalContentVisual)
+            {
+            // Allow the external content visual to be drawn normally
+            iCanvasVisualData->iExternalContentVisual->ClearFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
+            }
         ClearCommandSet();
-        delete iCanvasVisualData->iBackground;
-        iCanvasVisualData->iBackground = NULL;
-        delete iCanvasVisualData->iCanvasPainter;
-    	iCanvasVisualData->iCanvasPainter = NULL;
+        if ( iCanvasVisualData->iBackground )
+            {
+            delete iCanvasVisualData->iBackground;
+            iCanvasVisualData->iBackground = NULL;
+            }
+        if ( iCanvasVisualData->iCanvasPainter )
+            {
+            delete iCanvasVisualData->iCanvasPainter;
+            iCanvasVisualData->iCanvasPainter = NULL;
+            }
+        
+    	
     	iCanvasVisualData->iExternalContentVisual = NULL;
     	
     	// Tell parent that we are destructed
@@ -332,14 +345,17 @@
 
     if ((IsDelayedEffectSource() || Freezed()))
         {
+        // Select right draw mode
+        THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend;
+
         if (StoredRenderBuffer())
             {
-            DrawStoredFullScreenRenderBuffer(aGc);
+            DrawStoredFullScreenRenderBuffer(drawMode, aGc);
             return;
             }
         else if (iCanvasVisualData->iStoredRenderBuffer)
             {
-            DrawStoredVisualRenderBuffer();
+            DrawStoredVisualRenderBuffer(drawMode);
             return;
 			}
         }  
@@ -492,14 +508,17 @@
 
     if ((IsDelayedEffectSource() || Freezed()))
         {
+        // Select right draw mode
+        THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend;
+        
         if (StoredRenderBuffer())
             {
-            DrawStoredFullScreenRenderBuffer(aGc);
+            DrawStoredFullScreenRenderBuffer(drawMode, aGc);
 			return;
             }
         else if (iCanvasVisualData->iStoredRenderBuffer)
             {
-            DrawStoredVisualRenderBuffer();
+            DrawStoredVisualRenderBuffer(drawMode);
             return;
             }
         }    
@@ -590,20 +609,26 @@
     const TInt count = Count();
     for(TInt i = 0; i < count; ++i)
         {
-        // This cast is not really safe, but dynamic cast is slow
-        CHuiCanvasVisual* visual = (CHuiCanvasVisual*) iHuiLayoutPrivateData->iChildren[i];
+        CHuiVisual* visual = iHuiLayoutPrivateData->iChildren[i];
+        
         //Ignore inactive child visuals
         if ((visual->Flags()& EHuiVisualFlagInactive))
             {
             continue;
             }
         
-        if (aIncludeCanvasFlags && !(visual->CanvasFlags()& aIncludeCanvasFlags))
+        TInt canvasFlags = 0;
+        if (aIncludeCanvasFlags || aExcludeCanvasFlags)
+            {
+            canvasFlags = visual->QueryCanvasFlags();
+            }
+        
+        if (aIncludeCanvasFlags && !(canvasFlags & aIncludeCanvasFlags))
             {
             continue;
             }
 
-        if (aExcludeCanvasFlags && (visual->CanvasFlags()& aExcludeCanvasFlags))
+        if (aExcludeCanvasFlags && (canvasFlags & aExcludeCanvasFlags))
             {
             continue;
             }
@@ -649,34 +674,50 @@
    	return hasChanged;
     }
 
-TBool CHuiCanvasVisual::ChildTreeChanged(TInt aExcludeCanvasFlags) const
+// Goes through visual hierarchy and checks if any visual has changed.
+// This method does not modify any visuals. Parameter is not const 
+// because of CanvasVisual method.
+TBool CHuiCanvasVisual::RecursiveChildTreeChanged(CHuiVisual* aVisual, TInt aExcludeCanvasFlags)
     {
-    // CHuiLayout::Changed() does not check children.  
-    // This utility method checks whole child tree below this visual.
     TBool changed = EFalse;
 
     // Check wheter we should include this visual or igonre it.
     if (aExcludeCanvasFlags)
         {
-        if (!(iCanvasVisualData->iCanvasFlags & aExcludeCanvasFlags))
+        if ( !(aVisual->Flags() & EHuiVisualFlagInactive) )
             {
-            changed |= Changed();
+            TInt canvasFlags = aVisual->QueryCanvasFlags();
+                
+            if ( !(canvasFlags & aExcludeCanvasFlags) )
+                {
+                changed |= aVisual->Changed();
+                }
             }        
         }
     
-    const TInt count = Count();
-    for(TInt i = 0; i < count; ++i)
+    if ( !changed )
         {
-        CHuiCanvasVisual* visual = (CHuiCanvasVisual*) iHuiLayoutPrivateData->iChildren[i];
-        changed |= visual->ChildTreeChanged(aExcludeCanvasFlags);        
-        if (changed)
+        const TInt count = aVisual->Count();
+        for(TInt i = 0; i < count; ++i)
             {
-            break;
+            CHuiVisual* visual = &aVisual->Visual(i);
+            changed |= RecursiveChildTreeChanged( visual, aExcludeCanvasFlags );
+            if ( changed )
+                {
+                break;
+                }
             }
         }
-    return changed;
+    return changed;    
     }
 
+TBool CHuiCanvasVisual::ChildTreeChanged(TInt aExcludeCanvasFlags) const
+    {
+    // CHuiLayout::Changed() does not check children.  
+    // This utility method checks whole child tree below this visual.
+    return RecursiveChildTreeChanged(
+        const_cast<CHuiCanvasVisual*>(this), aExcludeCanvasFlags);
+    }
 
 EXPORT_C void CHuiCanvasVisual::ClearChanged()
     {
@@ -747,8 +788,11 @@
 
 EXPORT_C void CHuiCanvasVisual::ClearCommandSet()
     {
-    iCanvasVisualData->iCanvasPainter->ClearCommandSet();
-    SetChanged();
+    if ( iCanvasVisualData->iCanvasPainter )
+        {
+        iCanvasVisualData->iCanvasPainter->ClearCommandSet();
+        SetChanged();
+        }
     }
 
 #ifdef HUI_DEBUG_TRACK_DRAWING  
@@ -815,6 +859,7 @@
     
    	if (aCommandType == ECommandBufferAlf)
    	   	{
+   	   	ClearFlags(EHuiVisualFlagWserv);
    	   	delete iCanvasVisualData->iCanvasPainter;
    	   	iCanvasVisualData->iCanvasPainter = NULL;
         iCanvasVisualData->iCommandSetType = ECommandBufferAlf;    
@@ -823,6 +868,7 @@
    		}	     
     else if (aCommandType == ECommandBufferWs)
     	{
+    	SetFlags(EHuiVisualFlagWserv);
     	delete iCanvasVisualData->iCanvasPainter;
    	   	iCanvasVisualData->iCanvasPainter = NULL;
         iCanvasVisualData->iCommandSetType = ECommandBufferWs;    
@@ -983,6 +1029,31 @@
     return drawContent;       
     }
 
+// Goes through visual hierarchy and checks if any visual has external content drawing enabled.
+TBool CHuiCanvasVisual::RecursiveIsExternalContentDrawingEnabled(CHuiVisual* aVisual)
+    {
+    TBool drawExternalContent = EFalse;
+    
+    const TInt count = aVisual->Count();
+    for(TInt i = 0; i < count; ++i)
+        {
+        CHuiVisual* visual = &aVisual->Visual(i);
+        drawExternalContent |= visual->QueryExternalContentDrawingEnabled();
+        if ( drawExternalContent )
+            {
+            break;
+            }
+        
+        drawExternalContent |= RecursiveIsExternalContentDrawingEnabled( visual );
+        if ( drawExternalContent )
+            {
+            break;
+            }
+        }
+    
+    return drawExternalContent;    
+    }
+
 TBool CHuiCanvasVisual::IsExternalContentDrawingEnabled(TBool aIncludeChildren) const
     {
     TBool drawExternalContent = EFalse;
@@ -990,13 +1061,10 @@
         {
         drawExternalContent = ETrue;    
         }
-    if (aIncludeChildren)
+    if (aIncludeChildren && !drawExternalContent)
         {
-        for (TInt i=0; !drawExternalContent && i<Count(); i++)
-             {
-             CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*) &Visual(i);
-             drawExternalContent |= canvasVisual->IsExternalContentDrawingEnabled(ETrue);
-             }
+        drawExternalContent |= RecursiveIsExternalContentDrawingEnabled(
+            const_cast<CHuiCanvasVisual*>(this));        
         }
     return drawExternalContent;       
     }
@@ -1055,6 +1123,11 @@
 
 EXPORT_C void CHuiCanvasVisual::SetLayerUsesAlphaFlag(TBool aEnabled)
     {
+    if (aEnabled == KWindowIsDSAHost)
+        {
+        iCanvasVisualData->iCanvasFlags |= EHuiCanvasFlagDisableCanvasContent;        
+        return;    
+        }    
     iCanvasVisualData->iLayerUsesAlphaFlag = aEnabled;
     }
 
@@ -1118,7 +1191,8 @@
         }
     else // background surface was removed
         {
-        EnableTransformationL(EFalse);
+        iCanvasVisualData->iCanvasFlags &= (~EHuiCanvasFlagDisableCanvasContent);    
+        //EnableTransformationL(EFalse);
         }
     }
 
@@ -1154,17 +1228,39 @@
         }
     }
 
-void CHuiCanvasVisual::DrawStoredVisualRenderBuffer() const
+void CHuiCanvasVisual::DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const
     {
     CHuiCanvasGc& gc = CanvasGc();
+    CHuiCanvasVisual* visual = NULL; 
+    TBool transparent = EffectiveOpacity() < 1.0f;
+    gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode);
+    if (transparent)
+        {
+        gc.EnableEffectiveOpacity(ETrue);  
+        visual = gc.Visual();
+        gc.SetVisual(*this);
+        gc.SetDrawMode(EHuiCanvasDrawModeBlend);
+        }
     THuiRealPoint dest_point = DisplayRect().iTl;
     CHuiCanvasRenderBuffer *stored = iCanvasVisualData->iStoredRenderBuffer;
+
     gc.DrawImage(*stored, dest_point);
+    if (transparent)
+        {
+        gc.SetVisual(*visual);
+        gc.EnableEffectiveOpacity(EFalse);
+        }
     }
 
-void CHuiCanvasVisual::DrawStoredFullScreenRenderBuffer(CHuiGc& aGc) const
+void CHuiCanvasVisual::DrawStoredFullScreenRenderBuffer(TInt aCanvasDrawMode, CHuiGc& aGc) const
     {
     if (!Display()) return;
+    if (!iHuiLayoutPrivateData->iGc)
+        {
+        CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer();
+		// deleted in CHuiLayout destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore
+        iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL();
+        }
     CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc;
     gc.SetGc(aGc);
     gc.SetDefaults();
@@ -1182,8 +1278,23 @@
     
     THuiRealPoint dest_point = DisplayRect().iTl;
     CHuiCanvasRenderBuffer *stored = StoredRenderBuffer();
-    gc.DrawImage(*stored, dest_point); 
-
+    TBool transparent = EffectiveOpacity() < 1.0f;
+    CHuiCanvasVisual* visual = NULL; 
+	gc.SetDrawMode((THuiCanvasDrawMode)aCanvasDrawMode);
+    if (transparent)
+        {
+        
+        gc.EnableEffectiveOpacity(ETrue);  
+        visual = gc.Visual();
+        gc.SetVisual(*this);
+        gc.SetDrawMode(EHuiCanvasDrawModeBlend);
+        }
+    gc.DrawImage(*stored, dest_point);
+    if (transparent)
+        {
+        gc.SetVisual(*visual);
+        gc.EnableEffectiveOpacity(EFalse);
+        }
     gc.PopTransformationMatrix();
     }
 
@@ -1195,24 +1306,47 @@
             {
             delete iCanvasVisualData->iStoredRenderBuffer;
             iCanvasVisualData->iStoredRenderBuffer = NULL;
+            delete iHuiLayoutPrivateData->iGc;
+            iHuiLayoutPrivateData->iGc = NULL;
             }
         }
     }
 
+// Goes through visual hierarchy and checks if any visual has command buffers
+// or other drawable content.
+TBool CHuiCanvasVisual::RecursiveHasCommandBuffers(CHuiVisual* aVisual)
+    {
+    TBool hasCommandBuffers = EFalse;
+    
+    const TInt count = aVisual->Count();
+    for(TInt i = 0; i < count; ++i)
+        {
+        CHuiVisual* visual = &aVisual->Visual(i);
+        // If visual is a canvas one, then QueryHasDrawableContent returns 
+        // HasCommandBuffers(EFalse)
+        hasCommandBuffers |= visual->QueryHasDrawableContent();
+        if ( hasCommandBuffers )
+            {
+            break;
+            }
+        
+        hasCommandBuffers |= RecursiveHasCommandBuffers( visual );
+        if ( hasCommandBuffers )
+            {
+            break;
+            }
+        }
+    
+    return hasCommandBuffers;    
+    }
+
 EXPORT_C TBool CHuiCanvasVisual::HasCommandBuffers(TBool aIncludeChildren) const
     {
     TBool hasCommandBuffers = iCanvasVisualData->iCanvasPainter->HasCommandBuffers();
-    if (aIncludeChildren)
+    if (aIncludeChildren && !hasCommandBuffers)
         {
-        for (TInt i=0; i<Count(); i++)
-            {
-            CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*) &Visual(i); // Dynamic cast is too slow for us ;)
-            hasCommandBuffers |= canvasVisual->HasCommandBuffers(aIncludeChildren);
-            if (hasCommandBuffers)
-                {
-                break;
-                }
-            }
+        // Include children branch - just check if there is something to draw.
+        hasCommandBuffers |= RecursiveHasCommandBuffers(const_cast<CHuiCanvasVisual*>(this));
         }
     return hasCommandBuffers;
     }
@@ -1267,4 +1401,31 @@
     return THuiLayoutChildRectLayoutUpdateNeeded;
     }
 
-
+void CHuiCanvasVisual::VisualExtension(const TUid& aExtensionUid, TAny** aExtensionParams)
+    {
+    if (aExtensionUid == KHuiVisualQueryUid && aExtensionParams && *aExtensionParams)
+        {
+        THuiVisualQueryParams* params = static_cast<THuiVisualQueryParams*>(*aExtensionParams);
+        switch (params->iQueryType)
+            {
+        case THuiVisualQueryParams::EQueryCanvasFlags:
+            params->iValue = CanvasFlags();
+            params->iResult = KErrNone;
+            break;
+        case THuiVisualQueryParams::EQueryExternalContentDrawingEnabled:
+            params->iValue = IsExternalContentDrawingEnabled(EFalse);
+            params->iResult = KErrNone;
+            break;
+        case THuiVisualQueryParams::EQueryHasDrawableContent:
+            params->iValue = HasCommandBuffers(EFalse);
+            params->iResult = KErrNone;
+            break;
+        default:
+            break;
+            }
+        }
+    else
+	    {
+		CHuiVisual::VisualExtension(aExtensionUid, aExtensionParams);
+		}
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCmdBufferBrush.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCmdBufferBrush.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -167,7 +167,10 @@
 
     CHuiCanvasRenderBuffer* renderbuffer = NULL;
     renderbuffer = iVisual->Env().CanvasTextureCache().FindCachedRenderBuffer(*iVisual);
-    iCanvasGc.ClearRenderBuffer(*renderbuffer, aRectangle /*TRect(0,0,iVisual->DisplayRect().Size().iWidth, iVisual->DisplayRect().Size().iHeight)*/);
+    if (renderbuffer)
+        {
+        iCanvasGc.ClearRenderBuffer(*renderbuffer, aRectangle /*TRect(0,0,iVisual->DisplayRect().Size().iWidth, iVisual->DisplayRect().Size().iHeight)*/);
+        }
     }
 void CHuiCmdBufferBrush::DrawDrawingCommands(TInt aAction, CHuiGc &aGc, TRect aClippingRectangle, 
                                              TPtrC8 aCommands, CHuiCanvasCommandBuffer *buf, const TRegion &reg) const
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -48,22 +48,29 @@
 
 	
 CHuiControlGroup::~CHuiControlGroup()
-    {    
-    iUnhandledEventObservers.Close();
+    {   
+    
+       
+        iEnv.RemoveTheControlGroup(iResourceId);
     
-    // The group owns the controls, so it must destroy them.
-    // Destroy in reverse order so that references will be removed in 
-    // natural order (children of a pane will be removed before the pane).
-    for(TInt i = iControls.Count() - 1; i >= 0; --i)
-        {
-        CHuiControl* c = iControls[i];
-        iControls.Remove(i);
-        delete c;
-        }
-    iControls.Reset();
+        iUnhandledEventObservers.Close();
+            
+            // The group owns the controls, so it must destroy them.
+            // Destroy in reverse order so that references will be removed in 
+            // natural order (children of a pane will be removed before the pane).
+            for(TInt i = iControls.Count() - 1; i >= 0; --i)
+                {
+                CHuiControl* c = iControls[i];
+                iControls.Remove(i);
+                delete c;
+                }
+            iControls.Reset();
+            
+            delete iTransform;
+            iTransform = NULL;
+            HUI_PROBE_REPORT_DESTRUCTED
+      
     
-    delete iTransform;
-    HUI_PROBE_REPORT_DESTRUCTED
     }
     
     
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1525,10 +1525,8 @@
                     }
                 break;
             case EClearWithSkinBackground:
-                 TRect skinRect;
-                 TRect dummy;
-                 GetRectForItem(item.SkinBackground(), dummy, skinRect);
                  backgroundTexture = s60skin->BackgroundTexture(item.SkinBackground());
+                 TRect skinRect = s60skin->SkinRect(item.SkinBackground());
                  if (backgroundTexture)
                     {
                     THuiImage background(*backgroundTexture);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -47,6 +47,8 @@
 #include "huicanvastexturecache.h"
 #include "HuiFxEngine.h"
 
+#include "huisynchronizationobserver.h"
+
 #define HUI_HIRES_TIMER
 
 
@@ -1069,6 +1071,8 @@
             }
         }
 
+    DoSynchronize();
+        
     iCurrentDisplay = NULL; // informs the egosystem that the drawing is done.
     CHuiStatic::ReportNewFrame();
     
@@ -1762,3 +1766,65 @@
     {
     return iMemoryLevel;
     }
+
+EXPORT_C void CHuiEnv::Synchronize(TInt aId, MHuiSynchronizationObserver* aObserver)
+    {
+    iSynchObserver = aObserver;
+    iSynchId = aId;
+    
+    if ( aObserver )
+        {
+        ContinueRefresh();
+        }
+    }
+
+void CHuiEnv::DoSynchronize()
+    {
+    if ( !iSynchObserver )
+        {
+        return;
+        }
+
+    // Synchronize commands before signalling through P&S
+    for(TInt i = 0; i < iDisplays.Count(); ++i)
+        {          
+        if ( ( iDisplays[i]->DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer ) 
+             && ( iDisplays[i]->ScreenBufferObserver() == NULL ) )
+            {
+            MakeCurrent(*iDisplays[i]);
+            iDisplays[i]->RenderSurface().Finish();
+            }
+        }
+
+    iSynchObserver->Synchronized( iSynchId );
+    iSynchObserver = NULL;
+    }
+
+void CHuiEnv::RemoveTheControlGroup(TInt aId)
+    {
+    TInt i;
+
+    for(i = 0; i < iLoadedGroups.Count(); ++i)
+        {
+        if(iLoadedGroups[i]->ResourceId() == aId)
+            {
+            // This is control group to delete.
+            CHuiControlGroup* group = iLoadedGroups[i];
+            CancelCommands(group);
+
+            for (TInt ii = iDisplays.Count()-1; ii>=0; ii--)
+                {
+                TInt index = iDisplays[ii]->Roster().Find(group);
+                if (index != KErrNotFound)
+                    {
+                    iDisplays[ii]->Roster().Hide(iDisplays[ii]->Roster().ControlGroup(index));
+                    }
+                }
+            
+            iLoadedGroups.Remove(i);
+            
+            }
+        }
+
+   
+    }
\ No newline at end of file
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -63,11 +63,17 @@
 void CHuiFxEffectCache::CreateL(MHuiFxEffectCacheNode *aNode)
     { // registration of fxml file
     MHuiFxEffectCacheNode *cachedNode = Find(aNode);
+    MHuiFxEffectCacheNode *dupNode = FindDuplicate(aNode);
     if (cachedNode)
        { // found in cache => duplicate registration => no need to do anything
        cachedNode->Ref(1);
        delete aNode;
        }
+    else if (dupNode)
+        { // found same file already being loaded
+        dupNode->Ref(1);
+        delete aNode;
+        }
     else
        { // not found in cache, so insert it and start parsing the effect.
        TInt id = UniqueId();
@@ -119,14 +125,14 @@
        TInt count = cachedNode->Ref(-1);
        if (count == 0)
            {
+           Remove(iCachedEffects, cachedNode);
            delete cachedNode;
-           Remove(iCachedEffects, cachedNode);
            }
        }
    if (cachedNode != aNode)
        { // this node was not found in iCachedEffects array, so it needs to be in iDuplicateEffects array
+       Remove(iDuplicateEffects, aNode);
        delete aNode;
-       Remove(iDuplicateEffects, aNode);
        }
    }
 
@@ -161,6 +167,19 @@
 	}
    return 0;
    }
+MHuiFxEffectCacheNode *CHuiFxEffectCache::FindDuplicate(MHuiFxEffectCacheNode *aNode)
+    {
+    TInt size = iDuplicateEffects.Count();
+    for(TInt i=0;i<size;i++)
+        {
+        MHuiFxEffectCacheNode *node = iDuplicateEffects[i].iNode;
+        if (Compare(node, aNode))
+            {
+            return node;
+            }
+        }
+    return 0;
+    }
 
 TInt CHuiFxEffectCache::FindById(TInt aId)
     {
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectParser.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectParser.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -278,7 +278,7 @@
 #ifdef _HUI_FX_PARSER_LOGGING
             __ALFFXLOGSTRING("CHuiFxEffectParser::ParseNodeL - ENodeTypeUnknown");
 #endif
-            FAIL(KErrGeneral, _L("Unknown node type"));
+            __ALFFXLOGSTRING1("CHuiFxEffectParser::ParseNodeL : WARNING - Node tag <%S> is not supported.", &(aNode->NodeName()));
             break;
             }
             
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -77,6 +77,26 @@
     return EFalse;
 #endif
     }
+
+TBool CHuiFxEngine::FxmlUsesInput1(CHuiFxEffect& aEffect)
+    {
+    RArray<THuiFxVisualSrcType> array;
+    aEffect.FxmlVisualInputs(array);
+ 
+    TInt c = array.Count();
+    for(TInt i = 0; i<c; i++)
+        {
+        THuiFxVisualSrcType val = array[i];
+        if (val == EVisualSrcInput1)
+            {
+            array.Close();
+            return ETrue;
+            }
+        }
+    array.Close();
+    return EFalse;    
+    }
+
     
 EXPORT_C void CHuiFxEngine::RegisterEffectL(const TDesC &aFileName)
     {
@@ -150,7 +170,6 @@
 #ifdef HUIFX_EFFECTCACHE_ENABLED
     CHuiFxEffectCacheEffectNode *node = new (ELeave) CHuiFxEffectCacheEffectNode(aFileName, aEffect, aVisual, &iExtRect, this);
     node->SetEffectEndObserver( aEffectEndObserver, aHandle );
-    aFlags |= KHuiFxDelayRunUntilFirstFrameHasBeenDrawn;
     node->SetEffectFlags( aFlags );
     CleanupStack::PushL(node);
     iCache->FindOrCreateL(node); // takes ownership
@@ -206,7 +225,6 @@
 		aFlags |= KHuiFxWaitGroupSyncronization;
 		node->SetEffectGroup(aGroup);
     	}
-    aFlags |= KHuiFxDelayRunUntilFirstFrameHasBeenDrawn;
     node->SetEffectFlags( aFlags );
     
     CleanupStack::PushL(node);
@@ -314,6 +332,14 @@
 #endif // #ifdef HUIFX_TRACE    
 
     iActiveEffects.AppendL(aEffect);
+
+    // Performance improvement, but this would be better to be a special hint param in the fxml
+    if (aEffect && FxmlUsesInput1(*aEffect))
+        {
+        TInt flags = aEffect->EffectFlags();
+        flags |= KHuiFxOpaqueHint;
+        aEffect->SetEffectFlags(flags);        
+        }
     }
 
 EXPORT_C void CHuiFxEngine::RemoveEffect(CHuiFxEffect* aEffect)
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiLayout.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiLayout.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -56,8 +56,7 @@
     {
     CHuiVisual::ConstructL();
     iHuiLayoutPrivateData = new (ELeave) THuiLayoutPrivateData;
-    CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer();
-    iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL();
+    iHuiLayoutPrivateData->iGc = NULL;
     }
 
 
@@ -74,6 +73,7 @@
 	        }
 	    iHuiLayoutPrivateData->iChildren.Reset();
 	    delete iHuiLayoutPrivateData->iGc;
+	    iHuiLayoutPrivateData->iGc = NULL;
 	    delete iHuiLayoutPrivateData;
     	}
     }
@@ -311,12 +311,8 @@
     TInt count = Count();
     for(TInt i = 0; i < count; ++i)
         {
-        //Ignore inactive child visuals
-        if ( iHuiLayoutPrivateData->iChildren[i]->Flags() & EHuiVisualFlagInactive )
-        	{
-        	continue;
-        	}
-        UpdateChildLayout(i, aTransitionTime);
+        // size and positio changes must go also to inactive visuals
+        UpdateChildLayout(i, aTransitionTime); 
         }
 
     CHuiVisual::UpdateChildrenLayout(aTransitionTime);
@@ -687,7 +683,7 @@
     TInt count = Count();
     for(TInt i = 0; i < count; ++i)
         {
-        if (Flags() & EHuiVisualFlagInactive)
+        if (iHuiLayoutPrivateData->iChildren[i]->Flags() & EHuiVisualFlagInactive)
             {
             // No need to clear inactive children
             continue;
@@ -1120,6 +1116,13 @@
 void CHuiLayout::DrawStoredBitmap(CHuiGc &aGc) const
     {
     if (!Display()) return;
+    
+    if (!iHuiLayoutPrivateData->iGc)
+        {
+        CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer();
+		// deleted in destructor or CHuiCanvasVisual::FreeRenderBuffer when not needed anymore
+        iHuiLayoutPrivateData->iGc = renderplugin.CreateCanvasGcL(); 
+        }
     CHuiCanvasGc& gc = *iHuiLayoutPrivateData->iGc;
     gc.SetGc(aGc);
     gc.SetDefaults();
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -527,10 +527,12 @@
     TInt j = 0;
 
     CHuiDisplay* display = aDisplay ? aDisplay : iDisplay;
+    
+    ASSERT(display!=NULL);
 
     if (iCanvasRenderBuffer && iCanvasGc)
         {
-        DrawSelfFrozen(aGc, aDisplay);
+        DrawSelfFrozen(aGc, display);
         return;
         }
 
@@ -1214,13 +1216,11 @@
         for(TInt i = 0; i < visualCount; ++i)
             {
             // Ignore inactive visuals
-            if ( entry.iRootVisuals[i]->Flags()& EHuiVisualFlagInactive )
+            if ( !(entry.iRootVisuals[i]->Flags()& EHuiVisualFlagInactive) )
                 {
-                continue; 
-                }
-            
-            // This will clear the change flags of the entire tree of visuals.
-            entry.iRootVisuals[i]->ClearChanged();
+                // This will clear the change flags of the entire tree of visuals.
+                entry.iRootVisuals[i]->ClearChanged(); 
+                }            
             }
         }
     }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -72,7 +72,9 @@
     if (iSkinSrvConnected)
         iSkinSrvSession.Close();
         
-   delete iBackgroundBitmap;
+    delete iBackgroundBitmap;
+    iCachedSkinItems.ResetAndDestroy();
+    iCachedSkinItems.Close();
     }
 
 
@@ -135,33 +137,45 @@
 
 void CHuiS60Skin::UpdateBackgroundL()
     {
-    if(iBackgroundTexture)
-         {
-         iBackgroundTexture->Reset();
-         delete iBackgroundTexture;
-         iBackgroundTexture = 0;
-         }
-
-    HUI_DEBUG1(_L("CHuiS60Skin::UpdateBackgroundL - Free memory in the beginning: %i"), HuiUtil::FreeMemory());
-    iBackgroundTexture = CreateSkinBackgroundL(KAknsIIDQsnBgScreen);
-    iBackgroundTexture->SetSkinContent(ETrue);
-    iBackgroundTexture->iContentObservers.AppendL(*this);
-
+    if(!iBackgroundTexture)
+        {
+        iBackgroundTexture = CreateSkinBackgroundL(KAknsIIDQsnBgScreen);
+        iBackgroundTexture->SetSkinContent(ETrue);
+        iBackgroundTexture->iContentObservers.AppendL(*this);
+        }
+    else if(iSkinChanged)
+        {
+        iBackgroundTexture->Reset();
+        delete iBackgroundBitmap;
+        iBackgroundBitmap = NULL;
+        iBackgroundBitmap = CHuiStatic::GetBgBitmapLC(KAknsIIDQsnBgScreen); 
+        CleanupStack::Pop(iBackgroundBitmap);
+        // update iBackgroundRect as well 
+        TRect dummy;
+        GetRectForItem(KAknsIIDQsnBgScreen, dummy, iBackgroundRect);
+        iBackgroundTexture->UploadL(*iBackgroundBitmap,NULL,EHuiTextureUploadFlagRetainResolution );                
+        iBackgroundTexture->SetSkinContent(ETrue);
+        }
+    else
+        {
+        // there should be already up-to-date background texture
+        }
     HUI_DEBUG1(_L("CHuiS60Skin::UpdateBackgroundL - Free memory at exit: %i"), HuiUtil::FreeMemory());
     }
 
 
-void CHuiS60Skin::SkinContentChanged()
+EXPORT_C void CHuiS60Skin::SkinContentChanged()
     {
     iSkinChanged = ETrue;
     }
 
-void CHuiS60Skin::SkinConfigurationChanged(
+EXPORT_C void CHuiS60Skin::SkinConfigurationChanged(
     const TAknsSkinStatusConfigurationChangeReason aReason )
     {
     
     }
-void CHuiS60Skin::SkinPackageChanged(
+
+EXPORT_C void CHuiS60Skin::SkinPackageChanged(
     const TAknsSkinStatusPackageChangeReason aReason )
     {
     
@@ -213,11 +227,12 @@
 EXPORT_C void CHuiS60Skin::NotifyDisplaySizeChangedL()
     {
     // The background is now different.
-    iReloadBackground = ETrue;
     SkinContentChanged(); // for changing the iSkinChanged flag
     Env().NotifySkinChangedL();
     Env().TextStyleManager().NotifyDisplaySizeChangedL();
     ReloadBgTexturesL();
+
+    iSkinChanged = EFalse;
     }
 
 
@@ -300,8 +315,9 @@
         delete bgTexture.iBackgroundTexture;
         bgTexture.iBackgroundTexture = NULL;
         }
-    ((TPrivData*)(iSpare))->iBackgrounds.Reset(); 
+    ((TPrivData*)(iSpare))->iBackgrounds.Reset();
     
+    iCachedSkinItems.ResetAndDestroy(); // reset cached bg images & rects
     }
     
     
@@ -317,47 +333,82 @@
     MAknsSkinInstance* skin = SkinInstance();
     CHuiTexture* texture = CHuiTexture::NewL();
     
-    CleanupStack::PushL(texture);            
-    if(iSkinChanged)
-         {
-     
-        delete iBackgroundBitmap; 
-        iBackgroundBitmap = NULL;
-        
-        if (skin)
-            {
-            TRect dummy;
-            TRect skinRect;
-            GetRectForItem(aID, dummy, skinRect);
-    
-            iBackgroundBitmap = new (ELeave) CFbsBitmap();
-            User::LeaveIfError( iBackgroundBitmap->Create(skinRect.Size(), EColor64K) );        
-    
-            CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(iBackgroundBitmap);
-            CleanupStack::PushL(device);
+    CleanupStack::PushL(texture);
     
-            CFbsBitGc* gc = 0;
-            User::LeaveIfError( device->CreateContext(gc) );
-            CleanupStack::PushL(gc);
-            iSkinControlContext->SetRect(skinRect);
-            iSkinControlContext->SetBitmap(aID);
-    
-            AknsDrawUtils::DrawBackground(skin, iSkinControlContext, NULL, *gc, TPoint(0,0), skinRect,
-                              KAknsDrawParamDefault);
-    
-            CleanupStack::PopAndDestroy(gc);
-            CleanupStack::PopAndDestroy(device);
+    if (skin)
+        {
+        TRect skinrect;
+        TRect dummy;
+        GetRectForItem(aID, dummy, skinrect);
+
+        CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
+        CleanupStack::PushL(bitmap);
+        User::LeaveIfError( bitmap->Create(skinrect.Size(), EColor64K) );        
+
+        CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(bitmap);
+        CleanupStack::PushL(device);
+
+        CFbsBitGc* gc = 0;
+        User::LeaveIfError( device->CreateContext(gc) );
+        CleanupStack::PushL(gc);
+        iSkinControlContext->SetRect(skinrect);
+        iSkinControlContext->SetBitmap(aID);
+
+        AknsDrawUtils::DrawBackground(skin, iSkinControlContext, NULL, *gc, TPoint(0,0), skinrect,
+                          KAknsDrawParamDefault);
+
+        CleanupStack::PopAndDestroy(gc);
+        CleanupStack::PopAndDestroy(device);
+
+        texture->UploadL(*bitmap,NULL,EHuiTextureUploadFlagRetainResolution );            
+        CleanupStack::PopAndDestroy(bitmap);
+        }
+    else
+        {
+        CFbsBitmap* bitmap = SearchCachedSkinItemBitmap(aID);
+        if(iSkinChanged || !bitmap)
+            {
+            TRect skinrect;
+            TRect dummy;
+            GetRectForItem(aID, dummy, skinrect);
+
+            if( aID == KAknsIIDQsnBgScreen) // handle normal background id differently
+                {
+                delete iBackgroundBitmap; 
+                iBackgroundBitmap = NULL;
+                bitmap = CHuiStatic::GetBgBitmapLC(aID);
+                CleanupStack::Pop(bitmap);
+                iBackgroundBitmap = bitmap;
+                iBackgroundRect = skinrect;
+                }
+            else // others are cached in skin item array
+                {
+                bitmap = CHuiStatic::GetBgBitmapLC(aID);
+                TInt index = SearchCachedSkinItemIndex(aID);
+                if( index == KErrNotFound ) // add new
+                    {
+                    CSkinItem* newSkinItem = new (ELeave) CHuiS60Skin::CSkinItem();
+                    CleanupStack::PushL(newSkinItem);
+                    newSkinItem->iId = aID;
+                    newSkinItem->iSkinRect = skinrect;
+                    newSkinItem->iBitmap = bitmap;
+                    User::LeaveIfError(iCachedSkinItems.Append(newSkinItem));
+                    CleanupStack::Pop(newSkinItem);
+                    }
+                else // modify existing
+                    {
+                    iCachedSkinItems[index]->iSkinRect = skinrect;
+                    delete iCachedSkinItems[index]->iBitmap;
+                    iCachedSkinItems[index]->iBitmap = NULL; 
+                    iCachedSkinItems[index]->iBitmap = bitmap;
+                    }
+                CleanupStack::Pop(bitmap);                
+                }
             }
-        else
-            {
-            iBackgroundBitmap = CHuiStatic::GetBgBitmapLC(aID);   
-            CleanupStack::Pop( iBackgroundBitmap );
-            }
-         }
-    texture->UploadL(*iBackgroundBitmap,NULL,EHuiTextureUploadFlagRetainResolution );            
-    
+        texture->UploadL(*bitmap,NULL,EHuiTextureUploadFlagRetainResolution );            
+        }
+
     CleanupStack::Pop(texture);
-    iSkinChanged = EFalse;
     return texture;
     }
 
@@ -368,6 +419,8 @@
         // no need to render the skin backgrounds separately on bitgdi
         return;
         }
+    iCachedSkinItems.ResetAndDestroy(); // reset cached bg images & rects
+    
     TBackgroundTexture bgTexture;
     TInt itemCount = ((TPrivData*)(iSpare))->iBackgrounds.Count(); 
     for (TInt index = 0; index < itemCount; index++)
@@ -425,3 +478,62 @@
         }
     return NULL;
     }
+
+
+TInt CHuiS60Skin::SearchCachedSkinItemIndex(const TAknsItemID& aId)
+    {
+    TInt cacheditemsCount = iCachedSkinItems.Count();
+    for(TInt i = 0; i < cacheditemsCount; i++ )
+        {
+        if( iCachedSkinItems[i]->iId == aId )
+            {
+            return i;
+            }
+        }
+
+    HUI_DEBUG2(_L("CHuiS60Skin::SeachCachedSkinItemIndex - cached TAknsItemID %i %i (iMajor, iMinor) not found"), aId.iMajor, aId.iMinor );
+
+    return KErrNotFound;
+    }
+
+TRect CHuiS60Skin::SearchCachedSkinItemRect(const TAknsItemID& aId)
+    {
+    TRect returnRect = TRect();
+    if(aId == KAknsIIDQsnBgScreen)
+        {
+        returnRect = iBackgroundRect;
+        }
+    else
+        {
+        TInt index = SearchCachedSkinItemIndex(aId);
+        if(index != KErrNotFound )
+            {
+            returnRect = iCachedSkinItems[index]->iSkinRect;
+            }
+        }   
+    return returnRect;
+    }
+
+CFbsBitmap* CHuiS60Skin::SearchCachedSkinItemBitmap(const TAknsItemID& aId)
+    {
+    CFbsBitmap* bitmap = NULL;
+    if(aId == KAknsIIDQsnBgScreen)
+        {
+        bitmap = iBackgroundBitmap;
+        }
+    else
+        {
+        TInt index = SearchCachedSkinItemIndex(aId);
+        if(index != KErrNotFound )
+            {
+            bitmap = iCachedSkinItems[index]->iBitmap;
+            }
+        }   
+    return bitmap;    
+    }
+
+
+TRect CHuiS60Skin::SkinRect(const TAknsItemID& aID)
+    {
+    return SearchCachedSkinItemRect(aID);
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -39,6 +39,8 @@
 #include "HuiCmdBufferBrush.h"
 #include "huicanvasrenderbuffer.h"
 
+#include "huiextension.h"
+
 struct CHuiVisual::THuiVisualPrivateData
     {
 public: // Functions
@@ -67,8 +69,7 @@
     
     // Data
     RArray<TTacticon> iTacticons;
-    CHuiDropShadow* iDropShadow;
-    TRect iPreviousDrawnTvOut; 
+    CHuiDropShadow* iDropShadow; 
     CHuiFxEffect* iEffect;
     CHuiFxEffectParser* iEffectParser;
     MHuiEffectable *iEffectable;
@@ -218,7 +219,7 @@
         	CHuiDisplay* display = &Env().Display(i);
         	if (&(display->Roster()) == &roster)
         		{
-				const TRect& previousDirtyRect = display->IsDisplayTypeTvOut() ? iVisualData->iPreviousDrawnTvOut : iPreviousDrawn;
+				const TRect& previousDirtyRect = iPreviousDrawn;
 				TRect empty;
         		display->CombineAndAddDirtyRegion(previousDirtyRect, empty);
         		}
@@ -690,6 +691,34 @@
 
 EXPORT_C THuiRealRect CHuiVisual::DisplayRect() const __SOFTFP
     {
+    // if this visual is wserv owned, we can take some shortcuts
+    // when calculating the displayrect (ie. none of the "advanced"
+    // functionality is used
+    if (iFlags & EHuiVisualFlagWserv)
+        {
+        TReal x = iPos.iX.iInterpolationStartValue;
+        TReal y = iPos.iY.iInterpolationStartValue;
+        TReal width = iSize.iX.iInterpolationStartValue;
+        TReal height = iSize.iY.iInterpolationStartValue;
+        
+        const CHuiVisual* iter = this;
+        while(iter)
+            {
+            // Move up in the tree.
+            iter = iter->iLayout;
+            if(iter)
+                {
+                x+=iter->iPos.iX.iInterpolationStartValue;
+                y+=iter->iPos.iY.iInterpolationStartValue;
+                }
+            }
+
+        iDisplayRect.iTl.iX = x;
+        iDisplayRect.iTl.iY = y;
+        iDisplayRect.iBr.iX = x+width;
+        iDisplayRect.iBr.iY = y+height;
+        return iDisplayRect;
+        }
     // Recalculate and cache as necessary. 
     TBool recalculationNeeded = ETrue;
     
@@ -1483,7 +1512,7 @@
             ExpandRectWithContent(dirty);
             }
 
-		TRect& previousDrawn = display->IsDisplayTypeTvOut() ? iVisualData->iPreviousDrawnTvOut : iPreviousDrawn;
+		TRect& previousDrawn = iPreviousDrawn;
         
         // CombineAndAddDirtyRegion modifies "dirty" param by transforming it.
         // "previousDrawn" is supposed to be already transformed. 
@@ -2153,3 +2182,50 @@
     delete iVisualData->iEffectParser;
     iVisualData->iEffectParser = aEffectParser;
     }
+
+TInt CHuiVisual::QueryCanvasFlags()
+    {
+    THuiVisualQueryParams p;
+    p.iQueryType = THuiVisualQueryParams::EQueryCanvasFlags;
+    p.iValue = 0;
+    p.iResult = KErrNotSupported;
+    TAny* ptr = &p;
+    
+    VisualExtension(KHuiVisualQueryUid, &ptr);
+    
+    // If visual does not support this extension, assume 0
+    
+    return ( p.iResult == KErrNone ) ? p.iValue : 0;
+    }
+    
+TBool CHuiVisual::QueryExternalContentDrawingEnabled()
+    {
+    THuiVisualQueryParams p;
+    p.iQueryType = THuiVisualQueryParams::EQueryExternalContentDrawingEnabled;
+    p.iValue = 0;
+    p.iResult = KErrNotSupported;
+    TAny* ptr = &p;
+    
+    VisualExtension(KHuiVisualQueryUid, &ptr);
+    
+    // If visual does not support this extension, assume
+    // that visual does not have external content drawing enabled.
+    
+    return ( p.iResult == KErrNone ) && p.iValue;
+    }
+    
+TBool CHuiVisual::QueryHasDrawableContent()
+    {
+    THuiVisualQueryParams p;
+    p.iQueryType = THuiVisualQueryParams::EQueryHasDrawableContent;
+    p.iValue = 0;
+    p.iResult = KErrNotSupported;
+    TAny* ptr = &p;
+    
+    VisualExtension(KHuiVisualQueryUid, &ptr);
+
+    // If visual does not support this extension, assume
+    // that it has something to draw.
+    
+    return p.iValue || ( p.iResult != KErrNone );
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvasgc.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvasgc.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1193,7 +1193,19 @@
                 // Could copy only needed rects to avoid excessive clipping
                 iDelayedClipRegion.Copy(iClippingRegion);
                 break;
-                }                                
+                }
+
+		    // both points lie outside - but the line may still intersect the region, 
+            // so represent the line as a rect and try an intersection test...
+            TRect lineBoundingRect(start, end);
+            lineBoundingRect.Normalize();
+            lineBoundingRect.iBr += TPoint(1, 1);
+            if (IsClipped(lineBoundingRect, iClippingRegion) != EFullyOutside)
+                {
+                iDelayedClipRegion.Copy(iClippingRegion);
+                vis1 = EPartialOverlap;
+                break;
+                }                    
             }                    
         }        
     if (vis1 == EFullyOutside && vis2 == EFullyOutside)
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -2067,7 +2067,8 @@
             TRgb oldColor = gc->PenColor();            
             gc->SetPenAlpha(0);
             gc->SetPenColor(KRgbBlue);
-            gc->Clear(); 
+            TRect rect = aUpdateRegion.BoundingRect();
+            gc->Clear(rect); 
             gc->SetPenAlpha(oldAlpha);
             gc->SetPenColor(oldColor);
             }
@@ -2106,6 +2107,7 @@
     // Set new clipping region which does not clip anything. 
     // We want always draw aUpdateRegion fully to the aRenderbuffer. 
     TRect displayArea = iCanvasGc->Gc()->DisplayArea(); 
+    
     iCanvasGc->Gc()->SetClip(displayArea); // this call does not transform region anymore
     
     // We use translation to get screen coordinates to match render buffer coordinates
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -2488,7 +2488,9 @@
 
 TInt CHuiCanvasWsPainter::EnableRenderBuffer(TBool aEnable)
     {
-    if (aEnable != iCanvasWsGc->IsRenderBufferEnabled())
+    iEnableRenderBuffer = aEnable;
+    
+    if (iCanvasWsGc && ( aEnable != iCanvasWsGc->IsRenderBufferEnabled() ) )
         {
         if (aEnable)
             {
@@ -2604,6 +2606,11 @@
         {
         oldGc->ClearCache();
         }
+    if ( iCanvasWsGc )
+        {
+        // Forward 'enable render buffer' setting to new GC.
+        iCanvasWsGc->EnableRenderbuffer( iEnableRenderBuffer );
+        }
 
     #ifdef HUI_DEBUG_TRACK_DRAWING
     CHuiCanvasWsGc* realGc = iCanvasWsGc;
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -1325,8 +1325,8 @@
 	
 TDisplayMode CHuiCanvasWsSwGc::SelectDisplayMode()
     {
-    TDisplayMode mode = EColor16MA;
-        
+    TDisplayMode mode = EColor16MAP;
+    
     // Note 64K mode cannot be used until separate mask is supported. It might be
     // possible to generate according to dirty region ?
     
@@ -1477,6 +1477,8 @@
         return;
         }
     
+    iBitGc->Reset();
+    
     if (aClear)
         {
         if (iDefaultClipRegion.Count())
--- a/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -149,7 +149,10 @@
     {
     if ((iAnimationState & EInitializing) && aTexture.iFrameCount > 1 && aTextureId == iTextureId1)
         {
+        delete iTexture;
         iTexture = iTexture1;
+        delete iTexture2;
+        iTexture2 = NULL;
         TRAP_IGNORE(iTexture2 = &iManager.LoadTextureL(*iFilename,EHuiTextureUploadFlagDefault, iTextureId2, 1))
         iFrameInterval = aTexture.iFrameInterval;
         iFrameCount = aTexture.iFrameCount;
--- a/uiacceltk/hitchcock/goommonitor/bwins/goommonitoru.DEF	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/bwins/goommonitoru.DEF	Mon Feb 22 17:57:49 2010 +0200
@@ -21,4 +21,5 @@
 	?UsesAbsoluteMemTargets@RGOomMonitorSession@@QAEXH@Z @ 20 NONAME ; void RGOomMonitorSession::UsesAbsoluteMemTargets(int)
 	?Connect@RGOomMonitorSession@@QAEHAAVTRequestStatus@@@Z @ 21 NONAME ; int RGOomMonitorSession::Connect(class TRequestStatus &)
 	?AppAboutToStart@RGOomMonitorSession@@QAEXAAVTRequestStatus@@ABVTUid@@@Z @ 22 NONAME ; void RGOomMonitorSession::AppAboutToStart(class TRequestStatus &, class TUid const &)
+	?MemoryAllocationsComplete@RGOomMonitorSession@@QAEXXZ @ 23 NONAME ; void RGOomMonitorSession::MemoryAllocationsComplete(void)
 
--- a/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml	Mon Feb 22 17:57:49 2010 +0200
@@ -18,7 +18,7 @@
 	actions are needed. This value is meaningful only when "check" or "estimate" sync mode is
 	used with plugins.
 -->
-	<global_settings low_ram_threshold="3637" good_ram_threshold="10000" max_app_close_batch="3" default_wait_after_plugin="500">
+	<global_settings low_ram_threshold="3637" good_ram_threshold="10000" max_app_close_batch="3" default_wait_after_plugin="300">
 	</global_settings>
 
 <!--	Application specific low RAM and good RAM thresholds are defined here. The higher values of
@@ -27,10 +27,11 @@
 -->
 	<app_specific_thresholds>
 
-  <app uid="101F857A" low_ram_threshold="26000" good_ram_threshold="28000" target_free_on_startup="26000"></app> <!-- Camera --> 
-  <app uid="200159B2" low_ram_threshold="5000" good_ram_threshold="10000" target_free_on_startup="26000"></app> <!-- MPlayer -->
-  <app uid="102824CD" low_ram_threshold="26000" good_ram_threshold="28000"></app> <!-- Embedded mplayer -->
+  <app uid="101F857A" low_ram_threshold="26000" good_ram_threshold="28000" target_free_on_startup="26000" skip_plugin="2002B3AE"></app> <!-- Camera --> 
+  <app uid="200159B2" low_ram_threshold="5000" good_ram_threshold="10000" target_free_on_startup="26000" skip_plugin="2002B3AE"></app> <!-- MPlayer -->
+  <app uid="102824CD" low_ram_threshold="26000" good_ram_threshold="28000" skip_plugin="2002B3AE"></app> <!-- Embedded mplayer -->
   <app uid="200009EE" low_ram_threshold="3637" good_ram_threshold="10000" target_free_on_startup="15000"></app> <!-- Photos -->
+  <app uid="101FD693" low_ram_threshold="5000" good_ram_threshold="10000" target_free_on_startup="26000"></app> <!-- Flashlite -->
 
 	</app_specific_thresholds>
 
@@ -40,7 +41,7 @@
 <!--		The uid DEFAULT_APP refers to all applications, which priority is not specifically
 		defined in the conf file.
 -->
-		<close_app uid="DEFAULT_APP" priority="80" sync_mode="check">
+		<close_app uid="DEFAULT_APP" priority="80" sync_mode="check" close_timeout="1000" wait_after_close="2000">
 			<app_close_idle_priority idle_time="900" priority="50"></app_close_idle_priority>
 			<app_close_idle_priority idle_time="43200" priority="20"></app_close_idle_priority>
 		</close_app>
@@ -55,6 +56,11 @@
 		<close_app uid="HIGH_PRIORITY_APP" priority="90" sync_mode="check">
 			<app_close_idle_priority idle_time="43200" priority="20"></app_close_idle_priority>
 		</close_app>
+		
+<!-- policy server takes time to release resources aftr apps close
+		this line may be enabled for flashlite and other apps that allocate mem through policy server
+		close_app uid="101FD693" priority="80" sync_mode="check" close_timeout="3000" wait_after_close="5000"
+-->
 	</app_close_settings>
 	
 <!--	The priority of executing each system plugin is defined here.
--- a/uiacceltk/hitchcock/goommonitor/eabi/goommonitoru.DEF	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/eabi/goommonitoru.DEF	Mon Feb 22 17:57:49 2010 +0200
@@ -25,4 +25,5 @@
 	_ZN19RGOomMonitorSession22UsesAbsoluteMemTargetsEi @ 24 NONAME
 	_ZN19RGOomMonitorSession15AppAboutToStartER14TRequestStatusRK4TUid @ 25 NONAME
 	_ZN19RGOomMonitorSession7ConnectER14TRequestStatus @ 26 NONAME
+	_ZN19RGOomMonitorSession25MemoryAllocationsCompleteEv @ 27 NONAME
 
--- a/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Mon Feb 22 17:57:49 2010 +0200
@@ -201,6 +201,10 @@
         }
     
     void SetPriority(TInt aWgId, TInt aPriority);
+    
+    TBool IsRunningKillAppActions();
+    
+    TUint CurrentPluginRun();
             
 private:
     
@@ -244,6 +248,8 @@
     RArray<TUint> iAppsProtectedByPlugins;
     
     TBool iRunningKillAppActions;
+    
+    TUint iCurrentPluginRun;
     };
 
 #include "goomactionlist.inl"
--- a/uiacceltk/hitchcock/goommonitor/inc/goomactionref.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionref.h	Mon Feb 22 17:57:49 2010 +0200
@@ -49,7 +49,7 @@
     TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, CGOomRunPlugin& aRunPlugin, TUint aWgIndexOfTargetApp);
 
     //constructor for AppClose actions
-    TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, TInt aWgId, TUint aWgIndex);
+    TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, TInt aWgId, TUint aWgIndex, TInt aCloseTimeout = 0, TInt aWaitAfterClose = 0);
     
     TActionType Type() const;
     TUint Priority() const;
@@ -59,6 +59,8 @@
     TInt WgId() const;
     TInt WgIndex() const;
     CGOomRunPlugin& RunPlugin();
+    TInt CloseTimeout() const;
+    TInt WaitAfterClose() const;
 
 private: //data
     
@@ -69,6 +71,8 @@
     TInt iWgId; //For AppClose
     TInt iWgIndex;
     CGOomRunPlugin* iRunPlugin; //For Plugins. Not owned
+    TInt iCloseTimeout; //For AppClose
+    TInt iWaitAfterClose; //For AppClose
     };
 
 #endif /*GOOMACTIONREF_H_*/
--- a/uiacceltk/hitchcock/goommonitor/inc/goomapplicationconfig.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomapplicationconfig.h	Mon Feb 22 17:57:49 2010 +0200
@@ -72,6 +72,7 @@
     TUint iGoodRamThreshold;
     TUint iLowRamThreshold; 
     TUint iTargetFree;
+    TUint iSkipPluginId;
     
 private:
     
--- a/uiacceltk/hitchcock/goommonitor/inc/goomcloseapp.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomcloseapp.h	Mon Feb 22 17:57:49 2010 +0200
@@ -83,6 +83,8 @@
     void ConstructL();
     
     TUint iWgId;
+    TInt iCloseTimeout; 
+    TInt iWaitAfterClose; 
         
     TBool iAppCloserRunning;
     TApaTask iCurrentTask;
--- a/uiacceltk/hitchcock/goommonitor/inc/goomcloseappconfig.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomcloseappconfig.h	Mon Feb 22 17:57:49 2010 +0200
@@ -49,6 +49,9 @@
      */
     inline TUint CalculateCloseAppPriority(const CGOomWindowGroupList& aWindowGroupList, TUint aAppIndexInWindowGroup);
     
+    TInt iCloseTimeout;
+    TInt iWaitAfterClose;
+    
 private:
     
     CGOomCloseAppConfig(TInt32 aId);
--- a/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h	Mon Feb 22 17:57:49 2010 +0200
@@ -25,6 +25,7 @@
 #include <EGL/egl.h>
 #include "goomglobalconfig.h"
 #include "goomwindowgrouplist.h"
+#include "goomtraces.h"
 
 // ---------------------------------------------------------
 // CMemoryMonitor
@@ -40,16 +41,25 @@
 
 typedef EGLBoolean (*NOK_resource_profiling)(EGLDisplay, EGLint, EGLint*, EGLint, EGLint*);
 
+class CGOomSynchTimer;
+
 NONSHARABLE_CLASS(CMemoryMonitor) : public CBase
     {
 public:
     static CMemoryMonitor* NewL();
     ~CMemoryMonitor();
+    
+    enum TGOomTrigger   //How free memory operation was triggered
+            {
+            EGOomFocusChanged = 0,
+            EGOomRequestMemory,
+            EGOomThresholdCrossed
+            };
 
 public: // event handlers
     void FreeMemThresholdCrossedL(TInt aAction = 0, TInt aThreshold = 0);
     void AppNotExiting(TInt aWgId);
-    void StartFreeSomeRamL(TInt aTargetFree);
+    void StartFreeSomeRamL(TInt aTargetFree, TGOomTrigger aTrigger);
     void FreeOptionalRamL(TInt aTargetFree, TInt aPluginId, TBool aUseAbsolute = EFalse); // The ID of the plugin that will clear up the allocation, used to determine the priority of the allocation
     void RequestFreeMemoryL(TInt aTargetFree, TBool aUseAbsolute = EFalse);
     void HandleFocusedWgChangeL(TInt aForegroundAppUid = KErrNotFound);
@@ -61,6 +71,7 @@
     TInt GetFreeMemory();
     void RunCloseAppActions(TInt aMaxPriority);
     CGOomWindowGroupList * GetWindowGroupList() const;
+    TBool IsSafeToProcessNewRequest(TUint aClientId);
         
     
     void SetActiveClient(TInt aClientId)
@@ -77,22 +88,34 @@
         {
         return iForegroundAppUid;
         } 
-    void SessionInCriticalAllocation(TBool aPostponeMemGood)
+    void SessionInCriticalAllocation(TBool aPostponeMemGood, TUint aClientId)
         {
+        FUNC_LOG;
         if (aPostponeMemGood)
             {
             iPostponeMemGood++;
+            if(iClientsRequestingMemory.Find(aClientId) == KErrNotFound)
+                iClientsRequestingMemory.Append(aClientId);
+            
+            TRACES2("SessionInCriticalAllocation : STARTING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
             }
         else
             {
             iPostponeMemGood--;
-            if(iPostponeMemGood<0)
+            TInt idx = iClientsRequestingMemory.Find(aClientId);
+            if(idx != KErrNotFound)
+                {
+                iClientsRequestingMemory.Remove(idx);
+                TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count());
+                }
+            
+             if(iPostponeMemGood<0)
                 {
                 iPostponeMemGood = 0;
                 }
             }
-                        
-        if (iPostponeMemGood == 0)
+        TRACES1("SessionInCriticalAllocation : ClientsRequestingMemory Count %d", iClientsRequestingMemory.Count());    
+        if (iClientsRequestingMemory.Count() == 0)
             {
             DoPostponedMemoryGood();
             }
@@ -103,18 +126,23 @@
     
     TBool NeedToPostponeMemGood()
         {
-        return (iPostponeMemGood != 0);
+        //return (iPostponeMemGood != 0);
+        return (iClientsRequestingMemory.Count() != 0);
         } 
     
+    void WaitAndSynchroniseMemoryState();
+    void SynchroniseMemoryState();
+    
 private:
     CMemoryMonitor();
     void ConstructL();
     TBool FreeGraphicsMemoryAboveThresholdL(TInt& aCurrentFreeMemory);
     void CloseNextApp();
     void RefreshThresholds(TInt aForegroundAppUid = KErrNotFound);
-    void StartFreeSomeRamL(TInt aTargetFree, TInt aMaxPriority);
+    void StartFreeSomeRamL(TInt aTargetFree, TInt aMaxPriority, TGOomTrigger aTrigger);
     void AppClosePriorityChanged(TInt aWgId, TInt aPriority);
     
+    
 public:
     // All members are owned
     // generally useful sessions
@@ -174,6 +202,26 @@
     
     TInt iForegroundAppUid;
     TInt iPostponeMemGood;
+    
+    RArray<TUint> iClientsRequestingMemory;
+    
+    TGOomTrigger iTrigger;
+    
+    CGOomSynchTimer* iSynchTimer;
     };
 
+
+
+NONSHARABLE_CLASS(CGOomSynchTimer) : public CTimer
+    {
+    public:
+        static CGOomSynchTimer* NewL(CMemoryMonitor& aMonitor);
+        
+    private:
+        CMemoryMonitor& iMonitor;
+        CGOomSynchTimer(CMemoryMonitor& aMonitor);
+        void RunL();
+    };
+
+
 #endif /*GOOMMEMORYMONITOR_H*/
--- a/uiacceltk/hitchcock/goommonitor/inc/goommonitorclientserver.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goommonitorclientserver.h	Mon Feb 22 17:57:49 2010 +0200
@@ -34,6 +34,7 @@
 enum TGOomMonitorCmd
     {
     EGOomMonitorRequestFreeMemory,
+    EGOomMonitorMemoryAllocationsComplete,
     EGOomMonitorCancelRequestFreeMemory,
     EGOomMonitorThisAppIsNotExiting,
     EGOomMonitorRequestOptionalRam,
--- a/uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.h	Mon Feb 22 17:57:49 2010 +0200
@@ -55,6 +55,8 @@
     // To be called by the CGOomPluginWaiter
     inline void WaitCompleted();
     
+    TUint Id();
+    
 protected:
     
     void ConstructL(CGOomRunPluginConfig& aPluginConfig);    
--- a/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Mon Feb 22 17:57:49 2010 +0200
@@ -72,6 +72,11 @@
     
     // Find the specificed application in the window group list and return the index
     TInt GetIndexFromAppId(TUint aAppId) const;
+    TInt GetIndexFromWgId(TInt aWgId) const;
+    
+    // Find all the windowgroups in the list that matches application id for this window group
+    void GetAllWgIdsMatchingAppId(TInt aWgId, RArray<TInt> & WgIdList) const;
+    
     
 private:    
 
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -177,9 +177,30 @@
         else
             actionType = TActionRef::ESystemPlugin;
 
+
+        //get skip plugin config for foreground app
+        TUint foregroundUid = iMonitor.ForegroundAppUid();
+        if(aConfig.GetApplicationConfig(foregroundUid).iSkipPluginId == iPluginList->Uid(pluginIndex))
+            {
+            TRACES2("Skiping plugin %x, configured for app %x", iPluginList->Uid(pluginIndex), foregroundUid);
+            actionsIndex++;
+            continue ; //skip this and continue with next plugin
+            }
+        
+        TUint activeClientId = iMonitor.ActiveClientId();
+        if(activeClientId!=0 && activeClientId!=foregroundUid)
+            {
+            if(aConfig.GetApplicationConfig(activeClientId).iSkipPluginId == iPluginList->Uid(pluginIndex))
+                        {
+                        TRACES2("Skiping plugin %x, configured for app %x", iPluginList->Uid(pluginIndex), foregroundUid);
+                        actionsIndex++;
+                        continue ; //skip this and continue with next plugin
+                        }
+            }
+        
         TActionRef ref = TActionRef(actionType, priority, syncMode, ramEstimate, *(iRunPluginActions[actionsIndex]), aWindowGroupList.GetIndexFromAppId(pluginConfig.TargetApp()));
         iAppsProtectedByPlugins.Append(pluginConfig.TargetApp());
-        TRACES1("Creating Plugin Action Item TargetAppId %x", pluginConfig.TargetApp());
+        TRACES2("Creating Plugin Action Item %x , TargetAppId %x", iPluginList->Uid(pluginIndex), pluginConfig.TargetApp());
         //It is valid to have plugins with equal priority
         User::LeaveIfError(iActionRefs.InsertInOrderAllowRepeats(ref, ComparePriorities));
 
@@ -193,8 +214,8 @@
     {
     FUNC_LOG;
     
-    iActionRefs.Reset();
-    iCurrentActionIndex = 0;
+//    iActionRefs.Reset();
+//    iCurrentActionIndex = 0;
     
     aWindowGroupList.RefreshL();
     
@@ -218,20 +239,23 @@
                 {
                 CGOomCloseAppConfig* appCloseConfig = NULL;
     
-                CApaWindowGroupName* wgName = aWindowGroupList.WgName();
-                __ASSERT_DEBUG(wgName, GOomMonitorPanic(KInvalidWgName));
-    
                 // Get the app ID for the wglist item
                 // This sets the window group name
                 TInt32 appId = aWindowGroupList.AppId(wgIndex, ETrue);
-     
-                if ( !appId  || foregroundUid.iUid ==appId || wgName->IsSystem() || wgName->Hidden() || (iAppsProtectedByPlugins.Find(appId) != KErrNotFound))
+                
+                CApaWindowGroupName* wgName = aWindowGroupList.WgName();
+                __ASSERT_DEBUG(wgName, GOomMonitorPanic(KInvalidWgName));
+
+                    
+                TBool skipped = EFalse;
+                if ( !appId  || foregroundUid.iUid ==appId || (iAppsProtectedByPlugins.Find(appId) != KErrNotFound))
                     {
                     //If the UID is NULL at this point, we assume the process is not an application
                     //and therefore is not a suitable candidate for closure.
                     //We also do not close system or hidden apps.
                     TRACES3("BuildActionListL: Not adding process to action list; UID = %x, wgIndex = %d, wgid = %d", appId, wgIndex, aWindowGroupList.WgId(wgIndex).iId);
-                    TRACES3("BuildActionListL: IsSystem = %d, Hidden = %d, Foregroundapp %x", wgName->IsSystem() ? 1 : 0, wgName->Hidden() ? 1 : 0, foregroundUid);
+                    TRACES1("BuildActionListL: Foregroundapp %x", foregroundUid);
+                    skipped = ETrue;
                     }
     
                 else if (aWindowGroupList.IsBusy(wgIndex) || wgName->IsBusy())
@@ -252,6 +276,11 @@
                     // Find the app close config for this app ID
                     appCloseConfig = aConfig.GetApplicationConfig(appId).GetAppCloseConfig();
                     }
+                
+                if(!appCloseConfig && !skipped)
+                    {
+                    appCloseConfig = aConfig.GetApplicationConfig(KGOomDefaultAppId).GetAppCloseConfig();
+                    }
     
                 // Create the app close action and add it to the action list
                 if (appCloseConfig)
@@ -260,7 +289,7 @@
                     TInt wgId = aWindowGroupList.WgId(wgIndex).iId;
                     TGOomSyncMode syncMode = appCloseConfig->iSyncMode;
                     TInt ramEstimate = appCloseConfig->iRamEstimate;
-                    TActionRef ref = TActionRef(TActionRef::EAppClose, priority, syncMode, ramEstimate, wgId, wgIndex);
+                    TActionRef ref = TActionRef(TActionRef::EAppClose, priority, syncMode, ramEstimate, wgId, wgIndex, appCloseConfig->iCloseTimeout, appCloseConfig->iWaitAfterClose);
     
                     //AppClose Actions should always have a unique prioirity determined by the application's z order.
                     TInt err = iActionRefs.InsertInOrder(ref, ComparePriorities);
@@ -320,7 +349,7 @@
             
             //Double checking again if this app is now in foreground, if yes then we dont kill
             CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(iWs, iWs.GetFocusWindowGroup());
-            RDebug::Print(wgName->WindowGroupName());
+            
             TInt32 fgApp = wgName->AppUid().iUid;
             TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue);
             if(appId == fgApp)
@@ -334,11 +363,13 @@
         else
             {
             action = &(ref.RunPlugin());
+            iCurrentPluginRun = ref.RunPlugin().Id();
             }
 
         iFreeingMemory = ETrue;
         TRACES2("CGOomActionList::FreeMemory: Running action %d which has priority %d", iCurrentActionIndex,ref.Priority());
         action->FreeMemory(iCurrentTarget - memoryEstimate);
+        iCurrentPluginRun = 0;
         memoryFreeingActionRun = ETrue;
 
         // Actions with EContinueIgnoreMaxBatchSize don't add to the tally of running actions
@@ -379,10 +410,7 @@
         TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
         iMonitor.ResetTargets();
         TInt freeMemory;
-        if (FreeMemoryAboveTarget(freeMemory) && !iMonitor.NeedToPostponeMemGood())
-            {
-            MemoryGood();
-            }
+        FreeMemoryAboveTarget(freeMemory);
         iServer.CloseAppsFinished(freeMemory, EFalse);
         }
     }
@@ -587,6 +615,7 @@
                     iRunningKillAppActions = ETrue;
                     iMonitor.RunCloseAppActions(iMaxPriority);
                     }
+                iMonitor.WaitAndSynchroniseMemoryState();
                 }
             else
                 {
@@ -607,6 +636,7 @@
             iRunningKillAppActions = EFalse;
             iMonitor.ResetTargets();
             iServer.CloseAppsFinished(freeMemory, ETrue);
+            iMonitor.WaitAndSynchroniseMemoryState();
             }
         }
 
@@ -653,14 +683,15 @@
         }
     }
 
-void CGOomActionList::SetPriority(TInt aWgIndex, TInt aPriority)
+
+void CGOomActionList::SetPriority(TInt aWgId, TInt aPriority)
     {
     FUNC_LOG;
 
     TInt idx = iActionRefs.Count()-1;
     while(idx >= 0)
         {
-        if(iActionRefs[idx].WgIndex() == aWgIndex)
+        if(iActionRefs[idx].WgId() == aWgId)
             {
             break;
             }
@@ -669,15 +700,22 @@
     
     if(idx >= 0)
         {
-        TRACES2("CGOomActionList::SetPriority Setting app wgindex %d, index %d as busy", aWgIndex, idx);
+        TRACES2("CGOomActionList::SetPriority Setting app wgid %d, index %d as busy", aWgId, idx);
         iActionRefs[idx].SetPriority(aPriority);
-        if (!iFreeingMemory)
-            {
-            iActionRefs.Sort(ComparePriorities);
-            }
         }
     else
         {
-        TRACES1("CGOomActionList::SetPriority wgindex %d not in the hitlist", aWgIndex);
+        TRACES1("CGOomActionList::SetPriority wgd %d not in the hitlist", aWgId);
         }
     }
+
+
+TUint CGOomActionList::CurrentPluginRun()
+    {
+    return iCurrentPluginRun;
+    }
+
+TBool CGOomActionList::IsRunningKillAppActions()
+    {
+    return iRunningKillAppActions;
+    }
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionref.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionref.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -23,8 +23,8 @@
     {   
     }
 
-TActionRef::TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, TInt aWgId, TUint aWgIndex)
-: iType(aType), iPriority(aPriority), iSyncMode(aSyncMode), iRamEstimate(aRamEstimate), iWgId(aWgId), iWgIndex(aWgIndex), iRunPlugin(NULL)
+TActionRef::TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, TInt aWgId, TUint aWgIndex, TInt aCloseTimeout, TInt aWaitAfterClose)
+: iType(aType), iPriority(aPriority), iSyncMode(aSyncMode), iRamEstimate(aRamEstimate), iWgId(aWgId), iWgIndex(aWgIndex), iRunPlugin(NULL), iCloseTimeout(aCloseTimeout), iWaitAfterClose(aWaitAfterClose)
     {   
     }
 
@@ -59,6 +59,16 @@
     return iWgId;
     }
 
+TInt TActionRef::CloseTimeout() const
+    {
+    return iCloseTimeout;
+    }
+
+TInt TActionRef::WaitAfterClose() const
+    {
+    return iWaitAfterClose;
+    }
+
 TInt TActionRef::WgIndex() const
     {
     return iWgIndex;
--- a/uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -24,8 +24,6 @@
 #include "goomappclosewatcher.h"
 #include "goomactionref.h"
 
-const TInt KGOomMaxAppExitTime = 1000000;
-const TInt KGOomMaxAppAfterKillWaitTime = 1000000;
 
 CGOomCloseApp* CGOomCloseApp::NewL(MGOomActionObserver& aStateChangeObserver, RWsSession& aWs)
     {
@@ -51,10 +49,10 @@
     
     // Start a timer and the thread watcher 
     iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing);
-    iAppCloseTimer->After(KGOomMaxAppExitTime);
+    iAppCloseTimer->After(iCloseTimeout * 1000);
     iAppCloseWatcher->Start(iCurrentTask);
     // Tell the app to close
-    TRACES1("CGOomCloseApp::FreeMemory: Closing app with window group id %d",iWgId);
+    TRACES2("CGOomCloseApp::FreeMemory: Closing app with window group id %d Timeout = %d",iWgId, iCloseTimeout);
     iCurrentTask.EndTask();
     }
 
@@ -81,12 +79,16 @@
     iAppCloserRunning = EFalse;
     
     if (iAppCloseTimer)
-        iAppCloseTimer->Cancel();
+        {
+            iAppCloseTimer->Cancel();
+            iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled);
+            iAppCloseTimer->After(iWaitAfterClose * 1000);
+        }
+    
     if (iAppCloseWatcher)
         iAppCloseWatcher->Cancel(); 
     
-    iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled);
-    iAppCloseTimer->After(KGOomMaxAppAfterKillWaitTime);
+    
     //MemoryFreed(KErrNone);
     }
 
@@ -95,6 +97,8 @@
     FUNC_LOG;
 
     iWgId = aRef.WgId();    
+    iCloseTimeout = aRef.CloseTimeout();
+    iWaitAfterClose = aRef.WaitAfterClose();
     }
 
 void CGOomCloseApp::ConstructL()
@@ -128,7 +132,7 @@
     iAppCloserRunning = EFalse;
     
     iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled);
-    iAppCloseTimer->After(KGOomMaxAppAfterKillWaitTime);
+    iAppCloseTimer->After(iWaitAfterClose * 1000);
     //MemoryFreed(KErrNone);
     }
 
--- a/uiacceltk/hitchcock/goommonitor/src/goomconfigparser.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomconfigparser.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -56,6 +56,7 @@
 KGOomErrBadLowThresholdValueForAppConfig,
 KGOomErrBadGoodThresholdValueForAppConfig,
 KGOomErrBadTargetFreeValueForAppConfig,
+KGOomErrBadSkipPluginValueForAppConfig,
 KGOomErrSystemPluginSettingsMustComeAfterAppCloseSettings,
 KGOomErrAppPluginSettingsMustComeAfterSystemPluginSettings,
 KGOomErrAppPluginIdleTimeRulesMustComeAfterAppPluginSettings,
@@ -109,6 +110,9 @@
 _LIT8(KGOomConfigAppCloseSettings, "app_close_settings");
 _LIT8(KGOomConfigCloseApp, "close_app");
 
+_LIT8(KGOomAttributeAppCloseTimeout, "close_timeout");
+_LIT8(KGOomAttributeAppWaitAfterClose, "wait_after_close");
+
 // App close idle time
 _LIT8(KGOomConfigAppCloseIdlePriority, "app_close_idle_priority");
 
@@ -122,6 +126,7 @@
 
 //App specific
 _LIT8(KGOomAttributeTargetFreeOnStartup, "target_free_on_startup");
+_LIT8(KGOomAttributeSkipPlugin, "skip_plugin");
 
 // System plugins 
 
@@ -478,6 +483,24 @@
             if (err != KErrNone)
                 ConfigError(KGOomErrBadTargetFreeValueForAppConfig);
             }
+        
+    // Get the app specific SkipPlugin
+        if (err == KErrNone)
+            {
+            TUint skipPlugin;
+            err = GetValueFromHexAttributeList(aAttributes, KGOomAttributeSkipPlugin, skipPlugin);
+            if (err == KErrNone)
+                {
+                TRACES2("SKIP PLUGIN %x configured for App %x", skipPlugin, uid); 
+                appConfig->iSkipPluginId = skipPlugin;
+                }
+            else if (err == KErrNotFound)
+                err = KErrNone;
+            
+            if (err != KErrNone)
+                ConfigError(KGOomErrBadSkipPluginValueForAppConfig);
+            }
+                
     
     // Add the applciation config to the main config
     if ((err == KErrNone) && (appConfig))
@@ -568,10 +591,46 @@
             ConfigError(KGOomErrMissingEstimateFromAppCloseConfig);
         else
             closeAppConfig->iRamEstimate = ramEstimate * 1024;
-           }
+        }
+    
+    if (err == KErrNone)
+        {
+        TInt closeTimeout;
+        err = GetValueFromDecimalAttributeList(aAttributes, KGOomAttributeAppCloseTimeout, closeTimeout);
+        if (err == KErrNone)
+            {
+            closeAppConfig->iCloseTimeout = closeTimeout;
+            }
+        else if (err == KErrNotFound)
+            {
+            closeAppConfig->iCloseTimeout=0;
+            err = KErrNone;
+            }
+        }
+     
+    if (err == KErrNone)
+        {
+        TInt waitAfterClose;
+        err = GetValueFromDecimalAttributeList(aAttributes, KGOomAttributeAppWaitAfterClose, waitAfterClose);
+        if (err == KErrNone)
+            {
+            closeAppConfig->iWaitAfterClose = waitAfterClose;
+            }
+        else if (err == KErrNotFound)
+            {
+            err = KErrNone;
+            closeAppConfig->iWaitAfterClose = 0;
+            }
+        }
 
     if (err == KErrNone)
-        iConfig.SetAppCloseConfigL(closeAppConfig);
+        {
+         iConfig.SetAppCloseConfigL(closeAppConfig);
+        }
+    else
+        {
+        TRACES2("ERROR Creating Appcloseconfig file for %x, err %d", uid,err);
+        }
     
     CleanupStack::Pop(closeAppConfig);
     }
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -48,6 +48,8 @@
 #include "goomthresholdcrossedao.inl"
 #endif
 
+const TInt KGoomWaitTimeToSynch = 1000000;
+
 // ======================================================================
 // class CMemoryMonitor
 // ======================================================================
@@ -81,6 +83,8 @@
 CMemoryMonitor::~CMemoryMonitor()
     {
     FUNC_LOG;
+    
+    delete iSynchTimer;
 
     delete iServer;
     delete iWservEventReceiver;
@@ -184,6 +188,8 @@
     
     iWservEventReceiver = new(ELeave) CWservEventReceiver(*this, iWs);
     iWservEventReceiver->ConstructL();
+    
+    iSynchTimer = CGOomSynchTimer::NewL(*this);
     }
 
 const CGOomGlobalConfig& CMemoryMonitor::GlobalConfig()
@@ -202,30 +208,37 @@
     FUNC_LOG;
     // keep only one notification active at a moment
 #ifdef USE_ASYNCYH_NOTIFICATIONS 
-    if (aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK)
-        {
-        TRACES("FreeMemThresholdCrossedL : EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK");
-        iMemAllocationsGrowing->Stop();
-        iMemAllocationsGoingDown->Continue();
-        }
-    else
-        {
-        TRACES("FreeMemThresholdCrossedL : EGL_PROF_TOTAL_MEMORY_USAGE_LT_NOK");
-        iMemAllocationsGrowing->Continue();
-        iMemAllocationsGoingDown->Stop();            
-        }    
-#endif
-
-    StartFreeSomeRamL(iGoodThreshold);
+   
     if (aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_LT_NOK)
         {
         TInt current = GetFreeMemory();
         if(current >= iGoodThreshold  && (!NeedToPostponeMemGood()))
             {
-            TRACES("FreeMemThresholdCrossedL : calling MemoryGOOD");
+            TRACES2("FreeMemThresholdCrossedL : crossed good threshold Free %d, GThresh %d, Calling MemoryGood",current, iGoodThreshold);
             iGOomActionList->MemoryGood();
+            iMemAllocationsGrowing->Continue();
+            iMemAllocationsGoingDown->Stop();
+            return;
+            }
+        else
+            {
+            TRACES3("FreeMemThresholdCrossedL : Not Calling MemoryGOOD. Free %d, GThresh %d, Handshakepending = %d",current, iGoodThreshold, NeedToPostponeMemGood()?1:0);
+            //if we remain in low mem mode, we have to wait for the same trigger i.e. free mem crossing good threshold
+            
+            if(NeedToPostponeMemGood()) //if handshake pending
+                iMemAllocationsGoingDown->Stop();   //Stop till handhsake is complete. It will be made to continue from DoPostponedMemoryGood
+            else
+                iMemAllocationsGoingDown->Continue();
             }
         }
+    else//if aThreshold == EGL_PROF_TOTAL_MEMORY_USAGE_GT_NOK
+        {
+        TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold);
+        iMemAllocationsGrowing->Stop();
+        iMemAllocationsGoingDown->Continue();
+        StartFreeSomeRamL(iGoodThreshold, EGOomThresholdCrossed);
+        }
+#endif
     }
 
 void CMemoryMonitor::HandleFocusedWgChangeL(TInt aForegroundAppUid)
@@ -244,20 +257,10 @@
     RefreshThresholds(aForegroundAppUid);
     // Not very elegant, now we poll on each window group change
     // Should have better trigger e.g. from window server 
-#ifndef USE_ASYNCYH_NOTIFICATIONS  
-    TInt current = GetFreeMemory();
-    if (current < iLowThreshold)
-        {
-        StartFreeSomeRamL(iGoodThreshold);
-        }  
-    else if(current >= iGoodThreshold)
-        {
-        iGOomActionList->MemoryGood();
-        }
-#endif
+	StartFreeSomeRamL(iCurrentTarget, EGOomFocusChanged);
      }
 
-void CMemoryMonitor::StartFreeSomeRamL(TInt aTargetFree, TInt aMaxPriority) // The maximum priority of action to run
+void CMemoryMonitor::StartFreeSomeRamL(TInt aTargetFree, TInt aMaxPriority, TGOomTrigger aTrigger) // The maximum priority of action to run
     {
     FUNC_LOG;
 
@@ -299,8 +302,10 @@
     //iGOomActionList->SetCurrentTarget(aTargetFree);
     iGOomActionList->SetCurrentTarget(iCurrentTarget);
 
+    iTrigger = aTrigger;
     // Run the memory freeing actions
     iGOomActionList->FreeMemory(aMaxPriority);
+    
     }
 
 void CMemoryMonitor::RunCloseAppActions(TInt aMaxPriority)
@@ -317,18 +322,18 @@
 // of applications, and each will be given a timeout of KAPPEXITTIMEOUT.
 // ---------------------------------------------------------
 //
-void CMemoryMonitor::StartFreeSomeRamL(TInt aTargetFree)
+void CMemoryMonitor::StartFreeSomeRamL(TInt aTargetFree, TGOomTrigger aTrigger)
     {
     FUNC_LOG;
 
-    StartFreeSomeRamL(aTargetFree, KGOomPriorityInfinate - 1);
+    StartFreeSomeRamL(aTargetFree, KGOomPriorityInfinate - 1, aTrigger);
     }
 
 void CMemoryMonitor::RequestFreeMemoryL(TInt aTargetFree, TBool aUseAbsolute)
     {
     FUNC_LOG;
 
-    StartFreeSomeRamL(aUseAbsolute?aTargetFree:(aTargetFree + iLowThreshold), KGOomPriorityInfinate - 1);
+    StartFreeSomeRamL(aUseAbsolute?aTargetFree:(aTargetFree + iLowThreshold), KGOomPriorityInfinate - 1, EGOomRequestMemory);
     }
 
 void CMemoryMonitor::FreeOptionalRamL(TInt aTargetFree, TInt aPluginId, TBool aUseAbsolute) // The ID of the plugin that will clear up the allocation, used to determine the priority of the allocation
@@ -337,7 +342,7 @@
 
     // Calculate the priority of the allocation (the priority of the plugin that will clear it up - 1)
     TInt priorityOfAllocation = iConfig->GetPluginConfig(aPluginId).CalculatePluginPriority(*iGOomWindowGroupList) - 1;
-    StartFreeSomeRamL(aUseAbsolute?aTargetFree:(aTargetFree + iGoodThreshold), priorityOfAllocation);
+    StartFreeSomeRamL(aUseAbsolute?aTargetFree:(aTargetFree + iGoodThreshold), priorityOfAllocation, EGOomRequestMemory);
     }
 
 // Does the EGL extension return the amount of memory in bits?
@@ -469,26 +474,52 @@
 void CMemoryMonitor::SetPriorityBusy(TInt aWgId)
     {
     FUNC_LOG;
+    TRACES2("Received SetPriorityBusy for appid = %x, wgid = %d", iGOomWindowGroupList->AppIdfromWgId(aWgId, ETrue), aWgId);
     
-    TRACES2("Received SetPriorityBusy for appid = %x, wgid = %d", iGOomWindowGroupList->AppIdfromWgId(aWgId, ETrue), aWgId);
-    iGOomWindowGroupList->SetPriorityBusy(aWgId);
-    AppClosePriorityChanged(aWgId, RGOomMonitorSession::EGOomPriorityBusy);
+    RArray<TInt> WgIdList;
+    iGOomWindowGroupList->GetAllWgIdsMatchingAppId(aWgId, WgIdList);
+        
+    TInt i = WgIdList.Count();
+    while(i--)
+        {
+        iGOomWindowGroupList->SetPriorityBusy(WgIdList[i]);
+        if(iGOomActionList->IsRunningKillAppActions())  //this may be too late as killing of apps has already begun, but we might still be able to save the app 
+            AppClosePriorityChanged(WgIdList[i], RGOomMonitorSession::EGOomPriorityBusy);
+        }
     }
 
 void CMemoryMonitor::SetPriorityNormal(TInt aWgId)
     {
     FUNC_LOG;
-
-    iGOomWindowGroupList->SetPriorityNormal(aWgId);
-    AppClosePriorityChanged(aWgId, RGOomMonitorSession::EGOomPriorityNormal);
+    TRACES2("Received SetPriorityBusy for appid = %x, wgid = %d", iGOomWindowGroupList->AppIdfromWgId(aWgId, ETrue), aWgId);
+    
+    RArray<TInt> WgIdList;
+    iGOomWindowGroupList->GetAllWgIdsMatchingAppId(aWgId, WgIdList);
+        
+    TInt i = WgIdList.Count();
+    while(i--)
+        {
+        iGOomWindowGroupList->SetPriorityNormal(WgIdList[i]);
+        if(iGOomActionList->IsRunningKillAppActions())
+            AppClosePriorityChanged(WgIdList[i], RGOomMonitorSession::EGOomPriorityNormal);
+        }
     }
 
 void CMemoryMonitor::SetPriorityHigh(TInt aWgId)
     {
     FUNC_LOG;
+    TRACES2("Received SetPriorityBusy for appid = %x, wgid = %d", iGOomWindowGroupList->AppIdfromWgId(aWgId, ETrue), aWgId);
     
-    iGOomWindowGroupList->SetPriorityHigh(aWgId);
-    AppClosePriorityChanged(aWgId, RGOomMonitorSession::EGOomPriorityHigh);
+    RArray<TInt> WgIdList;
+    iGOomWindowGroupList->GetAllWgIdsMatchingAppId(aWgId, WgIdList);
+        
+    TInt i = WgIdList.Count();
+    while(i--)
+        {    
+        iGOomWindowGroupList->SetPriorityHigh(WgIdList[i]);
+        if(iGOomActionList->IsRunningKillAppActions())
+            AppClosePriorityChanged(WgIdList[i], RGOomMonitorSession::EGOomPriorityHigh);
+        }
     }
 
 TInt CMemoryMonitor::GetFreeMemory()
@@ -586,14 +617,24 @@
     {
     FUNC_LOG;
     TInt current = GetFreeMemory();
-    if(current >= iGoodThreshold  && (!NeedToPostponeMemGood()))
+    if(current >= iGoodThreshold)
         {
-        TRACES("DoPostponedMemoryGood calling MemoryGOOD");
-        iGOomActionList->MemoryGood();
+        if(!NeedToPostponeMemGood())
+            {
+            TRACES("DoPostponedMemoryGood calling MemoryGOOD");
+            iGOomActionList->MemoryGood();
+            }
+        else
+            {
+            iMemAllocationsGoingDown->Continue();
+            }
         }
+    else
+        {
+        iMemAllocationsGoingDown->Continue();
+        }   
     }    
 
-
 void CMemoryMonitor::AppClosePriorityChanged(TInt aWgId, TInt aPriority)
     {
     FUNC_LOG;
@@ -615,19 +656,21 @@
         appCloseConfig = iConfig->GetApplicationConfig(aWgId).GetAppCloseConfig();
         TRACES("CMemoryMonitor::AppClosePriorityChanged NORMAL");
     }
-        
+    
+    if(!appCloseConfig)
+        {
+        appCloseConfig = iConfig->GetApplicationConfig(KGOomDefaultAppId).GetAppCloseConfig();
+        }
+    
     if (appCloseConfig)
         {  
-        TInt32 appId = iGOomWindowGroupList->AppIdfromWgId(aWgId, ETrue);
-        TInt wgIndex=iGOomWindowGroupList->GetIndexFromAppId(appId);
-        
-        TRACES2("CMemoryMonitor::AppClosePriorityChanged wgindex %d, appid %x", wgIndex, appId);
+        TInt wgIndex=iGOomWindowGroupList->GetIndexFromWgId(aWgId);
         
         if(wgIndex>=0)
             {
-            TRACES2("CMemoryMonitor::AppClosePriorityChanged Setting Priority for app %x, wgid %d", appId, aWgId);
+            TRACES2("CMemoryMonitor::AppClosePriorityChanged Setting Priority for app %x, wgid %d", iGOomWindowGroupList->AppIdfromWgId(aWgId, ETrue), aWgId);
             TUint priority = appCloseConfig->CalculateCloseAppPriority(*iGOomWindowGroupList, wgIndex);
-            iGOomActionList->SetPriority(wgIndex, priority);
+            iGOomActionList->SetPriority(aWgId, priority);
             }
         else
             {
@@ -644,3 +687,105 @@
 {
     return iGOomWindowGroupList; 
 }
+
+TBool CMemoryMonitor::IsSafeToProcessNewRequest(TUint aClientId)
+    {
+    FUNC_LOG;
+    if(iActiveClientId == aClientId)
+        {
+        TRACES1("Repeated Request from %x", aClientId);
+        return EFalse;
+        }
+    
+    TUint currrentPluginRun = iGOomActionList->CurrentPluginRun();
+    if(currrentPluginRun)
+        {
+        if(iConfig->GetApplicationConfig(aClientId).iSkipPluginId == currrentPluginRun)
+            {
+            TRACES2("Request from %x cannot be served now as plugin %x is running", aClientId, currrentPluginRun);
+            return EFalse;
+            }
+        }
+    
+    TRACES1("Going to process new request %d",iPostponeMemGood);
+    return ETrue;
+    }
+
+void CMemoryMonitor::WaitAndSynchroniseMemoryState() //this will be called after freeing memory
+    {
+    FUNC_LOG;
+    
+    switch (iTrigger)
+        {
+        case EGOomThresholdCrossed:
+            {
+            //Call memory good if we are good.
+            DoPostponedMemoryGood();
+            break;
+            }
+        case EGOomFocusChanged:
+        case EGOomRequestMemory:
+            {
+            //start timer
+            //cancel timer if end critical allocations request
+            //end critical allocations when timer expires
+            if ( iSynchTimer && //exists
+                 !iSynchTimer->IsActive() ) // keep it simple
+                {                
+	        iSynchTimer->After(KGoomWaitTimeToSynch);
+                }
+            break;
+            }
+        }
+    }
+
+void CMemoryMonitor::SynchroniseMemoryState()
+    {
+    FUNC_LOG;
+    TInt current = GetFreeMemory();
+    if(current >= iGoodThreshold)
+        {
+        if(!NeedToPostponeMemGood())
+            {
+            TRACES("SynchroniseMemoryState calling MemoryGOOD");
+            iGOomActionList->MemoryGood();
+            }
+        else
+            {
+            iMemAllocationsGoingDown->Continue();
+            }
+        }
+    else if(current < iLowThreshold)
+        {
+        iMemAllocationsGrowing->Stop();
+        iMemAllocationsGoingDown->Continue();
+        }
+    else
+        {
+        iMemAllocationsGrowing->Continue();
+        iMemAllocationsGoingDown->Continue();
+        }
+    }
+    
+    
+CGOomSynchTimer* CGOomSynchTimer::NewL(CMemoryMonitor& aMonitor)
+    {
+    CGOomSynchTimer* self = new (ELeave) CGOomSynchTimer(aMonitor);
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+
+CGOomSynchTimer::CGOomSynchTimer(CMemoryMonitor& aMonitor) : CTimer(EPriorityStandard), iMonitor(aMonitor)
+    {
+    CActiveScheduler::Add(this);
+    }
+    
+void CGOomSynchTimer::RunL()
+    {
+    FUNC_LOG;
+    iMonitor.SynchroniseMemoryState();
+    }
+
+
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -35,10 +35,12 @@
 CMemoryMonitorSession::~CMemoryMonitorSession()
     {
     FUNC_LOG;
+	/* TODO - need to add the right condition
     if (iUseAbsoluteTargets)
         { // se3ssion terminated while on critical allocation, release lock
         Server().Monitor().SessionInCriticalAllocation(0);
         }
+	*/
     CloseAppsFinished(0, EFalse);
     }
 
@@ -63,22 +65,31 @@
     iFunction = aMessage.Function();
     RThread t;
     aMessage.Client(t);
-    Server().Monitor().SetActiveClient(t.SecureId());
+    
+    TUint clientId = t.SecureId();
     t.Close();
     
+    TRACES1("NEW REQUEST from client %x", clientId);
     switch (aMessage.Function())
         {
         case EGOomMonitorRequestFreeMemory:
-            if (!iRequestFreeRam.IsNull())
+
+            //Do not take any more requests from the same client if previous request being served
+            if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(clientId))
                 {
+                TRACES1("CANNOT PROCESS NEW REQUEST from %x", clientId);
                 aMessage.Complete(KErrInUse);
                 return;
                 }
+            
+            Server().Monitor().SetActiveClient(clientId);
             // message will be completed when CloseAppsFinished() is called.
             if (aMessage.Int1() == 0)
                 {
                 iRequestFreeRam = aMessage;
 
+                Server().Monitor().SessionInCriticalAllocation(1, clientId);
+                
                 TRAPD(err, Monitor().RequestFreeMemoryL(aMessage.Int0(), iUseAbsoluteTargets));
                 if (err)
                     {
@@ -94,12 +105,19 @@
                 TRAP_IGNORE(Monitor().HandleFocusedWgChangeL(appUid));
                 }
             break;
+            
+        case EGOomMonitorMemoryAllocationsComplete:
+            TRACES1("ServiceL : Memory Allocations complete from %x", clientId);
+            Server().Monitor().SessionInCriticalAllocation(0, clientId);
+            aMessage.Complete(KErrNone);
+            break;
 
         case EGOomMonitorCancelRequestFreeMemory:
             if (!iRequestFreeRam.IsNull())
                 {
                 iRequestFreeRam.Complete(KErrCancel);
                 }
+            Server().Monitor().SessionInCriticalAllocation(0, clientId);
             aMessage.Complete(KErrNone);
             break;
 
@@ -109,10 +127,11 @@
             break;
 
         case EGOomMonitorRequestOptionalRam:
-            if (!iRequestFreeRam.IsNull())
+            if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(clientId))
                 {
                 aMessage.Complete(KErrInUse);
                 }
+            Server().Monitor().SetActiveClient(clientId);
             // message will be completed when CloseAppsFinished() is called.
             iRequestFreeRam = aMessage;
             iMinimumMemoryRequested = aMessage.Int1();
@@ -125,12 +144,12 @@
             break;
             
         case EGOomMonitorSetPriorityNormal:
-               Monitor().SetPriorityNormal(aMessage.Int0());
+            Monitor().SetPriorityNormal(aMessage.Int0());
             aMessage.Complete(KErrNone);
             break;
 
         case EGOomMonitorSetPriorityHigh:
-               Monitor().SetPriorityHigh(aMessage.Int0());
+            Monitor().SetPriorityHigh(aMessage.Int0());
             aMessage.Complete(KErrNone);
             break;
 
@@ -141,12 +160,13 @@
             TRAP_IGNORE(Monitor().HandleFocusedWgChangeL(appUid))
             break;
             }
+           
         case EGoomMonitorAppUsesAbsoluteMemTargets:
             {
             iUseAbsoluteTargets = aMessage.Int0();
-            TRACES2("EGoomMonitorAppUsesAbsoluteMemTargets this: 0x%x, use abs targets %d", this, iUseAbsoluteTargets);
+/*            TRACES2("EGoomMonitorAppUsesAbsoluteMemTargets this: 0x%x, use abs targets %d", this, iUseAbsoluteTargets);
             Server().Monitor().SessionInCriticalAllocation(iUseAbsoluteTargets);
-            aMessage.Complete(KErrNone);     
+*/           aMessage.Complete(KErrNone);     
             break;
             }    
             
--- a/uiacceltk/hitchcock/goommonitor/src/goommonitorsession.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goommonitorsession.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -59,6 +59,15 @@
     return KErrNone;    
     }
 
+EXPORT_C void RGOomMonitorSession::MemoryAllocationsComplete()
+    {
+    FUNC_LOG;
+    if (IsConnected())
+        {
+        SendReceive(EGOomMonitorMemoryAllocationsComplete);
+        }
+    }
+
 EXPORT_C TInt RGOomMonitorSession::RequestOptionalRam(TInt aBytesRequested, TInt aMinimumBytesNeeded, TInt aPluginId, TInt& aBytesAvailable)
     {
     FUNC_LOG;
@@ -128,7 +137,7 @@
         }
     }
 
-
+//TODO should this be asynchronous - can be called from a goom plugin, which is called from goom - deadlock ?
 EXPORT_C void RGOomMonitorSession::SetGOomPriority(TGOomPriority aPriority)
     {
     FUNC_LOG;
--- a/uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -94,3 +94,8 @@
 
     iPluginWaiter = CGOomPluginWaiter::NewL(waitDuration, *this);
     }
+
+TUint CGOomRunPlugin::Id()
+    {
+    return iPluginId;
+    }
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -31,6 +31,8 @@
 _LIT(KDummyWgName, "20");
 const TInt KPreallocatedSpaceForAppList = 50;
 
+const TInt KAllowedMemUsageForApps = 50000;     //Allow upto 50K usage by app when killing apps
+
 const TUint KGOomTicksPerSecond = 1000;
 
 typedef EGLBoolean (*NOK_resource_profiling)(EGLDisplay, EGLint, EGLint*, EGLint, EGLint*);
@@ -78,7 +80,8 @@
     EGLint* prof_data;
     TInt i(0);
     RArray<TUint64> processIds;
-    //RArray<TUint> privMemUsed;
+    RArray<TUint> privMemUsed;
+    RArray<TUint64> systemProcessIds;
         
     EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 
@@ -100,15 +103,14 @@
                                  &data_count);
     
     /* Iterate over the returned data */
+    TUint64 process_id;  
     while (i < data_count)
         {
         TRACES2("RefreshL EGL_NOK_resource_profiling - index: %d data: %x", i, prof_data[i]);
-            
         switch (prof_data[i++])
             {   
             case EGL_PROF_PROCESS_ID_NOK:
                 {
-                TUint64 process_id;
                 if (sizeof(EGLNativeProcessIdTypeNOK) == 8)
                     {
                     process_id = TUint64(prof_data[i]);
@@ -120,17 +122,29 @@
                     process_id = prof_data[i];
                     i++;
                     }
-                processIds.Append(process_id);
                 break;
                 }
             case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK:
                 {
-                //TUint mem = prof_data[i];
-                //privMemUsed.Append(mem);
+                TUint mem = prof_data[i];
+                privMemUsed.Append(mem);
+
+                TRACES1("Memory Usage by app is %d", mem);
+                if(mem > KAllowedMemUsageForApps)
+                    processIds.Append(process_id);
+                
                 i++;
                 break;
                 }
             case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK:
+                {
+                TUint mem = prof_data[i];
+                TRACES1("Shared Memory Usage by app is %d", mem);
+                if(mem > KAllowedMemUsageForApps)
+                    processIds.Append(process_id);
+                i++;
+                break;
+                }
             case EGL_PROF_USED_MEMORY_NOK:
             case EGL_PROF_TOTAL_MEMORY_NOK:
             default:
@@ -227,18 +241,49 @@
                 {
                 found = 1;
                 process.Close();
-                TRACES2("RefreshL Process id %x, wgindex %d, using gfx memory. Added to list", psecid, index);
+                TRACES3("RefreshL Process id %x, wgid %d, using gfx memory %d. Added to list", psecid, iWgIds[index].iId, privMemUsed[i]);
                 break;
                 }
             process.Close();
             }
-      
+        
         if(!found)
             {
             iWgIds.Remove(index);
             continue;
             }
       
+        //check if it is system app
+        if(iWgName->IsSystem() /*|| iWgName->Hidden()*/)
+            {
+            TRACES3("System/Hidden app found %x, ISystem %d, IsHidden %d",secureId, iWgName->IsSystem()?1:0, iWgName->Hidden()?1:0);  
+            systemProcessIds.Append(secureId);
+            }
+      
+        }
+       
+    processIds.Close();
+    privMemUsed.Close();      
+    
+    //check if any system apps are included
+    index = iWgIds.Count();
+    while (index--)
+        {
+        TBool skipped = EFalse;
+        for(i = 0; i < systemProcessIds.Count(); i++)
+            {
+            if(AppId(index,ETrue) == systemProcessIds[i])
+                {
+                TRACES2("WgId %d belongs to system app %x. Removing from Kill List",iWgIds[index].iId, systemProcessIds[i]);
+                iWgIds.Remove(index);
+                skipped = ETrue;
+                break;
+                }
+            }
+        
+        if(skipped)
+            continue;
+        
         // See if there is a tick count entry for each window in the list
         TGOomWindowGroupProperties* wgProperties = iWgToPropertiesMapping.Find(iWgIds[index].iId);
         
@@ -250,9 +295,8 @@
             iWgToPropertiesMapping.InsertL(iWgIds[index].iId, wgProperties);
             }
         }
-       
-    processIds.Close();
-    //privMemUsed.Close();       
+    
+    systemProcessIds.Close();
     
     }
 
@@ -467,8 +511,6 @@
 void CGOomWindowGroupList::SetPriorityBusy(TInt aWgId)
     {
     FUNC_LOG;
-
-    //Refresh();
     
     TInt parentId;
     TRAPD(err, parentId = FindParentIdL(aWgId));
@@ -476,15 +518,15 @@
         {
         parentId = aWgId;
         }
-    
+        
     TRACES2("CGOomWindowGroupList::SetPriorityBusy aWgId = %d, parentId = %d", aWgId, parentId);
-    
+        
     TGOomWindowGroupProperties* wgProperties = iWgToPropertiesMapping.Find(parentId);
     if (wgProperties)
         {
         wgProperties->iDynamicPriority = EGOomPriorityBusy;
         }
-    
+        
     // If we can't find the window group then ignore it
     }
 
@@ -533,6 +575,7 @@
 
 TBool CGOomWindowGroupList::IsBusy(TInt aWgIndex)
     {
+    FUNC_LOG;
     if (aWgIndex < 0 || aWgIndex >= iWgIds.Count())
         {
         return EFalse;
@@ -576,8 +619,6 @@
     {
     FUNC_LOG;
 
-    //Refresh();
-    
     TInt parentId;
     TRAPD(err, parentId = FindParentIdL(aWgId));
     if (err)
@@ -599,8 +640,6 @@
     {
     FUNC_LOG;
 
-    //Refresh();
-
     TInt parentId;
     TRAPD(err, parentId = FindParentIdL(aWgId));
     if (err)
@@ -639,3 +678,41 @@
 
     return indexInGroupList;
     }
+
+// Find the specificed application in the window group list and return the index
+TInt CGOomWindowGroupList::GetIndexFromWgId(TInt aWgId) const
+    {
+    FUNC_LOG;
+
+    TInt indexInGroupList = Count();
+    TBool appFoundInWindowGroupList = EFalse;
+    
+    while (indexInGroupList--)
+        {
+        if (iWgIds[indexInGroupList].iId == aWgId)
+            {
+            appFoundInWindowGroupList = ETrue;
+            break;
+            }
+        }
+    
+    if (!appFoundInWindowGroupList)
+        indexInGroupList = KAppNotInWindowGroupList;
+
+    return indexInGroupList;
+    }
+
+void CGOomWindowGroupList::GetAllWgIdsMatchingAppId(TInt aWgId, RArray<TInt> & WgIdList) const
+    {
+    TInt32 appId = AppIdfromWgId(aWgId, ETrue);
+    TInt indexInGroupList = Count();
+    WgIdList.Reset();
+    
+    while (indexInGroupList--)
+        {
+        if (AppIdfromWgId(iWgIds[indexInGroupList].iId, ETrue) == appId)
+            {
+            WgIdList.Append(iWgIds[indexInGroupList].iId);
+            }
+        }
+    }
--- a/uiacceltk/hitchcock/group/bld.inf	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/group/bld.inf	Mon Feb 22 17:57:49 2010 +0200
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:   Build information file for project alfappserver
-*  Version     : %version: tr1sido#128.1.7 %
+*  Version     : %version: tr1sido#128.1.9 %
 *
 */
 
@@ -88,6 +88,7 @@
 ../plugins/alftranseffect/alftfxserverplugin/group/AlfTfxSrvPlugin.mmp
 ../plugins/alftranseffect/alfgfxtransadapter/group/gfxtransenginetfx.mmp
 ../plugins/alfoogmplugin/group/alfoogmplugin.mmp
+../plugins/alfcrpplugin/group/alfcrpplugin.mmp
 
 // background animation host+reference plugin
 ../backgroundanim/group/bganimhost.mmp
@@ -111,10 +112,7 @@
 // waves plugin is not part of foundation content (differentiating SW)
 #include "../backgroundanim/wavesplugin/group/bld.inf"
 
-// yber hack, to be remover right after W02 build is out
-#ifndef FF_MEETING_REQUEST_UI
 #include "../plugins/mmfmediaclientplugin/group/bld.inf"
 #endif
-#endif
 
 PRJ_TESTMMPFILES
--- a/uiacceltk/hitchcock/group/core_exports.inc	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/group/core_exports.inc	Mon Feb 22 17:57:49 2010 +0200
@@ -3,7 +3,7 @@
 *  Name        : core_exports.inc
 *  Part of     : Alfred UI Toolkit
 *  Description : Exported header files.
-*  Version     : %version: tr1sido#8.1.24 %
+*  Version     : %version: tr1sido#8.1.25 %
 *
 *  Copyright © 2006-2007 Nokia.  All rights reserved.
 *  This material, including documentation and any related computer
@@ -82,6 +82,8 @@
 ../coretoolkit/data/taskswapper_app_start_rect.fxml /epoc32/release/winscw/urel/z/resource/effects/taskswapper_app_start_rect.fxml
 ../coretoolkit/data/taskswapper_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/taskswapper_appear.fxml
 ../coretoolkit/data/taskswapper_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/taskswapper_disappear.fxml
+../coretoolkit/data/toolbar_ext_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/toolbar_ext_appear.fxml
+../coretoolkit/data/toolbar_ext_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/toolbar_ext_disappear.fxml
 ../coretoolkit/data/touchinput_close.fxml /epoc32/release/winscw/urel/z/resource/effects/touchinput_close.fxml
 ../coretoolkit/data/touchinput_open.fxml /epoc32/release/winscw/urel/z/resource/effects/touchinput_open.fxml
 ../coretoolkit/data/waitnote_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/waitnote_appear.fxml
@@ -144,6 +146,8 @@
 ../coretoolkit/data/taskswapper_app_start_rect.fxml /epoc32/release/winscw/udeb/z/resource/effects/taskswapper_app_start_rect.fxml
 ../coretoolkit/data/taskswapper_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/taskswapper_appear.fxml
 ../coretoolkit/data/taskswapper_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/taskswapper_disappear.fxml
+../coretoolkit/data/toolbar_ext_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/toolbar_ext_appear.fxml
+../coretoolkit/data/toolbar_ext_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/toolbar_ext_disappear.fxml
 ../coretoolkit/data/touchinput_close.fxml /epoc32/release/winscw/udeb/z/resource/effects/touchinput_close.fxml
 ../coretoolkit/data/touchinput_open.fxml /epoc32/release/winscw/udeb/z/resource/effects/touchinput_open.fxml
 ../coretoolkit/data/waitnote_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/waitnote_appear.fxml
@@ -166,7 +170,7 @@
 ../coretoolkit/data/app_start_rect.fxml /epoc32/data/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/data/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/data/z/resource/effects/app_start_switch_rect.fxml
-../coretoolkit/data/appshell_exit.fxml /epoc32/data/z/resource/effects/effects/appshell_exit.fxml
+../coretoolkit/data/appshell_exit.fxml /epoc32/data/z/resource/effects/appshell_exit.fxml
 ../coretoolkit/data/confirmationnote_appear.fxml /epoc32/data/z/resource/effects/confirmationnote_appear.fxml
 ../coretoolkit/data/confirmationnote_disappear.fxml /epoc32/data/z/resource/effects/confirmationnote_disappear.fxml
 ../coretoolkit/data/dialer_close.fxml /epoc32/data/z/resource/effects/dialer_close.fxml
@@ -206,6 +210,8 @@
 ../coretoolkit/data/taskswapper_app_start_rect.fxml /epoc32/data/z/resource/effects/taskswapper_app_start_rect.fxml
 ../coretoolkit/data/taskswapper_appear.fxml /epoc32/data/z/resource/effects/taskswapper_appear.fxml
 ../coretoolkit/data/taskswapper_disappear.fxml /epoc32/data/z/resource/effects/taskswapper_disappear.fxml
+../coretoolkit/data/toolbar_ext_appear.fxml /epoc32/data/z/resource/effects/toolbar_ext_appear.fxml
+../coretoolkit/data/toolbar_ext_disappear.fxml /epoc32/data/z/resource/effects/toolbar_ext_disappear.fxml
 ../coretoolkit/data/touchinput_close.fxml /epoc32/data/z/resource/effects/touchinput_close.fxml
 ../coretoolkit/data/touchinput_open.fxml /epoc32/data/z/resource/effects/touchinput_open.fxml
 ../coretoolkit/data/waitnote_appear.fxml /epoc32/data/z/resource/effects/waitnote_appear.fxml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/group/alfcrpplugin.mmp	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,45 @@
+/*
+* 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:  MMP file for alf crp ECOM plugin
+*
+*/
+
+#include <platform_paths.hrh>
+#include <defaultcaps.hrh>
+
+TARGET          alfcrpplugin.dll
+TARGETTYPE      PLUGIN 
+UID             0x10009D8D 0x2002C358
+CAPABILITY      CAP_ECOM_PLUGIN
+VENDORID        VID_DEFAULT
+
+USERINCLUDE     ../inc
+USERINCLUDE     ../../../CommonInc
+MW_LAYER_SYSTEMINCLUDE
+
+SOURCEPATH      ../src
+SOURCE          alfcrpplugin.cpp
+SOURCE          alfsynchronizer.cpp
+
+START RESOURCE  alfcrpplugin.rss
+TARGET          alfcrpplugin.rsc
+END
+
+LIBRARY         ecom.lib
+LIBRARY         euser.lib
+LIBRARY         wsgraphicdrawer.lib
+LIBRARY         fbscli.lib
+LIBRARY         estor.lib
+LIBRARY         gdi.lib
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/group/bld.inf	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,25 @@
+/*
+* 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:  bld.inf
+*
+*/
+
+
+#include <platform_paths.hrh>
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_MMPFILES
+alfcrpplugin.mmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/inc/alfcrpplugin.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,88 @@
+/*
+* 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:  Alf CRP ECOM plugin
+*
+*/
+
+
+#ifndef AFLCRPPLUGIN_H
+#define AFLCRPPLUGIN_H
+
+// INCLUDES
+#include <w32std.h>
+#include <graphics/wsgraphicdrawerinterface.h>
+#include <graphics/wsgraphicdrawer.h>
+
+/**
+ * Alf window server ECOM plugin class.
+ */
+NONSHARABLE_CLASS( CAlfCrpPlugin ) : public CWsGraphicDrawer
+    {
+public:
+
+    /**
+     * Creates a new instance of the plugin.
+     * @return Created instance.
+     */ 
+    static CWsGraphicDrawer* CreateL();
+    
+    /**
+     * Destructor.
+     */ 
+    ~CAlfCrpPlugin();
+    
+private:
+
+    /**
+     * From CWsGraphicDrawer.
+     *
+     * @param aGc
+     * @param aRect
+     * @param aData
+     */ 
+    void DoDraw( MWsGc& aGc, const TRect& aRect, const TDesC8& aData ) const;
+    
+    /**
+     * Handles message from PreviewProviderClient.
+     *
+     * @param aData Message data.
+     */ 
+    void HandleMessage( const TDesC8& aData );
+
+    /**
+     * 2nd phase constructor.
+     *
+     * @param aEnv
+     * @param aId
+     * @param aOwner
+     * @param aData
+     */     
+    void ConstructL( MWsGraphicDrawerEnvironment& aEnv, 
+                     const TGraphicDrawerId& aId, 
+                     MWsClient& aOwner, 
+                     const TDesC8& aData );   
+
+private:
+    /**
+     * Handles message from PreviewProviderClient.
+     *
+     * @param aData Message data.
+     */     
+    void DoHandleMessageL( const TDesC8& aData );
+    
+    };
+
+#endif // AFLCRPPLUGIN_H
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/inc/alfsynchronizer.h	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,102 @@
+/*
+* 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:   AlfSynchronizer waits for synchronization to complete
+*
+*/
+
+
+
+#ifndef __ALFSYNCHRONIZER_H__
+#define __ALFSYNCHRONIZER_H__
+
+#include <e32base.h>
+#include <e32property.h>
+
+/**
+ * Synchronization active object.
+ */
+NONSHARABLE_CLASS( CAlfSynchronizer ) : public CActive
+    {
+public:
+    
+    /**
+     * Two phase constructor.
+     */
+    static CAlfSynchronizer* NewL();
+    
+    /**
+     * C++ destructor
+     */
+    ~CAlfSynchronizer();
+
+public:
+    
+    /**
+     * Starts to wait for synchronization to complete
+     * with particular identifier.
+     * This will start nested active scheduler.
+     */
+    void Start(TInt aId);  
+    
+private:    
+
+    /**
+     * C++ constructor
+     */
+    CAlfSynchronizer();
+
+    /**
+     * ConstructL
+     */
+    void ConstructL();
+
+    void RunL();
+    void DoCancel();
+
+    static TInt CallbackSyncTimeout( TAny* aPtr );
+    void DoCallbackSyncTimeout();
+
+private: // data
+
+    /**
+     * Active scheduler waiter.
+     * Own.
+     */
+    CActiveSchedulerWait* iWait;
+    
+    /**
+     * P&S property for monitoring a variable.
+     * Own.
+     */
+    RProperty iProperty;
+    
+    /**
+     * Timer to ensure that this synchronizer has finite duration.
+     * Own.
+     */
+    CPeriodic* iTimeout;
+    
+    /**
+     * Id waiting to be completed.
+     */
+    TInt iSynchId;
+    
+    /**
+     * ETrue if @c iWait has been stop.
+     * EFalse otherwise.
+     */
+    TBool iAsyncStopDone;
+    };
+
+#endif //__ALFSYNCHRONIZER_H__
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfcrpplugin.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,144 @@
+/*
+* 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:  Alf CRP ECOM plugin
+*
+*/
+
+
+#include <bldvariant.hrh>
+
+#include "alfcrpplugin.h"
+#include <ecom/implementationproxy.h>
+#include <s32mem.h> //RDesReadStream
+
+#include "alfsynchronizer.h"
+#include "alfrenderstageutils.h"
+
+// CONSTANTS
+const TInt KImpId( 0x2002C358 );
+const TInt KAlfCrpSynchronize = 0;
+
+// --------------------------------------------------------------------------
+// CAlfCrpPlugin::CreateL
+// --------------------------------------------------------------------------
+//
+CWsGraphicDrawer* CAlfCrpPlugin::CreateL()
+    {
+    CAlfCrpPlugin* crp = new (ELeave) CAlfCrpPlugin();
+    return crp;
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPlugin::~CAlfCrpPlugin
+// --------------------------------------------------------------------------
+//    
+CAlfCrpPlugin::~CAlfCrpPlugin()    
+    {
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPlugin::DoDraw
+// --------------------------------------------------------------------------
+//
+void CAlfCrpPlugin::DoDraw( MWsGc& /*aGc*/, const TRect& /*aRect*/, 
+    const TDesC8& /*aData*/) const
+    {
+    // Draws nothing
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPlugin::HandleMessage
+// --------------------------------------------------------------------------
+//    
+void CAlfCrpPlugin::HandleMessage( const TDesC8& aData )
+    {
+    TRAP_IGNORE( DoHandleMessageL( aData ) );
+    }
+    
+// --------------------------------------------------------------------------
+// CAlfCrpPlugin::DoHandleMessageL
+// --------------------------------------------------------------------------
+//    
+void CAlfCrpPlugin::DoHandleMessageL( const TDesC8& aData )
+    {  
+    RDesReadStream in( aData );
+    switch( in.ReadInt32L() )
+        {
+        case KAlfCrpSynchronize:
+            {
+            MAlfSynchronizationInterface* synchronizer = NULL;            
+            if ( Env().ScreenCount() )
+                {
+                MWsScreen* screen = Env().Screen(0);
+                if ( screen )
+                    {
+                    synchronizer = 
+                        (MAlfSynchronizationInterface*)screen->ResolveObjectInterface(
+                            KAlfSynchronizationInterfaceUid);
+                    }
+                }
+            
+            if ( synchronizer )
+                {
+                _LIT_SECURITY_POLICY_S0(KAlfSynchronizerPolicy, 0x10003B20);
+                RProperty::Define( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, RProperty::EInt, KAlfSynchronizerPolicy, KAlfSynchronizerPolicy );
+                RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, 0 );
+                    
+                CAlfSynchronizer* synch = CAlfSynchronizer::NewL();
+                CleanupStack::PushL( synch );
+                TInt syncId = 0;
+                synchronizer->Synchronize(syncId);
+                synch->Start( syncId );
+                            
+                CleanupStack::PopAndDestroy( synch );
+                }
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAlfCrpPlugin::ConstructL
+// --------------------------------------------------------------------------
+//    
+void CAlfCrpPlugin::ConstructL( MWsGraphicDrawerEnvironment& aEnv,
+    const TGraphicDrawerId& aId, MWsClient& aOwner, const TDesC8& /*aData*/ )
+    {
+    BaseConstructL( aEnv, aId, aOwner );
+
+    ShareGlobally();
+    }
+
+// --------------------------------------------------------------------------
+// KImplementationTable
+// --------------------------------------------------------------------------
+//    
+LOCAL_C const TImplementationProxy KImplementationTable[] = 
+    {
+    IMPLEMENTATION_PROXY_ENTRY(KImpId, CAlfCrpPlugin::CreateL)
+    };
+
+// --------------------------------------------------------------------------
+// ImplementationGroupProxy
+// --------------------------------------------------------------------------
+//    
+EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
+    {
+    aTableCount = (sizeof(KImplementationTable) / sizeof(TImplementationProxy));
+    return KImplementationTable;
+    }
+
+// End of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfcrpplugin.rss	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,42 @@
+/*
+* 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:  ECOM registration file
+*
+*/
+
+
+#include <ecom/registryinfo.rh>
+
+RESOURCE REGISTRY_INFO theInfo
+	{
+	dll_uid = 0x2002C358;
+	interfaces =
+		{
+		INTERFACE_INFO
+			{
+			interface_uid = 0x10281924;
+			implementations =
+				{
+				IMPLEMENTATION_INFO
+					{
+					implementation_uid = 0x2002C358;
+					version_no = 1;
+					display_name = "alfcrpplugin";
+					default_data = "";
+					opaque_data = "";
+					}
+				};
+			}
+		};
+	}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/hitchcock/plugins/alfcrpplugin/src/alfsynchronizer.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -0,0 +1,153 @@
+/*
+* 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:  AlfSynchronizer waits for synchronization to complete
+*
+*/
+
+
+#include "alfsynchronizer.h"
+#include "alfrenderstageutils.h"
+
+// Timeout in microseconds - 500 ms.
+const TInt KAlfSyncTimeout = 500000;
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::NewL
+// --------------------------------------------------------------------------
+//    
+CAlfSynchronizer* CAlfSynchronizer::NewL()
+    {
+    CAlfSynchronizer* self = new (ELeave) CAlfSynchronizer;
+    CleanupStack::PushL(self);
+    self->ConstructL();
+    CleanupStack::Pop(self);
+    return self;
+    }
+    
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::~CAlfSynchronizer
+// --------------------------------------------------------------------------
+//
+CAlfSynchronizer::~CAlfSynchronizer()
+    {
+    Cancel();
+    
+    iProperty.Close();
+    
+    delete iWait;
+    delete iTimeout;
+    }
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::Start
+// --------------------------------------------------------------------------
+//
+void CAlfSynchronizer::Start(TInt aId)
+    {
+    iProperty.Subscribe( iStatus );
+    SetActive();
+    
+    TInt value = 0;
+    iProperty.Get(value);
+    
+    if ( value != aId )
+        {
+        // Launch timeout AO in case there happens to be deadlock in coretoolkit etc.
+        iTimeout->Start( KAlfSyncTimeout, KAlfSyncTimeout, 
+            TCallBack( CallbackSyncTimeout, this ) );
+
+        // Start wait
+        iSynchId = aId;
+        iWait->Start();
+        }
+    }
+    
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::RunL
+// --------------------------------------------------------------------------
+//
+void CAlfSynchronizer::RunL()
+    {
+    if ( !iAsyncStopDone && iStatus.Int() == KErrNone )
+        {
+        iProperty.Subscribe( iStatus );
+        SetActive();
+        }
+    
+    TInt value = 0;
+    iProperty.Get(value);
+        
+    if ( !iAsyncStopDone && value == iSynchId )
+        {
+        iWait->AsyncStop();
+        iAsyncStopDone = ETrue;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::CallbackSyncTimeout
+// --------------------------------------------------------------------------
+//
+TInt CAlfSynchronizer::CallbackSyncTimeout( TAny* aPtr )
+    {
+    ((CAlfSynchronizer*)aPtr)->DoCallbackSyncTimeout();
+    return KErrNone;
+    }
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::DoCallbackSyncTimeout
+// --------------------------------------------------------------------------
+//
+void CAlfSynchronizer::DoCallbackSyncTimeout()
+    {        
+    iTimeout->Cancel();
+    
+    if (!iAsyncStopDone)
+        {
+        iWait->AsyncStop();
+        iAsyncStopDone = ETrue;
+        }
+    }
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::DoCancel
+// --------------------------------------------------------------------------
+//
+void CAlfSynchronizer::DoCancel()
+    {
+    iProperty.Cancel();
+    }
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::CAlfSynchronizer
+// --------------------------------------------------------------------------
+//
+CAlfSynchronizer::CAlfSynchronizer()
+    : CActive( EPriorityHigh )
+    {
+    CActiveScheduler::Add(this);
+    }
+
+// --------------------------------------------------------------------------
+// CAlfSynchronizer::ConstructL
+// --------------------------------------------------------------------------
+//
+void CAlfSynchronizer::ConstructL()
+    {
+    User::LeaveIfError( iProperty.Attach( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer ) );
+
+    iWait = new (ELeave) CActiveSchedulerWait;
+    
+    iTimeout = CPeriodic::NewL( CActive::EPriorityHigh );
+    }
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfpolicyhandler.cpp	Tue Feb 02 07:56:43 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfpolicyhandler.cpp	Mon Feb 22 17:57:49 2010 +0200
@@ -24,12 +24,12 @@
 // ======== HELPER CLASS ========
 
 NONSHARABLE_CLASS(TFullScreenBlock)
-	{
+    {
 public:
-	TUid iFromUid;
-	TUid iToUid;
+    TUid iFromUid;
+    TUid iToUid;
 
-	};
+    };
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -69,128 +69,128 @@
 // ---------------------------------------------------------------------------
 //
 void CPolicyHandler::RegisterListBoxKmlL( const TUid& aUid,
-										  const TThreadId& aThreadId,
+                                          const TThreadId& aThreadId,
                                           const CAlfTransitionServerClient::TListBoxType aListBoxType,
                                           const TDesC& aResourceDir, 
-						                  const TDesC& aBackgroundFilename, 
-						                  const TDesC& aItemFilename,
-						                  TInt aCachePriority, 
-						                  TInt aWantedTime , TInt aMinTime )
+                                          const TDesC& aBackgroundFilename, 
+                                          const TDesC& aItemFilename,
+                                          TInt aCachePriority, 
+                                          TInt aWantedTime , TInt aMinTime )
     {
     __ALFFXLOGSTRING2("CPolicyHandler::RegisterListBoxKmlL - aUid 0x%x, aThreadId >>", aUid, aThreadId.Id());
-	aCachePriority = 1;
-	// For now, the cache priority is always 1 at registration time, and after
-	// fetching the KML information from the policy, it gets set to 0. This is
-	// used to trigger eviction from the KML cache. Newly registered KML:s have
-	// priority over existing...
-	CListBoxPolicy* policy = CListBoxPolicy::NewL( aUid, 
-												   aThreadId, 
-												   aListBoxType,
-	                                               aResourceDir, 
+    aCachePriority = 1;
+    // For now, the cache priority is always 1 at registration time, and after
+    // fetching the KML information from the policy, it gets set to 0. This is
+    // used to trigger eviction from the KML cache. Newly registered KML:s have
+    // priority over existing...
+    CListBoxPolicy* policy = CListBoxPolicy::NewL( aUid, 
+                                                   aThreadId, 
+                                                   aListBoxType,
+                                                   aResourceDir, 
                                                    aBackgroundFilename, 
                                                    aItemFilename,
                                                    aCachePriority,
                                                    aWantedTime,
                                                    aMinTime );
-	CleanupStack::PushL( policy );
-	TInt spec = policy->Specificity();	
-	TInt count = iListBoxPolicies.Count();
-	TInt uid = aUid.iUid;
-	TInt i;
-	
-	// This keeps the list with ListBox KMLs sorted after specifity, 
-	// High specificity is in the beginning of the list and low at the end.
-	// This means that when getting a ListBox KML it will find the more specified
-	// values first. A Uid counts as more specific than a TListBoxType.
-	
-	for ( i = 0; i < count; i++ )
-	    {
-	    CListBoxPolicy* curr = iListBoxPolicies[i];
-	    TInt currspec = curr->Specificity();
-	    
-	    if ( uid == curr->Uid().iUid && aListBoxType == curr->ListBoxType() )
-	        {
-	        // Duplicate policy, delete the old one.
-	        iListBoxPolicies.Remove( i );
-	        delete curr;
-	        break;
-	        }
-	    else if ( spec > currspec )
-	        {
-	        break;
-	        }
-	    }
+    CleanupStack::PushL( policy );
+    TInt spec = policy->Specificity();  
+    TInt count = iListBoxPolicies.Count();
+    TInt uid = aUid.iUid;
+    TInt i;
+    
+    // This keeps the list with ListBox KMLs sorted after specifity, 
+    // High specificity is in the beginning of the list and low at the end.
+    // This means that when getting a ListBox KML it will find the more specified
+    // values first. A Uid counts as more specific than a TListBoxType.
+    
+    for ( i = 0; i < count; i++ )
+        {
+        CListBoxPolicy* curr = iListBoxPolicies[i];
+        TInt currspec = curr->Specificity();
+        
+        if ( uid == curr->Uid().iUid && aListBoxType == curr->ListBoxType() )
+            {
+            // Duplicate policy, delete the old one.
+            iListBoxPolicies.Remove( i );
+            delete curr;
+            break;
+            }
+        else if ( spec > currspec )
+            {
+            break;
+            }
+        }
 
     iListBoxPolicies.InsertL( policy, i );
     
     CleanupStack::Pop();
     __ALFFXLOGSTRING("CPolicyHandler::RegisterListBoxKmlL <<");
-	}
-	
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterListBoxKml( const TUid& aUid,
         CAlfTransitionServerClient::TListBoxType aListBoxType )
-	{
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterListBoxKml - Uid: 0x%x >>", aUid);
-	for( TInt count = iListBoxPolicies.Count() - 1 ; count >= 0; count-- )
-		{
-		if( iListBoxPolicies[count]->Uid() == aUid &&
-		    iListBoxPolicies[count]->ListBoxType() == aListBoxType )
-			{
-			delete iListBoxPolicies[count];
-			iListBoxPolicies.Remove( count );
-			__ALFFXLOGSTRING("CPolicyHandler::UnregisterListBoxKml - return KErrNone<<");
-			return KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING("CPolicyHandler::UnregisterListBoxKml - return KErrNotFound <<");
-	return KErrNotFound;
-	}
+    {
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterListBoxKml - Uid: 0x%x >>", aUid);
+    for( TInt count = iListBoxPolicies.Count() - 1 ; count >= 0; count-- )
+        {
+        if( iListBoxPolicies[count]->Uid() == aUid &&
+            iListBoxPolicies[count]->ListBoxType() == aListBoxType )
+            {
+            delete iListBoxPolicies[count];
+            iListBoxPolicies.Remove( count );
+            __ALFFXLOGSTRING("CPolicyHandler::UnregisterListBoxKml - return KErrNone<<");
+            return KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING("CPolicyHandler::UnregisterListBoxKml - return KErrNotFound <<");
+    return KErrNotFound;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterListBoxKml( const TThreadId& aThreadId )
-	{
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterListBoxKml - aThreadId: %d >>", aThreadId.Id());
-	TThreadId tid;
-	TInt err = KErrNotFound;
-	
-	for( TInt count = iListBoxPolicies.Count() - 1 ; count >= 0; count-- )
-		{
-		tid = iListBoxPolicies[count]->ThreadId();
-		if( tid.Id() == aThreadId.Id() )
-			{
-			delete iListBoxPolicies[count];
-			iListBoxPolicies.Remove( count );
-			err = KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterListBoxKml - return: %d <<", err);
-	return err;
-	}
-	
+    {
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterListBoxKml - aThreadId: %d >>", aThreadId.Id());
+    TThreadId tid;
+    TInt err = KErrNotFound;
+    
+    for( TInt count = iListBoxPolicies.Count() - 1 ; count >= 0; count-- )
+        {
+        tid = iListBoxPolicies[count]->ThreadId();
+        if( tid.Id() == aThreadId.Id() )
+            {
+            delete iListBoxPolicies[count];
+            iListBoxPolicies.Remove( count );
+            err = KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterListBoxKml - return: %d <<", err);
+    return err;
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-TInt CPolicyHandler::GetListBoxKml(	const TUid& aAppId,
+TInt CPolicyHandler::GetListBoxKml( const TUid& aAppId,
                                     const CAlfTransitionServerClient::TListBoxType aListBoxType,
                                     TPtrC& aResourceDir,
                                     TPtrC& aBackgroundFilename, 
                                     TPtrC& aItemFilename, 
                                     TInt& aCachePriority, TInt& aWantedTime,
-									TInt& aMinTime)
-	{
-	__ALFFXLOGSTRING3("CPolicyHandler::GetListBoxKml - aResourceDir: %S, aBackgroundFilename: %S, aItemFilename: %S >>", &aResourceDir, &aBackgroundFilename, &aItemFilename);
-	TInt count = iListBoxPolicies.Count();
-	TBool hit = EFalse;
-	TInt i;
+                                    TInt& aMinTime)
+    {
+    __ALFFXLOGSTRING3("CPolicyHandler::GetListBoxKml - aResourceDir: %S, aBackgroundFilename: %S, aItemFilename: %S >>", &aResourceDir, &aBackgroundFilename, &aItemFilename);
+    TInt count = iListBoxPolicies.Count();
+    TBool hit = EFalse;
+    TInt i;
     aResourceDir.Set( TPtrC() );
     aBackgroundFilename.Set( TPtrC() );
     aItemFilename.Set( TPtrC() );
-	
+    
     for ( i = 0; i < count; i++ )
         {
         CListBoxPolicy* curr = iListBoxPolicies[i];
@@ -212,127 +212,127 @@
         return KErrNotFound;
         }
 
-	aResourceDir.Set( iListBoxPolicies[i]->ResourceDir() );
-	aBackgroundFilename.Set( iListBoxPolicies[i]->BackgroundFilename() );
-	aItemFilename.Set( iListBoxPolicies[i]->ItemFilename() );
-	aCachePriority = iListBoxPolicies[i]->CachePriority();
-	aWantedTime = iListBoxPolicies[i]->WantedTime();
-	aMinTime = iListBoxPolicies[i]->MinTime();
-		
-	// For now, this entry should have no priority over others
-	iListBoxPolicies[i]->SetCachePriority( 0 );
-	__ALFFXLOGSTRING("CPolicyHandler::GetListBoxKml - return KErrNone <<");
-	return KErrNone;
-	}
+    aResourceDir.Set( iListBoxPolicies[i]->ResourceDir() );
+    aBackgroundFilename.Set( iListBoxPolicies[i]->BackgroundFilename() );
+    aItemFilename.Set( iListBoxPolicies[i]->ItemFilename() );
+    aCachePriority = iListBoxPolicies[i]->CachePriority();
+    aWantedTime = iListBoxPolicies[i]->WantedTime();
+    aMinTime = iListBoxPolicies[i]->MinTime();
+        
+    // For now, this entry should have no priority over others
+    iListBoxPolicies[i]->SetCachePriority( 0 );
+    __ALFFXLOGSTRING("CPolicyHandler::GetListBoxKml - return KErrNone <<");
+    return KErrNone;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 void CPolicyHandler::RegisterFullscreenKmlL(TUint aAction, const TUid& aUid, const TThreadId& aThreadId,
-											const TDesC& aResourceDir, const TDesC& aFilename,
-											TInt /*aCachePriority*/, TInt aWantedTime, TInt aMinTime)
-	{
-	__ALFFXLOGSTRING3("CPolicyHandler::RegisterFullscreenKmlL - aAction: %d aUid: 0x%x aThread.Id : %d", aAction, aUid, aThreadId.Id() );
-	__ALFFXLOGSTRING2("CPolicyHandler::RegisterFullscreenKmlL - aResourceDir: %S, aFilename: %S", &aResourceDir, &aFilename );
-	TInt cachePriority = 1; //aCachePriority; 
-	// For now, the cache priority is always 1 at registration time, and after
-	// fetching the KML information from the policy, it gets set to 0. This is
-	// used to trigger eviction from the KML cache. Newly registered KML:s have
-	// priority over existing...
-	
-	CFullscreenPolicy* policy = NULL;
-	
-	// Check if the action was already is registered and if so, delete it.
-	TInt count = iFullscreenPolicies.Count()-1;
-	for(; count >= 0; count--)
-		{
-		if(	iFullscreenPolicies[count]->Action() == aAction && 
-			iFullscreenPolicies[count]->Uid() == aUid)
-			{
-			policy = iFullscreenPolicies[count];
-			iFullscreenPolicies.Remove(count);
-			delete policy;
-			policy = NULL;
-			}
-		} 
+                                            const TDesC& aResourceDir, const TDesC& aFilename,
+                                            TInt /*aCachePriority*/, TInt aWantedTime, TInt aMinTime)
+    {
+    __ALFFXLOGSTRING3("CPolicyHandler::RegisterFullscreenKmlL - aAction: %d aUid: 0x%x aThread.Id : %d", aAction, aUid, aThreadId.Id() );
+    __ALFFXLOGSTRING2("CPolicyHandler::RegisterFullscreenKmlL - aResourceDir: %S, aFilename: %S", &aResourceDir, &aFilename );
+    TInt cachePriority = 1; //aCachePriority; 
+    // For now, the cache priority is always 1 at registration time, and after
+    // fetching the KML information from the policy, it gets set to 0. This is
+    // used to trigger eviction from the KML cache. Newly registered KML:s have
+    // priority over existing...
+    
+    CFullscreenPolicy* policy = NULL;
+    
+    // Check if the action was already is registered and if so, delete it.
+    TInt count = iFullscreenPolicies.Count()-1;
+    for(; count >= 0; count--)
+        {
+        if( iFullscreenPolicies[count]->Action() == aAction && 
+            iFullscreenPolicies[count]->Uid() == aUid)
+            {
+            policy = iFullscreenPolicies[count];
+            iFullscreenPolicies.Remove(count);
+            delete policy;
+            policy = NULL;
+            }
+        } 
 
-	// create and add the new action.
-	policy = CFullscreenPolicy::NewL(aAction, aUid, aThreadId, aResourceDir, aFilename,
-														cachePriority, aWantedTime, aMinTime);
-	CleanupStack::PushL(policy);
-	iFullscreenPolicies.AppendL(policy);
-	CleanupStack::Pop(policy);
-	__ALFFXLOGSTRING("CPolicyHandler::RegisterFullscreenKmlL <<");
-	}
-	
+    // create and add the new action.
+    policy = CFullscreenPolicy::NewL(aAction, aUid, aThreadId, aResourceDir, aFilename,
+                                                        cachePriority, aWantedTime, aMinTime);
+    CleanupStack::PushL(policy);
+    iFullscreenPolicies.AppendL(policy);
+    CleanupStack::Pop(policy);
+    __ALFFXLOGSTRING("CPolicyHandler::RegisterFullscreenKmlL <<");
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterFullscreenKml(TUint aAction, const TUid& aUid)
-	{
-	__ALFFXLOGSTRING2("CPolicyHandler::UnregisterFullscreenKml - aAction: %d, aUid: 0x%x <<", aAction, aUid );
-	TInt count = iFullscreenPolicies.Count() -1;
-	for(; count >= 0; count--)
-		{
-		if(iFullscreenPolicies[count]->Action() == aAction && 
-			iFullscreenPolicies[count]->Uid() == aUid)
-			{
-			CFullscreenPolicy* policy = iFullscreenPolicies[count];
-			iFullscreenPolicies.Remove(count);
-			delete policy;
-			policy = NULL;
-			__ALFFXLOGSTRING("CPolicyHandler::UnregisterFullscreenKml - return KErrNone <<");
-			return KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING("CPolicyHandler::UnregisterFullscreenKml - return KErrNotFound <<");
-	return KErrNotFound;
-	}
+    {
+    __ALFFXLOGSTRING2("CPolicyHandler::UnregisterFullscreenKml - aAction: %d, aUid: 0x%x <<", aAction, aUid );
+    TInt count = iFullscreenPolicies.Count() -1;
+    for(; count >= 0; count--)
+        {
+        if(iFullscreenPolicies[count]->Action() == aAction && 
+            iFullscreenPolicies[count]->Uid() == aUid)
+            {
+            CFullscreenPolicy* policy = iFullscreenPolicies[count];
+            iFullscreenPolicies.Remove(count);
+            delete policy;
+            policy = NULL;
+            __ALFFXLOGSTRING("CPolicyHandler::UnregisterFullscreenKml - return KErrNone <<");
+            return KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING("CPolicyHandler::UnregisterFullscreenKml - return KErrNotFound <<");
+    return KErrNotFound;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterFullscreenKml(const TThreadId& aThreadId)
-	{
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterFullscreenKml - aThreadId: %d >>", aThreadId.Id());
-	TInt count = iFullscreenPolicies.Count() -1;
-	TInt err = KErrNotFound;
-	TThreadId tid;
-	
-	for(; count >= 0; count--)
-		{
-		tid = iFullscreenPolicies[count]->ThreadId();
-		if( tid.Id() == aThreadId.Id())
-			{
-			CFullscreenPolicy* policy = iFullscreenPolicies[count];
-			iFullscreenPolicies.Remove(count);
-			delete policy;
-			policy = NULL;
-			err = KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterFullscreenKml - return: %d <<", err);
-	return err;
-	}
-	
+    {
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterFullscreenKml - aThreadId: %d >>", aThreadId.Id());
+    TInt count = iFullscreenPolicies.Count() -1;
+    TInt err = KErrNotFound;
+    TThreadId tid;
+    
+    for(; count >= 0; count--)
+        {
+        tid = iFullscreenPolicies[count]->ThreadId();
+        if( tid.Id() == aThreadId.Id())
+            {
+            CFullscreenPolicy* policy = iFullscreenPolicies[count];
+            iFullscreenPolicies.Remove(count);
+            delete policy;
+            policy = NULL;
+            err = KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterFullscreenKml - return: %d <<", err);
+    return err;
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterAllKml(const TThreadId& aThreadId)
-	{
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterAllKml - aThreadId: <<", aThreadId.Id());
-	TInt err = KErrNotFound;
-	TInt err1 = UnregisterFullscreenKml(aThreadId);
-	TInt err2 = UnregisterControlKml(aThreadId);
+    {
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterAllKml - aThreadId: <<", aThreadId.Id());
+    TInt err = KErrNotFound;
+    TInt err1 = UnregisterFullscreenKml(aThreadId);
+    TInt err2 = UnregisterControlKml(aThreadId);
 
-	if(err1 == KErrNone || err2 == KErrNone)
-		err = KErrNone;
+    if(err1 == KErrNone || err2 == KErrNone)
+        err = KErrNone;
 
 
-	TInt err3 = UnregisterListBoxKml(aThreadId);
-	if(err3 == KErrNone)
-		err = KErrNone;
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterAllKml - return: %d <<", err);
+    TInt err3 = UnregisterListBoxKml(aThreadId);
+    if(err3 == KErrNone)
+        err = KErrNone;
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterAllKml - return: %d <<", err);
     return err; 
     }
 
@@ -340,688 +340,688 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-TInt CPolicyHandler::GetFullscreenKml(	TUint aAction, const TUid& aToUid, const TUid& aFromUid,
-									 	TPtrC& aResourceDir, TPtrC& aFilename,
-									 	TInt& aCachePriority, TInt& aWantedTime, TInt& aMinTime)
-	{
+TInt CPolicyHandler::GetFullscreenKml(  TUint aAction, const TUid& aToUid, const TUid& aFromUid,
+                                        TPtrC& aResourceDir, TPtrC& aFilename,
+                                        TInt& aCachePriority, TInt& aWantedTime, TInt& aMinTime)
+    {
     __ALFFXLOGSTRING3("CPolicyHandler::GetFullscreenKml - aAction: %d, aToUid: %d, aFromUid :%d", aAction, aToUid, aFromUid );
     __ALFFXLOGSTRING2("CPolicyHandler::GetFullscreenKml - aResourceDir: %S, aFilename :%S", &aResourceDir, &aFilename );
 
-	// Checking if the UID is blocked.
-	TInt blockedUids = iFullScreenBlocks.Count();
-	aResourceDir.Set( TPtrC() );
-	aFilename.Set( TPtrC() );
-	
-	for( TInt i = 0 ;  i < blockedUids ; i++ )
-		{
-		if( iFullScreenBlocks[i]->iToUid == aToUid ||
-			iFullScreenBlocks[i]->iFromUid == aFromUid)
-			{
-			__ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNotSupported <<");
-			return KErrNotSupported;
-			}
-		}
-		
-	TInt count = iFullscreenPolicies.Count();
-	// try to find it using both action and uid
-	for(TInt i = 0; i < count; i++)
-		{
-		if(iFullscreenPolicies[i]->Action() == aAction && 
-			iFullscreenPolicies[i]->Uid() == aToUid)
-			{
-			aResourceDir.Set( iFullscreenPolicies[i]->ResourceDir() );
-			aFilename.Set( iFullscreenPolicies[i]->Filename() );
-			aCachePriority = iFullscreenPolicies[i]->CachePriority();
-			aWantedTime = iFullscreenPolicies[i]->WantedTime();
-			aMinTime = iFullscreenPolicies[i]->MinTime();
-			// Check if theres a block on this UID/Action pair.
-			if( aFilename.Length() == 0 ) 
-				{
-	            __ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNotSupported <<");
-				return KErrNotSupported;
-				}
-				
-			// For now, this entry should have no priority over others
-			iFullscreenPolicies[i]->SetCachePriority(0);
+    // Checking if the UID is blocked.
+    TInt blockedUids = iFullScreenBlocks.Count();
+    aResourceDir.Set( TPtrC() );
+    aFilename.Set( TPtrC() );
+    
+    for( TInt i = 0 ;  i < blockedUids ; i++ )
+        {
+        if( iFullScreenBlocks[i]->iToUid == aToUid ||
+            iFullScreenBlocks[i]->iFromUid == aFromUid)
+            {
+            __ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNotSupported <<");
+            return KErrNotSupported;
+            }
+        }
+        
+    TInt count = iFullscreenPolicies.Count();
+    // try to find it using both action and uid
+    for(TInt i = 0; i < count; i++)
+        {
+        if(iFullscreenPolicies[i]->Action() == aAction && 
+            iFullscreenPolicies[i]->Uid() == aToUid)
+            {
+            aResourceDir.Set( iFullscreenPolicies[i]->ResourceDir() );
+            aFilename.Set( iFullscreenPolicies[i]->Filename() );
+            aCachePriority = iFullscreenPolicies[i]->CachePriority();
+            aWantedTime = iFullscreenPolicies[i]->WantedTime();
+            aMinTime = iFullscreenPolicies[i]->MinTime();
+            // Check if theres a block on this UID/Action pair.
+            if( aFilename.Length() == 0 ) 
+                {
+                __ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNotSupported <<");
+                return KErrNotSupported;
+                }
+                
+            // For now, this entry should have no priority over others
+            iFullscreenPolicies[i]->SetCachePriority(0);
             __ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNone <<");
             return KErrNone;
-			}
-		}
-	// try to find the default (Uid == KNullUid)
-	for(TInt i = 0; i < count; i++)
-		{
-		if(iFullscreenPolicies[i]->Action() == aAction && 
-			iFullscreenPolicies[i]->Uid() == KNullUid)
-			{
-			aResourceDir.Set( iFullscreenPolicies[i]->ResourceDir() );
-			aFilename.Set( iFullscreenPolicies[i]->Filename() );
-			aCachePriority = iFullscreenPolicies[i]->CachePriority();
-			aWantedTime = iFullscreenPolicies[i]->WantedTime();
-			aMinTime = iFullscreenPolicies[i]->MinTime();
-			
-			// For now, this entry should have no priority over others
-			iFullscreenPolicies[i]->SetCachePriority(0); 
-			__ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNone <<");
-			return KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNotFound <<");
-	return KErrNotFound;
-	}
+            }
+        }
+    // try to find the default (Uid == KNullUid)
+    for(TInt i = 0; i < count; i++)
+        {
+        if(iFullscreenPolicies[i]->Action() == aAction && 
+            iFullscreenPolicies[i]->Uid() == KNullUid)
+            {
+            aResourceDir.Set( iFullscreenPolicies[i]->ResourceDir() );
+            aFilename.Set( iFullscreenPolicies[i]->Filename() );
+            aCachePriority = iFullscreenPolicies[i]->CachePriority();
+            aWantedTime = iFullscreenPolicies[i]->WantedTime();
+            aMinTime = iFullscreenPolicies[i]->MinTime();
+            
+            // For now, this entry should have no priority over others
+            iFullscreenPolicies[i]->SetCachePriority(0); 
+            __ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNone <<");
+            return KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING("CPolicyHandler::GetFullscreenKml - return KErrNotFound <<");
+    return KErrNotFound;
+    }
 
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::BlockFullScreenUid(const TUid& aUid, TBool aBlockFrom, TBool aBlockTo)
-	{
-	__ALFFXLOGSTRING3("CPolicyHandler::BlockFullScreenUid - aUid: 0x%x, aBlockFrom: %d, aBlockTo: %d >>", aUid, aBlockFrom, aBlockTo );	
-	TFullScreenBlock* block = NULL;
-	
-	TInt blockedUids = iFullScreenBlocks.Count();
-	if(	blockedUids > 0)
-		{
-		// Looking for an existing To block.
-		if(!aBlockTo && aBlockFrom )
-			{
-			for(TInt i = 0; i < blockedUids; i++)
-				{
-				if(iFullScreenBlocks[i]->iFromUid == aUid)
-					{
-					__ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
-					return KErrNone;
-					}
-				}
-			}
-		// Looking for an existing From block.
-		else if(aBlockTo && !aBlockFrom)
-			{
-			for(TInt i = 0; i < blockedUids; i++)
-				{
-				if(iFullScreenBlocks[i]->iToUid  == aUid)
-					{
-					__ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
-					return KErrNone;
-					}
-				}
-			}
-		// Trying to unblock stuff.
-		else if(!aBlockTo && !aBlockFrom)
-			{
-			for(TInt i = blockedUids -1; i >= 0; i--)
-				{
-				if(	iFullScreenBlocks[i]->iToUid  == aUid ||
-					iFullScreenBlocks[i]->iFromUid == aUid )
-					{
-					block = iFullScreenBlocks[i];
-					iFullScreenBlocks.Remove(i);
-					delete block;
-					block = NULL;
-					}
-				}
-			__ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
-			return KErrNone;
-			}
-		// Looking for an existing To and From block with the same UID's.
-		else
-			{
-			for(TInt i = 0; i < blockedUids; i++)
-				{
-				if(	iFullScreenBlocks[i]->iToUid  == aUid &&
-					iFullScreenBlocks[i]->iFromUid == aUid )
-					{
-					__ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
-					return KErrNone;
-					}
-				}
-			}
-		}
+    {
+    __ALFFXLOGSTRING3("CPolicyHandler::BlockFullScreenUid - aUid: 0x%x, aBlockFrom: %d, aBlockTo: %d >>", aUid, aBlockFrom, aBlockTo ); 
+    TFullScreenBlock* block = NULL;
+    
+    TInt blockedUids = iFullScreenBlocks.Count();
+    if( blockedUids > 0)
+        {
+        // Looking for an existing To block.
+        if(!aBlockTo && aBlockFrom )
+            {
+            for(TInt i = 0; i < blockedUids; i++)
+                {
+                if(iFullScreenBlocks[i]->iFromUid == aUid)
+                    {
+                    __ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
+                    return KErrNone;
+                    }
+                }
+            }
+        // Looking for an existing From block.
+        else if(aBlockTo && !aBlockFrom)
+            {
+            for(TInt i = 0; i < blockedUids; i++)
+                {
+                if(iFullScreenBlocks[i]->iToUid  == aUid)
+                    {
+                    __ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
+                    return KErrNone;
+                    }
+                }
+            }
+        // Trying to unblock stuff.
+        else if(!aBlockTo && !aBlockFrom)
+            {
+            for(TInt i = blockedUids -1; i >= 0; i--)
+                {
+                if( iFullScreenBlocks[i]->iToUid  == aUid ||
+                    iFullScreenBlocks[i]->iFromUid == aUid )
+                    {
+                    block = iFullScreenBlocks[i];
+                    iFullScreenBlocks.Remove(i);
+                    delete block;
+                    block = NULL;
+                    }
+                }
+            __ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
+            return KErrNone;
+            }
+        // Looking for an existing To and From block with the same UID's.
+        else
+            {
+            for(TInt i = 0; i < blockedUids; i++)
+                {
+                if( iFullScreenBlocks[i]->iToUid  == aUid &&
+                    iFullScreenBlocks[i]->iFromUid == aUid )
+                    {
+                    __ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNone <<");
+                    return KErrNone;
+                    }
+                }
+            }
+        }
 
-	// None found. Create!
-	block = new TFullScreenBlock();
-	if(NULL == block)
-		{
-		__ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNoMemory <<");
-		return KErrNoMemory;
-		}
+    // None found. Create!
+    block = new TFullScreenBlock();
+    if(NULL == block)
+        {
+        __ALFFXLOGSTRING("CPolicyHandler::BlockFullScreenUid - return KErrNoMemory <<");
+        return KErrNoMemory;
+        }
 
-	if(aBlockTo)
-		{
-		block->iToUid = aUid;
-		}
-	if(aBlockFrom)
-		{
-		block->iFromUid = aUid;
-		}
+    if(aBlockTo)
+        {
+        block->iToUid = aUid;
+        }
+    if(aBlockFrom)
+        {
+        block->iFromUid = aUid;
+        }
 
-	TInt err = iFullScreenBlocks.Append(block);
-	if(KErrNone != err)
-		{
-		delete block;
-		block = NULL;
-		}
-	__ALFFXLOGSTRING1("CPolicyHandler::BlockFullScreenUid - return: %d <<", err);
-	return err;
-	}
+    TInt err = iFullScreenBlocks.Append(block);
+    if(KErrNone != err)
+        {
+        delete block;
+        block = NULL;
+        }
+    __ALFFXLOGSTRING1("CPolicyHandler::BlockFullScreenUid - return: %d <<", err);
+    return err;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::RegisterControlAction(const TUid aUid, TUint aAction, const TDesC& aActionString)
-	{
-	__ALFFXLOGSTRING3("CPolicyHandler::RegisterControlAction - aUid: 0x%x, aAction: %d, aActionString: %S", aUid, aAction, &aActionString );
-	TInt index = 0;
-	CControlPolicy* pData = NULL;
-	CActionPolicy* pPolicy = NULL;
-	
-	// TEST!!!!!!!!!!
-	// First see if we have an empty entry that means a new KML has been registered
-	// Adding just a KML does not remove the old one, the old one gets removed only
-	// after we add an action to the new KML
-	
-	// The double action of first registering a KML file and then registering the action
-	// should be replaced with single call where the control file and action are defined
-	// in one call
-	
+    {
+    __ALFFXLOGSTRING3("CPolicyHandler::RegisterControlAction - aUid: 0x%x, aAction: %d, aActionString: %S", aUid, aAction, &aActionString );
+    TInt index = 0;
+    CControlPolicy* pData = NULL;
+    CActionPolicy* pPolicy = NULL;
+    
+    // TEST!!!!!!!!!!
+    // First see if we have an empty entry that means a new KML has been registered
+    // Adding just a KML does not remove the old one, the old one gets removed only
+    // after we add an action to the new KML
+    
+    // The double action of first registering a KML file and then registering the action
+    // should be replaced with single call where the control file and action are defined
+    // in one call
+    
     TInt count = iControlPolicies.Count();
-	index = -1;	// Setting index to negative value to use as check if match found.
-	TInt i = 0;
-	TInt j = 0;
-	TInt k = 0;
-	
-	// We stop when we find a matching empty entry
-	// But first old non-empty entries are deleted
-	for( i = count - 1; i >= 0 && index == -1; i-- )
-		{
-		pData = iControlPolicies[i];
-		if( pData->Uid() == aUid )
-			{
-			if ( pData->iControlPolicies.Count() == 0 )
-			    {
-			    index = i;
-			    // We have found an empty definition.
-			    // This means a new effect definition file has been added, and the new action
-			    // should be attached to it.
-			    // But first we have to remove the possible old effect file
-			    for ( j = count - 1; j >= 0; j-- )
-			        {
-               		pData = iControlPolicies[j];
-               		if ( pData->Uid() == aUid )
-               		    {
-                   		for ( k = 0; pData && k < pData->iControlPolicies.Count(); k++ )
-                   		    {
-            				pPolicy = pData->iControlPolicies[k];
-                   		    if ( pPolicy->iAction == aAction )
-                   		        {
-                   		        // Old definition found, remove the whole policy entry
-    			                iControlPolicies.Remove( j );
-    			                count--; // this value is referred later. It must be kept up to date.
-    			                delete pData;
-    			                pData = NULL;
-                   		        }
-                   		    }
-               		    }
-			        }
-			    }
-			}
-		}
-		
-	if( index >= 0 )
-		{
-		index = -1; // paranoid...
-		// find the empty entry again - if it exists
-		// our indexes may have got messed up if we removed something
-		// so we must recheck the index
-		// We only accept entries with no policies, as we just checked
-		// the existence of an entry with matching policy
-    	for( i = count - 1; i >= 0 && index == -1; i-- )
-	    	{
-		    pData = iControlPolicies[i];
-		    if( pData->Uid() == aUid )
-			    {
-     			if ( pData->iControlPolicies.Count() == 0 )
-     			    {
-	     		    index = i;
-     			    }
-			    }
-	    	}
-		}
+    index = -1; // Setting index to negative value to use as check if match found.
+    TInt i = 0;
+    TInt j = 0;
+    TInt k = 0;
+    
+    // We stop when we find a matching empty entry
+    // But first old non-empty entries are deleted
+    for( i = count - 1; i >= 0 && index == -1; i-- )
+        {
+        pData = iControlPolicies[i];
+        if( pData->Uid() == aUid )
+            {
+            if ( pData->iControlPolicies.Count() == 0 )
+                {
+                index = i;
+                // We have found an empty definition.
+                // This means a new effect definition file has been added, and the new action
+                // should be attached to it.
+                // But first we have to remove the possible old effect file
+                for ( j = count - 1; j >= 0; j-- )
+                    {
+                    pData = iControlPolicies[j];
+                    if ( pData->Uid() == aUid )
+                        {
+                        for ( k = 0; pData && k < pData->iControlPolicies.Count(); k++ )
+                            {
+                            pPolicy = pData->iControlPolicies[k];
+                            if ( pPolicy->iAction == aAction )
+                                {
+                                // Old definition found, remove the whole policy entry
+                                iControlPolicies.Remove( j );
+                                count--; // this value is referred later. It must be kept up to date.
+                                delete pData;
+                                pData = NULL;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        
+    if( index >= 0 )
+        {
+        index = -1; // paranoid...
+        // find the empty entry again - if it exists
+        // our indexes may have got messed up if we removed something
+        // so we must recheck the index
+        // We only accept entries with no policies, as we just checked
+        // the existence of an entry with matching policy
+        for( i = count - 1; i >= 0 && index == -1; i-- )
+            {
+            pData = iControlPolicies[i];
+            if( pData->Uid() == aUid )
+                {
+                if ( pData->iControlPolicies.Count() == 0 )
+                    {
+                    index = i;
+                    }
+                }
+            }
+        }
 // Now we have checked if we have an effect file definition that has no entries yet,
 // and if we found one, we deleted old effect file definitions for this UID.
-// Now we check if we just update an old action or add a new one to the existing entry		
+// Now we check if we just update an old action or add a new one to the existing entry      
 
-	// First checking if we need to update a policy.
-	// If we have an empty entry, we must use it, not add our action to a different entry
-	// even if if has the same UID.
-	// So we must not try to find an existing entry if we have already decided to use an
-	// empty entry
-	
-	if ( index < 0 )
-	    {
-    	if(FindControlPolicy(aAction, aUid, pPolicy, index) == KErrNone)
-    		{
-    		// If we get here and pPolicy == NULL, something is really wrong outside of
-    		// our control.
-    		pPolicy->iAction = aAction;
-    		// Setting the action string is a leaving method.
-    		// Trap it here to avoid the rest of the system to become
-    		// leaving to.
-    		TRAPD(err, pPolicy->SetActionStringL(aActionString));
-    		if(KErrNone != err)
-    			{
-    			__ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
-    			return err;
-    			}
-    		pPolicy->iPolicy = ESupported;
-    		iClientRequestHandler->RegisterControlAction( aUid, aAction);
-    		__ALFFXLOGSTRING("CPolicyHandler::RegisterControlAction - return KErrNone <<");
-    		return KErrNone;
-    		}
-	    }
-		
-	if( index < 0 )
-		{
-		__ALFFXLOGSTRING("CPolicyHandler::RegisterControlAction - return KErrNotFound <<");
-		return KErrNotFound;
-		}
-		
-	pData = iControlPolicies[index];
-	pPolicy = new CActionPolicy();
-	if(!pPolicy)
-		{
-		__ALFFXLOGSTRING("CPolicyHandler::RegisterControlAction - return KErrNoMemory <<");
-		return KErrNoMemory;
-		}
-	
-	// Assign some values
-	pPolicy->iAction = aAction;
-	pPolicy->iPolicy = ESupported;
-	TRAPD(err, pPolicy->SetActionStringL(aActionString));
-	if(KErrNone != err)
-		{
-		delete pPolicy;
-		__ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
-		return err;
-		}	
+    // First checking if we need to update a policy.
+    // If we have an empty entry, we must use it, not add our action to a different entry
+    // even if if has the same UID.
+    // So we must not try to find an existing entry if we have already decided to use an
+    // empty entry
+    
+    if ( index < 0 )
+        {
+        if(FindControlPolicy(aAction, aUid, pPolicy, index) == KErrNone)
+            {
+            // If we get here and pPolicy == NULL, something is really wrong outside of
+            // our control.
+            pPolicy->iAction = aAction;
+            // Setting the action string is a leaving method.
+            // Trap it here to avoid the rest of the system to become
+            // leaving to.
+            TRAPD(err, pPolicy->SetActionStringL(aActionString));
+            if(KErrNone != err)
+                {
+                __ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
+                return err;
+                }
+            pPolicy->iPolicy = ESupported;
+            iClientRequestHandler->RegisterControlAction( aUid, aAction);
+            __ALFFXLOGSTRING("CPolicyHandler::RegisterControlAction - return KErrNone <<");
+            return KErrNone;
+            }
+        }
+        
+    if( index < 0 )
+        {
+        __ALFFXLOGSTRING("CPolicyHandler::RegisterControlAction - return KErrNotFound <<");
+        return KErrNotFound;
+        }
+        
+    pData = iControlPolicies[index];
+    pPolicy = new CActionPolicy();
+    if(!pPolicy)
+        {
+        __ALFFXLOGSTRING("CPolicyHandler::RegisterControlAction - return KErrNoMemory <<");
+        return KErrNoMemory;
+        }
+    
+    // Assign some values
+    pPolicy->iAction = aAction;
+    pPolicy->iPolicy = ESupported;
+    TRAPD(err, pPolicy->SetActionStringL(aActionString));
+    if(KErrNone != err)
+        {
+        delete pPolicy;
+        __ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
+        return err;
+        }   
 
-	// Then add it to the list.
-	err = pData->iControlPolicies.Append(pPolicy);
-	if(err != KErrNone)
-		{
-		delete pPolicy;
-		pPolicy = NULL;
-		__ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
-		return err;
-		}
-	iClientRequestHandler->RegisterControlAction(aUid, aAction);
-	__ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
-	return err;
-	}
-	
+    // Then add it to the list.
+    err = pData->iControlPolicies.Append(pPolicy);
+    if(err != KErrNone)
+        {
+        delete pPolicy;
+        pPolicy = NULL;
+        __ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
+        return err;
+        }
+    iClientRequestHandler->RegisterControlAction(aUid, aAction);
+    __ALFFXLOGSTRING1("CPolicyHandler::RegisterControlAction - return: %d <<", err);
+    return err;
+    }
+    
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterControlAction(const TUid aUid, TUint aAction)
-	{
-	__ALFFXLOGSTRING2("CPolicyHandler::UnregisterControlAction - aUid %d, aAction: %d >>", aUid, aAction);
-	CControlPolicy* pData = NULL;
-	CActionPolicy* pPolicy = NULL;
-		
-	TInt count = iControlPolicies.Count();
-	
-	// Removing policy for action.
-	for(TInt counter = 0; counter < count; counter++)
-		{
-		pData = iControlPolicies[counter];
-		if(pData->Uid() == aUid)
-			{
-			TInt polActionCount = pData->iControlPolicies.Count();
-			// Iterating the list from first. No problem since we only delete one item!
-			for(TInt j = 0; j < polActionCount; j++)
-				{
-				pPolicy = pData->iControlPolicies[j];
-				if(pPolicy->iAction == aAction)
-					{
-					// Call this before removing data permanently!
-					iClientRequestHandler->RemoveControlPolicy( aUid, aAction);
-					delete pPolicy;
-					pPolicy = NULL;
-					pData->iControlPolicies.Remove(j);
-					__ALFFXLOGSTRING("CPolicyHandler::UnregisterControlAction - return KErrNone<<");
-					return KErrNone;
-					}
-				}
-			}
-		}
-	__ALFFXLOGSTRING("CPolicyHandler::UnregisterControlAction - return KErrNotFound<<");
-	return KErrNotFound;
-	}  	
-	
-	
+    {
+    __ALFFXLOGSTRING2("CPolicyHandler::UnregisterControlAction - aUid %d, aAction: %d >>", aUid, aAction);
+    CControlPolicy* pData = NULL;
+    CActionPolicy* pPolicy = NULL;
+        
+    TInt count = iControlPolicies.Count();
+    
+    // Removing policy for action.
+    for(TInt counter = 0; counter < count; counter++)
+        {
+        pData = iControlPolicies[counter];
+        if(pData->Uid() == aUid)
+            {
+            TInt polActionCount = pData->iControlPolicies.Count();
+            // Iterating the list from first. No problem since we only delete one item!
+            for(TInt j = 0; j < polActionCount; j++)
+                {
+                pPolicy = pData->iControlPolicies[j];
+                if(pPolicy->iAction == aAction)
+                    {
+                    // Call this before removing data permanently!
+                    iClientRequestHandler->RemoveControlPolicy( aUid, aAction);
+                    delete pPolicy;
+                    pPolicy = NULL;
+                    pData->iControlPolicies.Remove(j);
+                    __ALFFXLOGSTRING("CPolicyHandler::UnregisterControlAction - return KErrNone<<");
+                    return KErrNone;
+                    }
+                }
+            }
+        }
+    __ALFFXLOGSTRING("CPolicyHandler::UnregisterControlAction - return KErrNotFound<<");
+    return KErrNotFound;
+    }   
+    
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 void CPolicyHandler::RegisterControlKmlL(const TUid &aUid, const TThreadId &aThreadId, 
-										 const TDesC& aResourceDir, const TDesC& aFilename,
-										 const TInt aWantedTime, const TInt aMinTime)
-	{
-	
-	__ALFFXLOGSTRING2("CPolicyHandler::RegisterControlKmlL - aUid :%d aThread.Id :%d", aUid, aThreadId.Id() );
+                                         const TDesC& aResourceDir, const TDesC& aFilename,
+                                         const TInt aWantedTime, const TInt aMinTime)
+    {
+    
+    __ALFFXLOGSTRING2("CPolicyHandler::RegisterControlKmlL - aUid :%d aThread.Id :%d", aUid, aThreadId.Id() );
    __ALFFXLOGSTRING2("CPolicyHandler::RegisterControlKmlL - aResourceDir: %S, aFilename :%S", &aResourceDir, &aFilename );
 
-	CControlPolicy* policy = NULL;
-	TInt cachePriority = 1; //aCachePriority; 
-	// For now, the cache priority is always 1 at registration time, and after
-	// fetching the KML information from the policy, it gets set to 0. This is
-	// used to trigger eviction from the KML cache. Newly registered KML:s have
-	// priority over existing...
+    CControlPolicy* policy = NULL;
+    TInt cachePriority = 1; //aCachePriority; 
+    // For now, the cache priority is always 1 at registration time, and after
+    // fetching the KML information from the policy, it gets set to 0. This is
+    // used to trigger eviction from the KML cache. Newly registered KML:s have
+    // priority over existing...
 
-	// Check if the action was already is registered and if so, delete it.
-	
-// TEST!!!!!!!!!!!! Don't delete before action is added	
+    // Check if the action was already is registered and if so, delete it.
+    
+// TEST!!!!!!!!!!!! Don't delete before action is added 
 // Only delete if the entry has no policies, then we are replacing the xml file
 // though we have added no actions yet
-	TInt count = iControlPolicies.Count()-1;
-	for(; count >= 0; count--)
-		{
-		if(	iControlPolicies[count]->Uid() == aUid)
-			{
-			policy = iControlPolicies[count];
-			if ( policy->iControlPolicies.Count() == 0 )
-			    {
-    			iControlPolicies.Remove(count);
-	    		delete policy;
-		    	policy = NULL;
-			    }
-			}
-		} 
+    TInt count = iControlPolicies.Count()-1;
+    for(; count >= 0; count--)
+        {
+        if( iControlPolicies[count]->Uid() == aUid)
+            {
+            policy = iControlPolicies[count];
+            if ( policy->iControlPolicies.Count() == 0 )
+                {
+                iControlPolicies.Remove(count);
+                delete policy;
+                policy = NULL;
+                }
+            }
+        } 
 
-	// Create the new action and add it.
-	policy = CControlPolicy::NewL(aUid, aThreadId, aResourceDir, aFilename, cachePriority, aWantedTime, aMinTime);
-	CleanupStack::PushL(policy);
-	iControlPolicies.AppendL(policy);
-	CleanupStack::Pop(policy);
-	__ALFFXLOGSTRING("CPolicyHandler::RegisterControlKmlL <<");
-	}
-	
+    // Create the new action and add it.
+    policy = CControlPolicy::NewL(aUid, aThreadId, aResourceDir, aFilename, cachePriority, aWantedTime, aMinTime);
+    CleanupStack::PushL(policy);
+    iControlPolicies.AppendL(policy);
+    CleanupStack::Pop(policy);
+    __ALFFXLOGSTRING("CPolicyHandler::RegisterControlKmlL <<");
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::RemoveControlKml(const TUid &aUid)
-	{
-	__ALFFXLOGSTRING1("CPolicyHandler::RemoveControlKml - aUid: %d ", aUid);
-	
-	TInt err = KErrNotFound;
-	CControlPolicy* ptr = NULL;
-	CActionPolicy* action = NULL;
-	TInt policyCount = iControlPolicies.Count();
-	// We may remove several KMLs if different actions have different effect files
-	for( TInt i = policyCount - 1; i >= 0; i--)
-		{
-		ptr = iControlPolicies[i];
-		if(ptr->Uid() == aUid)
-			{
-			// making sure that policies get removed from the running clients as well!
-			TInt count = ptr->iControlPolicies.Count();
-			if( count > 0)
-				{
-				for(TInt j = 0; j < count; j++)
-					{
-					action = ptr->iControlPolicies[j];
-					iClientRequestHandler->RemoveControlPolicy(aUid, action->iAction);
-					}
-				}
-			iControlPolicies.Remove(i);
-			delete ptr;
-			ptr = NULL;
-			err = KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING1("CPolicyHandler::RemoveControlKml - return: %d <<", err);
-	return err;
-	}
-	
+    {
+    __ALFFXLOGSTRING1("CPolicyHandler::RemoveControlKml - aUid: %d ", aUid);
+    
+    TInt err = KErrNotFound;
+    CControlPolicy* ptr = NULL;
+    CActionPolicy* action = NULL;
+    TInt policyCount = iControlPolicies.Count();
+    // We may remove several KMLs if different actions have different effect files
+    for( TInt i = policyCount - 1; i >= 0; i--)
+        {
+        ptr = iControlPolicies[i];
+        if(ptr->Uid() == aUid)
+            {
+            // making sure that policies get removed from the running clients as well!
+            TInt count = ptr->iControlPolicies.Count();
+            if( count > 0)
+                {
+                for(TInt j = 0; j < count; j++)
+                    {
+                    action = ptr->iControlPolicies[j];
+                    iClientRequestHandler->RemoveControlPolicy(aUid, action->iAction);
+                    }
+                }
+            iControlPolicies.Remove(i);
+            delete ptr;
+            ptr = NULL;
+            err = KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING1("CPolicyHandler::RemoveControlKml - return: %d <<", err);
+    return err;
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::UnregisterControlKml(const TThreadId &aThreadId)
-	{
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterControlKml - aThreadId: %d ", aThreadId.Id() );
-	CControlPolicy* ptr = NULL;
-	CActionPolicy* action = NULL;
-	TInt err = KErrNotFound;
-	TThreadId tid;
-	TInt policyCount = iControlPolicies.Count();
-	
-	for( TInt i = policyCount - 1; i >= 0; i--)
-		{
-		ptr = iControlPolicies[i];
-		tid = ptr->ThreadId();
-		
-		if(tid.Id() == aThreadId.Id())
-			{
-			// making sure that policies get removed from the running clients as well!
-			TInt count = ptr->iControlPolicies.Count();
-			if(count > 0)
-				{
-				for(TInt j = 0; j < count; j++)
-					{
-					action = ptr->iControlPolicies[j];
-					iClientRequestHandler->RemoveControlPolicy(ptr->Uid(), action->iAction);
-					}
-				}
-			iControlPolicies.Remove(i);
-			delete ptr;
-			ptr = NULL;
-			err = KErrNone;
-			}
-		}
-	__ALFFXLOGSTRING1("CPolicyHandler::UnregisterControlKml - return: %d <<", err);
-	return err;
-	}
+    {
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterControlKml - aThreadId: %d ", aThreadId.Id() );
+    CControlPolicy* ptr = NULL;
+    CActionPolicy* action = NULL;
+    TInt err = KErrNotFound;
+    TThreadId tid;
+    TInt policyCount = iControlPolicies.Count();
+    
+    for( TInt i = policyCount - 1; i >= 0; i--)
+        {
+        ptr = iControlPolicies[i];
+        tid = ptr->ThreadId();
+        
+        if(tid.Id() == aThreadId.Id())
+            {
+            // making sure that policies get removed from the running clients as well!
+            TInt count = ptr->iControlPolicies.Count();
+            if(count > 0)
+                {
+                for(TInt j = 0; j < count; j++)
+                    {
+                    action = ptr->iControlPolicies[j];
+                    iClientRequestHandler->RemoveControlPolicy(ptr->Uid(), action->iAction);
+                    }
+                }
+            iControlPolicies.Remove(i);
+            delete ptr;
+            ptr = NULL;
+            err = KErrNone;
+            }
+        }
+    __ALFFXLOGSTRING1("CPolicyHandler::UnregisterControlKml - return: %d <<", err);
+    return err;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-TInt CPolicyHandler::GetControlKml(	TUid aUid, TUint aAction, TPtrC& aResourceDir, 
-					TPtrC& aFileName, TPtrC& aActionString, TInt& aCachePriority,
-					TInt& aWantedTime, TInt& aMinTime)
-	{
-	__ALFFXLOGSTRING2("CPolicyHandler::GetControlKml - aAction: %d aUid :0x%x", aAction, aUid );
-	__ALFFXLOGSTRING3("CPolicyHandler::GetControlKml - aResourceDir: %S, aFilename :%S, aActionString: %S", &aResourceDir, &aFileName, &aActionString );
-	    
-	CControlPolicy* ptr = NULL;
-	CActionPolicy* pPolicy = NULL;
-	aResourceDir.Set( TPtrC() );
-	aFileName.Set( TPtrC() );
+TInt CPolicyHandler::GetControlKml( TUid aUid, TUint aAction, TPtrC& aResourceDir, 
+                    TPtrC& aFileName, TPtrC& aActionString, TInt& aCachePriority,
+                    TInt& aWantedTime, TInt& aMinTime)
+    {
+    __ALFFXLOGSTRING2("CPolicyHandler::GetControlKml - aAction: %d aUid :0x%x", aAction, aUid );
+    __ALFFXLOGSTRING3("CPolicyHandler::GetControlKml - aResourceDir: %S, aFilename :%S, aActionString: %S", &aResourceDir, &aFileName, &aActionString );
+        
+    CControlPolicy* ptr = NULL;
+    CActionPolicy* pPolicy = NULL;
+    aResourceDir.Set( TPtrC() );
+    aFileName.Set( TPtrC() );
     aActionString.Set( TPtrC() );
 
-	TInt itemCount = iControlPolicies.Count();
-	for(TInt i = 0; i < itemCount; i++)
-		{
-		ptr = iControlPolicies[i];
-		if( ptr->Uid() == aUid)
-			{
-			aResourceDir.Set( ptr->ResourceDir() );
-			aFileName.Set( ptr->Filename() );
-			aCachePriority = ptr->CachePriority();
-			aWantedTime = ptr->WantedTime();
-			aMinTime = ptr->MinTime();
-			TInt actionCount = ptr->iControlPolicies.Count();
-			for(TInt j = 0; j < actionCount; j++)
-				{
-				pPolicy = ptr->iControlPolicies[j];
-				if(pPolicy->iAction == aAction)
-					{
-					aActionString.Set( pPolicy->ActionString() );
-					// For now, this entry should have no priority over others
-					ptr->SetCachePriority(0);
-					__ALFFXLOGSTRING("CPolicyHandler::GetControlKml - return KErrNone <<");
-					return KErrNone;
-					}
-				}
-			}
-		}
-	__ALFFXLOGSTRING("CPolicyHandler::GetControlKml - return KErrNotFound <<");
-	return KErrNotFound;
-	}
-	
+    TInt itemCount = iControlPolicies.Count();
+    for(TInt i = 0; i < itemCount; i++)
+        {
+        ptr = iControlPolicies[i];
+        if( ptr->Uid() == aUid)
+            {
+            aResourceDir.Set( ptr->ResourceDir() );
+            aFileName.Set( ptr->Filename() );
+            aCachePriority = ptr->CachePriority();
+            aWantedTime = ptr->WantedTime();
+            aMinTime = ptr->MinTime();
+            TInt actionCount = ptr->iControlPolicies.Count();
+            for(TInt j = 0; j < actionCount; j++)
+                {
+                pPolicy = ptr->iControlPolicies[j];
+                if(pPolicy->iAction == aAction)
+                    {
+                    aActionString.Set( pPolicy->ActionString() );
+                    // For now, this entry should have no priority over others
+                    ptr->SetCachePriority(0);
+                    __ALFFXLOGSTRING("CPolicyHandler::GetControlKml - return KErrNone <<");
+                    return KErrNone;
+                    }
+                }
+            }
+        }
+    __ALFFXLOGSTRING("CPolicyHandler::GetControlKml - return KErrNotFound <<");
+    return KErrNotFound;
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::GetAllControlPolicies(RPointerArray<CClientControlPolicy>& aControlPolicies)
-	{
-	__ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies >>");
-	TInt err = KErrNone;
-	
-	TInt itemCount = iControlPolicies.Count();
-	if( 0 >= itemCount)
-		{
-		__ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNotFound <<");
-		return KErrNotFound;
-		}
+    {
+    __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies >>");
+    TInt err = KErrNone;
+    
+    TInt itemCount = iControlPolicies.Count();
+    if( 0 >= itemCount)
+        {
+        __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNotFound <<");
+        return KErrNotFound;
+        }
 
-	for(TInt i = 0; i < itemCount; i++)
-		{
-		CClientControlPolicy* ptr = new CClientControlPolicy();
-		if ( ptr == NULL )
-		    {
-		    __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNoMemory <<");
-		    return KErrNoMemory;
-		    }
-		ptr->iUid = iControlPolicies[i]->Uid();
-		HBufC* fname = HBufC::New(iControlPolicies[i]->Filename().Length());
-		if ( fname == NULL )
-		    {
-		    delete ptr;
-		    __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNoMemory <<");
-		    return KErrNoMemory;
-		    }
-		fname->Des().Copy(iControlPolicies[i]->Filename());
-		ptr->iFilename.Assign(fname);
-		HBufC* resdir = HBufC::New(255);
+    for(TInt i = 0; i < itemCount; i++)
+        {
+        CClientControlPolicy* ptr = new CClientControlPolicy();
+        if ( ptr == NULL )
+            {
+            __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNoMemory <<");
+            return KErrNoMemory;
+            }
+        ptr->iUid = iControlPolicies[i]->Uid();
+        HBufC* fname = HBufC::New(iControlPolicies[i]->Filename().Length());
+        if ( fname == NULL )
+            {
+            delete ptr;
+            __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNoMemory <<");
+            return KErrNoMemory;
+            }
+        fname->Des().Copy(iControlPolicies[i]->Filename());
+        ptr->iFilename.Assign(fname);
+        HBufC* resdir = HBufC::New(255);
         if ( resdir == NULL )
             {
             delete ptr;
             __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNoMemory <<");
             return KErrNoMemory;
             }
-		ptr->iResourceDir.Assign(resdir);
-		// In order to actually copy the pointers to the policy data, we
-		// need to iterate through the entire list. 
-		TInt count = iControlPolicies[i]->iControlPolicies.Count();
-		if(count > 0)
-			{
-			for( TInt j = 0; j < count; j++)
-				{
-				err = ptr->iControlPolicies.Append(iControlPolicies[i]->iControlPolicies[j]);
-				if(KErrNone != err)
-					{
-					delete ptr;
-					__ALFFXLOGSTRING1("CPolicyHandler::GetAllControlPolicies - return: %d <<", err);
-					return err;
-					}
-				}
-			err = aControlPolicies.Append(ptr);	
-			if(KErrNone != err)
-				{
-				delete ptr;
-				__ALFFXLOGSTRING1("CPolicyHandler::GetAllControlPolicies - return: %d <<", err);
-				return err;
-				}
-			}
-		else
-			{
-			delete ptr;
-			ptr = NULL;
-			}
-		}
-	__ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNotFound<<");
-	return KErrNone;
-	}
+        ptr->iResourceDir.Assign(resdir);
+        // In order to actually copy the pointers to the policy data, we
+        // need to iterate through the entire list. 
+        TInt count = iControlPolicies[i]->iControlPolicies.Count();
+        if(count > 0)
+            {
+            for( TInt j = 0; j < count; j++)
+                {
+                err = ptr->iControlPolicies.Append(iControlPolicies[i]->iControlPolicies[j]);
+                if(KErrNone != err)
+                    {
+                    delete ptr;
+                    __ALFFXLOGSTRING1("CPolicyHandler::GetAllControlPolicies - return: %d <<", err);
+                    return err;
+                    }
+                }
+            err = aControlPolicies.Append(ptr); 
+            if(KErrNone != err)
+                {
+                delete ptr;
+                __ALFFXLOGSTRING1("CPolicyHandler::GetAllControlPolicies - return: %d <<", err);
+                return err;
+                }
+            }
+        else
+            {
+            delete ptr;
+            ptr = NULL;
+            }
+        }
+    __ALFFXLOGSTRING("CPolicyHandler::GetAllControlPolicies - return KErrNotFound<<");
+    return KErrNone;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::RequestPolicy(const RMessage2& aMessage)
-	{
-	return iClientRequestHandler->RequestPolicy(aMessage);
-	}
+    {
+    return iClientRequestHandler->RequestPolicy(aMessage);
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::GetPolicyL( TThreadId aClientId, TInt aPolicyCount, TPtr8& aOutBuf )
- 	{
- 	return iClientRequestHandler->GetPolicyL( aClientId, aPolicyCount, aOutBuf );
- 	}
- 	
+    {
+    return iClientRequestHandler->GetPolicyL( aClientId, aPolicyCount, aOutBuf );
+    }
+    
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 void CPolicyHandler::RemoveClient( TThreadId aClientId )
- 	{
- 	iClientRequestHandler->RemoveClient( aClientId );
- 	}
+    {
+    iClientRequestHandler->RemoveClient( aClientId );
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 /*
 void CPolicyHandler::RemoveDeadClients()
- 	{
- 	iClientRequestHandler->RemoveDeadClients();
- 	}
-*/ 	
+    {
+    iClientRequestHandler->RemoveDeadClients();
+    }
+*/  
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 /*
 void CPolicyHandler::DumpClientsL(RFileWriteStream& aFile)
-	{
-	iClientRequestHandler->DumpClientsL(aFile);
-	}
-*/	
- 	
+    {
+    iClientRequestHandler->DumpClientsL(aFile);
+    }
+*/  
+    
 
-//==============  	PRIVATE METHODS =================/
+//==============    PRIVATE METHODS =================/
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 TInt CPolicyHandler::FindControlPolicy(TUint aAction, TUid aUid, CActionPolicy*& aPolicy, TInt& aIndex)
-	{
-	__ALFFXLOGSTRING3("CPolicyHandler::FindControlPolicy - aAction: %d, aUid: 0x%x, aIndex: %d", aAction, aUid, aIndex );
-	
-	TInt count = iControlPolicies.Count();
-	aIndex = -1;	// Setting index to low value to avoid accidental insertion.
-	
-	CControlPolicy* pData = NULL;
-	for(TInt i = 0; i < count; i++)
-		{
-		pData = iControlPolicies[i];
-		if(pData->Uid() == aUid)
-			{
-			aIndex = i;
-			TInt j = pData->iControlPolicies.Count();
-			CActionPolicy* pPolicy = NULL;
-			for(TInt q = 0; q < j; q++)
-				{
-				pPolicy = pData->iControlPolicies[q];
-				if(pPolicy->iAction == aAction)
-					{
-					aPolicy = pPolicy;
-					__ALFFXLOGSTRING("CPolicyHandler::FindControlPolicy - return KErrNone <<");
-					return KErrNone;
-					}
-				}
-			}
-		}
+    {
+    __ALFFXLOGSTRING3("CPolicyHandler::FindControlPolicy - aAction: %d, aUid: 0x%x, aIndex: %d", aAction, aUid, aIndex );
+    
+    TInt count = iControlPolicies.Count();
+    aIndex = -1;    // Setting index to low value to avoid accidental insertion.
+    
+    CControlPolicy* pData = NULL;
+    for(TInt i = 0; i < count; i++)
+        {
+        pData = iControlPolicies[i];
+        if(pData->Uid() == aUid)
+            {
+            aIndex = i;
+            TInt j = pData->iControlPolicies.Count();
+            CActionPolicy* pPolicy = NULL;
+            for(TInt q = 0; q < j; q++)
+                {
+                pPolicy = pData->iControlPolicies[q];
+                if(pPolicy->iAction == aAction)
+                    {
+                    aPolicy = pPolicy;
+                    __ALFFXLOGSTRING("CPolicyHandler::FindControlPolicy - return KErrNone <<");
+                    return KErrNone;
+                    }
+                }
+            }
+        }
     __ALFFXLOGSTRING("CPolicyHandler::FindControlPolicy - return KErrNotFound <<");
-	return KErrNotFound;
-	}
+    return KErrNotFound;
+    }
 
 
 // --- EOF ---