Revision: 201021
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 11 Jun 2010 14:31:43 +0300
changeset 35 ac76c975c9be
parent 25 f7f1ae431f74
child 42 b80cfcbd075a
Revision: 201021 Kit: 2010123
group/bld.inf
layers.sysdef.xml
uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h
uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiRoster.h
uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def
uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp
uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h
uiacceltk/hitchcock/CommonInc/alfmoduletest.h
uiacceltk/hitchcock/CommonInc/alfmoduletestconf.h
uiacceltk/hitchcock/CommonInc/alfmoduletestconsts.h
uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h
uiacceltk/hitchcock/CommonInc/alfmoduletestitem.h
uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h
uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h
uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h
uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h
uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h
uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp
uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp
uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp
uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp
uiacceltk/hitchcock/ServerCore/Src/alfsrvcontrolgroupsubsession.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp
uiacceltk/hitchcock/backgroundanim/inc/sensor.h
uiacceltk/hitchcock/backgroundanim/src/sensor.cpp
uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilter.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilterLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxGroupLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BevelFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BlurFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10ColorMatrixFilterBase.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10FilterBase.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10OutlineFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10TransformFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BevelFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BlurFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10ColorMatrixFilterBase.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10FilterBase.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10OutlineFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10TransformFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxFilterLayer.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxGroupLayer.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h
uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h
uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp
--- a/group/bld.inf	Thu May 27 13:47:19 2010 +0300
+++ b/group/bld.inf	Fri Jun 11 14:31:43 2010 +0300
@@ -15,9 +15,9 @@
 *
 */
 
-// local
-//#define ALF_USE_OPENWF_COMPOSITION
-
+#ifdef SYMBIAN_GRAPHICS_BUILD_OPENWF_WSERV
+#define ALF_USE_OPENWF_COMPOSITION
+#endif
 
 #include "../uiaccelerator_plat/group/bld.inf"
 
--- a/layers.sysdef.xml	Thu May 27 13:47:19 2010 +0300
+++ b/layers.sysdef.xml	Fri Jun 11 14:31:43 2010 +0300
@@ -10,6 +10,7 @@
         <unit unitID="nga.uiaccelerator" mrp="" bldFile="&layer_real_source_path;/group" name="uiaccelerator" />
       </module>
     </layer>
+
     
    <layer name="unit_test_layer">
       <module name="uiaccelerator_test">
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h	Fri Jun 11 14:31:43 2010 +0300
@@ -164,6 +164,12 @@
      * @return Container. Ownership not transferred.
      */
     CObjectCon* NewContainerL();
+
+    /**
+     * Releases container created by NewContainerL back to server.
+     * @param aContainer container to be removed.
+     */
+    void ReleaseContainer(CObjectCon& aContainer);
     
 // from base class CAknAppServer
 
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Fri Jun 11 14:31:43 2010 +0300
@@ -33,6 +33,7 @@
 class CAlfAppSrvSessionBase;
 class CAlfSrvResourceManager;
 class CAlfSrvSettingsHandler;
+class RAlfBridgerClient;
 
 enum TAlfSrvSetting
     {
@@ -177,6 +178,8 @@
     void EndPointerEventHandling();
     void UpdateActiveSession(CAlfAppSrvSessionBase* aSession);
     
+    CAlfAppSrvSessionBase* ActiveSession();
+    
     TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
 
     TInt FirstAlfControlGroupIndex( TInt aScreenNumber = 0);    
@@ -205,6 +208,7 @@
     void DoBlankScreen(const RMessage2& aMessage);
     
     TInt GetLastActiveClient();
+    RAlfBridgerClient* BridgerClient();
 
 private:
 
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Fri Jun 11 14:31:43 2010 +0300
@@ -449,8 +449,8 @@
     static TBool RecursiveIsExternalContentDrawingEnabled(CHuiVisual* aVisual);
     static TBool RecursiveHasCommandBuffers(CHuiVisual* aVisual);
     
-    void CollectPaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
-    void CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
+    TBool CollectPaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
+    TBool CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
     
     TBool CanSkipDrawing() const;
     TBool KeepNoCache() const;
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h	Fri Jun 11 14:31:43 2010 +0300
@@ -30,6 +30,29 @@
 #include <uiacceltk/HuiSessionObject.h>
 
 
+
+enum THuiControlGroupRole
+    {
+    /** Unknown */
+    EHuiUnknownContainer,
+    
+    /** Alf application control group */
+    EHuiSessionContainer,
+    
+    /** WSERV window group */
+    EHuiWindowGroupContainer,
+    
+    /** WSERV floating sprite group */
+    EHuiWindowFloatingSpriteContainer,
+
+    /** Group for showing effects */
+    EHuiFullScreenEffectContainer,
+    
+    /** Group for FPS indicator */
+    EHuiFpsIndicatorContainer
+    };
+
+
 /* Forward declarations. */
 class CHuiEnv;
 class CHuiControl;
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Fri Jun 11 14:31:43 2010 +0300
@@ -821,6 +821,10 @@
     
     void DoBackgroundClear();
     
+    void ScanningAlfContent(TBool aScanning );
+    void SetAlfContentChanged(TBool aChanged);
+    TBool AlfContentChanged();
+    
 private:
 
     /**
@@ -1030,6 +1034,10 @@
     
     /** Current dirty region for this refresh instance */
     RDirtyRegions iTempDirtyRegions;
+    
+	/** For handling alf content update */
+    TBool iScanningAlfContent;
+    TBool iDisplayContainsChangedAlfContent;
     };
 
 #endif  // __HUIDISPLAY_H__
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiRoster.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiRoster.h	Fri Jun 11 14:31:43 2010 +0300
@@ -234,6 +234,8 @@
     
     virtual TBool IsVisibleContentFrozen() const = 0;
     
+    virtual void SetAlfEventWindow(CHuiVisual* aVisual) = 0;
+    
 protected:
 
     /* Constructors. */
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def	Fri Jun 11 14:31:43 2010 +0300
@@ -50,4 +50,5 @@
 	?SubscribeCallbackL@CAlfEffectObserver@@QAEXPAVMAlfEffectObserver@1@HH@Z @ 49 NONAME ; void CAlfEffectObserver::SubscribeCallbackL(class CAlfEffectObserver::MAlfEffectObserver *, int, int)
 	?GetListOfWindowGroupsWSurfaces@RAlfBridgerClient@@QAEHPAV?$RArray@H@@@Z @ 50 NONAME ; int RAlfBridgerClient::GetListOfWindowGroupsWSurfaces(class RArray<int> *)
 	?SetDistractionWindow@CAlfEffectObserver@@QAEXABVRWindowTreeNode@@H@Z @ 51 NONAME ; void CAlfEffectObserver::SetDistractionWindow(class RWindowTreeNode const &, int)
+	?GetOptionalGraphicsMemUsers@RAlfBridgerClient@@QAEXPAV?$RArray@H@@@Z @ 52 NONAME ; void RAlfBridgerClient::GetOptionalGraphicsMemUsers(class RArray<int> *)
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def	Fri Jun 11 14:31:43 2010 +0300
@@ -73,4 +73,5 @@
 	_ZN18CAlfEffectObserver18SubscribeCallbackLEPNS_18MAlfEffectObserverEii @ 72 NONAME
 	_ZN17RAlfBridgerClient30GetListOfWindowGroupsWSurfacesEP6RArrayIiE @ 73 NONAME
 	_ZN18CAlfEffectObserver20SetDistractionWindowERK15RWindowTreeNodei @ 74 NONAME
+	_ZN17RAlfBridgerClient27GetOptionalGraphicsMemUsersEP6RArrayIiE @ 75 NONAME
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -156,12 +156,14 @@
     SendReceive(aOp, aIPCArgs, aStatus );
     }
 
-TInt RAlfBridgerClient::GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TBool aListAll)
+TInt RAlfBridgerClient::GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TInt aType)
     {
     TInt err = KErrNone;
     TInt array[10];
     TPtr8 ptr((TUint8*)array,0,40);
-    err = SendReceive(EAlfGetListOfWGsHavingInactiveSurfaces, TIpcArgs(&ptr, aListAll));
+
+    err = SendReceive(EAlfGetListOfWGsHavingInactiveSurfaces, TIpcArgs(&ptr, aType));
+
     if (!err)
         {
         for(TInt i = 0; i < 10; i++)
@@ -181,14 +183,18 @@
 
 EXPORT_C TInt RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups)
     {
-    return GetListOfWindowGroups(aWindowGroups, EFalse);
+    return GetListOfWindowGroups(aWindowGroups, EAlfInactiveWgs);
     }
 
 EXPORT_C TInt RAlfBridgerClient::GetListOfWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups)
     {
-    return GetListOfWindowGroups(aWindowGroups, ETrue);
+    return GetListOfWindowGroups(aWindowGroups, EAlfAllWgsWithSurface);
     }
 
+EXPORT_C void RAlfBridgerClient::GetOptionalGraphicsMemUsers(RArray<TInt>* aOptionalCandidates)
+    {
+    GetListOfWindowGroups(aOptionalCandidates, EAlfVolunteersForCommonGood);
+    }    
 
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h	Fri Jun 11 14:31:43 2010 +0300
@@ -66,16 +66,23 @@
      */    
     IMPORT_C TInt GetListOfWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups);
 
-
      /**
      * Asks the number of active effects
      * @return error code or number of active effects (>= 0).
      */    
      IMPORT_C TInt EffectsCount();
+
+     /**
+     * Asks list of window groups that potentially use graohics memory even no direct EGL nor surface access on main display
+     * @param aArray array to be populated
+     * @return error code.
+     */   
+    IMPORT_C void RAlfBridgerClient::GetOptionalGraphicsMemUsers(RArray<TInt>* aOptionalCandidates);
+
      
 private:
     
-    TInt GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TBool aListAll);
+    TInt GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TInt aType);
     TInt iSpare1;
     TInt iSpare2;
     };
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 #ifndef ALFMODULETEST_H
 #define ALFMODULETEST_H
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestconf.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestconf.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 #ifndef ALF_MODULETEST_CONF_H
 #define ALF_MODULETEST_CONF_H
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestconsts.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestconsts.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * Provides general constants for test cases.
  */
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @see alfmoduletest.h for class implementations that these defines use.
  */
@@ -35,40 +19,9 @@
     #define AMT_FUNC_EXC_RET(ret, func)
     #define AMT_FUNC_EXC_IF(cond, func)
     #define AMT_FUNC_EXC_IF_RET(cond, ret, 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_INC_COUNTER_IF(cond, member)
-    #define AMT_DEC_COUNTER_IF(cond, member)
-    #define AMT_SET_VALUE_IF(cond, member, val)
-    #define AMT_GET_VALUE_IF(cond, x, member)
-
-    #define AMT_ADD_TIME(handle, member, effects)
-    #define AMT_GET_TIME(x, handle, index, effects)
-    #define AMT_GET_TIME_POINT_COUNT(handle, x)
-    #define AMT_RESET_TIME(handle)
-    
-    #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr )
-    #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr )
-    #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)
-    #define AMT_MAP_APPEND(memberMap, key, defaultValue, type)
-    #define AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, targetKey, type)
-    #define AMT_MAP_APPEND_LINK(memberMap, linkKey, targetKey, type)
-    #define AMT_MAP_APPEND_AND_LINK_IF(cond, memberMap, linkKey, actualKey, defaultValue, type)
-    #define AMT_MAP_APPEND_AND_LINK(memberMap, linkKey, actualKey, defaultValue, type)
-    #define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)
-    #define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)
-    #define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)
-    #define AMT_MAP_SET_VALUE(memberMap, key, value, type)
-    #define AMT_MAP_INC_VALUE(memberMap, key, type)
-    #define AMT_MAP_DEC_VALUE(memberMap, key, type)
-    #define AMT_MAP_APPEND_ACCEPT_IF(cond, memberMap, testType)
-    #define AMT_MAP_APPEND_ACCEPT(memberMap, testType)
-    #define AMT_MAP_RESET_ITEMS(memberMap, defaultValue, type)
-    #define AMT_MAP_RESET(memberMap)
-    
-    #define AMT_PRINT_STATE()
+    #define AMT_MAP_PTR_TO_KEY_CAST(keyPtr)
+    #define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC()
+    #define AMT_MAP_GCE_SET_LAYER_POSITIONS()
 
 #else
     // Module test hook has been set.
@@ -83,6 +36,23 @@
     #endif // AMT_CONTROL
 
 
+    // *** General test variable defines
+    
+    // Text cursor handle is defined as constant because correct handle is not provided
+    // from the window server for render stage.
+    #define AMT_MAP_TEXT_CURSOR_HANDLE 0
+    
+    #define AMT_MAP_FORCE_SW_HANDLE 0
+    #define AMT_MAP_SW_ENABLED_HANDLE 1
+    #define AMT_MAP_LOW_MEMORY_MODE_HANDLE 2
+    
+    #define AMT_MAP_CANVAS_WS_GC_TYPE 0
+    #define AMT_MAP_TEXTURE_CACHE_MEMORY_LEVEL 1
+    #define AMT_MAP_CACHED_IMAGES_COUNT 2
+    #define AMT_MAP_CACHED_TEXTS_COUNT 3
+    #define AMT_MAP_CACHED_RENDER_BUFFERS_COUNT 4
+
+
     //  *** Use these macros to access global memory chunk
     
     
@@ -92,67 +62,97 @@
     
     // 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
+    // *** 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();}
     #define AMT_FUNC_EXC_RET(ret, func)             {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {ret = func;} AMT_CONTROL()->Unlock();}
     #define AMT_FUNC_EXC_IF(cond, func)             {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();}        
     #define AMT_FUNC_EXC_IF_RET(cond, ret, func)    {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {ret = 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)
-    
-    // Conditional single operation macros, that will do lock/unlock.
-    #define AMT_INC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++)
-    #define AMT_DEC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--)
-    #define AMT_SET_VALUE_IF(cond, member, val)     AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val))
-    #define AMT_GET_VALUE_IF(cond, x, member)       AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member)
-    
-    #define AMT_ADD_TIME(handle, member, effects)   AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ TInt nextFreeIndex = AMT_DATA()->iTimeMap[timemapIndex].iCounter; AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[nextFreeIndex] = member; AMT_DATA()->iTimeMap[timemapIndex].iCounter++; timemapIndex = 100; break;} timemapIndex++; } if (timemapIndex == 10) { if (AMT_DATA()->iNextFreeMap == 10) { AMT_DATA()->iNextFreeMap = 0;} TInt nextFreeMap = AMT_DATA()->iNextFreeMap; AMT_DATA()->iTimeMap[nextFreeMap].iCounter = 1; AMT_DATA()->iTimeMap[nextFreeMap].iHandle = handle; AMT_DATA()->iTimeMap[nextFreeMap].iTimeStamp[0] = member; AMT_DATA()->iTimeMap[nextFreeMap].iEffects = effects; AMT_DATA()->iNextFreeMap++; /*RDebug::Printf("Handle: %d, %d %d %d", handle, timemapIndex, AMT_DATA()->iNextFreeMap, member)*/;})
-    #define AMT_GET_TIME(x, handle, index, effects) AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[index];(effects) = AMT_DATA()->iTimeMap[timemapIndex].iEffects;break;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;(effects) = EFalse;})
-    #define AMT_GET_TIME_POINT_COUNT(handle, x)     AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iCounter;timemapIndex = 100;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;})
-    #define AMT_RESET_TIME(handle)                  AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ AMT_DATA()->iTimeMap[timemapIndex].iHandle = 0; AMT_DATA()->iTimeMap[timemapIndex].iCounter = 0;AMT_DATA()->iTimeMap[timemapIndex].iEffects = 0;break;}timemapIndex++;})
-    
-    // Map operation macros, that will do lock/unlock
-    #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr )                                                   reinterpret_cast< TInt >( keyPtr )
-    #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr )                                                 AMT_MAP_PTR_TO_KEY_CAST( static_cast< const CBase* >( keyCPtr ) )
-    #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)                         AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.Append(type, key, defaultValue))
-    #define AMT_MAP_APPEND(memberMap, key, defaultValue, type)                                  AMT_MAP_APPEND_IF(ETrue, memberMap, key, defaultValue, type)
-    #define AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, targetKey, type)                   AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.AppendLink(type, linkKey, targetKey))
-    #define AMT_MAP_APPEND_LINK(memberMap, linkKey, targetKey, type)                            AMT_MAP_APPEND_LINK_IF(ETrue, memberMap, linkKey, targetKey, type)
-    #define AMT_MAP_APPEND_AND_LINK_IF(cond, memberMap, linkKey, actualKey, defaultValue, type) AMT_MAP_APPEND_IF(cond, memberMap, actualKey, defaultValue, type ); AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, actualKey, type)
-    #define AMT_MAP_APPEND_AND_LINK(memberMap, linkKey, actualKey, defaultValue, type)          AMT_MAP_APPEND_AND_LINK_IF(ETrue, memberMap, linkKey, actualKey, defaultValue, type)
-    #define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)                             AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetActualValue(type, key, value))
-    #define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)                                    AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.FindActual(type, key)), AMT_DATA()->memberMap.SetActualValue(type, key, AMT_DATA()->memberMap.FindActual(type, key)->Value() + 1))
-    #define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)                                    AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.FindActual(type, key)), AMT_DATA()->memberMap.SetActualValue(type, key, AMT_DATA()->memberMap.FindActual(type, key)->Value() - 1))
-    #define AMT_MAP_SET_VALUE(memberMap, key, value, type)                                      AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetActualValue(type, key, value))
-    #define AMT_MAP_INC_VALUE(memberMap, key, type)                                             AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type)              
-    #define AMT_MAP_DEC_VALUE(memberMap, key, type)                                             AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type)
-    #define AMT_MAP_APPEND_ACCEPT_IF(cond, memberMap, testType)                                 AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.AppendAccept(testType))
-    #define AMT_MAP_APPEND_ACCEPT(memberMap, testType)                                          AMT_MAP_APPEND_ACCEPT_IF(ETrue, memberMap, testType)
-    #define AMT_MAP_RESET_ITEMS(memberMap, defaultValue, type)                                  AMT_FUNC_EXC(AMT_DATA()->memberMap.ResetItems(type, defaultValue))
-    #define AMT_MAP_RESET(memberMap)                                                            AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset())
-    
-    #define AMT_PRINT_STATE()   AMT_FUNC_EXC(AMT_DATA()->PrintState())
+    #define AMT_MAP_PTR_TO_KEY_CAST(keyPtr)         reinterpret_cast< TInt >( keyPtr )
+
+
+    // *** Macros to define function content
+
+    #define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC() \
+            if ( iCanvasWsGc ) \
+                { \
+                AMT_MAP_SET_VALUE( \
+                        iIntMap, \
+                        AMT_MAP_CANVAS_WS_GC_TYPE, \
+                        iCanvasWsGc->Type(), \
+                        EAlfModuleTestTypeCoreToolkitGoom ); \
+                } \
+            else \
+                { \
+                AMT_MAP_SET_VALUE( \
+                        iIntMap, \
+                        AMT_MAP_CANVAS_WS_GC_TYPE, \
+                        KErrNotFound, \
+                        EAlfModuleTestTypeCoreToolkitGoom ); \
+                }
+
+    // Sets the position of the layer into the map. 
+    // Zero means the bottom and the top layer has the greates position value.
+    #define AMT_MAP_GCE_SET_LAYER_POSITIONS() \
+            TInt gceLayerPosition( -1 ); \
+            const MWsLayer* gceLayer( iBottomLayer ); \
+            while( gceLayer ) \
+                { \
+                ++gceLayerPosition; \
+                AMT_MAP_SET_VALUE( \
+                    iIntMap, AMT_MAP_PTR_TO_KEY_CAST( gceLayer ), \
+                    gceLayerPosition, EAlfModuleTestTypeGceLayerPosition ); \
+                gceLayer = gceLayer->Above(); \
+                }
 
 #endif // USE_MODULE_TEST_HOOKS_FOR_ALF
 
 
-// General defines
-// Text cursor handle is defined as constant because correct handle is not provided
-// from the window server for render stage.
-#define AMT_MAP_TEXT_CURSOR_HANDLE 0
-
-
 // Notice: 
 // Defines below will be empty if module test hook is not set.
 // If module test hook is set on, then these defines also use functionality defined above.  
 
 
+// Single operation macros, that will do lock/unlock.
+#define AMT_PRINT_STATE()                       AMT_FUNC_EXC(AMT_DATA()->PrintState())
+#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)
+
+// Conditional single operation macros, that will do lock/unlock.
+#define AMT_INC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++)
+#define AMT_DEC_COUNTER_IF(cond, member)        AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--)
+#define AMT_SET_VALUE_IF(cond, member, val)     AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val))
+#define AMT_GET_VALUE_IF(cond, x, member)       AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member)
+
+#define AMT_ADD_TIME(handle, member, effects)   AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ TInt nextFreeIndex = AMT_DATA()->iTimeMap[timemapIndex].iCounter; AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[nextFreeIndex] = member; AMT_DATA()->iTimeMap[timemapIndex].iCounter++; timemapIndex = 100; break;} timemapIndex++; } if (timemapIndex == 10) { if (AMT_DATA()->iNextFreeMap == 10) { AMT_DATA()->iNextFreeMap = 0;} TInt nextFreeMap = AMT_DATA()->iNextFreeMap; AMT_DATA()->iTimeMap[nextFreeMap].iCounter = 1; AMT_DATA()->iTimeMap[nextFreeMap].iHandle = handle; AMT_DATA()->iTimeMap[nextFreeMap].iTimeStamp[0] = member; AMT_DATA()->iTimeMap[nextFreeMap].iEffects = effects; AMT_DATA()->iNextFreeMap++; /*RDebug::Printf("Handle: %d, %d %d %d", handle, timemapIndex, AMT_DATA()->iNextFreeMap, member)*/;})
+#define AMT_GET_TIME(x, handle, index, effects) AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[index];(effects) = AMT_DATA()->iTimeMap[timemapIndex].iEffects;break;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;(effects) = EFalse;})
+#define AMT_GET_TIME_POINT_COUNT(handle, x)     AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iCounter;timemapIndex = 100;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;})
+#define AMT_RESET_TIME(handle)                  AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ AMT_DATA()->iTimeMap[timemapIndex].iHandle = 0; AMT_DATA()->iTimeMap[timemapIndex].iCounter = 0;AMT_DATA()->iTimeMap[timemapIndex].iEffects = 0;break;}timemapIndex++;})
+
+// Map operation macros, that will do lock/unlock
+#define AMT_MAP_CPTR_TO_KEY_CAST(keyCPtr)                                                   AMT_MAP_PTR_TO_KEY_CAST( static_cast< const CBase* >( keyCPtr ) )
+#define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type)                         AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.Append(type, key, defaultValue))
+#define AMT_MAP_APPEND(memberMap, key, defaultValue, type)                                  AMT_MAP_APPEND_IF(ETrue, memberMap, key, defaultValue, type)
+#define AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, targetKey, type)                   AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.AppendLink(type, linkKey, targetKey))
+#define AMT_MAP_APPEND_LINK(memberMap, linkKey, targetKey, type)                            AMT_MAP_APPEND_LINK_IF(ETrue, memberMap, linkKey, targetKey, type)
+#define AMT_MAP_APPEND_AND_LINK_IF(cond, memberMap, linkKey, actualKey, defaultValue, type) AMT_MAP_APPEND_IF(cond, memberMap, actualKey, defaultValue, type ); AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, actualKey, type)
+#define AMT_MAP_APPEND_AND_LINK(memberMap, linkKey, actualKey, defaultValue, type)          AMT_MAP_APPEND_AND_LINK_IF(ETrue, memberMap, linkKey, actualKey, defaultValue, type)
+#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)                             AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetActualValue(type, key, value))
+#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)                                    AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.FindActual(type, key)), AMT_DATA()->memberMap.SetActualValue(type, key, AMT_DATA()->memberMap.FindActual(type, key)->Value() + 1))
+#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)                                    AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.FindActual(type, key)), AMT_DATA()->memberMap.SetActualValue(type, key, AMT_DATA()->memberMap.FindActual(type, key)->Value() - 1))
+#define AMT_MAP_SET_VALUE(memberMap, key, value, type)                                      AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetActualValue(type, key, value))
+#define AMT_MAP_INC_VALUE(memberMap, key, type)                                             AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type)              
+#define AMT_MAP_DEC_VALUE(memberMap, key, type)                                             AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type)
+#define AMT_MAP_APPEND_ACCEPT_IF(cond, memberMap, testType)                                 AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.AppendAccept(testType))
+#define AMT_MAP_APPEND_ACCEPT(memberMap, testType)                                          AMT_MAP_APPEND_ACCEPT_IF(ETrue, memberMap, testType)
+#define AMT_MAP_RESET_ITEMS(memberMap, defaultValue, type)                                  AMT_FUNC_EXC(AMT_DATA()->memberMap.ResetItems(type, defaultValue))
+#define AMT_MAP_RESET(memberMap)                                                            AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset())
+
+
 // Render stage defines
 
 #define AMT_MAP_RENDER_STAGE_NODE_CREATED() \
@@ -181,7 +181,8 @@
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER() \
         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeCreateLayer ); \
         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeReleaseLayer ); \
-        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerOrdinalPosition )
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerOrdinalPosition ); \
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerNodeOrdinalPosition )
 
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \
         AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeCreateLayer ); \
@@ -190,6 +191,13 @@
         AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeReleaseLayer ); \
         AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerOrdinalPosition ); \
         AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerOrdinalPosition ); \
+        AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerNodeOrdinalPosition ); \
+        AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerNodeOrdinalPosition ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceCreateLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceReleaseLayer ); \
+        AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerPosition ); \
+        AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerOpacity ); \
+        AMT_MAP_APPEND_LINK( iRectMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerExtent ); \
         \
         AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeCreateLayer )
 
@@ -266,6 +274,40 @@
 #define AMT_MAP_BRIDGE_SET_ORDINAL_POSITION() \
         AMT_MAP_SET_VALUE_IF( windowAttributes, iIntMap, windowNodeId, windowAttributes->iOrdinalPosition, EAlfModuleTestTypeLayerOrdinalPosition )
 
+#define AMT_MAP_NODE_SET_ORDINAL_POSITION() \
+        AMT_MAP_SET_VALUE( iIntMap, iId, ordinal, EAlfModuleTestTypeLayerNodeOrdinalPosition )
+
+
+// GCE defines
+
+#define AMT_MAP_GCE_ADD_LAYER() \
+        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeGceCreateLayer ); \
+        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeGceReleaseLayer ); \
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeGceLayerPosition ); \
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeGceLayerOpacity ); \
+        AMT_MAP_APPEND_IF( aLayer, iRectMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TRect(), EAlfModuleTestTypeGceLayerExtent )
+
+#define AMT_MAP_GCE_SET_SURFACE() \
+        AMT_MAP_SET_VALUE( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), aSurface, EAlfModuleTestTypeGceCreateLayer )
+
+#define AMT_MAP_GCE_REMOVE_LAYER() \
+        AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeGceReleaseLayer )
+
+#define AMT_MAP_GCE_SET_LAYER_OPACITY() \
+        AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), Opacity(), EAlfModuleTestTypeGceLayerOpacity )
+
+#define AMT_MAP_GCE_SET_LAYER_EXTENT() \
+        AMT_MAP_SET_VALUE( iRectMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), aExtent, EAlfModuleTestTypeGceLayerExtent )
+
+
+// Goom defines
+
+#define AMT_MAP_CANVAS_TEXTURE_CACHE_SET_MEMORY_LEVEL() \
+        AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_TEXTURE_CACHE_MEMORY_LEVEL, iMemoryLevel, EAlfModuleTestTypeCoreToolkitGoom ); \
+        AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_CACHED_IMAGES_COUNT, iCachedImages.Count(), EAlfModuleTestTypeCoreToolkitGoom ); \
+        AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_CACHED_TEXTS_COUNT, iCachedTexts.Count(), EAlfModuleTestTypeCoreToolkitGoom ); \
+        AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_CACHED_RENDER_BUFFERS_COUNT, iCachedRenderBuffers.Count(), EAlfModuleTestTypeCoreToolkitGoom )
+
 
 #endif // ALF_MODULE_TEST_DEFINES_H
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestitem.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestitem.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @note This class is provided only if module test hooks are set on.
  */
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @note This class is provided only if module test hooks are set on.
  */
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @note Contents of this file are provided only if module test hooks are set on.
  */
@@ -78,15 +62,23 @@
     EAlfModuleTestTypeBridgeChangeTextCursorFlag,
     EAlfModuleTestTypeBridgeChangeTextCursorColor,
     EAlfModuleTestTypeBridgeVisualVisibility,
+    EAlfModuleTestTypeBridgeGoom,
     
     // Core toolkit component specific tests
     EAlfModuleTestTypeCoreToolkitDrawWindow,
     EAlfModuleTestTypeCoreToolkitDrawFromRenderBuffer,
+    EAlfModuleTestTypeCoreToolkitGoom,
     
     // Layer tests
     EAlfModuleTestTypeCreateLayer,
-    EAlfModuleTestTypeReleaseLayer,    
-    EAlfModuleTestTypeLayerOrdinalPosition,    
+    EAlfModuleTestTypeReleaseLayer,
+    EAlfModuleTestTypeLayerOrdinalPosition,
+    EAlfModuleTestTypeLayerNodeOrdinalPosition,
+    EAlfModuleTestTypeGceCreateLayer,
+    EAlfModuleTestTypeGceReleaseLayer,
+    EAlfModuleTestTypeGceLayerPosition,
+    EAlfModuleTestTypeGceLayerExtent,
+    EAlfModuleTestTypeGceLayerOpacity,
     
     // Do not use this value when creating item.
     // This is just meant for Find operations when all tests are accepted.
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Fri Jun 11 14:31:43 2010 +0300
@@ -66,13 +66,15 @@
                         CHuiVisual* aTemporaryPresenterVisual,
                         TBool aIsLayout, 
                         TBool aHideWhenFinished,
-                        TBool aCanDestroyOrHideImmediately) 
+                        TBool aCanDestroyOrHideImmediately,
+                        TBool aIsFullScreenEffect) 
                 : iHandle(aHandle), 
                 iEffectedVisual(aEffectedVisual),
                 iTemporaryPresenterVisual(aTemporaryPresenterVisual),
                 iIsLayout(aIsLayout),
                 iHideWhenFinished(aHideWhenFinished),
-                iCanDestroyOrHideImmediately(aCanDestroyOrHideImmediately)
+                iCanDestroyOrHideImmediately(aCanDestroyOrHideImmediately),
+                iIsFullScreenEffect(aIsFullScreenEffect)
                         {
 //                        RDebug::Printf("TEffectCleanupStruct - 0x%x 0x%x, %d", iEffectedVisual, iTemporaryPresenterVisual, iIsLayout );
                         };
@@ -84,7 +86,9 @@
                 TBool iHideWhenFinished;
                 
                 TBool iCanDestroyOrHideImmediately;
-				
+
+                TBool iIsFullScreenEffect;
+                
 				// not own, unless iEffectedVisual has EShouldDestroy flag enabled
                 CHuiVisual* iEffectedVisual;
 				// owned
@@ -279,7 +283,15 @@
      * 
      */
     void GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData);
-    
+
+    /**
+	 * UpdateSecondaryEffectL
+	 *
+	 * Resolve filename for two part effect that is used with slowly starting applications
+	 * 
+	 */
+    TBool UpdateSecondaryEffectL(const CFullScreenEffectState& aState);
+
    /*
 	*	GfxTriggerEffectWhenFullScreenDrawn
 	*
@@ -427,7 +439,7 @@
 	 *	@return	ETrue, 	if layout have been initialized succesfully for the effect
 	 			EFalse,	if any visuals have been removed. Effect should not be applied.
      */
-    TBool SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately);
+    TBool SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsFullScreenEffect, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately);
 
     /*
      *	AddEffectItemL
@@ -444,8 +456,10 @@
             CHuiControl* aEffectControl,
             TBool aInsertTemporaryVisual,
             TBool& aItemDestroyed,
+            TBool aIsFullScreenEffect,
             TBool aIsExitEffect = EFalse,
-            TBool aCanDestroyOrHideImmediately = EFalse);
+            TBool aCanDestroyOrHideImmediately = EFalse
+            );
             
 
     /*
@@ -457,6 +471,7 @@
             CHuiLayout* aTargetLayout,
             CHuiControl* aEffectControlGroup,
             TInt& aItemsDestroyed,
+            TBool aIsFullScreenEffect,
             TBool aAddLayout = ETrue,
             TBool aIsExitEffect = EFalse,
             TBool aCanDestroyOrHideImmediately = EFalse);
@@ -607,6 +622,15 @@
 
     void ShowWindowGroupControlGroupL(CHuiRoster& aRoster, CHuiControlGroup& aGroup, TInt aWhere, TInt aScreenNumber );
     
+	/**
+	 * HasActiveAlfContent
+	 *
+	 * Determine if the window group in question has active Alf visuals
+	 *
+	 *	@return 	ETrue, if active clients
+	 */
+    TBool HasActiveAlfContent( TInt aClientWgId );
+    
 private:
          
     /**
@@ -916,6 +940,8 @@
      */
     CFullScreenEffectState* iFullScreenEffectData;
     
+    CFullScreenEffectState* iSecondaryFullScreenEffectData;
+    
     /**
      * Control effect state.
      * Own.
@@ -925,10 +951,7 @@
     // these save the current full screen transition data
     // so that the correct transition can be ended from the callback
     // when the effect ends
-    TInt iLastFullScreenEffectWindowGroup;
-    TInt iLastFullScreenScreen;
-    TInt iLastAction;
-    TInt iLastEffectHandle;
+    
     CAlfEffectEndTimer* iEffectEndTimer;
     TBool iLayoutInitializedForExitEffect;
     
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Fri Jun 11 14:31:43 2010 +0300
@@ -19,6 +19,16 @@
 #include <akntranseffect.h>
 #include "alfbridge.h"
 
+enum TEffectState
+    {
+    EBeginFullScreenReceived, // first request of effect received
+    EWaitingWindowGroup,
+    EWaitEndFullScreen,
+    EEndFullScreenReceivedWaitingWindowGroup,
+    EEndFullscreenReceived,
+    ESecondPhaseSetupActive,
+    EFinalEffectActive
+    };
 // Timer to send finish full screen effect
 // ---------------------------------------------------------
 // CAlfFinishTimer
@@ -228,6 +238,8 @@
     public:
         ~CFullScreenEffectState();
         
+        void ConstructL(const CFullScreenEffectState& aEffectState);
+        
         void ConstructL(TInt aAction, RMemReadStream& aStream);
         
         // Information from BeginFullScreen
@@ -239,15 +251,32 @@
         TInt iToSecureId;
         TInt iFromSecureId;
         TRect iRect;
-        TBool iTimeoutTriggered;
+        TBool iLongAppStartTimeout;
+        TBool iTimeout;
         
-        // ETrue if waiting for window group to appear
-        TBool iWaitingWindowGroup;
+         
+        void SetState(TEffectState aState);
+       
+        TEffectState State();
+       
+      
+private:
+        TEffectState iState;
+        
+public:
         // ETrue if end fullscreen has been performed
         TBool iEndFullScreen;
         // ETrue if setup effect container has been done
         TBool iSetupDone;
-
+        // effect has fade out and fade in. The fade in part is active, when this is ETrue.
+        enum TEffectPhase
+            {
+            EOnlyOnePart = 0,
+            EFirstPartActive,
+            ESecondPartActive
+            };
+        
+        TEffectPhase iTwoPhaseEffect;
         // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application
         TInt iAppStartScreenshotItemHandle;
         
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h	Fri Jun 11 14:31:43 2010 +0300
@@ -26,27 +26,6 @@
 #include <uiacceltk/HuiTextVisual.h>
 #include "alfshareddisplaycoecontrol.h"
 
-enum TAlfControlGroupRole
-    {
-    /** Unknown */
-    EAlfUnknownContainer,
-    
-    /** Alf application control group */
-    EAlfSessionContainer,
-    
-    /** WSERV window group */
-    EAlfWindowGroupContainer,
-    
-    /** WSERV floating sprite group */
-    EAlfWindowFloatingSpriteContainer,
-
-    /** Group for showing effects */
-    EAlfFullScreenEffectContainer,
-    
-    /** Group for FPS indicator */
-    EAlfFpsIndicatorContainer
-    };
-
 NONSHARABLE_CLASS( TAlfControlGroupEntry )  
     {
 public:
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Fri Jun 11 14:31:43 2010 +0300
@@ -46,7 +46,9 @@
     EAlfGetNumberOfActiveEffects,
     EAlfRequestSignal,
     EAlfCompleteSignal,
-    EAlfSetDistractionWindow
+    EAlfSetDistractionWindow,
+    EAlfVolunteerForGoomTarget,
+    EAlfExcludeFromGoomTargets
 
     };
 
@@ -93,8 +95,14 @@
 enum TAlfSignalFlags
     {
     EAlfSignalEffectStarted = 0x1,
-    EAlfSignalEffectComplete = 0x2,    
-    
+    EAlfSignalEffectComplete = 0x2,     
     };
     
+enum TAlfWindowGroupListType
+    {    
+    EAlfInactiveWgs = 0,
+    EAlfAllWgsWithSurface,
+    EAlfVolunteersForCommonGood
+    };
+     
 #endif
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h	Fri Jun 11 14:31:43 2010 +0300
@@ -71,11 +71,13 @@
 
     void RemoveTargetFromInactiveSurfaces(TInt aTarget);
     void AddTargetFromInactiveSurfaces(TInt aTarget);
-    void GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso = ETrue);
+    void GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TInt aActiveAlso = ETrue);
     void QueueRequestBGAnimSessionsL(const TPtrC8& aPtr, TInt aOp);
 
     void AddSignal(CAlfStreamerServerSession* aSession, const RMessage2& aMessage);
     void CompleteSignal(TInt aSignal, TInt aType);
+    void FormAQueueL(TInt aOp, TInt aSecureId, TInt aWindowGroupId);
+
     
 private:
     void ConstructL();
@@ -145,13 +147,14 @@
     struct TAlfCompParams
         {
         TInt iTarget; 
-        TInt iTarget2;  // padding actually
+        TInt iSecureId; // used with optional GRAM list
         TInt iWindowHandle;
         TInt iWindowGroup;
         }; 
 
     RArray<TAlfCompParams> iAlfTargets;
     RArray<TAlfCompParams> iInactiveSurfaces;
+    RArray<TAlfCompParams> iOptionalGRAM;
     };
 
 NONSHARABLE_CLASS(CAlfStreamerServerSession): public CSession2
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -1058,6 +1058,18 @@
     return iObjectConIx->CreateL();
     }
 
+// ---------------------------------------------------------------------------
+// Releases container back to server.
+// ---------------------------------------------------------------------------
+// 
+void CAlfAppServer::ReleaseContainer(CObjectCon& aContainer)
+    {
+    if ( iObjectConIx )
+        {
+        iObjectConIx->Remove(&aContainer);
+        }
+    }
+
 // ======== RnD FUNCTIONS ========
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -36,6 +36,8 @@
 #include "alf/alfextensionfactory.h"
 #include "alf/alfversion.h"
 #include "alfsrvsettingshandler.h"
+#include "alfstreamerconsts.h"
+#include "alfdecoderserverclient.h"
 
 const TUint KAlfMaxCpuUsageDuringPointerEvent = 35; // Percentage
 
@@ -106,6 +108,7 @@
     RMessagePtr2 iSystemEvent;
     TInt iParentId;
     TBool iActive;
+    TUint iSecureId;
     }; 
 
 // ======== MEMBER FUNCTIONS ========
@@ -129,11 +132,17 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C CAlfAppSrvSessionBase::~CAlfAppSrvSessionBase()
-    { 
+    {
+        
     iHost->HandleClientExit(reinterpret_cast<TInt>(this));
     
     if ( iData )
         {
+        if (AlfAppUi()->BridgerClient())
+            {
+            AlfAppUi()->BridgerClient()->SendBlind(EAlfExcludeFromGoomTargets, TIpcArgs(iData->iSecureId,iData->iClientWindowGroupId));
+            }
+            
         iData->iHandles.Close();
         delete iData->iObjectIx;
     
@@ -154,6 +163,11 @@
             {
             iData->iSystemEvent.Complete(KErrCancel);
             }
+        
+        if ( iData->iContainer )
+            {
+            iHost->ReleaseContainer( *iData->iContainer );
+            }
         delete iData;
         }
     iHost = NULL;
@@ -203,6 +217,7 @@
 //
 EXPORT_C void CAlfAppSrvSessionBase::ServiceL(const RMessage2& aMessage)
     {
+    iData->iSecureId = aMessage.SecureId(); // one time would be enough    
     if(iHost->MetricsInterface())
         {
         iHost->MetricsInterface()->EnterClientMessageL(reinterpret_cast<TInt>(this), aMessage);
@@ -391,6 +406,10 @@
     {
     __ASSERT_DEBUG(iData, USER_INVARIANT());
     iData->iClientWindowGroupId = aId;
+    if (AlfAppUi()->BridgerClient())
+        {
+        AlfAppUi()->BridgerClient()->SendBlind(EAlfVolunteerForGoomTarget, TIpcArgs(iData->iSecureId, iData->iClientWindowGroupId));
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -944,20 +944,29 @@
 
 void CAlfAppUi::UpdateActiveSession(CAlfAppSrvSessionBase* aSession)
     {
-    EndPointerEventHandling();
-    iData->iActiveSession = aSession;
+    if( iData->iActiveSession  != aSession )
+        {
+        EndPointerEventHandling();
+        iData->iActiveSession = aSession;
+        
+        iData->iResourceManager->SetActiveSession( iData->iActiveSession );
     
-    iData->iResourceManager->SetActiveSession( iData->iActiveSession );
-
-    if(!aSession)
-        {
-        if (iData->iMainDisplay) // TBD: multiple display support once again...
+        if(!aSession)
             {
-            TRAP_IGNORE(iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone));
+            if (iData->iMainDisplay) // TBD: multiple display support once again...
+                {
+                TRAP_IGNORE(iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone));
+                }
             }
+        iData->iBridgeObj->HandleVisualVisibility( 0 );
         }
     }
     
+CAlfAppSrvSessionBase* CAlfAppUi::ActiveSession()
+    {
+    return iData->iActiveSession;
+    }
+
 // ---------------------------------------------------------------------------
 // From class CAknAppUi.
 // Handles window server event.
@@ -1398,4 +1407,13 @@
     // let the session complete message  
     }
 
+RAlfBridgerClient* CAlfAppUi::BridgerClient()
+    {
+    if (iData)
+        {
+        return iData->iBridgeObj->BridgerClient();  
+        }    
+    return 0;
+    }
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -171,6 +171,7 @@
     iDeadControlGroups.Close();
     iEffectWindowGroups.Close();
     delete iFullScreenEffectData;
+    delete iSecondaryFullScreenEffectData;
 
     if (iActivated)
         {
@@ -674,6 +675,13 @@
                 if (anyVisualHasEffect)
                     {
                     TInt activeEffectHandle = iEffectCleanupStack[activeEffectIndex].iHandle;
+                    if (iSecondaryFullScreenEffectData && iSecondaryFullScreenEffectData->iHandle == activeEffectHandle)
+                        {
+                        __ALFFXLOGSTRING1("CAlfBridge::DeleteControlGroupL - WARNING! Control group with 2 phase effect is being destroyed. Canceling second phase for handle %d", activeEffectHandle);
+                        delete iSecondaryFullScreenEffectData;
+                        iSecondaryFullScreenEffectData = NULL;
+                        }
+                    
                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
                     layout->SetFlags(EHuiVisualFlagShouldDestroy);
@@ -702,7 +710,7 @@
                        if (!HasActiveEffect(familyTree[familyIndex]))
                            {
                            TInt dummy;
-                           AddEffectItemL(activeEffectHandle, familyTree[familyIndex], NULL, NULL, EFalse, dummy, EFalse);
+                           AddEffectItemL(activeEffectHandle, familyTree[familyIndex], NULL, NULL, EFalse, dummy, ETrue, EFalse);
                            }
                        }
                     }
@@ -773,7 +781,7 @@
         cntrl->ConstructL();
         group->AppendL(cntrl);
         CleanupStack::Pop(cntrl);
-        cntrl->SetRole(EAlfWindowGroupContainer);
+        cntrl->SetRole(EHuiWindowGroupContainer);
 
         layout = CHuiCanvasVisual::AddNewL(*cntrl);
         layout->SetTagL(KAlfWindowGroupContainerControlTag);
@@ -798,10 +806,14 @@
         entry.iSecureId = aSecureId;
         // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group.
         if (iFullScreenEffectData
-                && iFullScreenEffectData->iWaitingWindowGroup
+                && (iFullScreenEffectData->State() == EWaitingWindowGroup || iFullScreenEffectData->State() == EEndFullScreenReceivedWaitingWindowGroup)
                 && iFullScreenEffectData->iToSecureId == aSecureId)
             {
             iFullScreenEffectData->iToWg = aClientWindowGroupId;
+            if (iSecondaryFullScreenEffectData)
+                {
+                iSecondaryFullScreenEffectData->iToWg = aClientWindowGroupId;
+                }
             CHuiControlGroup* fromGroup = NULL;
             CHuiLayout* fromLayout = NULL; 
             fromGroup = FindControlGroupByFullScreenFromEffect();
@@ -815,10 +827,16 @@
             // First HandleGfxEvent, then clear iWaitingWindowGroup.
             __ALFFXLOGSTRING1("CAlfBridge::CreateControlGroupL - try triggering effect 0x%x", layout);
             TBool failed = HandleGfxEventL( *iFullScreenEffectData, layout, fromLayout );
-            if ( iFullScreenEffectData )
-                {
-                iFullScreenEffectData->iWaitingWindowGroup = EFalse;
+            if ( iFullScreenEffectData->State() == EWaitingWindowGroup)
+                {
+                iFullScreenEffectData->SetState(EWaitEndFullScreen);
                 }
+            else
+                {  
+				// was CFullScreenEffectState::EEndFullScreenReceivedWaitingWindowGroup           
+                iFullScreenEffectData->SetState(EEndFullscreenReceived);
+                }
+            
             if ( failed )
                 {
                 // Effect failed, reset state
@@ -827,7 +845,7 @@
                 }
             }     
         entry.iScreenNumber = aScreenNumber;
-//        entry.iRole = EAlfWindowGroupContainer;
+//        entry.iRole = EHuiWindowGroupContainer;
 
         iAlfScreens[aScreenNumber]->iControlGroups.Append(entry);
         CleanupStack::Pop(group);                
@@ -872,7 +890,7 @@
 // disappear.
     if ( aGroup.Control(0).Visual(0).Effect() )
         {
-        if ( aGroup.Control(0).Role() != EAlfWindowGroupContainer )
+        if ( aGroup.Control(0).Role() != EHuiWindowGroupContainer )
             {
             // The case where the application control group is deleted by window server
             // has been solved by deleting the tag when window server wants to delete
@@ -882,13 +900,13 @@
             }
         }
 
-    if (aGroup.Control(0).Role() == EAlfWindowGroupContainer)      
+    if (aGroup.Control(0).Role() == EHuiWindowGroupContainer)      
         {
         // Window group control groups
         ShowWindowGroupControlGroupL(aRoster, aGroup, aWhere, aScreenNumber);
         aGroup.SetAcceptInput(EFalse);
         }
-    else if (aGroup.Control(0).Role() == EAlfSessionContainer)      
+    else if (aGroup.Control(0).Role() == EHuiSessionContainer)      
         {
         // ALF application control groups    
         ShowSessionContainerControlGroupL(aRoster, aGroup, aWhere, aScreenNumber);
@@ -976,7 +994,7 @@
                 move = ETrue;
                 }
             
-            if (aRoster.ControlGroup(i).Control(0).Role() == EAlfSessionContainer)
+            if (aRoster.ControlGroup(i).Control(0).Role() == EHuiSessionContainer)
                 {
                 index++;                                                
                 }                    
@@ -1050,7 +1068,7 @@
                 break;
                 }
 
-            if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer &&
+            if (aRoster.ControlGroup(i).Control(0).Role() == EHuiWindowGroupContainer &&
                 &aRoster.ControlGroup(i) != &aGroup)
                 {
                 index++;                                                
@@ -1063,7 +1081,7 @@
             // Topmost
             for (TInt i=aRoster.Count() - screen->FixedControlGroupCount(); i >= 0; i--)
                 {
-                if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer)
+                if (aRoster.ControlGroup(i).Control(0).Role() == EHuiWindowGroupContainer)
                     {
                     // increasing the count, assuming that WindowControlGroup is not in the Roster
                     i++;
@@ -1081,7 +1099,7 @@
 // 
 void CAlfBridge::SetAlfWindowGroupId(TInt aAlfWindowGroupId)
     {
-    iAlfWindowGroupId = aAlfWindowGroupId;        
+    iAlfWindowGroupId = aAlfWindowGroupId;
     // check if hithcock window group was already there
     TInt secureId = RThread().SecureId(); 
     if (iAlfScreens.Count())
@@ -1092,6 +1110,11 @@
                  iAlfScreens[0]->iControlGroups[i].iClientWindowGroupId != CHuiStatic::RootWin(0)->Identifier())
                 {
                 iAlfWindowGroupNodeId = iAlfScreens[0]->iControlGroups[i].iWindowGroupNodeId;
+                
+                CHuiControlGroup* controlGroup = FindControlGroup(iAlfWindowGroupNodeId, 0);
+                CHuiControl& control = controlGroup->Control(0);
+                CHuiVisual* layout = &control.Visual(0);
+                iAlfScreens[0]->iDisplay->Roster().SetAlfEventWindow(layout);
                 return;
                 }
             }        
@@ -1126,7 +1149,7 @@
         for (TInt j=0; j<roster.Count();j++)
             {
             CHuiControlGroup& controlGroup = roster.ControlGroup(j);
-            if (controlGroup.Control(0).Role() == EAlfSessionContainer)
+            if (controlGroup.Control(0).Role() == EHuiSessionContainer)
                 {
                 controlGroupOrder.Append(&controlGroup);
                 roster.Hide(controlGroup);
@@ -1154,7 +1177,7 @@
         CHuiRoster& roster = iAlfScreens[aScreenNumber]->iDisplay->Roster();
         for (TInt j=0; j<roster.Count();j++)
             {
-            if( roster.ControlGroup(j).Control(0).Role() == EAlfSessionContainer 
+            if( roster.ControlGroup(j).Control(0).Role() == EHuiSessionContainer 
                 || roster.ControlGroup(j).ResourceId() == iAlfWindowGroupNodeId )
                 {
                 return j; // Alf groups positioned just above alf servers window group   
@@ -1281,7 +1304,12 @@
         {
         return EFalse;
         }
-    if ( aVisual.Layout() && IsNonFadeEffect( aVisual.Layout()->Effect() ) )
+    
+    // Note: The long startup effect uses opaque effect to hide the background. 
+    if ( aVisual.Layout() 
+            && (IsNonFadeEffect( aVisual.Layout()->Effect() ) 
+			&& !IsOpaqueEffect(aVisual.Layout()->Effect() ))
+            )
         {
         return EFalse;
         }
@@ -1438,7 +1466,7 @@
         CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j);
         CHuiControl& control = controlgroup.Control(0);
 
-        if (control.Role() == EAlfFpsIndicatorContainer)
+        if (control.Role() == EHuiFpsIndicatorContainer)
             {
             // FPS container doesn't contain canvas visuals
             continue;
@@ -1465,11 +1493,18 @@
         
         
         // Dont mess with alf control group visuals, alf session handling does it for us
-        if (control.Role() == EAlfSessionContainer)
+        if (control.Role() == EHuiSessionContainer)
             {
             CHuiLayout* hostContainer = control.ContainerLayout( NULL );
-            TInt flags = hostContainer->Flags();            
-            if (!fullscreenCovered || alfClientWindowGroupVisible)
+            TInt flags = hostContainer->Flags();   
+            CAlfAppSrvSessionBase* activeSession = NULL;
+            if (iAppUi)
+                {
+                activeSession = iAppUi->ActiveSession();
+                }
+            // !fullscreenCovered need to be checked because for fullscreen
+            // alf applications alf event window group could be on top of alf client windowgroup
+            if ( (alfClientWindowGroupVisible || !fullscreenCovered)  && activeSession)
                 {
                 // clear inactive flag if client has not made this controlgroup hidden
                 if(!(flags&EHuiVisualFlagUnderOpaqueHint))
@@ -1616,14 +1651,16 @@
             }
         
         TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive);        
-        if (isLayoutActive && !hasActiveVisualsInVisualTree)
+        
+        if (isLayoutActive && !hasActiveVisualsInVisualTree && !IsOpaqueEffect(layout->Effect()))
             {
             // Setting also the root visual (layout) as inactive, if it had none
-						// active children. This is because otherwise the Inactive checks won't
-						// work correctly within RosterImpl ScanDirty & ClearChanged phases.
+			// active children. This is because otherwise the Inactive checks won't
+			// work correctly within RosterImpl ScanDirty & ClearChanged phases.
+			// If root visual is having an opaque effect, it must remain active
             layout->SetFlag(EHuiVisualFlagInactive);
             }
-        else if(!isLayoutActive && hasActiveVisualsInVisualTree)
+        else if(!isLayoutActive && (hasActiveVisualsInVisualTree || IsOpaqueEffect(layout->Effect())))
             {
             layout->ClearFlag(EHuiVisualFlagInactive);
             layout->SetPos(fullscreen.iTl);
@@ -1697,9 +1734,11 @@
             iHomeScreenPSValue = value;
             }
         }
-
-	screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible | alfClientWindowGroupVisible );
-
+    if ( iSwRenderingEnabled )
+        {
+        screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible | alfClientWindowGroupVisible );
+        }
+   
     // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not
     // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others
     // would clear the screen areas where they do not really draw.
@@ -1722,11 +1761,7 @@
                 
                 if ((controlgroup.ResourceId() == iAlfWindowGroupNodeId))
                     {
-                    // Special handling for ALF fading...fading happens via empty alf originated event window group
-                    TInt flags = layout->Effect()->EffectFlags();
-                    flags |= KHuiFxEnableBackgroundInAllLayers; // This forces effect to happen to background pixels that are read from surface. 
-                    flags |= KHuiFxFrozenBackground; // To get optimal UI performance, we ignore changes in ALF scene when it is faded.
-                    layout->Effect()->SetEffectFlags(flags);                            
+					// no special actions needed currently for alf content.
                     }                
                 firstFadedWindowGroupFound = ETrue;
                 }
@@ -1970,8 +2005,8 @@
         // Sprites and effects as we consider them always as transparent and also
         // if controlgroup is transformed somehow    
         
-        if (aControl.Role() == EAlfFullScreenEffectContainer 
-            || aControl.Role() == EAlfWindowFloatingSpriteContainer ||
+        if (aControl.Role() == EHuiFullScreenEffectContainer 
+            || aControl.Role() == EHuiWindowFloatingSpriteContainer ||
             aControlGroup.IsTransformed())
             {
             visualIsOpaque = EFalse;    
@@ -2171,8 +2206,8 @@
         CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j);
         CHuiControl& control = controlgroup.Control(0);
 
-        if ( control.Role() == EAlfSessionContainer ||
-             control.Role() == EAlfFpsIndicatorContainer )
+        if ( control.Role() == EHuiSessionContainer ||
+             control.Role() == EHuiFpsIndicatorContainer )
             {
             continue;
             }
@@ -3138,7 +3173,7 @@
 			TInt wsWindowGroupCount = 0;
 			for (TInt i=0; i<iAlfScreens[screenNumber]->iDisplay->Roster().Count();i++)
 				{
-                if (iAlfScreens[screenNumber]->iDisplay->Roster().ControlGroup(i).Control(0).Role()==EAlfWindowGroupContainer)
+                if (iAlfScreens[screenNumber]->iDisplay->Roster().ControlGroup(i).Control(0).Role()==EHuiWindowGroupContainer)
 					{
 					wsWindowGroupCount++;    
 					}
@@ -3327,9 +3362,11 @@
 		__ALFLOGSTRING3("CAlfBridge::HandlePostCanvasBufferL, EAlfDSPostCanvasBuffer: Visual not found! Screen: %d, Id: %d, GroupId: %d ", screenNumber, windowNodeId, windowGroupNodeId );                                 
 		}    
 #ifdef	USE_APPLICATION_ENDFULLSCREEN_TIMEOUT	
-	    if (iFullScreenEffectData 
+	    if (iFullScreenEffectData
+	            && !iSecondaryFullScreenEffectData
 	            && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect 
-	            && !iFullScreenEffectData->iEndFullScreen)
+	            && iFullScreenEffectData->State() == EWaitEndFullScreen
+	            && iFullScreenEffectData->iTwoPhaseEffect != CFullScreenEffectState::ESecondPartActive)
 	        {
 	        CHuiControlGroup *to_group = NULL;
             if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect)
@@ -3360,7 +3397,7 @@
 // 
 void CAlfBridge::GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData)
     {
-    if (aFullScreenEffectData->iEndFullScreen)
+    if (iFullScreenEffectData->State() == EFinalEffectActive)
         {
         return;
         }
@@ -3389,9 +3426,9 @@
         // from layout may be undefined
         __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEndFullScreenTimeout : Enough app drawing. Trigger EndFullScreen for layout 0x%x", to_layout);    
         HandleGfxEventL( *aFullScreenEffectData, to_layout, from_layout );
-        }
-
-    aFullScreenEffectData->iEndFullScreen = ETrue;
+        aFullScreenEffectData->SetState(EFinalEffectActive);
+        }
+
     iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
     }
 
@@ -4123,7 +4160,7 @@
         CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j);
         CHuiControl& control = controlgroup.Control(0);
 
-        if( control.Role() == EAlfWindowGroupContainer)
+        if( control.Role() == EHuiWindowGroupContainer)
             {
             // Only update layout which are made to correspond window groups. 
             // Layouts that fullscreen effects are applied to
@@ -4525,8 +4562,9 @@
 
 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout)
     {
-    __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x", aEvent.iToSecureId, aEvent.iFromSecureId);
+    __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x, effect %S", aEvent.iToSecureId, aEvent.iFromSecureId, aEvent.iEffectName);
     __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction);
+    
     TInt err = KErrNone;
     TBool failed = EFalse;
     
@@ -4559,7 +4597,7 @@
 					if (!HasActiveEffect(aToLayout, dummy))
 						{
 						__ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Add layout 0x%x with handle %d to cleanupstack", aToLayout, aEvent.iHandle);
-                    	AddEffectItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, EFalse);
+                    	AddEffectItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, ETrue, EFalse);
 						}
                     }
 				// Screenshot was requested, but it could not be taken. Lets cancel the effect.	
@@ -4581,6 +4619,11 @@
                         aToLayout->iOpacity.Set(0.0f);    // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground
                         FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle);
                         aEvent.iEffectType = CFullScreenEffectState::EStartEffect;
+                        if (iSecondaryFullScreenEffectData)
+                            {
+                            iSecondaryFullScreenEffectData->iEffectType = CFullScreenEffectState::EStartEffect; 
+                            }
+                                
                         aEvent.iCanDestroyOrHideImmediately = ETrue; // enable hiding of windows during application start/activate effects
                         break;
                         }
@@ -4606,7 +4649,9 @@
                         if (!(aToLayout->Flags() & EHuiVisualFlagInactive)) 
                             {
                             TInt index;
-                            if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound)
+                            if (aToLayout->StoredRenderBuffer() 
+                                    && HasActiveEffect(aToLayout, index) 
+                                    && index != KErrNotFound)
                                 {
 	                            // a screenshot has been saved into the layout, and the layout was added to cleanupstack
     	                        // for cleaning. SetupEffectLayoutContainerL will add the same layout 
@@ -4616,7 +4661,7 @@
                                 }
                             // this will tag the visual, that they cannot be hidden by HandleVisualVisibility
                             // Initialize layout for the exit effect  
-                            iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately);
+                            iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, ETrue, aEvent.iCanDestroyOrHideImmediately);
                             __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect);
                             aEvent.iSetupDone = iLayoutInitializedForExitEffect; 
                             }
@@ -4624,7 +4669,11 @@
                             {
                             iLayoutInitializedForExitEffect = EFalse;
                             aEvent.iSetupDone = EFalse;
-							failed = ETrue;
+                            failed = ETrue;
+                            }
+                        if (iSecondaryFullScreenEffectData)
+                            {
+                            iSecondaryFullScreenEffectData->iSetupDone = aEvent.iSetupDone;
                             }
                          return failed;
                          }
@@ -4645,6 +4694,17 @@
                         
                     if (aToLayout)
                         {
+                        // if this was timeout appstart effect, we need to take screenshot at this point. 
+                        // It was not taken in the beginfullscreen
+                        
+                        if (aEvent.iLongAppStartTimeout)
+                            {
+                            __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL  - taking screenshot for the timeout appstart effect. Handle: %d",  aEvent.iHandle );
+                            aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
+                            TBool neededStoredBuffers(EFalse); // dummy 
+                            StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers);
+                            }
+                        
                         aToLayout->iOpacity.Set(1.0f);
                         __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - loading effect, handle %d", aEvent.iHandle );
                         if (aEvent.iAction == AknTransEffect::EApplicationExit)
@@ -4658,7 +4718,11 @@
                             // add visuals to visual cleanupstack
                             aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse);
                             TInt index;
-                            if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound)
+                            if (aToLayout->StoredRenderBuffer() 
+                                    && HasActiveEffect(aToLayout, index) 
+                                    && index != KErrNotFound
+                                    && aEvent.iTwoPhaseEffect != CFullScreenEffectState::ESecondPartActive // effects second phase
+                                    )
                                 {
 	                            // a screenshot has been saved into the layout, and the layout was added to cleanupstack
     	                        // for cleaning. SetupEffectLayoutContainerL will add the same layout 
@@ -4666,7 +4730,16 @@
                                 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout);
                                 iEffectCleanupStack.Remove(index);
                                 }
-                            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately);
+                            if (aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive || aEvent.iSetupDone)
+                                {
+                                // two phase effect, setup has been made with the first part of the effect. 
+                                // Only changing the effect is required.
+                                layoutEffectable = ETrue; 
+                                }
+                            else
+                                {
+                                layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately);
+                                }
                             aEvent.iSetupDone = layoutEffectable; 
                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
                             }
@@ -4680,12 +4753,16 @@
                                 engine->AddEffectToGroup(activeEffectGroup);
                                 }
                             __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Active effect group: %d", activeEffectGroup);
-                            effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; 
-                            if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName))
+                            effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn;
+                            if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName) ||
+                                    aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive)
                                 {
-                                // Performance improvement, but this would be better to be a special hint param in the fxml
                                 effectFlags |= KHuiFxOpaqueHint;
                                 }
+                            if (iSecondaryFullScreenEffectData)
+                                {
+                                iSecondaryFullScreenEffectData->iSetupDone = ETrue;
+                                }
                             
                             if (aEvent.iRect != TRect())
                                 {
@@ -4721,7 +4798,8 @@
                 }
             }
         }
-    iLastAction = aEvent.iAction; // TODO: useless?
+    
+    iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
     return failed;
     }
 
@@ -4736,7 +4814,7 @@
             // Freeze only, if buffer was reserved succesfully 
             aLayout->SetFreezeState(ETrue);
         	TBool itemsDestroyed;
-    	    AddEffectItemL(aHandle, aLayout, NULL, NULL, EFalse, itemsDestroyed, EFalse);
+    	    AddEffectItemL(aHandle, aLayout, NULL, NULL, EFalse, itemsDestroyed, ETrue, EFalse);
 	        iFullScreenEffectData->iAppStartScreenshotItemHandle = aHandle;
 			}
         }
@@ -4784,6 +4862,8 @@
         }
     
     CleanupStack::PopAndDestroy( fxData );
+    delete iSecondaryFullScreenEffectData;
+    iSecondaryFullScreenEffectData = NULL;
     __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END");
     }
 
@@ -4889,6 +4969,8 @@
                 }
 
                delete iFullScreenEffectData;
+               delete iSecondaryFullScreenEffectData;
+               iSecondaryFullScreenEffectData = NULL;
             iFullScreenEffectData = fxData;
             iFullScreenEffectData->iAppStartScreenshotItemHandle = fxData->iHandle;
             
@@ -4904,6 +4986,14 @@
             
             // Client expects completion to be signalled with this handle.
             iFullScreenEffectData->iCompletionHandle = stream.ReadInt32L();
+            if (iSecondaryFullScreenEffectData)
+                {
+                // Two phase effect path has been chosen. First part is now ongoing, and second part will be 
+                // triggered after that. Client has now notified, that its screen is ready. We may trigger the 
+                // second effect as soon as the first part finishes.
+                __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Trigger second part. when 1st part done.");
+                iSecondaryFullScreenEffectData->iCompletionHandle = iFullScreenEffectData->iCompletionHandle;
+                }
             
             stream.Release();           
             return ; 
@@ -4914,42 +5004,88 @@
         // End fullscreen signal received. We proceed only if there is really
         // effect ongoing and "end fullscreen" hasn't already been processed.
         
-        if ( !iFullScreenEffectData || iFullScreenEffectData->iEndFullScreen )
-            {
-            __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END: fx ready");
+        if ( !iFullScreenEffectData 
+                || iFullScreenEffectData->State() == EFinalEffectActive
+                || iFullScreenEffectData->State() == EEndFullscreenReceived)
+            {
+            if (iFullScreenEffectData)
+            __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEffectsL - END: fx ready, state %d ", iFullScreenEffectData->State());
+            stream.Release();
             return;
             }
-			// Load the whole structure. If timeout was triggered then request effect name
-			// is updated.
-            CFullScreenEffectState* fxData = new (ELeave) CFullScreenEffectState;
-            CleanupStack::PushL( fxData );
-            fxData->ConstructL( action, stream );
-            iFullScreenEffectData->iTimeoutTriggered = fxData->iTimeoutTriggered;    
-            if (fxData->iTimeoutTriggered)
-                {
-                delete iFullScreenEffectData->iEffectName;
-                iFullScreenEffectData->iEffectName = NULL;
-                iFullScreenEffectData->iEffectName = fxData->iEffectName->AllocL();
+        CFullScreenEffectState* fxData = new (ELeave) CFullScreenEffectState;
+        CleanupStack::PushL( fxData );
+        fxData->ConstructL( KErrUnknown, stream );
+        
+        TBool timeout = fxData->iTimeout;
+        // could the application be ready?
+        CHuiControlGroup* applicationExists = FindControlGroupByFullScreenToEffect();
                 
+        TBool longAppStartTimeout = fxData->iLongAppStartTimeout; 
+        
+        if (iFullScreenEffectData &&
+                !iSecondaryFullScreenEffectData && // second part has not been requested yet
+                longAppStartTimeout && // this is indeed timeout for app start effect
+                iFullScreenEffectData->iTwoPhaseEffect == CFullScreenEffectState::EOnlyOnePart && // second part has not been activated. note, that iSecondaryFullScreenEffectData would be NULL in this case 
+                (iFullScreenEffectData->State() == EWaitEndFullScreen 
+                 || iFullScreenEffectData->State() == EWaitingWindowGroup))
+            {
+            // Load the whole structure. If timeout was triggered then request effect name to be
+            // updated.
+            UpdateSecondaryEffectL(*fxData);
+            iFullScreenEffectData->iLongAppStartTimeout = fxData->iLongAppStartTimeout;
+            iFullScreenEffectData->iTwoPhaseEffect = CFullScreenEffectState::EFirstPartActive;
+            iFullScreenEffectData->iOperation = MAlfGfxEffectPlugin::EEndFullscreen;
+            }
+
+        __ALFFXLOGSTRING4("HandleGfxEffectsL - iTwoPhaseEffect %d, Setup done: %d, Timeout: %d, long app start timeout: %d", iFullScreenEffectData->iTwoPhaseEffect,iFullScreenEffectData->iSetupDone, timeout,longAppStartTimeout);
+        if (!fxData->iLongAppStartTimeout) // endfullscreen originating from the application
+            {
+            if (iFullScreenEffectData->State() == EWaitingWindowGroup)
+                {
+                iFullScreenEffectData->SetState(EEndFullScreenReceivedWaitingWindowGroup);
                 }
-            CleanupStack::PopAndDestroy( fxData );
-            fxData = NULL;
+            else
+                {
+                iFullScreenEffectData->SetState(EEndFullscreenReceived);
+                }
+            
+            if (iSecondaryFullScreenEffectData)
+                {
+                iSecondaryFullScreenEffectData->SetState(EEndFullscreenReceived);
+                }
+            
+            }
+        CleanupStack::PopAndDestroy( fxData );
+        fxData = NULL;
         
-        __ALFFXLOGSTRING("HandleGfxEffectsL - process end");
-        iFullScreenEffectData->iEndFullScreen = ETrue;
-
-#ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT		
-        if (iFullScreenEffectData->iDrawingCompleteTimer)
-            {
-            iFullScreenEffectData->iDrawingCompleteTimer->Cancel();
-            }
-#endif			
-        stream.Release();
+        __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEffectsL - Regular timeout: %d, Slow start timeout: %d, Effect setup: %d, State: %d",
+                timeout,
+                longAppStartTimeout,
+                iFullScreenEffectData->iSetupDone,
+                iFullScreenEffectData->State());
+
+        stream.Release();// We should respect normal timeouts.
+        if (iFullScreenEffectData->iTwoPhaseEffect > CFullScreenEffectState::EOnlyOnePart
+                && iFullScreenEffectData->iSetupDone && timeout && longAppStartTimeout) // timeout = endfullscreen was requested or it was normal endfullscreen timeout, longAppStartTime = 
+            {
+            // If this is two phased effect, it can be started only by application request of endfullscreen (!timeout)
+            // or screen drawn (triggered from 
+            __ALFFXLOGSTRING("HandleGfxEffectsL - Two phase effect. Waiting second part to start. Skip this event.");
+            return;
+            }
+        
+        // If client triggered EndFullScreen has been received, and still we haven't seen sign of the application, we know
+        // things have gone wrong and will not go right. Clean up the mess.
+        if (iFullScreenEffectData->State() == EEndFullscreenReceived && !applicationExists && !timeout)
+            {
+            HandleGfxStopEvent(ETrue);
+            return;
+            }
         }
 
     CFullScreenEffectState* fxData = iFullScreenEffectData;
     fxData->iOperation = operation;
-    fxData->iWaitingWindowGroup = EFalse;
 
     __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType);
     __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg);
@@ -4984,11 +5120,16 @@
         if (toLayout)
             {
             failed = HandleGfxEventL(*fxData, toLayout, fromLayout);
+            // We found layout, and this was beginfullscreen event. Wait for endfullscreen to be triggered
+            if (fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen)
+                {
+                iFullScreenEffectData->SetState(EWaitEndFullScreen);
+                }
             }
         else
             {
             __ALFFXLOGSTRING("HandleGfxEffectsL - waiting window group");            
-            fxData->iWaitingWindowGroup = ETrue;
+            fxData->SetState(EWaitingWindowGroup);
             }
         }
 
@@ -5020,13 +5161,33 @@
     __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END");
     }
 
+TBool CAlfBridge::UpdateSecondaryEffectL(const CFullScreenEffectState& aState)
+    {
+    
+    __ALFFXLOGSTRING1("CAlfBridge::UpdateSecondaryEffectL - appstart timeout triggered: %d", aState.iLongAppStartTimeout);
+    if (aState.iLongAppStartTimeout) // only application start effects can trigger this timeout 
+        {
+        // clone the primary startup effect for later usage
+        delete iSecondaryFullScreenEffectData;
+        iSecondaryFullScreenEffectData = new (ELeave) CFullScreenEffectState;
+        iSecondaryFullScreenEffectData->ConstructL(*iFullScreenEffectData);
+        iSecondaryFullScreenEffectData->iLongAppStartTimeout = EFalse;
+        
+        delete iFullScreenEffectData->iEffectName;
+        iFullScreenEffectData->iEffectName = NULL;
+        iFullScreenEffectData->iEffectName = aState.iEffectName->AllocL();
+        }
+    __ALFFXLOGSTRING("CAlfBridge::UpdateSecondaryEffectL <<" );
+    return EFalse;
+    }    
+
 TBool CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup)
     {
     if (!aToGroup || (aToGroup && aToGroup->Count() == 0))
         {
         return EFalse;
         }
-      iTempRegion.Clear();
+    iTempRegion.Clear();
     
     CAlfScreen* screen = iAlfScreens[0];
     TRect fullscreen = TRect(TPoint(0,0), screen->Size());
@@ -5043,6 +5204,16 @@
     TBool opaque = ETrue; // in app start case the layout is propably not opaque. Fake it.
     IsFullScreenDrawnRecursive(toLayout, *aToGroup, control, fullscreenCovered, fullscreen, screen, dummy, opaque, iAlfScreens[0]->iDisplay->Orientation());
     fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion);
+    // alf content check is relavant only for alf apps
+    if (!fullscreenCovered && aToGroup->iAlfApp) 
+        {
+        TInt clientGroupId = FindClientWindowGroupId(0, *aToGroup);
+        if (clientGroupId != KErrNotFound)
+            {
+            fullscreenCovered = HasActiveAlfContent(clientGroupId);
+            }
+        }
+    
     __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Covered: %d", fullscreenCovered);
     if (fullscreenCovered)
         {
@@ -5196,8 +5367,10 @@
         CHuiControl* aEffectControl, 
         TBool aInsertTemporaryVisual,
         TInt& aItemDestroyed,
+        TBool aIsFullScreenEffect,
         TBool aIsExitEffect,
-        TBool aCanDestroyOrHideImmediately)
+        TBool aCanDestroyOrHideImmediately 
+        )
     {
     CHuiCanvasVisual* temporaryPresenterVisual = NULL;
     TInt enableEffect = ETrue;
@@ -5247,7 +5420,8 @@
                     temporaryPresenterVisual,
                     ETrue,
                     aIsExitEffect,
-                    aCanDestroyOrHideImmediately);
+                    aCanDestroyOrHideImmediately,
+                    aIsFullScreenEffect);
             iEffectCleanupStack.AppendL(item);
             }
         else
@@ -5257,7 +5431,8 @@
             TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle,
                         aSourceVisual, NULL, EFalse,
                         aIsExitEffect,
-                        aCanDestroyOrHideImmediately);
+                        aCanDestroyOrHideImmediately,
+                        aIsFullScreenEffect);
             iEffectCleanupStack.AppendL(item);
             }
      }
@@ -5270,6 +5445,7 @@
         CHuiLayout* aTargetLayout, 
         CHuiControl* aEffectControl,
         TInt& aItemsDestroyed,
+        TBool aIsFullScreenEffect,
         TBool aAddLayout,
         TBool aIsExitEffect,
         TBool aCanDestroyOrHideImmediately)
@@ -5277,7 +5453,7 @@
     __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x is having %d children", aSourceLayout, aSourceLayout->Count());
     if (aAddLayout)
         {
-        AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately);
+        AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsFullScreenEffect, aIsExitEffect, aCanDestroyOrHideImmediately);
         }
         
     for (TInt i = 0; i < aSourceLayout->Count(); i++)
@@ -5287,10 +5463,10 @@
            if (sourceVisual.Count())
                {
                CHuiLayout& layout = static_cast<CHuiLayout&> (aSourceLayout->Visual(i));
-               AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect, aCanDestroyOrHideImmediately );
+               AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, aIsFullScreenEffect,  EFalse, aIsExitEffect, aCanDestroyOrHideImmediately );
                }
            TInt oldItemsDestroyed = aItemsDestroyed;
-           AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately);
+           AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsFullScreenEffect, aIsExitEffect, aCanDestroyOrHideImmediately);
            if (oldItemsDestroyed != aItemsDestroyed)
                {
                // Visual was destroyed. If so, then we must adjust index.
@@ -5300,7 +5476,7 @@
     __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count());
     }
 
-TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately)
+TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsFullScreenEffect, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately)
     {
     __ALFFXLOGSTRING4("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d, CanDestroyOrHideImmediately: %d >>", 
             aHandle, 
@@ -5321,17 +5497,17 @@
     // CHuiCanvasVisual* temporaryPresenterLayout = CHuiCanvasVisual::AddNewL( effectControlGroup, &effectControlGroupLayout);
     // create presenter visual and set bindings
     TInt itemsDestroyed(0);
-    AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect, aCanDestroyOrHideImmediately);
+    AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, aIsFullScreenEffect, EFalse, aIsExitEffect, aCanDestroyOrHideImmediately);
 
     if (aIsExitEffect)
         {
-        CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsExitEffect, EFalse);
+        CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsFullScreenEffect, aIsExitEffect, EFalse);
         aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
         __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual);
         }
     else
         {
-        AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse, EFalse);
+        AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, aIsFullScreenEffect, EFalse, EFalse);
         __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout);
         }
     iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue;
@@ -5465,11 +5641,11 @@
                 aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity);
                 // visual->SetFlag(EHuiVisualFlagShouldBeHidden);
                 }*/
-            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, ETrue, EFalse);
+            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, ETrue, EFalse);
             }
         else
             {
-            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse);
+            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse, EFalse);
             }
         if (layoutEffectable)
             {
@@ -5497,8 +5673,6 @@
         // only use the effect if the effect file was correctly parsed
         if (err == KErrNone)
             {
-            iLastEffectHandle = aEvent.iHandle;
-
 #ifdef HUI_DEBUG_TRACK_DRAWING  
             visual->SetTracking(ETrue);
 #endif                
@@ -5528,8 +5702,18 @@
         sourceViz2->FreeRenderBuffer();
         }
     sourceViz->ClearFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
-    TBool hideVisual = sourceViz->Flags() & EHuiVisualFlagShouldBeHidden;
-    TBool showVisual = sourceViz->Flags() & EHuiVisualFlagShouldBeShown;
+    TBool hideVisual = EFalse;
+    TBool showVisual = ETrue;
+    if(!aEffectItem.iIsFullScreenEffect)
+        {
+        hideVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeHidden) || aEffectItem.iHideWhenFinished;
+        showVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeShown) && !aEffectItem.iHideWhenFinished;
+        }
+    else
+        {
+        hideVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeHidden);
+        showVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeShown);
+        }
     TBool destroyVisual = sourceViz->Flags() & EHuiVisualFlagShouldDestroy;
     TBool shouldInactivate = sourceViz->Flags() & EHuiVisualFlagShouldBeInactive;
     TBool shouldBeUnderOpaqueHint = sourceViz->Flags() & EHuiVisualFlagShouldBeUnderOpaqueHint;
@@ -5803,6 +5987,38 @@
     // around will be cleared when HandleGfxStopEffectsL is called
 
     // iFinishedCleanupStackEffects.Append(aHandle);
+    
+	// check if the first part of application start effect finished
+    if (iFullScreenEffectData 
+            && iFullScreenEffectData->iHandle == aHandle
+            && iFullScreenEffectData->iLongAppStartTimeout && iSecondaryFullScreenEffectData)
+        {
+        delete iFullScreenEffectData;
+        iFullScreenEffectData = iSecondaryFullScreenEffectData;
+        iSecondaryFullScreenEffectData = NULL;
+        iFullScreenEffectData->iTwoPhaseEffect = CFullScreenEffectState::ESecondPartActive;
+        if (iFullScreenEffectData->State() == EEndFullscreenReceived)
+            {
+            // Client notified of the EndFullScreen during the effect. Trigger the end part immediately.
+            __ALFFXLOGSTRING("CAlfBridge::AlfGfxEffectEndCallBack - End was received. Trigger second part.");
+            iFullScreenEffectData->SetState(ESecondPhaseSetupActive); // effect setup will be skipped in HandleGfxEvent
+            GfxTriggerEndFullScreen(iFullScreenEffectData);
+            iFullScreenEffectData->SetState(EFinalEffectActive);
+			// skip cleanup. It will be run, when this effect finishes
+            return;
+            }
+        else
+            {
+            iFullScreenEffectData->SetState(EWaitEndFullScreen);
+            }
+        
+        iFullScreenEffectData->iEffectType = CFullScreenEffectState::EStartEffect;
+        
+        CHuiControlGroup* toGroup = FindControlGroupByFullScreenToEffect();
+        GfxTriggerEffectWhenFullScreenDrawn(toGroup);
+        return;
+        }
+    
     if (!iEffectEndTimer->IsActive())
         {
         TRAP_IGNORE(iEffectEndTimer->AddFinishedHandleL(aHandle));
@@ -5849,6 +6065,9 @@
         {
         delete iFullScreenEffectData;
         iFullScreenEffectData = NULL;
+        
+        delete iSecondaryFullScreenEffectData;
+        iSecondaryFullScreenEffectData = NULL;
         }
     }
     
@@ -5892,7 +6111,7 @@
 
         TFileName processName = iCommandDebug->WServClientFileName( clientWindowGroupId, CHuiStatic::WsSession() );
 #endif         
-        if (indexedGroup.Control(0).Role() == EAlfWindowGroupContainer)
+        if (indexedGroup.Control(0).Role() == EHuiWindowGroupContainer)
             {
             if (aRoster.ControlGroup(i).ResourceId() == iAlfWindowGroupNodeId)
                 {
@@ -5911,7 +6130,7 @@
 #endif
                 }                    
             }
-        else if (indexedGroup.Control(0).Role() == EAlfSessionContainer)
+        else if (indexedGroup.Control(0).Role() == EHuiSessionContainer)
             {
 #ifdef  HUI_DEBUG_TRACK_DRAWING
             __ALFLOGSTRING2(">> %d ALF GROUP, %d", i, clientWindowGroupId);                        
@@ -5919,7 +6138,7 @@
             __ALFLOGSTRING1(">> %d ALF GROUP", i);                                    
 #endif
             }
-        else if (indexedGroup.Control(0).Role() == EAlfWindowFloatingSpriteContainer)
+        else if (indexedGroup.Control(0).Role() == EHuiWindowFloatingSpriteContainer)
             {
 #ifdef  HUI_DEBUG_TRACK_DRAWING			
             __ALFLOGSTRING3(">> %d FLOATING SPRITE GROUP %S, %d", i, &processName, clientWindowGroupId);                                            
@@ -5927,7 +6146,7 @@
             __ALFLOGSTRING1(">> %d FLOATING SPRITE GROUP", i);                                            
 #endif
             }
-        else if (indexedGroup.Control(0).Role() == EAlfFullScreenEffectContainer)
+        else if (indexedGroup.Control(0).Role() == EHuiFullScreenEffectContainer)
             {
 #ifdef  HUI_DEBUG_TRACK_DRAWING
             __ALFLOGSTRING3(">> %d EFFECT GROUP %S, %d", i, &processName, clientWindowGroupId );                                                                
@@ -5935,7 +6154,7 @@
             __ALFLOGSTRING1(">> %d EFFECT GROUP", i);                                                                
 #endif
             }
-        else if (indexedGroup.Control(0).Role() == EAlfFpsIndicatorContainer)
+        else if (indexedGroup.Control(0).Role() == EHuiFpsIndicatorContainer)
             {
 #ifdef  HUI_DEBUG_TRACK_DRAWING
             __ALFLOGSTRING3(">> %d FPS GROUP %S, %d", i, &processName, clientWindowGroupId );                                                                
@@ -6174,6 +6393,13 @@
         }
     
     iSwRenderingEnabled = aEnable;    
+    
+    AMT_MAP_SET_VALUE(
+            iBoolMap,
+            AMT_MAP_SW_ENABLED_HANDLE,
+            iSwRenderingEnabled,
+            EAlfModuleTestTypeBridgeGoom );
+    
     for (TInt i=0; i<iAlfScreens.Count();i++)
         {
         PrepareSwRenderingTarget(iAlfScreens[i]);        
@@ -6282,6 +6508,13 @@
 void CAlfBridge::SetLowMemory(TBool aEnabled)
     {
     iLowMemoryMode = aEnabled;
+    
+    AMT_MAP_SET_VALUE(
+            iBoolMap,
+            AMT_MAP_LOW_MEMORY_MODE_HANDLE,
+            iLowMemoryMode,
+            EAlfModuleTestTypeBridgeGoom );
+    
     DoUpdateMemoryLevel();
     }
 
@@ -6291,6 +6524,13 @@
 TInt CAlfBridge::ForceSwRendering(TBool aEnabled)
     {
     iForcedSwRendering = aEnabled;
+    
+    AMT_MAP_SET_VALUE(
+            iBoolMap,
+            AMT_MAP_FORCE_SW_HANDLE,
+            iForcedSwRendering,
+            EAlfModuleTestTypeBridgeGoom );
+    
     DoUpdateMemoryLevel();
     return KErrNone;        
     }
@@ -6539,7 +6779,7 @@
 		__ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", controlgroup.SecureId());
                 
         
-        if (control.Role() == EAlfFpsIndicatorContainer)
+        if (control.Role() == EHuiFpsIndicatorContainer)
             {
             // FPS container doesn't contain canvas visuals
             continue;
@@ -6562,7 +6802,7 @@
             }
         
         // Dont mess with alf control group visuals, alf session handling does it for us
-        if (control.Role() == EAlfSessionContainer)
+        if (control.Role() == EHuiSessionContainer)
             {
             CHuiLayout* hostContainer = control.ContainerLayout( NULL );
             TInt flags = hostContainer->Flags();            
@@ -6721,8 +6961,8 @@
         
         // Sprites and effects as we consider them always as transparent and also
         // if controlgroup is transformed somehow    
-        if (aControl.Role() == EAlfFullScreenEffectContainer 
-            || aControl.Role() == EAlfWindowFloatingSpriteContainer ||
+        if (aControl.Role() == EHuiFullScreenEffectContainer 
+            || aControl.Role() == EHuiWindowFloatingSpriteContainer ||
             aControlGroup.IsTransformed())
             {
             visualIsOpaque = EFalse;    
@@ -6764,7 +7004,7 @@
         CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j);
         CHuiControl& control = controlgroup.Control(0);
 
-        if (control.Role() == EAlfFpsIndicatorContainer || control.Role() == EAlfSessionContainer)
+        if (control.Role() == EHuiFpsIndicatorContainer || control.Role() == EHuiSessionContainer)
             {
             // FPS container doesn't contain canvas visuals and alfsession containers cannot have surfaces
             continue;
@@ -6876,4 +7116,30 @@
         }
     }
 
+TBool CAlfBridge::HasActiveAlfContent( TInt aClientWgId )
+    {
+    TBool hasAlfContent = EFalse;
+    if(iAppUi)
+        {
+        CAlfAppSrvSessionBase* activeAlfSession = iAppUi->ActiveSession();
+        CAlfScreen* screen = iAlfScreens[0];
+        for(TInt i = 0 ; i < screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount() ; i++)
+            {
+            CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(i);
+            CHuiControl& control = controlgroup.Control(0);
+            if (control.Role() == EHuiSessionContainer)
+                {
+                CAlfAppSrvSessionBase* alfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup);
+                if(alfSrvSession && 
+                   (alfSrvSession->ClientWindowGroup() == aClientWgId))
+                    {
+                    hasAlfContent = ETrue;
+                    break;
+                    }
+                }
+            }
+        }
+    return hasAlfContent;
+    }
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -812,6 +812,31 @@
         }
     }
 
+void CFullScreenEffectState::ConstructL(const CFullScreenEffectState& aEffectState)
+    {
+    iAction = aEffectState.iAction;
+    iHandle = aEffectState.iHandle;
+    iType = aEffectState.iType;
+    iLongAppStartTimeout = aEffectState.iLongAppStartTimeout;
+    iTimeout = aEffectState.iTimeout;
+    iToWg = aEffectState.iToWg;
+    iFromWg = aEffectState.iFromWg;
+    iToAppId = aEffectState.iToAppId;
+    iFromAppId = aEffectState.iFromAppId;
+
+    iToSecureId = aEffectState.iToSecureId;
+    iFromSecureId = aEffectState.iFromSecureId;
+    
+    iRect.iTl.iX = aEffectState.iRect.iTl.iX;
+    iRect.iTl.iY = aEffectState.iRect.iTl.iY;
+    iRect.iBr.iX = aEffectState.iRect.iBr.iX;
+    iRect.iBr.iY = aEffectState.iRect.iBr.iY;
+    iState = aEffectState.iState;
+    iEffectName = aEffectState.iEffectName->AllocL();
+    iEffectType = aEffectState.iEffectType;
+    iCompletionHandle = aEffectState.iCompletionHandle;
+    iTwoPhaseEffect = CFullScreenEffectState::EOnlyOnePart;
+    }
 
 void CFullScreenEffectState::ConstructL(
         TInt aAction,
@@ -820,7 +845,8 @@
     iAction = aAction;
     iHandle = aStream.ReadInt32L();
     iType = aStream.ReadInt32L();
-    iTimeoutTriggered = aStream.ReadInt32L();
+    iLongAppStartTimeout = aStream.ReadInt32L();
+    iTimeout = aStream.ReadInt32L();
     iToWg = aStream.ReadInt32L();
     iFromWg = aStream.ReadInt32L();
     iToAppId = aStream.ReadInt32L();
@@ -828,7 +854,8 @@
 
     iToSecureId = aStream.ReadInt32L();
     iFromSecureId = aStream.ReadInt32L();
-    /*TInt flags =*/
+    
+    // TInt flags
     aStream.ReadInt32L();
     iRect.iTl.iX = aStream.ReadInt32L();
     iRect.iTl.iY = aStream.ReadInt32L();
@@ -838,8 +865,27 @@
     ResolveFileNameL(aStream);
 
     iCompletionHandle = iHandle;
+    iTwoPhaseEffect = CFullScreenEffectState::EOnlyOnePart;
     }
 
+void CFullScreenEffectState::SetState(TEffectState aState)
+    {
+    if (aState >= iState)
+        {
+        iState = aState;
+        }
+    else
+        {
+        __ALFFXLOGSTRING2("CFullScreenEffectState::SetState - WARNING! Trying to set to previous state. %d -> %d", iState, aState);
+        }
+    };
+        
+TEffectState CFullScreenEffectState::State()
+    {
+    return iState;
+    }
+      
+
 void CControlEffectState::ConstructL(TInt aAction,
         RMemReadStream& aStream)
     {
--- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -139,7 +139,7 @@
 #ifdef ALF_DEBUG_TRACK_DRAWING 
     delete iCommandDebugger;
 #endif
-    
+    iUpdateRegion.Close();    
 #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
     delete AMT_CONTROL();
     Dll::FreeTls();
@@ -1034,6 +1034,8 @@
     iStream->ReadInt8L();
     ReadRegionL( iStream, newOpaqueRegion );
     // TODO: Implement actions
+    newTransparentRegion.Close();
+    newOpaqueRegion.Close();
     }
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -1317,6 +1317,7 @@
                     (TAny*)offset );
             }
         }
+    AMT_MAP_NODE_SET_ORDINAL_POSITION();
     }
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -142,7 +142,7 @@
 	CHuiControl* cntrl = new (ELeave) CHuiControl(aHuiEnv);
 	CleanupStack::PushL(cntrl); 
 	cntrl->ConstructL();
-	cntrl->SetRole(EAlfWindowFloatingSpriteContainer);
+	cntrl->SetRole(EHuiWindowFloatingSpriteContainer);
 	iFloatingSpriteControlGroup->AppendL(cntrl);
 	CleanupStack::Pop(cntrl);
 	CHuiCanvasVisual* layout = CHuiCanvasVisual::AddNewL(*cntrl);            
@@ -153,7 +153,7 @@
 	CHuiControl* effectCntrl = new (ELeave) CHuiControl(aHuiEnv);		    
 	CleanupStack::PushL(effectCntrl); 
 	effectCntrl->ConstructL();
-	effectCntrl->SetRole(EAlfFullScreenEffectContainer);
+	effectCntrl->SetRole(EHuiFullScreenEffectContainer);
 	iFullscreenEffectControlGroup->AppendL(effectCntrl);
 	CleanupStack::Pop(effectCntrl);
 	CHuiCanvasVisual* effectLayout = CHuiCanvasVisual::AddNewL(*effectCntrl);            
@@ -169,7 +169,7 @@
     	CHuiControl* fpsCntrl = new (ELeave) CHuiControl(aHuiEnv);	    
 	    CleanupStack::PushL(fpsCntrl);
 	    fpsCntrl->ConstructL();
-	    fpsCntrl->SetRole(EAlfFpsIndicatorContainer);
+	    fpsCntrl->SetRole(EHuiFpsIndicatorContainer);
 	    iFpsControlGroup->AppendL(fpsCntrl);
 	    CleanupStack::Pop(fpsCntrl);
         
--- a/uiacceltk/hitchcock/ServerCore/Src/alfsrvcontrolgroupsubsession.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfsrvcontrolgroupsubsession.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -76,7 +76,7 @@
         
     iHostControl = new (ELeave) CAlfSrvHostControl( *Session().SharedHuiEnv() );
     iHostControl->ConstructL();
-    iHostControl->SetRole(EAlfSessionContainer);
+    iHostControl->SetRole(EHuiSessionContainer);
         
     CHuiLayout* sessionContainer = CHuiDeckLayout::AddNewL( *iHostControl, NULL );
     sessionContainer->SetFlags( EHuiVisualFlagManualLayout );
--- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -234,6 +234,7 @@
     iCompositionTokens.Close();
     iWindowServerSessions.Close();
     iAlfTargets.Close();
+    iOptionalGRAM.Close();
     }
 
 void CAlfStreamerServer::AppendCompositionSessionL(CAlfStreamerServerSession* aSession, TBool aHost)
@@ -409,6 +410,30 @@
     __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Not Found <<")
     }
 
+void CAlfStreamerServer::FormAQueueL(TInt aOp, TInt aSecureId, TInt aWindowGroup)
+    {
+    __ALFLOGSTRING3("CAlfStreamerServer::FormAQueueL( %d, %d, %d )",aOp, aSecureId, aWindowGroup)
+    if (aOp == EAlfVolunteerForGoomTarget)
+        {
+        TAlfCompParams param = {aSecureId, aSecureId, aWindowGroup, aWindowGroup};
+        if (iOptionalGRAM.Find(param) != KErrNotFound)
+            {
+            __ALFLOGSTRING("CAlfStreamerServer::FormAQueueL: Already added");
+            return;
+            }    
+        User::LeaveIfError(iOptionalGRAM.Append(param));
+        }
+    else
+        {
+        for(TInt i = iOptionalGRAM.Count()-1; i >= 0; i-- )
+            {
+            if ( iOptionalGRAM[i].iWindowGroup == aWindowGroup )
+                {
+                iOptionalGRAM.Remove(i);
+                }       
+            }    
+        }    
+    }
 void CAlfStreamerServer::QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp)
     {
     __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL >>")
@@ -676,12 +701,29 @@
         }
     }
     
-void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso)
+void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TInt aActiveAlso)
     {
-    RArray<TAlfCompParams>& arrayRef = aActiveAlso?iAlfTargets:iInactiveSurfaces;
+    TBool optionalOnly(aActiveAlso==EAlfVolunteersForCommonGood);  // to lessen ambiquity..
         
+    RArray<TAlfCompParams>* arrayPtr = 0;
+    switch (aActiveAlso)
+        {
+        case EAlfInactiveWgs:
+            arrayPtr = &iInactiveSurfaces;
+            break;
+        case EAlfAllWgsWithSurface:
+            arrayPtr = &iAlfTargets;
+            break;
+        case EAlfVolunteersForCommonGood:
+        default:
+            arrayPtr = &iOptionalGRAM;      
+            break;
+        }
+    
+    RArray<TAlfCompParams>& arrayRef =  *arrayPtr; // :)
+            
     TInt count = arrayRef.Count();    
-   __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count)
+    __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count);
     if ( count == 0)
         {
         aMessage.Complete(KErrNotFound);
@@ -689,20 +731,29 @@
         }
                 
     TInt maxLength = aMessage.GetDesMaxLength(0);
-    TInt* array = new (ELeave) TInt [maxLength/4];
+    TInt* arrayStart = new (ELeave) TInt [maxLength/4];
+    TInt* array = arrayStart;
+	
+    TInt payloadSize = optionalOnly?8:4; // what a waste
+    count = Min(maxLength/payloadSize-1, count);
     
-    count = Min(maxLength/4-1, count);
     for ( TInt i = 0; i<count; i++ ) 
         {
-        __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayRef[i].iWindowGroup);
-        array[i] = arrayRef[i].iWindowGroup;
+        __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayPtr[i].iWindowGroup);
+        *array = arrayRef[i].iWindowGroup;
+        array++;
+        if (optionalOnly)
+            {           
+            *array = arrayRef[i].iSecureId;
+            array++;
+            }
         }
         
-    array[count] = 0;
+    *array = 0;
         
-    TPtr8 ptr((TUint8*)array,maxLength,maxLength);
+    TPtr8 ptr((TUint8*)arrayStart,maxLength,maxLength);
     aMessage.WriteL(0, ptr);
-    delete[] array;
+    delete[] arrayStart;
     aMessage.Complete(KErrNone);
    __ALFLOGSTRING("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL <<")
     }
@@ -994,6 +1045,14 @@
             server->Bridge()->AddData( EAlfDSSetDistractionWindow, windowGroupId, windowHandle, (TAny*)state );
             break;
             }
+        case EAlfVolunteerForGoomTarget:  
+        case EAlfExcludeFromGoomTargets:
+            { // all these volunteers, just get into a line..
+            server->FormAQueueL(op, aMessage.Int0(), aMessage.Int1());    
+            break;    
+            }            
+            
+            
         default:
             {
             aMessage.Complete(KErrNotSupported);
--- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -74,8 +74,6 @@
     RPointerArray<CAlfWindow> iWindows;
     RArray<TPluginInfo> iPlugins;
     CAlfHierarchyModel* iTree;
-    
-    RPointerArray<CAlfWindow> iChangedWindows;    
     };
 
 // ---------------------------------------------------------------------------
@@ -440,10 +438,6 @@
 //
 void CAlfWindowManager::ContentReady(CAlfWindow& aWindow, CAlfWindowBuffer* aOutBuffer)
     {
-    //ASSERT(iData->iChangedWindows.Find(&aWindow) == KErrNotFound); // no plugin should produce more frames
-                                                            // than actually bound to scene
-    iData->iChangedWindows.Append(&aWindow);
-
     if(!aWindow.IsInsertedToScene())
     	{
     	TRAPD( err, BindWindowToHitchL(&aWindow, this) );
@@ -648,7 +642,6 @@
 //   
 void CAlfWindowManager::PrepareNewFrame(TUint aEstimatedInterval)
     {
-    iData->iChangedWindows.Reset();
     for (TInt i = iData->iPlugins.Count()-1; i >= 0 ; i--)
         {
         TRAP_IGNORE(iData->iPlugins[i].iPlugin->PrepareFrameL(aEstimatedInterval));
--- a/uiacceltk/hitchcock/backgroundanim/inc/sensor.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/backgroundanim/inc/sensor.h	Fri Jun 11 14:31:43 2010 +0300
@@ -1,20 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
 #ifndef __SENSOR_H__
 #define __SENSOR_H__
 
--- a/uiacceltk/hitchcock/backgroundanim/src/sensor.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/backgroundanim/src/sensor.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -1,20 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
-
 #include <sensrvaccelerometersensor.h>
 
 #include "sensor.h"
--- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Fri Jun 11 14:31:43 2010 +0300
@@ -1391,12 +1391,12 @@
 	?RegisterParameterL@CHuiFxVisualLayer@@IAEXABVTDesC16@@PAM@Z @ 1390 NONAME ; void CHuiFxVisualLayer::RegisterParameterL(class TDesC16 const &, float *)
 	?NewL@CHuiFxEffect@@SAPAV1@AAVCHuiFxEngine@@@Z @ 1391 NONAME ; class CHuiFxEffect * CHuiFxEffect::NewL(class CHuiFxEngine &)
 	?ConstructL@CHuiFxVisualLayer@@IAEXPAVMHuiEffectable@@@Z @ 1392 NONAME ; void CHuiFxVisualLayer::ConstructL(class MHuiEffectable *)
-	?Draw@CHuiFxEffect@@QAEHAAVCHuiGc@@ABVTRect@@@Z @ 1393 NONAME ; int CHuiFxEffect::Draw(class CHuiGc &, class TRect const &)
+	?Draw@CHuiFxEffect@@QAEHAAVCHuiGc@@ABVTRect@@H@Z @ 1393 NONAME ; int CHuiFxEffect::Draw(class CHuiGc &, class TRect const &)
 	?TargetRect@CHuiFxLayer@@QBEABVTRect@@XZ @ 1394 NONAME ; class TRect const & CHuiFxLayer::TargetRect(void) const
 	?AdvanceTime@CHuiFxVisualLayer@@UAEXM@Z @ 1395 NONAME ; void CHuiFxVisualLayer::AdvanceTime(float)
 	?Filter@CHuiFxFilterLayer@@QBEAAVCHuiFxFilter@@XZ @ 1396 NONAME ; class CHuiFxFilter & CHuiFxFilterLayer::Filter(void) const
 	?IsFreeForm@CHuiFxFilter@@QBEHXZ @ 1397 NONAME ; int CHuiFxFilter::IsFreeForm(void) const
-	?Draw@CHuiFxFilterLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2@Z @ 1398 NONAME ; void CHuiFxFilterLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
+	?Draw@CHuiFxFilterLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2H@Z @ 1398 NONAME ; void CHuiFxFilterLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
 	?SetSourceRect@CHuiFxLayer@@QAEXABVTRect@@@Z @ 1399 NONAME ; void CHuiFxLayer::SetSourceRect(class TRect const &)
 	??1CHuiFxRenderbuffer@@UAE@XZ @ 1400 NONAME ; CHuiFxRenderbuffer::~CHuiFxRenderbuffer(void)
 	?SetBlendingMode@CHuiFxLayer@@QAEXW4THuiFxBlendingMode@@@Z @ 1401 NONAME ; void CHuiFxLayer::SetBlendingMode(enum THuiFxBlendingMode)
@@ -1416,7 +1416,7 @@
 	?Changed@CHuiFxFilterLayer@@UBEHXZ @ 1415 NONAME ; int CHuiFxFilterLayer::Changed(void) const
 	?AddLayerL@CHuiFxEffect@@QAEXPBVCHuiFxLayer@@@Z @ 1416 NONAME ; void CHuiFxEffect::AddLayerL(class CHuiFxLayer const *)
 	?EffectsEngine@CHuiEnv@@QBEPAVCHuiFxEngine@@XZ @ 1417 NONAME ; class CHuiFxEngine * CHuiEnv::EffectsEngine(void) const
-	?Draw@CHuiFxGroupLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2@Z @ 1418 NONAME ; void CHuiFxGroupLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
+	?Draw@CHuiFxGroupLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2H@Z @ 1418 NONAME ; void CHuiFxGroupLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
 	??0CHuiFxRenderbuffer@@IAE@XZ @ 1419 NONAME ; CHuiFxRenderbuffer::CHuiFxRenderbuffer(void)
 	?AddEffectL@CHuiFxEngine@@IAEXPAVCHuiFxEffect@@@Z @ 1420 NONAME ; void CHuiFxEngine::AddEffectL(class CHuiFxEffect *)
 	?Engine@CHuiFxEffect@@QBEAAVCHuiFxEngine@@XZ @ 1421 NONAME ; class CHuiFxEngine & CHuiFxEffect::Engine(void) const
@@ -1460,7 +1460,7 @@
 	?SetEffect@CHuiVisual@@QAEXPAVCHuiFxEffect@@@Z @ 1459 NONAME ; void CHuiVisual::SetEffect(class CHuiFxEffect *)
 	?SetMargin@CHuiFxFilter@@QAEXABVTSize@@@Z @ 1460 NONAME ; void CHuiFxFilter::SetMargin(class TSize const &)
 	?PrepareDrawL@CHuiFxFilterLayer@@UAEHAAVCHuiFxEngine@@@Z @ 1461 NONAME ; int CHuiFxFilterLayer::PrepareDrawL(class CHuiFxEngine &)
-	?Draw@CHuiFxVisualLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2@Z @ 1462 NONAME ; void CHuiFxVisualLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
+	?Draw@CHuiFxVisualLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2H@Z @ 1462 NONAME ; void CHuiFxVisualLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
 	?SkinInstance@CHuiStatic@@SAPAVMAknsSkinInstance@@XZ @ 1463 NONAME ; class MAknsSkinInstance * CHuiStatic::SkinInstance(void)
 	?SetTrackCommandSet@CHuiCanvasVisual@@QAEXAAV?$TBuf@$0BAA@@@H@Z @ 1464 NONAME ; void CHuiCanvasVisual::SetTrackCommandSet(class TBuf<256> &, int)
 	?PopTransformationMatrix@CHuiCanvasGc@@UAEXXZ @ 1465 NONAME ; void CHuiCanvasGc::PopTransformationMatrix(void)
--- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Fri Jun 11 14:31:43 2010 +0300
@@ -1733,7 +1733,7 @@
 	_ZN12CHuiFxEffect10ConstructLEv @ 1732 NONAME
 	_ZN12CHuiFxEffect11AdvanceTimeEf @ 1733 NONAME
 	_ZN12CHuiFxEffect20SetEffectEndObserverEP21MAlfGfxEffectObserveri @ 1734 NONAME
-	_ZN12CHuiFxEffect4DrawER6CHuiGcRK5TRect @ 1735 NONAME
+	_ZN12CHuiFxEffect4DrawER6CHuiGcRK5TRecti @ 1735 NONAME
 	_ZN12CHuiFxEffect4NewLER12CHuiFxEngine @ 1736 NONAME
 	_ZN12CHuiFxEffect7ChangedEv @ 1737 NONAME
 	_ZN12CHuiFxEffect9AddLayerLEPK11CHuiFxLayer @ 1738 NONAME
@@ -1773,7 +1773,7 @@
 	_ZN16CHuiFxGroupLayer10VisualAreaER5TRect @ 1772 NONAME
 	_ZN16CHuiFxGroupLayer11AdvanceTimeEf @ 1773 NONAME
 	_ZN16CHuiFxGroupLayer12PrepareDrawLER12CHuiFxEngine @ 1774 NONAME
-	_ZN16CHuiFxGroupLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_ @ 1775 NONAME
+	_ZN16CHuiFxGroupLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_i @ 1775 NONAME
 	_ZN16CHuiFxGroupLayer4NewLEi @ 1776 NONAME
 	_ZN16CHuiFxGroupLayer9AddLayerLEPK11CHuiFxLayer @ 1777 NONAME
 	_ZN16CHuiFxGroupLayerC1Ev @ 1778 NONAME
@@ -1784,14 +1784,14 @@
 	_ZN17CHuiFxFilterLayer10ConstructLEP12CHuiFxFilter @ 1783 NONAME
 	_ZN17CHuiFxFilterLayer11AdvanceTimeEf @ 1784 NONAME
 	_ZN17CHuiFxFilterLayer12PrepareDrawLER12CHuiFxEngine @ 1785 NONAME
-	_ZN17CHuiFxFilterLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_ @ 1786 NONAME
+	_ZN17CHuiFxFilterLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_i @ 1786 NONAME
 	_ZN17CHuiFxVisualLayer10ConstructLEP14MHuiEffectable @ 1787 NONAME
 	_ZN17CHuiFxVisualLayer10VisualAreaER5TRect @ 1788 NONAME
 	_ZN17CHuiFxVisualLayer11AdvanceTimeEf @ 1789 NONAME
 	_ZN17CHuiFxVisualLayer12PrepareDrawLER12CHuiFxEngine @ 1790 NONAME
 	_ZN17CHuiFxVisualLayer18RegisterParameterLERK7TDesC16P4TRgb @ 1791 NONAME
 	_ZN17CHuiFxVisualLayer18RegisterParameterLERK7TDesC16Pf @ 1792 NONAME
-	_ZN17CHuiFxVisualLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_ @ 1793 NONAME
+	_ZN17CHuiFxVisualLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_i @ 1793 NONAME
 	_ZN17CHuiFxVisualLayer4NewLEP14MHuiEffectable @ 1794 NONAME
 	_ZN17CHuiFxVisualLayer9ParameterERK7TDesC16 @ 1795 NONAME
 	_ZN17CHuiFxVisualLayerD0Ev @ 1796 NONAME
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h	Fri Jun 11 14:31:43 2010 +0300
@@ -102,7 +102,7 @@
     IMPORT_C static CHuiFxEffect* NewL(CHuiFxEngine& aEngine);
     IMPORT_C void AddLayerL(const CHuiFxLayer* aLayer); // takes ownership
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
-    IMPORT_C TBool Draw(CHuiGc& aGc, const TRect& aDisplayRect);
+    IMPORT_C TBool Draw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aHasSurface);
     IMPORT_C CHuiFxEngine& Engine() const;
     IMPORT_C TBool VisualArea(TRect& aRect) const;
     IMPORT_C TBool Changed();
@@ -168,7 +168,7 @@
      *                   
      *  @return ETrue if drawing was done, otherwise EFalse   
      */
-    TBool CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TInt aAlpha = 255);
+    TBool CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TBool aHasSurface, TInt aAlpha = 255);
     TBool CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque);
 
     void FxmlVisualInputs(RArray<THuiFxVisualSrcType> &aArray);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilter.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilter.h	Fri Jun 11 14:31:43 2010 +0300
@@ -34,7 +34,7 @@
     IMPORT_C virtual ~CHuiFxFilter();
     IMPORT_C virtual TBool PrepareDrawL(CHuiFxEngine& aEngine);
     IMPORT_C virtual TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-                               const TRect& aTargetRect, const TRect& aSourceRect) = 0;
+                               const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface) = 0;
     // CalculateMargin will be called before PrepareDrawL(), so 
     // parameters are not ready, so margin calculation need to use 
     // either previous frame parameter values, or should be independent 
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilterLayer.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilterLayer.h	Fri Jun 11 14:31:43 2010 +0300
@@ -31,7 +31,7 @@
     IMPORT_C ~CHuiFxFilterLayer();
     IMPORT_C static CHuiFxFilterLayer* NewL(CHuiFxFilter* aFilter); // takes ownership
     IMPORT_C TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource);
+    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface);
     IMPORT_C CHuiFxFilter& Filter() const;
     IMPORT_C TBool Changed() const;
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxGroupLayer.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxGroupLayer.h	Fri Jun 11 14:31:43 2010 +0300
@@ -28,7 +28,7 @@
     IMPORT_C ~CHuiFxGroupLayer();
     IMPORT_C static CHuiFxGroupLayer* NewL(TBool aIsRoot = EFalse);
     IMPORT_C TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource);
+    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface);
     IMPORT_C void AddLayerL(const CHuiFxLayer* aLayer); // takes ownership
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
     IMPORT_C TBool Changed() const;
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxLayer.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxLayer.h	Fri Jun 11 14:31:43 2010 +0300
@@ -32,7 +32,7 @@
     IMPORT_C virtual ~CHuiFxLayer();
 
     IMPORT_C virtual TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    virtual void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource) = 0;
+    virtual void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface) = 0;
     IMPORT_C virtual TBool VisualArea(TRect& aRect);
     IMPORT_C virtual TBool Margin( TMargins &m );
     IMPORT_C virtual void AdvanceTime(TReal32 aElapsedTime);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h	Fri Jun 11 14:31:43 2010 +0300
@@ -32,7 +32,7 @@
     IMPORT_C static CHuiFxVisualLayer* NewL(MHuiEffectable* aVisual); // param mandatory
     IMPORT_C ~CHuiFxVisualLayer();
     IMPORT_C TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource);
+    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface);
     IMPORT_C TBool VisualArea( TRect& aRect );
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
     IMPORT_C TBool Changed() const;
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h	Fri Jun 11 14:31:43 2010 +0300
@@ -336,6 +336,12 @@
     // From MHuiMemoryLevelObserver
     void SetMemoryLevel(THuiMemoryLevel aLevel);
     
+	// For handling native ALF applications drawing 
+    void SetAlfEventWindow(CHuiVisual* aVisual);
+    const CHuiVisual* AlfEventWindow();
+    TBool NativeAppsContentChanged();
+    void DrawNativeAppsContent( CHuiGc &aGc, CHuiDisplay* aDisplay) const;
+    
 protected:
 
     /* Methods. */
@@ -512,6 +518,10 @@
 	
 	TBool iRosterIsFrozen;
 	TBool iMonitorMemoryLevel;
+	
+	/* not owned */
+	CHuiVisual* iAlfEventWindowVisual;
+	TBool iPreviousAlfContentDrawn;
 	};
 
 #endif  // __HUIROSTERIMPL_H__
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BevelFilter.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BevelFilter.h	Fri Jun 11 14:31:43 2010 +0300
@@ -29,7 +29,7 @@
     CHuiFxVg10BevelFilter *CloneL() const;
 protected:
     void ConstructL();
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
 private:
     TReal32             iOutlineX;
     TReal32             iOutlineY;
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BlurFilter.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BlurFilter.h	Fri Jun 11 14:31:43 2010 +0300
@@ -28,9 +28,9 @@
     static CHuiFxVg10BlurFilter* NewL();
     TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc,
             CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-            const TRect& aTargetRect, const TRect& aSourceRect);
+            const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface);
 
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
     void CalculateMargin(TMargins &aMargin) const;  
     CHuiFxVg10BlurFilter *CloneL() const;
 protected:
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10ColorMatrixFilterBase.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10ColorMatrixFilterBase.h	Fri Jun 11 14:31:43 2010 +0300
@@ -29,7 +29,7 @@
     static CHuiFxVg10ColorMatrixFilterBase* NewL();
 protected:
     void ConstructL();
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
     virtual void UpdateColorMatrix();
     void CopyFromL(const CHuiFxVg10ColorMatrixFilterBase *aOldFilter);
     CHuiFxVg10ColorMatrixFilterBase *CloneL() const;
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10FilterBase.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10FilterBase.h	Fri Jun 11 14:31:43 2010 +0300
@@ -35,10 +35,10 @@
 public: // from CHuiFxFilter
     virtual TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc,
             CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-            const TRect& aTargetRect, const TRect& aSourceRect);
+            const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface);
 
 private:
-    virtual void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight) = 0;
+    virtual void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface) = 0;
 protected:
     TBool wasEnoughMemory();
     
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10OutlineFilter.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10OutlineFilter.h	Fri Jun 11 14:31:43 2010 +0300
@@ -28,7 +28,7 @@
     static CHuiFxVg10OutlineFilter* NewL();
 protected:
     void ConstructL();
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
     void CalculateMargin(TMargins &aMargin) const;  
     CHuiFxVg10OutlineFilter *CloneL() const;
 private:
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10TransformFilter.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10TransformFilter.h	Fri Jun 11 14:31:43 2010 +0300
@@ -26,9 +26,9 @@
 public: // from CHuiFxFilter
     virtual TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc,
                        CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-                       const TRect& aTargetRect, const TRect& aSourceRect);
+                       const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface);
     static CHuiFxVg10TransformFilter* NewL();
-    void DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage /*aTargetImage*/, VGImage /*aSourceImage*/, TInt /*aWidth*/, TInt /*aHeight*/) {}
+    void DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage /*aTargetImage*/, VGImage /*aSourceImage*/, TInt /*aWidth*/, TInt /*aHeight*/, TBool /*aHasSurface*/) {}
     void CalculateMargin(TMargins &aMargin) const;  
     CHuiFxVg10TransformFilter *CloneL() const;
 protected:
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BevelFilter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BevelFilter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -59,7 +59,7 @@
     return filter;
     }
 
-void CHuiFxVg10BevelFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight)
+void CHuiFxVg10BevelFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool /*aHasSurface*/)
     {
     VGfloat outline_x = clamp(iOutlineX, EPSILON, 128.0f);
     VGfloat outline_y = clamp(iOutlineY, EPSILON, 128.0f);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BlurFilter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BlurFilter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -84,7 +84,7 @@
 }
 
 TBool CHuiFxVg10BlurFilter::Draw(CHuiFxEngine& aEngine, CHuiGc& /* aGc */, CHuiFxRenderbuffer& aTarget,
-                                 CHuiFxRenderbuffer& aSource, const TRect& aTargetRect, const TRect& aSourceRect)
+                                 CHuiFxRenderbuffer& aSource, const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface)
     {
     aTarget.BindAsTexture(ERenderbufferUsageWriteOnly);
     aSource.BindAsTexture(ERenderbufferUsageReadOnly);
@@ -96,7 +96,7 @@
 
     if(opacity > EPSILON)
         {
-        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height());
+        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height(), aHasSurface);
         }
     else
         {
@@ -116,7 +116,7 @@
     return wasEnoughMemory();
     }
 
-void CHuiFxVg10BlurFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight)
+void CHuiFxVg10BlurFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool /*aHasSurface*/)
     {
     const VGfloat blur_x = clamp(iBlurX, EPSILON, 128.0f);
     const VGfloat blur_y = clamp(iBlurY, EPSILON, 128.0f);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -87,8 +87,5 @@
     iColorMatrix[16] = oOff;
     iColorMatrix[17] = oOff;
     iColorMatrix[18] = oOff;
-    iColorMatrix[19] = 0.5f; // add 0.5 to alpha so that surfaces fade aswell
-	                         // it should be considered if this should only
-							 // be done for visuals with a background
-							 // surface
+    iColorMatrix[19] = 0.0f; 
     }
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10ColorMatrixFilterBase.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10ColorMatrixFilterBase.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -44,7 +44,7 @@
     CHuiFxVg10FilterBase::CopyFromL(aOldFilter);
     memcpy(iColorMatrix, aOldFilter->iColorMatrix, sizeof(iColorMatrix));
     }
-void CHuiFxVg10ColorMatrixFilterBase::DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight )
+void CHuiFxVg10ColorMatrixFilterBase::DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight,TBool aHasSurface )
     {
     // take opacity into account
     const VGfloat opacity = clamp(iOpacity, 0.0f, 1.0f);
@@ -55,6 +55,8 @@
             {
             UpdateColorMatrix();
             }
+
+        iColorMatrix[19] = aHasSurface ? 0.5f : 0.0f;
         vgColorMatrix(aTargetImage, aSourceImage, iColorMatrix);
         }
     else
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10FilterBase.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10FilterBase.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -25,7 +25,7 @@
 
 
 TBool CHuiFxVg10FilterBase::Draw(CHuiFxEngine& aEngine, CHuiGc& /* aGc */, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-                                            const TRect& aTargetRect, const TRect& aSourceRect)
+                                            const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface)
     {
     aTarget.BindAsTexture(ERenderbufferUsageWriteOnly);
     aSource.BindAsTexture(ERenderbufferUsageReadOnly);
@@ -37,7 +37,7 @@
 
     if(opacity > EPSILON)
         {
-        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height());
+        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height(), aHasSurface);
         }
     else
         {
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10OutlineFilter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10OutlineFilter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -70,7 +70,7 @@
 }
 
 
-void CHuiFxVg10OutlineFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight)
+void CHuiFxVg10OutlineFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool /*aHasSurface*/)
     {
     VGfloat outline_x = clamp(iOutlineX, EPSILON, 128.0f);
     VGfloat outline_y = clamp(iOutlineY, EPSILON, 128.0f);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10TransformFilter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10TransformFilter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -154,7 +154,7 @@
 
 TBool CHuiFxVg10TransformFilter::Draw(CHuiFxEngine& /*aEngine*/, CHuiGc& /*aGc*/,
         CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-        const TRect& /*aTargetRect*/, const TRect& aSourceRect)
+        const TRect& /*aTargetRect*/, const TRect& aSourceRect, TBool /*aHasSurface*/)
     {
     aSource.BindAsTexture(ERenderbufferUsageReadOnly);
     aTarget.BindAsRenderTarget();
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -105,6 +105,8 @@
     vgDestroyPaint(iPaint);
     vgDestroyPaint(iGradientPaint);
     vgDestroyPath(iEllipsePath);
+    
+    iTempRegion.Close();
     }
     
 
@@ -978,8 +980,8 @@
 #if defined(RENDER_DEBUG_RECTANGLES)
     color = Math::Random() | 0xff;
 #endif
-    
-    // Update the color of the current paint
+    vgSetPaint(iPaint, VG_FILL_PATH | VG_STROKE_PATH);
+   // Update the color of the current paint
     // if required
     if (iPaintColor != color)
         {
@@ -2085,12 +2087,12 @@
         1.0f,  aEndColor.Red()   * scale, aEndColor.Green()   * scale, aEndColor.Blue()   * scale, aEndOpacity,
         };
     
+
     vgSetParameterfv(iGradientPaint, VG_PAINT_LINEAR_GRADIENT, 2 * 2, gradientCoords);
     vgSetParameterfv(iGradientPaint, VG_PAINT_COLOR_RAMP_STOPS, 2 * 5, gradientStops);
     vgSetPaint(iGradientPaint, VG_FILL_PATH);
     HUI_VG_INVARIANT();
 
-    UpdateColor();
     UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
     
     // Draw the gradient as an image if we have a texture, otherwise draw a regular rectangle
@@ -2117,7 +2119,16 @@
 
         if (!tex)
             {
-            DrawRect(aRect);
+            UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
+            vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+            
+            vgTranslate(aRect.iTl.iX, aRect.iTl.iY);
+            vgScale(aRect.Width(),aRect.Height());
+            
+            vgDrawPath(iRectPath, VG_FILL_PATH);
+            
+            vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+            UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
             }
         else
             {
@@ -2127,12 +2138,20 @@
         }
     else
         {
-        DrawRect(aRect);
+        UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
+        vgSeti(VG_MATRIX_MODE, VG_MATRIX_PATH_USER_TO_SURFACE);
+        
+        vgTranslate(aRect.iTl.iX, aRect.iTl.iY);
+        vgScale(aRect.Width(),aRect.Height());
+        
+        vgDrawPath(iRectPath, VG_FILL_PATH);
+        
+        vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
+        UpdateMatrix(VG_MATRIX_PATH_USER_TO_SURFACE);
         }
     HUI_VG_INVARIANT();
     
-    // Restore the original paint
-    vgSetPaint(iPaint, VG_FILL_PATH | VG_STROKE_PATH);
+    // Restore the original color & paint
     UpdateColor();
     }
 
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -32,6 +32,15 @@
 #include <AknLayoutFont.h>
 #include <e32property.h>
 
+#include "alfmoduletestconf.h"
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    // Provides TLS object data for test cases.
+    // This is used only if module test hooks are set on.
+    #include "huistatictlsdata.h"
+#endif // USE_MODULE_TEST_HOOKS_FOR_ALF
+// Provides module test hook defines.
+#include "alfmoduletestdefines.h"
+
 // Enable this for debugging cache usage
 //#define HUI_DEBUG_PRINT_CANVAS_TEXTURE_CACHE
 //#define HUI_DEBUG_PRINT_CANVAS_TEXTURE_CACHE_EGL
@@ -3508,6 +3517,8 @@
         iMaxTextureMemoryInKBytes = KHuiMaxRecommendedTextureAmountInKBytes;
         iMaxRenderBufferMemoryInKBytes = KHuiMaxRecommendedRenderBufferAmountInKBytes;       
         }    
+
+    AMT_MAP_CANVAS_TEXTURE_CACHE_SET_MEMORY_LEVEL();
     }
 
 TBool CHuiCanvasTextureCache::IsLowMemoryStateEnabled() const
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -342,8 +342,15 @@
     
 TBool CHuiCanvasVisual::CanSkipDrawing() const
     {
+    if(Display()->RosterImpl().AlfEventWindow() == this)
+         {
+         return EFalse;
+         }
+    
     if (Effect())
         {
+        TBool hasStoredContent = (IsDelayedEffectSource() || Freezed()) && (StoredRenderBuffer() ||  iCanvasVisualData->iStoredRenderBuffer);
+    
         TBool semiTranparentEffectActive = Effect()->IsSemitransparent();
         if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive))
             {
@@ -356,7 +363,8 @@
             !HasCommandBuffers(ETrue /*include children*/) && 
             !IsBackgroundDrawingEnabled() &&
             !IsExternalContentDrawingEnabled()&&
-            !IsExternalContentDrawingEnabled(ETrue /*include children*/))
+            !IsExternalContentDrawingEnabled(ETrue /*include children*/) &&
+            !hasStoredContent )
             {
             return ETrue;
             }
@@ -451,22 +459,27 @@
         transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent
                 
         TBool refreshCache = EFalse;        
+        TBool layer =  EFalse;
         if (EffectIsAppliedToChildren())
             {
             refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect);
 
             iCanvasVisualData->iPaintedRegion.Clear();
-            CollectRecursivePaintedRegion(iCanvasVisualData->iPaintedRegion, EHuiCanvasFlagExcludeFromParentEffect);
+            layer = CollectRecursivePaintedRegion(iCanvasVisualData->iPaintedRegion, EHuiCanvasFlagExcludeFromParentEffect);
             }
         else
             {
             refreshCache |= Changed();            
 
             iCanvasVisualData->iPaintedRegion.Clear();
-            CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0);
+            layer = CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0);
             }
-        
-        didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion);
+
+        if(Display()->RosterImpl().AlfEventWindow() == this)
+            {
+            refreshCache |= Display()->RosterImpl().NativeAppsContentChanged();
+            }
+        didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion,layer );
         
         }
     
@@ -536,10 +549,10 @@
         RDebug::Print(_L("CHuiCanvasVisual::DrawSelf - tracked visual"));
         }
 #endif		
-      
+    TBool alfEventWindow = (Display()->RosterImpl().AlfEventWindow() == this);
     TReal32 effectiveOpacity = EffectiveOpacity();
-        
-    if (effectiveOpacity <= 0 || !HasCommandBuffers(ETrue))
+    TBool hasStoredContent = (IsContentDrawingEnabled() && (IsDelayedEffectSource() || Freezed())) && (StoredRenderBuffer() || iCanvasVisualData->iStoredRenderBuffer);        
+    if ((effectiveOpacity <= 0 || !HasCommandBuffers(ETrue)) && !alfEventWindow && !hasStoredContent)
         {
         // In case background drawing is enabled, and even if we don't have command buffers we still
         // want to issue clear. If the background drawing is enabled here, it means that the
@@ -555,7 +568,7 @@
             }
         }
 
-    if (IsContentDrawingEnabled() && (IsDelayedEffectSource() || Freezed()))
+    if (hasStoredContent)
         {
         // Select right draw mode
         THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend;
@@ -572,6 +585,12 @@
             }
         }    
 
+    if(alfEventWindow)
+         {
+         Display()->RosterImpl().DrawNativeAppsContent(aGc, Display());
+         return;
+         }
+    
     // Use 'under opaque' hint to optimize drawing.
     // See comment from CHuiCanvasVisual::Draw for further details. 
     const TBool drawVisualContent = !( Flags() & EHuiVisualFlagUnderOpaqueHint );
@@ -997,6 +1016,7 @@
                     }                    
 
                 background.iPaintedRect = backgroundItems[aIndex].Rect();
+                backgroundItems.Close();
                 return background;
                 }
             else
@@ -1509,7 +1529,7 @@
 		}
     }
 
-void CHuiCanvasVisual::CollectPaintedRegion(TRegion& aPaintRegion, TInt aExcludeCanvasFlags) const
+TBool CHuiCanvasVisual::CollectPaintedRegion(TRegion& aPaintRegion, TInt aExcludeCanvasFlags) const
     {
     // Only our own painted areas.
     TInt paintedAreaCount = PaintedAreaCount();  
@@ -1518,12 +1538,13 @@
         aPaintRegion.AddRect( CanvasPaintedArea(i).iPaintedRect.Round() );
         }
     aPaintRegion.Tidy();
+    return !iCanvasVisualData->iLayerExtent.IsEmpty();
     }
 
-void CHuiCanvasVisual::CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const
+TBool CHuiCanvasVisual::CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const
     {
     // First our own painted areas...
-    CollectPaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
+    TBool layer = CollectPaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
             
     // ...then children (and their children).
     const TInt count = Count();
@@ -1543,13 +1564,14 @@
                     if (visual->Flags() & EHuiVisualFlagWserv)
                         {
                         CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)visual;
-                        canvasVisual->CollectRecursivePaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
+                        layer |= canvasVisual->CollectRecursivePaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
                         }
                     }
                 }        
             }
         }    
     aRecursivePaintRegion.Tidy();
+    return layer;
     }
 
 EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation)
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -582,6 +582,11 @@
     	}
     // We must only transform the (new) dirtyregion, not combine or anything else here
     aDirtyRegion = transformedNewDirtyRect;
+    
+    if(iScanningAlfContent)
+        {
+		SetAlfContentChanged(ETrue);
+        }
     }
 
 
@@ -633,6 +638,7 @@
     startTime.UniversalTime();
 #endif
     
+    SetAlfContentChanged(EFalse);
     
     // Prevent display refresh, if the display is on background.
     if(!iOnForeground || IsScreenBufferLocked())
@@ -1612,6 +1618,21 @@
 #endif
     }
 
+void CHuiDisplay::ScanningAlfContent(TBool aScanning )
+    {
+    iScanningAlfContent = aScanning;
+    }
+
+void CHuiDisplay::SetAlfContentChanged(TBool aChanged)
+    {
+    iDisplayContainsChangedAlfContent = aChanged;
+    }
+
+TBool CHuiDisplay::AlfContentChanged()
+    {
+    return iDisplayContainsChangedAlfContent;
+    }
+
 void CHuiDisplay::ClipDirtyRect(TRect& aRect, TRect aClippingRect)
     {
     if (aRect.Intersects(aClippingRect))
@@ -1771,36 +1792,33 @@
 
 void CHuiDisplay::DoBackgroundClear()
     {
-    if(iForegroundTextureTransparency) // alf application is visible -> clear background as requested 
+    // Clear background for the dirty area
+    TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
+    if (iBackgroundItems.Count() != 0)
         {
-        // Clear background for the dirty area
-        TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
-        if (iBackgroundItems.Count() != 0)
+        ClearWithBackgroundItems(dirtyRect);    
+        }
+    else
+        {
+        switch (iClearBackground)
             {
-            ClearWithBackgroundItems(dirtyRect);    
-            }
-        else
-            {
-            switch (iClearBackground)
+            case EClearWithColor:
                 {
-                case EClearWithColor:
-                    {
-                    ClearWithColor(dirtyRect);                            
-                    break;    
-                    }
-                case EClearWithSkinBackground:
-                    {
-                    ClearWithSkinBackground(dirtyRect);                                                    
-                    break;    
-                    }
-                case EClearNone:
-                default:
-                    {
-                    // Don't do anything
-                    break;    
-                    }                                                
-                }                                    
-            }
+                ClearWithColor(dirtyRect);                            
+                break;    
+                }
+            case EClearWithSkinBackground:
+                {
+                ClearWithSkinBackground(dirtyRect);                                                    
+                break;    
+                }
+            case EClearNone:
+            default:
+                {
+                // Don't do anything
+                break;    
+                }                                                
+            }                                    
         }
     }
 
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -261,13 +261,13 @@
 TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque)
     {
     RRegion dummy;
-    TBool ret = CachedDraw(aGc, aDisplayRect, aRefreshCachedRenderTarget, aOpaque, dummy);
+    TBool ret = CachedDraw(aGc, aDisplayRect, aRefreshCachedRenderTarget, aOpaque, dummy,EFalse);
     dummy.Close();
     return ret;
     }
 
 // TODO: effect area should be reduced if aClipRegion is smaller than aDisplayRect.
-TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TInt aAlpha)
+TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TBool aHasSurface, TInt aAlpha)
     {
 #ifdef HUIFX_TRACE    
     RDebug::Print(_L("CHuiFxEffect::CachedDraw - 0x%x"), this);
@@ -364,7 +364,7 @@
             if (cachedRenderTargetNeedsRefresh)
                 {
                 // Render to cached render target
-                iRoot->Draw(*iEngine, aGc, *iCachedRenderTarget, *iCachedRenderTarget);                
+                iRoot->Draw(*iEngine, aGc, *iCachedRenderTarget, *iCachedRenderTarget, aHasSurface);                
 #ifdef HUIFX_TRACE    
                 RDebug::Print(_L("CHuiFxEffect::CachedDraw - refreshed cached render buffer 0x%x"), this);
 #endif
@@ -420,13 +420,13 @@
             }
         
         // Normal drawing
-        iRoot->Draw(*iEngine, aGc, *target, *target);
+        iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
         }
                 
     return ETrue;    
     }
 
-EXPORT_C TBool CHuiFxEffect::Draw(CHuiGc& aGc, const TRect& aDisplayRect)
+EXPORT_C TBool CHuiFxEffect::Draw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aHasSurface)
     {
     // Prepare all layers
 #ifdef HUIFX_TRACE    
@@ -483,7 +483,7 @@
         return EFalse;
         }
 
-    iRoot->Draw(*iEngine, aGc, *target, *target);
+    iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
     return ETrue;
     }
 
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxFilterLayer.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxFilterLayer.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -90,7 +90,7 @@
     iFilter->AdvanceTime(aElapsedTime);
     }
 
-EXPORT_C void CHuiFxFilterLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource)
+EXPORT_C void CHuiFxFilterLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface)
     {
 #ifdef HUIFX_TRACE 
 	RDebug::Print(_L("CHuiFxFilterLayer::Draw - 0x%x "), this);
@@ -107,7 +107,7 @@
     TRect targetRect(TPoint(0, 0), TargetRect().Size());
     TInt alpha = 0xff; // TODO
 
-    iFilter->Draw(aEngine, aGc, *backBuffer, aSource, targetRect, SourceRect());
+    iFilter->Draw(aEngine, aGc, *backBuffer, aSource, targetRect, SourceRect(), aHasSurface);
 
     // Composite the result
     TRect compositionSourceRect(targetRect);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxGroupLayer.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxGroupLayer.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -172,7 +172,7 @@
     }
 
 EXPORT_C void CHuiFxGroupLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, 
-                                     CHuiFxRenderbuffer& aSource)
+                                     CHuiFxRenderbuffer& aSource, TBool aHasSurface)
     {
 #ifdef HUIFX_TRACE    
     RDebug::Print(_L("CHuiFxGroupLayer::Draw - 0x%x "), this);
@@ -230,7 +230,7 @@
     
     for (TInt i = 0; i < iLayers.Count(); i++)
         {
-        iLayers[i]->Draw(aEngine, aGc, *backBuffer, *sourceBuffer);
+        iLayers[i]->Draw(aEngine, aGc, *backBuffer, *sourceBuffer, aHasSurface);
         }
 
     // The root group does not support composition
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -233,7 +233,7 @@
     return ETrue;
     }
 
-EXPORT_C void CHuiFxVisualLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer &aTarget, CHuiFxRenderbuffer& /*aSource*/)
+EXPORT_C void CHuiFxVisualLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer &aTarget, CHuiFxRenderbuffer& /*aSource*/, TBool /*aHasSurface*/)
     {
 #ifdef HUIFX_TRACE    
     RDebug::Print(_L("CHuiFxVisualLayer::Draw - 0x%x "), this);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -504,7 +504,7 @@
             iEffect->ForceCachedRenderTargetUsage(ETrue);
             }        
         RRegion dummy;
-        didDrawEffect = iEffect->CachedDraw(aGc, displayRect, refreshCache, opaque, dummy, iEffectOpacity*255);        
+        didDrawEffect = iEffect->CachedDraw(aGc, displayRect, refreshCache, opaque, dummy, EFalse, iEffectOpacity*255);        
         dummy.Close();
         }
     
@@ -543,8 +543,6 @@
         return;
         }
     
-    // this was moved here because otherwise background clear did never end up to effect canvas buffers
-    display->DoBackgroundClear();
     
     TInt visualCount = 0;
     TInt entryCount = iEntries.Count();
@@ -553,7 +551,14 @@
         {
         CHuiRosterEntry& entry = *iEntries[j]; 
         CHuiControlGroup& group = entry.ControlGroup();
-
+        CHuiControl& control = group.Control(0);
+        
+        // skip all  alf client session drawing
+        if(control.Role() == EHuiSessionContainer )
+            {
+            continue;
+            }
+        
         // Init model matrix always for every group
         //aGc.LoadIdentity(EHuiGcMatrixModel);        
         aGc.Push(EHuiGcMatrixModel);
@@ -711,6 +716,121 @@
         }
     }
 
+void CHuiRosterImpl::SetAlfEventWindow(CHuiVisual* aVisual)
+    {
+    iAlfEventWindowVisual = aVisual;
+    }
+
+const CHuiVisual* CHuiRosterImpl::AlfEventWindow()
+    {
+    return iAlfEventWindowVisual;
+    }
+
+TBool CHuiRosterImpl::NativeAppsContentChanged()
+    {
+    // if we have multiple frames where alf content was changed, skip every other frame
+	// this should be only used if whole alf content has effect (is faded)
+    TBool alfContentChanged = iDisplay->AlfContentChanged();
+    if(!iPreviousAlfContentDrawn && alfContentChanged)
+        {
+        iPreviousAlfContentDrawn = ETrue;
+        }
+    else
+        {
+        iPreviousAlfContentDrawn = EFalse;
+        }
+    return iPreviousAlfContentDrawn;
+    }
+
+
+void CHuiRosterImpl::DrawNativeAppsContent(CHuiGc &aGc, CHuiDisplay* aDisplay) const
+    {
+    TInt i = 0;
+    TInt j = 0;
+
+    CHuiDisplay* display = aDisplay ? aDisplay : iDisplay;
+    
+    ASSERT(display!=NULL);
+
+    TBool clearDone = EFalse;
+    
+    TInt visualCount = 0;
+    TInt entryCount = iEntries.Count();
+    // Draw the visuals tree in the display.
+    for(j = 0; j < entryCount; ++j)
+        {
+        CHuiRosterEntry& entry = *iEntries[j]; 
+        CHuiControlGroup& group = entry.ControlGroup();
+        CHuiControl& control = group.Control(0);
+        // skip all but alf client session drawing
+        if(control.Role() != EHuiSessionContainer )
+            {
+            continue;
+            }
+        
+        // skip inactive
+        CHuiLayout* hostContainer = control.ContainerLayout( NULL );
+        if(hostContainer->Flags() & EHuiVisualFlagInactive )
+            {
+            continue;
+            }
+        
+        // Init model matrix always for every group
+        //aGc.LoadIdentity(EHuiGcMatrixModel);        
+        aGc.Push(EHuiGcMatrixModel);
+        
+        // Set up display-specifc transformations i.e. camera transformations       
+        display->Transformation().Execute(EHuiGcMatrixModel, aGc);
+        
+        // Set up a group-specific transformation.
+        if(group.IsTransformed())
+            {
+            group.Transformation().Execute(EHuiGcMatrixModel, aGc);
+            }
+        
+        // Draw visuals
+        visualCount = entry.iRootVisuals.Count();
+        for(i = 0; i < visualCount; ++i)
+            {
+            CHuiVisual* visual = entry.iRootVisuals[i];
+            //Ignore inactive visuals
+            if ( visual->Flags()& EHuiVisualFlagInactive || visual->LoadingEffect() )
+                {
+                continue; 
+                }
+            
+            if(!clearDone)
+                {
+                // only do clear if we really draw some alf native content
+                display->DoBackgroundClear();
+                clearDone = ETrue;
+                }
+            
+            visual->Draw(aGc);
+            
+            }       
+
+        if( display->DrawVisualOutline() != CHuiDisplay::EDrawVisualOutlineNone )
+            {           
+            for(i = 0; i < visualCount; ++i)
+                {   
+                // Draw Visual Outline depending on central repository setting
+                // and visual flag value
+                const TBool drawOutline =
+                    ( entry.iRootVisuals[i]->Flags() & EHuiVisualFlagEnableDebugMode ) ||  
+                    ( display->DrawVisualOutline() == CHuiDisplay::EDrawVisualOutlineAllVisuals );
+                
+                DrawBoundaries( aGc, entry.iRootVisuals[i], drawOutline );        
+                }
+            }
+        
+        aGc.Pop(EHuiGcMatrixModel);        
+        }
+    }
+
+
+
+
 void CHuiRosterImpl::DrawBoundaries( CHuiGc& aGc, CHuiVisual* aVisual, TBool aDrawOutline ) const
 	{
     if( aDrawOutline )
@@ -995,8 +1115,8 @@
         if(iDisplay)
             {
             iDisplay->AddDirtyRegion(iRect);
+            iDisplay->SetAlfContentChanged(ETrue);
             }
-        
         SetChanged(EFalse);
         return;
         }
@@ -1019,7 +1139,28 @@
            		{
            		continue; 
            		}
+            
+             CHuiControlGroup& group = entry.ControlGroup();
+             CHuiControl& control = group.Control(0);
+             
+             if(control.Role() == EHuiSessionContainer )
+                 {
+                 if (iDisplay)
+                     {
+                     iDisplay->ScanningAlfContent(ETrue);
+                     }
+                 
+                 }
+             
             entry.iRootVisuals[i]->ReportChanged();
+            
+            if(control.Role() == EHuiSessionContainer )
+                {
+                if(iDisplay)
+                    {
+                    iDisplay->ScanningAlfContent(EFalse);
+                    }
+                }
             }
         }
     }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -156,6 +156,19 @@
         delete iVisualData->iStoredRenderBuffer;
         iVisualData->iStoredRenderBuffer = aRenderBuffer;
         }
+    else
+        {
+        if (aRenderBuffer != iVisualData->iStoredRenderBuffer)
+            {
+#ifdef _DEBUG
+            RDebug::Printf("CHuiVisual::SetStoredRenderBuffer - Warning: Not enabled (%x / %x)", 
+                aRenderBuffer, iVisualData->iStoredRenderBuffer);
+#endif
+            // Ownership was passed, but we do not need it.
+            delete aRenderBuffer;
+            aRenderBuffer = NULL;
+            }
+        }
     }
 EXPORT_C void CHuiVisual::SetStoredRenderBufferModificationsEnabled(TBool aEnabled)
     {
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -248,7 +248,7 @@
 TRect CHuiCanvasPainter::CommandBufferCoverage(TInt aOrientation)
     {
     TInt bufferCount = iCommandBuffers.Count();
-    RRegion tempRegion;
+    RRegionBuf<1> tempRegion;
     
     for (TInt cb = 0; cb < bufferCount; cb++)
         {        
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -51,6 +51,15 @@
 
 #include "HuiCmdBufferBrush.h"
 
+#include "alfmoduletestconf.h"
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    // Provides TLS object data for test cases.
+    // This is used only if module test hooks are set on.
+    #include "huistatictlsdata.h"
+#endif // USE_MODULE_TEST_HOOKS_FOR_ALF
+// Provides module test hook defines.
+#include "alfmoduletestdefines.h"
+
 /** 
  * Constants to define enabling/disabling render buffer automatically 
  *  incase there are frequently new buffers posted. 
@@ -2387,15 +2396,16 @@
                 }
             
             CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb];
+            // Translate region to be relative to visual top left corner.
+            TPoint offset = -cmdbuffer->iOriginalDisplayRect.Round().iTl;
+
             for (TInt j=0; j < cmdbuffer->iOriginalUpdateRegion.Count();j++)
                 {
-                iTempRegion.AddRect(cmdbuffer->iOriginalUpdateRegion[j]);        
+                TRect rect = cmdbuffer->iOriginalUpdateRegion[j];
+                rect.Move(offset);
+                iTempRegion.AddRect(rect);
                 }
-            
-            // Translate region to be relative to visual top left corner.
-            TPoint offset = -cmdbuffer->iOriginalDisplayRect.Round().iTl;
-            iTempRegion.Offset(offset);
-            
+                        
             // Check older buffers for overlapping regions against current buffer
             if (cb > 0)
                 {                   
@@ -2745,6 +2755,8 @@
     CHuiCanvasWsGc* realGc = iCanvasWsGc;
     iCanvasWsGc = CHuiCanvasDebugWsGc::NewL( realGc, *iCommandDebugger );
     #endif
+    
+    AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC();
     }
 
 void CHuiCanvasWsPainter::RenewAllBuffers()
--- a/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Fri Jun 11 14:31:43 2010 +0300
@@ -265,6 +265,8 @@
     TUint iCurrentPluginRun;
     RArray<TInt> iLowOnMemWgs;
     TBool iUseSwRendering;
+    TBool iTryOptional; // we did everything we could but still missing some bits, try again with different app targets
+    TBool iOptionalTried; // no need to overperform though
     };
 
 #include "goomactionlist.inl"
--- a/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Fri Jun 11 14:31:43 2010 +0300
@@ -42,10 +42,10 @@
     static CGOomWindowGroupList* NewL(RWsSession& aWs);
     
     // Update the list of window groups
-    void RefreshL();
+    void RefreshL(TBool aOptionalOnly = EFalse);
     
     // Update the list of window groups, non-leaving version
-    void Refresh();
+    void Refresh(TBool aOptionalOnly = EFalse);
     
     // Return the number of application instances in this list
     inline TUint Count() const;
@@ -133,6 +133,7 @@
     CApaWindowGroupName* iWgName;
     HBufC* iWgNameBuf;              // owned by iWgName
     RArray<TInt> iLowOnMemWgs;
+    RArray<TInt> iOptionalUids;
     RAlfBridgerClient iAlfClient;
     };
 
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -217,7 +217,7 @@
 //    iActionRefs.Reset();
 //    iCurrentActionIndex = 0;
     
-    aWindowGroupList.RefreshL();
+    aWindowGroupList.RefreshL(iTryOptional);
     
     for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
         {
@@ -426,11 +426,23 @@
     if (!memoryFreeingActionRun)
         {
         // No usable memory freeing action has been found, so we give up
-        TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
         TInt freeMemory;
-        FreeMemoryAboveTarget(freeMemory);
-        iServer.CloseAppsFinished(freeMemory, EFalse);
-        iMonitor.WaitAndSynchroniseMemoryState();
+
+        if ( !FreeMemoryAboveTarget(freeMemory) && !iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
+            { 
+            iTryOptional = ETrue;
+            iOptionalTried = ETrue;
+            iMonitor.RunCloseAppActions(iMaxPriority);
+            }
+        else
+            {
+            iTryOptional = EFalse;
+            iOptionalTried = EFalse;
+
+            TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
+            iServer.CloseAppsFinished(freeMemory, EFalse);
+            iMonitor.WaitAndSynchroniseMemoryState();
+            }
         }
     }
 
@@ -636,8 +648,18 @@
                     MemoryGood();
                     }
                      */
-                    iServer.CloseAppsFinished(freeMemory, EFalse);
-                    iMonitor.WaitAndSynchroniseMemoryState();
+                    if (!iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
+                        { 
+                        iTryOptional = ETrue;
+                        iOptionalTried = EFalse;
+                        iMonitor.RunCloseAppActions(iMaxPriority);
+                        }
+                    else
+                        {
+                        iTryOptional = EFalse;       
+                        iServer.CloseAppsFinished(freeMemory, EFalse);
+                        iMonitor.WaitAndSynchroniseMemoryState();
+                        }
                     }
                 else
                     {
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -502,6 +502,7 @@
         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);
         }
+    WgIdList.Close();
     }
 
 void CMemoryMonitor::SetPriorityNormal(TInt aWgId)
@@ -519,6 +520,7 @@
         if(iGOomActionList->IsRunningKillAppActions())
             AppClosePriorityChanged(WgIdList[i], RGOomMonitorSession::EGOomPriorityNormal);
         }
+    WgIdList.Close();
     }
 
 void CMemoryMonitor::SetPriorityHigh(TInt aWgId)
@@ -536,6 +538,7 @@
         if(iGOomActionList->IsRunningKillAppActions())
             AppClosePriorityChanged(WgIdList[i], RGOomMonitorSession::EGOomPriorityHigh);
         }
+    WgIdList.Close();
     }
 
 TInt CMemoryMonitor::GetFreeMemory()
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -43,18 +43,18 @@
     }
 
 // Update the list of window groups
-void CGOomWindowGroupList::Refresh()
+void CGOomWindowGroupList::Refresh(TBool aOptionalOnly)
     {
     FUNC_LOG;
     
 #ifdef _DEBUG
-    TRAPD(err, RefreshL());
+    TRAPD(err, RefreshL(aOptionalOnly));
     if (err)
         {
         TRACES1("CGOomWindowGroupList::Refresh(): RefreshL leave %d", err);
         }
 #else
-    TRAP_IGNORE(RefreshL());
+    TRAP_IGNORE(RefreshL(aOptionalOnly));
     // Ignore any error
     // Errors are very unlikely, the only possibility is OOM errors (which should be very unlikely due to pre-created, re-reserved lists)
     // The outcome of any error is that the most foreground operations will be missing from the list
@@ -64,7 +64,7 @@
 
 // Update the list of window groups
 // Should be called whenever the 
-void CGOomWindowGroupList::RefreshL()
+void CGOomWindowGroupList::RefreshL(TBool aOptionalOnly)
     {
     FUNC_LOG;
   
@@ -76,9 +76,27 @@
     RArray<TInt> inactiveSurfaces;
 
     // ignore possible errors, we have information from profiling extension anyway
-    iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
-    iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
+    if (!aOptionalOnly)
+        {
+        iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
+        iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
+        }
+    else
+        { // first iteration: try to cope with window group ID's only
+          // Most likely that needs to be revisited because apps fail to name their window 
+          // groups properly on external screens...  
+        iAlfClient.GetOptionalGraphicsMemUsers(&inactiveSurfaces);    
+        iOptionalUids.Reset();
+        TInt count = inactiveSurfaces.Count(); 
+        for (TInt i = 0; i<count-1; i++)
+            {
+            iOptionalUids.Append(inactiveSurfaces[i+1]);
+            inactiveSurfaces.Remove(i+1);
+            count--;
+            }   
+        }
         
+    TRACES1("Optional list composed: %d", aOptionalOnly);     
     TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
     TRACES1("Windowgroups w/ surfaces count %d", iLowOnMemWgs.Count());     
 
@@ -86,17 +104,17 @@
     RArray<TUint> privMemUsed;
     RArray<TUint64> sparedProcessIds;
     
-   //if (inactiveSurfaces.Count() == 1) // ALF only 
-   //     {
-    NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+   if (!aOptionalOnly)
+      {
+      NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
     
-    if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
+      if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
         {
         TRACES("RefreshL EGL_NOK_resource_profiling not available");
         return;
         }
     
-    if (eglQueryProfilingData)
+     if (eglQueryProfilingData)
         {
         EGLint data_count;
         EGLint* prof_data;
@@ -206,7 +224,7 @@
                 }
             }
         }
-                
+      }            
     // Refresh window group list
     // get all window groups, with info about parents
     TInt numGroups = iWs.NumWindowGroups();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -456,13 +456,8 @@
 	    }
 	 
 	TInt err = KErrNone;    
-	TInt action = 0;
 	const CTransitionData* transdata;
 	err = iClient->GetTransitionData( aHandle, transdata );
-	if ( err == KErrNone )
-	    {
-    	action = transdata->iAction;
-	    }
 
 	switch(aState)
 		{
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Fri Jun 11 14:31:43 2010 +0300
@@ -42,7 +42,6 @@
 	virtual TUint& Action() = 0;
 	virtual TInt& Flags() = 0;
 	virtual void IncreaseControlHandle() = 0;
-	virtual void IncreaseFullScreenHandle() = 0;
 	virtual TInt CurrentControlHandle() = 0;
 	virtual TInt CurrentFullScreenHandle() = 0;
 	virtual void StartEndChecker() = 0;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Fri Jun 11 14:31:43 2010 +0300
@@ -95,7 +95,6 @@
 	void IncreaseControlHandle();
 	TInt CurrentControlHandle();
 	
-	void IncreaseFullScreenHandle();
 	TInt CurrentFullScreenHandle();
 	
 	void StartEndChecker();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -43,8 +43,15 @@
 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, 
 // this will stop the effect.
 const TInt KAlfShortEffectTimeout     = 4000000;
+
+// Note, The timeouts are DIFFERENT for EMULATOR AND ARMV5
+#ifdef __WINS__
+const TInt KAlfAppStartEffectTimeout  = 800000;
+const TInt KAlfLongEffectTimeout      = 10000000;
+#else
 const TInt KAlfAppStartEffectTimeout  = 300000;
 const TInt KAlfLongEffectTimeout      = 5000000;
+#endif
 const TInt KAlfActiveControlFxGranularity = 4;
 const TInt KAlfLongApplicationStartContext = 20;
 
@@ -671,7 +678,7 @@
     // I don't think we need this
     TInt index = 0;
 
-    IncreaseFullScreenHandle();
+    iCurrentFullScreenHandle = iToSid.iId;
 
     iFullScreenTransitionEndObserver->Cancel();
     iFinishFullScreen->Cancel();
@@ -685,9 +692,10 @@
         RMemWriteStream stream( bridgeBuffer, bufferSize );
         // The writes should not leave if we have calculated our buffer length correctly.
         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
-        stream.WriteInt32L(  iToSid.iId ); //iCurrentFullScreenHandle );
+        stream.WriteInt32L(  iToSid.iId );
         stream.WriteInt32L( iType );
-        stream.WriteInt32L( 0 ); // timeout triggered
+        stream.WriteInt32L( 0 ); // timeout? 0 always in BeginFullScreen
+        stream.WriteInt32L( 0 );
       	if ( iType == AknTransEffect::EParameterType && isExit )
       	    {
             stream.WriteInt32L( iToWg );
@@ -810,7 +818,7 @@
     // It appears that folder open and close never send endfullscreen, so for them the effect
     // must be started as soon as we get beginfullscreen
     
-    isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
+    // isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
 	
     if (isAppStartEffect)
         {
@@ -837,13 +845,14 @@
         __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen END no need");
         return KErrNone;
         }
-    iFullScreenEndSent = ETrue;
         
     __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
     iFullScreenTransitionEndObserver->Cancel();
     iFullScreenTimeout->Cancel();
     iFinishFullScreen->Cancel();
+    TBool timeout = iFullScreenTimeout->iTimeoutTriggered;
     TBool triggerStartEffectTimeout= iFullScreenTimeout->iTimeoutTriggered && iFullScreenTimeout->iIsStartEffect;
+    iFullScreenEndSent = !triggerStartEffectTimeout;
     iFullScreenTimeout->iTimeoutTriggered = EFalse;
     iFullScreenTimeout->iIsStartEffect = EFalse;
     
@@ -879,7 +888,7 @@
     // also the effect file name or something else to identify the effect 
     // that is going to be used
     
-    TInt bufferSize = 12 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
+    TInt bufferSize = 13 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
     bufferSize += sizeof(TPtrC);
     bufferSize += resourceDir.Length() * 2;
     bufferSize += sizeof(TPtrC);
@@ -904,6 +913,7 @@
             stream.WriteInt32L( iCurrentFullScreenHandle );
             stream.WriteInt32L( iType );
             stream.WriteInt32L( triggerStartEffectTimeout );
+            stream.WriteInt32L( timeout );
             stream.WriteInt32L( iToWg );
             stream.WriteInt32L( iFromWg );
 
@@ -934,6 +944,10 @@
 
     iFullScreenFinished = EFalse;
     iFullScreenTimeout->iIsStartEffect = EFalse;
+    if (triggerStartEffectTimeout)
+        {
+        return KErrNone;
+        }
     if ( iAction == AknTransEffect::EApplicationExit /*||
         iAction == 1001*/  ) 
         {
@@ -1286,13 +1300,6 @@
     highestHandle++;
     iCurrentControlHandle = highestHandle; 
 	}
-	
-void CAlfServerDrawer::IncreaseFullScreenHandle()
-    {
-    TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
-    highestHandle++;
-    iCurrentFullScreenHandle = highestHandle;
-    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
@@ -1339,7 +1346,7 @@
         iFullScreenTimeout->Cancel();
         // If we don't get an EndFullScreen in a timely manner, 
         // we generate an EndFullScreen signal by ourselves
-        EndFullscreen();
+        EndFullscreen(ETrue);
         }
     }
 
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -238,6 +238,9 @@
 				return CPhase1State::NewL(iEngine,iHandler);
 				}
 			return NULL;
+	     case EEndFullscreen:
+	            iEngine.SendEndFullscreen();
+	        return NULL;
 		case EBeginComponent:
 		    error = iEngine.SendBeginControlTransition();
 		    if ( error == KErrNone )
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp	Thu May 27 13:47:19 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp	Fri Jun 11 14:31:43 2010 +0300
@@ -66,7 +66,8 @@
 		// startup blocked because startup exit leaves the screen black.
 		// must be debugged
         0x100058F4, // startup blocked for the time being
-        0x101f857A // camera
+        0x101f857A, // camera
+        0x2002d07f	// ovistore_2002D07F.exe, this does not draw anything, but launcher 
         // Application shell is Ok, folder open and close have KAknApplicationShellViewId
         // as both to and from ids. There is only one visual, so some sort of blur effect works...
 		//, KAknApplicationShellViewId
@@ -84,8 +85,8 @@
     {
 	0x0, // DO NOT REMOVE 0x0! this is here for compile reasons, it will not be included in the AllowedCustomUid check
     0x101f857A, // camera
-    0x2002A540  // conversation.exe , other launchable from messaging don't have effect either
-
+    0x2002A540,  // conversation.exe , other launchable from messaging don't have effect either
+    0x2002d07f // ovistore_2002D07F.exe, this does not draw anything, but launcher 
   //0xUID //Add UIds of applications that shouldn't have effects here
 	};
 
@@ -485,7 +486,7 @@
             }
         
         iAppInfo[index].iAction = aAction;
-        RDebug::Printf("CAppInfoCache::SetAction - Returned action %d", iAppInfo[index].iAction);
+        __ALFFXLOGSTRING1("CAppInfoCache::SetAction - Returned action %d", iAppInfo[index].iAction);
         return iAppInfo[index].iAction;
     }
 
@@ -804,15 +805,14 @@
 	//we should know if its a dsa app before end can be called
 	if(iDSAActive)
 	    {
-        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - DSA active. Abort.");
 	    return; //Do nothing if dsa active.
 	    }
 
 	//Special argument calls does not initiate any FS effect and is caught here.
-	// TODO: remove && !iEngine->WaitingForRootWgId() when appuids available from wserv
 	if(fstype == CStateHandler::ENone) 
 		{
-        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Special argument. Abort.");
 		return;
 		}