Revision: 201020 RCL_3 PDK_3.0.0
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 25 May 2010 13:39:57 +0300
branchRCL_3
changeset 24 f93c875b566e
parent 22 7c5dd702d6d3
child 34 3a60ebea00d0
Revision: 201020 Kit: 2010121
rom/alfred.iby
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/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/src/alfcompositionclient.cpp
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp
uiacceltk/hitchcock/CommonInc/alfmoduletest.h
uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.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/Src/alfappserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.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/alfscreen.cpp
uiacceltk/hitchcock/ServerCore/Src/alfsrvcontrolgroupsubsession.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp
uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h
uiacceltk/hitchcock/coretoolkit/rendervg10/group/huirendervg10.mmp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.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/HuiRosterImpl.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
uiacceltk/hitchcock/group/core_exports.inc
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
--- a/rom/alfred.iby	Tue May 11 17:03:00 2010 +0300
+++ b/rom/alfred.iby	Tue May 25 13:39:57 2010 +0300
@@ -101,6 +101,7 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_activate.fxml RESOURCE_FILES_DIR/effects/app_activate.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_exit.fxml RESOURCE_FILES_DIR/effects/app_exit.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start.fxml RESOURCE_FILES_DIR/effects/app_start.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_long.fxml RESOURCE_FILES_DIR/effects/app_start_long.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_rect.fxml RESOURCE_FILES_DIR/effects/app_start_rect.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_switch.fxml RESOURCE_FILES_DIR/effects/app_start_switch.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_switch_rect.fxml RESOURCE_FILES_DIR/effects/app_start_switch_rect.fxml
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Tue May 25 13:39:57 2010 +0300
@@ -177,6 +177,8 @@
     void EndPointerEventHandling();
     void UpdateActiveSession(CAlfAppSrvSessionBase* aSession);
     
+    CAlfAppSrvSessionBase* ActiveSession();
+    
     TTypeUid::Ptr MopSupplyObject(TTypeUid aId);
 
     TInt FirstAlfControlGroupIndex( TInt aScreenNumber = 0);    
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiRoster.h	Tue May 25 13:39:57 2010 +0300
@@ -234,6 +234,8 @@
     
     virtual TBool IsVisibleContentFrozen() const = 0;
     
+    virtual void SetAlfEventWindow(CHuiVisual* aVisual) = 0;
+    
 protected:
 
     /* Constructors. */
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp	Tue May 25 13:39:57 2010 +0300
@@ -1363,6 +1363,10 @@
 
 EXPORT_C void CAlfEffectObserver::SetDistractionWindow(const RWindowTreeNode& aWindow, TInt aState)
     {
+    if (!&aWindow)
+        {
+        return;
+        }
     iData->iClient.SendSynch(EAlfSetDistractionWindow, TIpcArgs(aWindow.WindowGroupId(), aWindow.ClientHandle(), aState));
     }
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Tue May 25 13:39:57 2010 +0300
@@ -22,9 +22,18 @@
 #include "alfuids.h"
 
 _LIT(KAlfServerThreadName, "alfredserver");
+
+
+// Implements just Error() to avoid panic
+NONSHARABLE_CLASS(CSimpleScheduler) : public CActiveScheduler
+    {
+    void Error( TInt ) const{} // From CActiveScheduler
+    };
+
+
 static void RunServerL()
     {
-    CActiveScheduler* s=new(ELeave) CActiveScheduler;
+    CActiveScheduler* s=new(ELeave) CSimpleScheduler;
     CleanupStack::PushL(s);
     CActiveScheduler::Install(s);
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Tue May 25 13:39:57 2010 +0300
@@ -25,7 +25,7 @@
 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
 
-
+const TInt KMaxSimultMeasurementCount = 10;
 /*
  *  Class CAlfModuleTestData
  */
@@ -224,6 +224,18 @@
     TInt iASE_Temp3;
     TInt iASE_Temp4;
 
+    class TSpeedTest
+    {
+    public:
+        TInt64 iHandle;
+        TInt iCounter;
+        TBool iEffects;
+        TInt64 iTimeStamp[5];
+    };
+    
+    TSpeedTest iTimeMap[10];
+    TInt iNextFreeMap;
+        
     // Map that contains boolean items for certain test cases.
     TAlfModuleTestMap< TBool > iBoolMap;        
     // Map that contains integer items for certain test cases.
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Tue May 25 13:39:57 2010 +0300
@@ -27,6 +27,11 @@
     #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 )
@@ -91,6 +96,11 @@
     #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 ) )
@@ -121,6 +131,16 @@
 // 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
+
 
 // Notice: 
 // Defines below will be empty if module test hook is not set.
@@ -153,14 +173,22 @@
         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorColor )
 
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER() \
-        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeRenderStageCreateLayer ); \
-        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeRenderStageReleaseLayer )
+        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 )
 
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \
-        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeRenderStageCreateLayer ); \
-        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeRenderStageReleaseLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeCreateLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeCreateLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeReleaseLayer ); \
+        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_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeRenderStageCreateLayer )
+        AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeCreateLayer )
+
+#define AMT_MAP_RENDER_STAGE_REMOVE_LAYER() \
+        AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeReleaseLayer )
 
 
 // Streamer defines
@@ -229,7 +257,38 @@
         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorFlag ); \
         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorColor )
 
-        
+#define AMT_MAP_BRIDGE_SET_ORDINAL_POSITION() \
+        AMT_MAP_SET_VALUE_IF( windowAttributes, iIntMap, windowNodeId, windowAttributes->iOrdinalPosition, EAlfModuleTestTypeLayerOrdinalPosition )
+
+#ifndef USE_MODULE_TEST_HOOKS_FOR_ALF
+#define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC()
+#else
+#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 ); \
+            }
+#endif // USE_MODULE_TEST_HOOKS_FOR_ALF
+
+#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
 
 // End of File
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h	Tue May 25 13:39:57 2010 +0300
@@ -45,7 +45,8 @@
      * Constructor to initialize variables.
      */
     TAlfModuleTestMap():
-        iArrayCount( 0 )
+        iArrayCount( 0 ),
+        iAcceptArrayCount( 0 )
         {
         }
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Tue May 25 13:39:57 2010 +0300
@@ -17,8 +17,6 @@
     EAlfModuleTestTypeNone,
     
     // Render stage component specific tests
-    EAlfModuleTestTypeRenderStageCreateLayer,
-    EAlfModuleTestTypeRenderStageReleaseLayer,
     EAlfModuleTestTypeRenderStageCreateWindow,
     EAlfModuleTestTypeRenderStageReleaseWindow,    
     EAlfModuleTestTypeRenderStageCreateWindowGroup,
@@ -64,10 +62,17 @@
     EAlfModuleTestTypeBridgeChangeTextCursorFlag,
     EAlfModuleTestTypeBridgeChangeTextCursorColor,
     EAlfModuleTestTypeBridgeVisualVisibility,
+    EAlfModuleTestTypeBridgeGoom,
     
     // Core toolkit component specific tests
     EAlfModuleTestTypeCoreToolkitDrawWindow,
     EAlfModuleTestTypeCoreToolkitDrawFromRenderBuffer,
+    EAlfModuleTestTypeCoreToolkitGoom,
+    
+    // Layer tests
+    EAlfModuleTestTypeCreateLayer,
+    EAlfModuleTestTypeReleaseLayer,    
+    EAlfModuleTestTypeLayerOrdinalPosition,    
     
     // 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Tue May 25 13:39:57 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
@@ -427,7 +431,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 +448,10 @@
             CHuiControl* aEffectControl,
             TBool aInsertTemporaryVisual,
             TBool& aItemDestroyed,
+            TBool aIsFullScreenEffect,
             TBool aIsExitEffect = EFalse,
-            TBool aCanDestroyOrHideImmediately = EFalse);
+            TBool aCanDestroyOrHideImmediately = EFalse
+            );
             
 
     /*
@@ -457,6 +463,7 @@
             CHuiLayout* aTargetLayout,
             CHuiControl* aEffectControlGroup,
             TInt& aItemsDestroyed,
+            TBool aIsFullScreenEffect,
             TBool aAddLayout = ETrue,
             TBool aIsExitEffect = EFalse,
             TBool aCanDestroyOrHideImmediately = EFalse);
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Tue May 25 13:39:57 2010 +0300
@@ -239,6 +239,7 @@
         TInt iToSecureId;
         TInt iFromSecureId;
         TRect iRect;
+        TBool iTimeoutTriggered;
         
         // ETrue if waiting for window group to appear
         TBool iWaitingWindowGroup;
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfscreen.h	Tue May 25 13:39:57 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/Src/alfappserver.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Tue May 25 13:39:57 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/alfappsrvsession.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Tue May 25 13:39:57 2010 +0300
@@ -1592,9 +1592,9 @@
 
         // If we are reusing deleted texture, remove it from "deleted" array
         TInt index = iTextures.Find(&texture);
-        if (index != KErrNotFound)
+        if (index == KErrNotFound)
            {
-           iTextures.Remove(index);                
+           iTextures.Append(env->TextureManager().Texture(id));                
            }                    
 
 
@@ -1727,9 +1727,9 @@
 
         // If we are reusing deleted texture, remove it from "deleted" array
         TInt index = iTextures.Find(&textureRef);
-        if (index != KErrNotFound)
+        if (index == KErrNotFound)
            {
-           iTextures.Remove(index);                
+           iTextures.Append(env->TextureManager().Texture(id));                
            }                    
         
         // Add texture to skin content
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Tue May 25 13:39:57 2010 +0300
@@ -154,6 +154,11 @@
             {
             iData->iSystemEvent.Complete(KErrCancel);
             }
+        
+        if ( iData->iContainer )
+            {
+            iHost->ReleaseContainer( *iData->iContainer );
+            }
         delete iData;
         }
     iHost = NULL;
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Tue May 25 13:39:57 2010 +0300
@@ -67,6 +67,12 @@
 #define ALF_USE_EMULATOR_LAYOUT_SWITCH_BUTTON
 #endif
 
+// Implements just Error() to avoid panic
+NONSHARABLE_CLASS(CSimpleScheduler) : public CActiveScheduler
+    {
+    void Error( TInt ) const{} // From CActiveScheduler
+    };
+
 NONSHARABLE_CLASS(TAlfEffectObserver): public MHuiEffectObserver
     {
     public:    
@@ -603,7 +609,7 @@
     if (err == KErrNone)
         {
         // Set up scheduler and cleanup stack for this thread
-        CActiveScheduler* scheduler = new CActiveScheduler;
+        CActiveScheduler* scheduler = new CSimpleScheduler();
         if (!scheduler)
             {
             return KErrNoMemory;
@@ -952,6 +958,11 @@
         }
     }
     
+CAlfAppSrvSessionBase* CAlfAppUi::ActiveSession()
+    {
+    return iData->iActiveSession;
+    }
+
 // ---------------------------------------------------------------------------
 // From class CAknAppUi.
 // Handles window server event.
--- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Tue May 25 13:39:57 2010 +0300
@@ -361,7 +361,7 @@
         TInt aClientSideGroupId,
         CHuiCanvasVisual* aVisual )
     {
-    __ALFFXLOGSTRING1("CAlfBridge::AddVisual 0x%x", aWindowNodeId);
+    __ALFFXLOGSTRING4("CAlfBridge::AddVisual id: %d (%d,%d), visual: 0x%x", aWindowNodeId, aClientSideId, aClientSideGroupId, aVisual);
     THashVisualStruct visualStruct( aVisual, aClientSideId, aClientSideGroupId);
     iWindowHashArray.Insert( aWindowNodeId, visualStruct );
     iPreviouslySearchedVisualId = aWindowNodeId;
@@ -406,7 +406,7 @@
         iPreviouslySearchedVisual = visualStruct->iVisual;
         return iPreviouslySearchedVisual; 
         }
-    __ALFFXLOGSTRING1("CAlfBridge::FindVisual - Visual 0x%x not found", aWindowNodeId);
+    __ALFLOGSTRING1("CAlfBridge::FindVisual - Visual 0x%x not found", aWindowNodeId);
     return NULL;
     }
 
@@ -664,13 +664,16 @@
                 TBool anyVisualHasEffect(EFalse);
                 TInt familyIndex(0);
                 TInt familySize = familyTree.Count();
+                TInt activeEffectIndex = KErrNotFound; 
                 while(familyIndex < familySize && !anyVisualHasEffect)
                     {
-                    anyVisualHasEffect = HasActiveEffect(familyTree[familyIndex++]);
+                    anyVisualHasEffect = HasActiveEffect(familyTree[familyIndex++], activeEffectIndex); 
+                    
                     }
                 
                 if (anyVisualHasEffect)
                     {
+                    TInt activeEffectHandle = iEffectCleanupStack[activeEffectIndex].iHandle;
                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
                     layout->SetFlags(EHuiVisualFlagShouldDestroy);
@@ -692,10 +695,16 @@
                     effectControlGroup.AppendL(layout, effectControlGroupLayout); // this will remove it from the previous layout
                     layout->SetOwner(effectControlGroup);
                     
-                    for(TInt familyIndex = 0; familyIndex < familyTree.Count();familyIndex++)
-                        {
-                        familyTree[familyIndex]->SetOwner(effectControlGroup);
-                        }
+                    for(TInt familyIndex = familyTree.Count() - 1; familyIndex >= 0; --familyIndex)
+                       {
+                       familyTree[familyIndex]->SetOwner(effectControlGroup);                      
+                       
+                       if (!HasActiveEffect(familyTree[familyIndex]))
+                           {
+                           TInt dummy;
+                           AddEffectItemL(activeEffectHandle, familyTree[familyIndex], NULL, NULL, EFalse, dummy, ETrue, EFalse);
+                           }
+                       }
                     }
                 else
                     {
@@ -710,6 +719,8 @@
                          if ( removedVisual != layout ) // let control group delete the layout
 					         {
 					         control.Remove(removedVisual); // remove ownership from the original control (group)
+					         __ALFFXLOGSTRING1("CAlfBridge::DeleteControlGroupL - adding to orphonage 0x%x", layout);
+					         RemoveTemporaryPresenterVisual(removedVisual);
 					         if ( removedVisual->Layout() == layout ) 
 					             {
 					             iOrphanStorage->AppendL( removedVisual );
@@ -762,7 +773,7 @@
         cntrl->ConstructL();
         group->AppendL(cntrl);
         CleanupStack::Pop(cntrl);
-        cntrl->SetRole(EAlfWindowGroupContainer);
+        cntrl->SetRole(EHuiWindowGroupContainer);
 
         layout = CHuiCanvasVisual::AddNewL(*cntrl);
         layout->SetTagL(KAlfWindowGroupContainerControlTag);
@@ -816,7 +827,7 @@
                 }
             }     
         entry.iScreenNumber = aScreenNumber;
-//        entry.iRole = EAlfWindowGroupContainer;
+//        entry.iRole = EHuiWindowGroupContainer;
 
         iAlfScreens[aScreenNumber]->iControlGroups.Append(entry);
         CleanupStack::Pop(group);                
@@ -861,7 +872,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
@@ -871,13 +882,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);
@@ -965,7 +976,7 @@
                 move = ETrue;
                 }
             
-            if (aRoster.ControlGroup(i).Control(0).Role() == EAlfSessionContainer)
+            if (aRoster.ControlGroup(i).Control(0).Role() == EHuiSessionContainer)
                 {
                 index++;                                                
                 }                    
@@ -1039,7 +1050,7 @@
                 break;
                 }
 
-            if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer &&
+            if (aRoster.ControlGroup(i).Control(0).Role() == EHuiWindowGroupContainer &&
                 &aRoster.ControlGroup(i) != &aGroup)
                 {
                 index++;                                                
@@ -1052,7 +1063,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++;
@@ -1070,7 +1081,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())
@@ -1081,6 +1092,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;
                 }
             }        
@@ -1115,7 +1131,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);
@@ -1143,7 +1159,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   
@@ -1427,7 +1443,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;
@@ -1454,11 +1470,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))
@@ -1608,8 +1631,8 @@
         if (isLayoutActive && !hasActiveVisualsInVisualTree)
             {
             // 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.
             layout->SetFlag(EHuiVisualFlagInactive);
             }
         else if(!isLayoutActive && hasActiveVisualsInVisualTree)
@@ -1686,9 +1709,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.
@@ -1711,11 +1736,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;
                 }
@@ -1959,8 +1980,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;    
@@ -2160,8 +2181,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;
             }
@@ -2711,6 +2732,9 @@
         CHuiLayout* lVisual = familyTree[familyIndex];
         lVisual->Owner().Remove(lVisual);
         iOrphanStorage->AppendL( lVisual );
+        RemoveTemporaryPresenterVisual(lVisual);
+        
+        __ALFLOGSTRING1("CAlfBridge::DestroyWindow - orphons: %d", iOrphanStorage->VisualCount());
         }
     familyTree.Close();
          
@@ -3124,7 +3148,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++;    
 					}
@@ -3200,7 +3224,9 @@
 			}
 		}
   
-	iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed   
+	iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed
+
+	AMT_MAP_BRIDGE_SET_ORDINAL_POSITION();
 	}
 
 // ---------------------------------------------------------------------------
@@ -3255,6 +3281,27 @@
 			{
 			viz->ClearCommandSet();
 			}
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+		if (!(viz->Flags() & EHuiVisualFlagInactive))
+		    {
+            TInt secureId = viz->Owner().ControlGroup()->SecureId();
+            TInt64 temp(KErrNotFound);
+            TBool effects(EFalse);
+            AMT_GET_TIME(temp, secureId, 0, effects);
+            if (temp != KErrNotFound && effects == EFalse)
+                {
+                TTime time;
+                time.UniversalTime();
+                TTime startTime(temp);
+                    
+                TInt64 reactionTime = time.MicroSecondsFrom(startTime).Int64();
+                    
+                RDebug::Printf("CAlfBridge::HandlePostCanvasBufferL - Reaction time \t0x%x\t%f", secureId, (TReal)reactionTime / 1000000.0f );
+                AMT_RESET_TIME(secureId);
+                }
+		    }
+#endif
+		
 		// If tracking has been enabled for this CHuiCanvasVisual object, the buffers will be marked for tracking aswell in CHuiCanvasVisual
 		switch( bufferAttributes->iPartStatus )
 			{
@@ -4086,7 +4133,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
@@ -4169,6 +4216,7 @@
                     effectFlags |= KHuiFxEffectExcludeChildrenFlag;
                     //RDebug::Print(_L("CAlfBridge::SetupFadeEffectL - no children faded by parent"));
                     }
+                __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - insert fade 0x%x", &aVisual);
                 TRAP( err, engine->LoadEffectL(*iFadeEffectFile, effect, aVisual.Effectable(), NULL, NULL, 0, effectFlags ) );
                 didFadeEffectLoad = ETrue;
         		}
@@ -4180,6 +4228,7 @@
         if (alreadyFaded)
             {
             aVisual.SetEffect( NULL );
+            __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - remove fade: 0x%x", &aVisual);
             alreadyFaded = EFalse;
             }
         }
@@ -4265,7 +4314,9 @@
         else 
             {
             __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find new group! orphaning the visual");
-            iOrphanStorage->AppendL( viz );
+            
+            RemoveTemporaryPresenterVisual(viz);
+             iOrphanStorage->AppendL( viz );
             }
         }
     else
@@ -4518,7 +4569,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.	
@@ -4575,7 +4626,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; 
                             }
@@ -4625,7 +4676,7 @@
                                 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout);
                                 iEffectCleanupStack.Remove(index);
                                 }
-                            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately);
+                            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately);
                             aEvent.iSetupDone = layoutEffectable; 
                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
                             }
@@ -4695,7 +4746,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;
 			}
         }
@@ -4870,8 +4921,6 @@
         }
     else // MAlfGfxEffectPlugin::EEndFullscreen
         {
-        stream.Release();
-
         // End fullscreen signal received. We proceed only if there is really
         // effect ongoing and "end fullscreen" hasn't already been processed.
         
@@ -4880,7 +4929,22 @@
             __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END: fx ready");
             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();
+                
+                }
+            CleanupStack::PopAndDestroy( fxData );
+            fxData = NULL;
+        
         __ALFFXLOGSTRING("HandleGfxEffectsL - process end");
         iFullScreenEffectData->iEndFullScreen = ETrue;
 
@@ -4890,6 +4954,7 @@
             iFullScreenEffectData->iDrawingCompleteTimer->Cancel();
             }
 #endif			
+        stream.Release();
         }
 
     CFullScreenEffectState* fxData = iFullScreenEffectData;
@@ -5078,7 +5143,7 @@
         }
     else
         {
-        __ALFFXLOGSTRING2("CAlfBridge::HandleGfxControlEffectsL - Control not found. iClientHandle %d, iClientGroupHandle %d", 
+        __ALFFXLOGSTRING2("CAlfBridge::HandleSetDistractionWindowL - Control not found. iClientHandle %d, iClientGroupHandle %d. Cache request.", 
                 fxData->iClientHandle, 
                 fxData->iClientGroupHandle);
         return;
@@ -5141,8 +5206,10 @@
         CHuiControl* aEffectControl, 
         TBool aInsertTemporaryVisual,
         TInt& aItemDestroyed,
+        TBool aIsFullScreenEffect,
         TBool aIsExitEffect,
-        TBool aCanDestroyOrHideImmediately)
+        TBool aCanDestroyOrHideImmediately 
+        )
     {
     CHuiCanvasVisual* temporaryPresenterVisual = NULL;
     TInt enableEffect = ETrue;
@@ -5192,7 +5259,8 @@
                     temporaryPresenterVisual,
                     ETrue,
                     aIsExitEffect,
-                    aCanDestroyOrHideImmediately);
+                    aCanDestroyOrHideImmediately,
+                    aIsFullScreenEffect);
             iEffectCleanupStack.AppendL(item);
             }
         else
@@ -5202,7 +5270,8 @@
             TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle,
                         aSourceVisual, NULL, EFalse,
                         aIsExitEffect,
-                        aCanDestroyOrHideImmediately);
+                        aCanDestroyOrHideImmediately,
+                        aIsFullScreenEffect);
             iEffectCleanupStack.AppendL(item);
             }
      }
@@ -5215,6 +5284,7 @@
         CHuiLayout* aTargetLayout, 
         CHuiControl* aEffectControl,
         TInt& aItemsDestroyed,
+        TBool aIsFullScreenEffect,
         TBool aAddLayout,
         TBool aIsExitEffect,
         TBool aCanDestroyOrHideImmediately)
@@ -5222,7 +5292,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++)
@@ -5232,10 +5302,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.
@@ -5245,7 +5315,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, 
@@ -5266,17 +5336,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;
@@ -5381,7 +5451,7 @@
     CHuiFxEngine* engine = NULL;
     // engine is not owned by us, it is a member of HuiEnv
     engine = iHuiEnv->EffectsEngine();
-    if (engine)
+    if (engine && aCanvasVisual)
         {
         if (NeedsStoredBuffers(engine, *aEvent.iEffectName))
             {
@@ -5410,11 +5480,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)
             {
@@ -5473,8 +5543,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;
@@ -5837,7 +5917,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)
                 {
@@ -5856,7 +5936,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);                        
@@ -5864,7 +5944,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);                                            
@@ -5872,7 +5952,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 );                                                                
@@ -5880,7 +5960,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 );                                                                
@@ -6119,6 +6199,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]);        
@@ -6227,6 +6314,13 @@
 void CAlfBridge::SetLowMemory(TBool aEnabled)
     {
     iLowMemoryMode = aEnabled;
+    
+    AMT_MAP_SET_VALUE(
+            iBoolMap,
+            AMT_MAP_LOW_MEMORY_MODE_HANDLE,
+            iLowMemoryMode,
+            EAlfModuleTestTypeBridgeGoom );
+    
     DoUpdateMemoryLevel();
     }
 
@@ -6236,6 +6330,13 @@
 TInt CAlfBridge::ForceSwRendering(TBool aEnabled)
     {
     iForcedSwRendering = aEnabled;
+    
+    AMT_MAP_SET_VALUE(
+            iBoolMap,
+            AMT_MAP_FORCE_SW_HANDLE,
+            iForcedSwRendering,
+            EAlfModuleTestTypeBridgeGoom );
+    
     DoUpdateMemoryLevel();
     return KErrNone;        
     }
@@ -6484,7 +6585,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;
@@ -6507,7 +6608,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();            
@@ -6666,8 +6767,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;    
@@ -6709,7 +6810,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;
--- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Tue May 25 13:39:57 2010 +0300
@@ -818,22 +818,16 @@
         RMemReadStream& aStream)
     {
     iAction = aAction;
-
     iHandle = aStream.ReadInt32L();
-
     iType = aStream.ReadInt32L();
+    iTimeoutTriggered = aStream.ReadInt32L();
     iToWg = aStream.ReadInt32L();
     iFromWg = aStream.ReadInt32L();
     iToAppId = aStream.ReadInt32L();
     iFromAppId = aStream.ReadInt32L();
 
-    if (iType == AknTransEffect::EParameterType)
-        {
-        iToSecureId = aStream.ReadInt32L();
-        iFromSecureId = aStream.ReadInt32L();
-        /*screen1 =*/aStream.ReadInt32L();
-        /*screen2 =*/aStream.ReadInt32L();
-        }
+    iToSecureId = aStream.ReadInt32L();
+    iFromSecureId = aStream.ReadInt32L();
     /*TInt flags =*/
     aStream.ReadInt32L();
     iRect.iTl.iX = aStream.ReadInt32L();
--- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Tue May 25 13:39:57 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/alfscreen.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfscreen.cpp	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfsrvcontrolgroupsubsession.cpp	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Tue May 25 13:39:57 2010 +0300
@@ -32,6 +32,12 @@
 #include <alf/AlfTransEffectPlugin.hrh>
 
 
+// Implements just Error() to avoid panic
+NONSHARABLE_CLASS(CSimpleScheduler) : public CActiveScheduler
+    {
+    void Error( TInt ) const{} // From CActiveScheduler
+    };
+
 // ==================================
 // Launcher implementation.
 // ==================================   
@@ -66,7 +72,7 @@
         thread.Close();
 
         // Set up scheduler and cleanup stack for this thread
-        CActiveScheduler* scheduler = new CActiveScheduler;
+        CActiveScheduler* scheduler = new CSimpleScheduler;
         if (!scheduler)
             {
             return KErrNoMemory;
--- a/uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp	Tue May 25 13:39:57 2010 +0300
@@ -46,6 +46,9 @@
 #include "alfsrvsubsessionbase.h"
 #include "alfsrvtransformationsubsession.h"
 
+#define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 #ifdef RD_ALF_IN_PLATFORM
 #include <aknlayout2hierarchy.h>
 #endif
@@ -768,6 +771,11 @@
             CHuiFxEngine* engine = iVisual->Env().EffectsEngine();
             if (engine)
                 {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+                TTime time;
+                time.UniversalTime();
+                AMT_ADD_TIME(params->iHandle, time.Int64(), ETrue);
+#endif  
                 CHuiFxEffect* effect = NULL;
                 engine->LoadEffectL( params->iFileName, effect, iVisual->Effectable(), NULL , NULL, params->iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn );
                 // The effect will be automatically set to the visual if parsing succeeds
@@ -781,6 +789,11 @@
             CHuiFxEngine* engine = iVisual->Env().EffectsEngine();
             if (engine)
                 {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+                TTime time;
+                time.UniversalTime();
+                AMT_ADD_TIME(params->iHandle, time.Int64(), ETrue);
+#endif  
                 CHuiFxEffect* effect = NULL;
                 // this will add the group, if it does not exist already
                 // Begin and End group events are supposed to come through GfxTransEffect API.
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h	Tue May 25 13:39:57 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/group/huirendervg10.mmp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/group/huirendervg10.mmp	Tue May 25 13:39:57 2010 +0300
@@ -48,6 +48,7 @@
 
 USERINCLUDE     ../../inc
 USERINCLUDE     ../inc
+USERINCLUDE     ../../../CommonInc
 
 //Added as part of break team support changes.
 #include "../../../../../group/stdinc.mmh"
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Tue May 25 13:39:57 2010 +0300
@@ -87,5 +87,8 @@
     iColorMatrix[16] = oOff;
     iColorMatrix[17] = oOff;
     iColorMatrix[18] = oOff;
-    iColorMatrix[19] = 0.0f;
+    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
     }
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Tue May 25 13:39:57 2010 +0300
@@ -342,6 +342,11 @@
     
 TBool CHuiCanvasVisual::CanSkipDrawing() const
     {
+    if(Display()->RosterImpl().AlfEventWindow() == this)
+         {
+         return EFalse;
+         }
+    
     if (Effect())
         {
         TBool semiTranparentEffectActive = Effect()->IsSemitransparent();
@@ -465,7 +470,11 @@
             iCanvasVisualData->iPaintedRegion.Clear();
             CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0);
             }
-        
+
+        if(Display()->RosterImpl().AlfEventWindow() == this)
+            {
+            refreshCache |= Display()->RosterImpl().NativeAppsContentChanged();
+            }
         didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion);
         
         }
@@ -536,10 +545,10 @@
         RDebug::Print(_L("CHuiCanvasVisual::DrawSelf - tracked visual"));
         }
 #endif		
-      
+    TBool alfEventWindow = (Display()->RosterImpl().AlfEventWindow() == this);
     TReal32 effectiveOpacity = EffectiveOpacity();
         
-    if (effectiveOpacity <= 0 || !HasCommandBuffers(ETrue))
+    if ((effectiveOpacity <= 0 || !HasCommandBuffers(ETrue)) && !alfEventWindow)
         {
         // 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
@@ -572,6 +581,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 +1012,7 @@
                     }                    
 
                 background.iPaintedRect = backgroundItems[aIndex].Rect();
+                backgroundItems.Close();
                 return background;
                 }
             else
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Tue May 25 13:39:57 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	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Tue May 25 13:39:57 2010 +0300
@@ -22,6 +22,16 @@
 #include "HuiRenderPlugin.h"
 #include "HuiCmdBufferBrush.h" // MHuiEffectable
 
+#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"
+
+
 EXPORT_C CHuiFxEffect* CHuiFxEffect::NewL(CHuiFxEngine& aEngine)
     {
     CHuiFxEffect* e = new (ELeave) CHuiFxEffect( aEngine );
@@ -107,6 +117,40 @@
         {
         return ETrue; // fade effect does not have observer that would need notification
         }
+    
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    TTime endTime;
+    endTime.UniversalTime();
+    
+	// There might be several BeginFullScreen for single effects. We want to calculate
+	// reaction time from the first BeginFullScreen event to this point
+    TInt timeStamps = 0;
+    AMT_GET_TIME_POINT_COUNT(iHandle, timeStamps);
+    
+    TInt64 temp;
+    TBool effects(EFalse); // dummy, 1 if effects were on for this time stamp
+    AMT_GET_TIME(temp, iHandle, 0, effects);
+    TTime startTime(temp);
+    
+    AMT_GET_TIME(temp, iHandle, timeStamps - 1, effects);
+    TTime effectStartTime(temp);
+    
+    TInt64 effectTime = endTime.MicroSecondsFrom(effectStartTime).Int64();
+    TReal fps = (TReal)iFramesDrawn / ((TReal)effectTime / 1000000.0f) ; 
+
+    TInt64 totalEffectTime = endTime.MicroSecondsFrom(startTime).Int64();
+    TInt64 reactionTime = effectStartTime.MicroSecondsFrom(startTime).Int64();
+        
+    RDebug::Printf("CHuiFxEffect::NotifyEffectEndObserver - Reaction time \t0x%x\t%f\tVisible effect time:\t%f\ts. (%f FPS). Total effect time:\t%f", 
+            iHandle,
+            (TReal)reactionTime / 1000000.0f,
+            ((TReal)effectTime)/1000000,
+            fps,
+            ((TReal)totalEffectTime)/1000000.0f 
+            );
+    AMT_RESET_TIME(iHandle);
+#endif
+    
     if (iEffectEndObserver)
         {
         // The callback can be called only once when the effect finishes
@@ -553,6 +597,13 @@
 
             if (iFramesDrawn == 1)
                 {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+				// This is about the time when first frame from the effect is on screen
+                TTime endTime;
+                endTime.UniversalTime();
+                
+                AMT_ADD_TIME(iHandle, endTime.Int64(), ETrue);
+#endif
                 aElapsedTime = 0;
                 iFramesDrawn++;
                 }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Tue May 25 13:39:57 2010 +0300
@@ -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/huicanvaspainter.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Tue May 25 13:39:57 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++)
         {        
@@ -258,7 +258,9 @@
             tempRegion.AddRect(iCommandBuffers[cb]->iOriginalDisplayRect);
             }
         }    
-    return tempRegion.BoundingRect();
+    TRect result = tempRegion.BoundingRect();
+    tempRegion.Close();
+    return result;
     }
 
 void CHuiCanvasPainter::ClearCapturingBufferArea(const TRect& /*aRect*/)
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Tue May 25 13:39:57 2010 +0300
@@ -1906,12 +1906,15 @@
     if (aUpdateDisplay && renderbuffer && iCanvasGc->Gc())
         {
         THuiRealRect updatedRect = aUpdateRegion.BoundingRect();
-
+				  TInt w; 
+				  TInt h ;
         // Handle relative rotation
-        TRect displayArea = iVisual->Display()->VisibleArea();
-        TInt w = displayArea.Width();
-        TInt h = displayArea.Height();
-                
+        if (iVisual->Display())
+            {
+            TRect displayArea = iVisual->Display()->VisibleArea();
+            w = displayArea.Width();
+            h = displayArea.Height();
+            }
         // ...select right rotation...
         if (iRelativeOrientation == CHuiGc::EOrientationCW90)
             {
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Tue May 25 13:39:57 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/src/goommemorymonitor.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Tue May 25 13:39:57 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/group/core_exports.inc	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/group/core_exports.inc	Tue May 25 13:39:57 2010 +0300
@@ -3,7 +3,7 @@
 *  Name        : core_exports.inc
 *  Part of     : Alfred UI Toolkit
 *  Description : Exported header files.
-*  Version     : %version: tr1sido#8.1.36 %
+*  Version     : %version: tr1sido#8.1.37 %
 *
 *  Copyright © 2006-2007 Nokia.  All rights reserved.
 *  This material, including documentation and any related computer
@@ -53,6 +53,7 @@
 ../coretoolkit/data/app_activate.fxml /epoc32/release/winscw/urel/z/resource/effects/app_activate.fxml
 ../coretoolkit/data/app_exit.fxml /epoc32/release/winscw/urel/z/resource/effects/app_exit.fxml
 ../coretoolkit/data/app_start.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start.fxml
+../coretoolkit/data/app_start_long.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_long.fxml
 ../coretoolkit/data/app_start_rect.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_switch_rect.fxml
@@ -145,6 +146,7 @@
 ../coretoolkit/data/app_activate.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_activate.fxml
 ../coretoolkit/data/app_exit.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_exit.fxml
 ../coretoolkit/data/app_start.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start.fxml
+../coretoolkit/data/app_start_long.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_long.fxml
 ../coretoolkit/data/app_start_rect.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_switch_rect.fxml
@@ -237,6 +239,7 @@
 ../coretoolkit/data/app_activate.fxml /epoc32/data/z/resource/effects/app_activate.fxml
 ../coretoolkit/data/app_exit.fxml /epoc32/data/z/resource/effects/app_exit.fxml
 ../coretoolkit/data/app_start.fxml /epoc32/data/z/resource/effects/app_start.fxml
+../coretoolkit/data/app_start_long.fxml /epoc32/data/z/resource/effects/app_start_long.fxml
 ../coretoolkit/data/app_start_rect.fxml /epoc32/data/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/data/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/data/z/resource/effects/app_start_switch_rect.fxml
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Tue May 25 13:39:57 2010 +0300
@@ -48,7 +48,7 @@
 	virtual void StartEndChecker() = 0;
 	virtual void CancelEndChecker() = 0;
 	virtual void SendBeginFullscreen() = 0;
-	virtual TInt SendEndFullscreen() = 0;
+	virtual TInt SendEndFullscreen(TBool aTimeout = EFalse) = 0;
 	virtual TInt SendAbortFullscreen() = 0;
 	virtual TInt SendAbortControlTransition() = 0;
     virtual	TInt SendBeginControlTransition() = 0;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Tue May 25 13:39:57 2010 +0300
@@ -69,7 +69,7 @@
     void BeginFullscreen( TInt aAction, const TRect& aEffectRect, 
 						TInt aType, const TUid aUid1, const TUid aUid2, TInt aData,
 						TSecureId aSid1, TInt aWg1, TSecureId aSid2, TInt aWg2);
-    void EndFullscreen();
+    void EndFullscreen(TBool aTimeout = EFalse);
     void CancelFullscreen();
     void AbortFullscreen();
     void RegisterAlfFullScreenEffect( TInt aAction, const TDesC& aResourceDir,
@@ -103,7 +103,7 @@
 
 	TInt SendBeginFullscreen(TInt aHandle, TUint aAction, const TUid& aUid, 
 							 const TUid& aPreviousUid, const TRect& aEffectRect);
-	TInt SendEndFullscreen();
+	TInt SendEndFullscreen(TBool aTimeout = EFalse);
 	TInt SendAbortFullscreen();
 	TInt SendAbortControlTransition();
 	void SendBeginFullscreen();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp	Tue May 25 13:39:57 2010 +0300
@@ -48,6 +48,9 @@
 
 #include "wsserverdrawercontroller.h"
 
+#define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 // Constants
 //const TInt KAlfDefaultFocusGainedEffectDuration = 500;
 //const TInt KAlfDefaultFocusLostEffectDuration = 500;
@@ -118,6 +121,13 @@
 	                                     KThemesTransitionEffects);
     
     iSyncronizedGroupDefitionEndChecker = CEndCheck::NewL(*this);
+    
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    // Initiliaze global data in TLS and Open global module testing chunk and mutex
+    User::LeaveIfError(Dll::SetTls(new(ELeave) CAlfModuleTestDataControl()));
+    User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects());
+#endif
+
     __ALFFXLOGSTRING("CAlfGfxEffects::ConstructL <<");
     }
 
@@ -191,6 +201,23 @@
 		        // We should not get end full screen if the effect has not been even started
 		        // (could return KErrAbort in aOutBuf)
 		        err = KErrAbort;
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+		        action = inStream.ReadUint32L();
+                TRect effectRect( inStream.ReadInt32L(),
+                    inStream.ReadInt32L(), inStream.ReadInt32L(), inStream.ReadInt32L() );
+                TInt type = inStream.ReadInt32L();
+                uid1 = TUid::Uid( inStream.ReadInt32L() );
+                uid2 = TUid::Uid( inStream.ReadInt32L() );
+                TInt data = inStream.ReadInt32L();
+                
+                if ( type == AknTransEffect::EParameterType )
+                    {
+                    sid1 = TSecureId( inStream.ReadInt32L() ); // secureid is the only thing interesting to us
+                    }
+                TTime time;
+                time.UniversalTime();
+                AMT_ADD_TIME(sid1.iId, time.Int64(), EFalse);
+#endif
 		        break;
 		        }
 		    else
@@ -223,7 +250,7 @@
 #ifdef _DEBUG    
     PrintRequestInfo( op, action);
 #endif    
-            iEngine->EndFullscreen();
+            iEngine->EndFullscreen(EFalse); // not timeout, but official endfullscreen
             break;
         case MAlfGfxEffectPlugin::EAbortFullscreen:
 #ifdef _DEBUG    
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Tue May 11 17:03:00 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Tue May 25 13:39:57 2010 +0300
@@ -37,11 +37,16 @@
 #include <alflogger.h>
 #include <uiacceltk/HuiUtil.h>
 
+#define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 // 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;
-const TInt KAlfLongEffectTimeout  = 5000000;
+const TInt KAlfShortEffectTimeout     = 4000000;
+const TInt KAlfAppStartEffectTimeout  = 300000;
+const TInt KAlfLongEffectTimeout      = 5000000;
 const TInt KAlfActiveControlFxGranularity = 4;
+const TInt KAlfLongApplicationStartContext = 20;
 
 //const TInt KAlfLongEffectTimeout  = 500000;
 // Timer to send finish full screen effect
@@ -63,6 +68,11 @@
         
         void DoCancel();
 
+    public:
+        
+        TBool iTimeoutTriggered;
+        TBool iIsStartEffect;
+        
     private:
 
         CAlfFinishTimer();
@@ -108,6 +118,7 @@
 void CAlfFinishTimer::Start( TTimeIntervalMicroSeconds32 aPeriod, TCallBack aTimeoutCallback )
     {
     iCallback = aTimeoutCallback; 
+    iTimeoutTriggered = EFalse;
     After( aPeriod );
     }
 
@@ -118,6 +129,7 @@
     //
     if ( iStatus.Int() != KErrCancel )
         {
+        iTimeoutTriggered = ETrue;
         iCallback.CallBack();
         }
     }
@@ -266,6 +278,10 @@
     delete iFinishFullScreen;
     delete iFullScreenTimeout;
     iActiveControlFx.Close();
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    delete AMT_CONTROL();
+    Dll::FreeTls();
+#endif
     }
 
 // ---------------------------------------------------------------------------
@@ -501,11 +517,11 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-void CAlfServerDrawer::EndFullscreen()
+void CAlfServerDrawer::EndFullscreen(TBool aTimeout)
     {
     __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen >>");
     CancelEndChecker();
-    iFullScreenController->EndFullscreen(EFalse);
+    iFullScreenController->EndFullscreen(aTimeout);
     iFullScreenController->AppInfoCache().ClearActions();
     __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen <<");
     }
@@ -550,6 +566,11 @@
 //  
 void CAlfServerDrawer::DoSendBeginFullscreenL()
     {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    TTime time;
+    time.UniversalTime();
+    AMT_ADD_TIME(iToSid.iId, time.Int64(), ETrue);
+#endif    
     __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendBeginFullscreen");
     __ALFFXLOGSTRING(" <- Original window server ids");
     __ALFFXLOGSTRING2("From UID: 0x%X, To UID: 0x%X", iFromUid.iUid, iToUid.iUid);    
@@ -666,6 +687,7 @@
         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
         stream.WriteInt32L(  iToSid.iId ); //iCurrentFullScreenHandle );
         stream.WriteInt32L( iType );
+        stream.WriteInt32L( 0 ); // timeout triggered
       	if ( iType == AknTransEffect::EParameterType && isExit )
       	    {
             stream.WriteInt32L( iToWg );
@@ -679,8 +701,6 @@
             stream.WriteInt32L( iToSid.iId );
             stream.WriteInt32L( iFromSid.iId );
                         
-            stream.WriteInt32L( KErrNotFound ); //  was iToScreen, obsolete
-            stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete
        	    }
        	else if ( iType == AknTransEffect::EParameterType )
        	    {
@@ -695,19 +715,22 @@
             stream.WriteInt32L( iToSid.iId );
             stream.WriteInt32L( iFromSid.iId );
                         
-            stream.WriteInt32L( KErrNotFound );  // was iToScreen, obsolete
-            stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete
             }
         else
             {
-            stream.WriteInt32L( KErrNotFound); // was iFocusWg 
-            stream.WriteInt32L( KErrNotFound); // was iFocusWg 
+            stream.WriteInt32L( KErrNotFound);  // dummy BEGIN
+            stream.WriteInt32L( KErrNotFound);  
+            stream.WriteInt32L( KErrNotFound);  
+            stream.WriteInt32L( KErrNotFound); 
+            stream.WriteInt32L( KErrNotFound);  
+            stream.WriteInt32L( KErrNotFound);  // dummy END
             }
         stream.WriteInt32L( iFlags );
         stream.WriteInt32L( iEffectRect.iTl.iX );
         stream.WriteInt32L( iEffectRect.iTl.iY );
         stream.WriteInt32L( iEffectRect.iBr.iX );
         stream.WriteInt32L( iEffectRect.iBr.iY );
+        
         stream << resourceDir;
         stream << fileName;    
         stream.CommitL();
@@ -725,13 +748,14 @@
     // iFlags and iAction will contain some extra information that can be used to control the effect:
     
     // All of these actions may not produce effects, they are here for now for debugging.
-    
+    TBool isAppStartEffect(EFalse);
     switch ( iAction )
         {
         case AknTransEffect::EApplicationActivate:
             __ALFFXLOGSTRING("EApplicationActivate - 1");
             break;
         case AknTransEffect::EApplicationStart:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStart - 3");
             break;
         case AknTransEffect::EEmbeddedApplicationStart:
@@ -741,12 +765,15 @@
             __ALFFXLOGSTRING("EApplicationExit - 5");
             break;
         case AknTransEffect::EApplicationStartRect:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStartRect - 6");
             break;
         case AknTransEffect::EApplicationStartSwitch:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStartSwitch - 7");
             break;
         case AknTransEffect::EApplicationStartSwitchRect:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStartSwitchRect - 8");
             break;
         case AknTransEffect::EEmbeddedApplicationExit:
@@ -783,15 +810,27 @@
     // It appears that folder open and close never send endfullscreen, so for them the effect
     // must be started as soon as we get beginfullscreen
     
-    iFullScreenTimeout->Start( KAlfLongEffectTimeout, TCallBack( FullScreenTimeout, this ) );
+    isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
+	
+    if (isAppStartEffect)
+        {
+		// The shorter timeout can be disabled here!
+        iFullScreenTimeout->Start( KAlfAppStartEffectTimeout, TCallBack( FullScreenTimeout, this ) );
+        iFullScreenTimeout->iIsStartEffect = ETrue;
+        }
+    else
+        {
+        iFullScreenTimeout->Start( KAlfLongEffectTimeout, TCallBack( FullScreenTimeout, this ) );
+        iFullScreenTimeout->iIsStartEffect = EFalse;
+        }
     }
     
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //	
-TInt CAlfServerDrawer::SendEndFullscreen()
+TInt CAlfServerDrawer::SendEndFullscreen(TBool aTimeout)
     {
-    __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
+    __ALFFXLOGSTRING3("CAlfServerDrawer::SendEndFullscreen - Timeout: %d, iFullScreenEndSent: %d, IsStartEffect: %d", aTimeout, iFullScreenEndSent, iFullScreenTimeout->iIsStartEffect);
     
     if ( iFullScreenEndSent )
         {
@@ -804,19 +843,13 @@
     iFullScreenTransitionEndObserver->Cancel();
     iFullScreenTimeout->Cancel();
     iFinishFullScreen->Cancel();
-	/*
-    TUint action = iAction;   
-    if ( iType == AknTransEffect::EParameterAvkonInternal )
-        {
-        action = iOldAction;
-        }
-    */
-    // TEMPORARY HACK
-    // REMOVE AFTER APPSHELL HAS BEEN FIXED
-    //iDoNotClearEffectRect = EFalse;
+    TBool triggerStartEffectTimeout= iFullScreenTimeout->iTimeoutTriggered && iFullScreenTimeout->iIsStartEffect;
+    iFullScreenTimeout->iTimeoutTriggered = EFalse;
+    iFullScreenTimeout->iIsStartEffect = EFalse;
     
-    // This is where the second part of the effect should start
-    // The new window should already have something on the screen
+     // This is where the second part of the effect should start
+    // The new window should already have something on the screen.
+	// It might not be the case, if aTimeout is ETrue 
     
     // Send the data to CAlfAppUI via bridge
     
@@ -826,13 +859,27 @@
     
 	TPtrC resourceDir;
 	TPtrC fileName;
+	TInt cachePriority = 0;
+    TInt wantedTime = 0;
+    TInt minTime = 0;
 
+	if (triggerStartEffectTimeout)
+	    {
+        // if the following fails, then the effect from beginfullscreen will be used.
+        TInt err = iPolicyHandler.GetFullscreenKml( KAlfLongApplicationStartContext, iToUid, iFromUid, resourceDir, fileName,
+        cachePriority, wantedTime, minTime );
+		if (err != KErrNone)
+			{
+			triggerStartEffectTimeout = EFalse;
+			}
+	    }
+	
     // We must make a stream of the data as the length may vary.
     // At the moment we only send some numbers, but we should probably include
     // also the effect file name or something else to identify the effect 
     // that is going to be used
     
-    TInt bufferSize = 11 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect
+    TInt bufferSize = 12 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
     bufferSize += sizeof(TPtrC);
     bufferSize += resourceDir.Length() * 2;
     bufferSize += sizeof(TPtrC);
@@ -856,29 +903,23 @@
             stream.WriteInt32L( MAlfGfxEffectPlugin::EEndFullscreen );
             stream.WriteInt32L( iCurrentFullScreenHandle );
             stream.WriteInt32L( iType );
-
+            stream.WriteInt32L( triggerStartEffectTimeout );
             stream.WriteInt32L( iToWg );
             stream.WriteInt32L( iFromWg );
 
             // AppUid for the future. alfbridge can figure out the windog groups based on that
             stream.WriteInt32L( iToUid.iUid );
             stream.WriteInt32L( iFromUid.iUid );
+            
+            stream.WriteInt32L( iToSid.iId );
+            stream.WriteInt32L( iFromSid.iId );
 
-            if ( iType == AknTransEffect::EParameterType )
-                {
-                stream.WriteInt32L( iToScreen );
-                stream.WriteInt32L( iFromScreen );
-                }
-            /*else
-                {
-                //stream.WriteInt32L( iFocusWg );
-                //stream.WriteInt32L( iFocusWg );
-//              }*/
             stream.WriteInt32L( iFlags ); 
             stream.WriteInt32L( iEffectRect.iTl.iX );
             stream.WriteInt32L( iEffectRect.iTl.iY );
             stream.WriteInt32L( iEffectRect.iBr.iX );
             stream.WriteInt32L( iEffectRect.iBr.iY );
+            
             stream << resourceDir;
             stream << fileName;    
             stream.CommitL();    
@@ -892,6 +933,7 @@
         }
 
     iFullScreenFinished = EFalse;
+    iFullScreenTimeout->iIsStartEffect = EFalse;
     if ( iAction == AknTransEffect::EApplicationExit /*||
         iAction == 1001*/  ) 
         {
@@ -987,6 +1029,11 @@
 	TPtrC actionString;
 	
 	TInt err = KErrNone;
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+	TTime time;
+    time.UniversalTime();
+    AMT_ADD_TIME(iControlHandle, time.Int64(), ETrue);
+#endif    
 	err = iPolicyHandler.GetControlKml( iControlUid, iControlAction, resourceDir,
 	    fileName, actionString, cachePriority, wantedTime, minTime );