Revision: 201011
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Fri, 16 Apr 2010 15:56:24 +0300
changeset 14 83d2d132aa58
parent 13 8f67d927ea57
child 19 f5bac0badc7e
Revision: 201011 Kit: 201015
layers.sysdef.xml
package_definition.xml
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_client_server_api/inc/alf/alfdirectclient.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h
uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h
uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h
uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h
uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorplugin.hrh
uiacceltk/group/bld.inf
uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def
uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp
uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h
uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp
uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp
uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF
uiacceltk/hitchcock/Client/eabi/alfclientu.DEF
uiacceltk/hitchcock/Client/src/alfdirectclient.cpp
uiacceltk/hitchcock/Client/src/alfdrawer.cpp
uiacceltk/hitchcock/CommonInc/alfbridgecommands.h
uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h
uiacceltk/hitchcock/CommonInc/alflogger.h
uiacceltk/hitchcock/CommonInc/alfmoduletest.h
uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h
uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h
uiacceltk/hitchcock/ServerCore/BWINS/alfappservercoreu.DEF
uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h
uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h
uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h
uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h
uiacceltk/hitchcock/ServerCore/Inc/alfnodes.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h
uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h
uiacceltk/hitchcock/ServerCore/Inc/alfwindowdata.h
uiacceltk/hitchcock/ServerCore/Inc/alfwindowfxplugin.h
uiacceltk/hitchcock/ServerCore/Inc/alfwindowmanager.h
uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp
uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp
uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp
uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
uiacceltk/hitchcock/ServerCore/Src/alfsrvdisplaysubsession.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerbridge.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfwindow.cpp
uiacceltk/hitchcock/ServerCore/Src/alfwindowfxplugin.cpp
uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp
uiacceltk/hitchcock/ServerCore/eabi/alfappservercoreu.DEF
uiacceltk/hitchcock/ServerStub/Proxy_src/AlfAppFwProxy.cpp
uiacceltk/hitchcock/backgroundanim/group/bganimhost.mmp
uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h
uiacceltk/hitchcock/backgroundanim/inc/sensor.h
uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp
uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp
uiacceltk/hitchcock/backgroundanim/src/screensaverpropertylistener.cpp
uiacceltk/hitchcock/backgroundanim/src/sensor.cpp
uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h
uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvastexturecache.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsbitgc.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsgc.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsswgc.h
uiacceltk/hitchcock/coretoolkit/inc/huiextension.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/huivg10canvasgc.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiGc.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiTextureManager.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp
uiacceltk/hitchcock/goommonitor/data/goomconfig.xml
uiacceltk/hitchcock/goommonitor/group/goommonitor.mmp
uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h
uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h
uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp
uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
uiacceltk/hitchcock/group/bld.inf
uiacceltk/hitchcock/group/core_exports.inc
uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/group/gfxtransenginetfx.mmp
uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/inc/gfxtransenginetfx.h
uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/wsserverdrawercontroller.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/repositoryhandler.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp
--- a/layers.sysdef.xml	Fri Mar 19 09:43:21 2010 +0200
+++ b/layers.sysdef.xml	Fri Apr 16 15:56:24 2010 +0300
@@ -7,8 +7,14 @@
   <systemModel>
     <layer name="mw_layer">
       <module name="uiaccelerator">
-        <unit unitID="abs.uiaccelerator" mrp="" bldFile="&layer_real_source_path;/group" name="uiaccelerator" />
+        <unit unitID="nga.uiaccelerator" mrp="" bldFile="&layer_real_source_path;/group" name="uiaccelerator" />
+      </module>
+    </layer>
+    
+   <layer name="unit_test_layer">
+      <module name="uiaccelerator_test">
+        <unit unitID="nga.uiaccererator.unittest" mrp="" bldFile="&layer_real_source_path;/tsrc/group" name="uiaccelerator_test" />
       </module>
     </layer>
   </systemModel>
-</SystemDefinition>
+</SystemDefinition>
\ No newline at end of file
--- a/package_definition.xml	Fri Mar 19 09:43:21 2010 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<SystemDefinition schema="3.0.0">
-  <package id="uiaccelerator" name="UI Accelerator" levels="plugin framework server ex if">
-    <collection id="uiacceltk" name="UI Accelerator Toolkit" level="framework">
-      <component id="hitchcock" filter="s60" name="Hitchcock">
-        <unit bldFile="uiacceltk/hitchcock/group"/>
-		<!-- are the following needed? if so, 'include from above -->
-        <!-- <unit bldFile="uiacceltk/hitchcock/coretoolkit/group"/> -->
-        <!-- <unit bldFile="uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/group"/> -->
-        <!-- <unit bldFile="uiacceltk/hitchcock/tracer/group"/> -->
-        <!-- <unit bldFile="uiacceltk/hitchcock/tracer/traceextclient/group"/> -->
-        <!-- <unit bldFile="uiacceltk/hitchcock/tracer/traceextplugin/group"/> -->
-      </component>
-      <component id="widgeteditors" filter="s60" name="Widget Editors">
-        <unit bldFile="uiacceltk/widgeteditors/group"/>
-      </component>
-      <component id="uiacceltk_build" filter="s60" name="UI Accelerator Toolkit Build">
-		<!-- consider distributing into other components -->
-        <unit bldFile="uiacceltk/group"/>
-      </component>
-    </collection>
-    <collection id="uiaccelexampleapps" name="UI Accelerator Example Apps" level="ex">
-		<!-- are these unbuilt components? -->
-      <component id="alfexanalogdialer" filter="s60" name="Accelerated LAF Example Analog Dialer" purpose="development">
-        <!-- <unit bldFile="uiaccelexampleapps/alfexanalogdialer/group"/> -->
-      </component>
-      <component id="alfexstickers" filter="s60" name="Accelerated LAF Example Stickers" purpose="development">
-        <!-- <unit bldFile="uiaccelexampleapps/alfexstickers/group"/> -->
-      </component>
-    </collection>
-    <collection id="uiaccelerator_info" name="UI Accelerator Info" level="if">
-      <component id="uiaccelerator_inc" filter="s60">
-		<!-- is this needed? -->
-        <!-- <unit bldFile="inc/group"/> -->
-      </component>
-      <component id="uiaccelerator_plat" filter="s60" name="UI Accelerator Platform Interfaces" class="api">
-        <unit bldFile="uiaccelerator_plat/group"/>
-		<!-- Can only have one bld.inf: include the test bld.infs from the above one if needed -->
-        <unit bldFile="uiaccelerator_plat/alf_client_server_api/tsrc/group"/>
-        <unit bldFile="uiaccelerator_plat/alf_core_toolkit_api/tsrc/group"/>
-        <unit bldFile="uiaccelerator_plat/alf_editors_api/tsrc/group"/>
-        <unit bldFile="uiaccelerator_plat/alf_extended_visual_api/tsrc/group"/>
-        <unit bldFile="uiaccelerator_plat/alf_extension_api/tsrc/group"/>
-        <unit bldFile="uiaccelerator_plat/alf_tracing_api/tsrc/group"/>
-        <unit bldFile="uiaccelerator_plat/alf_visual_api/tsrc/group"/>
-      </component>
-    </collection>
-  </package>
-</SystemDefinition>
--- a/rom/alfred.iby	Fri Mar 19 09:43:21 2010 +0200
+++ b/rom/alfred.iby	Fri Apr 16 15:56:24 2010 +0300
@@ -81,13 +81,18 @@
 
 // Effect fxmls. Keep the list in alphabetical order. When updating the list below, REMEMBER TO ALSO UPDATE core_exports.inc!
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_add_page.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_add_page.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_editmode.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_editmode.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_widgetmanager.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_widgetmanager.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_disappear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_editmode.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_editmode.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_widgetmanager.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_widgetmanager.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_remove_page.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_remove_page.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_disappear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_disappear.fxml
 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
@@ -97,7 +102,11 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/appshell_exit.fxml RESOURCE_FILES_DIR/effects/appshell_exit.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/confirmationnote_appear.fxml RESOURCE_FILES_DIR/effects/confirmationnote_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/confirmationnote_disappear.fxml RESOURCE_FILES_DIR/effects/confirmationnote_disappear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/contextmenu_appear.fxml RESOURCE_FILES_DIR/effects/contextmenu_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/contextmenu_disappear.fxml RESOURCE_FILES_DIR/effects/contextmenu_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_close.fxml RESOURCE_FILES_DIR/effects/dialer_close.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_list_appear.fxml RESOURCE_FILES_DIR/effects/dialer_list_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_list_disappear.fxml RESOURCE_FILES_DIR/effects/dialer_list_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_open.fxml RESOURCE_FILES_DIR/effects/dialer_open.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/discreet_popup_appear.fxml RESOURCE_FILES_DIR/effects/discreet_popup_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/discreet_popup_disappear.fxml RESOURCE_FILES_DIR/effects/discreet_popup_disappear.fxml
@@ -124,6 +133,10 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/optionsmenu_cascade_appear.fxml RESOURCE_FILES_DIR/effects/optionsmenu_cascade_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/optionsmenu_cascade_disappear.fxml RESOURCE_FILES_DIR/effects/optionsmenu_cascade_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/optionsmenu_disappear.fxml RESOURCE_FILES_DIR/effects/optionsmenu_disappear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_gridview_appear.fxml RESOURCE_FILES_DIR/effects/photos_gridview_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_gridview_disappear.fxml RESOURCE_FILES_DIR/effects/photos_gridview_disappear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_fullscreen_close.fxml RESOURCE_FILES_DIR/effects/photos_fullscreen_close.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_fullscreen_open.fxml RESOURCE_FILES_DIR/effects/photos_fullscreen_open.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/popup_appear.fxml RESOURCE_FILES_DIR/effects/popup_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/popup_disappear.fxml RESOURCE_FILES_DIR/effects/popup_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/popup_disappear_screenshot.fxml RESOURCE_FILES_DIR/effects/popup_disappear_screenshot.fxml
@@ -143,6 +156,12 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/toolbar_ext_disappear.fxml RESOURCE_FILES_DIR/effects/toolbar_ext_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_close.fxml RESOURCE_FILES_DIR/effects/touchinput_close.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_open.fxml RESOURCE_FILES_DIR/effects/touchinput_open.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left.fxml RESOURCE_FILES_DIR/effects/viewswitch_left.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_appear2.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_disappear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_disappear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right.fxml RESOURCE_FILES_DIR/effects/viewswitch_right.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_right_appear.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right_disappear.fxml RESOURCE_FILES_DIR/effects/viewswitch_right_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/waitnote_appear.fxml RESOURCE_FILES_DIR/effects/waitnote_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/waitnote_disappear.fxml RESOURCE_FILES_DIR/effects/waitnote_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/warningnote_appear.fxml RESOURCE_FILES_DIR/effects/warningnote_appear.fxml
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h	Fri Apr 16 15:56:24 2010 +0300
@@ -260,6 +260,9 @@
      */
     CAlfAppSrvSessionBase* UpMostClientAboveWg( TInt aWgId );
 
+    
+    CAlfAppSrvSessionBase* SrvSessionForControlGroup(CHuiControlGroup& aGroup);
+    
 public:
     
     CAlfAppSrvSessionBase* iOldSession;
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Fri Apr 16 15:56:24 2010 +0300
@@ -196,8 +196,13 @@
     void SetAlfWindowGroupId(TInt aWgId);
     void NotifyLowMemory(TInt aAmountOfFreeMemRequested);
     TInt ForceSwRendering(TBool aEnabled);
+    TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation);
+    TInt ReadPixels(CFbsBitmap* aBitmap);
     void SetAlfAppWindowGroup( TInt aID );
     
+    CAlfAppSrvSessionBase* SrvSessionForControlGroup(CHuiControlGroup& aGroup);
+    void DoBlankScreen(const RMessage2& aMessage);
+
 private:
 
     void CreateHuiEnvL();
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfdirectclient.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfdirectclient.h	Fri Apr 16 15:56:24 2010 +0300
@@ -69,6 +69,30 @@
      */
     IMPORT_C TInt ForceSwRendering( TBool aEnabled );
     
+    /**
+     * Gets display size and virtual rotation.
+     * @param aSize this will contain size.
+     * @param aRotation this will contain rotation.
+     * @return error code, KErrNone upon success.
+     * @internal
+     */
+    TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation);
+    
+    /**
+     * Reads pixels from surface to bitmap.
+     * @param aBitmapHandle bitmap handle.
+     * @return error code, KErrNone upon success.
+     * @internal
+     */
+    TInt ReadPixels(TInt aBitmapHandle);
+    
+    /**
+     * NGA Substitute for Avkon screen blanker.
+     * Only AknCapserver can use this method (protected using SID)
+     * Does not reference count, i.e. all calls are absolute 
+     * @return error code.
+     */
+    IMPORT_C TInt BlankScreen( TBool aEnabled );    
     };
 
 #endif
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Fri Apr 16 15:56:24 2010 +0300
@@ -104,7 +104,13 @@
     /** Effect is excluded from parent (or grandparent) effect (if it has effect which is applied to children) */
     EHuiCanvasFlagExcludeFromParentEffect = 0x80,
     /** Hint flag which is used for optimizations. Tells if fade effect(s) exist in visual tree */
-    EHuiCanvasFlagExternalFadeExistsInsideVisualTree = 0x100 
+    EHuiCanvasFlagExternalFadeExistsInsideVisualTree = 0x100,
+    /** Flag to indicate whether to include this visual to visibility calculation */
+    EHuiCanvasFlagIncludeToVisibilityCalculation = 0x200,
+    /** Flag to indicate whether surface is invisible (based on visibility calculation) */
+    EHuiCanvasFlagSurfaceInvisible = 0x400,
+    /** Flag to indicate whether surface is visible (based on visibility calculation) */
+    EHuiCanvasFlagSurfaceVisible = 0x800
     };
 
 /**
@@ -344,6 +350,8 @@
         
     IMPORT_C TBool HasCommandBuffers(TBool aAskFromChildren = ETrue) const;
     
+    IMPORT_C TBool HasTransParentClear() const;
+    
     // to handle background surface that may be set to the Window
 public:    
     
@@ -352,6 +360,26 @@
     IMPORT_C TRect& LayerExtent(); 
     IMPORT_C void SetLayerExtent(TRect& aExtent); 
 
+    // window area
+public:
+    
+    /**
+     * Sets shape. This affects only visible area calculation.
+     */
+    IMPORT_C void SetShape(const TPoint& aOrigin, const TRegion& aRegion);
+    /**
+     * Returns true if shape is different than display rect.
+     */
+    IMPORT_C TBool HasCustomShape() const;
+    /**
+     * Returns origin of window shape.
+     */
+    IMPORT_C TPoint ShapeOrigin() const;
+    /**
+     * Returns shape as region.
+     */
+    IMPORT_C const TRegion& ShapeRegion() const;
+
 public:
     
     void SetSize(const THuiRealSize& aSize, TInt aTransitionTime=0);    
@@ -402,6 +430,7 @@
     void DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const;
     void DrawStoredFullScreenRenderBuffer(TInt aCanvasDrawMode, CHuiGc& aGc) const;
     IMPORT_C void FreeRenderBuffer();
+    IMPORT_C TRect CommandBufferCoverage(TInt aOrientation);
 
 protected:
     virtual void VisualExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h	Fri Apr 16 15:56:24 2010 +0300
@@ -203,6 +203,9 @@
      */
     IMPORT_C void SetSessionId(TInt aSessionId);
 
+    IMPORT_C void SetSecureId(TInt aSecureId);
+    IMPORT_C TInt SecureId();
+
 private:
 
     /* Private methods */
@@ -235,6 +238,8 @@
 
     /** Session id */
     TInt iSessionId;
+    
+    TInt iSecureId;
 
 public:
 
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Fri Apr 16 15:56:24 2010 +0300
@@ -790,6 +790,14 @@
     IMPORT_C CHuiTexture* ForegroundTexture() const;
     
     /**
+     * Sets foreground texture / bitmap options.
+     * @param aBlendRequired ETrue if texture should be blend, EFalse if copy
+	 *        is sufficient.
+     * @internal
+     */
+    IMPORT_C void SetForegroundTextureOptions(TBool aBlendRequired);
+    
+    /**
      * Sets bitmap which is drawn on top of the frame
      * (when used with @c SetForegroundTexture).
      * 
@@ -805,6 +813,10 @@
      */
     IMPORT_C CFbsBitmap* ForegroundBitmap() const;
     
+    /**
+     * Copy raw screen data to bitmap.
+     */
+    IMPORT_C void CopyScreenToBitmapL(CFbsBitmap* aBitmap);
     
 private:
 
@@ -1007,6 +1019,8 @@
     CFbsBitmapDevice* iForegroundBitmapDevice;
     /** Graphics context for foreground bitmap */
     CFbsBitGc* iForegroundBitmapGc;
+    /** ETrue if foreground texture should be blend, EFalse otherwise */
+    TBool iForegroundTextureTransparency;
     };
 
 #endif  // __HUIDISPLAY_H__
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h	Fri Apr 16 15:56:24 2010 +0300
@@ -1004,9 +1004,10 @@
     IMPORT_C THuiMemoryLevel MemoryLevel();
     
     void DoSynchronize();
+    TBool iPauseDrawing;
 private:
-    MHuiSynchronizationObserver* iSynchObserver;
-    TInt iSynchId;
+    RPointerArray<MHuiSynchronizationObserver> iSynchObservers;
+    RArray<TInt> iSynchIds;
     };
 
 #endif  // __HUIENV_H__
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h	Fri Apr 16 15:56:24 2010 +0300
@@ -933,6 +933,16 @@
      */
     IMPORT_C void NotifyImagePreferredSize(const THuiImage& aImage, THuiRealRect aRect);
 
+public:
+
+    /**
+     * Copy screen to bitmap.
+     * @internal
+     * @param aBitmap bitmap to which data should be copied.
+     * @return error code, KErrNone upon success.
+     */
+    TInt CopyScreenToBitmap(CFbsBitmap* aBitmap);
+    
 protected:
 
     /* Constructors. */
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h	Fri Apr 16 15:56:24 2010 +0300
@@ -146,6 +146,9 @@
      */
     void UpdateBackgroundL();
 
+private:
+    
+    void FreeAllBackgroundTextureResources();
 
 private:
 
@@ -163,7 +166,6 @@
      
     /** Background should be reloaded the next time it is needed. */
     TBool iReloadBackground;
-    TBool iSkinChanged;
 
     class CSkinItem : public CBase
         {
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h	Fri Apr 16 15:56:24 2010 +0300
@@ -70,6 +70,7 @@
     TInt iId;
     TReal32 iElapsedTime;
     TInt iAnimatedTextureGroupId;
+    TBool iOriginalFileInUse;
     };
 
 
--- a/uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h	Fri Apr 16 15:56:24 2010 +0300
@@ -538,6 +538,9 @@
 
     EAlfEnableLowMemoryState = 4300,
     EAlfForceSwRendering,
+    EAlfBlankScreen,
+    EAlfGetSizeAndRotation,
+    EAlfReadPixels,
     
     EAlfLastReservedOpCmd = 10000
     };
--- a/uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h	Fri Apr 16 15:56:24 2010 +0300
@@ -34,7 +34,8 @@
     virtual void LowOnGraphicsMemory()=0;
     virtual void GraphicsMemoryGood(){}
     
-    virtual void AlfBridgeCallback(TInt, TAny*){};
+    virtual void AlfBridgeCallback(TInt, TAny*){}
+    virtual void HideTarget(TInt,TBool){};
     }; 
 
 /** Wrapper class IPC <-> MAlfCompositionController **/
@@ -293,6 +294,13 @@
      **/
     IMPORT_C static CAlfCompositionPixelSource* NewL(MAlfBufferProvider& aProvider, RWindow* aWindow = NULL);
     
+
+    /**
+     * Constructor for application to decide AO priority
+     */
+    IMPORT_C static CAlfCompositionPixelSource* NewL(MAlfBufferProvider& aProvider, TInt aPriority = CActive::EPriorityIdle, RWindow* aWindow = NULL );
+
+    
     /**
      *  Activate drawing for the first time or continue drawing if it is being paused or suspended
      **/
@@ -328,7 +336,7 @@
 
 private: // Internal / utils
     
-    void ConstructL(MAlfBufferProvider& aProvider, RWindow* aWindow);
+    void ConstructL(MAlfBufferProvider& aProvider, TInt aPriority, RWindow* aWindow);
     void ConstructSurfaceL(MAlfBufferProvider::TBufferCreationAttributes& aCreationAttributes);
     void FreeSurface();
     TUint8* Buffer(TInt aBufferNumber);
--- a/uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h	Fri Apr 16 15:56:24 2010 +0300
@@ -19,6 +19,9 @@
 
 #include <e32base.h>
 
+class CWsScreenDevice;
+class CFbsBitmap;
+
 /**
  * This provides additional alf drawing synchronization.
  * 
@@ -47,6 +50,21 @@
      */
     IMPORT_C TInt Finish();
 
+    /**
+     * Fallback copy screen to bitmap. This copies pixels from UI surface.
+     * This is similar to @c CWsScreenDevice::CopyScreenToBitmap. That method
+     * may use GPU memory and so cannot be guaranteed to succeed always.
+     * 
+     * @param aDevice screendevice.
+     * @param aBitmap bitmap to which pixels ought to be copied.
+     * @param aRect rect to copy.
+     * @return error code.
+     */
+    IMPORT_C static TInt FallbackCopyScreenToBitmap(
+        CWsScreenDevice& aDevice,
+        CFbsBitmap* aBitmap, 
+        const TRect& aRect);
+
 private:
     CAlfDrawer();
     void ConstructL();
--- a/uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorplugin.hrh	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorplugin.hrh	Fri Apr 16 15:56:24 2010 +0300
@@ -25,4 +25,8 @@
 // Extension interface "uids"
 #define KGoomClientSecureId     0x1000
 
+// Goom Events through Window Server
+#define KGoomMemoryLowEvent 0x10282DBF
+#define KGoomMemoryGoodEvent 0x20026790
+
 #endif // GOOMMONITORPLUGIN_HRH
--- a/uiacceltk/group/bld.inf	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/group/bld.inf	Fri Apr 16 15:56:24 2010 +0300
@@ -24,4 +24,6 @@
 PRJ_EXPORTS
 ../hitchcock/sis/uiaccelerator_stub.sis    /epoc32/release/armv5/urel/uiaccelerator_stub.sis
 ../../rom/alfred.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(alfred.iby)
+#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 ../../rom/alftranseffectplugin.iby   CORE_MW_LAYER_IBY_EXPORT_PATH(alftranseffectplugin.iby)
+#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
\ No newline at end of file
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def	Fri Apr 16 15:56:24 2010 +0300
@@ -40,4 +40,6 @@
 	?SendEvent@CAlfCompositionClientBase@@IAEHHPBXH@Z @ 39 NONAME ; int CAlfCompositionClientBase::SendEvent(int, void const *, int)
 	??1CAlfCompositionCntrlClient@@UAE@XZ @ 40 NONAME ; CAlfCompositionCntrlClient::~CAlfCompositionCntrlClient(void)
 	?SetSourceRect@CAlfCompositionSource@@UAEHABVTRect@@@Z @ 41 NONAME ; int CAlfCompositionSource::SetSourceRect(class TRect const &)
+	?GetListOfInactiveWindowGroupsWSurfaces@RAlfBridgerClient@@QAEHPAV?$RArray@H@@@Z @ 42 NONAME ; int RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(class RArray<int> *)
+	?NewL@CAlfCompositionPixelSource@@SAPAV1@AAVMAlfBufferProvider@@HPAVRWindow@@@Z @ 43  NONAME ; class CAlfCompositionPixelSource * CAlfCompositionPixelSource::NewL(class MAlfBufferProvider &, int, class RWindow *)
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def	Fri Apr 16 15:56:24 2010 +0300
@@ -61,4 +61,6 @@
 	_ZN26CAlfCompositionCntrlClientD2Ev @ 60 NONAME
 	_ZN21CAlfCompositionSource13SetSourceRectERK5TRect @ 61 NONAME
 	_ZThn32_N21CAlfCompositionSource13SetSourceRectERK5TRect @ 62 NONAME
+	_ZN17RAlfBridgerClient38GetListOfInactiveWindowGroupsWSurfacesEP6RArrayIiE @ 63 NONAME
+	_ZN26CAlfCompositionPixelSource4NewLER18MAlfBufferProvideriP7RWindow @ 64 NONAME
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -258,6 +258,11 @@
         return;
         }    
     
+    if (aEventType == KAlfCompositionLayoutSwitchComplete && iController)
+        {
+        iController->AlfBridgeCallback(KAlfCompositionLayoutSwitchComplete, NULL);
+        }
+    
     TInt* ptr = static_cast<TInt*>(aEventData);
     TInt target;
     
@@ -386,7 +391,18 @@
             iController->DeleteTarget(target);
             break;
             }
-            
+        
+        case KAlfCompositionTargetVisible:
+            {
+            iController->HideTarget(target, EFalse);
+            break;
+            }    
+
+        case KAlfCompositionTargetHidden:
+            {
+            iController->HideTarget(target, ETrue);
+            break;
+            }    
         default:
             break;
         }
@@ -813,6 +829,8 @@
     TInt iCurrentBuffer;
     
     TRect iSurfaceRect;
+    
+    TInt iWaiterAoPriority;
     };
 
 
@@ -825,12 +843,26 @@
     {
     CAlfCompositionPixelSource* me = new (ELeave) CAlfCompositionPixelSource();
     CleanupStack::PushL(me);
-    me->ConstructL(aProvider, aWindow);
+    me->ConstructL(aProvider, CActive::EPriorityIdle, aWindow);
     CleanupStack::Pop(me);
     return me;    
     }
 
 // ---------------------------------------------------------------------------
+// CAlfCompositionPixelSource::NewL
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CAlfCompositionPixelSource* CAlfCompositionPixelSource::NewL(MAlfBufferProvider& aProvider, TInt aPriority, RWindow* aWindow)
+    {
+    CAlfCompositionPixelSource* me = new (ELeave) CAlfCompositionPixelSource();
+    CleanupStack::PushL(me);
+    me->ConstructL(aProvider, aPriority, aWindow);
+    CleanupStack::Pop(me);
+    return me;    
+    }
+
+
+// ---------------------------------------------------------------------------
 // CAlfCompositionPixelSource::ActivateL
 // ---------------------------------------------------------------------------
 //
@@ -862,7 +894,7 @@
         {
         if( !iData->iSurfaceUpdateWaiter )
             {
-            iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, CActive::EPriorityIdle );
+            iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, iData->iWaiterAoPriority );
             }
 
         iData->iSurfaceUpdateWaiter->SetActive();
@@ -950,9 +982,11 @@
 // CAlfCompositionPixelSource::ConstructL
 // ---------------------------------------------------------------------------
 //
-void CAlfCompositionPixelSource::ConstructL(MAlfBufferProvider& aProvider, RWindow* aWindow)
+void CAlfCompositionPixelSource::ConstructL(MAlfBufferProvider& aProvider, TInt aPriority, RWindow* aWindow)
     {
     iData = CAlfCompositionPixelSourceData::NewL( aProvider );
+    iData->iWaiterAoPriority = aPriority;
+
     TInt screenNumber = KErrNotFound;
     if( aWindow )
         {
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -147,6 +147,30 @@
     SendReceive(aOp, aIPCArgs, aStatus );
     }
 
+
+EXPORT_C TInt RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups)
+    {
+    TInt err = KErrNone;
+    TInt array[10];
+    TPtr8 ptr((TUint8*)array,0,40);
+    err = SendReceive(EAlfGetListOfWGsHavingInactiveSurfaces, TIpcArgs(&ptr));
+    if (!err)
+        {
+        for(TInt i = 0; i < 10; i++)
+            {
+            if (array[i])
+                {
+                aWindowGroups->Append(array[i]);
+                }
+            else
+                {
+                break;
+                }        
+            }    
+        }
+    return err; 
+    }
+
 // Open
 // ---------------------------------------------------------------------------
 //
--- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h	Fri Apr 16 15:56:24 2010 +0300
@@ -18,6 +18,8 @@
 #ifndef CALFSENDBUFFER_H_
 #define CALFSENDBUFFER_H_
 
+//#define RD_SUBWINDOW_EFFECTS 
+
 #include <e32cmn.h>
 #include <e32std.h> 
 #include <s32mem.h>
@@ -119,6 +121,19 @@
 	    void WriteRegionL( const TUint8& aCommand, const TRegion& aRegion );
 	    
 	    /**
+	     * Writes ints followed by region.
+         * 
+         * Convenience function for writing region to the stream 
+         *
+         * @param aCommand   CommandId
+         * @param aRegion    Region
+         * @param aCount    Amount of TInt values to be streamed
+         * @param aFirst    The first value
+         * @param ...       variable aCount-1 amount of TInt values
+	     */
+	    void WriteRegionIntsL( const TUint8& aCommand, const TRegion& aRegion, TInt aCount, TRefByValue<const TInt> aFirst, ...);
+	    
+	    /**
          * WriteDescriptorAndIntsL
          * 
          * Convenience function for writing TDesC reference and TInt values to the stream.
@@ -187,13 +202,15 @@
          * @param aPoWriteIntList  Point array to be streamed
          */
         void WritePointArrayL( const TUint8& aCommand, const TArray<TPoint>* aPoWriteIntList );
-        
+
         /**
-         * WriteFlagsL
+         * SetOrientation
          * 
-         * Write flags to the stream
-         */
-        void WriteFlagsL();
+         * Set orientation. All drawing buffers will be tagged with the current orientation.
+         *
+         * @param aOrientatation 	New orientation
+         */        
+        void SetOrientation(TInt aOrientation);
         
 	//
 	// ARRAY IMPLEMENTATION
@@ -206,7 +223,7 @@
     TRect iBoundingRectangle;
     };
 
-
+#ifdef RD_SUBWINDOW_EFFECTS
 	void WriteArrayHeaderTemplateL();
 	void InitTOffsetElemArray(RArray<TOffsetElem> &aOffset);
 	void WriteArrayHeaderL(const TOffsetElem &aIndexArrayOffset);
@@ -216,6 +233,7 @@
 	void EndMarkerL(RArray<TOffsetElem> &aOffset, TInt &aMarker, const TRect &aRectangle, TInt aLayerId);
     void StartMarkerL(TRect aBoundingRectangle, TInt aLayerId);
     void EndMarkerL();
+#endif // RD_SUBWINDOW_EFFECTS
 	
        /**
         * SendL
@@ -789,6 +807,7 @@
         CAlfCompositionCntrlClient* iAlfCompositionCntrlClient;
         
         // array implementation
+#ifdef RD_SUBWINDOW_EFFECTS		
         RArray<TOffsetElem> iOffsetArray;
         TInt iMarker;
         TRect iBoundingRectangle;
@@ -797,5 +816,7 @@
         TInt iPreviousBlockOffset;
         TInt iExtraLayerId;
         TBool iLayersEnabled;
+#endif        
+        TInt iOrientation;
 	};
 #endif /*CALFSENDBUFFER_H_*/
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -593,7 +593,7 @@
 	
     AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); 
     AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup,  iRsWindowGroupNodeCount ); 
-    AMT_INC_COUNTER(iRsWindowGroupNodeCount ); 
+    AMT_INC_COUNTER(iRsTotalNodeCount ); 
     }
 
 // ---------------------------------------------------------------------------
@@ -636,7 +636,7 @@
 
     AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); 
     AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup,  iRsWindowGroupNodeCount ); 
-    AMT_DEC_COUNTER(iRsWindowGroupNodeCount ); 
+    AMT_DEC_COUNTER(iRsTotalNodeCount ); 
     }
 
 // ---------------------------------------------------------------------------
@@ -695,6 +695,12 @@
 
     AMT_INC_COUNTER( iRsNodeExtentChangedCount );
     AMT_SET_VALUE( iRsLatestNodeExtentRect, aRect );
+    AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ),
+                          iSizeMap, aWindowTreeNode.Window()->Handle(), 
+                          aRect.Size(), EAlfModuleTestTypeRenderStageChangeSize );
+    AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ),
+                          iPositionMap, aWindowTreeNode.Window()->Handle(), 
+                          aRect.iTl, EAlfModuleTestTypeRenderStageChangePosition );
     }
 
 // ---------------------------------------------------------------------------
@@ -729,14 +735,52 @@
 	iAlfSendBuffer->CommitL();
 
     AMT_INC_COUNTER( iRsTotalNodeFlagChangedCount );
+    AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.Window() ),
+                          iIntMap, aWindowTreeNode.Window()->Handle(), 
+                          EAlfModuleTestTypeRenderStageChangeFlag );
     }
 
 // ---------------------------------------------------------------------------
 // AttributeChanged
 // ---------------------------------------------------------------------------
 //
-void CAlfRenderStage::AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aAttribute )
+void CAlfRenderStage::AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aAttribute)
     {
+    if ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeClient &&
+         aWindowTreeNode.Window() != NULL )
+        {
+        TInt32 nodeId = (TInt32)&aWindowTreeNode;
+        
+        switch ( aAttribute )
+            {
+        case MWsWindowTreeObserver::EWindowShape:
+            {
+            TPoint origin( aWindowTreeNode.Window()->AbsRect().iTl );
+            
+            if ( aWindowTreeNode.Window()->WindowArea().Count() )
+                {
+                iAlfSendBuffer->WriteRegionIntsL( 
+                    EAlfNodeSetWindowArea, 
+                    aWindowTreeNode.Window()->WindowArea(), 
+                    3, 
+                    nodeId, 
+                    origin.iX,
+                    origin.iY );
+                }
+            else
+                {
+                iAlfSendBuffer->WriteIntsL( EAlfNodeSetWindowArea, 4, nodeId, 0, 0, 0 ); // no region
+                }
+            
+            iAlfSendBuffer->CommitL();
+            }
+            break;
+            
+        default:
+            break;
+            }
+        }
+        
     if ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor )
         {
         TInt32 nodeId = (TInt32)&aWindowTreeNode;
@@ -1059,7 +1103,9 @@
             }
         case CAlfHintGraphic::EAlfEndSubWindow:
             {
+#ifdef RD_SUBWINDOW_EFFECTS            
             iAlfSendBuffer->EndMarkerL();
+#endif
             break;
             }
             
@@ -1076,7 +1122,9 @@
         {
         case CAlfHintGraphic::EAlfBeginSubWindow:
             {
+#ifdef RD_SUBWINDOW_EFFECTS             
             iAlfSendBuffer->StartMarkerL(aBoundingRectangle, aLayerId);
+#endif
             break;
             }
         }
--- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -48,12 +48,17 @@
 const TInt KCacheChunkMinSize = 50000;
 const TUint8 KDivisibleByX = 8;
 const TInt KWindowFrameHeader1 = 6; // bytes
-const TInt KWindowFrameHeader2 = 18 + 10; // bytes // TP +10 
 
+#ifdef RD_SUBWINDOW_EFFECTS 
+const TInt KWindowFrameHeader2 = 23 + 10; // bytes // TP +10 
+#else
+const TInt KWindowFrameHeader2 = 23;
+#endif
 const TInt KAllRenderersMask = 63;
 const TInt KPossiblePerformanceProblemInWindow = 64;
 const TInt KPossiblePerformanceProblemInWindowThreshold = 1000;
 
+const TInt KFlushBufferTimeout = 50*1000; // 50ms
 
 enum TPatternSearchStates
     {
@@ -442,23 +447,6 @@
     }
 
 // ---------------------------------------------------------------------------
-// WriteFlagsL
-// ---------------------------------------------------------------------------
-//
-void CAlfRsSendBuffer::WriteFlagsL( )
-    {
-    if (iDisabled) // return if this send buffer is not in use
-        {
-        return;
-        }
-    
-    // space has been reserved for us
-    WriteInt8L( EAlfFrameFlags ); 
-    WriteInt32L( iFlags);
-    WriteInt8L( EAlfCommandEndMarker );
-    }
-
-// ---------------------------------------------------------------------------
 // WriteCommandL
 // writes 1 TInt value to the stream
 // ---------------------------------------------------------------------------
@@ -666,6 +654,49 @@
     }
 
 // ---------------------------------------------------------------------------
+// WriteRegionIntsL
+// ---------------------------------------------------------------------------
+//
+void CAlfRsSendBuffer::WriteRegionIntsL( const TUint8& aCommand, const TRegion& aRegion, 
+        TInt aCount, TRefByValue<const TInt> aFirst, ...)
+    {
+    if (iDisabled) // return if this send buffer is not in use
+        {
+        return;
+        }
+    
+    TInt count = aRegion.Count();
+    const TInt size = sizeof(TInt32) * ( 4 * count + 1 + aCount);
+
+    if (! InitCommandL( aCommand, size )){ return;}
+#ifdef _ALF_PRINT_WS_COMMANDS_    
+    iCommandDebugger->SetDescriptionAndSize( aCommand, size, R_ALF_COMMAND_DESCRIPTION_ARRAY );
+    iCommandDebugger->SetRegion( aRegion );
+    iCommandDebugger->Print();
+#endif
+
+	if ( aCount > 0 )
+	    {
+	    aCount--; // first item is serialized separately. It seems to exist at different location as rest of the parameters.
+	    WriteInt32L( aFirst );
+	    WriteL( (TUint8*)&aFirst + sizeof(TInt32), aCount * sizeof(TInt32) );
+	    }
+
+    WriteInt32L( count );
+    TInt i = 0;
+    while( i < count )
+        {
+        WriteL( (TUint8*)&aRegion[i].iTl.iX, 4 * sizeof(TInt32 ));
+        i++;
+        }
+    
+    if ( !iReceivingDrawingCommands )
+        {
+        WriteInt8L( EAlfCommandEndMarker );
+        }    
+    }
+
+// ---------------------------------------------------------------------------
 // WriteDescriptorAndIntsL
 // writes aCount amount of variables to the stream and updates stream index.
 // ---------------------------------------------------------------------------
@@ -973,6 +1004,7 @@
     TInt size = sizeof(TUint32) + // windowId
         sizeof(TUint32) + // next frame offset
         3 * sizeof(TUint8) + // command + contains unsupported commands + end marker
+        sizeof(TUint8) + sizeof(TUint32) + // orientation
         sizeof(TUint8) + // screen number ( in WriteFollowingFrameOffsetTemplate)
         sizeof(TUint32) * ( 4 * aRegionSize + 1 ) +  // updateregion 
         sizeof(TUint8) * KDivisibleByX + // possible padding
@@ -1037,12 +1069,19 @@
             {
             WriteInt8L( 0 );
 			}
+#ifdef RD_SUBWINDOW_EFFECTS         
         iArrayImplOffset = iOffset;
         InitMarker(iMarker);
+#endif        
 		WriteInt8L( EAlfFrameContainsUnsupportedCommands );
         WriteInt8L( 0 );
+		WriteInt8L( EAlfFrameOrientation );
+		WriteInt32L( iOrientation ); 
+        // These are for subwindow effects, that are not currently enabled
+#ifdef RD_SUBWINDOW_EFFECTS         
         WriteArrayHeaderTemplateL();
         InitTOffsetElemArray(iOffsetArray);
+#endif
         // </HEADER2>
         }
     }
@@ -1057,11 +1096,13 @@
         {
         return ETrue;
         }
+#ifdef RD_SUBWINDOW_EFFECTS  
     TOffsetElem e;
     if (aSendArray)
         {
         e = WriteIndexArrayL(iOffsetArray);
         }
+#endif
     
 #ifdef _OLD_STREAM    
     if ( iBufStream->Sink() )
@@ -1109,10 +1150,14 @@
 			}
         WriteInt8L( EAlfFrameContainsUnsupportedCommands );
 		WriteInt8L( iNonSupportedCommandsInWindow );
+	    WriteInt8L( EAlfFrameOrientation );
+	    WriteInt32L( iOrientation ); 
+#ifdef RD_SUBWINDOW_EFFECTS 
 		if (aSendArray) 
 		    {
 		    WriteArrayHeaderL(e);
 		    }
+#endif
 		/*iWindowHeaderStruct.iWindowEndOffset = previousPos.Offset();
         iWindowHeaderStruct.iUnsupportedCommandsInWindow = iNonSupportedCommandsInWindow;
         iBufStream->WriteL( (TUint8*)&iWindowHeaderStruct, sizeof(TWindowHeaderStruct) );*/
@@ -1134,6 +1179,7 @@
 const TInt KArrayOffsetTemplate = 23456789;
 const TInt KArraySizeTemplate = 23456789;
 
+#ifdef RD_SUBWINDOW_EFFECTS
 void CAlfRsSendBuffer::WriteArrayHeaderTemplateL()
 {
     WriteInt8L( EAlfCommandIndexArrayHeader );
@@ -1246,6 +1292,8 @@
     {
     EndMarkerL(iOffsetArray, iMarker, iBoundingRectangle, iLayerId);
     }
+#endif // RD_SUBWINDOW_EFFECTS
+
 // ---------------------------------------------------------------------------
 // SendL
 // sends data syncronously in one or more packets to the streamer server
@@ -1354,15 +1402,17 @@
       if ( !iFlushBufferTimer )
         {
         iFlushBufferTimer = CPeriodic::NewL( EPriorityNormal );
-        iFlushBufferTimer->Start( 5000, 10 * 1000000 , TCallBack( doFlushBuffer, this ));
+        iFlushBufferTimer->Start( KFlushBufferTimeout, 10 * 1000000 , TCallBack( doFlushBuffer, this ));
         }
     if ( !iFlushBufferTimer->IsActive() )
         {
         //__ALFLOGSTRING("CAlfRsSendBuffer::CommitL, activating timer");
-        iFlushBufferTimer->After( 5000 );
+        iFlushBufferTimer->After( KFlushBufferTimeout );
         }
     else
     	{
+        iFlushBufferTimer->Cancel();
+        iFlushBufferTimer->After( KFlushBufferTimeout );
     	//__ALFLOGSTRING("CAlfRsSendBuffer::CommitL, timer already active ");
     	}
     }
@@ -2119,3 +2169,13 @@
 #endif    
     iOffset = aOffset;
     }
+
+// ---------------------------------------------------------------------------
+// SetOrientation
+// ---------------------------------------------------------------------------
+//
+void CAlfRsSendBuffer::SetOrientation(TInt aOrientation)
+    {
+    iOrientation = aOrientation;
+    }
+      
--- a/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF	Fri Apr 16 15:56:24 2010 +0300
@@ -1108,4 +1108,6 @@
 	?Finish@CAlfDrawer@@QAEHXZ @ 1107 NONAME ; int CAlfDrawer::Finish(void)
 	??1CAlfDrawer@@UAE@XZ @ 1108 NONAME ; CAlfDrawer::~CAlfDrawer(void)
 	?NewL@CAlfDrawer@@SAPAV1@XZ @ 1109 NONAME ; class CAlfDrawer * CAlfDrawer::NewL(void)
+	?BlankScreen@RAlfDirectClient@@QAEHH@Z @ 1110 NONAME ; int RAlfDirectClient::BlankScreen(int)
+	?FallbackCopyScreenToBitmap@CAlfDrawer@@SAHAAVCWsScreenDevice@@PAVCFbsBitmap@@ABVTRect@@@Z @ 1111 NONAME ; int CAlfDrawer::FallbackCopyScreenToBitmap(class CWsScreenDevice &, class CFbsBitmap *, class TRect const &)
 
--- a/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF	Fri Apr 16 15:56:24 2010 +0300
@@ -1343,4 +1343,6 @@
 	_ZN10CAlfDrawerD0Ev @ 1342 NONAME
 	_ZN10CAlfDrawerD1Ev @ 1343 NONAME
 	_ZN10CAlfDrawerD2Ev @ 1344 NONAME
+	_ZN16RAlfDirectClient11BlankScreenEi @ 1345 NONAME
+	_ZN10CAlfDrawer26FallbackCopyScreenToBitmapER15CWsScreenDeviceP10CFbsBitmapRK5TRect @ 1346 NONAME
 
--- a/uiacceltk/hitchcock/Client/src/alfdirectclient.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alfdirectclient.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -68,6 +68,49 @@
     return SendReceive(EAlfForceSwRendering, TIpcArgs(aEnabled));
     }
 
+TInt RAlfDirectClient::GetSizeAndRotation(TSize& aSize, TInt& aRotation)
+    {
+    if (!Handle())
+        {
+        TRAPD(err, OpenL());
+        if (err)
+            {
+            return err;
+            }
+        }
+
+    TPckg<TSize> sizePckg(aSize);
+    TPckg<TInt> rotationPckg(aRotation);
+    return SendReceive(EAlfGetSizeAndRotation, TIpcArgs(&sizePckg, &rotationPckg));
+    }
+    
+TInt RAlfDirectClient::ReadPixels(TInt aBitmapHandle)
+    {
+    if (!Handle())
+        {
+        TRAPD(err, OpenL());
+        if (err)
+            {
+            return err;
+            }
+        }
+
+    return SendReceive(EAlfReadPixels, TIpcArgs(aBitmapHandle));
+    }
+
+EXPORT_C TInt RAlfDirectClient::BlankScreen( TBool aEnabled )
+    {
+    if (!Handle())
+        {
+        TRAPD(err, OpenL());
+        if (err)
+            {
+            return err;
+            }
+        }
+    return SendReceive(EAlfBlankScreen, TIpcArgs(aEnabled));
+    }
+
 // ---------------------------------------------------------------------------
 // Constructor
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/Client/src/alfdrawer.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/Client/src/alfdrawer.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -19,10 +19,13 @@
 
 
 #include <alf/alfdrawer.h>
+#include <alf/alfdirectclient.h>
 #include "alfcrppluginclient.h"
+#include "alflogger.h"
 
 #include <coemain.h>
 #include <w32std.h>
+#include <fbs.h>
 
 // Class to hold internal alf drawer data.
 NONSHARABLE_CLASS( CAlfDrawer::TAlfDrawerData )
@@ -39,6 +42,59 @@
 // Creates CAlfCrpPluginClient instance.
 static CAlfCrpPluginClient* CreateAlfCrpClientL();
 
+/**
+ * Misc utility methods for CAlfDrawer.
+ */
+NONSHARABLE_CLASS(AlfDrawerUtils)
+    {
+public:
+
+    enum TRotation
+        {
+	    ERotationNone,
+	    ERotation90,
+	    ERotation180,
+	    ERotation270
+	    };
+
+    /**
+     * Inverse rotate.
+     */
+    static void RotateBack(TInt aVirtualRotation, TRect& aRect, TSize aScreenSize)
+        {
+        if( aVirtualRotation == ERotation90 || aVirtualRotation == ERotation270 )
+            {
+            RotateRect( aVirtualRotation, aRect, aScreenSize, ETrue );  
+            }
+        else if( aVirtualRotation == ERotation180 )
+            {
+            RotateRect( aVirtualRotation, aRect, aScreenSize, EFalse );  
+            }    
+        }
+
+    /**
+     * Rotate rect
+     */
+    static void RotateRect(TInt aDirection, TRect& aRect, TSize aScreenSize, TBool aMirror)
+        {
+        if (aMirror) aDirection = (aDirection+2)%4; // magic    
+        for (;aDirection > 0; aDirection--) 
+            {
+            TSize rotatedSize(aRect.Size().iHeight, aRect.Size().iWidth);     
+            aRect = TRect(TPoint(aRect.iTl.iY, aScreenSize.iWidth - aRect.iTl.iX - rotatedSize.iHeight ), rotatedSize);
+            aScreenSize = TSize(aScreenSize.iHeight, aScreenSize.iWidth);
+            }
+        }
+        
+    /**
+     * Copies screen to bitmap using 'read pixels' operation.
+     */
+    static void DoCopyScreenToBitmapL( 
+        CWsScreenDevice& aDevice,
+        CFbsBitmap* aBitmap, 
+        const TRect& aRect );
+        
+    };
 
 // ---------------------------------------------------------------------------
 // NewL
@@ -92,6 +148,304 @@
     }
 
 // ---------------------------------------------------------------------------
+// FallbackCopyScreenToBitmap
+// ---------------------------------------------------------------------------
+//
+EXPORT_C TInt CAlfDrawer::FallbackCopyScreenToBitmap(
+        CWsScreenDevice& aDevice,
+        CFbsBitmap* aBitmap, 
+        const TRect& aRect)
+    {
+    TRAPD(err, AlfDrawerUtils::DoCopyScreenToBitmapL(aDevice, aBitmap, aRect));
+    return err;    
+    }
+
+// ---------------------------------------------------------------------------
+// DoCopyScreenToBitmapL
+// ---------------------------------------------------------------------------
+//
+void AlfDrawerUtils::DoCopyScreenToBitmapL( 
+    CWsScreenDevice& aDevice,
+    CFbsBitmap* aBitmap, 
+    const TRect& aRect )
+    {
+    if (aDevice.GetScreenNumber() != 0) // only screen 0 supported for now
+        {
+        User::Leave(KErrNotSupported);
+        }
+                
+    if ( !aBitmap || 
+         !aBitmap->Handle() || 
+         aBitmap->IsCompressedInRAM() || 
+         aBitmap->ExtendedBitmapType() != KNullUid )
+        {
+        User::Leave(KErrArgument);
+        }            
+
+    __ALFLOGSTRING("DoCopyScreenToBitmapL begin");
+    
+    RAlfDirectClient client;
+    CleanupClosePushL(client);
+
+    // Get size & virtual rotation from ALF side.
+    // GetSizeAndRotation will also create session to server.
+
+    TInt rotation = 0;
+    TSize size;
+    User::LeaveIfError(client.GetSizeAndRotation(size, rotation));
+
+    // Calculate device size in pixels (same as aDevice.SizeInPixels())
+    TSize deviceSize = size;
+    if (rotation == AlfDrawerUtils::ERotation90 ||
+        rotation == AlfDrawerUtils::ERotation270 )
+        {
+        deviceSize.iWidth = size.iHeight;
+        deviceSize.iHeight = size.iWidth;
+        }
+
+    // Clip aRect to screen boundaries
+    TRect actualRect(deviceSize);
+    actualRect.Intersection(aRect);
+    
+    __ALFLOGSTRING2("DoCopyScreenToBitmapL - requested rect origin %d x %d", actualRect.iTl.iX, actualRect.iTl.iY ) ;
+    __ALFLOGSTRING2("DoCopyScreenToBitmapL - requested rect %d x %d", actualRect.Size().iWidth, actualRect.Size().iHeight ) ;
+    __ALFLOGSTRING2("DoCopyScreenToBitmapL - bitmap rect %d x %d", aBitmap->SizeInPixels().iWidth, aBitmap->SizeInPixels().iHeight );
+    __ALFLOGSTRING1("DoCopyScreenToBitmapL - bitmap mode %d", aBitmap->DisplayMode() );
+
+    if ( TRect( aBitmap->SizeInPixels() ).IsEmpty() || 
+         actualRect.IsEmpty() )
+        {
+        __ALFLOGSTRING("DoCopyScreenToBitmapL - empty rect or zero bitmap size");
+        CleanupStack::PopAndDestroy(); // CleanupClosePushL
+        return;
+        }
+
+    // Select display mode.
+    
+    TDisplayMode surfaceDisplayMode = EColor64K;
+    TDisplayMode bitmapDisplayMode = aBitmap->DisplayMode();
+    if ( bitmapDisplayMode == EColor16MU || 
+         bitmapDisplayMode == EColor16MA || 
+         bitmapDisplayMode == EColor16MAP )
+        {
+        surfaceDisplayMode = bitmapDisplayMode;
+        }
+
+    __ALFLOGSTRING3("DoCopyScreenToBitmapL - surface size %d x %d, mode %d", 
+        size.iWidth, size.iHeight, surfaceDisplayMode ) ;
+
+    // Read pixels to temporary bitmap
+    CFbsBitmap* surfaceBitmap = new (ELeave) CFbsBitmap;
+    CleanupStack::PushL( surfaceBitmap );
+    User::LeaveIfError( surfaceBitmap->Create( size, surfaceDisplayMode ) );
+    
+    TInt err = client.ReadPixels( surfaceBitmap->Handle() );              
+    __ALFLOGSTRING1("DoCopyScreenToBitmapL - ReadPixels returned %d", err);
+    User::LeaveIfError( err );  
+
+    // Copy data
+    TInt surfaceStride = CFbsBitmap::ScanLineLength(size.iWidth, surfaceDisplayMode);
+    __ALFLOGSTRING2("DoCopyScreenToBitmapL - DisplayMode %d, Stride %d", surfaceDisplayMode, surfaceStride);  
+
+    TDisplayMode displayMode = surfaceDisplayMode;
+    
+    TInt8 bytesPerPixel = 2;
+    switch( displayMode )
+        {
+        case EColor64K:
+            {
+            bytesPerPixel = 2;
+            break;
+            }
+        case EColor16MU:
+        case EColor16MA:
+        case EColor16MAP:
+            {
+            bytesPerPixel = 4;
+            break;
+            }
+        
+        default:
+            {
+            __ALFLOGSTRING1("DoCopyScreenToBitmapL - display mode not supported %d", displayMode);
+            User::Leave( KErrNotSupported );
+            }
+        }
+    
+    // actualRect (/aRect) must be converted to correct coordinate system.
+    TRect surfaceRect(actualRect);
+    AlfDrawerUtils::RotateBack(rotation, surfaceRect, deviceSize);
+    surfaceRect.Intersection(TRect(size));
+    
+    __ALFLOGSTRING2("DoCopyScreenToBitmapL - surface rect tl %d x %d", surfaceRect.iTl.iX, surfaceRect.iTl.iY ) ;
+    __ALFLOGSTRING2("DoCopyScreenToBitmapL - surface rect size %d x %d", surfaceRect.Size().iWidth, surfaceRect.Size().iHeight ) ;
+
+    CFbsBitmap* bitmap = NULL;
+    TBool needTempBitmap = ETrue;
+
+    if( aBitmap->DisplayMode() == displayMode && actualRect == aRect && aBitmap->SizeInPixels() == aRect.Size() )
+        {
+        // Copy data direcly to given bitmap
+        bitmap = aBitmap;
+        needTempBitmap = EFalse;
+        }
+    else 
+        {
+        // Create temporary bitmap which maches the sufrace's pixel format and source rect size
+        bitmap = new (ELeave) CFbsBitmap;
+        CleanupStack::PushL( bitmap );
+        TInt err = bitmap->Create( actualRect.Size(), displayMode );       
+        __ALFLOGSTRING1("DoCopyScreenToBitmapL - Create returned %d", err );
+        User::LeaveIfError( err );
+        __ALFLOGSTRING("DoCopyScreenToBitmapL - display mode or size don't mach -> using temp bitmap" );            
+        }
+
+    surfaceBitmap->BeginDataAccess();
+    bitmap->BeginDataAccess();
+    
+    TUint8* surfacePtr = (TUint8*)surfaceBitmap->DataAddress() + surfaceStride * surfaceRect.iTl.iY;
+    
+    TUint8* bitmapPtr = (TUint8*)bitmap->DataAddress();
+    TInt rowBegin = surfaceRect.iTl.iX * bytesPerPixel;
+    TInt captureBitmapWidth = surfaceRect.Width() * bytesPerPixel;              
+
+    const TSize bitmapSize = bitmap->SizeInPixels();
+    
+    // Initialize with direct copy case parameters
+    TInt bitmapPtrColumnDelta = bytesPerPixel;
+    TInt bitmapPtrRowDelta = bitmap->DataStride();
+    
+    const TSize surfaceRectSize(surfaceRect.Size());
+    if ( rotation == AlfDrawerUtils::ERotationNone )
+        {
+        __ALFLOGSTRING("DoCopyScreenToBitmapL - direct copy") ;
+        
+        // Direct copy case
+        for ( TInt row = surfaceRectSize.iHeight - 1 ; row >= 0  ; --row )
+            {
+            // Copy only the desired part of the bitmap
+            memcpy( bitmapPtr, 
+                    surfacePtr + rowBegin, 
+                    captureBitmapWidth );
+            surfacePtr += surfaceStride;
+            bitmapPtr += bitmap->DataStride();
+            }
+        }
+    else
+        {
+        // Handle rotation cases
+        //
+        // 0 degree case
+        //    A B C
+        //    1 2 3
+        // 90 degrees anti-clockwise
+        //    C 3
+        //    B 2 
+        //    A 1
+        // 180 degrees anti-clockwise
+        //    3 2 1
+        //    C B A
+        // 270 degrees anti-clockwise
+        //    1 A
+        //    2 B
+        //    3 C
+        // 
+        switch (rotation)
+            {
+            case AlfDrawerUtils::ERotation90:
+                bitmapPtrColumnDelta = -bitmap->DataStride();
+                bitmapPtrRowDelta = bytesPerPixel;
+                bitmapPtr += ( bitmapSize.iHeight - 1 ) * bitmap->DataStride();
+                break;
+            case AlfDrawerUtils::ERotation180:
+                bitmapPtrColumnDelta = -bytesPerPixel;
+                bitmapPtrRowDelta = -bitmap->DataStride();
+                bitmapPtr += ( bitmapSize.iHeight - 1 ) * bitmap->DataStride() + ( bitmapSize.iWidth - 1 ) * bytesPerPixel;
+                break;
+            case AlfDrawerUtils::ERotation270:
+                bitmapPtrColumnDelta = bitmap->DataStride();
+                bitmapPtrRowDelta = -bytesPerPixel;
+                bitmapPtr += ( bitmapSize.iWidth - 1 ) * bytesPerPixel;
+                break;
+            default:
+                break;
+            }
+    
+        // We go through surface row by row, column by column and
+        // copy pixel data to appropriate place to bitmap
+        if ( bytesPerPixel == 4 )
+            {
+            __ALFLOGSTRING("DoCopyScreenToBitmapL - four bytes per pixel, rotated copy") ;
+            
+            for ( TInt row = surfaceRectSize.iHeight - 1 ; row >= 0 ; --row )
+                {
+                TUint8* rowBitmapPtr = bitmapPtr;
+                TUint8* rowSurfacePtr = surfacePtr + rowBegin;
+                for ( TInt column = surfaceRectSize.iWidth - 1 ; column >= 0 ; --column )
+                    {
+                    *((TUint32*)rowBitmapPtr) = *((TUint32*)rowSurfacePtr);
+                    
+                    rowBitmapPtr += bitmapPtrColumnDelta;
+                    rowSurfacePtr += bytesPerPixel;
+                    }
+        
+                surfacePtr += surfaceStride;
+                bitmapPtr += bitmapPtrRowDelta;
+                }
+            }
+        else
+            {
+            // Now bytesPerPixel == 2
+            __ALFLOGSTRING("DoCopyScreenToBitmapL - two bytes per pixel, rotated copy") ;
+            for ( TInt row = surfaceRectSize.iHeight - 1 ; row >= 0 ; --row )
+                {
+                TUint8* rowBitmapPtr = bitmapPtr;
+                TUint8* rowSurfacePtr = surfacePtr + rowBegin;
+                for ( TInt column = surfaceRectSize.iWidth - 1 ; column >= 0 ; --column )
+                    {
+                    *((TUint16*)rowBitmapPtr) = *((TUint16*)rowSurfacePtr);
+                    
+                    rowBitmapPtr += bitmapPtrColumnDelta;
+                    rowSurfacePtr += bytesPerPixel;
+                    }
+        
+                surfacePtr += surfaceStride;
+                bitmapPtr += bitmapPtrRowDelta;
+                } 
+            }
+        }
+    __ALFLOGSTRING("DoCopyScreenToBitmapL - copy finished" );
+    surfaceBitmap->EndDataAccess(ETrue);
+    bitmap->EndDataAccess();
+
+    if( !needTempBitmap )
+        {
+        bitmap = NULL;
+        }
+    else // bitblit the temporary bitmap to given bitmap
+        {
+        CFbsBitmapDevice* tempBitmapDevice = CFbsBitmapDevice::NewL( aBitmap );
+        CleanupStack::PushL( tempBitmapDevice );
+        CFbsBitGc* tempBitmapGc = NULL;
+        User::LeaveIfError( tempBitmapDevice->CreateContext( tempBitmapGc ) );             
+        CleanupStack::PushL( tempBitmapGc );
+
+        tempBitmapGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
+        tempBitmapGc->BitBlt( TPoint(), bitmap );
+        
+        CleanupStack::PopAndDestroy( tempBitmapGc );
+        CleanupStack::PopAndDestroy( tempBitmapDevice );
+        CleanupStack::PopAndDestroy( bitmap );
+        }
+    
+    CleanupStack::PopAndDestroy( surfaceBitmap );
+    
+    CleanupStack::PopAndDestroy(); // CleanupClosePushL
+    
+    __ALFLOGSTRING("DoCopyScreenToBitmapL - Done");    
+    }
+
+// ---------------------------------------------------------------------------
 // Constructor
 // ---------------------------------------------------------------------------
 //
--- a/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h	Fri Apr 16 15:56:24 2010 +0300
@@ -65,6 +65,7 @@
     // 130
     EAlfEffectFx,
     EAlfStopEffectFx,
+    EAlfStopControlEffectFx,
     EAlfControlEffectFx,
     EAlfRegisterEffectFx,
     EAlfUnregisterEffectFx,
@@ -79,6 +80,9 @@
     EAlfReleaseTemporaryChunk,
     EAlfBridgeSetScreenRotation,
     EAlfDSSynchronize,
+    EAlfDSSetWindowArea,
+    EAlfDSSetTransparencyAlphaChannel,
+    EAlfDSIncludeToVisibilityCalculation,
 
     KUnInitialized
     };
--- a/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h	Fri Apr 16 15:56:24 2010 +0300
@@ -50,6 +50,14 @@
     IMPORT_C void SendAsynchronous(TInt aOp, const TIpcArgs& aIPCArgs,TRequestStatus& aStatus );
 
     IMPORT_C TInt SendBlind(TInt aOp, const TIpcArgs& aIPCArgs );
+    
+     /**
+     * Asks list of window groups that have graphics surfaces even
+     * they are not supposed to be seen on screen
+     * @param aArray array to be populated
+     * @return error code.
+     */    
+    IMPORT_C TInt GetListOfInactiveWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups);
 private:
     TInt iSpare1;
     TInt iSpare2;
--- a/uiacceltk/hitchcock/CommonInc/alflogger.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alflogger.h	Fri Apr 16 15:56:24 2010 +0300
@@ -89,7 +89,7 @@
     #define __ALFFXLOGSTRING1(C, X)
     #define __ALFFXLOGSTRING2(C, X, Y)
     #define __ALFFXLOGSTRING3(C, X, Y, Z)
-    #define __ALFFXLOGSTRING4(C, X, Y, W)
+    #define __ALFFXLOGSTRING4(C, X, Y, Z, W)
 
 #endif
 #if (ALF_FXLOGGING_METHOD==1)
@@ -104,7 +104,7 @@
     #define __ALFFXLOGSTRING1(C, X)        {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X);}
     #define __ALFFXLOGSTRING2(C, X, Y)     {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y);}
     #define __ALFFXLOGSTRING3(C, X, Y, Z)  {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z);}
-    #define __ALFFXLOGSTRING4(C,X,Y,Z,W)   {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z,W);}
+    #define __ALFFXLOGSTRING4(C, X, Y, Z, W)   {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue<const TDesC>(tempLogDes()),X,Y,Z,W);}
 #endif
 
 #endif // ALFLOGGER_H
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Fri Apr 16 15:56:24 2010 +0300
@@ -1,3 +1,19 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
 #include "e32base.h"
 #include "e32debug.h"
 
@@ -5,13 +21,16 @@
 #define ALFMODULETEST_H
 
 // Define this to build module testing enchanced version of ALF
-// #define USE_MODULE_TEST_HOOKS_FOR_ALF 
+//#define USE_MODULE_TEST_HOOKS_FOR_ALF 
 
 #if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL)
 
+#define AMT_DATA()
 #define AMT_FUNC(func)                                
-#define AMT_FUNC_EXC(func)    
-#define AMT_FUNC_EXC_IF(cond, func)    
+#define AMT_FUNC_EXC(func)
+#define AMT_FUNC_EXC_RET(ret, func)
+#define AMT_FUNC_EXC_IF(cond, func)
+#define AMT_FUNC_EXC_IF_RET(cond, ret, func)
 #define AMT_INC_COUNTER(member)
 #define AMT_DEC_COUNTER(member)
 #define AMT_SET_VALUE(member, val)
@@ -20,6 +39,16 @@
 #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_MAP_APPEND(memberMap, key, type, defaultValue)          
+#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)     
+#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)            
+#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)            
+#define AMT_MAP_SET_VALUE(memberMap, key, value, type)              
+#define AMT_MAP_INC_VALUE(memberMap, key, type)                              
+#define AMT_MAP_DEC_VALUE(memberMap, key, type)                     
+#define AMT_MAP_RESET(memberMap)                                    
+
 #define AMT_PRINT_STATE()
 
 #ifndef AMT_CONTROL
@@ -46,8 +75,10 @@
 // Generic macros
 #define AMT_DATA()                  AMT_CONTROL()->iModuleTestData
 #define AMT_FUNC(func)              if (AMT_DATA()->iIsEnabled) {func;}                                         
-#define AMT_FUNC_EXC(func)          {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();}        
+#define AMT_FUNC_EXC(func)          {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();}
+#define AMT_FUNC_EXC_RET(ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {ret = func;} AMT_CONTROL()->Unlock();}
 #define AMT_FUNC_EXC_IF(cond, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();}        
+#define AMT_FUNC_EXC_IF_RET(cond, ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {ret = func;} AMT_CONTROL()->Unlock();}
 
 // Single operation macros, that will do lock/unlock.
 #define AMT_INC_COUNTER(member)     AMT_FUNC_EXC(AMT_DATA()->member++)
@@ -62,11 +93,351 @@
 #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)
 
+// Map operation macros, that will do lock/unlock
+#define AMT_MAP_APPEND(memberMap, key, type, defaultValue)          AMT_FUNC_EXC(AMT_DATA()->memberMap.Append(key, type, defaultValue))
+#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type)     AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetValue(key, value, type))
+#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type)            AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() + 1, type))
+#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type)            AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() - 1, type))
+#define AMT_MAP_SET_VALUE(memberMap, key, value, type)              AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetValue(key, value, type))
+#define AMT_MAP_INC_VALUE(memberMap, key, type)                     AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type)              
+#define AMT_MAP_DEC_VALUE(memberMap, key, type)                     AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type)
+#define AMT_MAP_RESET(memberMap)                                    AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset())
 
 // *** Global object names
 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
 
+
+/**
+ * TAlfModuleTestType specifies recognized test types.
+ */
+enum TAlfModuleTestType
+    {
+    // Do not use this value when creating item.
+    EAlfModuleTestTypeNone,
+    
+    // Render stage component specific tests
+    EAlfModuleTestTypeRenderStageChangeSize,
+    EAlfModuleTestTypeRenderStageChangePosition,
+    EAlfModuleTestTypeRenderStageChangeFlag,
+    
+    // Streamer hierarchy model component specific tests
+    EAlfModuleTestTypeHierarchyModelChangeSize,
+    EAlfModuleTestTypeHierarchyModelChangePosition,
+    EAlfModuleTestTypeHierarchyModelChangeFlag,    
+    
+    // Server bridge component specific tests
+    EAlfModuleTestTypeBridgeChangeSize,
+    EAlfModuleTestTypeBridgeChangePosition,
+    EAlfModuleTestTypeBridgeChangeFlag,
+    
+    // Do not use this value when creating item.
+    // This is just meant for Find operations when all tests are accepted.
+    EAlfModuleTestTypeAll
+    };
+
+
+/**
+ * CAlfModuleTestItem
+ * 
+ * Provides key-value pair that is used in TAlfModuleTestMap.
+ */
+template< class T >
+NONSHARABLE_CLASS( TAlfModuleTestItem )
+    {
+    
+public:
+
+    /**
+     * Constructor to initialize variables.
+     * 
+     * @param aKey Key that identifies the item.
+     *             In test cases this could be for example handle.
+     * @param aTestType Defines for what this test item is meant for.
+     */
+    TAlfModuleTestItem( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue ):
+        iKey( aKey ),
+        iTestType( aTestType ),
+        iValue( aDefaultValue ),
+        iValueSetCount( 0 )
+        {
+        }
+
+    
+    /**
+     * @param aObject Value to be compared.
+     * @return ETrue if given object equals the value of this item.
+     *         Else EFalse.
+     */
+    TBool Equals( const T& aValue, const TAlfModuleTestType& aTestType ) const
+        {
+        // Also, check that value has been set. If it has not been set,
+        // then think objects as unequals.
+        return ( iValueSetCount > 0 
+                 && iValue == aValue 
+                 && TestTypeMatch( aTestType ) );
+        }
+
+    
+    /**
+     * @return TInt Key that should be set during creation of this object.
+     */
+    TInt Key() const
+        {
+        return iKey;
+        }
+
+    /**
+     * @see ValueSet to check if the value has already been set.
+     * 
+     * @return const T& Value that corresonds the key.
+     */
+    const T& Value() const
+        {
+        return iValue;
+        }
+    
+    
+    /**
+     * @param aValue Value to be set for the key
+     */
+    void SetValue( const T& aValue )
+        {
+        iValue = aValue;
+        ++iValueSetCount;
+        }
+
+    
+    /**
+     * @return TInt Informs how many times the value has been set. 
+     */
+    TInt ValueSetCount() const
+        {
+        return iValueSetCount;
+        }
+    
+    /**
+     * @return const TAlfModuleTestType& Defines what the test is for
+     */
+    const TAlfModuleTestType& TestType() const
+        {
+        return iTestType;
+        }
+
+    
+    /**
+     * @param aTestType
+     * @return TBool ETrue if flag matches this item. Else EFalse.
+     */
+    TBool TestTypeMatch( const TAlfModuleTestType& aTestType ) const
+        {
+        return ( EAlfModuleTestTypeAll == aTestType
+                 || iTestType == aTestType );
+        }
+
+    
+    /**
+     * Resets the item info
+     */
+    void Reset()
+        {
+        iValueSetCount = 0;
+        }
+
+    
+private: // data    
+    
+    TInt iKey;
+    TAlfModuleTestType iTestType;    
+    T iValue;
+    TInt iValueSetCount;
+    
+    };
+
+
+/**
+ * Class CAlfModuleTestMap
+ * 
+ * Provides map functionality for the key-value-pairs.
+ * In test cases, this should most likely be used so, that 
+ * first test case classes create items with certain keys, for example with handle values.
+ * Then, define hooks are used in the code to update values that corresond the correct handles.
+ * In the end, test case classes can check that items have correct values set and if the test
+ * is passed.
+ */
+template< class T >
+NONSHARABLE_CLASS( TAlfModuleTestMap )
+    {
+public:
+
+    // Maximum item count in the map
+    static const TInt KMaxArrayCount = 50;
+
+    
+    /**
+     * Constructor to initialize variables.
+     */
+    TAlfModuleTestMap():
+        iCount( 0 ),
+        iSetValueCallCount( 0 )
+        {            
+        }
+
+    
+    /**
+     * @param aKey
+     * @param aTestType Informs what type of test is accepted. Others are skipped.
+     * @return T* Ownership is not transferred.
+     *            NULL if item is not found.
+     */
+    TAlfModuleTestItem< T >* Find( TInt aKey, const TAlfModuleTestType& aTestType )
+        {
+        // Try to find the item corresponding the given key.
+        for ( TInt i = 0; i < iCount; ++i )
+            {
+            TAlfModuleTestItem< T >& testItem( iArray[ i ] );
+            if ( testItem.Key() == aKey
+                 && testItem.TestTypeMatch( aTestType ) )
+                {
+                return &( testItem );
+                }
+            }
+        // Item corresponding the given key was not found.
+        return NULL;
+        }    
+    
+    
+    /**
+     * Function to append new item into the map.
+     * 
+     * @param aKey
+     * @param aTestType Describes for what case the appended test item is created for.
+     * @return TInt System wide error code.
+     */    
+    TInt Append( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue )
+        {
+        if ( iCount == KMaxArrayCount )
+            {
+            // Array already full.
+            return KErrOverflow;
+            }
+        else if ( Find( aKey, aTestType ) )
+            {
+            // Key has already been inserted.
+            return KErrAlreadyExists;
+            }
+        
+        // Append new key value set into the array.
+        iArray[ iCount ] = TAlfModuleTestItem< T >( aKey, aTestType, aDefaultValue );
+        ++iCount;
+        return KErrNone;        
+        }
+
+    
+    /**
+     * Sets the value for the item.
+     * Item itself should already exist in the array before
+     * setting its value here. See, Append function.
+     * 
+     * @param aKey
+     * @param aValue
+     * @return TInt System wide error code.
+     */
+    TInt SetValue( TInt aKey, const T& aValue, const TAlfModuleTestType& aTestType )
+        {
+        // Increase counter, because this function is called.
+        ++iSetValueCallCount;
+        TAlfModuleTestItem< T >* item( Find( aKey, aTestType ) );        
+        if ( !item )
+            {
+            // Item was not found from the array.        
+            return KErrNotFound;
+            }        
+        // Item exists. So, set its values.
+        item->SetValue( aValue );
+        return KErrNone;
+        }
+
+    
+    /**
+     * Resets the map
+     */
+    void Reset()
+        {
+        // Just reset the counter.
+        // We do not bother to reset map items, because when counter is reseted
+        // already set items and their info is left out of the scope.
+        iCount = 0;
+        iSetValueCallCount = 0;
+        }
+    
+    
+    /**
+     * Checks if all the values of items in the array match the given value.
+     * 
+     * @param aValue Reference to the value that items are compared to.
+     * @param aTestType Informs the test type whose items should be compared.
+     */
+    TInt CountEquals( const T& aValue, const TAlfModuleTestType& aTestType ) const
+        {
+        TInt count( 0 );
+        for ( TInt i = 0; i < iCount; ++i )
+            {
+            if ( iArray[ i ].Equals( aValue, aTestType ) )
+                {
+                // Item matches
+                ++count;            
+                }
+            }
+        return count;
+        }
+
+
+    /**
+     * @return TInt Number of map items
+     */
+    TInt ItemCount() const
+        {
+        return iCount;
+        }
+
+
+    /**
+     * @return const TAlfModuleTestItem< T >& Reference to the map item
+     */
+    const TAlfModuleTestItem< T >& Item( TInt aIndex ) const
+        {
+        return iArray[ aIndex ];
+        }
+
+    
+    /**
+     * @return TInt Number of times SetValue function has been called
+     *              since last reset. This information can be used
+     *              to check if hooks have been used correct times during
+     *              a test case. Notice, that this informs the number of
+     *              function calls, not the number of times a value has actually
+     *              set for some item.
+     */
+    TInt SetValueCallCount() const
+        {
+        return iSetValueCallCount;
+        }
+    
+    
+private: // data
+    
+    TAlfModuleTestItem< T > iArray[ KMaxArrayCount ];
+    // Informs number of array items
+    TInt iCount;
+    // Informs how many times SetItem has been called since last reset.
+    // Notice, that this informs the number of function calls, not the number
+    // of times a value has actually set for some item.
+    TInt iSetValueCallCount;
+    
+    };
+
+    
 /*
  *  Class CAlfModuleTestData
  */
@@ -115,10 +486,48 @@
                          iLatestVisualExtentRect.iTl.iX, iLatestVisualExtentRect.iTl.iY, 
                          iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height());
         RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount);
-        RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount);        
+        RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount);
+        RDebug::Print(_L("iSizeMap =>"));
+        PrintSizeMapState( iSizeMap );
+        RDebug::Print(_L("iPositionMap =>"));
+        PrintPositionMapState( iPositionMap );        
         RDebug::Print(_L("*** ALF INTERNAL STATE ***"));
         }
+
     
+    void PrintSizeMapState( TAlfModuleTestMap< TSize > aMap )
+        {
+        RDebug::Print(_L("*** ALF INTERNAL SIZE MAP STATE -->"));
+        RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), 
+                         aMap.ItemCount(), aMap.SetValueCallCount());
+        for ( TInt i = 0; i < aMap.ItemCount(); ++i )
+            {
+            const TAlfModuleTestItem< TSize >& item( aMap.Item( i ) );
+            RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"),
+                             i, item.Key(), item.TestType(), item.ValueSetCount());
+            RDebug::Print(_L("Map item index=%d, width=%d, height=%d"),
+                             i, item.Value().iWidth, item.Value().iHeight);
+            }
+        RDebug::Print(_L("<-- ALF INTERNAL SIZE MAP STATE ***"));
+        }
+
+    
+    void PrintPositionMapState( TAlfModuleTestMap< TPoint > aMap )
+        {
+        RDebug::Print(_L("*** ALF INTERNAL POSITION MAP STATE -->"));
+        RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), 
+                         aMap.ItemCount(), aMap.SetValueCallCount());
+        for ( TInt i = 0; i < aMap.ItemCount(); ++i )
+            {
+            const TAlfModuleTestItem< TPoint >& item( aMap.Item( i ) );
+            RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"),
+                             i, item.Key(), item.TestType(), item.ValueSetCount());
+            RDebug::Print(_L("Map item index=%d, x=%d, y=%d"),
+                             i, item.Value().iX, item.Value().iY);
+            }
+        RDebug::Print(_L("<-- ALF INTERNAL POSITION MAP STATE ***"));
+        }    
+
     
 public:
     TBool iIsEnabled;           // *** not yet implemented. For run-time enabling/disabling of the test system.  
@@ -177,6 +586,14 @@
     TInt iASE_Temp2;
     TInt iASE_Temp3;
     TInt iASE_Temp4;
+
+    // Map that contains integer items that can be specified for certain test cases.
+    TAlfModuleTestMap< TInt > iIntMap;    
+    // Map that contains size items that can be specified for certain test cases.
+    TAlfModuleTestMap< TSize > iSizeMap;
+    // Map that contains position items that can be specified for certain test cases.
+    TAlfModuleTestMap< TPoint > iPositionMap;    
+
     };
 
 
--- a/uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h	Fri Apr 16 15:56:24 2010 +0300
@@ -101,6 +101,7 @@
     virtual void CommitL() = 0;
     virtual void WriteIntsL(TUint8 aCommand, TInt aCount, TInt* aArray) = 0;
     virtual RAlfBridgerClient* Client() = 0;
+    virtual void SetOrientation(TInt aOrientation) = 0;
     };
 
 /**
--- a/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h	Fri Apr 16 15:56:24 2010 +0300
@@ -123,6 +123,7 @@
      
      EAlfContentTag,
      EAlfFrameFlags,
+     EAlfFrameOrientation,
     
      EAlfPacketReady,
      EAlfPacketNotReady,
@@ -157,9 +158,13 @@
      EAlfDebugTrackNode,
      EAlfNodeLayerExtentChanged,
      EAlfNodeLayerUsesAlphaFlagChanged,
+
+     // 110
      EAlfNodeFadeAllChildren,
      EAlfCommandIndexArray,
      EAlfCommandIndexArrayHeader,
+     EAlfNodeSetWindowArea,    
+     
      // This must be kept as last command!
      EAlfLastCommand
      };
--- a/uiacceltk/hitchcock/ServerCore/BWINS/alfappservercoreu.DEF	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/BWINS/alfappservercoreu.DEF	Fri Apr 16 15:56:24 2010 +0300
@@ -308,4 +308,5 @@
 	?FindWgForAppUid@CAlfStreamerBridge@@QAEHVTUid@@@Z @ 307 NONAME ; int CAlfStreamerBridge::FindWgForAppUid(class TUid)
 	?FindAppUidForWgId@CAlfStreamerBridge@@QAE?AVTUid@@H@Z @ 308 NONAME ; class TUid CAlfStreamerBridge::FindAppUidForWgId(int)
 	?SetLayerUsesAplhaFlag@CAlfWindow@@QAEXH@Z @ 309 NONAME ; void CAlfWindow::SetLayerUsesAplhaFlag(int)
+	?ClientAboutToExit@CAlfWindowFxPlugin@@UAEXVTThreadId@@@Z @ 310 NONAME ; void CAlfWindowFxPlugin::ClientAboutToExit(class TThreadId)
 
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h	Fri Apr 16 15:56:24 2010 +0300
@@ -367,6 +367,8 @@
     
     void EnvEnableLowMemoryState(const RMessage2& aMessage);
     void EnvForceSwRendering(const RMessage2& aMessage);
+    void EnvGetSizeAndRotation(const RMessage2& aMessage);
+    void EnvReadPixels(const RMessage2& aMessage);
         
 private:
 
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Fri Apr 16 15:56:24 2010 +0300
@@ -65,12 +65,14 @@
                         CHuiVisual* aEffectedVisual,
                         CHuiVisual* aTemporaryPresenterVisual,
                         TBool aIsLayout, 
-                        TBool aHideWhenFinished) 
+                        TBool aHideWhenFinished,
+                        TBool aCanDestroyOrHideImmediately) 
                 : iHandle(aHandle), 
                 iEffectedVisual(aEffectedVisual),
                 iTemporaryPresenterVisual(aTemporaryPresenterVisual),
                 iIsLayout(aIsLayout),
-                iHideWhenFinished(aHideWhenFinished)
+                iHideWhenFinished(aHideWhenFinished),
+                iCanDestroyOrHideImmediately(aCanDestroyOrHideImmediately)
                         {
 //                        RDebug::Printf("TEffectCleanupStruct - 0x%x 0x%x, %d", iEffectedVisual, iTemporaryPresenterVisual, iIsLayout );
                         };
@@ -80,6 +82,8 @@
                 TBool iIsLayout;
 
                 TBool iHideWhenFinished;
+                
+                TBool iCanDestroyOrHideImmediately;
 				
 				// not own, unless iEffectedVisual has EShouldDestroy flag enabled
                 CHuiVisual* iEffectedVisual;
@@ -129,7 +133,18 @@
             TRect& aFullscreen,
             CAlfScreen* aScreen,
             TBool& aSubtreeVisible,
+            TBool& aHasVisualsWithLayers,
             TBool aChildCanBeOpaque );
+
+    /**
+     * Updates layer visibilities.
+     */
+    void HandleLayerVisibility(
+            CHuiLayout* aLayout,
+            CHuiControlGroup& aControlGroup,
+            CHuiControl& aControl,
+            TBool aVisible );
+    
     /**
      * This method shows the control group in roster, however the aWhere param
      * is modified so that controlgroup appears at the right position depending on
@@ -184,6 +199,7 @@
     void AlfGfxEffectEndCallBack( TInt aHandle );
    
     TInt FindClientWindowGroupId( TInt aScreenNumber, CHuiControlGroup& aControlGroup );
+    TInt FindWindowGroupNodeId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) const;
     
     void RemoveAllTemporaryPresenterVisuals();
 
@@ -222,9 +238,24 @@
     void DoUpdateMemoryLevel();
     
     /**
-     * Cancels all effects due to low memory.
+     * Modify all effects due to low memory.
      */
-    void LowMemoryCancelAllEffects();
+    void OnLowMemoryModifyAllEffects();
+
+    /**
+     * Gets size & rotation.
+     * @param aSize size.
+     * @param aRotation rotation.
+     * @return error code.
+     */
+    TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation);
+    
+    /**
+     * Reads pixels to bitmap.
+     * @param aBitmap bitmap.
+     * @return error code.
+     */
+    TInt ReadPixels(CFbsBitmap* aBitmap);
 
     /**
       * Sets HuiControlGroup as Alf application window group
@@ -245,7 +276,13 @@
      * gets another N milliseconds. Most cases, the first N milliseconds is enough.
      */
     void HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData);
-        
+    
+	// Experimental
+    TBool IsFullScreenDrawn( TInt aOrientation);
+	
+    void LayoutSwitchStart();
+    void LayoutSwitchComplete();
+    
 private:    
     
     
@@ -285,12 +322,14 @@
     // This is needed if we have to abort an effect
     void HandleGfxStopEffectsL( TAlfBridgerData data );
     
+    void HandleGfxStopControlEffectsL( TAlfBridgerData data );
+    
 	/**
 	*	RemoveEffectFromApp
 	*
 	*	Removes effects on appui.
 	*/
-    void RemoveEffectFromApp(TInt aAppUid);
+    void RemoveEffectFromApp(TInt aSecureId, TInt aWgId = -1 );
     
     // component effect handling
     void HandleGfxControlEffectsL( TAlfBridgerData data );
@@ -341,7 +380,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 SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately);
 
     /*
      *	AddEffectItemL
@@ -358,7 +397,8 @@
             CHuiControl* aEffectControl,
             TBool aInsertTemporaryVisual,
             TBool& aItemDestroyed,
-            TBool aIsExitEffect = EFalse);
+            TBool aIsExitEffect = EFalse,
+            TBool aCanDestroyOrHideImmediately = EFalse);
             
 
     /*
@@ -371,20 +411,13 @@
             CHuiControl* aEffectControlGroup,
             TInt& aItemsDestroyed,
             TBool aAddLayout = ETrue,
-            TBool aIsExitEffect = EFalse);
+            TBool aIsExitEffect = EFalse,
+            TBool aCanDestroyOrHideImmediately = EFalse);
 
     /*
      *	ListFamilyTreeL
      */   
     void ListFamilyTreeL( RPointerArray<CHuiLayout>& aArray, const CHuiLayout* aLayout );
-    /*
-     * SetupEffectLayoutContainerL
-     * 
-     * This method creates an own temporary presenter visual visual and binds it to aSourceVisul
-     * using SetExternalContentL. Finally the effect entry is added to iEffectCleanupStack, 
-     * thus it can be cleaned after effect completion.
-     */
-    void SetupEffectContainerL(TInt aHandle, CHuiCanvasVisual* aSourceVisual, TBool aIsExitEffect);
 
     /*
      * RemoveTemporaryPresenterItem
@@ -479,6 +512,12 @@
 	
 	void HandleSetWindowOpacityL( TAlfBridgerData& aData );
 	
+	void HandleSetTransparencyAlphaChannelL( TAlfBridgerData& aData );
+	
+	void HandleIncludeToVisibilityCalculationL( TAlfBridgerData& aData );
+	
+	void HandleSetWindowAreaL( TAlfBridgerData& aData );
+	
 	void HandleReorderWindowL( TAlfBridgerData& aData );
 	
 	void HandlePostCanvasBufferL( TAlfBridgerData& aData );
@@ -502,6 +541,8 @@
 	void HandleSetNodeTracking( TAlfBridgerData& aData );
 	
 	void HandleSetFadeEffectL( TAlfBridgerData& aData );
+	
+	void HandleMoveWindowToNewGroupL( TAlfBridgerData& aData );
 
     void HandleSetLayoutSwitchEffectL();
 	
@@ -605,7 +646,30 @@
             TInt& aScreenNumber, 
             TAlfControlGroupEntry** aAlfGroup = NULL );
 
-    CHuiControlGroup* FindControlGroupByAppId( TInt aAppId );
+    /**
+     * Finds control group which matches the given secure ID. For more detailed search, 
+     * you can provide the client window group ID.
+     * 
+     * @param aSecureId Secure ID to seacrh for
+     * @param aWgId Client window group ID. Ignored if -1.
+     * @return Pointer to found control gruop. NULL if not found.
+     */
+    CHuiControlGroup* FindControlGroupBySecureId( TInt aSecureId, TInt aWgId = -1 ) const;
+    
+    /**
+     * Finds control gruop which matches the full screen effect end state.
+     * 
+     * @return Pointer to found control gruop. NULL if not found.
+     */
+    CHuiControlGroup* FindControlGroupByFullScreenToEffect() const;
+    
+    /**
+     * Finds control gruop which matches the full screen effect start state.
+     * 
+     * @return Pointer to found control gruop. NULL if not found.
+     */
+    CHuiControlGroup* FindControlGroupByFullScreenFromEffect() const;
+    
     /**
      * This method deletes controlgroup which has been assosiated with given window group id. 
      * Control group may or may not be active in roster.
@@ -703,7 +767,22 @@
     RPointerArray<CAlfScreen> iAlfScreens;
     void SetCursorTimerL(TUint aTime = 0, CHuiVisual* aCursor = 0);
     TBool IsAlfOriginatedWindow(CHuiCanvasVisual& aVisual);
+    
+   // Experimental
+    TBool IsFullScreenDrawnRecursive(
+            CHuiLayout* aLayout, 
+            CHuiControlGroup& aControlGroup,
+            CHuiControl& aControl,
+            TBool& aFullscreenCovered, 
+            TRect& aFullscreen,
+            CAlfScreen* aScreen,
+            TBool& aSubtreeVisible, 
+            TBool aChildCanBeOpaque,
+            TInt aOrientation);
 
+    
+    void MarkAllLayersHiddenRecursive(CHuiLayout* aLayout);
+    
 NONSHARABLE_CLASS ( TDeadControlGroup )
     {
 public:
@@ -846,6 +925,10 @@
     RArray<TRegisteredEffectsStruct> iAlfRegisteredEffects;
     CHuiEnv* iHuiEnv;
 	CAlfAppUi* iAppUi;
+    CAlfLayoutSwitchEffectCoordinator* LayoutSwitchEffectCoordinator()
+        {
+        return iLayoutSwitchEffectCoordinator;
+        }
 
 private:    
 
@@ -871,6 +954,10 @@
     mutable RRegionBuf<KAlfBridgeRegionGranularity> iTempRegion;
     TBool iBgSurfaceFound;
     TBool iInLowMemMode;
+
+    TBool iHomeScreenWallpaperWindowFound;
+    TBool iBgAnimHidden;
+    
     CAlfLayoutSwitchEffectCoordinator* iLayoutSwitchEffectCoordinator;
     TInt iAlfSecureId; 	    
     TBool iSwRenderingEnabled;
@@ -879,10 +966,9 @@
     TBool iLowMemoryMode;
     THuiMemoryLevel iCurrentMemoryLevel;
     
-    #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
-    TInt iTempTotalActiveVisualCount;
-    TInt iTempTotalPassiveVisualCount;
-    #endif
+    TInt iIdForEAlfDSSynchronizeOp;
+    TInt iIdForLayoutSwitchFrameSync;
+    
     #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
     TInt activevisualcount;
     TInt passivevisualcount;
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Fri Apr 16 15:56:24 2010 +0300
@@ -31,7 +31,7 @@
         virtual ~CAlfRosterFreezeEndTimer();
 
     public: // New functions
-        void Start( TTimeIntervalMicroSeconds32 aPeriod );
+        void Start( TTimeIntervalMicroSeconds32 aPeriod, TCallBack aCallBack  );
         
     protected:  // Functions from base classes
         void DoCancel();
@@ -43,7 +43,9 @@
       
     private:    // Data
         CAlfBridge& iBridge;
-                
+ 	public:
+	   	TInt iSafeCounter;
+        TCallBack iCallBack;        
     };
 
 
@@ -60,7 +62,8 @@
         virtual ~CAlfEffectEndTimer();
 
     public: // New functions
-        void Start( TTimeIntervalMicroSeconds32 aPeriod, TInt aHandle );
+        void Start( TTimeIntervalMicroSeconds32 aPeriod );
+        void AddFinishedHandleL(TInt aHandle);
         
     protected:  // Functions from base classes
         void DoCancel();
@@ -72,8 +75,7 @@
       
     private:    // Data
         CAlfBridge& iBridge;
-        TInt iHandle;
-                
+        RArray<TInt> iHandles;
     };
 
 // ---------------------------------------------------------
@@ -82,6 +84,25 @@
 //
 NONSHARABLE_CLASS( CAlfLayoutSwitchEffectCoordinator ) : public CBase, public MAlfGfxEffectObserver
     {
+    public:
+        enum TEvent
+            {
+            EEventLayoutSwitch,
+            EEventBlankOn,
+            EEventBlankOff,
+            EEventLowMemory
+            };
+    
+        enum TState
+            {
+            EStateIdle,
+            EStateFreezeFx,
+            EStateBlankFx,
+            EStateThemeFx
+            };
+
+        typedef TState (*TStateFunction)(TEvent aEvent);
+
     public:  // Constructors and destructor
         CAlfLayoutSwitchEffectCoordinator( CAlfBridge& aBridge );
         virtual ~CAlfLayoutSwitchEffectCoordinator();
@@ -90,13 +111,47 @@
         void AlfGfxEffectEndCallBack( TInt aHandle );
     
     public:
+        void Blank(TBool aEnabled);
+        void LowMemoryEvent();
         void BeginLayoutSwitch();
-        void Cancel();
         
+        void Event(TEvent aEvent);
+        void Transition(TState aNewState, TState aPreviousState);
+
+    private:
+        TState NextIdleState(TEvent aEvent);
+        TState NextFreezeState(TEvent aEvent);
+        TState NextBlankState(TEvent aEvent);
+        TState NextThemeState(TEvent aEvent);
+
+        void FreezeFinished();
+
+    public:            
+        TBool IsThemeEffectEnabled() const;
+        TBool LayoutSwitchEffectsExist() const;
+
+		void EnableSafeCounter(TBool aEnable)
+			{
+			if (iRosterFreezeEndTimer)
+				{
+				if (aEnable)
+					{
+					iRosterFreezeEndTimer->iSafeCounter = 0;
+					}
+				else
+					{
+					iRosterFreezeEndTimer->iSafeCounter = KErrNotFound;
+					}
+				}
+			}        
+    
     private:
         AknTransEffect::TContext NextLayoutSwitchContext();
         void SetLayoutSwitchEffect(AknTransEffect::TContext aContext);
-        TBool LayoutSwitchEffectsExist();
+        
+        void FreezeRoster(TBool aFrozen);
+        
+        static TInt DoFreezeFinished(TAny* aAny);
         
     private: // Data
         
@@ -104,7 +159,11 @@
         AknTransEffect::TContext iLayoutSwitchEffectContext;
         TThreadPriority iOriginalPriority;
         CAlfRosterFreezeEndTimer* iRosterFreezeEndTimer;
-    };
+        TBool iBlankEnabled;
+        
+        TState iCurrentState;
+        TBool iLayoutSwitchNotCompleted;
+	};
 
 // ---------------------------------------------------------
 // Effects states are used for effects request that arrive before the effected 
@@ -160,16 +219,18 @@
         
         void ConstructL(TInt aAction, RMemReadStream& aStream);
         
-        TBool ResetTimerL(CAlfBridge* aBridge);
+        TBool InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize);
         
         void NotifyDrawingTimeout();
 
         // Information from BeginFullScreen
         TInt iType;
-        TInt iWg1;
-        TInt iWg2;
+        TInt iToWg;
+        TInt iFromWg;
         TInt iToAppId;
         TInt iFromAppId;
+        TInt iToSecureId;
+        TInt iFromSecureId;
         TRect iRect;
         
         // ETrue if waiting for window group to appear
@@ -182,7 +243,7 @@
         // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application
         TInt iAppStartScreenshotItemHandle;
         
-        RRegion iPaintedRegion;
+        
         enum TEffectType
         {
             ENotDefinedEffect = 0,
@@ -191,8 +252,17 @@
         };
         
         TEffectType iEffectType;
+        
+        // Display dimension, iPaintedRegion is clipped to this when determining, if there is enough drawing to the group
         TSize iDisplaySize;
+        
+        // gathers the painted region for the effected application. When enough region has been painted, the effect is forced.
+        RRegion iPaintedRegion;
+        
         CAlfBridge* iBridge; // for callback. not own.
         
+        // If the visual is shown by some other visual by a screenshot, this is set ETrue.
+        TBool iCanDestroyOrHideImmediately;
+        
         CPeriodic* iDrawingCompleteTimer;
         };
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h	Fri Apr 16 15:56:24 2010 +0300
@@ -162,6 +162,7 @@
 	void DoNodeWindowGroupChainedL();
 	void DoNodeWindowGroupChainBrokenAfterL();
 	void DoNodeAttributeChangedL();
+	void DoNodeSetWindowAreaL();
 	void DoNodeDebugTrackL();
 	void DoNodeFadeAllChildrenL();
 private: // from bridge
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfnodes.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfnodes.h	Fri Apr 16 15:56:24 2010 +0300
@@ -370,7 +370,8 @@
             TInt aScreenNumber );
     
     void MoveToWindowGroup( TUint32 aNewGroupId );
-      
+    void SetWindowAreaL( RMemReadStream* aStream );
+    
 protected:
 	
     void ConstructL( CAlfHierarchyModel* aModel, RMemReadStream* aStream  );
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Fri Apr 16 15:56:24 2010 +0300
@@ -38,7 +38,11 @@
     EAlfBridgerBlindSend,
     EAlfSetScreenRotation, 
     EAlfGetNativeWindowHandles,
-    EAlfSynchronize
+    EAlfSynchronize,
+    EAlfPostDataToCompositionClient,
+    EAlfPostDataToCompositionTarget,
+    EAlfGetListOfWGsHavingInactiveSurfaces, 
+    EAlfQueueRequestBGSessions
     };
 
 enum TAlfCompOps{
@@ -65,7 +69,11 @@
     KAlfCompositionWServScreenNumber,
     KAlfCompositionSourceScreenNumber,
     KAlfCompositionGoodOnGraphicsMemory,
-    KAlfCompositionTargetVisible
+    KAlfCompositionTargetVisible,
+    KAlfCompositionTargetHiddenBGAnim,
+    KAlfCompositionTargetVisibleBGAnim,
+    
+    KAlfCompositionLayoutSwitchComplete
     
     };
 
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h	Fri Apr 16 15:56:24 2010 +0300
@@ -35,7 +35,7 @@
     static TInt LaunchServer(TThreadId& aThreadId, CAlfStreamerBridge* aBridge );
     static void NewLC(CAlfStreamerBridge* aBridge);
 	~CAlfStreamerServer();
-    void HandleClientExit(const CSession2* aClient);
+    void HandleClientExit(const CAlfStreamerServerSession* aClient);
     CAlfWindowManager* WindowMgr() 
         {
         return iWindowMgr;
@@ -62,6 +62,18 @@
     void ValidateToken(CAlfStreamerServerSession* aSession, const RMessage2& aMessage);
 
     void FreeCompositionSessionExtents(CAlfStreamerServerSession* aSession);
+
+    // ALF use
+    void CreatePermissionTokenL(TInt aAlfToken, TInt aWindowHandle, TInt aWindowGroup);
+    void ReleasePermissionTokenL(TInt aAlfToken);
+    void QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp);  
+    void HandleCompositionRequestL(CAlfStreamerServerSession* aSession, TInt aOp, TPtr8& aClientBuf);
+
+    void RemoveTargetFromInactiveSurfaces(TInt aTarget);
+    void AddTargetFromInactiveSurfaces(TInt aTarget);
+    void GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso = ETrue);
+    void QueueRequestBGAnimSessionsL(const TPtrC8& aPtr, TInt aOp);
+    
     
 private:
     void ConstructL();
@@ -73,6 +85,10 @@
 
     CAlfStreamerServerSession* WservSession(TInt aScreenNumber);
     
+    TInt SearchCommonEntryForToken(const RMessage2& aMessage);
+    CAlfStreamerServerSession* SearchSessionForToken(TInt aToken);
+    
+    
 private:
     CAlfStreamerBridge* iBridge; // not owned
     mutable TUint iSessions;
@@ -84,15 +100,15 @@
     RPointerArray<CAlfStreamerServerSession> iCompositionHostSessions;
     RPointerArray<CAlfStreamerServerSession> iWindowServerSessions;
     
-    class CCompositionToken : public CBase
-    {   
-    public:
+    class TCompositionToken
+        {   
+        public:
         
         /*
          * CCompositionToken is used by CAlfCompositionSource and CAlfCompositionHost
          * for maintaining layer sharing permissions.
          */
-        CCompositionToken( TInt aKey, TInt aSecretKey, TInt aFlags, TInt aTarget, TInt aScreenNumber, TBool aCombinedTarget = EFalse) : 
+        TCompositionToken( TInt aKey, TInt aSecretKey, TInt aFlags, TInt aTarget, TInt aScreenNumber, TBool aCombinedTarget = EFalse) : 
             iKey(aKey),
             iSecretKey(aSecretKey), 
             iFlags(aFlags),
@@ -106,16 +122,31 @@
             TInt iTarget;
             TInt iScreenNumber;
             TBool iCombinedTarget;
+            TInt iAlfKey;
+            
     };
     
-    RArray<CCompositionToken> iCompositionTokens;
+    RArray<TCompositionToken> iCompositionTokens;
+
     CAsyncCallBack * iRendezvous;
+
+public:    
+    struct TAlfCompParams
+        {
+        TInt iTarget; 
+        TInt iTarget2;  // padding actually
+        TInt iWindowHandle;
+        TInt iWindowGroup;
+        }; 
+
+    RArray<TAlfCompParams> iAlfTargets;
+    RArray<TAlfCompParams> iInactiveSurfaces;
     };
 
 NONSHARABLE_CLASS(CAlfStreamerServerSession): public CSession2
     {
 public:
-    CAlfStreamerServerSession();
+    CAlfStreamerServerSession(const TThreadId& aThreadId);
     ~CAlfStreamerServerSession();
     void ServiceL(const RMessage2& aMessage);
     void HandleCompositionOpL(TInt aOp, const RMessage2& aMessage, CAlfStreamerServer* aServer);
@@ -129,6 +160,12 @@
     void SetScreenNumber(TInt aScreennumber);
     TInt ScreenNumber() const;
     TSurfaceId& ExtentSurfaceId();
+    TInt& AlfToken(){ return iAlfToken; }
+    TBool IsBgAnimSession(){return iIsBgAnimSession;}
+    TThreadId ThreadId() const
+		{
+		return iThreadId;
+		} 
     
 private:
     RArray<TInt> iLoadedPlugins;
@@ -143,7 +180,10 @@
     
     // Surface id of the composition client. If composition client has set extent to some other screen than where its actual window is. 
     // This is used to identify layers created for this composition client 
-    TSurfaceId iExtentSurfaceId;  
+    TSurfaceId iExtentSurfaceId;
+    TInt iAlfToken;
+    TBool iIsBgAnimSession;
+    TThreadId iThreadId;
     };
 
 #endif
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h	Fri Apr 16 15:56:24 2010 +0300
@@ -255,6 +255,39 @@
      * @param Duration to new opacity value
      */
     IMPORT_C void SetOpacity(TReal32 aOpacity, TUint aDuration = 0) __SOFTFP;
+
+    /**
+     * Window area
+	 * @param aOrigin origin of shape.
+	 * @param aRegion window shape.
+     */
+    void SetWindowArea(const TPoint& aOrigin, const TRegion& aRegion);
+    
+	/**
+	 * Reset current window area.
+	 */
+    void SetWindowArea();
+
+    /**
+	 * Set transparency alpha channel.
+	 * @param aActive ETrue if transparency alpha channel enabled, EFalse if not.
+	 */
+    void SetTransparencyAlphaChannel(TBool aActive);
+
+    /**
+	 * Returns transparency alpha channel.
+	 */
+    TBool TransparencyAlphaChannel() const;
+
+    /**
+     * Returns ETrue if included to visibility calculation. EFalse otherwise.
+     */
+    TBool IsIncludedToVisibilityCalculation() const;
+    
+    /**
+     * Include to visibility calculation.
+     */
+    void IncludeToVisibilityCalculation(TBool aActive);
     
     public: // utils
     
@@ -356,6 +389,9 @@
 
     TAlfWindowCommandBufferAttributes* CreateWindowCommandBufferAttributes(TInt& aIndex);
 
+    TAny* CreateSetWindowAreaL(TInt& aOffset, TInt aScreenNumber, 
+        const TPoint& aOrigin, const TRegion& aRegion);
+
     void CreateInBufferL();
 
 private:
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindowdata.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindowdata.h	Fri Apr 16 15:56:24 2010 +0300
@@ -54,6 +54,12 @@
     // was not set inactive because was reserved,
     // should be set inactive as soon as is reserved.
     TInt iFlags;
+
+    RRegion iWindowArea;
+    TPoint iWindowAreaOrigin;
+    
+    TBool iTransparencyAlphaChannel;
+    TBool iIncludeToVisibilityCalculation;
     };
 
 
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindowfxplugin.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindowfxplugin.h	Fri Apr 16 15:56:24 2010 +0300
@@ -45,6 +45,9 @@
     /** Cancel asynch message(s) from client */    
     IMPORT_C virtual void CancelMessage(TInt aMessageId);
 
+    /** Client about to exist, discard message(s) from client */    
+    IMPORT_C virtual void ClientAboutToExit(TThreadId aClientId);
+
     /**
     * Pure Virtuals
     */
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindowmanager.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindowmanager.h	Fri Apr 16 15:56:24 2010 +0300
@@ -248,6 +248,8 @@
     
     IMPORT_C CAlfStreamerBridge* Bridge();
     
+    void HandleClientExit(TThreadId aThreadId);
+    
 private: // utils
 
     CAlfWindowManager();
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -1448,3 +1448,20 @@
     return sessionAboveGivenWgId;
     }
 
+CAlfAppSrvSessionBase* CAlfAppServer::SrvSessionForControlGroup(CHuiControlGroup& aGroup)
+    {
+    CAlfAppSrvSessionBase* result = NULL;
+    iSessionIter.SetToFirst();
+    while (iSessionIter)
+      {
+      CAlfAppSrvSessionBase* session = reinterpret_cast<CAlfAppSrvSessionBase*>(iSessionIter++);
+      if ( session->GetHandleFromInterface(EHuiObjectTypeControlGroup, &aGroup) != KErrNotFound )
+          {
+          result = session;
+          break;
+          }
+      }
+    return result;
+    }
+
+
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -364,9 +364,10 @@
         	{
       		iAnimatedTextures.operator[](index)->EnableAnimation(EFalse); 
         	}
-       	
+#ifndef SYMBIAN_BUILD_GCE       	
       	StoreControlGroupOrderL(*display, EFalse ); // do not hide  
-       	// background must be drawn as long as the effect is displayed 
+#endif
+      	// background must be drawn as long as the effect is displayed 
        	// as the background will be visible if the effect does not cover full screen
        	// or is partially transparent.
     	}
@@ -421,6 +422,7 @@
             iControlGroupOrder.AppendL( &group );
             }
         }
+    
     // at the end the lowest index the bottom most and the biggest index the top most.
     
     // hide at the end so it does not affect the order of the group in the roster
@@ -429,7 +431,7 @@
         for ( TInt i = 0 ; i < iControlGroupOrder.Count() ; i++ )
             {
             CHuiLayout* hostContainer = iControlGroupOrder[i]->Control(0).ContainerLayout( NULL );
-            hostContainer->iOpacity.Set(0.f); 
+
             aDisplay.Roster().Hide( *iControlGroupOrder[i] );
             }
         }
@@ -437,6 +439,22 @@
     
 void CAlfAppSrvSession::ShowControlGroupsInOrderL(CHuiDisplay& aDisplay)
     {
+#ifdef SYMBIAN_BUILD_GCE
+    iControlGroupOrder.Reset();
+    // gather all the control groups that belong to this session
+    for ( TInt g = 0 ; g < aDisplay.Roster().Count() ; g++ )
+        {
+        // first append the bottom one
+        CHuiControlGroup& group = aDisplay.Roster().ControlGroup( g );
+        
+        // make sure we only store control groups for this session
+        if ( GetHandleFromInterface(EHuiObjectTypeControlGroup, &group) != KErrNotFound )
+            {
+            iControlGroupOrder.AppendL( &group );
+            }
+        }
+#endif
+    // put this session's controlgroups on top
     while ( iControlGroupOrder.Count() )
         {
         CHuiControlGroup& group = *iControlGroupOrder[iControlGroupOrder.Count()-1];
@@ -445,9 +463,11 @@
         if ( GetHandleFromInterface(EHuiObjectTypeControlGroup, &group) != KErrNotFound )
             {
             CHuiLayout* hostContainer = group.Control(0).ContainerLayout( NULL );
-            hostContainer->iOpacity.Set(1.f); 
+
 #ifdef SYMBIAN_BUILD_GCE
-            AlfAppUi()->ShowControlGroupL(aDisplay.Roster(), group, KAlfRosterShowAtBottom, 0); 
+            
+            AlfAppUi()->ShowControlGroupL(aDisplay.Roster(), group, KHuiRosterShowAtTop, 0); 
+            
 #else    
             aDisplay.Roster().ShowL( group, KAlfRosterShowAtBottom );
 #endif
@@ -664,7 +684,10 @@
             if (iFocused)
                 {
 #ifdef SYMBIAN_BUILD_GCE
-                AlfAppUi()->ShowControlGroupL(display.Roster(), controlGroup, where, 0); 
+                CHuiLayout* hostContainer = controlGroup.Control(0).ContainerLayout( NULL );                
+                if(hostContainer)
+                    hostContainer->ClearFlags( EHuiVisualFlagUnderOpaqueHint);
+                AlfAppUi()->ShowControlGroupL(display.Roster(), controlGroup, where, 0);
 #else    
                 display.Roster().ShowL(controlGroup, where);                                    
 #endif
@@ -672,10 +695,16 @@
                     *CHuiStatic::RootWin(), 
                     ClientWindowGroup(), 
                     PreferredWindowGroupPosition()  );
-
                 }
             else
-                {                
+                {
+#ifdef SYMBIAN_BUILD_GCE
+            CHuiLayout* hostContainer = controlGroup.Control(0).ContainerLayout( NULL );                
+                if(hostContainer)
+                    hostContainer->ClearFlags(EHuiVisualFlagUnderOpaqueHint);
+                AlfAppUi()->ShowControlGroupL(display.Roster(), controlGroup, where, 0);
+#else                    
+
                 if (where == KHuiRosterShowAtTop)
                     {
                     if (iControlGroupOrder.Count())
@@ -689,6 +718,7 @@
                     }
                 else if (where == KHuiRosterShowAtBottom)
                     {
+                
                     iControlGroupOrder.AppendL(&controlGroup);                
                     }
                 else
@@ -701,7 +731,8 @@
                         {
                         iControlGroupOrder.InsertL(&controlGroup, where);                                        
                         }                                                
-                    }                                                        
+                    }
+#endif                    
                 }    
                         
             break;
@@ -1024,6 +1055,24 @@
             EnvForceSwRendering( aMessage );
             break;    
             }
+        
+        case EAlfGetSizeAndRotation:
+            {
+            EnvGetSizeAndRotation( aMessage );
+            break;
+            }
+            
+        case EAlfReadPixels:
+            {
+            EnvReadPixels( aMessage );
+            break;
+            }
+                        
+        case EAlfBlankScreen:
+            {
+            AlfAppUi()->DoBlankScreen(aMessage);
+            break;    
+            }
             
             
         default:
@@ -1187,6 +1236,12 @@
     // hide
     controlGroupSubSession.SetIsShown( EFalse );
   
+    
+#ifdef SYMBIAN_BUILD_GCE
+    CHuiLayout* hostContainer = controlGroup.Control(0).ContainerLayout( NULL );                
+    if(hostContainer)
+        hostContainer->SetFlags(EHuiVisualFlagUnderOpaqueHint);
+#else    
     // hide from the roster only if session is focused
     if ( iFocused )
         {
@@ -1200,6 +1255,7 @@
              iControlGroupOrder.Remove( index );
              }
         }
+#endif
     }
     
 // ---------------------------------------------------------------------------
@@ -2834,4 +2890,45 @@
     aMessage.Complete( err );
     }
 
+// ---------------------------------------------------------------------------
+// EnvGetSizeAndRotation
+// ---------------------------------------------------------------------------
+//    
+void CAlfAppSrvSession::EnvGetSizeAndRotation(const RMessage2& aMessage)
+    {
+    TPckgBuf<TSize> size;
+    TPckgBuf<TInt> rotation;
+    TInt err = AlfAppUi()->GetSizeAndRotation(size(), rotation());
+    if ( err == KErrNone )
+        {
+        aMessage.Write(0, size);
+        aMessage.Write(1, rotation);
+        }
+    aMessage.Complete( err );
+    }
+
+// ---------------------------------------------------------------------------
+// EnvReadPixels
+// ---------------------------------------------------------------------------
+//    
+void CAlfAppSrvSession::EnvReadPixels(const RMessage2& aMessage)
+    {
+    TInt bitmapHandle = aMessage.Int0();
+    CFbsBitmap* bmp = new CFbsBitmap;
+    TInt err = KErrNoMemory;
+
+    if ( bmp )
+        {
+        err = bmp->Duplicate( bitmapHandle );
+        if ( err == KErrNone )
+            {
+            err = AlfAppUi()->ReadPixels( bmp );
+            }        
+        delete bmp;
+        }
+    
+    aMessage.Complete( err );
+    }
+
+
 // End of file    
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -36,6 +36,8 @@
 #include <uiacceltk/HuiTextVisual.h>
 #include <uiacceltk/HuiGradientBrush.h>
 #include <apgwgnam.h>
+#include <akntransitionutils.h>
+#include "alfeffectutils.h"
 
 #ifdef ALF_USE_CANVAS
 #include <uiacceltk/HuiCanvasVisual.h>
@@ -466,8 +468,10 @@
                 if(iWindowGc->Construct() == KErrNone)
                     {
                     iWindowGc->Activate(*iWindow);
+                    iWindow->BeginRedraw();
                     iWindowGc->SetBrushColor(0xffffffff);
                     iWindowGc->Clear();
+                    iWindow->EndRedraw();
                     iWindowGc->Deactivate();
                     }                
                 }
@@ -518,7 +522,7 @@
 #endif
             
 			// This is a workaround for possibly missing command buffers at layout switch
-            iWsSession.ClearAllRedrawStores(); 
+            // iWsSession.ClearAllRedrawStores(); 
             
             __ALFLOGSTRING2("ALF EventWin: Size(%d,%d)", iWindow->Size().iWidth, iWindow->Size().iHeight );
             //and fall through
@@ -641,8 +645,6 @@
     CHuiDisplay* iMainDisplay;
     CHuiDisplay* iTVDisplay;
     CAlfEventBridge* iEventAo;
-    RAlfTfxClient iDsServer;
-    TBool iDsActivated;
     };
 
 // ======== MEMBER FUNCTIONS ========
@@ -980,7 +982,7 @@
         {
         if (iData->iMainDisplay) // TBD: multiple display support once again...
             {
-            iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone);
+            TRAP_IGNORE(iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone));
             }
         }
     }
@@ -1406,26 +1408,6 @@
 //
 void CAlfAppUi::NotifyLowMemory(TInt aAmountOfFreeMemRequested)
     {
-    if (!iData->iDsActivated)            
-        {
-        if (iData->iDsServer.Open() == KErrNone)
-            {
-            iData->iDsActivated = ETrue;            
-            }
-        }
-    
-    if (iData->iDsActivated )
-        {
-        if (!aAmountOfFreeMemRequested)
-            {
-            iData->iDsServer.SendSynch(KAlfCompositionGoodOnGraphicsMemory, TIpcArgs());
-            }
-        else
-            {          
-            iData->iDsServer.SendSynch(KAlfCompositionLowOnGraphicsMemory, TIpcArgs());
-            }
-        }
-
 /*
 	// Toggle between normal & low memory levels
     if (!aAmountOfFreeMemRequested)
@@ -1458,8 +1440,55 @@
     return iData->iBridgeObj->ForceSwRendering( aEnabled );
     }
     
+// ---------------------------------------------------------------------------
+// GetSizeAndRotation
+// ---------------------------------------------------------------------------
+//
+TInt CAlfAppUi::GetSizeAndRotation(TSize& aSize, TInt& aRotation)
+    {
+    return iData->iBridgeObj->GetSizeAndRotation(aSize, aRotation);
+    }
+    
+// ---------------------------------------------------------------------------
+// ReadPixels
+// ---------------------------------------------------------------------------
+//
+TInt CAlfAppUi::ReadPixels(CFbsBitmap* aBitmap)
+    {
+    return iData->iBridgeObj->ReadPixels(aBitmap);
+    }
+    
 void CAlfAppUi::SetAlfAppWindowGroup( TInt aID )
     {
     iData->iBridgeObj->SetWindowGroupAsAlfApp( aID );
     }
+
+CAlfAppSrvSessionBase* CAlfAppUi::SrvSessionForControlGroup(CHuiControlGroup& aGroup)
+    {
+    return iData->iServer->SrvSessionForControlGroup(aGroup);
+    }
+
+void CAlfAppUi::DoBlankScreen(const RMessage2& aMessage)
+    {
+    __ALFLOGSTRING("CAlfAppUi::DoBlankScreen >>");
+    TSecureId capServerId(0x10207218);    
+    TSecurityPolicy policy(capServerId);
+    if (!policy.CheckPolicy(aMessage))
+        {
+        User::Leave(KErrPermissionDenied);    
+        }
+    
+//	if (iData->iBridgeObj->LayoutSwitchEffectCoordinator())
+//		{
+//		iData->iBridgeObj->LayoutSwitchEffectCoordinator()->EnableSafeCounter(EFalse); // let capserver rule  
+//		}
+  
+    TBool pause = aMessage.Int0();
+    
+    iData->iBridgeObj->LayoutSwitchEffectCoordinator()->Blank(pause);
+    
+    __ALFLOGSTRING("CAlfAppUi::DoBlankScreen <<");
+    // let the session complete message  
+    }
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -87,10 +87,13 @@
 
 const TReal32 KAlfVisualDefaultOpacity = 1.0f;
 //const TReal32 KAlfVisualDefaultOpacity = 0.5f;
+const TInt KEffectCleanupDelayInMs = 10;
+
+const TInt KPreventingCollisionOfIdsInSynchDrawRequests = 35;
 
 _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP");
 
-// #define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT
+#define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT
 // This debug option shows window groups in a grid
 //#define ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER
 
@@ -170,6 +173,9 @@
 void CAlfBridge::ConstructL(CHuiEnv* aEnv)
     {
     iHuiEnv = aEnv;
+    
+    iIdForEAlfDSSynchronizeOp = 0;
+    iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests;
 
 #ifdef SYMBIAN_BUILD_GCE
     iPrintFPS = EFalse;
@@ -182,16 +188,7 @@
         }
 #endif
 #endif //SYMBIAN_BUILD_GCE
-    // create the key for indication transition ends
-    // No access restrictions for starters
-    TInt err = RProperty::Define( KPSAlfDomain, KAlfTransitionStatus,
-        RProperty::EInt );
-    if (!err)
-        {
-        // Initialize to no transition    
-        RProperty::Set( KPSAlfDomain, KAlfTransitionStatus, 0 );
-        }
-
+   
     iEffectEndTimer = CAlfEffectEndTimer::NewL( *this );
     iWindowHashArray.ReserveL( 500 );
     iAlfRegisteredEffects.ReserveL(10);
@@ -439,6 +436,22 @@
     }
 
 // ---------------------------------------------------------------------------
+// FindWindowGroupNodeId
+// ---------------------------------------------------------------------------
+//
+TInt CAlfBridge::FindWindowGroupNodeId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) const
+    {
+    for (TInt i=0; i<iAlfScreens[aScreenNumber]->iControlGroups.Count();i++)
+        {
+        if( iAlfScreens[aScreenNumber]->iControlGroups[i].iControlGroup == &aControlGroup )
+            {
+            return iAlfScreens[aScreenNumber]->iControlGroups[i].iWindowGroupNodeId;
+            }
+        }
+    return KErrNotFound;
+    }
+
+// ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 CHuiControlGroup* CAlfBridge::FindControlGroupByWindowGroupId( TInt aWindowGroupId, TInt& aScreenNumber, TAlfControlGroupEntry** aAlfGroup )
@@ -470,21 +483,68 @@
     }
 
 // ---------------------------------------------------------------------------
+// FindControlGroupBySecureId
 // ---------------------------------------------------------------------------
 //
-CHuiControlGroup* CAlfBridge::FindControlGroupByAppId( TInt aAppId )
+CHuiControlGroup* CAlfBridge::FindControlGroupBySecureId( TInt aSecureId, TInt aWgId ) const
     {
+    if ( aSecureId == 0 )
+        {
+        return NULL;
+        }
+    
     for ( TInt i = 0; i < iAlfScreens[0]->iControlGroups.Count(); i++ )
         {
-        if ( iAlfScreens[0]->iControlGroups[i].iSecureId == aAppId )
+        TAlfControlGroupEntry& groupEntry = iAlfScreens[0]->iControlGroups[i];
+        if ( groupEntry.iSecureId == aSecureId )
             {
-            return iAlfScreens[0]->iControlGroups[i].iControlGroup;
+            if ( aWgId != -1 )
+                {
+                // match the window group as well
+                if ( groupEntry.iClientWindowGroupId == aWgId )
+                    {
+                    // found match
+                    return groupEntry.iControlGroup;
+                    }
+                // found a matching SID, but the window group ID was incorrect. keep going...
+                }
+            else
+                {
+                // done for the day
+                return groupEntry.iControlGroup;
+                }
             }
         }        
     return NULL;       
     }
 
 // ---------------------------------------------------------------------------
+// FindControlGroupByFullScreenToEffect
+// ---------------------------------------------------------------------------
+//
+CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenToEffect() const
+    {
+    if ( iFullScreenEffectData )
+        {
+        return FindControlGroupBySecureId( iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg ); 
+        }
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
+// FindControlGroupByFullScreenFromEffect
+// ---------------------------------------------------------------------------
+//
+CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenFromEffect() const
+    {
+    if ( iFullScreenEffectData )
+        {
+        return FindControlGroupBySecureId( iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg );
+        }
+    return NULL;
+    }
+
+// ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
 
@@ -514,7 +574,7 @@
 #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT
     if (iFullScreenEffectData && iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect)
         {
-        CHuiControlGroup *exitingGroupInEffect = FindControlGroupByAppId(iFullScreenEffectData->iToAppId);
+        CHuiControlGroup *exitingGroupInEffect = FindControlGroupByFullScreenToEffect();
         if (exitingGroupInEffect == aGroup)
             {
             CHuiRoster& roster = iAlfScreens[0]->iDisplay->Roster();
@@ -536,8 +596,9 @@
                     {
                     if (iAlfScreens[0]->iControlGroups[j].iControlGroup == nextToBecomeVisible)
                         {
-                        iFullScreenEffectData->iFromAppId = iAlfScreens[0]->iControlGroups[j].iSecureId;
-                        __ALFFXLOGSTRING1("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x. Start track drawing for exit effect.", iFullScreenEffectData->iFromAppId );
+                        iFullScreenEffectData->iFromSecureId = iAlfScreens[0]->iControlGroups[j].iSecureId;
+                        iFullScreenEffectData->iFromWg = iAlfScreens[0]->iControlGroups[j].iClientWindowGroupId;
+                        __ALFFXLOGSTRING2("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x, window group: %d -  Start track drawing for exit effect.", iFullScreenEffectData->iFromAppId, iFullScreenEffectData->iFromWg );
                         break;
                         }
                     }
@@ -657,6 +718,7 @@
     if (!group)
         {
         group = &iHuiEnv->NewControlGroupL(aWindowGroupNodeId); 
+        group->SetSecureId(aSecureId);
         CleanupStack::PushL(group);
         CHuiControl*  cntrl = new (ELeave) CHuiControl(*iHuiEnv);
         CleanupStack::PushL(cntrl);
@@ -682,11 +744,12 @@
         // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group.
         if (iFullScreenEffectData
                 && iFullScreenEffectData->iWaitingWindowGroup
-                && iFullScreenEffectData->iToAppId == aSecureId)
+                && iFullScreenEffectData->iToSecureId == aSecureId)
             {
+            iFullScreenEffectData->iToWg = aClientWindowGroupId;
             CHuiControlGroup* fromGroup = NULL;
             CHuiLayout* fromLayout = NULL; 
-            fromGroup = FindControlGroupByAppId(iFullScreenEffectData->iFromAppId);
+            fromGroup = FindControlGroupByFullScreenFromEffect();
             if (fromGroup)
                 {
                 CHuiControl& control2 = fromGroup->Control(0);
@@ -919,6 +982,8 @@
                 {
                 if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer)
                     {
+                    // increasing the count, assuming that WindowControlGroup is not in the Roster
+                    i++;
                     aRoster.ShowL(aGroup, i); 
                     break;
                     }                    
@@ -1079,18 +1144,17 @@
                 }
             }
 #endif
-        
+        if (!iActivated)            
+            {
+            TInt err = iBridgerClient.Connect();
+            iActivated = (err == KErrNone);            
+            }
+                    
         if (iAlfScreens[screenNumber]->IsVisualTreeVisibilityChanged())
             {
             HandleVisualVisibility( screenNumber );    
             iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(EFalse);
             }
-
-        if (!iActivated)            
-            {
-            iBridgerClient.Connect();
-            iActivated = ETrue;            
-            }
         }
     }
 
@@ -1253,8 +1317,11 @@
         }
     
     TBool fullscreenCovered = EFalse;
+    CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL;
+    
     //iActiveVisualCount = 0;
     iBgSurfaceFound = EFalse;
+    iHomeScreenWallpaperWindowFound = EFalse;
     //iPaintedArea = 0;  
     
     // Check if effect group has an effect with opaque hint.
@@ -1272,10 +1339,10 @@
         fullscreenCovered = ETrue;
         }    
     
-    #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
-    iTempTotalActiveVisualCount = 0;
-    iTempTotalPassiveVisualCount = 0;
-    #endif
+	
+	TBool alfWindowGroupFoundVisible = EFalse;
+
+    AMT_SET_VALUE( iVisibleVisualCount, 0 );
 	
     // skip the topmost (effect) layer, start from floating sprite group
     for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--)
@@ -1302,14 +1369,6 @@
             }
 #endif            
             
-        // Dont mess with alf control group visuals, alf session handling does it for us
-        // just add the rect to covered region because alf draws solid background.
-        if (control.Role() == EAlfSessionContainer)
-            {
-            iTempRegion.AddRect(fullscreen);
-            iTempRegion.Tidy();                                    
-            continue;
-            }
         
         // For optimization reasons, check if all visuals below in Z-order are covered    
         if (!fullscreenCovered)
@@ -1321,6 +1380,63 @@
 #endif
             }
         
+        
+        // Dont mess with alf control group visuals, alf session handling does it for us
+        if (control.Role() == EAlfSessionContainer)
+            {
+            CHuiLayout* hostContainer = control.ContainerLayout( NULL );
+            TInt flags = hostContainer->Flags();            
+            if (!fullscreenCovered)
+                {
+                // clear inactive flag if client has not made this controlgroup hidden
+                if(!(flags&EHuiVisualFlagUnderOpaqueHint))
+                    {
+                    alfWindowGroupFoundVisible = ETrue;
+                    if(iAppUi)
+                        {
+                        topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup);
+                        }
+                    hostContainer->ClearFlags(EHuiVisualFlagInactive);
+
+                    // just add the rect to covered region because alf draws solid background
+                    iTempRegion.AddRect(fullscreen);
+                    iTempRegion.Tidy();
+                    fullscreenCovered = ETrue;
+                    }
+                else // else put as inactive
+                    {
+                    hostContainer->SetFlags(EHuiVisualFlagInactive);
+                    }
+                }
+            else if(!alfWindowGroupFoundVisible || flags&EHuiVisualFlagUnderOpaqueHint)
+                {
+                // this alf session control group should not be visible anymore because avkon application is on top
+                // -> change to inactive
+                hostContainer->SetFlags(EHuiVisualFlagInactive);
+                }
+            else if(!(flags&EHuiVisualFlagUnderOpaqueHint)) // alf app covers full screen
+                {
+                // check if current controlgroup belongs to same srvsession as the topmost visible alf session container
+                CAlfAppSrvSessionBase* alfsrvsession = NULL;
+                if(iAppUi)
+                    {
+                    alfsrvsession = iAppUi->SrvSessionForControlGroup(controlgroup);
+                    }
+                if(topMostAlfSrvSession!=NULL && topMostAlfSrvSession == alfsrvsession)
+                    {
+                    hostContainer->ClearFlags(EHuiVisualFlagInactive);
+                    }
+                else
+                    {
+                    hostContainer->SetFlags(EHuiVisualFlagInactive);
+                    }
+                }
+            continue;
+            }
+
+
+
+        
         if (!fullscreenCovered)
             {
             fullscreenCovered = screen->iDisplay->Roster().IsVisibleContentFrozen();
@@ -1331,7 +1447,11 @@
             }
         
         TBool subTreeCovered = EFalse;
-        TBool hasActiveVisualsInVisualTree = HandleLayoutVisualVisibility( layout, controlgroup, control, fullscreenCovered, fullscreen, screen, subTreeCovered, IsVisualOpaque(*layout)  );    
+        TBool hasLayers = EFalse;
+        TBool hasActiveVisualsInVisualTree = 
+            HandleLayoutVisualVisibility( layout, controlgroup, control, 
+                fullscreenCovered, fullscreen, screen, 
+                subTreeCovered, hasLayers, IsVisualOpaque(*layout) );    
         TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree);        
 
         // If root visuals effect is marked as opaque, then add whole screen area as covered.
@@ -1340,6 +1460,11 @@
             fullscreenCovered = IsOpaqueEffect(layout->Effect());
             }                    
         
+        if ( hasLayers && iActivated )
+            {
+            HandleLayerVisibility( layout, controlgroup, control, hasActiveVisualsInVisualTree );
+            }
+            
 		// If we layout is active setup the fade effects. Also if it is inactive, but has been
 		// flagged as containing fade effect, then run the setup as well so that effects which
 		// are no more needed get removed.
@@ -1364,16 +1489,19 @@
                 }
             }
         
-        if (!hasActiveVisualsInVisualTree)
+        TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive);        
+        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
+        else if(!isLayoutActive && hasActiveVisualsInVisualTree)
             {
             layout->ClearFlag(EHuiVisualFlagInactive);
+            layout->SetPos(fullscreen.iTl);
+            layout->SetSize(fullscreen.Size());
             }
         
 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
@@ -1383,22 +1511,52 @@
 #endif
             
         }
-    if (iBgSurfaceFound)
-        {
-        if (!iInLowMemMode)
+    
+    if (iActivated)
+        {
+        if (iBgSurfaceFound || iHomeScreenWallpaperWindowFound)
             {
-            SetLowMemory(ETrue);
-            iBridgerClient.SendBlind(KAlfCompositionTargetHidden, TIpcArgs());
-            iInLowMemMode = ETrue;            
+            // only bg surface should trigger lowmem
+            if (!iInLowMemMode && iBgSurfaceFound)
+                {
+                SetLowMemory(ETrue);
+                iInLowMemMode = ETrue;
+                }
+
+            // if the background animation is not hidden yet, hide it now
+            if (!iBgAnimHidden)
+                {
+                // Notify Bg anim
+                iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetHidden));
+                iBgAnimHidden = ETrue;
+                }
             }
-        }
-    else if (iInLowMemMode)
-        {
-        SetLowMemory(EFalse);
-        iBridgerClient.SendBlind(KAlfCompositionTargetVisible, TIpcArgs());
-        iInLowMemMode = EFalse;
-        }
-
+        else if (iInLowMemMode || iBgAnimHidden)
+            {
+            // if we did not found bg surface, but are in low memory mode
+            // exit it now...
+            if (!iBgSurfaceFound && iInLowMemMode)
+                {
+                SetLowMemory(EFalse);
+                iInLowMemMode = EFalse;                
+                }
+
+            // if the bg animation is hidden and we did not found a background surface
+            // or the homescreen window containing wallpaper, show the background animation
+            // again
+            if (iBgAnimHidden && !iBgSurfaceFound && !iHomeScreenWallpaperWindowFound)
+                {
+                // Notify Bg anim
+                iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible));
+                iBgAnimHidden = EFalse;
+                }
+            }
+        }
+
+    if ( iSwRenderingEnabled )
+        {
+        screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible );
+        }
 
     // 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
@@ -1427,17 +1585,11 @@
                     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);                            
-                    }
-                
+                    }                
                 firstFadedWindowGroupFound = ETrue;
                 }
             }
         }
-
-    AMT_FUNC_EXC(AMT_DATA()->iActiveVisualCount = iTempTotalActiveVisualCount;
-                 AMT_DATA()->iPassiveVisualCount = iTempTotalPassiveVisualCount;
-                 AMT_DATA()->PrintState()
-                 );
     }
 
 TBool CAlfBridge::HandleLayoutVisualVisibility(
@@ -1448,6 +1600,7 @@
         TRect& aFullscreen,
         CAlfScreen* aScreen,
         TBool& aSubtreeVisible, 
+        TBool& aHasVisualsWithLayers,
         TBool aChildCanBeOpaque )
     {
     TBool visualTreeActive = EFalse;
@@ -1475,9 +1628,17 @@
         // For example, parent can have opacity < 1 and that affects children as well.
         // As another example, parent can have scaling transformation.
         visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual);
+        
+        if (!canvasVisual->LayerExtent().IsEmpty())
+            {
+            aHasVisualsWithLayers = ETrue;
+            }        
+
         if (canvasVisual->Count())
             {
-            visualTreeActive |= HandleLayoutVisualVisibility( canvasVisual, aControlGroup, aControl, aFullscreenCovered, aFullscreen, aScreen, visualSubtreeVisible, visualIsOpaque );
+            visualTreeActive |= HandleLayoutVisualVisibility( canvasVisual, aControlGroup, aControl, 
+                aFullscreenCovered, aFullscreen, aScreen, 
+                visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque );
             }
     #ifdef HUI_DEBUG_TRACK_DRAWING  
         if ( canvasVisual->Tracking() )
@@ -1563,11 +1724,7 @@
                 {
                 aScreen->iDisplay->SetDirty();
                 }                
-            
-            #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
-            iTempTotalPassiveVisualCount++;
-            #endif
-            
+
             #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
                     passivevisualcount++;
             #endif
@@ -1581,6 +1738,24 @@
             canvasVisual->PrepareCache();
             canvasVisual->SetCapturingBufferL(aScreen->iSwRenderingTarget);                
 
+            // We found an _ACTIVE_ window in homescreens controlgroup
+            if (aControlGroup.SecureId() == 0x102750F0)
+                {
+                // which is fully opaque, and visible ...
+                if ( (canvasVisual->iOpacity.Now() > 0.001) && canvasVisual->Flags() & EHuiVisualFlagOpaqueHint)
+                    {
+                    // ... and it's a fullscreen one, and does not have a transparent clear in it
+                    if (canvasVisual->DisplayRect().Round() == Display(0)->VisibleArea() &&
+                        !canvasVisual->HasTransParentClear())
+                        {
+                        // we can "safely" asseme that the window is the
+                        // one used to draw the user defined wallpaper
+                        // ----> stop background animation as it's not visible
+                        iHomeScreenWallpaperWindowFound = ETrue;
+                        }
+                    }
+                }
+            
             // we've found non-inactive window which has background surface
             // attached..
             if (canvasVisual->IsBackgroundDrawingEnabled() &&
@@ -1606,7 +1781,7 @@
                     if ( r == Display(0)->VisibleArea())
                         {
                         // Final test. Surface must not be ALF surface, but some other surface.                        
-                        CHuiControlGroup* alfControlGroup = FindControlGroupByAppId( iAlfSecureId );
+                        CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId );
                         if (alfControlGroup != &aControlGroup)
                             {                        
                             iBgSurfaceFound = ETrue;
@@ -1619,15 +1794,14 @@
                 {
                 canvasVisual->SetChanged();
                 }
-            #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
-            iTempTotalActiveVisualCount++;
-            #endif
 
             #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
             activevisualcount++;
             #endif
             }
-            
+
+
+        
         // Finally check the area that this visual covers and add it to covered region
         visualIsActive = !(canvasVisual->Flags() & EHuiVisualFlagInactive);
     
@@ -1648,6 +1822,46 @@
                 __ALFLOGSTRING2("Visual has painted areas: displayrect: iTl: %i, %i", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY);                    
                 __ALFLOGSTRING2("Visual has painted areas: displayrect: iBr: %i, %i", visualDisplayRect.iBr.iX,visualDisplayRect.iBr.iY);
                 #endif
+#ifndef ALF_OLD_VISIBILITY
+            // New visibility system takes only window shape into account.
+            if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation )
+                {
+                if ( !canvasVisual->HasCustomShape() )
+                    {
+                    TRect displayRect(canvasVisual->DisplayRect());
+                    ClipVisualRect(displayRect, aFullscreen);
+
+#ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
+                    __ALFLOGSTRING2("Covered rect: iTl: %i, %i", displayRect.iTl.iX, displayRect.iTl.iY);                    
+                    __ALFLOGSTRING2("Covered rect: iBr: %i, %i", displayRect.iBr.iX, displayRect.iBr.iY);
+#endif
+
+                    iTempRegion.AddRect(displayRect);
+                    iTempRegion.Tidy();
+                    }
+                else
+                    {
+                    TRect displayRect = canvasVisual->DisplayRect();
+                    const TRegion& region = canvasVisual->ShapeRegion();
+                    TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl;
+                
+                    for (TInt i = 0; i < region.Count(); ++i)
+                        {
+                        TRect coveredRect(region[i]);
+                        coveredRect.Move(delta);
+                        ClipVisualRect(coveredRect, aFullscreen);
+
+#ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
+                        __ALFLOGSTRING2("Covered rect: iTl: %i, %i", coveredRect.iTl.iX, coveredRect.iTl.iY);                    
+                        __ALFLOGSTRING2("Covered rect: iBr: %i, %i", coveredRect.iBr.iX, coveredRect.iBr.iY);
+#endif
+                    
+                        iTempRegion.AddRect(coveredRect);
+                        iTempRegion.Tidy();
+                        }
+                    }
+                }
+#else
             for (TInt k=0; k < canvasVisual->PaintedAreaCount(); k++)
                 {                                
                 THuiCanvasPaintedArea paintArea = canvasVisual->PaintedArea(k);
@@ -1673,9 +1887,13 @@
                 {
                 iTempRegion.AddRect(visualDisplayRect);
                 iTempRegion.Tidy();
-                }            
+                }
+#endif				
             }                                        
         visualTreeActive |= visualIsActive;
+        
+        // iVisibleVisualCount is cleared in HandleVisualVisibility()
+        AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount );
         } // for loop end : children checking loop
      
     return visualTreeActive;
@@ -1685,6 +1903,79 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // 
+void CAlfBridge::HandleLayerVisibility(
+        CHuiLayout* aLayout,
+        CHuiControlGroup& aControlGroup,
+        CHuiControl& aControl,
+        TBool aVisible )
+    {
+    CHuiCanvasVisual* canvasVisual = NULL;
+
+    for (TInt i = aLayout->Count()-1; i >= 0; i--)
+        {
+        canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i));
+        
+        if (canvasVisual->Count())
+            {
+            HandleLayerVisibility( 
+                canvasVisual, aControlGroup, 
+                aControl, aVisible );
+            }            
+
+        if (!canvasVisual->LayerExtent().IsEmpty())
+            {
+            // Determine if surface is visible.
+            TBool surfaceWasVisible = ( canvasVisual->CanvasFlags() & EHuiCanvasFlagSurfaceVisible );
+            TBool surfaceWasInvisible = ( canvasVisual->CanvasFlags() & EHuiCanvasFlagSurfaceInvisible );
+            __ALFLOGSTRING2("CAlfBridge::HideTarget: %d %d", aVisible, surfaceWasVisible);
+
+            TBool forcedUpdate = !surfaceWasVisible && !surfaceWasInvisible;
+    
+            if ( !aVisible && ( forcedUpdate || surfaceWasVisible ) )
+                {
+                // notify surface observer that it has been hidden
+                __ALFLOGSTRING("CAlfBridge::HideTarget >>");
+                TLex8 lex(canvasVisual->Tag());
+                TInt windowId(0);
+                if (lex.Val(windowId) == KErrNone)
+                    {
+                    __ALFLOGSTRING1("CAlfBridge::HideTarget: WindowId: %d", windowId);
+                    canvasVisual->SetCanvasFlags( EHuiCanvasFlagSurfaceInvisible );
+                    canvasVisual->ClearCanvasFlags( EHuiCanvasFlagSurfaceVisible );
+                    
+                    iBridgerClient.SendBlind(EAlfPostDataToCompositionTarget, TIpcArgs(KAlfCompositionTargetHidden, windowId));                    
+                    iBridgerClient.SendBlind(EAlfPostDataToCompositionClient, TIpcArgs(KAlfCompositionTargetHidden, windowId));
+                    }
+                __ALFLOGSTRING("CAlfBridge::HideTarget <<");
+                }
+            else if ( aVisible && ( forcedUpdate || surfaceWasInvisible ) )
+                {
+                // notify surface observer that it has been hidden
+                __ALFLOGSTRING("CAlfBridge::ShowTarget >>");
+                TLex8 lex(canvasVisual->Tag());
+                TInt windowId(0);
+                if (lex.Val(windowId) == KErrNone)
+                    {
+                    __ALFLOGSTRING1("CAlfBridge::ShowTarget: WindowId: %d", windowId);
+                    canvasVisual->ClearCanvasFlags( EHuiCanvasFlagSurfaceInvisible );
+                    canvasVisual->SetCanvasFlags( EHuiCanvasFlagSurfaceVisible );
+                    
+                    iBridgerClient.SendBlind(EAlfPostDataToCompositionTarget, TIpcArgs(KAlfCompositionTargetVisible, windowId));                    
+                    iBridgerClient.SendBlind(EAlfPostDataToCompositionClient, TIpcArgs(KAlfCompositionTargetVisible, windowId));
+                    }
+                __ALFLOGSTRING("CAlfBridge::ShowTarget <<");
+                }
+            else
+                {
+                // No change - ignore.
+                }
+            }
+        } // for loop end : children checking loop
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// 
 void CAlfBridge::ClearCanvasVisualCommandSets(TBool aInactiveOnly)
     {
     if (!iAlfScreens.Count())
@@ -1777,10 +2068,10 @@
             {
             case EAlfDSSynchronize:
                 {
-                TInt id = data.iInt1;
+                iIdForEAlfDSSynchronizeOp = data.iInt1;
                 if ( iHuiEnv )
                     {
-                    iHuiEnv->Synchronize( id, this );
+                    iHuiEnv->Synchronize( iIdForEAlfDSSynchronizeOp, this );
                     }
                 }
                 break;
@@ -1825,6 +2116,21 @@
                 HandleSetWindowOpacityL( data );
                 break;
                 }
+            case EAlfDSSetTransparencyAlphaChannel:
+                {
+                HandleSetTransparencyAlphaChannelL( data );
+                break;
+                }
+            case EAlfDSIncludeToVisibilityCalculation:
+                {
+                HandleIncludeToVisibilityCalculationL( data );
+                break;
+                }
+            case EAlfDSSetWindowArea:
+                {
+                HandleSetWindowAreaL( data );
+                break;
+                }
             case EAlfDSRefreshCallback:
                 {
                 iHuiEnv->ContinueRefresh();
@@ -1880,30 +2186,8 @@
             	}
             case EAlfDSMoveWindowToNewGroup:
             	{
-            	/*
-            	RDebug::Print(_L("CAlfBridge::DoDispatchL, EAlfDSMoveWindowToNewGroup, THIS METHOD IS UNTESTED. EXPECT TROUBLE!"));
-            	// TODO: TEST!
-            	TInt windowGroupNodeId = data.iInt1;
-            	TInt windowNodeId = data.iInt2;
-            	TInt newGroupId = (TInt)data.iPtr;
-            	CHuiLayout* layout = NULL;
-            	CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId, windowGroupNodeId,screenNumber);
-            	if (viz)
-            		{
-            		// #1 remove visual from old group
-            		layout = viz->Layout();
-            		layout->Remove(viz);                           
-            		viz->Owner().Remove(viz);
-            		// #2 insert visual to the beginning of the new group
-            		CHuiControlGroup* controlGroup = FindControlGroup(newGroupId,screenNumber);
-            		if (controlGroup)
-            			{
-            			CHuiControl& control = controlGroup->Control(0);
-            			CHuiLayout* layout = (CHuiLayout*)&control.Visual(0);
-            			layout->AppendL( viz );
-            			}
-            		}*/
-            		break;
+            	HandleMoveWindowToNewGroupL( data );
+            	break; 
             	}
             case EAlfEffectFx:
                 {
@@ -1915,6 +2199,11 @@
                 HandleGfxStopEffectsL( data );
                 break;
                 }
+            case EAlfStopControlEffectFx:
+                {
+                HandleGfxStopControlEffectsL( data );
+                break;
+                }
             case EAlfControlEffectFx:
                 {
                 HandleGfxControlEffectsL( data );
@@ -1995,7 +2284,7 @@
                 CHuiGc::TOrientation huiOrientation(CHuiGc::EOrientationNormal);
 	            switch(data.iInt1)
 	                {
-	                case 1: // 90    
+	            case 1: // 90    
                     huiOrientation = CHuiGc::EOrientationCCW90;
                     break;
 	            case 2: // 180    
@@ -2135,6 +2424,7 @@
 				    {
                     viz = CHuiCanvasVisual::AddNewL(control, layout);
 				    }
+
 				__ALFFXLOGSTRING2("CAlfBridge::HandleNewWindowL visual: 0x%x, id 0x%x", viz, windowNodeId);
 				AddVisual( 
 				    windowNodeId, 
@@ -2274,6 +2564,7 @@
 		{
 		case EAlfWinTreeNodeGroup:
 			{
+			HandleVisualVisibility(0);
 			DeleteControlGroupL(windowGroupNodeId, screenNumber);                            
 			break;    
 			}
@@ -2367,6 +2658,9 @@
 
     AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount );
     AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) );
+    AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ),
+                          iPositionMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, 
+                          windowAttributes->iPosition, EAlfModuleTestTypeBridgeChangePosition );    
 	}
 
 // ---------------------------------------------------------------------------
@@ -2397,7 +2691,10 @@
     iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue);
     
     AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount );
-    AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) );        
+    AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) );
+    AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), 
+                          iSizeMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, 
+                          windowAttributes->iSize, EAlfModuleTestTypeBridgeChangeSize );
 	}
 
 // ---------------------------------------------------------------------------
@@ -2457,6 +2754,148 @@
 	}
 
 // ---------------------------------------------------------------------------
+// HandleSetTransparencyAlphaChannel
+// ---------------------------------------------------------------------------
+// 
+void CAlfBridge::HandleSetTransparencyAlphaChannelL( TAlfBridgerData& aData )
+    {
+	TInt windowNodeId = aData.iInt2;
+	TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr );
+	TInt screenNumber = windowAttributes->iScreenNumber;
+	// fetch visual
+	CHuiVisual* viz = FindVisual(windowNodeId);
+	if (viz)
+		{
+#ifdef HUI_DEBUG_TRACK_DRAWING
+        if ( viz->Tracking() )
+            {
+            RDebug::Print(_L("CAlfBridge::HandleSetTransparencyAlphaChannel - Tracked visual"));
+            }
+#endif
+		if ( windowAttributes->iActive )
+		    {
+		    viz->ClearFlag( EHuiVisualFlagOpaqueHint );
+		    }
+		else
+		    {
+		    viz->SetFlag( EHuiVisualFlagOpaqueHint );
+		    }
+		
+	    iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue);  // TODO: Check if really changed  
+		}
+	else
+		{
+		__ALFLOGSTRING("CAlfBridge::HandleSetTransparencyAlphaChannel, EAlfDSSetTransparencyAlphaChannel: Visual not found!");                                                
+		}          
+    }
+
+// ---------------------------------------------------------------------------
+// HandleSetWindowAreaL
+// ---------------------------------------------------------------------------
+// 
+void CAlfBridge::HandleIncludeToVisibilityCalculationL( TAlfBridgerData& aData )
+    {
+    TInt windowNodeId = aData.iInt2;
+    TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr );
+    TInt screenNumber = windowAttributes->iScreenNumber;
+    // fetch visual
+    CHuiVisual* viz = FindVisual(windowNodeId);
+    if (viz)
+        {
+#ifdef HUI_DEBUG_TRACK_DRAWING
+        if ( viz->Tracking() )
+            {
+            RDebug::Print(_L("CAlfBridge::HandleIncludeToVisibilityCalculationL - Tracked visual"));
+            }
+#endif
+        if ( windowAttributes->iWindowNodeType == EAlfWinTreeNodeClient )
+            {
+            CHuiCanvasVisual* canvasVisual = static_cast<CHuiCanvasVisual*>(viz);
+            
+            if ( windowAttributes->iActive )
+                {
+                canvasVisual->SetCanvasFlags( EHuiCanvasFlagIncludeToVisibilityCalculation );
+                }
+            else
+                {
+                canvasVisual->ClearCanvasFlags( EHuiCanvasFlagIncludeToVisibilityCalculation );
+                }
+            }
+        
+        iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue);  // TODO: Check if really changed  
+        }
+    else
+        {
+        __ALFLOGSTRING("CAlfBridge::HandleIncludeToVisibilityCalculationL, EAlfDSIncludeToVisibilityCalculation: Visual not found!");                                                
+        }              
+    }
+
+// ---------------------------------------------------------------------------
+// HandleSetWindowAreaL
+// ---------------------------------------------------------------------------
+// 
+void CAlfBridge::HandleSetWindowAreaL( TAlfBridgerData& aData )
+	{
+	TInt windowNodeId = aData.iInt2;
+	TAny* ptr = (TAny*)(*iHost)->GetVarDataL( (TInt)aData.iPtr );
+	
+	TInt screenNumber = 0;
+	TPoint origin;
+	TInt count = 0;
+	RRegion region;
+	CleanupClosePushL( region );
+	
+	    {
+	    RMemReadStream str(ptr, 4*sizeof(TInt32));	
+	    screenNumber = str.ReadInt32L(); 
+    	origin.iX = str.ReadInt32L();
+	    origin.iY = str.ReadInt32L();
+	    count = str.ReadInt32L();
+        str.Release();
+        }
+
+    if ( count > 0 )        
+        {
+        RMemReadStream str(((TUint8*)ptr) + 4*sizeof(TInt32), 4*sizeof(TInt32)*count);
+        TRect rect;
+        for (TInt i = 0; i < count; ++i)
+            {
+            rect.iTl.iX = str.ReadInt32L();
+            rect.iTl.iY = str.ReadInt32L();
+            rect.iBr.iX = str.ReadInt32L();
+            rect.iBr.iY = str.ReadInt32L();
+            region.AddRect(rect);
+            }
+        str.Release();
+        }
+    
+	
+	// fetch visual
+	CHuiVisual* viz = FindVisual(windowNodeId);
+	if (viz)
+		{
+#ifdef HUI_DEBUG_TRACK_DRAWING
+        if ( viz->Tracking() )
+            {
+            RDebug::Print(_L("CAlfBridge::HandleSetWindowAreaL - Tracked visual"));
+            }
+#endif
+		
+		
+		CHuiCanvasVisual* canvas = static_cast<CHuiCanvasVisual*>(viz);
+		canvas->SetShape( origin, region );
+		
+		iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue);
+		}
+	else
+		{
+		__ALFLOGSTRING("CAlfBridge::HandleSetWindowAreaL, EAlfDSSetWindowArea: Visual not found!");                                                
+		}  
+		
+    CleanupStack::PopAndDestroy();
+	}
+
+// ---------------------------------------------------------------------------
 // HandleReorderWindowL
 // ---------------------------------------------------------------------------
 // 
@@ -2667,17 +3106,17 @@
 	            && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect 
 	            && !iFullScreenEffectData->iEndFullScreen)
 	        {
-            TInt toAppUid; 
+
+	        CHuiControlGroup *to_group = NULL;
             if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect)
                 {
-                toAppUid = iFullScreenEffectData->iFromAppId;
+                to_group = FindControlGroupByFullScreenFromEffect();
                 }
             else
                 {
-                toAppUid = iFullScreenEffectData->iToAppId;
+                to_group = FindControlGroupByFullScreenToEffect();
                 }
             
-            CHuiControlGroup *to_group = FindControlGroupByAppId(toAppUid);
 	    
 	        // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call.
 	        // 2. only the first drawing commands will trigger EndFullScreen
@@ -2685,8 +3124,10 @@
 	        
 	        if (viz->Owner().ControlGroup() == to_group)
 	            {
-                iFullScreenEffectData->ResetTimerL(this);
-                iFullScreenEffectData->iDisplaySize = iAlfScreens[0]->Size(); 
+                if (!iFullScreenEffectData->iDrawingCompleteTimer)
+                    {
+                    iFullScreenEffectData->InitDelayedEffectL(this, iAlfScreens[0]->Size());
+                    }
                 THuiCanvasPaintedArea p = viz->PaintedArea(0);
 	            iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() );
 	            TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect();
@@ -2698,7 +3139,6 @@
 	            __ALFFXLOGSTRING2("CAlfBridge::HandlePostCanvasBufferL : iBr.iX: %d, iBr.iY: %d", b.iBr.iX, b.iBr.iY);
 	                        }
 	        }
-	        // END TP HACK
 #endif
 	}
 
@@ -2712,8 +3152,8 @@
         {
         return;
         }
-    CHuiControlGroup *to_group = FindControlGroupByAppId(aFullScreenEffectData->iToAppId);
-    CHuiControlGroup *from_group = FindControlGroupByAppId( aFullScreenEffectData->iFromAppId );
+    CHuiControlGroup *to_group = FindControlGroupByFullScreenToEffect();
+    CHuiControlGroup *from_group = FindControlGroupByFullScreenFromEffect();
     CHuiLayout *to_layout = NULL;
     CHuiLayout *from_layout = NULL;
     if (!to_group) // group has been destroyed and moved to effectControlGroup for waiting the application exit effect EndFullScreen trigger 
@@ -2740,6 +3180,7 @@
         }
 
     aFullScreenEffectData->iEndFullScreen = ETrue;
+    iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
     }
 
 // ---------------------------------------------------------------------------
@@ -2783,9 +3224,19 @@
             }
         else
             {
-			// this prevents windows disappearing before their effect has finished
-            aVisual->SetFlag(EHuiVisualFlagShouldBeHidden);
-            aVisual->ClearFlag(EHuiVisualFlagShouldBeShown);
+			// this prevents windows disappearing before their effect has finished, unless it makes no difference. 
+            // For instance, if the visual is being shown by a screenshot in some other visual, then having this visual around 
+            // will only break the "live view"
+            if (iEffectCleanupStack[effectIndex].iCanDestroyOrHideImmediately && !aVisual->Effect())
+                {
+                aVisual->ClearFlags(EHuiVisualFlagShouldBeShown | EHuiVisualFlagShouldBeHidden);
+                aVisual->iOpacity.Set(0.0f);    
+                }
+            else
+                {
+                aVisual->SetFlag(EHuiVisualFlagShouldBeHidden);
+                aVisual->ClearFlag(EHuiVisualFlagShouldBeShown);
+                }
             }
         }
     }
@@ -2849,7 +3300,7 @@
                    }
 #endif
 				// Uses opacity for now                            
-                SetWindowActiveL(viz, windowAttributes->iActive);
+                SetWindowActiveL(viz, windowAttributes->iActive);                
                 }
 			else
 				{
@@ -2865,6 +3316,13 @@
 			}
 		}
     iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue);	// TODO: Check if really changed                       
+
+    AMT_INC_COUNTER( iTotalVisualFlagChangedCount );
+    AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount );
+    AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount );
+    AMT_MAP_INC_VALUE_IF( ( iWindowHashArray.Find( windowNodeId ) ), 
+                          iIntMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, 
+                          EAlfModuleTestTypeBridgeChangeFlag );    
 	}
 
 
@@ -3068,7 +3526,11 @@
 			}
 		else
 			{
-			viz->SetClearBackground(CHuiDisplay::EClearNone);
+            viz->SetClearBackground(CHuiDisplay::EClearNone);
+
+            // Force update
+            viz->ClearCanvasFlags( EHuiCanvasFlagSurfaceInvisible );
+            viz->ClearCanvasFlags( EHuiCanvasFlagSurfaceVisible );
 			}		
 		}
 	else
@@ -3519,6 +3981,85 @@
 
 
 // ---------------------------------------------------------------------------
+// HandleMoveWindowToNewGroupL
+// ---------------------------------------------------------------------------
+// 
+void CAlfBridge::HandleMoveWindowToNewGroupL( TAlfBridgerData& aData )
+    {
+    TInt windowNodeId = aData.iInt1;
+    TInt screenNumber = aData.iInt2;
+    TInt newWindowGroupNodeId = (TInt)aData.iPtr;
+   
+    CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId);
+    
+#ifdef _ALF_LOGGING
+    CHuiControlGroup* oldControlGroup = viz->Owner().ControlGroup();
+    TInt oldWindowGroupId = 0; 
+    if ( oldControlGroup  )
+        {
+        oldWindowGroupId = FindWindowGroupNodeId(screenNumber, *oldControlGroup );
+        }   
+    __ALFLOGSTRING3("CAlfBridge::HandleMoveWindowToNewGroupL moving nodeId 0x%x from group 0x%x to 0x%x ",windowNodeId, oldWindowGroupId, newWindowGroupNodeId );
+#endif
+    
+    if (viz)
+        {
+        CHuiLayout* oldLayout = viz->Layout();
+        TBool isRootOfTheMovingTree = EFalse; // if true, we need to update the parent layout 
+        
+        if ( viz->Owner().ControlGroup() && 
+                (&viz->Owner().ControlGroup()->Control(0).Visual(0) == oldLayout) )
+            {
+            // Symbian OS documentation: "This function allows a window with a window group as its 
+            // immediate parent to be moved from one window group to another one."
+            //
+            // This implementation is assuming that only a window which is an immediate child of a window group
+            // can be moved to new group. Moving an immediate child (=root of the moving tree) 
+            // causes the child windows to move as well.
+            isRootOfTheMovingTree = ETrue;
+            }
+
+        // #1 remove visual from old group
+        if ( isRootOfTheMovingTree && oldLayout )
+            {
+            // remove also from the old parent layout - new layout is coming from the new group
+            oldLayout->Remove(viz);
+            }
+        // else: keep the parent layout - assume that is moving as well.  
+        
+        // remove from the old control
+        viz->Owner().Remove(viz);
+        
+        // #2 insert visual to the beginning of the new group
+        CHuiControlGroup* newControlGroup = FindControlGroup(newWindowGroupNodeId,screenNumber);
+        if (newControlGroup)
+            {
+            CHuiControl& newControl = newControlGroup->Control(0);
+            if ( isRootOfTheMovingTree )
+                {
+                // update the parent layout to be the default layout of the window group
+                CHuiLayout* newLayout = (CHuiLayout*)&newControl.Visual(0);
+                newControl.AppendL( viz, newLayout );
+                }
+            else
+                {
+                // just update the owner. Assume that the parent RWindowTreeNode/CAlfNode/CHuiLayout is moving as well.
+                newControl.AppendL( viz );
+                }
+            }
+        else 
+            {
+            __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find new group! orphaning the visual");
+            iOrphanStorage->AppendL( viz );
+            }
+        }
+    else
+        {
+        __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find moving visual!");
+        }
+    }
+
+// ---------------------------------------------------------------------------
 // HandleSetFadeEffect
 // ---------------------------------------------------------------------------
 // 
@@ -3688,6 +4229,7 @@
 	
 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout)
     {
+    __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction);
     TInt err = KErrNone;
     TBool failed = EFalse;
     
@@ -3718,6 +4260,7 @@
                     if (err == KErrNone)
                         {
                         aToLayout->SetFreezeState(ETrue);
+                        aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately
                         }
                     else
                         {
@@ -3727,23 +4270,17 @@
 
                 switch(aEvent.iAction)
                     {
+                    case AknTransEffect::EApplicationActivate:
                     case AknTransEffect::EApplicationStart:
                     case AknTransEffect::EApplicationStartRect:
+                    case AknTransEffect::EApplicationStartSwitch:
+                    case AknTransEffect::EApplicationStartSwitchRect:
                         {
-                        aToLayout->iOpacity.Set(0.0f);    // these are meant for applications that yet dont have anything to show
+                        aToLayout->iOpacity.Set(0.0f);    // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground
                         FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle);
                         aEvent.iEffectType = CFullScreenEffectState::EStartEffect;
                         break;
                         }
-                    case AknTransEffect::EApplicationStartSwitch:
-                    case AknTransEffect::EApplicationStartSwitchRect:
-                        {
-                        aToLayout->iOpacity.Set(0.0f);    // this is meant for applications that are in the background.
-                        FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle);
-                        aEvent.iEffectType = CFullScreenEffectState::EStartEffect;
-                        break;
-                        }
-
                     case AknTransEffect::EApplicationExit:
                         {
                         aEvent.iEffectType = CFullScreenEffectState::EExitEffect;
@@ -3766,7 +4303,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);
+                            iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately);
                             __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect);
                             aEvent.iSetupDone = iLayoutInitializedForExitEffect; 
                             }
@@ -3806,7 +4343,7 @@
                         	{
                             // add visuals to visual cleanupstack
                             aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse);
-                            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse);
+                            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately);
                             aEvent.iSetupDone = layoutEffectable; 
                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
                             }
@@ -3881,6 +4418,7 @@
     if (!iFullScreenEffectData)
         {
         __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none");
+        RemoveAllTemporaryPresenterVisuals();
         return;
         }
     
@@ -3896,14 +4434,11 @@
     // back
     if (fxData->iToAppId && fxData->iToAppId != KErrNotFound)
         {
-        RemoveEffectFromApp(fxData->iToAppId);
-        RemoveEffectFromApp(fxData->iFromAppId);
-        }
-    else
-        {
-        // abort ALL effects
-        RemoveAllTemporaryPresenterVisuals();
-        }
+        RemoveEffectFromApp(fxData->iToSecureId, fxData->iToWg );
+        RemoveEffectFromApp(fxData->iFromSecureId, fxData->iFromWg );
+        }
+    // abort ALL other possible control effects
+    RemoveAllTemporaryPresenterVisuals();
     
     iHuiEnv->ContinueRefresh();
     
@@ -3917,13 +4452,24 @@
     __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END");
     }
 
-void CAlfBridge::RemoveEffectFromApp(TInt aAppUid)
+void CAlfBridge::RemoveEffectFromApp(TInt aSecureId, TInt aWgId )
     {
-    if(aAppUid <= 0)
+    if(aSecureId == 0)
         {
         return;
         }
-    CHuiControlGroup* group = FindControlGroupByAppId(aAppUid);
+    CHuiControlGroup* group = NULL;
+    if ( aWgId > 0 )
+        {
+        // check with the specific window gruop
+        group = FindControlGroupBySecureId(aSecureId, aWgId);
+        }
+    else 
+        {
+        // any window gruop will do
+        group = FindControlGroupBySecureId(aSecureId);
+        }
+    
     if (group)
         {
         CHuiControl& control = group->Control(0);
@@ -3992,8 +4538,8 @@
             if (iFullScreenEffectData && iFullScreenEffectData->iToAppId != fxData->iToAppId)
                 {
 				__ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - WARNING - Another fullscreen effect to different app. Deleting the previous ongoing effect"); 
-                RemoveEffectFromApp(iFullScreenEffectData->iToAppId);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called.
-                RemoveEffectFromApp(iFullScreenEffectData->iFromAppId);
+                RemoveEffectFromApp(iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called.
+                RemoveEffectFromApp(iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg);
                 // Fullscreen effect for another 
                 }
             
@@ -4046,8 +4592,8 @@
     fxData->iOperation = operation;
     fxData->iWaitingWindowGroup = EFalse;
 
-    __ALFFXLOGSTRING3("Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType);
-    __ALFFXLOGSTRING2("wg1: %d, wg2: %d", fxData->iWg1, fxData->iWg2);
+    __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType);
+    __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg);
 
     // find root nodes and attach effects to them
     // First we need a windowgroup node id. So far we have a list of window ids
@@ -4081,29 +4627,17 @@
     // depending on if we have an application that is already running or not
 
     //    TAlfControlGroupEntry* alfGroup = NULL;
-    // TODO: 
-    //wg1 = (*iHost)->FindWgForAppUid(TUid::Uid(toAppId1));
-    //if (!wg1 && action != AknTransEffect::EApplicationExit )
-    // 	{
-    // 	// window group is not available yet, but it will be created in short while.
-    //  	iEffectWaitingWindowgroup.Append(toAppId1);
-    //  	}
-    // TODO: when ids available from wserv...
-    // if ( appUid1 )
-    //{
-    //	 group1 = FindControlGrouAppUId( appUid1, screen1, &alfGroup );
-    // }
 
     TBool failed = EFalse;
     if (fxData->iToAppId && fxData->iToAppId != KErrNotFound)
         {        
         CHuiControlGroup* toGroup = NULL;
         CHuiLayout* toLayout = NULL; 
-        toGroup = FindControlGroupByAppId(fxData->iToAppId);
+        toGroup = FindControlGroupByFullScreenToEffect();
 
         CHuiControlGroup* fromGroup = NULL;
         CHuiLayout* fromLayout = NULL; 
-        fromGroup = FindControlGroupByAppId(fxData->iFromAppId);
+        fromGroup = FindControlGroupByFullScreenFromEffect();
 
         if (!toGroup) // group has been destroyed and moved to effectControlGroup for waiting the application exit effect EndFullScreen trigger 
             {
@@ -4183,6 +4717,27 @@
     __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEffectsL - end");
     }
 
+void CAlfBridge::HandleGfxStopControlEffectsL(TAlfBridgerData data)
+    {
+    TInt length = data.iInt2;
+    __ALFFXLOGSTRING1("CAlfBridge::HandleGfxStopControlEffectsL - Reading bridge data %d", (TInt)data.iPtr);
+    void* bridgeBuffer = (void*) (*iHost)->GetEffectsDataL( (TInt)data.iPtr );    
+    RMemReadStream stream( bridgeBuffer, length );
+    
+    TInt operation = stream.ReadInt32L();
+    TInt handle = stream.ReadInt32L();
+    stream.Release();
+
+    if (handle != KErrNotFound)
+        {
+        __ALFFXLOGSTRING1("CAlfBridge::HandleGfxStopControlEffectsL - Remove effect with handle: %d", handle);
+        RemoveTemporaryPresenterVisual(NULL, handle);
+        iHuiEnv->ContinueRefresh();
+        }
+    __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopControlEffectsL - end");
+    }
+
+
 void CAlfBridge::HandleRegisterEffectL( TAlfBridgerData data )
     {     
     TInt action = data.iInt1;
@@ -4238,12 +4793,13 @@
         CHuiControl* aEffectControl, 
         TBool aInsertTemporaryVisual,
         TInt& aItemDestroyed,
-        TBool aIsExitEffect)
+        TBool aIsExitEffect,
+        TBool aCanDestroyOrHideImmediately)
     {
     CHuiCanvasVisual* temporaryPresenterVisual = NULL;
     TInt enableEffect = ETrue;
     
-    if (aSourceVisual->iOpacity.Now() >= 0.01)
+    if (aSourceVisual->iOpacity.Now() >= 0.01 && !(aSourceVisual->Flags() & EHuiVisualFlagShouldBeHidden))
         {
         aSourceVisual->SetFlag(EHuiVisualFlagShouldBeShown);
         }
@@ -4287,7 +4843,8 @@
                     aSourceVisual, 
                     temporaryPresenterVisual,
                     ETrue,
-                    aIsExitEffect);
+                    aIsExitEffect,
+                    aCanDestroyOrHideImmediately);
             iEffectCleanupStack.AppendL(item);
             }
         else
@@ -4296,7 +4853,8 @@
             // aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
             TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle,
                         aSourceVisual, NULL, EFalse,
-                        aIsExitEffect);
+                        aIsExitEffect,
+                        aCanDestroyOrHideImmediately);
             iEffectCleanupStack.AppendL(item);
             }
      }
@@ -4310,12 +4868,13 @@
         CHuiControl* aEffectControl,
         TInt& aItemsDestroyed,
         TBool aAddLayout,
-        TBool aIsExitEffect)
+        TBool aIsExitEffect,
+        TBool aCanDestroyOrHideImmediately)
     {
     __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x is having %d children", aSourceLayout, aSourceLayout->Count());
     if (aAddLayout)
         {
-        AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect);
+        AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately);
         }
         
     for (TInt i = 0; i < aSourceLayout->Count(); i++)
@@ -4325,16 +4884,20 @@
            if (sourceVisual.Count())
                {
                CHuiLayout& layout = static_cast<CHuiLayout&> (aSourceLayout->Visual(i));
-               AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect );
+               AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect, aCanDestroyOrHideImmediately );
                }
-           AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect);
+           AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately);
            }
     __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count());
     }
 
-TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect)
+TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately)
     {
-    __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d >>", aHandle, aSourceLayout, aIsExitEffect );
+    __ALFFXLOGSTRING4("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d, CanDestroyOrHideImmediately: %d >>", 
+            aHandle, 
+            aSourceLayout, 
+            aIsExitEffect,
+            aCanDestroyOrHideImmediately );
     
     if (aSourceLayout->Flags() & EHuiVisualFlagDrawOnlyAsExternalContent)
         {
@@ -4349,17 +4912,17 @@
     // CHuiCanvasVisual* temporaryPresenterLayout = CHuiCanvasVisual::AddNewL( effectControlGroup, &effectControlGroupLayout);
     // create presenter visual and set bindings
     TInt itemsDestroyed(0);
-    AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect);
+    AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect, aCanDestroyOrHideImmediately);
 
     if (aIsExitEffect)
         {
-        CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsExitEffect);
+        CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, 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);
+        AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse, EFalse);
         __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout);
         }
     iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue;
@@ -4372,31 +4935,6 @@
     return ETrue; // TBool(!itemsDestroyed);
     }
 
-void CAlfBridge::SetupEffectContainerL(TInt aHandle,
-        CHuiCanvasVisual* aSourceVisual, TBool aIsExitEffect)
-    {
-    // if the original visual is having an effect, then remove it.
-    if (HasActiveEffect(aSourceVisual))
-        {
-        RemoveTemporaryPresenterVisual(aSourceVisual); 
-        }
-        
-    // Create new temporary presenter visual for the effect
-    CHuiControl& effectControlGroup =
-            iAlfScreens[0]->iFullscreenEffectControlGroup->Control(0);
-    CHuiLayout* layout = (CHuiLayout*) &effectControlGroup.Visual(0);
-    CHuiCanvasVisual* temporaryPresenterVisual = NULL;
-    temporaryPresenterVisual = CHuiCanvasVisual::AddNewL(effectControlGroup, layout);
-    // attach the source to the presenter visual
-    temporaryPresenterVisual->SetExternalContentL(aSourceVisual);
-    aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent);
-    temporaryPresenterVisual->ClearFlag(EHuiVisualFlagInactive);
-    aSourceVisual->SetChanged();
-    // append to cleanup stack. this is cleaned in RemoveTemporaryVisuals after effect has finished
-    iEffectCleanupStack.AppendL(TEffectCleanupStruct(aHandle, aSourceVisual, temporaryPresenterVisual, EFalse /*iIsLayout*/, aIsExitEffect));
-    __ALFFXLOGSTRING3("CAlfBridge::SetupEffectContainerL - adding handle: %d, 0x%x (source visual)-> 0x%x (presenter visual)", aHandle, aSourceVisual, temporaryPresenterVisual);
-    }
-
 void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data )
     {
     TInt action = data.iInt1;
@@ -4454,17 +4992,17 @@
     CHuiFxEngine* engine = NULL;
     // engine is not owned by us, it is a member of HuiEnv
     engine = iHuiEnv->EffectsEngine();
-    if (NeedsStoredBuffers(engine, *aEvent.iEffectName))
-        {
-        RecursiveStoreRenderBufferL(aCanvasVisual);
-        }
-
     if (engine)
         {
+        if (NeedsStoredBuffers(engine, *aEvent.iEffectName))
+            {
+            RecursiveStoreRenderBufferL(aCanvasVisual);
+            }
+
         // clear out old effect if this visual has one
-        __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading effect %S", &aEvent.iEffectName );
+        __ALFFXLOGSTRING2("HandleGfxControlEffectsL - loading effect %S on visual 0x%x", aEvent.iEffectName, aCanvasVisual );
         __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading control effect, handle %d", aEvent.iHandle );
-        if (HasActiveEffect(aCanvasVisual))
+        if (aCanvasVisual->Effect())
             {
             __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual);
             // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing
@@ -4484,11 +5022,11 @@
                 aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity);
                 // visual->SetFlag(EHuiVisualFlagShouldBeHidden);
                 }*/
-            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, ETrue);
+            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, ETrue, EFalse);
             }
         else
             {
-            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse);
+            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse);
             }
         if (layoutEffectable)
             {
@@ -4552,7 +5090,7 @@
     if (showVisual)
         {
         sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity);
-        sourceViz->ClearFlag(EHuiVisualFlagShouldBeShown); // it is now hidden
+        sourceViz->ClearFlag(EHuiVisualFlagShouldBeShown); // it is now shown
         }
     
     if (destroyVisual)
@@ -4632,9 +5170,6 @@
             }
         else
             {
-            TLex8 lex(sourceViz->Tag());
-            TInt nodeId;
-            lex.Val(nodeId);
             DestroyWindow(sourceViz, ETrue);
             }
         }
@@ -4715,7 +5250,7 @@
             return iEffectCleanupStack[i].iHandle;
             }
         }
-    __ALFFXLOGSTRING1(" CAlfBridge::SetupEffectLayoutContainerL - Could not find handle for 0x%x", aVisual);
+    __ALFFXLOGSTRING1("CAlfBridge::FindEffectHandle - Could not find handle for 0x%x", aVisual);
     return KErrNotFound;
     }
 
@@ -4743,13 +5278,13 @@
     CHuiLayout* effectControlGroupLayout = (CHuiLayout*) &effectControlGroup.Visual(0);
     __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - BEGIN - effects in layout %d", effectControlGroupLayout->Count());
 
-    while (iFinishedCleanupStackEffects.Count())
-        {
-        for (TInt i = 0; i < iEffectCleanupStack.Count() && iFinishedCleanupStackEffects.Count(); i++)
+    while(iFinishedCleanupStackEffects.Count())
+        {
+        for (TInt i = 0; i < iEffectCleanupStack.Count() ; i++)
             {
             __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisuals - looping, finished count: %d, index in active effecs: %d", iFinishedCleanupStackEffects.Count(), i );
-       
             TEffectCleanupStruct& effectItem = iEffectCleanupStack[i];
+             
             if (iFinishedCleanupStackEffects[0] == effectItem.iHandle)
                 {
                 if (RemoveTemporaryPresenterItem(effectItem))
@@ -4759,12 +5294,19 @@
                 if (iEffectCleanupStack.Count() > i)
                     {
                     iEffectCleanupStack.Remove(i);
+                    break;
                     }
-                iFinishedCleanupStackEffects.Remove(0);
-                i--;
                 }
             }
-        }
+        iFinishedCleanupStackEffects.Remove(0);
+       }
+    
+    if (iFinishedCleanupStackEffects.Count())
+        {
+        __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - There are still %d finished effects, that could not be found. They have been cleaned already. Reseting the array", iFinishedCleanupStackEffects.Count());
+        iFinishedCleanupStackEffects.Reset();
+        }
+    
     iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; // TODO: Check if really changed   
     iAlfScreens[0]->iDisplay->SetDirty();
 	__ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - END - effects in layout %d", effectControlGroupLayout->Count());
@@ -4806,7 +5348,12 @@
     // iFinishedCleanupStackEffects.Append(aHandle);
     if (!iEffectEndTimer->IsActive())
         {
-        iEffectEndTimer->Start( 10000, aHandle );
+        iEffectEndTimer->AddFinishedHandleL(aHandle);
+        iEffectEndTimer->Start(KEffectCleanupDelayInMs * 1000);
+        }
+    else
+        {
+        iEffectEndTimer->AddFinishedHandleL(aHandle);
         }
 
     // We should do visual visibility scan after effect is ended
@@ -4821,6 +5368,7 @@
     		{
     		// effect might have been cleaned even without this callback. e.g. closing of applicaion while option menu disappear 
     		// effect is running, would cause it. There is no need to request cleaning again.
+            __ALFFXLOGSTRING2("CAlfBridge::TransitionFinishedHandlerL - Request cleaning for handle %d on visual 0x%x", aHandle, iEffectCleanupStack[i].iEffectedVisual);
     		iFinishedCleanupStackEffects.Append(aHandle);
     		}
     	}
@@ -5284,9 +5832,28 @@
     if ( memoryLevel != iHuiEnv->MemoryLevel() )
         {    
         __ALFLOGSTRING1("CAlfBridge::DoUpdateMemoryLevel -> %d", memoryLevel);
+        TBool nowGoodMemory = !(memoryLevel < EHuiMemoryLevelNormal);
+        TBool wasGoodMemory = !(iHuiEnv->MemoryLevel() < EHuiMemoryLevelNormal);
+        
+        if (iActivated)
+            {
+            if (nowGoodMemory && !wasGoodMemory)
+                {
+                iBridgerClient.SendBlind(KAlfCompositionGoodOnGraphicsMemory, TIpcArgs());
+                }
+            else if (!nowGoodMemory && wasGoodMemory)
+                {
+                iBridgerClient.SendBlind(KAlfCompositionLowOnGraphicsMemory, TIpcArgs());
+                }
+            else
+                {
+                // No change.
+                }
+            }
+        
         if ( memoryLevel <= EHuiMemoryLevelLowest)
             {
-            LowMemoryCancelAllEffects();
+            OnLowMemoryModifyAllEffects();
             }
             
         iHuiEnv->NotifyMemoryLevel(memoryLevel);
@@ -5304,21 +5871,81 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // 
-void CAlfBridge::LowMemoryCancelAllEffects()
+void CAlfBridge::OnLowMemoryModifyAllEffects()
+    {
+    __ALFLOGSTRING("CAlfBridge::OnLowMemoryModifyAllEffects");
+    iLayoutSwitchEffectCoordinator->LowMemoryEvent();
+    HandleGfxStopEvent( EFalse );
+    
+	__ALFLOGSTRING("CAlfBridge::OnLowMemoryModifyAllEffects done");
+	}
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// 
+TInt CAlfBridge::GetSizeAndRotation(TSize& aSize, TInt& aRotation)
     {
-    __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects");
-    iLayoutSwitchEffectCoordinator->Cancel();
-    HandleGfxStopEvent( EFalse );
-	__ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects done");
-	}
+    if ( !iAlfScreens.Count() )
+        {
+        return KErrNotReady;
+        }
+
+    switch (iAlfScreens[0]->iDisplay->Orientation())
+        {
+    case CHuiGc::EOrientationCCW90:
+        aRotation = 1;
+        break;
+    case CHuiGc::EOrientation180:
+        aRotation = 2;
+        break;
+    case CHuiGc::EOrientationCW90:
+        aRotation = 3;
+        break;
+    case CHuiGc::EOrientationNormal:
+    default:
+        aRotation = 0;
+        break;
+        }    
+
+    aSize = iAlfScreens[0]->iDisplay->Size();
+
+    __ALFLOGSTRING3("CAlfBridge::GetSizeAndRotation %d x %d, rot %d", aSize.iWidth, aSize.iHeight, aRotation);
+    return KErrNone;
+    }
+    
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
+// 
+TInt CAlfBridge::ReadPixels(CFbsBitmap* aBitmap)
+    {
+    if ( !iAlfScreens.Count() )
+        {
+        return KErrNotReady;
+        }
+    __ALFLOGSTRING("CAlfBridge::ReadPixels");  
+    TRAPD(err, iAlfScreens[0]->iDisplay->CopyScreenToBitmapL(aBitmap));
+    __ALFLOGSTRING1("CAlfBridge::ReadPixels ret %d", err);    
+    return err;
+    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // 
 void CAlfBridge::Synchronized(TInt aId)
     {
-    // Use P&S for now.
-    RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId );
+    if(aId == iIdForLayoutSwitchFrameSync)
+        {
+        // send notification to alfstreamer server about
+        if (iActivated)
+            {
+            iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs());
+            }        
+        }
+    else
+        {
+        // Use P&S for now.
+        RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId );
+        }
     }
 
 void CAlfBridge::SetWindowGroupAsAlfApp(TInt aId)
@@ -5350,4 +5977,303 @@
     return (aVisual.Owner().ControlGroup()->ResourceId() == iAlfWindowGroupNodeId);
     }
 
+// experimental
+TBool CAlfBridge::IsFullScreenDrawn( TInt aOrientation)
+    {
+    if (!iAlfScreens.Count())
+        return EFalse;
+    aOrientation = iAlfScreens[0]->iDisplay->Orientation();            
+    iTempRegion.Clear();
+    
+    CAlfScreen* screen = iAlfScreens[0];
+    TRect fullscreen = TRect(TPoint(0,0), screen->Size());
+    __ALFFXLOGSTRING3("CAlfBridge::IsFullScreenDrawn - new orientation %d, screen size: (%d,%d)", aOrientation, fullscreen.iBr.iX, fullscreen.iBr.iY );
+    TBool fullscreenCovered = EFalse;
+    CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL;
+    
+    //iActiveVisualCount = 0;
+    iBgSurfaceFound = EFalse;
+    //iPaintedArea = 0;  
+    
+    // Check if effect group has an effect with opaque hint.
+    CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup);
+    CHuiControl& fxcontrol = fxcontrolgroup.Control(0);
+    CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0);
+    CHuiVisual* fxExternalContent = fxlayout->ExternalContent();
+    
+    if (fxlayout && IsOpaqueEffect(fxlayout->Effect()))
+        {
+        fullscreenCovered = ETrue;    
+        }
+    else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect()))
+        {
+        fullscreenCovered = ETrue;
+        }    
+    
+    TBool alfWindowGroupFoundVisible = EFalse;
+    
+    // skip the topmost (effect) layer, start from floating sprite group
+    for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--)
+        {                
+        CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j);
+        CHuiControl& control = controlgroup.Control(0);
+
+            for (TInt ii=0; ii<iAlfScreens[0]->iControlGroups.Count();ii++)
+                {
+                if( iAlfScreens[0]->iControlGroups[ii].iControlGroup == &controlgroup )
+                    {
+                    __ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", iAlfScreens[0]->iControlGroups[ii].iSecureId);
+                    break;
+                    }
+                }
+        
+        if (control.Role() == EAlfFpsIndicatorContainer)
+            {
+            // FPS container doesn't contain canvas visuals
+            continue;
+            }
+
+        CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
+       
+        // For optimization reasons, check if all visuals below in Z-order are covered    
+        if (!fullscreenCovered)
+            {
+            fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion);
+            
+            for(TInt ii=0;ii< iTempRegion.Count(); ii++)
+                {
+                __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawn (%d,%d)-(%d,%d)", iTempRegion[ii].iTl.iX, iTempRegion[ii].iTl.iY , iTempRegion[ii].iBr.iX, iTempRegion[ii].iBr.iY );
+                return ETrue;
+                }
+            }
+        
+        // Dont mess with alf control group visuals, alf session handling does it for us
+        if (control.Role() == EAlfSessionContainer)
+            {
+            CHuiLayout* hostContainer = control.ContainerLayout( NULL );
+            TInt flags = hostContainer->Flags();            
+            if (!fullscreenCovered)
+                {
+                
+                if(!(flags&EHuiVisualFlagUnderOpaqueHint))
+                    {
+                    alfWindowGroupFoundVisible = ETrue;
+                    if(iAppUi)
+                        {
+                        topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup);
+                        }
+
+                    // just add the rect to covered region because alf draws solid background
+                    iTempRegion.AddRect(fullscreen);
+                    iTempRegion.Tidy();
+                    fullscreenCovered = ETrue;
+                    }
+                }
+            else if(!alfWindowGroupFoundVisible || flags&EHuiVisualFlagUnderOpaqueHint)
+                {
+                // this alf session control group should not be visible anymore because avkon application is on top
+                // -> change to inactive
+                
+                }
+            else if(!(flags&EHuiVisualFlagUnderOpaqueHint)) // alf app covers full screen
+                {
+                // check if current controlgroup belongs to same srvsession as the topmost visible alf session container
+                CAlfAppSrvSessionBase* alfsrvsession = NULL;
+                if(iAppUi)
+                    {
+                    alfsrvsession = iAppUi->SrvSessionForControlGroup(controlgroup);
+                    }
+                if(topMostAlfSrvSession!=NULL && topMostAlfSrvSession == alfsrvsession)
+                    {
+                
+                    }
+                else
+                    {
+                
+                    }
+                }
+            continue;
+            }
+        
+        __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered)
+        TBool subTreeCovered = EFalse;
+        TBool hasActiveVisualsInVisualTree = 
+                IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, IsVisualOpaque(*layout), aOrientation );    
+        // If root visuals effect is marked as opaque, then add whole screen area as covered.
+        /*
+        if (!fullscreenCovered)
+            {
+            fullscreenCovered = IsOpaqueEffect(layout->Effect());
+            }                    
+        */    
+       
+        if (fullscreenCovered)
+            {
+            return ETrue;
+            }
+        }
+    return fullscreenCovered;
+    }
+
+TBool CAlfBridge::IsFullScreenDrawnRecursive(
+        CHuiLayout* aLayout, 
+        CHuiControlGroup& aControlGroup,
+        CHuiControl& aControl,
+        TBool& aFullscreenCovered, 
+        TRect& aFullscreen,
+        CAlfScreen* aScreen,
+        TBool& aSubtreeVisible, 
+        TBool aChildCanBeOpaque,
+        TInt aOrientation)
+    {
+    TBool visualTreeActive = EFalse;
+    TRect visualDisplayRect;
+    TBool visualRectIsCovered = EFalse;
+    TBool visualIsOpaque = EFalse;
+    TBool visualIsActive = EFalse;
+    CHuiCanvasVisual* canvasVisual = NULL;
+
+    for (TInt i=aLayout->Count()-1; i >= 0; i--)
+        {
+        visualDisplayRect = TRect(0,0,0,0);
+        visualRectIsCovered = EFalse;
+        visualIsOpaque = EFalse;
+        visualIsActive = EFalse;
+        TBool visualSubtreeVisible = EFalse;
+        
+        // Check first if visual itself is hidden or does hide other visuals below 
+        // in z-order. If it does not hide, then we do not add its displayrect to covering 
+        // region.
+        canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i));
+        
+        // Child can be considered to be opaque only if all parents are opaque and
+        // visual itself is opaque.
+        // For example, parent can have opacity < 1 and that affects children as well.
+        // As another example, parent can have scaling transformation.
+        visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual);
+        
+        if (canvasVisual->Count())
+            {
+            visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, visualIsOpaque, aOrientation );
+            }
+           
+        
+        if (visualSubtreeVisible)
+            {
+            aSubtreeVisible = ETrue;
+            }
+            
+        // Optimization, it is faster to check fullscreen than read visuals displayrect
+        if (aFullscreenCovered)
+            {
+            visualRectIsCovered = ETrue;    
+            }
+        else
+            {
+            // add the rect only if the window contains drawing for the new orientation
+            
+            visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation);
+            
+            // Make sure we clip visual rect to visible screen area
+            ClipVisualRect(visualDisplayRect, aFullscreen);
+            
+            // Check if this visual is covered by other opaque visuals which rects are in "covered" region           
+            visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion);
+           
+            }
+
+        
+        visualIsActive = canvasVisual->iOpacity.Now() > 0.01; // in fact this does not mean that visual should be drawn, but this atleast prevents disabled "on top" windows to be considered as visible.
+        
+        // Sprites and effects as we consider them always as transparent and also
+        // if controlgroup is transformed somehow    
+        if (aControl.Role() == EAlfFullScreenEffectContainer 
+            || aControl.Role() == EAlfWindowFloatingSpriteContainer ||
+            aControlGroup.IsTransformed())
+            {
+            visualIsOpaque = EFalse;    
+            }
+    
+        if (visualIsActive && visualIsOpaque && !visualRectIsCovered)
+            { 
+            // New visibility system takes only window shape into account.
+            if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation )
+                {                    
+				iTempRegion.AddRect(visualDisplayRect);
+                iTempRegion.Tidy();
+                __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawnRecursive - Added covered area (%d,%d)-(%d,%d)", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY , visualDisplayRect.iBr.iX, visualDisplayRect.iBr.iY );
+                }
+            }                                   
+        visualTreeActive |= visualIsActive;
+        } // for loop end : children checking loop
+    return visualTreeActive;
+    }
+
+
+void CAlfBridge::LayoutSwitchStart()
+    {
+    // mark all the application surfaces hidden
+    if (!iAlfScreens.Count())
+        {
+        return;    
+        }
+    CAlfScreen* screen = iAlfScreens[0];
+    // skip the topmost (effect) layer, start from floating sprite group
+    for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--)
+        {                
+        CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j);
+        CHuiControl& control = controlgroup.Control(0);
+
+        if (control.Role() == EAlfFpsIndicatorContainer || control.Role() == EAlfSessionContainer)
+            {
+            // FPS container doesn't contain canvas visuals and alfsession containers cannot have surfaces
+            continue;
+            }
+        
+        CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0);
+        MarkAllLayersHiddenRecursive(layout);
+        }
+    
+    }
+
+void CAlfBridge::MarkAllLayersHiddenRecursive(CHuiLayout* aLayout)
+    {
+    CHuiCanvasVisual* canvasVisual = NULL;
+
+    for (TInt i = aLayout->Count()-1; i >= 0; i--)
+        {
+        canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i));
+        if(canvasVisual)
+            {
+            if (canvasVisual->Count())
+                {
+                MarkAllLayersHiddenRecursive(canvasVisual);
+                }            
+    
+            if (!canvasVisual->LayerExtent().IsEmpty())
+                {
+                canvasVisual->ClearCanvasFlags(EHuiCanvasFlagSurfaceVisible);
+                canvasVisual->SetCanvasFlags(EHuiCanvasFlagSurfaceInvisible);
+                }
+            }
+        }
+    }
+
+void CAlfBridge::LayoutSwitchComplete()
+    {
+    // send notification to alfstreamer server
+    /*if (iActivated)
+        {
+        iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs());
+        }
+        */
+    // request syncronized frame
+    if ( iHuiEnv )
+        {
+        iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests;
+        iHuiEnv->Synchronize( iIdForLayoutSwitchFrameSync, this );
+        }
+    }
+
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -18,10 +18,11 @@
 #include <s32mem.h>
 #include "alfeffectutils.h"
 #include <akntransitionutils.h>
-
+#include <alflogger.h>
 
-const TInt KRosterFreezeEndTimeoutInMs = 400;
-const TInt KFirstTimeoutForApplicationEndFullScreenInMs = 50;
+const TInt KRosterFreezeEndTimeoutInMs = 100;
+const TInt KFirstTimeoutForApplicationEndFullScreenInMs = 20;
+const TReal KMinimumPaintedAreaBeforeForcedEffect = 0.75;
 
 // ---------------------------------------------------------
 // CAlfRosterFreezeEndTimer
@@ -53,8 +54,10 @@
     Cancel();        
     }
 
-void CAlfRosterFreezeEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod )
+void CAlfRosterFreezeEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod, TCallBack aCallBack  )
     {
+    iCallBack = aCallBack;
+    __ALFLOGSTRING("CAlfRosterFreezeEndTimer::Start");
     if (!IsActive())
         {
         After( aPeriod );
@@ -63,9 +66,30 @@
 
 void CAlfRosterFreezeEndTimer::RunL()
     {
-    iBridge.iHuiEnv->Display(0).SetDirty();
-    TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse));
-    iBridge.SetVisualTreeVisibilityChanged(ETrue);    
+    __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL");
+	
+	TBool timeout = EFalse;
+	
+	if (iSafeCounter >= 0)	
+	    {
+		iSafeCounter++;
+		if (iSafeCounter == 100) // can be lower, 100 should be visible enough to see, if heuristics fail
+			{
+			timeout = ETrue;
+			iSafeCounter = 0;
+			}
+		}
+
+    if (!iBridge.IsFullScreenDrawn(0) && !timeout)
+        {
+        __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Not ready in new orientation. waiting 50ms more");
+        After( 50000 );
+        return;
+        }
+    else
+        {
+        iCallBack.CallBack();
+        }
     }
 
 void CAlfRosterFreezeEndTimer::DoCancel()
@@ -77,7 +101,8 @@
 
 CAlfLayoutSwitchEffectCoordinator::CAlfLayoutSwitchEffectCoordinator( CAlfBridge& aBridge ) :
     iBridge( aBridge ),
-    iLayoutSwitchEffectContext(AknTransEffect::ENone)    
+    iLayoutSwitchEffectContext(AknTransEffect::ENone),
+    iCurrentState( EStateIdle )
     {
     RThread me = RThread();
     iOriginalPriority = me.Priority();    
@@ -89,186 +114,365 @@
     }
 
 // ---------------------------------------------------------
-// CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack
-//
-// This method is callback which gets called when layout 
-// switch effect has ended.
+// CAlfLayoutSwitchEffectCoordinator::Blank
 // ---------------------------------------------------------
 //
-void CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack( TInt aHandle )
+void CAlfLayoutSwitchEffectCoordinator::Blank(TBool aEnabled)
     {
-    //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack"));
-    if (iLayoutSwitchEffectContext == aHandle)
-        {
-        AknTransEffect::TContext nextContext = NextLayoutSwitchContext();
-
-        // Unfreeze visible content. This reveals real roster content (in new orientation).
-        if (nextContext == AknTransEffect::ELayoutSwitchExit)
-            {
-            #ifdef HUI_DEBUG_TRACK_DRAWING
-            RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack unfreezing roster content"));
-            #endif
-            iBridge.iHuiEnv->Display(0).SetDirty();
-            TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse));
-            iBridge.SetVisualTreeVisibilityChanged(ETrue);
-            }
-        
-        // Set next effect
-        SetLayoutSwitchEffect(nextContext);
-        
-        if (nextContext == AknTransEffect::ENone)
-            {
-            // Restore normal priority
-            RThread me = RThread();
-            me.SetPriority(iOriginalPriority);    
-            me.Close();
-
-            // Just in case refresh everything
-            iBridge.iHuiEnv->Display(0).SetDirty();
-            }        
-        }
-    else
-        {
-        //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack - got different handle (normal, dont worry...) - %i"), aHandle);        
-        }
+    __ALFLOGSTRING1("CAlfLayoutSwitchEffectCoordinator::Blank %d", aEnabled);
+    iBlankEnabled = aEnabled;
+    Event( aEnabled ? EEventBlankOn : EEventBlankOff );
     }
-
+    
 // ---------------------------------------------------------
-// CAlfLayoutSwitchEffectCoordinator::Cancel
+// CAlfLayoutSwitchEffectCoordinator::LowMemoryEvent
 // ---------------------------------------------------------
 //
-void CAlfLayoutSwitchEffectCoordinator::Cancel()
+void CAlfLayoutSwitchEffectCoordinator::LowMemoryEvent()
     {
-    // Disable effect
-    SetLayoutSwitchEffect( AknTransEffect::ENone );
-
-    // Unfreeze visible content
-    if ( iRosterFreezeEndTimer )
-        {
-        iRosterFreezeEndTimer->Cancel();
-        }
-
-    iBridge.iHuiEnv->Display(0).SetDirty();
-    TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse));
-    iBridge.SetVisualTreeVisibilityChanged(ETrue);
+    __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::LowMemory");
+    Event( EEventLowMemory );
+    }
     
-    // Restore normal priority
-    RThread me = RThread();
-    me.SetPriority(iOriginalPriority);    
-    me.Close();
-    }
-
 // ---------------------------------------------------------
 // CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch
-//
-// This method starts the layout switch effect procedure.
 // ---------------------------------------------------------
 //
 void CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch()
     {
-    // Hm. what to do if earlier is already in progress ?
-    //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch"));
-    if ( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest )
-        {
-        // No effects in low memory mode
-        return;
+    __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch");
+    Event( EEventLayoutSwitch );      
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::Event
+// ---------------------------------------------------------
+//
+void CAlfLayoutSwitchEffectCoordinator::Event(TEvent aEvent)
+    {
+    // States:
+    // - EStateIdle - No layout switch effect ongoing
+    // - EStateFreezeFx - Roster frozen, periodic fullscreen completeness checking
+    // - EStateBlankFx - Roster frozen, expecting client to say when ready to unfreeze
+    // - EStateThemeFx - Theme effect in use
+
+    // Events:
+    // - EEventBlankOn - Client requested blank on
+    // - EEventBlankOff - Client requested blank off
+    // - EEventLayoutSwitch - Layout switch noticed
+    // - EEventLowMemory - Low memory indication
+    // and implicit Finish - Effect finished
+    
+    // Transitions:
+    // From EStateIdle:
+    // - EEventBlankOn: EStateBlankFx
+    // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx.
+    //
+    // From EStateFreezeFx:
+    // - EEventBlankOn: EStateBlankFx
+    // - implicit Finish - EStateIdle
+    //
+    // From EStateBlankFx:
+    // - EEventBlankOff: EStateFreezeFx (we use freeze to ensure that result is ok)
+    // - EEventLayoutSwitch: If effect available, EStateThemeFx.
+    //
+    // From EStateThemeFx:
+    // - EEventLowMemory: If blank still on, EStateBlankFx. Otherwise EStateFreezeFx.
+    // - implicit Finish - EStateIdle
+
+    TState nextState = EStateIdle;
+    
+    switch ( iCurrentState )
+        {    
+    case EStateFreezeFx:
+        nextState = NextFreezeState(aEvent);
+        break;
+        
+    case EStateBlankFx:
+        nextState = NextBlankState(aEvent);
+        break;
+        
+    case EStateThemeFx:
+        nextState = NextThemeState(aEvent);
+        break;
+        
+    case EStateIdle:
+    default:
+        nextState = NextIdleState(aEvent);   
+        break;
         }
     
-    if (!iLayoutSwitchEffectContext)
+    if ( nextState != iCurrentState )
         {
-        TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff );
-        TBool tfxExists = LayoutSwitchEffectsExist();
-        if (tfxOn && tfxExists)
-            {
-            // Boost priority so that we are able to draw more frames for the effect
-            RThread me = RThread();
-            me.SetPriority(EPriorityAbsoluteHigh);    
-            me.Close();
-            
-            // Freeze visual content
-            //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch freezing roster content"));
-            iBridge.iHuiEnv->Display(0).SetDirty();
-            TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue));
-            
-            // Remove all other effects
-            iBridge.HandleGfxStopEvent( EFalse );
-            iBridge.RemoveAllTemporaryPresenterVisuals();
-            
-            // Set first layout switch effect 
-            SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart);
-            }
-        else
-            {
-            if (!iRosterFreezeEndTimer)
-                {
-                TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge));
-                }
-            
-            if (iRosterFreezeEndTimer)
-                {
-                iBridge.iHuiEnv->Display(0).SetDirty();
-                TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue));
-                
-                // Remove all other effects
-                iBridge.HandleGfxStopEvent( EFalse );
-                iBridge.RemoveAllTemporaryPresenterVisuals();
-
-                // Set remove freeze timer
-                iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000); 
-                }            
-            //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - tfx are set OFF -> I am not starting effect."));                        
-            }
-        }
-    else
-        {
-        //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - old effect exists - %i"), iLayoutSwitchEffectContext);
+        Transition( nextState, iCurrentState );
         }
     }
 
 // ---------------------------------------------------------
-// CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext
-//
-// This method automatically selects the next context in the 
-// layout switch procedure.
-//
-// Contextes change in the following order during layout switch:
-//
-// 1. AknTransEffect::ENone
-// 2. AknTransEffect::ELayoutSwitchStart
-// 3. AknTransEffect::ELayoutSwitchExit
-// 4. AknTransEffect::ENone
-//
-// After new context is selected, appropriate effect is set 
-// (and/or removed) from the roster.
-//
+// CAlfLayoutSwitchEffectCoordinator::Transition
 // ---------------------------------------------------------
 //
-AknTransEffect::TContext CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext()
+void CAlfLayoutSwitchEffectCoordinator::Transition(
+        TState aNewState, TState aPreviousState)
     {
-    // Resolve next context based on current context
-    AknTransEffect::TContext newContext = AknTransEffect::ENone;    
-    switch (iLayoutSwitchEffectContext)
+    __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aNewState, aPreviousState);
+    iCurrentState = aNewState;
+        
+    // Undo previous state - don't unfreeze roster.
+    switch ( aPreviousState )
+        {
+    case EStateFreezeFx:
+        if ( iRosterFreezeEndTimer )
+            {
+            iRosterFreezeEndTimer->Cancel();
+            }
+        break;
+        
+    case EStateBlankFx:        
+        iBridge.iHuiEnv->iPauseDrawing = EFalse;
+        break;
+        
+    case EStateThemeFx:
+        {
+        RThread me = RThread();
+        me.SetPriority(iOriginalPriority);    
+        me.Close();
+
+        if ( iRosterFreezeEndTimer )
+            {
+            iRosterFreezeEndTimer->Cancel();
+            }
+
+        SetLayoutSwitchEffect( AknTransEffect::ENone );
+        }
+        break;
+        
+    case EStateIdle:
+    default:    
+        break;
+        }
+    
+    // Do next state actions
+    switch ( iCurrentState )
+        {    
+    case EStateFreezeFx:
         {
-        case AknTransEffect::ENone:
+        if (!iRosterFreezeEndTimer)
+            {
+            TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge));
+            }
+            
+        if (iRosterFreezeEndTimer)
             {
-            newContext = AknTransEffect::ELayoutSwitchStart;            
-            break;
+            iRosterFreezeEndTimer->Cancel();
+            
+            FreezeRoster(ETrue);
+                
+            // Remove all other effects
+            iBridge.HandleGfxStopEvent( EFalse );
+            iBridge.RemoveAllTemporaryPresenterVisuals();
+
+            // Set remove freeze timer
+            __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition - Freeze timer started");
+            iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); 
             }
-        case AknTransEffect::ELayoutSwitchStart:
+        }
+        break;
+        
+    case EStateBlankFx:
+        {
+        // Start blanker
+        iBridge.iHuiEnv->iPauseDrawing = ETrue;
+        FreezeRoster(ETrue);        
+        }
+        break;
+        
+    case EStateThemeFx:
+        {
+        // Boost priority so that we are able to draw more frames for the effect
+        RThread me = RThread();
+        me.SetPriority(EPriorityAbsoluteHigh);    
+        me.Close();
+            
+        // Freeze visual content
+        iBridge.iHuiEnv->Display(0).SetDirty();
+        FreezeRoster(ETrue);
+            
+        // Remove all other effects
+        iBridge.HandleGfxStopEvent( EFalse );
+        iBridge.RemoveAllTemporaryPresenterVisuals();
+            
+        // Set first layout switch effect 
+        SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart);
+        }
+        break;
+        
+    case EStateIdle:
+    default:
+        {
+        // Undo everything to be sure
+        RThread me = RThread();
+        me.SetPriority(iOriginalPriority);    
+        me.Close();
+        
+        SetLayoutSwitchEffect( AknTransEffect::ENone );
+        if ( iRosterFreezeEndTimer )
             {
-            newContext = AknTransEffect::ELayoutSwitchExit;                    
-            break;
+            iRosterFreezeEndTimer->Cancel();
+            }            
+        
+        iBridge.iHuiEnv->iPauseDrawing = EFalse;
+        FreezeRoster(EFalse);
+        iBridge.iHuiEnv->Display(0).SetDirty();
+        iBridge.SetVisualTreeVisibilityChanged(ETrue);
+        }
+        break;
+        }    
+    
+    // Inform bridge about layout switch actions
+    if ( aNewState != EStateIdle && aPreviousState == EStateIdle )
+        {
+        iLayoutSwitchNotCompleted = ETrue;
+        iBridge.LayoutSwitchStart();
+        }
+    if ( aNewState == EStateIdle && iLayoutSwitchNotCompleted )
+        {
+        iLayoutSwitchNotCompleted = EFalse;
+        iBridge.LayoutSwitchComplete();
+        }
+    
+    __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition end");        
+    }
+
+
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::NextIdleState
+// ---------------------------------------------------------
+//
+CAlfLayoutSwitchEffectCoordinator::TState 
+    CAlfLayoutSwitchEffectCoordinator::NextIdleState(
+        TEvent aEvent)
+    {
+    TState state = EStateIdle;
+    
+    switch ( aEvent )
+        {
+    case EEventLayoutSwitch:
+        if ( IsThemeEffectEnabled() )
+            {
+            state = EStateThemeFx;
             }
-        case AknTransEffect::ELayoutSwitchExit: // fallthrough
-        default:
+        else
             {
-            newContext = AknTransEffect::ENone;            
-            break;
-            }              
+            state = EStateFreezeFx;
+            }
+        break;
+        
+    case EEventBlankOn:
+        state = EStateBlankFx;
+        break;
+        
+    case EEventBlankOff:
+    case EEventLowMemory:
+    default:
+        break;     
+        }
+    
+    return state;
+    }
+    
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::NextFreezeState
+// ---------------------------------------------------------
+//
+CAlfLayoutSwitchEffectCoordinator::TState 
+    CAlfLayoutSwitchEffectCoordinator::NextFreezeState(
+        TEvent aEvent)
+    {
+    TState state = EStateFreezeFx;
+    
+    switch ( aEvent )
+        {
+    case EEventBlankOn:
+        state = EStateBlankFx;
+        break;
+    
+    case EEventLayoutSwitch:    
+    case EEventBlankOff:
+    case EEventLowMemory:
+    default:
+        break;     
         }
+    
+    return state;
+    }
 
-    //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchEffectL old ctx = %i, new ctx = %i"), iLayoutSwitchEffectContext, newContext);
-    return newContext;
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::NextBlankState
+// ---------------------------------------------------------
+//
+CAlfLayoutSwitchEffectCoordinator::TState 
+    CAlfLayoutSwitchEffectCoordinator::NextBlankState(
+        TEvent aEvent)
+    {
+    TState state = EStateBlankFx;
+    
+    switch ( aEvent )
+        {
+    case EEventLayoutSwitch:
+        if ( IsThemeEffectEnabled() )
+            {
+            state = EStateThemeFx;
+            }
+        break;
+    
+    case EEventBlankOff:
+        state = EStateFreezeFx;
+        break;
+        
+    case EEventBlankOn:        
+    case EEventLowMemory:
+    default:
+        break;     
+        }
+    
+    return state;
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::NextThemeState
+// ---------------------------------------------------------
+//
+CAlfLayoutSwitchEffectCoordinator::TState 
+    CAlfLayoutSwitchEffectCoordinator::NextThemeState(
+        TEvent aEvent)       
+    {
+    TState state = EStateThemeFx;
+    
+    switch ( aEvent )
+        {
+    case EEventLowMemory:
+        state = iBlankEnabled ? EStateBlankFx : EStateFreezeFx;
+        break;
+            
+    case EEventLayoutSwitch:    
+    case EEventBlankOn:
+    case EEventBlankOff:
+    default:
+        break;     
+        }
+    
+    return state;
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::FreezeFinished
+// ---------------------------------------------------------
+//
+void CAlfLayoutSwitchEffectCoordinator::FreezeFinished()
+    {
+    Transition(EStateIdle, iCurrentState);
     }
 
 // ---------------------------------------------------------
@@ -314,7 +518,159 @@
         }    
     }
 
-TBool CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist()
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack
+//
+// This method is callback which gets called when layout 
+// switch effect has ended.
+// ---------------------------------------------------------
+//
+void CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack( TInt aHandle )
+    {
+    //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack")); 
+    // KErrNotFound indicates callback from DoNextLayoutSwitchContext
+    if (iLayoutSwitchEffectContext == aHandle || aHandle == KErrNotFound)
+        {
+        AknTransEffect::TContext nextContext = NextLayoutSwitchContext();
+
+        // Unfreeze visible content. This reveals real roster content (in new orientation).
+        if (nextContext == AknTransEffect::ELayoutSwitchExit)
+            {
+            #ifdef HUI_DEBUG_TRACK_DRAWING
+            RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack unfreezing roster content"));
+            #endif
+            iBridge.iHuiEnv->Display(0).SetDirty();
+            FreezeRoster(EFalse);
+            iBridge.SetVisualTreeVisibilityChanged(ETrue);
+            if ( iLayoutSwitchNotCompleted )
+                {
+                iLayoutSwitchNotCompleted = EFalse;
+                iBridge.LayoutSwitchComplete();
+                }
+            }
+        
+        // Set next effect
+        SetLayoutSwitchEffect(nextContext);
+        
+        if (nextContext == AknTransEffect::ENone)
+            {
+            // Restore normal priority
+            if ( iCurrentState == EStateThemeFx )
+                {
+                Transition(EStateIdle, iCurrentState);
+                }
+            
+            RThread me = RThread();
+            me.SetPriority(iOriginalPriority);    
+            me.Close();
+
+            // Just in case refresh everything
+            iBridge.iHuiEnv->Display(0).SetDirty();
+            }        
+        }
+    else
+        {
+        //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack - got different handle (normal, dont worry...) - %i"), aHandle);        
+        }
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext
+//
+// This method automatically selects the next context in the 
+// layout switch procedure.
+//
+// Contextes change in the following order during layout switch:
+//
+// 1. AknTransEffect::ENone
+// 2. AknTransEffect::ELayoutSwitchStart
+// 3. AknTransEffect::ELayoutSwitchExit
+// 4. AknTransEffect::ENone
+//
+// After new context is selected, appropriate effect is set 
+// (and/or removed) from the roster.
+//
+// ---------------------------------------------------------
+//
+// todo: rename
+TInt DoNextLayoutSwitchContext(TAny* aLayoutSwitchCoordinator)
+    {
+    CAlfLayoutSwitchEffectCoordinator* coordinator = (CAlfLayoutSwitchEffectCoordinator*)aLayoutSwitchCoordinator;
+    coordinator->AlfGfxEffectEndCallBack(KErrNotFound);
+    return 0;
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext
+// ---------------------------------------------------------
+//
+AknTransEffect::TContext CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext()
+    {
+    // Resolve next context based on current context
+    AknTransEffect::TContext newContext = AknTransEffect::ENone;    
+    switch (iLayoutSwitchEffectContext)
+        {
+        case AknTransEffect::ENone:
+            {
+            newContext = AknTransEffect::ELayoutSwitchStart;            
+            break;
+            }
+        case AknTransEffect::ELayoutSwitchStart:
+            {
+            newContext = AknTransEffect::ELayoutSwitch;
+            if (!iRosterFreezeEndTimer)
+                {
+                TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge));
+                }
+            if (iRosterFreezeEndTimer)
+                {
+                iRosterFreezeEndTimer->Cancel();
+                iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoNextLayoutSwitchContext, this));
+                }
+            else
+                {
+                newContext = AknTransEffect::ELayoutSwitchExit;
+                }
+            break;
+            }
+        case AknTransEffect::ELayoutSwitch:
+            {
+            newContext = AknTransEffect::ELayoutSwitchExit;                    
+            break;
+            }
+        case AknTransEffect::ELayoutSwitchExit: // fallthrough
+        default:
+            {
+            newContext = AknTransEffect::ENone;            
+            break;
+            }              
+        }
+
+    //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchEffectL old ctx = %i, new ctx = %i"), iLayoutSwitchEffectContext, newContext);
+    return newContext;
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled()
+// Returns true if layout switch theme effect may be used
+// ---------------------------------------------------------
+//
+TBool CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() const
+    {
+    TBool memoryOk = !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest );
+    TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff );
+    TBool tfxExists = LayoutSwitchEffectsExist();
+
+    return 
+        memoryOk && tfxOn && tfxExists;
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist()
+// Returns true if layout switch effect exists
+// ---------------------------------------------------------
+//
+TBool CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() const
     {
     TBool appearExists = EFalse;
     TBool disAppearExists = EFalse;
@@ -337,6 +693,26 @@
     }
 
 // ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::FreezeRoster()
+// Freeze visible content in roster.
+// ---------------------------------------------------------
+//
+void CAlfLayoutSwitchEffectCoordinator::FreezeRoster(TBool aFrozen)
+    {
+    TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(aFrozen));
+    }
+
+// ---------------------------------------------------------
+// CAlfLayoutSwitchEffectCoordinator::DoFreezeFinished()
+// ---------------------------------------------------------
+//
+TInt CAlfLayoutSwitchEffectCoordinator::DoFreezeFinished(TAny* aAny)
+    {
+    static_cast<CAlfLayoutSwitchEffectCoordinator*>(aAny)->FreezeFinished();
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------
 // CAlfFinishTimer
 // ---------------------------------------------------------
 //
@@ -349,6 +725,7 @@
 void CAlfEffectEndTimer::ConstructL()
     {
     CTimer::ConstructL();
+    iHandles.ReserveL(5);
     CActiveScheduler::Add( this );
     }
 
@@ -363,21 +740,30 @@
 
 CAlfEffectEndTimer::~CAlfEffectEndTimer()
     {
-    Cancel();        
+    Cancel();
+    iHandles.Close();
     }
 
-void CAlfEffectEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod, TInt aHandle )
+void CAlfEffectEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod )
     {
-    iHandle = aHandle;
     After( aPeriod );
     }
 
+void CAlfEffectEndTimer::AddFinishedHandleL(TInt aHandle)
+    {
+    iHandles.Append(aHandle);
+    }
+
 void CAlfEffectEndTimer::RunL()
     {
     //
     // timer completes and control is returned to caller
     //
-    iBridge.TransitionFinishedHandlerL( iHandle );
+    while(iHandles.Count())
+        {
+        iBridge.TransitionFinishedHandlerL( iHandles[0]);
+        iHandles.Remove(0);
+        }
     // We don't become active unless we are explicitly restarted
     }
 
@@ -437,13 +823,15 @@
     iHandle = aStream.ReadInt32L();
 
     iType = aStream.ReadInt32L();
-    iWg1 = aStream.ReadInt32L();
-    iWg2 = 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();
         }
@@ -465,9 +853,10 @@
     return 0; // must return something
     }
 
-TBool CFullScreenEffectState::ResetTimerL(CAlfBridge* aBridge)
+TBool CFullScreenEffectState::InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize)
     {
     iBridge = aBridge;
+    iDisplaySize = aDisplaySize;
     if (!iDrawingCompleteTimer)
         {
         iDrawingCompleteTimer = CPeriodic::NewL( EPriorityNormal );
@@ -481,8 +870,16 @@
 
 void CFullScreenEffectState::NotifyDrawingTimeout()
     {
-    TRect b = iPaintedRegion.BoundingRect();
-    if ( (b.Width() * b.Height()) > 0.75 * (iDisplaySize.iWidth * iDisplaySize.iHeight))
+    
+    iPaintedRegion.ClipRect(TRect(0,0, iDisplaySize.iWidth, iDisplaySize.iHeight));
+    iPaintedRegion.Tidy(); // remove overlapping regions
+    TInt size(0);
+    for(TInt i=0; i< iPaintedRegion.Count();i++ )
+        {
+        size += iPaintedRegion[i].Width()*iPaintedRegion[i].Height();
+        }
+    // lets continue, if the covered area is more than 75% of the screen. This is usually enough.
+    if ( size > KMinimumPaintedAreaBeforeForcedEffect  * (iDisplaySize.iWidth * iDisplaySize.iHeight))
         {
         iBridge->HandleGfxEndFullScreenTimeout(this);
         delete iDrawingCompleteTimer;
--- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -555,6 +555,13 @@
                 DoNodeAttributeChangedL();
                 break;
                 }
+            
+            case EAlfNodeSetWindowArea:
+                {
+                DoNodeSetWindowAreaL();
+                }
+                break;
+                
             case EAlfCommitBatch:
                 {
                 RequestFrameEndCallback();
@@ -876,7 +883,13 @@
 #endif
 
     AMT_INC_COUNTER_IF(node, iNodeExtentChangedCount );
-    AMT_SET_VALUE_IF(node, iLatestNodeExtentRect, rect );        
+    AMT_SET_VALUE_IF(node, iLatestNodeExtentRect, rect );
+    AMT_MAP_SET_VALUE_IF( ( node && node->iWindow ),
+                          iSizeMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, 
+                          rect.Size(), EAlfModuleTestTypeHierarchyModelChangeSize );
+    AMT_MAP_SET_VALUE_IF( ( node && node->iWindow ),
+                          iPositionMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, 
+                          rect.iTl, EAlfModuleTestTypeHierarchyModelChangePosition );
     }
 
 // ---------------------------------------------------------------------------
@@ -937,7 +950,10 @@
         USER_INVARIANT();
         }
 
-    AMT_INC_COUNTER_IF(node, iTotalNodeFlagChangedCount );    
+    AMT_INC_COUNTER_IF(node, iTotalNodeFlagChangedCount );
+    AMT_MAP_INC_VALUE_IF( ( node && node->iWindow ),
+                          iIntMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, 
+                          EAlfModuleTestTypeHierarchyModelChangeFlag );    
     }
 
 // ---------------------------------------------------------------------------
@@ -1025,6 +1041,17 @@
             {
             node->Window()->SetLayerUsesAplhaFlag(KWindowIsDSAHost);
             }
+        if (extent.IsEmpty())
+            {
+            iServer.ReleasePermissionTokenL(node->iId);
+            }
+        else
+            {
+            iServer.CreatePermissionTokenL(node->iId, 
+                                           node->Window()->WsInfo().iClientSideId.iWindowIdentifer,
+                                           node->Window()->WsInfo().iClientSideId.iWindowGroupId );
+            }    
+        
         }
     else if( node ) // this would mean that node has being orphaneded but not yet deleted
         {
@@ -1127,6 +1154,26 @@
 
     AMT_INC_COUNTER_IF(node, iTotalNodeAttributeChangedCount );    
     }
+    
+// ---------------------------------------------------------------------------
+// DoNodeAttributeChangedL
+// ---------------------------------------------------------------------------
+//
+void CAlfHierarchyModel::DoNodeSetWindowAreaL()
+    {
+    TUint32 nodeId = (TUint32)iStream->ReadUint32L();
+    CAlfNode* node = FindNode(nodeId);
+    if ( node && node->Type() == MWsWindowTreeNode::EWinTreeNodeClient )
+        {
+        CAlfNodeWindow* w = static_cast<CAlfNodeWindow*>(node);
+        w->SetWindowAreaL( iStream );
+        }
+    else
+        {
+        USER_INVARIANT(); // set window area change for unexpected node type. new code needed!
+        }
+    }
+
 // ---------------------------------------------------------------------------
 // DoNodeWindowGroupChainBrokenAfterL
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -214,9 +214,13 @@
 	if ( iParent->iType != MWsWindowTreeNode::EWinTreeNodeRoot)
 		{
 		CAlfNode* parentGroupNode = iModel->FindNode( aParentId );
+		aNodes.Append(parentGroupNode); 
 		for (CAlfNode::TIter iter( parentGroupNode ); iter.Current() != NULL;  iter.Next()) 
 			{ 
-			aNodes.Append(iter.Current()); 
+			if (iter.Current() != parentGroupNode )
+			    {
+			    aNodes.Append(iter.Current());
+			    }
 			}
 		}
 	else
@@ -1476,6 +1480,8 @@
             		{
                     iWindow->SetActive( EFalse );
             		}
+            	
+            	iWindow->IncludeToVisibilityCalculation( iVisible && iNodeActivated );
             	}
             break;
             }
@@ -1488,6 +1494,10 @@
         case MWsWindowTreeObserver::EAlphaChannelTransparencyEnabled:
             {
             iAlphaChannelTransparencyEnabled = aNewValue;
+            if ( iWindow )
+                {
+                iWindow->SetTransparencyAlphaChannel( aNewValue );
+                }
             break;
             }
         }
@@ -1637,7 +1647,9 @@
         		{
         		iWindow->SetActive( ETrue );
         		}
-        	}
+        	
+        	iWindow->IncludeToVisibilityCalculation( iVisible && iNodeActivated );
+            }
          }
      else
          {
@@ -1712,16 +1724,15 @@
 
 // ---------------------------------------------------------------------------
 // MoveToWindowGroup
-// !!!! THIS METHOD HAS NOT BEEN TESTED AT ALL!!!!!! EXPECT TROUBLE!!!!
 // ---------------------------------------------------------------------------
 //
 void CAlfNodeWindow::MoveToWindowGroup( TUint32 aNewGroupId )
 	{
-	__ALFLOGSTRING("CAlfNodeWindow::MoveToWindowGroup, THIS METHOD IS UNTESTED. EXPECT TROUBLE!");
+	__ALFLOGSTRING3("CAlfNodeWindow::MoveToWindowGroup moving nodeID 0x%x from group 0x%x to 0x%x",iId, iParent->iId, aNewGroupId );
 	CAlfNodeGroup* newGroup = (CAlfNodeGroup*)iModel->FindNode( aNewGroupId );
 	if ( newGroup )
 		{
-		// collect my children in my old group
+		// collect my children in my old group (inclucing me)
 		RPointerArray<CAlfNode> myChildNodes;
 		GetAllChildrenInGroup( myChildNodes, iId );
 			    
@@ -1735,20 +1746,22 @@
 			{
 			previous->iSibling = iSibling; // there was the a previous child. update the link to my next sibling (which might be NULL)
 			}
-		TUint32 oldGroupId = iParent->iId;
-		iParent = newGroup;
-		SetFirstChild();
-		
+
 		// yippii, new parent, 		
 		// add me as the first child of the new group
-		// TODO: Move the nodes to the new group?
+		iParent = newGroup;
+		iSibling = NULL;
+		SetFirstChild();
+
+		TUint32 screenNumber = iScreenNumber;
+
 		TInt i = myChildNodes.Count();
 		while( --i >=0 ) // update groupid and send new location to appui 
-			{
-			iModel->Server().Bridge()->AddData( EAlfDSMoveWindowToNewGroup, 
-					myChildNodes[i]->iId, 
-					oldGroupId, 
-					(TAny*)aNewGroupId );
+		    {
+		    iModel->Server().Bridge()->AddData( EAlfDSMoveWindowToNewGroup, 
+		            myChildNodes[i]->iId, 
+		            screenNumber, 
+		            (TAny*)aNewGroupId );
 			myChildNodes[i]->iGroupId = aNewGroupId;
 			}
 	  
@@ -1762,6 +1775,38 @@
 	}
 
 // ---------------------------------------------------------------------------
+// SetWindowAreaL
+// ---------------------------------------------------------------------------
+//
+void CAlfNodeWindow::SetWindowAreaL( RMemReadStream* aStream )
+    {
+    TPoint pos;
+    RRegion region;
+    CleanupClosePushL( region );
+    
+    pos.iX = aStream->ReadInt32L();
+    pos.iY = aStream->ReadInt32L();
+    
+    TInt count = aStream->ReadInt32L();
+    for ( TInt i = 0; i < count; ++i )
+        {
+        TRect r;
+        aStream->ReadL((TUint8*)&r.iTl.iX, 4 * sizeof(TInt32 ));
+        region.AddRect(r);
+        }
+    
+    if ( region.CheckError() )
+        {
+        // Fallback to non-shape version
+        region.Clear();
+        }
+    
+    iWindow->SetWindowArea( pos, region );
+    
+    CleanupStack::PopAndDestroy();
+    }
+
+// ---------------------------------------------------------------------------
 // NewL
 // ---------------------------------------------------------------------------
 //
--- a/uiacceltk/hitchcock/ServerCore/Src/alfsrvdisplaysubsession.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfsrvdisplaysubsession.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -33,6 +33,13 @@
 #include <uiacceltk/HuiEvent.h>
 #include <mtransitionserver.h>
 
+// ETrue if client defined display quality is supported, EFalse if not.
+// As there is other content than this ALF application content in the scene, 
+// it's better ignore client quality hints.
+// Note: If this is supported and client gains focus, client quality setting is
+//       taken into use and applied to the whole scene. However, when client loses
+//       focus, quality setting is not restored.
+const TBool KAlfSrvClientQualitySupport = EFalse;
 
 // ======== MEMBER FUNCTIONS ========
 
@@ -257,7 +264,12 @@
         iBackgroundItems.Reset();
 
         // Set background
-        Display().SetClearBackgroundL( CHuiDisplay::TClearMode( clearBackground ));
+        TRAPD(err, Display().SetClearBackgroundL( CHuiDisplay::TClearMode( clearBackground )) );
+        // Don't let client see timeout errors from our internal services implementation
+        if( err != KErrNone && err != KErrTimedOut ) 
+            {
+            User::Leave(err);
+            }
         }
     
     // Complete
@@ -368,7 +380,7 @@
     TPckg<THuiQuality> valuePckg(value); 
     aMessage.Read(1,valuePckg);
 
-    if ( session.IsFocused() )
+    if ( KAlfSrvClientQualitySupport && session.IsFocused() )
         {
         // Set quality
         Display().SetQuality(value);    
@@ -395,7 +407,7 @@
     THuiQuality value = EHuiQualityAccurate;
     TPckg<THuiQuality> valuePckg(value); 
 
-    if ( session.IsFocused() )
+    if ( KAlfSrvClientQualitySupport && session.IsFocused() )
         {
         // Get quality
         value = Display().Quality();    
@@ -696,8 +708,11 @@
                 TRAP_IGNORE(iDisplay->SetClearBackgroundL(
                         CHuiDisplay::TClearMode(iDisplayClearBackground)))                                        
                 }    
-                        
-            iDisplay->SetQuality(THuiQuality(iDisplayRenderingQuality));
+
+            if ( KAlfSrvClientQualitySupport )
+                {
+                iDisplay->SetQuality(THuiQuality(iDisplayRenderingQuality));
+                }
             iDisplay->SetUseDepth(iDisplayUseDepthTest);
             
             UpdateAutomaticFading(); // update non-fading to app ui container
--- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerbridge.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerbridge.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -279,42 +279,16 @@
     iWgArray = aArray;
     }
 
-EXPORT_C TUid CAlfStreamerBridge::FindAppUidForWgId(TInt aWgId)
+EXPORT_C TUid CAlfStreamerBridge::FindAppUidForWgId(TInt /*aWgId*/)
     {
-    if (iWgArray)    
-        {TInt* ptr = iWgArray;     
-        for (TInt i=0; i<39; i=i+2) // magic
-            {
-            if (ptr[i] == aWgId)
-                {
-                return TUid::Uid(ptr[i+1]);
-                }
-            if (!ptr[i])
-                {
-                break;
-                }    
-            }
-        }
-    return KNullUid; 
+    __ASSERT_DEBUG(EFalse, User::Leave(KErrNotSupported));
+    return KNullUid;
     }        
 
-EXPORT_C TInt CAlfStreamerBridge::FindWgForAppUid(TUid aAppUid)
+EXPORT_C TInt CAlfStreamerBridge::FindWgForAppUid(TUid /*aAppUid*/)
     {
-    if (iWgArray)    
-        {TInt* ptr = iWgArray;     
-        for (TInt i=0; i<39; i=i+2) // magic
-            {
-            if (ptr[i+1] == aAppUid.iUid)
-                {
-                return ptr[i];
-                }
-            if (!ptr[i])
-                {
-                break;
-                }    
-            }
-        }
-    return 0; 
+    __ASSERT_DEBUG(EFalse, User::Leave(KErrNotSupported));
+    return 0;
     }        
     
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -26,6 +26,7 @@
 #include "alfstreamerbridge.h"
 #include "alfwindowmanager.h"
 #include "alfhierarchymodel.h"
+#include "alflogger.h"
 #include <ecom.h>
 #include <alf/AlfTransEffectPlugin.h>
 #include <alf/AlfTransEffectPlugin.hrh>
@@ -160,9 +161,13 @@
 // NewSessionL
 // ---------------------------------------------------------------------------
 //   
-CSession2* CAlfStreamerServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const
+CSession2* CAlfStreamerServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& aMessage) const
     {
-	CSession2* newSession = new(ELeave) CAlfStreamerServerSession();
+    RThread t;    
+    aMessage.Client(t);
+    CleanupClosePushL(t);
+	CSession2* newSession = new(ELeave) CAlfStreamerServerSession(t.Id());
+    CleanupStack::PopAndDestroy();
     iSessions++;
     
     return newSession;   
@@ -187,9 +192,13 @@
 // HandleClientExit
 // ---------------------------------------------------------------------------
 //   
-void CAlfStreamerServer::HandleClientExit(const CSession2* /*aClient*/)
+void CAlfStreamerServer::HandleClientExit(const CAlfStreamerServerSession* aClient)
     {
     iSessions--;
+    if (WindowMgr())
+        {
+        WindowMgr()->HandleClientExit(aClient->ThreadId());
+        }
     if (!iSessions)
         {
         // CActiveScheduler::Stop(); // TODO: lets not die, if client dies.
@@ -209,6 +218,7 @@
     iCompositionHostSessions.Close();
     iCompositionTokens.Close();
     iWindowServerSessions.Close();
+    iAlfTargets.Close();
     }
 
 void CAlfStreamerServer::AppendCompositionSessionL(CAlfStreamerServerSession* aSession, TBool aHost)
@@ -282,57 +292,138 @@
 
 void CAlfStreamerServer::HandleCompositionRequestL(CAlfStreamerServerSession* aSession, TInt aOp, const RMessage2& aMessage)
     {
-    CAlfStreamerServerSession* wservsession = WservSession( aSession->ScreenNumber() );
-
     TInt length = aMessage.GetDesLength(0);
     User::LeaveIfError(length);
     HBufC8* message = HBufC8::NewLC(length+4);
     TPtr8 clientBuf = message->Des();
     aMessage.ReadL(0,clientBuf);
-
-    if(aOp == KAlfCompOpSetExtent) 
-        {
-        TInt* ptr = (TInt*)clientBuf.Ptr();
-        TInt screennumber = ptr[4];
-        if(screennumber!=aSession->ScreenNumber())
-            {
-            aSession->ExtentSurfaceId().iInternal[0] = ptr[5];
-            aSession->ExtentSurfaceId().iInternal[1] = ptr[6];
-            aSession->ExtentSurfaceId().iInternal[2] = ptr[7];
-            aSession->ExtentSurfaceId().iInternal[3] = ptr[8];
-            wservsession = WservSession( screennumber );
-            }
-        }
-    else if(aOp == KAlfCompOpSessionClosed)
-        {
-        FreeCompositionSessionExtents(aSession);
-        }
-    
-    TInt session = reinterpret_cast<TInt>(aSession);
-    clientBuf.Insert(0, TPtrC8((TUint8*)&session ,sizeof(TInt)));
-    
-    if( wservsession ) // don't send to any wservsession if composition source does not have a window anywhere and this is not SetExtent operation
-        {
-        QueueRequestForSessionL(wservsession, clientBuf, aOp);
-        }
-    
-    CleanupStack::PopAndDestroy(); // unefficient..
  
-    if (!wservsession)
-        {
-        aMessage.Complete(KErrNotReady);
-        return;
-        }
-    
+    HandleCompositionRequestL(aSession,aOp, clientBuf);
+        
     if( aOp == KAlfCompOpCreateSource )
         {
         AppendCompositionSessionL(aSession);
+        TAlfCompParams* param = (TAlfCompParams*)clientBuf.Ptr();
+        for (TInt i = iAlfTargets.Count()-1;i >= 0; i--)
+            {
+            if (iAlfTargets[i].iWindowHandle == param->iWindowHandle&& 
+                iAlfTargets[i].iWindowGroup == param->iWindowGroup)
+                {
+                aSession->AlfToken() = iAlfTargets[i].iTarget;
+                __ALFLOGSTRING("CAlfStreamerServer::HandleCompositionRequestL(): Found ALF token for composition session")
+                }     
+            }    
         aMessage.Complete(reinterpret_cast<TInt>(aSession));
         }
     else if ( aOp != KAlfCompOpSetZOrder )
         {
         aMessage.Complete(KErrNone);
         }
+
+    CleanupStack::PopAndDestroy(); // unefficient..
+    }
+
+void CAlfStreamerServer::HandleCompositionRequestL(CAlfStreamerServerSession* aSession, TInt aOp, TPtr8& aClientBuf)
+    {
+    CAlfStreamerServerSession* wservsession = WservSession( aSession ? aSession->ScreenNumber() : 0 );
+    if (!wservsession)
+        {
+        __ALFLOGSTRING("CAlfStreamerServer::HandleCompositionRequestL(): Window server not connected yet")
+        User::Leave(KErrNotReady);
+        }
+        
+    if( aSession )
+        {
+        if(aOp == KAlfCompOpSetExtent ) 
+            {
+            TInt* ptr = (TInt*)aClientBuf.Ptr();
+            TInt screennumber = ptr[4];
+            if(screennumber!=aSession->ScreenNumber())
+                {
+                aSession->ExtentSurfaceId().iInternal[0] = ptr[5];
+                aSession->ExtentSurfaceId().iInternal[1] = ptr[6];
+                aSession->ExtentSurfaceId().iInternal[2] = ptr[7];
+                aSession->ExtentSurfaceId().iInternal[3] = ptr[8];
+                wservsession = WservSession( screennumber);
+                }
+            }
+        else if(aOp == KAlfCompOpSessionClosed)
+            {
+            FreeCompositionSessionExtents(aSession);
+            }
+        TInt targetId = reinterpret_cast<TInt>(aSession);
+        aClientBuf.Insert(0, TPtrC8((TUint8*)&targetId,sizeof(TInt)));
+        } 
+    
+    if( wservsession ) // don't send to any wservsession if composition source does not have a window anywhere and this is not SetExtent operation
+        {
+        QueueRequestForSessionL(wservsession, aClientBuf, aOp);
+        }
+    }
+
+void CAlfStreamerServer::CreatePermissionTokenL(TInt aAlfToken, TInt aWindowHandle, TInt aWindowGroup)
+    {
+    __ALFLOGSTRING3("CAlfStreamerServer::CreatePermissionTokenL %d, %d, %d >>",aAlfToken,aWindowHandle,aWindowGroup)
+    TAlfCompParams param = {aAlfToken, aAlfToken, aWindowHandle, aWindowGroup};
+    if (iAlfTargets.Find(param) != KErrNotFound)
+        {
+        __ALFLOGSTRING("CAlfStreamerServer::CreatePermissionTokenL: Already added")
+        return;
+        }    
+    TPckg<TAlfCompParams> ptr(param);
+    HandleCompositionRequestL(0, KAlfCompOpCreateSource, ptr);
+    User::LeaveIfError(iAlfTargets.Append(param));
+    __ALFLOGSTRING("CAlfStreamerServer::CreatePermissionTokenL <<")
+    }
+
+void CAlfStreamerServer::ReleasePermissionTokenL(TInt aAlfToken)
+    {
+    __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL >>")
+    RemoveTargetFromInactiveSurfaces(aAlfToken);
+    for (TInt i = 0; i < iAlfTargets.Count(); i++)
+        {
+        if (iAlfTargets[i].iTarget == aAlfToken)
+            {
+            TPckg<TInt> ptr(aAlfToken);
+            HandleCompositionRequestL(0, KAlfCompOpSessionClosed, ptr);        
+            iAlfTargets.Remove(i);
+            __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Found <<")
+            return;
+            }
+        }
+    __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Not Found <<")
+    }
+
+void CAlfStreamerServer::QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp)
+    {
+    __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL >>")
+    for(TInt i = iCompositionSessions.Count()-1; i >= 0; i-- )
+        {
+        if (iCompositionSessions[i]->AlfToken() == aAlfToken)
+            {
+            if (iCompositionSessions[i]->IsBgAnimSession() && 
+                (aOp == KAlfCompositionTargetHidden || aOp == KAlfCompositionTargetVisible ))
+                { // omit
+                continue;    
+                }        
+                    
+            __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL: Session found")
+            iCompositionSessions[i]->QueueL(aPtr, aOp);
+            }
+        }
+    __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL <<")
+    }
+
+
+void CAlfStreamerServer::QueueRequestBGAnimSessionsL(const TPtrC8& aPtr, TInt aOp)
+    {
+    for(TInt i = iCompositionSessions.Count()-1; i >= 0; i-- )
+        {
+        if (iCompositionSessions[i]->IsBgAnimSession())
+            {
+            iCompositionSessions[i]->QueueL(aPtr, aOp);
+            }
+        }
     }
 
 void CAlfStreamerServer::QueueRequestForSessionL(CAlfStreamerServerSession* aSession, const TPtrC8& aPtr, TInt aOp)
@@ -367,14 +458,14 @@
     TInt* ptr = (TInt*) clientBuf.Ptr();
     TInt newkey = Math::Random();
     
-    TRAPD( err, iCompositionTokens.AppendL( CCompositionToken( newkey, ptr[0] /* customer specified key */,
+    TRAPD( err, iCompositionTokens.AppendL( TCompositionToken( newkey, ptr[0] /* customer specified key */,
                                                                 ptr[1] /*flags*/, aTarget,
                                                                 aSession->ScreenNumber() ) ) );
     if (err)
         {
         newkey = 0;
         }
-    RDebug::Print(_L("CAlfStreamerServer::CreatePermissionToken - newkey %d target: %d, err: %d"), newkey, aTarget, err );
+    __ALFLOGSTRING3("CAlfStreamerServer::CreatePermissionToken - newkey %d target: %d, err: %d", newkey, aTarget, err )
             
     CleanupStack::PopAndDestroy(message);
     return newkey; 
@@ -456,7 +547,7 @@
         }
     
     if ( aOp == KAlfCompositionLowOnGraphicsMemory ||  aOp == KAlfCompositionGoodOnGraphicsMemory 
-		|| aOp == KAlfCompositionTargetHidden ||aOp == KAlfCompositionTargetVisible)
+		|| aOp == KAlfCompositionTargetHidden ||aOp == KAlfCompositionTargetVisible  || aOp == KAlfCompositionLayoutSwitchComplete)
         {
         aMessage.Complete(KErrNone);
         QueueRequestAllSessionsL(KNullDesC8(), aOp, ETrue);    
@@ -488,7 +579,7 @@
                     {
 
                     TRAPD( err, iCompositionTokens.AppendL( 
-                            CCompositionToken(
+                            TCompositionToken(
                             ptr[1], // new token
                             ptr[2], // secret key
                             0,
@@ -538,11 +629,74 @@
         }
     }
 
+void CAlfStreamerServer::RemoveTargetFromInactiveSurfaces(TInt aTarget)
+    {
+    for (TInt i = 0; i<iInactiveSurfaces.Count(); i++)
+        {
+        if (aTarget == iInactiveSurfaces[i].iTarget)
+            {
+            iInactiveSurfaces.Remove(i);
+            break;
+            }    
+        }  
+    }
+    
+void CAlfStreamerServer::AddTargetFromInactiveSurfaces(TInt aTarget)
+    {
+    for (TInt i = 0; i<iInactiveSurfaces.Count(); i++)
+        {
+        if (aTarget == iInactiveSurfaces[i].iTarget)
+            {
+            return;
+            }    
+        }
+
+    for (TInt i = 0; i<iAlfTargets.Count(); i++)
+        {
+        if (aTarget == iAlfTargets[i].iTarget)
+            { // ret value ignored intentionally
+            iInactiveSurfaces.Append(iAlfTargets[i]);
+            break;
+            }    
+        }
+    }
+    
+void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso)
+    {
+    RArray<TAlfCompParams>& arrayRef = aActiveAlso?iAlfTargets:iInactiveSurfaces;
+        
+    TInt count = arrayRef.Count();    
+   __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count)
+    if ( count == 0)
+        {
+        aMessage.Complete(KErrNotFound);
+        return;
+        }
+                
+    TInt maxLength = aMessage.GetDesMaxLength(0);
+    TInt* array = new (ELeave) TInt [maxLength/4];
+    
+    count = Min(maxLength/4-1, count);
+    for ( TInt i = 0; i<count; i++ ) 
+        {
+        __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayRef[i].iWindowGroup);
+        array[i] = arrayRef[i].iWindowGroup;
+        }
+        
+    array[count] = 0;
+        
+    TPtr8 ptr((TUint8*)array,maxLength,maxLength);
+    aMessage.WriteL(0, ptr);
+    delete[] array;
+    aMessage.Complete(KErrNone);
+   __ALFLOGSTRING("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL <<")
+    }
+
 // ---------------------------------------------------------------------------
 // constructor
 // ---------------------------------------------------------------------------
 //   
-CAlfStreamerServerSession::CAlfStreamerServerSession() : iScreenNumber(KErrNotFound)
+CAlfStreamerServerSession::CAlfStreamerServerSession(const TThreadId& aThreadId) : iScreenNumber(KErrNotFound), iThreadId(aThreadId)
     {
     }
 
@@ -591,7 +745,7 @@
 //   
 void CAlfStreamerServerSession::ServiceL(const RMessage2& aMessage)
     {
-//    RDebug::Print(_L("CAlfStreamerServerSession::ServiceL %d"), aMessage.Function());
+   __ALFLOGSTRING1("CAlfStreamerServerSession::ServiceL %d", aMessage.Function())
    CAlfStreamerServer* server = (CAlfStreamerServer*)( Server() );
    
    TInt op = aMessage.Function();
@@ -697,6 +851,87 @@
             break;    
             }
 
+        case EAlfPostDataToCompositionClient:
+            {
+            TInt clientBufL = aMessage.GetDesLength(2);       
+            TPtr8 ptr(0,0);
+            HBufC8* buf = 0;
+            if (clientBufL > 0)
+                { 
+                HBufC8::NewLC(aMessage.GetDesLength(2));
+                ptr.Set((TUint8*)buf->Ptr(),clientBufL,clientBufL);
+                }   
+            TInt op = aMessage.Int0();
+            TInt key = aMessage.Int1();
+            
+            aMessage.Complete(KErrNone);
+            TRAP_IGNORE(server->QueueRequestSessionsL(key, ptr, op);)
+            if (buf)
+                {
+                CleanupStack::PopAndDestroy();
+                }
+            break;                
+            }
+              
+        case EAlfPostDataToCompositionTarget:
+            {
+            TInt clientBufL = aMessage.GetDesLength(2);      
+            TInt int2 = aMessage.Int1();
+            TPtr8 ptr(0,0);
+            HBufC8* buf = 0;
+            if (clientBufL > 0)
+                { 
+                HBufC8::NewLC(clientBufL);
+                ptr.Set((TUint8*)buf->Ptr(),clientBufL,clientBufL);
+                }
+            else
+                {
+                ptr.Set((TUint8*)&int2, sizeof(TInt),sizeof(TInt));
+                }    
+            TInt op = aMessage.Int0();
+            aMessage.Complete(KErrNone);
+            TRAP_IGNORE(server->HandleCompositionRequestL(0, op, ptr);)
+            if (buf)
+                {
+                CleanupStack::PopAndDestroy();
+                }
+            if (op == KAlfCompositionTargetVisible)
+                {
+                server->RemoveTargetFromInactiveSurfaces(int2);
+                }
+            else if (op == KAlfCompositionTargetHidden)
+                {
+                server->AddTargetFromInactiveSurfaces(int2);
+                }                      
+            break;                
+            }
+        case EAlfGetListOfWGsHavingInactiveSurfaces:
+            {
+            server->GetListOfWGsHavingInactiveSurfacesL(aMessage, EFalse);
+            break;    
+            }
+        
+        case EAlfQueueRequestBGSessions:
+            {
+            TInt clientBufL = aMessage.GetDesLength(1);       
+            TPtr8 ptr(0,0);
+            HBufC8* buf = 0;
+            if (clientBufL > 0)
+                { 
+                HBufC8::NewLC(clientBufL);
+                ptr.Set((TUint8*)buf->Ptr(),clientBufL,clientBufL);
+                }   
+            TInt op = aMessage.Int0();    
+            aMessage.Complete(KErrNone);
+            TRAP_IGNORE(server->QueueRequestBGAnimSessionsL(ptr, op);)
+            if (buf)
+                {
+                CleanupStack::PopAndDestroy();
+                }
+            break;    
+            }
+            
+            
         default:
             {
             aMessage.Complete(KErrNotSupported);
@@ -707,7 +942,7 @@
         {
         aMessage.Complete(KErrNone);
         }
-//    RDebug::Print(_L("CAlfStreamerServerSession::ServiceL exit"));
+    __ALFLOGSTRING("CAlfStreamerServerSession::ServiceL exit")
     }
 
 void CAlfStreamerServerSession::HandleCompositionOpL(TInt aOp, const RMessage2& aMessage, CAlfStreamerServer* aServer)
@@ -741,13 +976,12 @@
     case KAlfCompositionTargetHidden:
     case KAlfCompositionTargetVisible:
     case KAlfCompositionTargetCreated:
+    case KAlfCompositionLayoutSwitchComplete:
         {
         aServer->HandleCompositionEventL(this, aOp, aMessage);
         break;
         }
 
-    // temp, should go to window server to have more precise control on 
-    // operations    
     case KAlfCompOpCreateToken:
         {
         TInt token = aServer->CreatePermissionToken( aMessage, reinterpret_cast<TInt>(this), this );
@@ -767,12 +1001,21 @@
     case KAlfCompOpSetRotation: 
     case KAlfCompOpSetExtent:
     case KAlfCompOpEnableKb:
-    case KAlfComOpSetBackgroundAnim:
     case KAlfCompOpSessionClosed:
         {
         aServer->HandleCompositionRequestL(this, aOp, aMessage);
         break;
         }
+    case KAlfComOpSetBackgroundAnim:
+        {
+        TBool isBg(EFalse);
+        TPckg<TBool> ptr(isBg);
+        aMessage.Read(0,ptr);
+        iIsBgAnimSession = isBg;
+        aServer->HandleCompositionRequestL(this, aOp, aMessage);
+        break;
+        }
+
     case KAlfCompositionWServScreenNumber:
         {
         iScreenNumber  = aMessage.Int0();
@@ -796,7 +1039,7 @@
         }
     default:        
         // add debug guards or remove
-        RDebug::Print(_L("Oops, unknown composition command: %d "), aOp);
+        __ALFLOGSTRING1("Oops, unknown composition command: %d ", aOp)
         User::Invariant();
         }
     }
@@ -815,7 +1058,7 @@
             }
         else
             {
-            RDebug::Print(_L("CAlfStreamerServerSession::CompletedFromQueue err: %d"),err);
+            __ALFLOGSTRING1("CAlfStreamerServerSession::CompletedFromQueue err: %d",err)
             }
         if( !iMessagePtr.IsNull())
             {
--- a/uiacceltk/hitchcock/ServerCore/Src/alfwindow.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindow.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -26,6 +26,7 @@
 #include "alfwindowdata.h"
 
 #include <string.h>
+#include <s32mem.h>
 
 // ---------------------------------------------------------------------------
 // NewL
@@ -53,6 +54,8 @@
         delete iData->iInBuffer;
         delete iData->iOutBuffer;
         
+        iData->iWindowArea.Close();
+        
         delete iData;
         }
     }
@@ -493,6 +496,183 @@
         }
     }
 
+
+// ---------------------------------------------------------------------------
+// CreateSetWindowAreaL
+// ---------------------------------------------------------------------------
+//
+TAny* CAlfWindow::CreateSetWindowAreaL(
+        TInt& aOffset, TInt aScreenNumber, const TPoint& aOrigin, const TRegion& aRegion)
+    {
+    const TInt size = ( 4*aRegion.Count() + 4 ) * sizeof(TInt32);
+    TAny* data = (TAny*)iData->iWindowManager->Bridge()->AppendVarDataL( size, aOffset );
+
+    RMemWriteStream str( data, size );
+    str.WriteInt32L( aScreenNumber );
+    str.WriteInt32L( aOrigin.iX );
+    str.WriteInt32L( aOrigin.iY );
+    str.WriteInt32L( aRegion.Count() );
+        
+    for (TInt i = 0; i < aRegion.Count(); ++i )
+        {
+        const TRect rect(aRegion[i]);
+        str.WriteInt32L(rect.iTl.iX);
+        str.WriteInt32L(rect.iTl.iY);
+        str.WriteInt32L(rect.iBr.iX);
+        str.WriteInt32L(rect.iBr.iY);
+        }
+    
+    return data;
+    }
+
+// ---------------------------------------------------------------------------
+// SetWindowArea
+// ---------------------------------------------------------------------------
+//
+void CAlfWindow::SetWindowArea()
+    {
+    if ( iData->iWindowArea.Count() )
+        {
+        // Now inserted to scene - forward
+        SetWindowArea(iData->iWindowAreaOrigin, iData->iWindowArea);
+        iData->iWindowArea.Clear();
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SetWindowArea
+// ---------------------------------------------------------------------------
+//
+void CAlfWindow::SetWindowArea(const TPoint& aOrigin, const TRegion& aRegion)
+    {
+    if ( WsInfo().iNodeType != MWsWindowTreeNode::EWinTreeNodeClient )
+        {
+        return;
+        }
+        
+    if (!IsInsertedToScene())
+     	{
+     	// Cache data to be able to send once this is inserted to scene
+        iData->iWindowAreaOrigin = aOrigin;
+        iData->iWindowArea.Copy(aRegion);
+        if ( iData->iWindowArea.CheckError() )
+            {
+            iData->iWindowArea.Clear();
+            }
+     	return;
+     	}
+
+    TAlfWServInfo wservInfo = WsInfo();
+    TInt offset = 0;
+    TAny* data = NULL;
+    
+    TRAP_IGNORE(data = CreateSetWindowAreaL( offset, wservInfo.iScreenNumber, aOrigin, aRegion ));  
+    
+    if (data)
+        {
+        TAlfBridgerData d;
+        d.Set(EAlfDSSetWindowArea, 
+            wservInfo.iRefId.iWindowGroupId, 
+            wservInfo.iRefId.iWindowIdentifer, 
+            (TAny*)offset); 
+
+        iData->iWindowManager->PostIt(d);
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// SetTransparencyAlphaChannel
+// ---------------------------------------------------------------------------
+//
+void CAlfWindow::SetTransparencyAlphaChannel(TBool aActive)
+    {
+    if ( WsInfo().iNodeType != MWsWindowTreeNode::EWinTreeNodeClient )
+        {
+        return;
+        }
+
+    if (!IsInsertedToScene())
+        {
+        iData->iTransparencyAlphaChannel = aActive;
+        return;        
+        }
+        
+    TAlfWServInfo wservInfo = WsInfo();
+
+    TInt offset;
+    TAlfWindowAttributes* windowAttributes = CreateWindowAttributes(offset);
+    if ( windowAttributes )
+        {
+        windowAttributes->iActive = aActive; 
+        windowAttributes->iScreenNumber = wservInfo.iScreenNumber;
+        
+        TAlfBridgerData d;
+        d.Set(EAlfDSSetTransparencyAlphaChannel, 
+            wservInfo.iRefId.iWindowGroupId, 
+            wservInfo.iRefId.iWindowIdentifer, 
+            (TAny*)offset); 
+
+        if (iData->iWindowManager->PostIt(d))
+            {
+            iData->iTransparencyAlphaChannel = aActive;
+            }
+        }
+    }
+
+// ---------------------------------------------------------------------------
+// TransparencyAlphaChannel
+// ---------------------------------------------------------------------------
+//
+TBool CAlfWindow::TransparencyAlphaChannel() const
+    {
+    return iData->iTransparencyAlphaChannel;
+    }
+
+// ---------------------------------------------------------------------------
+// IsIncludedToVisibilityCalculation
+// ---------------------------------------------------------------------------
+//
+TBool CAlfWindow::IsIncludedToVisibilityCalculation() const
+    {
+    return iData->iIncludeToVisibilityCalculation;
+    }
+
+// ---------------------------------------------------------------------------
+// IncludeToVisibilityCalculation
+// ---------------------------------------------------------------------------
+//
+void CAlfWindow::IncludeToVisibilityCalculation(TBool aActive)
+    {
+    if (!IsInsertedToScene())
+        {
+        iData->iIncludeToVisibilityCalculation = aActive;
+        return;
+        }
+
+    TAlfWServInfo wservInfo = WsInfo();
+
+    TInt offset;
+    TAlfWindowAttributes* windowAttributes = CreateWindowAttributes(offset);
+    if ( windowAttributes )
+        {
+        windowAttributes->iActive = aActive; 
+        windowAttributes->iScreenNumber = wservInfo.iScreenNumber;
+        windowAttributes->iWindowNodeType = wservInfo.iNodeType; 
+        
+        TAlfBridgerData d;
+        d.Set(EAlfDSIncludeToVisibilityCalculation, 
+            wservInfo.iRefId.iWindowGroupId, 
+            wservInfo.iRefId.iWindowIdentifer, 
+            (TAny*)offset); 
+
+        if (iData->iWindowManager->PostIt(d))
+            {
+            iData->iIncludeToVisibilityCalculation = aActive;
+            }
+        }
+    }
+
+
 // ---------------------------------------------------------------------------
 // SetWsInfo
 // ---------------------------------------------------------------------------
@@ -522,8 +702,12 @@
     memset(iData, 0, sizeof(TAlfWindowData)); // initialize all values to zero
     iData->iWindowManager = &aOwner;
     iData->iIdentifier = aId;
-    iData->iIsActive = ETrue;
+    iData->iIsActive = EFalse;
     iData->iOpacity = 1.0f;    
+    iData->iWindowArea = RRegion();
+    iData->iTransparencyAlphaChannel = EFalse;
+    iData->iIncludeToVisibilityCalculation = EFalse;
+    
     SetSize(aSizeInPixels);
     }
     
--- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowfxplugin.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowfxplugin.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -101,3 +101,10 @@
         }
     return 0;
     }
+
+
+EXPORT_C void CAlfWindowFxPlugin::ClientAboutToExit(TThreadId)
+    {
+    }
+
+
--- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -208,7 +208,9 @@
         aWindow->SetOpacity(aWindow->Opacity());
         }
 	aWindow->SetSurfaceExtent(aWindow->SurfaceExtent());
-        
+    aWindow->SetWindowArea();
+    aWindow->SetTransparencyAlphaChannel(aWindow->TransparencyAlphaChannel());
+    aWindow->IncludeToVisibilityCalculation(aWindow->IsIncludedToVisibilityCalculation());
 	aWindow->SetActive(aWindow->IsActive());
 	}
 
@@ -679,3 +681,15 @@
     *windowCommandBuffer = empty;
     return windowCommandBuffer;
     }
+
+
+void CAlfWindowManager::HandleClientExit(TThreadId aThreadId)
+    {
+    for (TInt i = iData->iPlugins.Count()-1; i >= 0 ; i--)
+        { // assuming that plugins won't actually change the order on this message 
+          //(i.e. they may destroy them selves but not the plugine inserted before them)
+        iData->iPlugins[i].iPlugin->ClientAboutToExit(aThreadId);
+        } 
+    }
+
+
--- a/uiacceltk/hitchcock/ServerCore/eabi/alfappservercoreu.DEF	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/eabi/alfappservercoreu.DEF	Fri Apr 16 15:56:24 2010 +0300
@@ -547,4 +547,5 @@
 	_ZN18CAlfStreamerBridge15FindWgForAppUidE4TUid @ 546 NONAME
 	_ZN18CAlfStreamerBridge17FindAppUidForWgIdEi @ 547 NONAME
 	_ZN10CAlfWindow21SetLayerUsesAplhaFlagEi @ 548 NONAME
+	_ZN18CAlfWindowFxPlugin17ClientAboutToExitE9TThreadId @ 549 NONAME
 
--- a/uiacceltk/hitchcock/ServerStub/Proxy_src/AlfAppFwProxy.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerStub/Proxy_src/AlfAppFwProxy.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -164,7 +164,7 @@
                 if (!iBitmap)
                     {
                     iBitmap = new (ELeave) CFbsBitmap();
-                    User::LeaveIfError( iBitmap->Create(skinRect.Size(), EColor64K) ); // is 64k still valid?        
+                    User::LeaveIfError( iBitmap->Create(skinRect.Size(), EColor16MAP) );         
                     }
                 
                 User::LeaveIfError(iBitmap->Resize(skinRect.Size()));
@@ -323,7 +323,7 @@
     void UpdateWgListL()
         {
         TInt wgId=0;
-        const TInt count=iWsSession.NumWindowGroups();
+        TInt count=iWsSession.NumWindowGroups();
         if (count)
             {
             TInt* ptr = iWgIdArray;    
@@ -333,6 +333,8 @@
             CApaWindowGroupName* wgName=CApaWindowGroupName::NewL(iWsSession);
             CleanupStack::PushL(wgName);
             User::LeaveIfError(iWsSession.WindowGroupList(wgIdArray)); // all groups
+            count = wgIdArray->Count(); // count might have changed
+            
             iWgEntriesWritten = 0;
             for (TInt ii=0; ii < count-1; ii++)
                 { 
--- a/uiacceltk/hitchcock/backgroundanim/group/bganimhost.mmp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/group/bganimhost.mmp	Fri Apr 16 15:56:24 2010 +0300
@@ -23,6 +23,7 @@
 TARGET                  backgroundanimhost.exe
 TARGETTYPE              exe
 EPOCPROCESSPRIORITY     realtimeserver
+EPOCHEAPSIZE            0x100000 0x800000
 
 ALWAYS_BUILD_AS_ARM
 OPTION ARMCC            -O3 -Otime --cpu 6 --fpmode fast
@@ -51,7 +52,9 @@
 SOURCE                  bganimhost.cpp
 SOURCE                  highrestimer.cpp 
 SOURCE                  themerepositorylistener.cpp
+#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 SOURCE                  screensaverpropertylistener.cpp
+#endif
 SOURCE                  sensor.cpp
 
 STATICLIBRARY           libcrt0.lib
--- a/uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h	Fri Apr 16 15:56:24 2010 +0300
@@ -18,7 +18,7 @@
 #include <w32std.h>
 #include <apgwgnam.h> 
 #include <sensrvdatalistener.h>
-
+#include <AknsSrvClient.h>
 
 #include <EGL/egl.h>
 
@@ -30,7 +30,7 @@
 
 #include "../../../../uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionutility.h"
 
-class CBgAnimHost : public CBase, public MAlfCompositionObserver, public MSensrvDataListener
+class CBgAnimHost : public CBase, public MAlfCompositionObserver, public MSensrvDataListener, public MAknsSkinChangeObserver
     {
     public:
         void ConstructL();
@@ -52,7 +52,11 @@
         void DataError( CSensrvChannel& aChannel, TSensrvErrorSeverity aError );
         void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface);
         
-        
+        // from MAknsSkinChangeObserver
+        void SkinContentChanged();
+        void SkinConfigurationChanged( const TAknsSkinStatusConfigurationChangeReason aReason );
+        void SkinPackageChanged( const TAknsSkinStatusPackageChangeReason aReason );
+
     protected:
         void CreateWindowL();
         void DestroyWindow();
@@ -61,9 +65,12 @@
         void CreateWindowSurfaceL();
         void ReleaseWindowSurface(TBool aReleaseObserver = ETrue);
         void LoadPluginL();
+        void ReleasePlugin();
         void NewFrame();
         void HandleScreenSaverEvent();
+        TBool GetPluginConfigurationL();
         static TInt ScreenSaverCallback(TAny* aPtr);
+        
     private:
         // windowing stuff
         RWsSession iWsSession;
@@ -101,4 +108,7 @@
 
         RPointerArray<CSensorListener> iSensorListeners;
 
+        RAknsSrvSession iSkinSrv;
+        HBufC* iCurrentPluginDllName;
+        HBufC* iCurrentPluginAssetDir;
     };
--- a/uiacceltk/hitchcock/backgroundanim/inc/sensor.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/inc/sensor.h	Fri Apr 16 15:56:24 2010 +0300
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
 #ifndef __SENSOR_H__
 #define __SENSOR_H__
 
--- a/uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -16,7 +16,6 @@
 */
 #include <stdio.h>
 #include <stdlib.h>
-#include <AknsSrvClient.h>
 #include <AknsSrvChunkLookup.h>
 #include <AknsConstants.h>
 #include <AknsItemDef.h>
@@ -38,6 +37,9 @@
     
 CBgAnimHost::~CBgAnimHost() 
     {
+    iSkinSrv.Close();
+    delete iCurrentPluginDllName;
+    delete iCurrentPluginAssetDir;
     delete iTimer;
     if (iPlugin)
         {
@@ -45,7 +47,9 @@
         free(iPlugin);
         }
     iPluginLibrary.Close();
+#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS)
     delete iSCPropertyListener;
+#endif
     delete iThemeRepositoryListener;
     while (iSensorListeners.Count())
         {
@@ -79,18 +83,24 @@
     CActiveScheduler::Install(ac);
     iTimer = CHighResTimer::NewL(TCallBack(TimerFunc, this),CActive::EPriorityStandard);
     iThemeRepositoryListener = CThemeRepositoryListener::NewL(&iRunning);
+#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS)
     iSCPropertyListener = CScreenSaverPropertyListener::NewL(TCallBack(ScreenSaverCallback, this));
+#endif
     
     CreateWindowL();
 
+    User::LeaveIfError(iSkinSrv.Connect());
     // load the initial plugin
+    GetPluginConfigurationL();
     LoadPluginL();
     InitEGLL();
     CreateWindowSurfaceL();
     
     User::LeaveIfError(iPlugin->gpuresourcesavailable(1));
     iThemeRepositoryListener->IssueRequest();
+#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS)    
     iSCPropertyListener->IssueRequest();
+#endif
     }
     
 void CBgAnimHost::CreateWindowL()
@@ -185,7 +195,7 @@
         
         iSurfaceInitialized = EFalse;
         
-        if (aReleaseObserver)
+        if (aReleaseObserver && iCompSource)
             {
             iCompSource->RemoveObserver(*this);
             delete iCompSource;
@@ -385,42 +395,68 @@
             }
         else
             {
-            User::After(5000000);
+            User::After(1000000);
             }
         }
 
     iSurfaceInitialized = ETrue;
     
     }
-    
-void CBgAnimHost::LoadPluginL()
+
+TBool CBgAnimHost::GetPluginConfigurationL()
     {
     // dig out the skin config from skin server
     HBufC* configstr = NULL;
-    RAknsSrvSession skinsrv;
-    User::LeaveIfError(skinsrv.Connect());
-    CleanupClosePushL(skinsrv);
-    CAknsSrvChunkLookup* cl = skinsrv.CreateChunkLookupL();
+    CAknsSrvChunkLookup* cl = iSkinSrv.CreateChunkLookupL();
     CleanupStack::PushL(cl);
     CAknsStringItemDef* configitem = static_cast<CAknsStringItemDef*>(cl->LookupAndCreateDefL( KAknsIIDPropertyAnimBgParam )); 
     User::LeaveIfNull(configitem);
     CleanupStack::PushL(configitem);
     configstr = configitem->String().AllocL();
-    CleanupStack::PopAndDestroy(3); // skinsrv, cl, configitem
+    CleanupStack::PopAndDestroy(2); // cl, configitem
     CleanupStack::PushL(configstr);
-    RDebug::Print(_L("----------------------"));
-    RDebug::Print(_L("backgroundhost config:"));
-    RDebug::Print(*configstr);
-    RDebug::Print(_L("----------------------"));
     
     TLex lex(*configstr);
-    TPtrC dllname = lex.NextToken();
-    if (!dllname.Length())
+    HBufC* dllname = lex.NextToken().AllocL();
+    CleanupStack::PushL(dllname);
+    if (!dllname || !dllname->Length())
+        {
+        User::Leave(KErrNotFound);
+        }
+
+    HBufC* assetdir = lex.NextToken().AllocL();
+    CleanupStack::PushL(assetdir);
+    if (!assetdir || !assetdir->Length())
         {
         User::Leave(KErrNotFound);
         }
     
-    User::LeaveIfError(iPluginLibrary.Load(dllname));
+    TBool confchanged = EFalse;
+    if (!iCurrentPluginDllName || !iCurrentPluginAssetDir || 
+        (iCurrentPluginDllName && !iCurrentPluginDllName->CompareF(*dllname)) ||
+        (iCurrentPluginAssetDir && !iCurrentPluginAssetDir->CompareF(*assetdir)) )
+        
+        {
+        confchanged = ETrue;
+        delete iCurrentPluginDllName;
+        delete iCurrentPluginAssetDir;
+        iCurrentPluginDllName = dllname;    
+        iCurrentPluginAssetDir = assetdir;
+        CleanupStack::Pop(2); // dllname, assetdir
+        }
+    else
+        {
+        CleanupStack::PopAndDestroy(2); // dllname, assetdir
+        }
+        
+    CleanupStack::PopAndDestroy(); // configstr
+    
+    return confchanged;
+    }
+    
+void CBgAnimHost::LoadPluginL()
+    {
+    User::LeaveIfError(iPluginLibrary.Load(*iCurrentPluginDllName));
     plugingetinterfacefunc getif = (plugingetinterfacefunc)iPluginLibrary.Lookup(1);
     if (!getif)
         {
@@ -430,23 +466,10 @@
     
     iPlugin = (plugin_export_v1_t*) getif(1);
 
-    TPtrC configpath = lex.NextToken();
-    if (!configpath.Length())
-        {
-        User::Leave(KErrNotFound);
-        }
     TBuf8<256> pluginpath;
-    pluginpath.Copy(configpath);
+    pluginpath.Copy(*iCurrentPluginAssetDir);
     User::LeaveIfError(iPlugin->initialize((const char*)pluginpath.PtrZ(), KMaxGPUMemUsage));
-
-//        }
-//    else
-//        {
-//        User::LeaveIfError(iPlugin->initialize("z:\\private\\200286D3", KMaxGPUMemUsage));
-//        }
-
-    CleanupStack::PopAndDestroy(); // configstr
-    
+   
     iPlugin->setdisplaydimensions(iDisplaySize.iWidth, iDisplaySize.iHeight);
     if (iPlugin->desiredsensors && iPlugin->receivesensordata)
         {
@@ -463,6 +486,24 @@
         }
     }
     
+void CBgAnimHost::ReleasePlugin()
+    {
+    if (iPlugin)
+        {
+        while (iSensorListeners.Count())
+            {
+            delete iSensorListeners[0];
+            iSensorListeners.Remove(0);
+            }
+            
+        iPlugin->gpuresourcesavailable(0);
+        iPlugin->destroy();
+        free(iPlugin);
+        iPlugin = NULL;
+        iPluginLibrary.Close();
+        }
+    }
+    
 void CBgAnimHost::NewFrame()
     {
     if (!iRunning)
@@ -506,6 +547,12 @@
     iTimer->CallBack(100);
     iTimerRunning = ETrue;
     iRunning = ETrue;
+    // we only want to receive skin change messages
+    // after we have been properly initialized
+    // and running, close the session without observer
+    // and re-open with observer
+    iSkinSrv.Close();
+    User::LeaveIfError(iSkinSrv.Connect(this));
     CActiveScheduler::Start();
     }
 
@@ -535,7 +582,6 @@
         return;
         }
 
-    RDebug::Print(_L("!!! - HIDDEN - !!!"));
     // release gpu resources...
     iTimer->Cancel();
     iTimerRunning = EFalse;
@@ -552,8 +598,6 @@
         return;
         }
 
-    RDebug::Print(_L("!!! - VISIBLE - !!!"));
-
     if (!iSurfaceInitialized && iCompSource)
         {
         iCompSource->RemoveObserver(*this);
@@ -573,17 +617,13 @@
 
 void CBgAnimHost::HandleScreenSaverEvent()
     {
-    RDebug::Print(_L("-----------------------------------"));
-    RDebug::Print(_L("CBgAnimHost::HandleScreenSaverEvent"));
+#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS)
     TInt scStatus = iSCPropertyListener->GetScreenSaverStatus();
-    RDebug::Print(_L("status: %d, timerrunning %d, surfacecreated %d"),scStatus, iTimerRunning, iSurfaceInitialized);
-    RDebug::Print(_L("-----------------------------------"));
     if (scStatus)
         {
         // screensaver is ON
         if (iTimerRunning)
             {
-            RDebug::Print(_L("--- screensaver on, stopping timer ---"));
             iTimer->Cancel();
             iTimerRunning = EFalse;
             }
@@ -593,12 +633,11 @@
         // screensaver is OFF
         if (!iTimerRunning && iSurfaceInitialized)
             {
-            RDebug::Print(_L("--- screensaver off, starting timer ---"));
-    
             iTimerRunning = ETrue;
             iTimer->CallBack(1);
             }
         }
+#endif
     }
 
 TInt CBgAnimHost::ScreenSaverCallback(TAny* aPtr)
@@ -623,3 +662,34 @@
 void CBgAnimHost::GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface)
     {
     }
+
+void CBgAnimHost::SkinContentChanged()
+    {
+    }
+
+void CBgAnimHost::SkinConfigurationChanged( const TAknsSkinStatusConfigurationChangeReason aReason )
+    {
+    if (aReason == EAknsSkinStatusConfigurationDeployed && iPlugin)
+        {
+        // okay, the skin has changed, let's check that should we load a different
+        // animation plugin
+        TBool changed = EFalse;
+        TRAPD(err, changed = GetPluginConfigurationL());
+        if (err || !changed)
+            {
+            // plugin configuration has not changed, or there is not animation
+            // in the theme, just return
+            return;
+            }
+
+        CompositionTargetHidden();
+        ReleasePlugin();
+                
+        TRAP_IGNORE(LoadPluginL());
+        CompositionTargetVisible();
+        }
+    }
+
+void CBgAnimHost::SkinPackageChanged( const TAknsSkinStatusPackageChangeReason /*aReason*/ )
+    {
+    }
--- a/uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -39,9 +39,9 @@
 	    {
 	    wait = 1000;
 	    }
-	if (wait > 15000)
+	if (wait > 100000)
 	    {
-	    wait = 15000;
+	    wait = 100000;
 	    }
             
     HighRes( TTimeIntervalMicroSeconds32( wait ) );
--- a/uiacceltk/hitchcock/backgroundanim/src/screensaverpropertylistener.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/src/screensaverpropertylistener.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -37,7 +37,6 @@
     CleanupStack::PushL(me);
     me->ConstructL();
     CleanupStack::Pop();
-    RDebug::Print(_L("screensaverlistener constructed"));
     return me;
     }
 
@@ -48,7 +47,6 @@
 
 void CScreenSaverPropertyListener::RunL()
     {
-    RDebug::Print(_L("screensaverlistener - runl"));
     if (iStatus.Int() != KErrCancel)
         {
         IssueRequest();
@@ -64,7 +62,6 @@
 
 void CScreenSaverPropertyListener::IssueRequest()
     {
-    RDebug::Print(_L("screensaverlistener issuereq"));
     iSCProperty.Subscribe(iStatus);
     SetActive();
     }
--- a/uiacceltk/hitchcock/backgroundanim/src/sensor.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/backgroundanim/src/sensor.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
 #include <sensrvaccelerometersensor.h>
 
 #include "sensor.h"
--- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Fri Apr 16 15:56:24 2010 +0300
@@ -1585,4 +1585,14 @@
 	?SkinPackageChanged@CHuiS60Skin@@UAEXW4TAknsSkinStatusPackageChangeReason@@@Z @ 1584 NONAME ; void CHuiS60Skin::SkinPackageChanged(enum TAknsSkinStatusPackageChangeReason)
 	?SkinConfigurationChanged@CHuiS60Skin@@UAEXW4TAknsSkinStatusConfigurationChangeReason@@@Z @ 1585 NONAME ; void CHuiS60Skin::SkinConfigurationChanged(enum TAknsSkinStatusConfigurationChangeReason)
 	?Synchronize@CHuiEnv@@QAEXHPAVMHuiSynchronizationObserver@@@Z @ 1586 NONAME ; void CHuiEnv::Synchronize(int, class MHuiSynchronizationObserver *)
+	?SetForegroundTextureOptions@CHuiDisplay@@QAEXH@Z @ 1587 NONAME ; void CHuiDisplay::SetForegroundTextureOptions(int)
+	?ShapeOrigin@CHuiCanvasVisual@@QBE?AVTPoint@@XZ @ 1588 NONAME ; class TPoint CHuiCanvasVisual::ShapeOrigin(void) const
+	?HasCustomShape@CHuiCanvasVisual@@QBEHXZ @ 1589 NONAME ; int CHuiCanvasVisual::HasCustomShape(void) const
+	?ShapeRegion@CHuiCanvasVisual@@QBEABVTRegion@@XZ @ 1590 NONAME ; class TRegion const & CHuiCanvasVisual::ShapeRegion(void) const
+	?SetShape@CHuiCanvasVisual@@QAEXABVTPoint@@ABVTRegion@@@Z @ 1591 NONAME ; void CHuiCanvasVisual::SetShape(class TPoint const &, class TRegion const &)
+	?CommandBufferCoverage@CHuiCanvasVisual@@QAE?AVTRect@@H@Z @ 1592 NONAME ; class TRect CHuiCanvasVisual::CommandBufferCoverage(int)
+	?CopyScreenToBitmapL@CHuiDisplay@@QAEXPAVCFbsBitmap@@@Z @ 1593 NONAME ; void CHuiDisplay::CopyScreenToBitmapL(class CFbsBitmap *)
+	?SecureId@CHuiControlGroup@@QAEHXZ @ 1594 NONAME ; int CHuiControlGroup::SecureId(void)
+	?SetSecureId@CHuiControlGroup@@QAEXH@Z @ 1595 NONAME ; void CHuiControlGroup::SetSecureId(int)
+	?HasTransParentClear@CHuiCanvasVisual@@QBEHXZ @ 1596 NONAME ; int CHuiCanvasVisual::HasTransParentClear(void) const
 
--- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Fri Apr 16 15:56:24 2010 +0300
@@ -1986,4 +1986,14 @@
 	_ZThn28_N11CHuiS60Skin18SkinPackageChangedE34TAknsSkinStatusPackageChangeReason @ 1985 NONAME
 	_ZThn28_N11CHuiS60Skin24SkinConfigurationChangedE40TAknsSkinStatusConfigurationChangeReason @ 1986 NONAME
 	_ZN7CHuiEnv11SynchronizeEiP27MHuiSynchronizationObserver @ 1987 NONAME
+	_ZN11CHuiDisplay27SetForegroundTextureOptionsEi @ 1988 NONAME
+	_ZN16CHuiCanvasVisual8SetShapeERK6TPointRK7TRegion @ 1989 NONAME
+	_ZNK16CHuiCanvasVisual11ShapeOriginEv @ 1990 NONAME
+	_ZNK16CHuiCanvasVisual11ShapeRegionEv @ 1991 NONAME
+	_ZNK16CHuiCanvasVisual14HasCustomShapeEv @ 1992 NONAME
+	_ZN16CHuiCanvasVisual21CommandBufferCoverageEi @ 1993 NONAME
+	_ZN11CHuiDisplay19CopyScreenToBitmapLEP10CFbsBitmap @ 1994 NONAME
+	_ZN16CHuiControlGroup11SetSecureIdEi @ 1995 NONAME
+	_ZN16CHuiControlGroup8SecureIdEv @ 1996 NONAME
+	_ZNK16CHuiCanvasVisual19HasTransParentClearEv @ 1997 NONAME
 
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h	Fri Apr 16 15:56:24 2010 +0300
@@ -40,6 +40,7 @@
     virtual void ParsingEndedBefore()=0;
     virtual void ParsingEndedAfter(MHuiFxEffectCacheNode *aCached)=0;
     virtual TBool FxmlUsesInput1()=0;
+    virtual void Delete()=0;
 };
 
 class CHuiFxEffectCache : public CBase, public MHuiFxParsingEndedObserver
@@ -103,6 +104,7 @@
      void ParsingEndedBefore();
      void ParsingEndedAfter(MHuiFxEffectCacheNode *aCached);
      TBool FxmlUsesInput1();
+     void Delete();
 
 private:
      const TDesC *iFileName;
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h	Fri Apr 16 15:56:24 2010 +0300
@@ -28,6 +28,7 @@
 #include "uiacceltk/HuiRealPoint.h"
 #include "uiacceltk/HuiRealPoint.h"
 #include "uiacceltk/HuiGc.h"
+#include "uiacceltk/huilowmemoryobserver.h"
 #include "huieffectable.h"
 
 /* Forward declarations. */
@@ -53,7 +54,8 @@
  *
  * @see CHuiRoster
  */
-NONSHARABLE_CLASS(CHuiRosterImpl) : public CHuiRoster, MHuiEffectable
+NONSHARABLE_CLASS(CHuiRosterImpl) : public CHuiRoster, private MHuiEffectable, 
+        private MHuiMemoryLevelObserver
 	{
 public:
 
@@ -330,6 +332,10 @@
     void SetLoadingEffect(TBool aLoading);
     void EffectSetSource( TBool aIsInput1 );
     TBool EffectGetSource() const;	
+    
+    // From MHuiMemoryLevelObserver
+    void SetMemoryLevel(THuiMemoryLevel aLevel);
+    
 protected:
 
     /* Methods. */
@@ -451,6 +457,11 @@
      */
 	void DrawBoundaries( CHuiGc& aGc, CHuiVisual* aVisual, TBool aDrawOutline ) const;
 
+    /**
+     * Returns true if render buffer can be used for freeze.
+     */
+    TBool UseRenderBufferForFreeze() const;
+    
 private:
 
     /** Area occupied by the roster. */
@@ -498,6 +509,9 @@
     CHuiCanvasGc* iCanvasGc;
     CHuiCanvasRenderBuffer* iCanvasRenderBuffer;
     CHuiGc::TOrientation iCanvasRenderBufferOrientation;
+	
+	TBool iRosterIsFrozen;
+	TBool iMonitorMemoryLevel;
 	};
 
 #endif  // __HUIROSTERIMPL_H__
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h	Fri Apr 16 15:56:24 2010 +0300
@@ -49,6 +49,7 @@
     
     /** Flag to say wheter buffer really contains somethign that really draws something */
     EHuiCanvasBufferContainsDrawing = 0x8000,
+    EHuiCanvasBufferContainsTransparentClear = 0x10000,
     /** All flags, can be used for clearing all flags */
     EHuiCanvasBufferStatusAll = 0xFFFFFFFF
     };
@@ -294,6 +295,12 @@
     virtual CHuiCanvasGc& CanvasGc() const = 0;
     
     /**
+     * Clears capturing buffer area with completely transparent.
+     * @param aRect rect to clear.
+     */ 
+    virtual void ClearCapturingBufferArea(const TRect& aRect);
+    
+    /**
      * Sets canvas visual that this painter draws into
      */
     void SetVisual(CHuiCanvasVisual* aVisual);
@@ -353,6 +360,11 @@
      * Does this painter have command buffers older than given time.
      */
     TBool HasOldCommandBuffers(TInt aLifeTimeInMs);
+    
+    /**
+     * Returns the area covered by buffers in the given orientation
+     */
+    TRect CommandBufferCoverage(TInt aOrientation);
 
     TInt NumBuffers() const { return iCommandBuffers.Count(); }
     CHuiCanvasCommandBuffer *At(TInt aIndex) const { return iCommandBuffers[aIndex]; }
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvastexturecache.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvastexturecache.h	Fri Apr 16 15:56:24 2010 +0300
@@ -219,6 +219,9 @@
     // Combined image
     RArray<THuiCachedBitmap> iSubImages;
     TSize iImageSize; 
+    
+	// Used for identifying recycled bitmap handles
+    TInt64 iSerialNumber;
     };
 
 
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsbitgc.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsbitgc.h	Fri Apr 16 15:56:24 2010 +0300
@@ -65,6 +65,7 @@
     virtual void ClearCache();
     
     virtual TBool IsRenderBufferEnabled() const;
+	virtual void ClearCapturingBufferArea(const TRect& aRect);
 	
 };    
 #endif  // __HUICANVASWSBITGC_H__
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsgc.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsgc.h	Fri Apr 16 15:56:24 2010 +0300
@@ -156,7 +156,8 @@
     
     virtual TInt EnableRenderbuffer(TBool aEnable = ETrue) = 0;
     virtual THuiCanvasWsGcType Type() const = 0;
-    
+
+    virtual void ClearCapturingBufferArea(const TRect& aRect) = 0;
     	
     ~CHuiCanvasWsGc(){}         
     };
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h	Fri Apr 16 15:56:24 2010 +0300
@@ -140,6 +140,8 @@
     virtual TInt EnableRenderbuffer(TBool aEnable = ETrue);    
     virtual THuiCanvasWsGcType Type() const;
 
+    virtual void ClearCapturingBufferArea(const TRect& aRect);
+
     void BeginDrawL(TRect aDisplayRect,const CHuiCanvasVisual& aUser, TBool aIsCachePrepared, const TRegion& aUpdateRegion);
     void EndDrawL(const TRegion& aUpdateRegion, TBool aUpdateDisplay);
     void BeginScanL(TRect aDisplayRect,const CHuiCanvasVisual& aUser, TBool aIsCachePrepared, const TRegion& aUpdateRegion);
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h	Fri Apr 16 15:56:24 2010 +0300
@@ -158,6 +158,7 @@
      */
     virtual CHuiCanvasGc& CanvasGc() const;
     CHuiCanvasWsGc *CanvasWsGc() const { return iCanvasWsGc; }
+
 private:
 
     /**
@@ -281,6 +282,8 @@
     void WsUseFontL() ;
 	void WsSetShapeRegionL( TInt aIndex );
     
+    virtual void ClearCapturingBufferArea(const TRect& aRect);
+    
 private:
     
     /** Region which this painter updates with current command buffers */
@@ -319,6 +322,8 @@
     TRect iTestFullDisplayRect;
     #endif
 	
+	TRgb iBrushColor;
+	
 	// Stream read optimizations
     struct TStructBitBlitRect
         {
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsswgc.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsswgc.h	Fri Apr 16 15:56:24 2010 +0300
@@ -148,6 +148,8 @@
     virtual TInt EnableRenderbuffer(TBool aEnable = ETrue);
     virtual THuiCanvasWsGcType Type() const;
 
+    virtual void ClearCapturingBufferArea(const TRect& aRect);
+    
 protected:
     
     void DoBeginDrawL(TBool aIsCachePrepared);
--- a/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h	Fri Apr 16 15:56:24 2010 +0300
@@ -68,4 +68,19 @@
     TInt iResult;
     };
 
+// Uid for Copy Screen To Bitmap extension
+const TUid KHuiGcCopyScreenToBitmap = { 0x2002E67B };
+
+// Parameter structure for Copy Screen To Bitmap extension
+struct THuiGcCopyScreenToBitmapParams
+    {
+    // Input parameters
+    
+    CFbsBitmap* iBitmap;
+    
+    // Output parameters
+    
+    TInt iErrorCode;
+    };
+
 #endif // __HUIEXTENSION_H__
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h	Fri Apr 16 15:56:24 2010 +0300
@@ -39,6 +39,7 @@
 class MNVGIcon;
 class CNvgEngine;
 #endif
+class CFbsBitmap;
 
 /**
  * CHuiVg10Gc implements an OpenVG 1.0 version of the HUITK
@@ -433,6 +434,11 @@
 
     void SetQuality(THuiQuality aQuality);
     
+    /**
+     * From CHuiGc.
+     */
+    void GcExtension(const TUid& aExtensionUid, TAny** aExtensionParams);
+    
 private:
     /** 
      *  Synchronize a specific OpenVG matrix with the main matrix.
@@ -510,6 +516,12 @@
     void UsePaintPattern();
     void DiscardPaintPattern();
     
+    /**
+     * Copy screen to bitmap.
+     * @internal
+     */
+    TInt DoCopyScreenToBitmap(CFbsBitmap* aBitmap);
+    
 private:
     /** Matrix characteristics */
     enum TMatrixFlags
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -34,6 +34,8 @@
 #include "HuiRenderSurface.h"
 #include "../../CommonInc/uiacceltkdomaincrkeys.h"
 
+#include "huiextension.h"
+
 #include <e32math.h>
 #include <VG/vgu.h>
 #ifdef __NVG
@@ -1479,7 +1481,7 @@
     destinationRect.iBr.iX -= 0.5f;
     destinationRect.iBr.iY -= 0.5f;
     
-    VGfloat alpha = PenAlpha();
+    VGfloat alpha = PenAlpha()/255.0f;
     vgClearPath(iEllipsePath, VG_PATH_CAPABILITY_APPEND_TO);
     
     VGfloat cx = (destinationRect.iTl.iX + destinationRect.iBr.iX) / 2.f; 
@@ -2322,6 +2324,85 @@
         }
     }
 
+void CHuiVg10Gc::GcExtension(const TUid& aExtensionUid, TAny** aExtensionParams)
+    {
+    if ( aExtensionUid == KHuiGcCopyScreenToBitmap && aExtensionParams && *aExtensionParams)
+        {
+        THuiGcCopyScreenToBitmapParams* params = static_cast<THuiGcCopyScreenToBitmapParams*>(*aExtensionParams);
+        params->iErrorCode = DoCopyScreenToBitmap(params->iBitmap);
+        }
+    else
+        {
+        CHuiGc::GcExtension(aExtensionUid, aExtensionParams);
+        }
+    }
+
+TInt CHuiVg10Gc::DoCopyScreenToBitmap(CFbsBitmap* aBitmap)
+    {
+    if (!aBitmap || 
+        !aBitmap->Handle() || 
+        aBitmap->IsCompressedInRAM() || 
+        aBitmap->ExtendedBitmapType() != KNullUid )
+        {
+        return KErrNotSupported;
+        }
+
+    VGImageFormat dataFormat = VG_sARGB_8888_PRE;
+    TBool displayModeSupported = ETrue;    
+    switch (aBitmap->DisplayMode())
+        {
+    case EColor16MAP:
+        dataFormat = VG_sARGB_8888_PRE;
+        break;
+    case EColor64K:
+        dataFormat = VG_sRGB_565;
+        break;
+    case EColor16MU:
+        dataFormat = VG_sXRGB_8888;
+        break;
+    case EColor16MA:
+        dataFormat = VG_sARGB_8888;
+        break;
+
+    default:
+        displayModeSupported = EFalse;
+        break;
+        }
+    
+    if (!displayModeSupported)
+        {
+        return KErrNotSupported;
+        }
+        
+    TRect copyRect(aBitmap->SizeInPixels());
+    if (copyRect.IsEmpty())
+        {
+        return KErrArgument;
+        }
+    
+    TInt dataStride = CFbsBitmap::ScanLineLength(copyRect.Width(), 
+        aBitmap->DisplayMode());
+
+    aBitmap->BeginDataAccess();
+    TUint8* data = (TUint8*)aBitmap->DataAddress();
+    
+    // image is upside down..
+    data += (copyRect.Height() - 1)*dataStride;
+    dataStride = -dataStride;
+    
+    vgReadPixels(
+        data,
+        dataStride,
+        dataFormat,
+        0,                // sx
+        0,                // sy
+        copyRect.Width(), // width
+        copyRect.Height() // height
+        );
+    
+    aBitmap->EndDataAccess(EFalse);
+    return KErrNone;
+    }
 
 // End of file
 
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -1335,6 +1335,10 @@
     // Render the NVGtexture into the image buffer. No transformations are done for this.
     SetNvgParamsFromIconHeader(*aNvgEngine, aNVGData);
     
+    // Always set blending mode to SRC_OVER before drawing NVG content (so that the  
+    // drawn icons would show correctly, and no issues with transparency would arise)
+    VGint blendMode = vgGeti(VG_BLEND_MODE);
+    vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
     if (iIconCommands)
         {
         //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing iIconCommands"));
@@ -1344,10 +1348,7 @@
         {
         // If ObjectCached version failed, try to use the old way
         //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing with DrawNvg"));
-        VGint blendMode = vgGeti(VG_BLEND_MODE);
-        vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER);
         aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), aDestSize, NULL, NULL);
-        vgSeti(VG_BLEND_MODE, blendMode);
         }
     
     // NVG-TLV icon margin special case check:
@@ -1366,7 +1367,12 @@
                 aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), size, NULL, NULL);
             }
         }
+
+    // restore the old surface before restoring original modes
+    oldSurface->MakeCurrent();  // This will also call the SetCurrentRenderSurface
     
+    // Return the original blend mode
+    vgSeti(VG_BLEND_MODE, blendMode);
     // The NVG draw messes up the paint, scissoring & rects, so mark them as dirty
     TInt dirtyFlags = EHuiVg10GcStateFlagDirtyPaint |
                     EHuiVg10GcStateFlagDirtyScissor | 
@@ -1387,7 +1393,6 @@
     
     vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE);
     vgLoadMatrix(matrix);
-    oldSurface->MakeCurrent();  // This will also call the SetCurrentRenderSurface
     
     // Now we should have a rendered image in the image variable!
     // Release the surface, but not the context because we used a shared context
@@ -1512,18 +1517,20 @@
 TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext)
     {
     HUI_VG_INVARIANT();
-    #ifdef __WINSCW__
-        if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE )
-           {
-           HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError());
-           return aSize;
-           }
-    #endif      
-#ifndef __WINS__ // Should possibly query the supported mode instead?
+
+#ifndef __WINSCW__  // Should possibly query the supported mode instead?
     VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE;
 #else
     // This doesn't work in the Emulator anyways.. => remove?
     VGImageFormat imageInternalFormat = VG_sARGB_8888;
+    
+    // If the icon is also a current EGL surface, the getImageSubData
+    // won't succeed and return "image in use" -error..
+    if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE )
+        {
+        HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError());
+        return aSize;
+        }
 #endif
     
     TInt stride = aSize.iWidth * 4; // VG_sARGB_8888(_PRE) is four bytes long (8888)
@@ -1567,14 +1574,16 @@
         }
     delete buf;
     HUI_VG_INVARIANT();
-    #ifdef __WINSCW__    
+    
+#ifdef __WINSCW__    
     // Make the PBuffer surface current again 
-     if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE )
-         {
-         HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError());
-         return aSize;
-         }
-    #endif     
+    if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE )
+        {
+        HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError());
+        return aSize;
+        }
+#endif
+    
     // If icon size has to be changed, clear out old area for new DrawNVG round!
     if(aSize.iHeight > HaN)
         {
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/huivg10canvasgc.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/huivg10canvasgc.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -144,8 +144,10 @@
     // Acquire background texture
     const CHuiTexture* backgroundTexture = NULL;
     TInt err = CHuiStatic::Env().Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture);
-    ASSERT(backgroundTexture!=NULL);
-    __ASSERT_ALWAYS(err == KErrNone, User::Invariant());
+    if(err)
+        {
+        return;
+        }
 
     // Apply background texture
     THuiImage background(*backgroundTexture);
@@ -197,12 +199,13 @@
                 iGc->PopClip();
                 break;
             case CHuiDisplay::EClearWithSkinBackground:
-                 TRect skinRect;
-                 TRect dummy;
-                 GetRectForItem(item.SkinBackground(), dummy, skinRect);
                  backgroundTexture = s60skin->BackgroundTexture(item.SkinBackground());
                  if (backgroundTexture)
                     {
+                    TRect skinRect;
+                    TRect dummy;
+                    GetRectForItem(item.SkinBackground(), dummy, skinRect);
+
                     THuiImage background(*backgroundTexture);
 
                     TPoint screenOrigin(0, 0);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -771,19 +771,21 @@
     else
         {
         // First clear
-        TRgb clearColor(KRgbBlack);
-        clearColor.SetAlpha(0);
-        iTempBitmapGc->SetPenColor(clearColor);
-        iTempBitmapGc->SetBrushColor(clearColor);
+        TRgb clearColor;
         if (iTempBitmap->DisplayMode() == EColor16MA)
             {
+            clearColor = aTextImage.iGcParams.iPenColor;
             iTempBitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
             }
         else
             {
+            clearColor = KRgbBlack;
             iTempBitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
             }
-                            	    
+
+        clearColor.SetAlpha(0);
+        iTempBitmapGc->SetPenColor(clearColor);
+        iTempBitmapGc->SetBrushColor(clearColor);                            	    
 	    iTempBitmapGc->Clear();                  
 
         // Set correct gc settings
@@ -1228,19 +1230,20 @@
     touchCountChanged |= volatileBitmapOrMask;
     touchCountChanged |= (aImage.iBitmapTouchCount != bitmapTouchCount);
     touchCountChanged |= (aImage.iMaskTouchCount != maskTouchCount);
-
+    TBool serialNumberChanged = (aImage.iSerialNumber != bitmap->SerialNumber());
+    
     // Is touch count check enabled ?
     TBool touchCountCheckEnabled = CHuiStatic::Env().CanvasTextureCache().IsTouchCountCheckEnabled();
     
     // Has it old content at all ?
     TBool hasContent = aImage.iTexture->HasContent();
     
-    if (!hasContent || (touchCountCheckEnabled && touchCountChanged))
+    if (!hasContent || (touchCountCheckEnabled && touchCountChanged) || serialNumberChanged)
         {
         // Upload bitmap content...this may be slow depending on used HW acceleration !
         if (bitmap->SizeInPixels().iWidth > 0 && 
             bitmap->SizeInPixels().iHeight > 0 &&
-            (!mask || (mask->SizeInPixels().iWidth > 0 && mask->SizeInPixels().iHeight)))
+            (!mask || (mask->SizeInPixels().iWidth > 0 && mask->SizeInPixels().iHeight > 0)))
             {
             // EHuiTextureUploadFlagDoNotRetainResolution should be removed when 
             // texturecoordinates with segmented textures work.
@@ -1255,6 +1258,9 @@
             CHuiTexture* texture = aImage.iTexture;
             texture->UploadL(*bitmap, mask, uploadFlags);
 
+            // Save the bitmap's serial number to the cached item
+            aImage.iSerialNumber = bitmap->SerialNumber();
+
 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
             TTime endTime;
             endTime.UniversalTime();
@@ -1274,6 +1280,11 @@
                 {
                 RDebug::Print(_L(">>> CHuiCanvasGraphicImageRasterizer::UpdateCachedImageL: Reason for uploading is iMaskTouchCount %i, old was %i "), maskTouchCount, aImage.iMaskTouchCount);                     
                 }
+            
+            if (serialNumberChanged)
+                {
+                RDebug::Print(_L(">>> CHuiCanvasGraphicImageRasterizer::UpdateCachedImageL: Reason for uploading is changed bitmap serial number %li, old was %li "), bitmap->SerialNumber(), aImage.iSerialNumber);
+                }
 
             RDebug::Print(_L(">>> CHuiCanvasGraphicImageRasterizer::UpdateCachedImageL: Upload of %ix%i %i+%i took %i ms"), 
                 texture->Size().iWidth, 
@@ -1921,7 +1932,18 @@
         {
         // For PC-lint
         }
-
+    if (aFirst.iTextBoxMaxSize.iHeight < aSecond.iTextBoxMaxSize.iHeight)
+           {
+           return -1; // less than
+           }
+       else if (aFirst.iTextBoxMaxSize.iHeight > aSecond.iTextBoxMaxSize.iHeight)
+           {
+           return 1; // more than  
+           }
+       else
+           {
+           // For PC-lint
+           }
     // Text content
     TInt textcompare = KErrNotFound;
     if ( aFirst.iFindTextPtr )
@@ -2077,7 +2099,7 @@
 //
 CHuiCanvasTextureCache::CHuiCanvasTextureCache()
     {
-    EnableLowMemoryState(EFalse);
+    SetMemoryLevel(EHuiMemoryLevelNormal);
     CHuiStatic::Env().AddLowMemoryObserver(this);
     }
 
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -77,6 +77,9 @@
     // For handling possible background surface that window may have
     TBool iLayerUsesAlphaFlag;
     TRect iLayerExtent;
+
+    RRegionBuf<5> iShapeRegion;
+    TPoint iShapeOrigin;
     };
 
 EXPORT_C CHuiCanvasVisual* CHuiCanvasVisual::AddNewL(CHuiControl& aOwnerControl,
@@ -120,6 +123,8 @@
     iCanvasVisualData->iLayerUsesAlphaFlag = EFalse;
     iCanvasVisualData->iLayerExtent = TRect();
     
+    iCanvasVisualData->iShapeOrigin = TPoint();
+    
     // subwindow effects
     //EnableBrushesL(ETrue);
     }
@@ -166,6 +171,7 @@
         iCanvasVisualData->iPaintedRegion.Close();
         iCanvasVisualData->iClipRegion.Close();
         iCanvasVisualData->iChildCanvasList.Close();
+        iCanvasVisualData->iShapeRegion.Close();
         }
     
     delete iCanvasVisualData;
@@ -314,27 +320,37 @@
     
 TBool CHuiCanvasVisual::CanSkipDrawing() const
     {
-    TBool semiTranparentEffectActive = (Effect() && Effect()->IsSemitransparent());
-    TBool childWindowEffectActive = (Effect() && EffectIsAppliedToChildren());
-    TBool invisible = (iOpacity.Now() <= EPSILON && !semiTranparentEffectActive);
-    TBool effectAppliedToSurfacePixels = (Effect() && (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers));
-    
-    if( invisible || 
-        (!HasCommandBuffers(ETrue /*include children*/) && 
-         !childWindowEffectActive &&
-         !IsBackgroundDrawingEnabled() && 
-         !IsExternalContentDrawingEnabled()&&
-         !IsExternalContentDrawingEnabled(ETrue /*include children*/) &&
-         !effectAppliedToSurfacePixels
-         
-        ))
+    if (Effect())
         {
-        return ETrue;
+        TBool semiTranparentEffectActive = Effect()->IsSemitransparent();
+        if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive))
+            {
+            return ETrue;
+            }
+        TBool childWindowEffectActive = EffectIsAppliedToChildren();
+        TBool effectAppliedToSurfacePixels = (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers);
+        if( !childWindowEffectActive &&
+            !effectAppliedToSurfacePixels &&
+            !HasCommandBuffers(ETrue /*include children*/) && 
+            !IsBackgroundDrawingEnabled() &&
+            !IsExternalContentDrawingEnabled()&&
+            !IsExternalContentDrawingEnabled(ETrue /*include children*/))
+            {
+            return ETrue;
+            }
         }
     else
         {
-        return EFalse;
+        if (iOpacity.Now() <= EPSILON ||
+            (!HasCommandBuffers(ETrue /*include children*/) && 
+            !IsBackgroundDrawingEnabled() &&
+            !IsExternalContentDrawingEnabled() &&
+            !IsExternalContentDrawingEnabled(ETrue /*include children*/)) )
+            {
+            return ETrue;
+            }
         }
+    return EFalse;
     }
 
 void CHuiCanvasVisual::Draw(CHuiGc& aGc) const
@@ -548,7 +564,14 @@
     
     // Draws background if it has been defined
     if (drawVisualContent && IsBackgroundDrawingEnabled())
-        { 
+        {
+        if (iCanvasVisualData->iCanvasPainter && 
+            !iCanvasVisualData->iLayerExtent.IsEmpty())
+            {
+            // In SW rendering case, we support only clearing with transparent.
+            iCanvasVisualData->iCanvasPainter->ClearCapturingBufferArea(aDisplayRect);
+            }
+            
         iCanvasVisualData->iBackground->DrawSelf(aGc, aDisplayRect); 
         }
 
@@ -1209,6 +1232,32 @@
     }
 
 
+EXPORT_C void CHuiCanvasVisual::SetShape(const TPoint& aOrigin, const TRegion& aRegion)
+    {
+    iCanvasVisualData->iShapeOrigin = aOrigin;
+    iCanvasVisualData->iShapeRegion.Copy(aRegion);
+    if ( iCanvasVisualData->iShapeRegion.CheckError() )
+        {
+        // fallback to full
+        iCanvasVisualData->iShapeRegion.Clear();
+        }
+    }
+    
+EXPORT_C TBool CHuiCanvasVisual::HasCustomShape() const
+    {
+    return iCanvasVisualData->iShapeRegion.Count();
+    }
+    
+EXPORT_C TPoint CHuiCanvasVisual::ShapeOrigin() const
+    {
+    return iCanvasVisualData->iShapeOrigin;
+    }
+    
+EXPORT_C const TRegion& CHuiCanvasVisual::ShapeRegion() const
+    {
+    return iCanvasVisualData->iShapeRegion;
+    }
+
 TBool CHuiCanvasVisual::IsCanvasClippingEnabled() const
     {
     return iCanvasVisualData->iCanvasFlags & EHuiCanvasFlagEnableCanvasClipping; 
@@ -1484,3 +1533,13 @@
         }    
     aRecursivePaintRegion.Tidy();
     }
+
+EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation)
+    {
+    return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); 
+    }
+
+EXPORT_C TBool CHuiCanvasVisual::HasTransParentClear() const
+    {
+    return iCanvasVisualData->iCanvasPainter->HasCommandBuffers(EHuiCanvasBufferContainsTransparentClear);
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -230,6 +230,15 @@
     iAcceptInput = aAcceptInput;
     }
 
+EXPORT_C void CHuiControlGroup::SetSecureId(TInt aSecureId)
+    {
+    iSecureId = aSecureId;
+    }
+EXPORT_C TInt CHuiControlGroup::SecureId()
+    {
+    return iSecureId;
+    }
+
 
 TBool CHuiControlGroup::Changed() const
     {
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -851,9 +851,9 @@
         iGc->PushClip();
         iGc->Clip(dirtyRect);        
         
-        if ( iForegroundBitmapGc )
+        if ( iForegroundBitmapGc && !RosterImpl().IsVisibleContentFrozen() )
             {
-            // If we are in SW rendering mode, then SW bitmap is blended.
+            // If we are in SW rendering mode, then SW bitmap may be blended.
             // However, it's possible that nothing is drawn below, so clear
             // background.
             const TRgb oldBgColor = iBackgroundColor;
@@ -891,11 +891,12 @@
                 }                                    
             }                                        
         
-        if ( iForegroundBitmapGc )
+        if ( iForegroundBitmapGc && iForegroundTextureTransparency )
             {
+            // There is ALF content in the background, we have to
+            // clear foreground bitmap.
+            
             iForegroundBitmapGc->Reset();
-            iForegroundBitmapGc->SetClippingRegion( iGc->ClipRegion() );
-
             TRgb clearColor = KRgbBlack;
             clearColor.SetAlpha(0x00);
                     
@@ -1474,8 +1475,10 @@
     // Acquire background texture
     const CHuiTexture* backgroundTexture = NULL;
     TInt err = iEnv.Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture);
-    ASSERT(backgroundTexture!=NULL);
-    __ASSERT_ALWAYS(err == KErrNone, USER_INVARIANT());
+    if( err )
+        {
+        return;
+        }
 
     // Apply background texture
     THuiImage background(*backgroundTexture);
@@ -1528,9 +1531,9 @@
                 break;
             case EClearWithSkinBackground:
                  backgroundTexture = s60skin->BackgroundTexture(item.SkinBackground());
-                 TRect skinRect = s60skin->SkinRect(item.SkinBackground());
                  if (backgroundTexture)
                     {
+                    TRect skinRect = s60skin->SkinRect(item.SkinBackground());
                     THuiImage background(*backgroundTexture);
 
                     TPoint screenOrigin(0, 0);
@@ -1622,6 +1625,11 @@
     return iForegroundTexture;
     }
 
+EXPORT_C void CHuiDisplay::SetForegroundTextureOptions(TBool aTransparency)
+    {
+    iForegroundTextureTransparency = aTransparency;
+    }
+
 void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect)
     {
     if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty())
@@ -1649,8 +1657,16 @@
 
 void CHuiDisplay::DrawForegroundTexture()
     {
-    if (iForegroundTexture)
+    if (iForegroundTexture && !RosterImpl().IsVisibleContentFrozen() )
         {
+        THuiQuality originalQuality = iGc->Quality();
+        if ( originalQuality != EHuiQualityFast )
+            {
+            // Enforce fast quality to be used - we want one to one mapping
+            // & no antialiasing.
+            iGc->SetQuality( EHuiQualityFast );
+            }            
+    
         // The following is similar to HWAcceleratedClearWithSkinBackground,
         // except blending is enabled.
         
@@ -1663,9 +1679,24 @@
         iGc->SetPenColor(KRgbWhite);
         iGc->SetPenAlpha(255);
         iGc->SetAlign(EHuiAlignHLeft, EHuiAlignVTop);            
-        iGc->Enable(CHuiGc::EFeatureBlending);
+        
+        if ( iForegroundTextureTransparency )
+            {
+            iGc->Enable(CHuiGc::EFeatureBlending);
+            }
+        else
+            {
+            iGc->Disable(CHuiGc::EFeatureBlending);
+            }
+               
         iGc->Enable(CHuiGc::EFeatureClipping);            
         iGc->DrawImage(image, screenOrigin, image.Texture().Size());        
+
+        if ( originalQuality != EHuiQualityFast )
+            {
+            // Restore original quality.
+            iGc->SetQuality( originalQuality );
+            }        
         }
     }
     
@@ -1707,3 +1738,17 @@
     return iForegroundBitmap;
     }
 
+EXPORT_C void CHuiDisplay::CopyScreenToBitmapL(CFbsBitmap* aBitmap)
+    {
+    MHuiRenderSurface* oldSurface = CHuiStatic::CurrentRenderSurface();
+    RenderSurface().MakeCurrent();
+    
+    TInt err = iGc->CopyScreenToBitmap( aBitmap );
+        
+    if (oldSurface && oldSurface != &RenderSurface())
+        {
+        oldSurface->MakeCurrent();
+        }
+        
+    User::LeaveIfError( err );
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -346,6 +346,9 @@
 
 CHuiEnv::~CHuiEnv()
     {
+    iSynchObservers.Close();
+    iSynchIds.Close();
+    
     iActionObservers.Close();
 
     // Destroy groups in reverse order so that references will be removed
@@ -741,9 +744,12 @@
     TReal32 elapsedTime = 0;
 
     // Investigate whether the environment is released
-    if(self->iState == EReleased)
+    if(self->iState == EReleased /*|| self->iPauseDrawing*/ )
         {
-        HUI_DEBUG(_L("CHuiEnv::RefreshCallBack() - Warning: Refresh callback called while environment is released."));
+        if (!self->iPauseDrawing)
+            {    
+            HUI_DEBUG(_L("CHuiEnv::RefreshCallBack() - Warning: Refresh callback called while environment is released."));
+            }        
         return KErrNone;
         }
 
@@ -1769,9 +1775,17 @@
 
 EXPORT_C void CHuiEnv::Synchronize(TInt aId, MHuiSynchronizationObserver* aObserver)
     {
-    iSynchObserver = aObserver;
-    iSynchId = aId;
-    
+    TInt err = iSynchObservers.Append(aObserver);
+    if(err)
+        {
+        return;
+        }
+    err = iSynchIds.Append(aId);
+    if(err )
+        {
+        iSynchObservers.Remove(iSynchObservers.Count()-1);
+        return;
+        }
     if ( aObserver )
         {
         ContinueRefresh();
@@ -1780,7 +1794,7 @@
 
 void CHuiEnv::DoSynchronize()
     {
-    if ( !iSynchObserver )
+    if ( iSynchObservers.Count() == 0)
         {
         return;
         }
@@ -1796,8 +1810,13 @@
             }
         }
 
-    iSynchObserver->Synchronized( iSynchId );
-    iSynchObserver = NULL;
+    TUint observersCount = iSynchObservers.Count()-1;
+    for(TInt u = observersCount; u >= 0 ; u-- )
+        {
+        iSynchObservers[u]->Synchronized( iSynchIds[u] );
+        iSynchObservers.Remove(u);
+        iSynchIds.Remove(u);
+        }
     }
 
 void CHuiEnv::RemoveTheControlGroup(TInt aId)
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -272,6 +272,10 @@
         
         // Check if cache is up-to date or does it need to be refreshed
         TBool cachedRenderTargetNeedsRefresh = (iRoot->Changed() || aRefreshCachedRenderTarget || (enableBackground && !useFrozenBackground));
+        if (!iCachedRenderTarget || (iCachedRenderTarget && iCachedRenderTarget->Size() !=  iRoot->VisualRect().Size())) 
+            {
+            cachedRenderTargetNeedsRefresh = ETrue;
+            }
 
         // Try to apply also margins, we cannot just use aDisplayRect directly
         TRect targetRect = iRoot->VisualRect();
@@ -304,7 +308,10 @@
                 }
             
             // Write cached buffer to the display
-            iEngine->Composite(aGc, *iCachedRenderTarget, targetRect.iTl, aOpaque && !(EffectFlags() & KHuiFxAlwaysBlend), aAlpha);
+            if (cachedRenderTargetNeedsRefresh)
+                {
+                iEngine->Composite(aGc, *iCachedRenderTarget, targetRect.iTl, aOpaque && !(EffectFlags() & KHuiFxAlwaysBlend), aAlpha);
+                }
 
             if (aClipRegion.Count())
                 {
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -126,6 +126,7 @@
        if (count == 0)
            {
            Remove(iCachedEffects, cachedNode);
+           cachedNode->Delete();
            delete cachedNode;
            }
        }
@@ -313,6 +314,10 @@
     delete iFileName;
     delete iParser;
     }
+void CHuiFxEffectCacheEffectNode::Delete()
+    {
+    delete iEffect;
+    }
 
 TPtrC CHuiFxEffectCacheEffectNode::Id()
    {
@@ -371,7 +376,7 @@
 
 void CHuiFxEffectCacheEffectNode::ParsingEndedBefore()
     {
-    iParser->Effect( iEffect );
+    iParser->Effect( iEffect ); // moves ownership of iEffect to iCachedNodeArray, and will be deleted in UnUse() / Delete().
     }
 
 void CHuiFxEffectCacheEffectNode::ParsingEndedAfter(MHuiFxEffectCacheNode *aCached)
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiGc.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiGc.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -28,6 +28,8 @@
 #include "uiacceltk/HuiUtil.h"  // For hui assert.
 #include "uiacceltk/HuiTransformation.h"
 
+#include "huiextension.h"
+
 #include <e32math.h>
 #include <AknUtils.h>
 
@@ -767,6 +769,18 @@
         }
     }
 
+TInt CHuiGc::CopyScreenToBitmap(CFbsBitmap* aBitmap)
+    {
+    THuiGcCopyScreenToBitmapParams params;
+    params.iErrorCode = KErrNotSupported;
+    params.iBitmap = aBitmap;
+    TAny* ptr = &params;
+    
+    GcExtension(KHuiGcCopyScreenToBitmap, &ptr);
+    
+    return params.iErrorCode;
+    }
+
 EXPORT_C void CHuiGc::TransformDirtyRect(THuiRealRect& /*aRect*/)
     {
     // No sensible implementation for HuiGc base class. Implement at least in
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -60,6 +60,11 @@
 
 CHuiRosterImpl::~CHuiRosterImpl()
     {
+    if (iDisplay)
+        {
+        iDisplay->Env().RemoveMemoryLevelObserver(this);
+        }
+
     FreezeVisibleContentL(EFalse);
     
     delete iLongTapDetector;
@@ -530,7 +535,7 @@
     
     ASSERT(display!=NULL);
 
-    if (iCanvasRenderBuffer && iCanvasGc)
+    if (IsVisibleContentFrozen())
         {
         DrawSelfFrozen(aGc, display);
         return;
@@ -1621,19 +1626,30 @@
 
 void CHuiRosterImpl::FreezeVisibleContentL(TBool aEnable)
     {
+    iRosterIsFrozen = aEnable;
+    
+    if (aEnable && !iMonitorMemoryLevel && iDisplay)
+        {
+        iDisplay->Env().AddMemoryLevelObserver(this);
+        iMonitorMemoryLevel = ETrue;
+        }
+    
     if (aEnable)
         {    
-        if (!iCanvasGc)
+        if (UseRenderBufferForFreeze())
             {
-            CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer();
-            iCanvasGc = renderplugin.CreateCanvasGcL();
-            }    
-        if (!iCanvasRenderBuffer)
-            {
-            iCanvasRenderBuffer = iCanvasGc->CreateRenderBufferL(TSize(0,0));
-            iCanvasRenderBuffer->InitializeL(CHuiStatic::Env().Display(0).VisibleArea().Size());
-            iCanvasRenderBuffer->Copy(TPoint(0,0));    
-            iCanvasRenderBufferOrientation = CHuiStatic::Env().Display(0).Orientation();
+            if (!iCanvasGc)
+                {
+                CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer();
+                iCanvasGc = renderplugin.CreateCanvasGcL();
+                }    
+            if (!iCanvasRenderBuffer)
+                {
+                iCanvasRenderBuffer = iCanvasGc->CreateRenderBufferL(TSize(0,0));
+                iCanvasRenderBuffer->InitializeL(CHuiStatic::Env().Display(0).VisibleArea().Size());
+                iCanvasRenderBuffer->Copy(TPoint(0,0));    
+                iCanvasRenderBufferOrientation = CHuiStatic::Env().Display(0).Orientation();
+                }
             }
         }
     else
@@ -1648,7 +1664,7 @@
 
 TBool CHuiRosterImpl::IsVisibleContentFrozen() const
     {
-    return ((iCanvasRenderBuffer != NULL) && (iCanvasGc != NULL));
+    return iRosterIsFrozen;
     }
     
 void CHuiRosterImpl::EffectSetEffect(CHuiFxEffect* aEffect)
@@ -1707,3 +1723,20 @@
     {
     return iIsInput1;
     }
+
+void CHuiRosterImpl::SetMemoryLevel(THuiMemoryLevel /*aLevel*/)
+    {
+    if ( IsVisibleContentFrozen() && !UseRenderBufferForFreeze() )
+        {
+        // Release render buffer if we are not supposed to use.
+        delete iCanvasGc;
+        iCanvasGc = NULL;        
+        delete iCanvasRenderBuffer;
+        iCanvasRenderBuffer = NULL;        
+        }
+    }
+
+TBool CHuiRosterImpl::UseRenderBufferForFreeze() const
+    {
+    return !iDisplay || !( iDisplay->Env().MemoryLevel() <= EHuiMemoryLevelLowest );
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -59,7 +59,6 @@
     iSkinControlContext = CAknsBasicBackgroundControlContext::NewL(
         KAknsIIDQsnBgScreen, TRect(TPoint(0, 0), HuiUtil::ScreenSize()), ETrue);
     iSpare = new (ELeave) TPrivData;
-    iSkinChanged = ETrue;
     }
 
 
@@ -143,7 +142,7 @@
         iBackgroundTexture->SetSkinContent(ETrue);
         iBackgroundTexture->iContentObservers.AppendL(*this);
         }
-    else if(iSkinChanged)
+    else if(iReloadBackground || !iBackgroundTexture->HasContent() )
         {
         iBackgroundTexture->Reset();
         delete iBackgroundBitmap;
@@ -163,15 +162,45 @@
     HUI_DEBUG1(_L("CHuiS60Skin::UpdateBackgroundL - Free memory at exit: %i"), HuiUtil::FreeMemory());
     }
 
+void CHuiS60Skin::FreeAllBackgroundTextureResources()
+    {
+    // delete old contents
+
+    TBackgroundTexture bgTexture;
+    TInt itemCount = ((TPrivData*)(iSpare))->iBackgrounds.Count(); 
+    for (TInt index = 0; index < itemCount; index++)
+        {
+        bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index];
+        if( bgTexture.iBackgroundTexture )
+            {
+            bgTexture.iBackgroundTexture->Reset();
+            }
+        }
+    
+    delete iBackgroundTexture;
+    iBackgroundTexture = NULL;
+    delete iBackgroundBitmap;
+    iBackgroundBitmap = NULL;
+    iBackgroundRect = TRect(0,0,0,0);
+    iCachedSkinItems.ResetAndDestroy();      
+    }
+
 
 EXPORT_C void CHuiS60Skin::SkinContentChanged()
     {
-    iSkinChanged = ETrue;
+    
     }
 
 EXPORT_C void CHuiS60Skin::SkinConfigurationChanged(
     const TAknsSkinStatusConfigurationChangeReason aReason )
     {
+    if (aReason == EAknsSkinStatusConfigurationDeployed)
+        {
+        FreeAllBackgroundTextureResources();
+        Env().NotifySkinChangedL();
+        Env().TextStyleManager().NotifyDisplaySizeChangedL();
+        ReloadBgTexturesL();
+        }
     
     }
 
@@ -191,7 +220,8 @@
     if(aSkinTextureId == EHuiSkinBackgroundTexture && 
     	CHuiStatic::Renderer().Id () != EHuiRenderPluginBitgdi) 
         {
-        if(!iBackgroundTexture || iReloadBackground || iSkinChanged)
+        if(!iBackgroundTexture || ( iBackgroundTexture && !iBackgroundTexture->HasContent() ) ||  
+           iReloadBackground )            
             {
             UpdateBackgroundL();
             iReloadBackground = EFalse;
@@ -227,12 +257,8 @@
 EXPORT_C void CHuiS60Skin::NotifyDisplaySizeChangedL()
     {
     // The background is now different.
-    SkinContentChanged(); // for changing the iSkinChanged flag
-    Env().NotifySkinChangedL();
-    Env().TextStyleManager().NotifyDisplaySizeChangedL();
-    ReloadBgTexturesL();
-
-    iSkinChanged = EFalse;
+     SkinConfigurationChanged(EAknsSkinStatusConfigurationDeployed);
+    
     }
 
 
@@ -343,7 +369,7 @@
 
         CFbsBitmap* bitmap = new (ELeave) CFbsBitmap();
         CleanupStack::PushL(bitmap);
-        User::LeaveIfError( bitmap->Create(skinrect.Size(), EColor64K) );        
+        User::LeaveIfError( bitmap->Create(skinrect.Size(), EColor16MAP) );        
 
         CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(bitmap);
         CleanupStack::PushL(device);
@@ -366,7 +392,7 @@
     else
         {
         CFbsBitmap* bitmap = SearchCachedSkinItemBitmap(aID);
-        if(iSkinChanged || !bitmap)
+        if(!bitmap)
             {
             TRect skinrect;
             TRect dummy;
@@ -427,7 +453,11 @@
         {
         bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index];
         delete bgTexture.iBackgroundTexture;
+        bgTexture.iBackgroundTexture = NULL;
+        // put back. In case of a leave NULL texture is stored and we can try to re-create it later
+        ((TPrivData*)(iSpare))->iBackgrounds[index] = bgTexture; 
         bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgTexture.iID);
+        // texture created succesfully
         ((TPrivData*)(iSpare))->iBackgrounds[index] = bgTexture;
         }
     }
@@ -449,8 +479,18 @@
         if (bgItem.ClearMode() == CHuiDisplay::EClearWithSkinBackground)
             {
             bgTexture.iID = bgItem.SkinBackground();
-            bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgItem.SkinBackground());
-            ((TPrivData*)(iSpare))->iBackgrounds.Append(bgTexture);
+            bgTexture.iBackgroundTexture = NULL;
+            TRAPD(err, bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgItem.SkinBackground()));
+            // if texture creation failed because our own internal services were busy
+            // still append NULL texture so we know to try it again later
+            if(err == KErrNone || err == KErrTimedOut )
+                { 
+                ((TPrivData*)(iSpare))->iBackgrounds.Append(bgTexture);
+                }
+            else
+                {
+                User::Leave(err);
+                }
             }
         }           
     }
@@ -473,6 +513,19 @@
         bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index];
         if (bgTexture.iID == aID)
             {
+            if(!bgTexture.iBackgroundTexture && !bgTexture.iBackgroundTexture->HasContent())
+                {
+                delete bgTexture.iBackgroundTexture;
+                bgTexture.iBackgroundTexture = NULL;
+                TRAPD(err, bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgTexture.iID));
+                // put bgTexture back to the array also in leave cases
+                // otherwise we could leave invalid pointer in array
+                ((TPrivData*)(iSpare))->iBackgrounds[index] = bgTexture;
+                if(err)
+                    {
+                    return NULL; // creating failed for some reason
+                    }
+                }
             return bgTexture.iBackgroundTexture;
             }
         }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -70,7 +70,7 @@
             iStatus = KErrNotFound;
             }
 
-        static void DoGuardedOpL(const TAlfCommandParams& aInParams, 
+        static TInt DoGuardedOpErrL(const TAlfCommandParams& aInParams, 
                                   TDes8& aOutParams,
                                   RNotifier& aNotifier,
                                   const TDesC8* aInParams2 = 0 // ugly extension, really
@@ -113,21 +113,36 @@
                 User::WaitForRequest(me->iTimerStatus);
                 aOutParams.Copy(*me->iRetBuf);    
                 delete me;
-                User::LeaveIfError(err);
+                return err;
                 }
             else 
                 {
                 me->SetActive(); 
-                User::Leave( KErrTimedOut );
+                return KErrTimedOut;
                 }
             }
 
+        static void DoGuardedOpL(const TAlfCommandParams& aInParams, 
+                                  TDes8& aOutParams,
+                                  RNotifier& aNotifier,
+                                  const TDesC8* aInParams2 = 0 // ugly extension, really
+                                  )
+            {
+            TInt err = DoGuardedOpErrL(aInParams, aOutParams, aNotifier, aInParams2);
+            User::LeaveIfError(err);
+            }
+
         static TInt DoGuardedOp(const TAlfCommandParams& aInParams, 
                                   TDes8& aOutParams,
                                   RNotifier& aNotifier)
             {
             TInt ret = KErrNone;    
-            TRAP(ret, DoGuardedOpL(aInParams, aOutParams, aNotifier);)
+            TInt err = KErrNone;
+            TRAP(ret, err = DoGuardedOpErrL(aInParams, aOutParams, aNotifier);)
+            if (ret == KErrNone)
+                {
+                ret = err;
+                }
             return ret;
             }    
 
@@ -176,9 +191,8 @@
             iNotif.iLayoutMirrored = (iStatus.Int() > 0);         
             SetActive();
             TAlfCommandParams params={EAlfIsMirrorred,0,0,0};
-            TPckgC<TAlfCommandParams> pkg(params);
-            TBuf8<1> awkwardApiDummy;
-            iNotif.iNotif.StartNotifierAndGetResponse(iStatus,TUid::Uid(KAlfAppFwProxyUid), pkg, awkwardApiDummy);            
+            iParams() = params;
+            iNotif.iNotif.StartNotifierAndGetResponse(iStatus,TUid::Uid(KAlfAppFwProxyUid), iParams, iAwkwardApiDummy);
             }
     
         void DoCancel()
@@ -189,6 +203,9 @@
 
         private:
             CAppFwProxy& iNotif;
+
+            TBuf8<1> iAwkwardApiDummy;
+            TPckgBuf<TAlfCommandParams> iParams;
             };    
 
     CAppFwProxy():iLayoutMirrored(KErrNotFound)
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiTextureManager.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiTextureManager.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -2113,7 +2113,7 @@
                 HUI_DEBUG5(_L("CHuiTextureManager::RestoreL() - Restoring texture 0x%x (\"%S\", id: %i) [%i/%i]"),
                           tex, &(tex->ImageFileName()), iTextures[i]->iId, i+1, iTextures.Count());
                 // Restore the texture.
-                tex->RestoreL();
+                TRAP_IGNORE( tex->RestoreL() );
                 }
             }
         else
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -2156,7 +2156,7 @@
     {
     SetFreezeState(EFalse);
 
-    __ALFFXLOGSTRING1("CHuiVisual::SetEffect - : 0x%d ", aEffect );
+    __ALFFXLOGSTRING2("CHuiVisual::SetEffect - : 0x%d on visual 0x%x", aEffect, this );
     // If effect is replaced by a new effect, we don't want the effect end callback
     // as it would end the new effect
     if ( iVisualData->iEffect )
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -68,10 +68,13 @@
     CHuiCanvasCommandBuffer* newBuffer = new(ELeave) CHuiCanvasCommandBuffer; 
     CleanupStack::PushL(newBuffer);
     newBuffer->iCommands = commands;
-    if (iCanvasVisual && iCanvasVisual->Display())
+	
+	// the orientation will be defined by the commandbuffer
+    /*if (iCanvasVisual && iCanvasVisual->Display())
         {
         newBuffer->iOrientation = iCanvasVisual->Display()->Orientation();
-        }
+        }*/
+		
     iCommandBuffers.AppendL( newBuffer);    
     CleanupStack::Pop(2, commands);
     
@@ -240,3 +243,25 @@
 
     return EFalse;    
     }
+
+
+TRect CHuiCanvasPainter::CommandBufferCoverage(TInt aOrientation)
+    {
+    TInt bufferCount = iCommandBuffers.Count();
+    RRegion tempRegion;
+    
+    for (TInt cb = 0; cb < bufferCount; cb++)
+        {        
+        if (iCommandBuffers[cb]->iOrientation == aOrientation)
+            {
+            // should this be original display rect or update region
+            tempRegion.AddRect(iCommandBuffers[cb]->iOriginalDisplayRect);
+            }
+        }    
+    return tempRegion.BoundingRect();
+    }
+
+void CHuiCanvasPainter::ClearCapturingBufferArea(const TRect& /*aRect*/)
+    {
+    // Not supported by default
+    }  
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -205,3 +205,18 @@
     {
     return ETrue;
     }
+
+void CHuiCanvasWsBitGc::ClearCapturingBufferArea(const TRect& aRect)
+    {
+    if ( iCapturingBitGc )
+        {
+        TRgb clearColor = KRgbBlack;
+	    clearColor.SetAlpha(0x0);
+        
+	    iCapturingBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
+        iCapturingBitGc->SetPenColor(clearColor);
+        iCapturingBitGc->SetBrushColor(clearColor);
+        iCapturingBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+  	    iCapturingBitGc->Clear(aRect);
+        }
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -557,8 +557,8 @@
         else if (iWsBrushStyle == MWsGraphicsContext::EPatternedBrush)
             {
             iCanvasGc->SetPolygonDrawMode( EHuiFillEvenOdd );
-            iCanvasGc->SetPenColor(iWsPenColor);                    
-            iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));       
+            iCanvasGc->SetPenColor(iWsBrushColor);                    
+            iCanvasGc->SetOpacity(TReal32(iWsBrushColor.Alpha() / 255.f));       
             UseBrushPattern();
             iCanvasGc->SetDrawMode(SelectCanvasDrawMode(iWsDrawMode));        
             iCanvasGc->DrawRoundRect( THuiRealRect(aRect), THuiRealSize( aPoint.iX*2, aPoint.iY*2 ));
@@ -731,8 +731,8 @@
         else if (iWsBrushStyle == MWsGraphicsContext::EPatternedBrush)
             {
             iCanvasGc->SetPolygonDrawMode( EHuiFillEvenOdd );
-            iCanvasGc->SetPenColor(iWsPenColor);                    
-            iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));       
+            iCanvasGc->SetPenColor(iWsBrushColor);                    
+            iCanvasGc->SetOpacity(TReal32(iWsBrushColor.Alpha() / 255.f));       
             UseBrushPattern();
             iCanvasGc->SetDrawMode(SelectCanvasDrawMode(iWsDrawMode));        
             iCanvasGc->DrawEllipse(destRect);
@@ -881,8 +881,8 @@
         else if (iWsBrushStyle == MWsGraphicsContext::EPatternedBrush)
             {
             iCanvasGc->SetPolygonDrawMode( EHuiFillEvenOdd );
-            iCanvasGc->SetPenColor(iWsPenColor);                    
-            iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));       
+            iCanvasGc->SetPenColor(iWsBrushColor);                    
+            iCanvasGc->SetOpacity(TReal32(iWsBrushColor.Alpha() / 255.f));       
             UseBrushPattern();
             iCanvasGc->SetDrawMode(SelectCanvasDrawMode(iWsDrawMode));        
             iCanvasGc->DrawRects(rects);
@@ -2055,6 +2055,11 @@
     return EHuiCanvasWsHw;
     }
 
+void CHuiCanvasWsHwGc::ClearCapturingBufferArea(const TRect& /*aRect*/)
+    {
+    // Not supported by HW GC.
+    }
+
 THuiCanvasDrawMode CHuiCanvasWsHwGc::SelectCanvasDrawMode(TInt aWsDrawMode)
     {
     if (aWsDrawMode == MWsGraphicsContext::EDrawModeWriteAlpha)
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -131,7 +131,6 @@
     {
     if (iCanvasVisual)
         {
-        iCanvasVisual->Env().CanvasTextureCache().ReleaseAllCachedEntries(*iCanvasVisual);
         iCanvasVisual->Env().RemoveMemoryLevelObserver(this);
         }
     else
@@ -369,8 +368,8 @@
              *        
              */            
             TBool clearBeforeHandlingBuffer = iCanvasWsGc->IsRenderBufferEnabled() 
-                && (!(aUser.Flags() & EHuiVisualFlagOpaqueHint) || aUser.IsBackgroundDrawingEnabled())
-                && !isFullUpdateRegionCleared;
+                && (!(aUser.Flags() & EHuiVisualFlagOpaqueHint) || aUser.IsBackgroundDrawingEnabled());
+
                         
             // TODO: Should avoid trap, but EndActionL must always be called
             TRAPD(err, DoHandleAllBuffersL( aDisplayRect, aAction, aUser, aGc, aPos, 
@@ -661,6 +660,14 @@
                     }                
                 break;
                 }
+            case EAlfFrameOrientation:
+                {
+                TInt orientation;
+                iWsCommandBufferReader->ReadInt32L(orientation);
+                commandBuffer.iOrientation = (CHuiGc::TOrientation)orientation;
+                break;
+                }
+                           
             case EAlfSetUpdateRegion: 
                 {
                 WsSetUpdateRegionL(aIndex);
@@ -790,6 +797,13 @@
                     }
                 break;
                 }
+            case EAlfFrameOrientation:
+                {
+                TInt orientation;
+                iWsCommandBufferReader->ReadInt32L( orientation );
+                break;
+                }
+
             case EAlfSetUpdateRegion: 
                 {
                 WsSetUpdateRegionL(aIndex);                    
@@ -911,6 +925,12 @@
             case EAlfClearRect:
                 {
                 commandBuffer->SetStatusFlags(EHuiCanvasBufferContainsDrawing);
+                TRgb transpclearcolor(KRgbWhite);
+                transpclearcolor.SetAlpha(0);
+                if (iBrushColor == transpclearcolor)
+                    {
+                    commandBuffer->SetStatusFlags(EHuiCanvasBufferContainsTransparentClear);                    
+                    }
                 WsClearRectL();
                 break;
                 }
@@ -1878,6 +1898,7 @@
 	#ifdef __ALF_SYMBIAN_RWINDOW_CLEARING_BUG_WORKAROUND__
 	iTestBrushColor.SetInternal(0);
 	#endif	
+	iBrushColor.SetInternal(0);
     }
 
 void CHuiCanvasWsPainter::WsSetBrushColorL()
@@ -1889,6 +1910,7 @@
 	#ifdef __ALF_SYMBIAN_RWINDOW_CLEARING_BUG_WORKAROUND__
 	iTestBrushColor = color;    	  	                            	
 	#endif
+	iBrushColor = color;
     }
 
 void CHuiCanvasWsPainter::WsSetBrushOriginL()
@@ -2484,6 +2506,11 @@
     return result;
     }
 
+void CHuiCanvasWsPainter::ClearCapturingBufferArea(const TRect& aRect)
+    {
+    iCanvasWsGc->ClearCapturingBufferArea(aRect);
+    }
+
 TRect CHuiCanvasWsPainter::DirtyRect() const
     {
     iTempRegion.Clear();                
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -1519,3 +1519,9 @@
     {
     return iAction == EDrawBuffer;
     }
+
+void CHuiCanvasWsSwGc::ClearCapturingBufferArea(const TRect& /*aRect*/)
+    {
+    // Not supported by fallback GC.
+    }
+
--- a/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -174,7 +174,8 @@
     iFrameInterval(-1),
     iFrameCount(0),
     iFlags(aFlags),
-    iId(aId)
+    iId(aId),
+    iOriginalFileInUse(EFalse)
     {
     }
 
@@ -203,11 +204,16 @@
     TChar drive;
     User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, drive ) );
         
-    iFilename = HBufC::NewL(parse.NameAndExt().Size() + 4);
+    // 32 extra for textureid and 4 for "temp"
+    iFilename = HBufC::NewL(parse.NameAndExt().Size() + 4 + 32+ 4);
     TPtr ptr = iFilename->Des();
     
     ptr.Append(drive);
-    ptr.Append(_L(":\\"));
+    ptr.Append(_L(":\\temp"));
+    // with the texture id:s the
+    // name should be "unique"
+    ptr.AppendNum(iTextureId1);
+    ptr.AppendNum(iTextureId2);
     ptr.Append(parse.NameAndExt());
     
     RFs fs;
@@ -220,10 +226,11 @@
     CleanupStack::PopAndDestroy();
     
     if(err != KErrNone)
-	{
-	delete iFilename;    
-    iFilename = aFilename.AllocL();
-	}
+    	{
+	    iOriginalFileInUse = ETrue;
+	    delete iFilename;    
+        iFilename = aFilename.AllocL();
+	    }
     
     
     iTexture1 = &iManager.LoadTextureL(
@@ -246,18 +253,22 @@
 
     iTexture = 0;    
     
-    RFs fs;
-    TInt err = fs.Connect();
-    if(err == KErrNone)    
+    // Don't delete the file if the original
+    // file was in use instead of the RAM copy
+    if (!iOriginalFileInUse)
         {
-        CFileMan* fileman = 0;
-        TRAP(err, fileman = CFileMan::NewL(fs));
-        if(err == KErrNone)
+        RFs fs;
+        TInt err = fs.Connect();
+        if(err == KErrNone)    
             {
-            fileman->Delete(iFilename->Des());
+            CFileMan* fileman = 0;
+            TRAP(err, fileman = CFileMan::NewL(fs));
+            if(err == KErrNone)
+                {
+                fileman->Delete(iFilename->Des());
+                }
             }
         }
-    
 
     delete iFilename;
     }
--- a/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml	Fri Apr 16 15:56:24 2010 +0300
@@ -27,9 +27,9 @@
 -->
 	<app_specific_thresholds>
 
-  <app uid="101F857A" low_ram_threshold="28000" good_ram_threshold="30000" target_free_on_startup="22000" skip_plugin="2002B3AE"></app> <!-- Camera --> 
-  <app uid="200159B2" low_ram_threshold="5000" good_ram_threshold="10000" target_free_on_startup="26000" skip_plugin="2002B3AE"></app> <!-- MPlayer -->
-  <app uid="102824CD" low_ram_threshold="26000" good_ram_threshold="28000" skip_plugin="2002B3AE"></app> <!-- Embedded mplayer -->
+  <app uid="101F857A" low_ram_threshold="5000" good_ram_threshold="26000" skip_plugin="2002B3AE"></app> <!-- Camera --> 
+  <app uid="200159B2" low_ram_threshold="5000" good_ram_threshold="10000" skip_plugin="2002B3AE"></app> <!-- MPlayer -->
+  <app uid="102824CD" low_ram_threshold="5000" good_ram_threshold="10000" skip_plugin="2002B3AE"></app> <!-- Embedded mplayer -->
   <app uid="200009EE" low_ram_threshold="3637" good_ram_threshold="10000" target_free_on_startup="15000"></app> <!-- Photos -->
   <app uid="101FD693" low_ram_threshold="5000" good_ram_threshold="10000" target_free_on_startup="26000"></app> <!-- Flashlite -->
 
@@ -72,7 +72,7 @@
 -->
 		<system_plugin uid="DEFAULT_PLUGIN" priority="10" sync_mode="check"></system_plugin>
 		<system_plugin uid="E4B6C988" priority="3" sync_mode="check"></system_plugin> <!-- ALFOOGMPLUGIN -->
-		<system_plugin uid="2002C30A" priority="5" sync_mode="check" wait="1000"></system_plugin> <!-- FLASHOOGMPLUGIN -->
+		<system_plugin uid="2002C30A" priority="5" sync_mode="continue"></system_plugin> <!-- FLASHOOGMPLUGIN -->
 	</system_plugin_settings>
 	
 <!--	The priority of executing each application plugin is defined here.
--- a/uiacceltk/hitchcock/goommonitor/group/goommonitor.mmp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/group/goommonitor.mmp	Fri Apr 16 15:56:24 2010 +0300
@@ -75,8 +75,9 @@
 LIBRARY         efsrv.lib
 LIBRARY         xmlframework.lib
 LIBRARY         cone.lib
-LIBRARY			libEGL.lib
-LIBRARY			libc.lib
+LIBRARY		libEGL.lib
+LIBRARY		libc.lib
+LIBRARY         alfdecoderserverclient.lib
 
 #ifdef _DEBUG
 LIBRARY         flogger.lib
--- a/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Fri Apr 16 15:56:24 2010 +0300
@@ -250,6 +250,7 @@
     TBool iRunningKillAppActions;
     
     TUint iCurrentPluginRun;
+    RArray<TInt> iLowOnMemWgs;
     };
 
 #include "goomactionlist.inl"
--- a/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Fri Apr 16 15:56:24 2010 +0300
@@ -21,6 +21,8 @@
 #include <e32base.h>
 #include <e32hashtab.h>
 #include <w32std.h>
+#include <goommonitorplugin.hrh>
+#include "alfdecoderserverclient.h"
 
 class CApaWindowGroupName;
 
@@ -76,11 +78,24 @@
     
     // Find all the windowgroups in the list that matches application id for this window group
     void GetAllWgIdsMatchingAppId(TInt aWgId, RArray<TInt> & WgIdList) const;
+
+    TInt LowOnMemWgs(TInt aIndex) 
+        {
+        if (aIndex >= iLowOnMemWgs.Count() || aIndex < 0)
+            {
+            return KErrNotFound;
+            }    
+        else
+            {
+            return iLowOnMemWgs[aIndex];
+            }
+        }
+
     
     
 private:    
 
-    void CollapseWindowGroupTree();
+    void CollapseWindowGroupTree(RArray<TInt>& aWgsHavingSurfaces);
     
     void RemovePropertiesForClosedWindowsL();
 
@@ -117,6 +132,8 @@
         
     CApaWindowGroupName* iWgName;
     HBufC* iWgNameBuf;              // owned by iWgName
+    RArray<TInt> iLowOnMemWgs;
+    RAlfBridgerClient iAlfClient;
     };
 
 #include "goomwindowgrouplist.inl"
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -219,6 +219,14 @@
     
     aWindowGroupList.RefreshL();
     
+    for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
+        {
+        if ( iLowOnMemWgs.Find(aWindowGroupList.LowOnMemWgs(i)) == KErrNotFound)
+            {
+            iLowOnMemWgs.Append(aWindowGroupList.LowOnMemWgs(i));    
+            }
+        }
+        
     iRunningKillAppActions = ETrue;
     
     if (aWindowGroupList.Count())
@@ -316,7 +324,7 @@
 
     if (iFreeingMemory)
             {
-            TRACES("OOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions");
+            TRACES("GOOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions");
             return;
             }
     
@@ -331,6 +339,8 @@
 
     TInt memoryEstimate = iMonitor.GetFreeMemory(); // The amount of free memory we expect to be free after the currently initiated operations
 
+    TRACES2("GOOMWATCHER:CGOomActionList::FreeMemory Memory currentActionIndex %d iActionrefsCount %d", iCurrentActionIndex, iActionRefs.Count());
+    
     while (iCurrentActionIndex < iActionRefs.Count())
         {
         if(iActionRefs[iCurrentActionIndex].Priority() > aMaxPriority)
@@ -352,6 +362,8 @@
             
             TInt32 fgApp = wgName->AppUid().iUid;
             TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue);
+            
+            CleanupStack::PopAndDestroy();
             if(appId == fgApp)
                 {
                 TRACES1("Foreground App wgid %x, spared by GOOM", appId);
@@ -396,6 +408,7 @@
             // Also check if we estimate that we have already freed enough memory (assuming that the sync mode is "estimate"
             {
             // Return from the loop - we will be called back (in CGOomActionList::StateChanged()) when the running actions complete
+            iCurrentActionIndex++;
             TRACES("CGOomActionList::FreeMemory: Exiting run action loop");
             return;
             }
@@ -433,6 +446,17 @@
             iActionRefs[actionRefIndex].RunPlugin().MemoryGood();
             }
         }
+    // notify window groups which were triggered to low mem that 
+    TWsEvent event;
+    event.SetType(KGoomMemoryGoodEvent); // naive
+
+    for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--)
+        {
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+        iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event);
+#endif // #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+        iLowOnMemWgs.Remove(i);
+		}    
     }
 
 TBool CGOomActionList::FreeMemoryAboveTarget(TInt& aFreeMemory)
@@ -591,7 +615,6 @@
             {            
             TRACES2("CGOomActionList::StateChanged: Finished Action %d out of %d",iCurrentActionIndex, iActionRefs.Count());
             
-            iCurrentActionIndex++;
             
             if (iCurrentActionIndex >= iActionRefs.Count())
                 {
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -23,12 +23,7 @@
 #include <libc/string.h>
 #include <UikonInternalPSKeys.h>
 
-//TODO: to be removed for wk44 onwards, should use only <EGL/egl.h> which is already included in goommemorymonitor.h
-#ifdef USE_ASYNCYH_NOTIFICATIONS
 #include <EGL/egl.h>
-#else // use local 
-#include "eglext.h"
-#endif
 
 #include "goommemorymonitor.h"
 #include "goommonitorplugin.h"
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -94,6 +94,7 @@
                 if (err)
                     {
                     // completes the message if that was left to pending
+                    TRACES1("Error in RequestFreeMemory %d", err);
                     CloseAppsFinished(0, EFalse);
                     }
                 }
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -68,128 +68,157 @@
     {
     FUNC_LOG;
   
-    NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+    if (!iAlfClient.Handle())
+        {
+        User::LeaveIfError(iAlfClient.Connect());
+        }
+    iLowOnMemWgs.Reset();
+    User::LeaveIfError(iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&iLowOnMemWgs));
+
+    RArray<TInt>& inactiveSurfaces = iLowOnMemWgs;
+    TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
+    RArray<TUint64> processIds;
+    RArray<TUint> privMemUsed;
+    RArray<TUint64> sparedProcessIds;
     
-    if (!eglQueryProfilingData)
+   //if (inactiveSurfaces.Count() == 1) // ALF only 
+   //     {
+        NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+    
+        if (!eglQueryProfilingData)
             {
             TRACES("RefreshL EGL_NOK_resource_profiling not available");
-            return;
+			return;
             }
     
-    EGLint data_count;
-    EGLint* prof_data;
-    TInt i(0);
-    RArray<TUint64> processIds;
-    RArray<TUint> privMemUsed;
-    RArray<TUint64> systemProcessIds;
+        EGLint data_count;
+        EGLint* prof_data;
+        TInt i(0);
         
-    EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
+        EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
 
-    /* Find out how much profiling data is available */
-    eglQueryProfilingData(dpy, EGL_PROF_QUERY_GLOBAL_BIT_NOK|
+        /* Find out how much profiling data is available */
+        eglQueryProfilingData(dpy, EGL_PROF_QUERY_GLOBAL_BIT_NOK|
                                 EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK,
                                 NULL, 0, &data_count);
     
-    /* Allocate room for the profiling data */
-    prof_data = (EGLint*)User::Alloc(data_count * sizeof(EGLint));
-    if (prof_data == NULL)
-        return;
+        /* Allocate room for the profiling data */
+        prof_data = (EGLint*)User::Alloc(data_count * sizeof(EGLint));
+        if (prof_data == NULL)
+		   {
+		   return;
+		   }
 
-    /* Retrieve the profiling data */
-    eglQueryProfilingData(dpy,   EGL_PROF_QUERY_GLOBAL_BIT_NOK|
+        /* Retrieve the profiling data */
+        eglQueryProfilingData(dpy,   EGL_PROF_QUERY_GLOBAL_BIT_NOK|
                                  EGL_PROF_QUERY_MEMORY_USAGE_BIT_NOK,
                                  prof_data,
                                  data_count,
                                  &data_count);
     
-    /* Iterate over the returned data */
-    TUint64 process_id;  
-    while (i < data_count)
-        {
-        TRACES2("RefreshL EGL_NOK_resource_profiling - index: %d data: %x", i, prof_data[i]);
-        switch (prof_data[i++])
-            {   
-            case EGL_PROF_PROCESS_ID_NOK:
-                {
-                if (sizeof(EGLNativeProcessIdTypeNOK) == 8)
+        /* Iterate over the returned data */
+        TUint64 process_id;  
+        while (i < data_count)
+            {
+            TRACES2("RefreshL EGL_NOK_resource_profiling - index: %d data: %x", i, prof_data[i]);
+            switch (prof_data[i++])
+                {   
+                case EGL_PROF_PROCESS_ID_NOK:
                     {
-                    process_id = TUint64(prof_data[i]);
-                    process_id += (TUint64(prof_data[i + 1]) << 32);
-                    i+=2;
-                    }
-                else
-                    {
-                    process_id = prof_data[i];
-                    i++;
+                    if (sizeof(EGLNativeProcessIdTypeNOK) == 8)
+                        {
+                        process_id = TUint64(prof_data[i]);
+                        process_id += (TUint64(prof_data[i + 1]) << 32);
+                        i+=2;
+                        }
+                    else
+                        {
+                        process_id = prof_data[i];
+                        i++;
+                        }
+                    break;
                     }
-                break;
-                }
-            case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK:
-                {
-                TUint mem = prof_data[i];
-                privMemUsed.Append(mem);
+                case EGL_PROF_PROCESS_USED_PRIVATE_MEMORY_NOK:
+                    {
+                    TUint mem = prof_data[i];
+                    privMemUsed.Append(mem);
 
-                TRACES1("Memory Usage by app is %d", mem);
-                if(mem > KAllowedMemUsageForApps)
-                    processIds.Append(process_id);
+                    TRACES1("Memory Usage by app is %d", mem);
+                    if(mem > KAllowedMemUsageForApps)
+                        processIds.Append(process_id);
+                    else
+                        sparedProcessIds.Append(process_id);
                 
-                i++;
-                break;
-                }
-            case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK:
-                {
-                TUint mem = prof_data[i];
-                TRACES1("Shared Memory Usage by app is %d", mem);
-                if(mem > KAllowedMemUsageForApps)
-                    processIds.Append(process_id);
-                i++;
-                break;
-                }
-            case EGL_PROF_USED_MEMORY_NOK:
-            case EGL_PROF_TOTAL_MEMORY_NOK:
-            default:
-                {
-                TRACES2("RefreshL index %d, data: %d\n", i, prof_data[i]);
-                i++;
-                break;
+                    i++;
+                    break;
+                    }
+                case EGL_PROF_PROCESS_USED_SHARED_MEMORY_NOK:
+                    {
+                    TUint mem = prof_data[i];
+                    TRACES1("Shared Memory Usage by app is %d", mem);
+                    if(mem > KAllowedMemUsageForApps)
+                        processIds.Append(process_id);
+                    i++;
+                    break;
+                    }
+                case EGL_PROF_USED_MEMORY_NOK:
+                case EGL_PROF_TOTAL_MEMORY_NOK:
+                default:
+                    {
+                    TRACES2("RefreshL index %d, data: %d\n", i, prof_data[i]);
+                    i++;
+                    break;
+                    }
                 }
             }
+       
+       /* Free allocated memory */
+        User::Free(prof_data);
+    
+        TRACES1("RefreshL : %d Processes use gfx memory", processIds.Count());
+    
+        ///////////////////////////////////////////////////////////////////
+        // Optimization, no need to construct list if ALF is the only one
+        ///////////////////////////////////////////////////////////////////
+    
+        if( (processIds.Count() == 1) && (inactiveSurfaces.Count() == 1))
+            {
+            RProcess process;
+            TInt err =  process.Open(processIds[0]);
+            if(!err)
+                {
+                TInt secureId = process.SecureId();
+                process.Close();
+                if(secureId == 0x10003B20) // magic, wserv 
+                    {
+                    processIds.Close();
+                    privMemUsed.Close();
+                    TRACES("Only WServ using GFX mem, no need for app actions");
+                    return;
+                    }
+                }
+            }
+     //   }
+                
+    // Refresh window group list
+    // get all window groups, with info about parents
+    TInt numGroups = iWs.NumWindowGroups();
+    iWgIds.ReserveL(numGroups);
+    User::LeaveIfError(iWs.WindowGroupList(&iWgIds));
+    
+    // Remove all child window groups, promote parents to foremost child position
+    CollapseWindowGroupTree(inactiveSurfaces);
+    
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+    TWsEvent event;
+    event.SetType(KGoomMemoryLowEvent); // naive
+
+    for (TInt i = inactiveSurfaces.Count()-1; i>=0; i--)
+        {
+        iWs.SendEventToWindowGroup(inactiveSurfaces[i], event);
         }
         
-    /* Free allocated memory */
-    User::Free(prof_data);
-    
-    TRACES1("RefreshL : %d Processes use gfx memory", processIds.Count());
-    
-    ///////////////////////////////////////////////////////////////////
-    // Optimization, no need to construct list if ALF is the only one
-    ///////////////////////////////////////////////////////////////////
-    
-    if (processIds.Count() == 1)
-        {
-        RProcess process;
-        TInt err =  process.Open(processIds[0]);
-        if(!err)
-            {
-            TInt secureId = process.SecureId();
-            process.Close();
-            if(secureId == 0x10003B20) // magic, wserv 
-                {
-                processIds.Close();
-                TRACES("Only WServ using GFX mem, no need for app actions");
-                return;
-                }
-            }
-        }
-        
-    // Refresh window group list
-    // get all window groups, with info about parents
-    TInt numGroups = iWs.NumWindowGroups(0);
-    iWgIds.ReserveL(numGroups);
-    User::LeaveIfError(iWs.WindowGroupList(0, &iWgIds));
-    
-    // Remove all child window groups, promote parents to foremost child position
-    CollapseWindowGroupTree();
+#endif    
     
     // Note the current foreground window ID (if there is one)
     TBool oldForegroundWindowExists = EFalse;
@@ -225,6 +254,7 @@
         TUint secureId = AppId(index,ETrue);
         TBool found = 0;
         TInt i = 0;
+        //todo - do we really need to check this list , when we have all ids in inactiveSurfaces[]
         for(i = 0; i < processIds.Count(); i++)
             {
             RProcess process;
@@ -249,6 +279,19 @@
         
         if(!found)
             {
+            TRACES1("Checking WG ID : %d", iWgIds[index].iId);             
+            for(TInt ii = 0; ii < inactiveSurfaces.Count(); ii++)
+                {
+                if (iWgIds[index].iId == inactiveSurfaces[ii] )
+                    {
+                    found = ETrue;
+                    TRACES3("Found %d , AppId %x, isSystem: %d",inactiveSurfaces[ii], secureId, iWgName->IsSystem())            
+                    }     
+                }
+            }
+        
+        if(!found)
+            {
             iWgIds.Remove(index);
             continue;
             }
@@ -257,11 +300,13 @@
         if(iWgName->IsSystem() /*|| iWgName->Hidden()*/)
             {
             TRACES3("System/Hidden app found %x, ISystem %d, IsHidden %d",secureId, iWgName->IsSystem()?1:0, iWgName->Hidden()?1:0);  
-            systemProcessIds.Append(secureId);
+            sparedProcessIds.Append(secureId);
             }
       
         }
-       
+    
+    inactiveSurfaces.Close();
+    //CleanupStack::PopAndDestroy(); //   CleanupClosePushL(inactiveSurfaces);
     processIds.Close();
     privMemUsed.Close();      
     
@@ -270,11 +315,11 @@
     while (index--)
         {
         TBool skipped = EFalse;
-        for(i = 0; i < systemProcessIds.Count(); i++)
+        for(TInt i = 0; i < sparedProcessIds.Count(); i++)
             {
-            if(AppId(index,ETrue) == systemProcessIds[i])
+            if(AppId(index,ETrue) == sparedProcessIds[i])
                 {
-                TRACES2("WgId %d belongs to system app %x. Removing from Kill List",iWgIds[index].iId, systemProcessIds[i]);
+                TRACES2("WgId %d belongs to system app %x. Removing from Kill List",iWgIds[index].iId, sparedProcessIds[i]);
                 iWgIds.Remove(index);
                 skipped = ETrue;
                 break;
@@ -295,9 +340,8 @@
             iWgToPropertiesMapping.InsertL(iWgIds[index].iId, wgProperties);
             }
         }
-    
-    systemProcessIds.Close();
-    
+    TRACES1("Number of applications using graphics mem: %d", iWgIds.Count());    
+    sparedProcessIds.Close();
     }
 
 
@@ -417,7 +461,7 @@
   
 
 
-void CGOomWindowGroupList::CollapseWindowGroupTree()
+void CGOomWindowGroupList::CollapseWindowGroupTree(RArray<TInt>& aWgsHavingSurfaces)
     {
     FUNC_LOG;
 
@@ -430,6 +474,23 @@
             // Look for the parent position
             TInt parentPos = ii;        // use child pos as not-found signal
             TInt count = iWgIds.Count();
+            
+            for (TInt kk = aWgsHavingSurfaces.Count()-1; kk >=0; kk--)
+                {
+                if (aWgsHavingSurfaces[kk] ==info.iId && aWgsHavingSurfaces.Find(info.iParentId) == KErrNotFound )
+                    { // replace child if with parent ID    
+					aWgsHavingSurfaces.Append(info.iParentId);
+					ii=-1; // need to start all over again
+                    break;
+                    }
+                }
+				
+			if (ii == -1)
+				{
+				ii++;
+				continue;	
+				}
+				
             for (TInt jj=0; jj<count; jj++)
                 {
                 if (iWgIds[jj].iId == info.iParentId)
@@ -505,6 +566,8 @@
     iWgToPropertiesMapping.Close();
     iExistingWindowIds.Close();
     delete iWgName;
+    iAlfClient.Close();
+    iLowOnMemWgs.Close();
     }
 
 
--- a/uiacceltk/hitchcock/group/bld.inf	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/group/bld.inf	Fri Apr 16 15:56:24 2010 +0300
@@ -12,7 +12,7 @@
 * Contributors:
 *
 * Description:   Build information file for project alfappserver
-*  Version     : %version: tr1sido#128.1.9 %
+*  Version     : %version: tr1sido#128.1.10 %
 *
 */
 
@@ -39,7 +39,7 @@
 // separate keyword definitions for appear and disappera effects for control transitions.
 // After effect system is complete and aknskins has taken over the correct 101f84b9.sel file
 // and manifest.mf file, we should no longer export these files.
-
+#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 ../coretoolkit/data/101f84b9.sel /epoc32/data/z/resource/skins/101f84b9/101f84b9.sel
 ../coretoolkit/data/101f84b9.sel /epoc32/release/winscw/udeb/z/resource/skins/101f84b9/101f84b9.sel
 ../coretoolkit/data/101f84b9.sel /epoc32/release/winscw/urel/z/resource/skins/101f84b9/101f84b9.sel
@@ -60,6 +60,8 @@
 // /resource/effects/ directory.
 // These files can be changed any time and reregistered by changing the skin
 
+#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+
 // backround animation shaders
 ../backgroundanim/refplugin/data/refvertexshader.vsh /epoc32/data/z/private/200286D3/refvertexshader.vsh
 ../backgroundanim/refplugin/data/reffragmentshader.fsh /epoc32/data/z/private/200286D3/reffragmentshader.fsh
@@ -84,9 +86,12 @@
 ../AlfHintPlugin/group/AlfHintPlugin.mmp
 ../AlfHintPlugin/group/AlfHintPluginDrawer.mmp
 
+#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
 ../plugins/alftranseffect/alftranseffectplugin/group/alftranseffectplugin.mmp
 ../plugins/alftranseffect/alftfxserverplugin/group/AlfTfxSrvPlugin.mmp
 ../plugins/alftranseffect/alfgfxtransadapter/group/gfxtransenginetfx.mmp
+#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+
 ../plugins/alfoogmplugin/group/alfoogmplugin.mmp
 ../plugins/alfcrpplugin/group/alfcrpplugin.mmp
 
--- a/uiacceltk/hitchcock/group/core_exports.inc	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/group/core_exports.inc	Fri Apr 16 15:56:24 2010 +0300
@@ -3,7 +3,7 @@
 *  Name        : core_exports.inc
 *  Part of     : Alfred UI Toolkit
 *  Description : Exported header files.
-*  Version     : %version: tr1sido#8.1.26 %
+*  Version     : %version: tr1sido#8.1.33 %
 *
 *  Copyright © 2006-2007 Nokia.  All rights reserved.
 *  This material, including documentation and any related computer
@@ -19,6 +19,10 @@
 
 PRJ_EXPORTS
 
+#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+// Effect definitions are considered as differentiating SW and thus not available for foundation.
+#ifndef ALF_USE_OPENWF_COMPOSITION
+
 //
 //	READ THIS!!!
 //
@@ -29,13 +33,18 @@
 
 // for EMULATOR UREL
 ../coretoolkit/data/activeidle_viewswitch_add_page.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_add_page.fxml
+../coretoolkit/data/activeidle_viewswitch_bg_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_bg_appear.fxml
 ../coretoolkit/data/activeidle_viewswitch_close_editmode.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_close_editmode.fxml
 ../coretoolkit/data/activeidle_viewswitch_close_widgetmanager.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_close_widgetmanager.fxml
 ../coretoolkit/data/activeidle_viewswitch_left.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_left.fxml
+../coretoolkit/data/activeidle_viewswitch_left_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_left_appear.fxml
+../coretoolkit/data/activeidle_viewswitch_left_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_left_disappear.fxml
 ../coretoolkit/data/activeidle_viewswitch_open_editmode.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_open_editmode.fxml
 ../coretoolkit/data/activeidle_viewswitch_open_widgetmanager.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_open_widgetmanager.fxml
 ../coretoolkit/data/activeidle_viewswitch_remove_page.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_remove_page.fxml
 ../coretoolkit/data/activeidle_viewswitch_right.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_right.fxml
+../coretoolkit/data/activeidle_viewswitch_right_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_right_appear.fxml
+../coretoolkit/data/activeidle_viewswitch_right_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_right_disappear.fxml
 ../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
@@ -45,7 +54,11 @@
 ../coretoolkit/data/appshell_exit.fxml /epoc32/release/winscw/urel/z/resource/effects/appshell_exit.fxml
 ../coretoolkit/data/confirmationnote_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/confirmationnote_appear.fxml
 ../coretoolkit/data/confirmationnote_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/confirmationnote_disappear.fxml
+../coretoolkit/data/contextmenu_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/contextmenu_appear.fxml
+../coretoolkit/data/contextmenu_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/contextmenu_disappear.fxml
 ../coretoolkit/data/dialer_close.fxml /epoc32/release/winscw/urel/z/resource/effects/dialer_close.fxml
+../coretoolkit/data/dialer_list_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/dialer_list_appear.fxml
+../coretoolkit/data/dialer_list_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/dialer_list_disappear.fxml
 ../coretoolkit/data/dialer_open.fxml /epoc32/release/winscw/urel/z/resource/effects/dialer_open.fxml
 ../coretoolkit/data/discreet_popup_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/discreet_popup_appear.fxml
 ../coretoolkit/data/discreet_popup_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/discreet_popup_disappear.fxml
@@ -72,6 +85,10 @@
 ../coretoolkit/data/optionsmenu_cascade_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/optionsmenu_cascade_appear.fxml
 ../coretoolkit/data/optionsmenu_cascade_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/optionsmenu_cascade_disappear.fxml
 ../coretoolkit/data/optionsmenu_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/optionsmenu_disappear.fxml
+../coretoolkit/data/photos_fullscreen_close.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_fullscreen_close.fxml
+../coretoolkit/data/photos_fullscreen_open.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_fullscreen_open.fxml
+../coretoolkit/data/photos_gridview_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_gridview_disappear.fxml
+../coretoolkit/data/photos_gridview_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_gridview_appear.fxml
 ../coretoolkit/data/popup_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/popup_appear.fxml
 ../coretoolkit/data/popup_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/popup_disappear.fxml
 ../coretoolkit/data/popup_disappear_screenshot.fxml /epoc32/release/winscw/urel/z/resource/effects/popup_disappear_screenshot.fxml
@@ -91,6 +108,12 @@
 ../coretoolkit/data/toolbar_ext_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/toolbar_ext_disappear.fxml
 ../coretoolkit/data/touchinput_close.fxml /epoc32/release/winscw/urel/z/resource/effects/touchinput_close.fxml
 ../coretoolkit/data/touchinput_open.fxml /epoc32/release/winscw/urel/z/resource/effects/touchinput_open.fxml
+../coretoolkit/data/viewswitch_left.fxml /epoc32/release/winscw/urel/z/resource/effects/viewswitch_left.fxml
+../coretoolkit/data/viewswitch_left_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/viewswitch_left_appear.fxml
+../coretoolkit/data/viewswitch_left_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/viewswitch_left_disappear.fxml
+../coretoolkit/data/viewswitch_right.fxml /epoc32/release/winscw/urel/z/resource/effects/viewswitch_right.fxml
+../coretoolkit/data/viewswitch_right_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/viewswitch_right_appear.fxml
+../coretoolkit/data/viewswitch_right_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/viewswitch_right_disappear.fxml
 ../coretoolkit/data/waitnote_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/waitnote_appear.fxml
 ../coretoolkit/data/waitnote_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/waitnote_disappear.fxml
 ../coretoolkit/data/warningnote_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/warningnote_appear.fxml
@@ -98,13 +121,18 @@
 
 // for EMULATOR UDEB
 ../coretoolkit/data/activeidle_viewswitch_add_page.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_add_page.fxml
+../coretoolkit/data/activeidle_viewswitch_bg_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_bg_appear.fxml
 ../coretoolkit/data/activeidle_viewswitch_close_editmode.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_close_editmode.fxml
 ../coretoolkit/data/activeidle_viewswitch_close_widgetmanager.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_close_widgetmanager.fxml
 ../coretoolkit/data/activeidle_viewswitch_left.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_left.fxml
+../coretoolkit/data/activeidle_viewswitch_left_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_left_appear.fxml
+../coretoolkit/data/activeidle_viewswitch_left_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_left_disappear.fxml
 ../coretoolkit/data/activeidle_viewswitch_open_editmode.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_open_editmode.fxml
 ../coretoolkit/data/activeidle_viewswitch_open_widgetmanager.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_open_widgetmanager.fxml
 ../coretoolkit/data/activeidle_viewswitch_remove_page.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_remove_page.fxml
 ../coretoolkit/data/activeidle_viewswitch_right.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_right.fxml
+../coretoolkit/data/activeidle_viewswitch_right_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_right_appear.fxml
+../coretoolkit/data/activeidle_viewswitch_right_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_right_disappear.fxml
 ../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
@@ -114,7 +142,11 @@
 ../coretoolkit/data/appshell_exit.fxml /epoc32/release/winscw/udeb/z/resource/effects/appshell_exit.fxml
 ../coretoolkit/data/confirmationnote_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/confirmationnote_appear.fxml
 ../coretoolkit/data/confirmationnote_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/confirmationnote_disappear.fxml
+../coretoolkit/data/contextmenu_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/contextmenu_appear.fxml
+../coretoolkit/data/contextmenu_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/contextmenu_disappear.fxml
 ../coretoolkit/data/dialer_close.fxml /epoc32/release/winscw/udeb/z/resource/effects/dialer_close.fxml
+../coretoolkit/data/dialer_list_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/dialer_list_appear.fxml
+../coretoolkit/data/dialer_list_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/dialer_list_disappear.fxml
 ../coretoolkit/data/dialer_open.fxml /epoc32/release/winscw/udeb/z/resource/effects/dialer_open.fxml
 ../coretoolkit/data/discreet_popup_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/discreet_popup_appear.fxml
 ../coretoolkit/data/discreet_popup_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/discreet_popup_disappear.fxml
@@ -141,6 +173,10 @@
 ../coretoolkit/data/optionsmenu_cascade_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/optionsmenu_cascade_appear.fxml
 ../coretoolkit/data/optionsmenu_cascade_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/optionsmenu_cascade_disappear.fxml
 ../coretoolkit/data/optionsmenu_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/optionsmenu_disappear.fxml
+../coretoolkit/data/photos_gridview_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_gridview_appear.fxml
+../coretoolkit/data/photos_gridview_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_gridview_disappear.fxml
+../coretoolkit/data/photos_fullscreen_close.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_fullscreen_close.fxml
+../coretoolkit/data/photos_fullscreen_open.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_fullscreen_open.fxml
 ../coretoolkit/data/popup_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/popup_appear.fxml
 ../coretoolkit/data/popup_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/popup_disappear.fxml
 ../coretoolkit/data/popup_disappear_screenshot.fxml /epoc32/release/winscw/udeb/z/resource/effects/popup_disappear_screenshot.fxml
@@ -160,6 +196,12 @@
 ../coretoolkit/data/toolbar_ext_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/toolbar_ext_disappear.fxml
 ../coretoolkit/data/touchinput_close.fxml /epoc32/release/winscw/udeb/z/resource/effects/touchinput_close.fxml
 ../coretoolkit/data/touchinput_open.fxml /epoc32/release/winscw/udeb/z/resource/effects/touchinput_open.fxml
+../coretoolkit/data/viewswitch_left.fxml /epoc32/release/winscw/udeb/z/resource/effects/viewswitch_left.fxml
+../coretoolkit/data/viewswitch_left_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/viewswitch_left_appear.fxml
+../coretoolkit/data/viewswitch_left_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/viewswitch_left_disappear.fxml
+../coretoolkit/data/viewswitch_right.fxml /epoc32/release/winscw/udeb/z/resource/effects/viewswitch_right.fxml
+../coretoolkit/data/viewswitch_right_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/viewswitch_right_appear.fxml
+../coretoolkit/data/viewswitch_right_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/viewswitch_right_disappear.fxml
 ../coretoolkit/data/waitnote_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/waitnote_appear.fxml
 ../coretoolkit/data/waitnote_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/waitnote_disappear.fxml
 ../coretoolkit/data/warningnote_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/warningnote_appear.fxml
@@ -167,13 +209,18 @@
 
 // For ROM
 ../coretoolkit/data/activeidle_viewswitch_add_page.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_add_page.fxml
+../coretoolkit/data/activeidle_viewswitch_bg_appear.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_bg_appear.fxml
 ../coretoolkit/data/activeidle_viewswitch_close_editmode.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_close_editmode.fxml
 ../coretoolkit/data/activeidle_viewswitch_close_widgetmanager.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_close_widgetmanager.fxml
 ../coretoolkit/data/activeidle_viewswitch_left.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_left.fxml
+../coretoolkit/data/activeidle_viewswitch_left_appear.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_left_appear.fxml
+../coretoolkit/data/activeidle_viewswitch_left_disappear.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_left_disappear.fxml
 ../coretoolkit/data/activeidle_viewswitch_open_editmode.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_open_editmode.fxml
 ../coretoolkit/data/activeidle_viewswitch_open_widgetmanager.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_open_widgetmanager.fxml
 ../coretoolkit/data/activeidle_viewswitch_remove_page.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_remove_page.fxml
 ../coretoolkit/data/activeidle_viewswitch_right.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_right.fxml
+../coretoolkit/data/activeidle_viewswitch_right_appear.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_right_appear.fxml
+../coretoolkit/data/activeidle_viewswitch_right_disappear.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_right_disappear.fxml
 ../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
@@ -183,7 +230,11 @@
 ../coretoolkit/data/appshell_exit.fxml /epoc32/data/z/resource/effects/appshell_exit.fxml
 ../coretoolkit/data/confirmationnote_appear.fxml /epoc32/data/z/resource/effects/confirmationnote_appear.fxml
 ../coretoolkit/data/confirmationnote_disappear.fxml /epoc32/data/z/resource/effects/confirmationnote_disappear.fxml
+../coretoolkit/data/contextmenu_appear.fxml /epoc32/data/z/resource/effects/contextmenu_appear.fxml
+../coretoolkit/data/contextmenu_disappear.fxml /epoc32/data/z/resource/effects/contextmenu_disappear.fxml
 ../coretoolkit/data/dialer_close.fxml /epoc32/data/z/resource/effects/dialer_close.fxml
+../coretoolkit/data/dialer_list_appear.fxml /epoc32/data/z/resource/effects/dialer_list_appear.fxml
+../coretoolkit/data/dialer_list_disappear.fxml /epoc32/data/z/resource/effects/dialer_list_disappear.fxml
 ../coretoolkit/data/dialer_open.fxml /epoc32/data/z/resource/effects/dialer_open.fxml
 ../coretoolkit/data/discreet_popup_appear.fxml /epoc32/data/z/resource/effects/discreet_popup_appear.fxml
 ../coretoolkit/data/discreet_popup_disappear.fxml /epoc32/data/z/resource/effects/discreet_popup_disappear.fxml
@@ -210,6 +261,10 @@
 ../coretoolkit/data/optionsmenu_cascade_appear.fxml /epoc32/data/z/resource/effects/optionsmenu_cascade_appear.fxml
 ../coretoolkit/data/optionsmenu_cascade_disappear.fxml /epoc32/data/z/resource/effects/optionsmenu_cascade_disappear.fxml
 ../coretoolkit/data/optionsmenu_disappear.fxml /epoc32/data/z/resource/effects/optionsmenu_disappear.fxml
+../coretoolkit/data/photos_gridview_appear.fxml /epoc32/data/z/resource/effects/photos_gridview_appear.fxml
+../coretoolkit/data/photos_gridview_disappear.fxml /epoc32/data/z/resource/effects/photos_gridview_disappear.fxml
+../coretoolkit/data/photos_fullscreen_close.fxml /epoc32/data/z/resource/effects/photos_fullscreen_close.fxml
+../coretoolkit/data/photos_fullscreen_open.fxml /epoc32/data/z/resource/effects/photos_fullscreen_open.fxml
 ../coretoolkit/data/popup_appear.fxml /epoc32/data/z/resource/effects/popup_appear.fxml
 ../coretoolkit/data/popup_disappear.fxml /epoc32/data/z/resource/effects/popup_disappear.fxml
 ../coretoolkit/data/popup_disappear_screenshot.fxml /epoc32/data/z/resource/effects/popup_disappear_screenshot.fxml
@@ -229,9 +284,18 @@
 ../coretoolkit/data/toolbar_ext_disappear.fxml /epoc32/data/z/resource/effects/toolbar_ext_disappear.fxml
 ../coretoolkit/data/touchinput_close.fxml /epoc32/data/z/resource/effects/touchinput_close.fxml
 ../coretoolkit/data/touchinput_open.fxml /epoc32/data/z/resource/effects/touchinput_open.fxml
+../coretoolkit/data/viewswitch_left.fxml /epoc32/data/z/resource/effects/viewswitch_left.fxml
+../coretoolkit/data/viewswitch_left_appear.fxml /epoc32/data/z/resource/effects/viewswitch_left_appear.fxml
+../coretoolkit/data/viewswitch_left_disappear.fxml /epoc32/data/z/resource/effects/viewswitch_left_disappear.fxml
+../coretoolkit/data/viewswitch_right.fxml /epoc32/data/z/resource/effects/viewswitch_right.fxml
+../coretoolkit/data/viewswitch_right_appear.fxml /epoc32/data/z/resource/effects/viewswitch_right_appear.fxml
+../coretoolkit/data/viewswitch_right_disappear.fxml /epoc32/data/z/resource/effects/viewswitch_right_disappear.fxml
 ../coretoolkit/data/waitnote_appear.fxml /epoc32/data/z/resource/effects/waitnote_appear.fxml
 ../coretoolkit/data/waitnote_disappear.fxml /epoc32/data/z/resource/effects/waitnote_disappear.fxml
 ../coretoolkit/data/warningnote_appear.fxml /epoc32/data/z/resource/effects/warningnote_appear.fxml
 ../coretoolkit/data/warningnote_disappear.fxml /epoc32/data/z/resource/effects/warningnote_disappear.fxml
 
 
+// Effect definitions are considered as differentiating SW and thus not available for foundation.
+#endif // ifndef ALF_USE_OPENWF_COMPOSITION
+#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/group/gfxtransenginetfx.mmp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/group/gfxtransenginetfx.mmp	Fri Apr 16 15:56:24 2010 +0300
@@ -57,6 +57,7 @@
 
 LIBRARY gfxtrans.lib
 LIBRARY eikcore.lib
+LIBRARY apgrfx.lib
 
 NOSTRICTDEF
 #if defined(WINSCW)
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/inc/gfxtransenginetfx.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/inc/gfxtransenginetfx.h	Fri Apr 16 15:56:24 2010 +0300
@@ -275,7 +275,23 @@
     void SubConBegin(const CCoeControl* aControl);
     void SubConAbort( const CCoeControl* aControl );
     
+    /*
+     * Finds the secure ID for the given application UID.
+     * 
+     * @param aAppUid Application UID
+     * @return Secure ID.
+     */
+    TSecureId SecureIdFromAppUid( TUid aAppUid );
     
+    /*
+     * Finds the Windoe group ID for the given application UID.
+     * 
+     * @param aAppUid Application UID
+     * @return Window group ID. Returns 0 if not found.
+     */
+    TInt32 WindowGroupIdFromAppUid( TUid aAppUid );
+
+
 private: // data
     /**
      * pointer to the client side
@@ -330,6 +346,17 @@
 //    RPointerArray<const CCoeControl> iIgnoredWOChildControls;
 
 //    TInt iSequence;
+	
+	struct TUidMapping
+	    {
+	    TUidMapping() : iAppUid(0), iSecureId(0), iWindowGroupId(0) {}
+	    TInt32 iAppUid;
+	    TInt32 iSecureId;
+	    TInt32 iWindowGroupId;
+	    };
+	
+	TUidMapping iCachedUidMapping; // cache one - this is covering most of the cases
+	
     };
 
 #endif
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -768,6 +768,161 @@
 	}
 
 // ---------------------------------------------------------------------------
+// GfxTransEffect::SecureIdFromAppUid
+// ---------------------------------------------------------------------------
+//
+TSecureId CGfxTransAdapterTfx::SecureIdFromAppUid( TUid aAppUid )
+    {
+    TSecureId result(aAppUid);
+    if ( aAppUid == TUid::Null() )
+        {
+        return result;
+        }
+
+    TBool found = EFalse;
+
+    // first check the cache
+    if ( iCachedUidMapping.iAppUid == aAppUid.iUid && iCachedUidMapping.iSecureId != 0 )
+        {
+        result = iCachedUidMapping.iSecureId;
+        found = ETrue;
+    }
+    
+    if ( !found )
+        {
+        // do the hard work
+        // first check this process - this is quick
+        // also, if this is the start-up effect on an application, the TApaTask is not yet updated with the 
+        // window group created by this application (yet).
+        TInt windowGroupId = -1;
+        RProcess thisProcess;
+        TUidType uidType = thisProcess.Type();
+        if ( uidType.IsValid() )
+            {
+            if ( uidType[2] == aAppUid ) // 0 = UID1, 1 = UID2, 2 = UID3
+                { 
+                result = thisProcess.SecureId();
+                // take the window gruop ID as well if available
+                CCoeEnv* env = CCoeEnv::Static();
+                if ( env )
+                    {
+                    windowGroupId = env->RootWin().Identifier();
+                    }
+                found = ETrue;
+                }
+            }
+        thisProcess.Close();
+
+        // If not this application, find UID using the TApaTask
+        if ( !found )
+            {
+            TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); 
+            const TApaTask task = taskList.FindApp( aAppUid );
+            const TThreadId threadId = task.ThreadId();
+            RThread otherThread;
+            if ( otherThread.Open( threadId ) == KErrNone ) // ignore error
+                {
+                result = otherThread.SecureId();
+                windowGroupId = task.WgId(); // take it for free at this point.
+                found = ETrue;
+                }
+            otherThread.Close();
+            }
+        
+        if ( found )
+            {
+            // update cache
+            if ( iCachedUidMapping.iAppUid == aAppUid.iUid )
+                {
+                // found the missing secure ID
+                iCachedUidMapping.iSecureId = result.iId;
+                
+                if ( windowGroupId > 0 )
+                    {
+                    // if we got the window group ID, update that as well to the cache
+                    iCachedUidMapping.iWindowGroupId = windowGroupId;
+                    }
+                }
+            else 
+                {
+                iCachedUidMapping.iAppUid = aAppUid.iUid;
+                iCachedUidMapping.iSecureId = result.iId;
+                // wgid might not be updated at this point.
+                iCachedUidMapping.iWindowGroupId = Max(windowGroupId,0); // might be -1 -> treat 0 and -1 is just 0
+                }
+            }
+        }
+    
+    if ( !found )
+        {
+        __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::SecureIdFromAppUid AppUid 0x%x not found (yet)", aAppUid.iUid );
+        }
+    else if ( aAppUid.iUid != result.iId )
+        {
+        __ALFFXLOGSTRING2( "CGfxTransAdapterTfx::SecureIdFromAppUid SecureID 0x%x differs form AppUid 0x%x", result.iId, aAppUid.iUid );
+        }
+
+    return result;
+    }
+
+// ---------------------------------------------------------------------------
+// GfxTransEffect::WindowGroupIdFromAppUid
+// ---------------------------------------------------------------------------
+//
+TInt32 CGfxTransAdapterTfx::WindowGroupIdFromAppUid( TUid aAppUid )
+    {
+    if ( aAppUid == TUid::Null() )
+        {
+        return 0;
+        }
+    
+    TInt result = 0;
+    TBool found = EFalse;
+    
+    // check the cache. most likely this is already up-to-date due the previous execution of SecureIdFromAppUid
+    if ( iCachedUidMapping.iAppUid == aAppUid.iUid )
+        {
+        if ( iCachedUidMapping.iWindowGroupId > 0 )
+            {
+            result = iCachedUidMapping.iWindowGroupId;
+            found = true;
+            }
+        }
+    
+    if ( !found )
+        {
+        // do the hard work
+        TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); 
+        const TApaTask task = taskList.FindApp( aAppUid );
+        result = TInt32(task.WgId());
+        
+        if ( result > 0 )
+            {
+            // update cache
+            found = ETrue;
+            if ( iCachedUidMapping.iAppUid != aAppUid.iUid )
+                {
+                iCachedUidMapping.iAppUid = aAppUid.iUid;
+                iCachedUidMapping.iSecureId = 0;
+                }
+            iCachedUidMapping.iWindowGroupId = result;
+            }
+        else
+            {
+            result = 0; // might be -1 -> treat 0 and -1 is just 0
+            }
+        }
+    
+    if ( !found )
+        {
+        __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::WindowGroupIdFromAppUid AppUid 0x%x not found (yet)", aAppUid.iUid );
+        }
+
+    return TInt32(result);
+    }
+
+
+// ---------------------------------------------------------------------------
 // GfxTransEffect::BeginFullscreen gets passed here.
 // ---------------------------------------------------------------------------
 //
@@ -815,7 +970,10 @@
             inBuf.WriteInt32L( params().iNext.iUid );
             inBuf.WriteInt32L( params().iPrev.iUid );
             inBuf.WriteInt32L( params().iFlags );
-     
+            inBuf.WriteInt32L( SecureIdFromAppUid(params().iNext).iId );
+            inBuf.WriteInt32L( WindowGroupIdFromAppUid(params().iNext) );
+            inBuf.WriteInt32L( SecureIdFromAppUid(params().iPrev) );
+            inBuf.WriteInt32L( WindowGroupIdFromAppUid(params().iPrev) );
     		}    
     	else if ( aType == AknTransEffect::EParameterAvkonInternal )
     	    {
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Fri Apr 16 15:56:24 2010 +0300
@@ -34,11 +34,17 @@
 //	virtual void UnredirectGc() = 0;
 //	virtual void UpdateToScreen() = 0;
 	virtual TUid& FromUid() = 0;
+	virtual TSecureId& FromSid() = 0;
+	virtual TInt FromWg() = 0;
 	virtual TUid& ToUid() = 0;
+	virtual TSecureId& ToSid() = 0;
+	virtual TInt ToWg() = 0;
 	virtual TUint& Action() = 0;
 	virtual TInt& Flags() = 0;
-	virtual void IncreaseHandle() = 0;
-	virtual TInt CurrentHandle() = 0;
+	virtual void IncreaseControlHandle() = 0;
+	virtual void IncreaseFullScreenHandle() = 0;
+	virtual TInt CurrentControlHandle() = 0;
+	virtual TInt CurrentFullScreenHandle() = 0;
 	virtual void StartEndChecker() = 0;
 	virtual void CancelEndChecker() = 0;
 	virtual void SendBeginFullscreen() = 0;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h	Fri Apr 16 15:56:24 2010 +0300
@@ -73,6 +73,9 @@
 
         /** Cancel asynch message(s) from client */    
         void CancelMessage(TInt aMessageId);
+        
+        /** release message(s) from client */  
+        void ClientAboutToExit(TThreadId aClientId);
 
 		/**
 		* From CAlfWindowManager - not implemented
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Fri Apr 16 15:56:24 2010 +0300
@@ -67,7 +67,8 @@
     // parameters are analyzed by CAlfGfxEffects
     
     void BeginFullscreen( TInt aAction, const TRect& aEffectRect, 
-						TInt aType, const TUid aUid1, const TUid aUid2, TInt aData );
+						TInt aType, const TUid aUid1, const TUid aUid2, TInt aData,
+						TSecureId aSid1, TInt aWg1, TSecureId aSid2, TInt aWg2);
     void EndFullscreen();
     void CancelFullscreen();
     void AbortFullscreen();
@@ -83,12 +84,19 @@
     */
 	
 	TUid& FromUid();
+	TSecureId& FromSid();
+	TInt FromWg();
 	TUid& ToUid();
+	TSecureId& ToSid();
+	TInt ToWg();
 	TUint& Action();
 	TInt& Flags();
 
-	void IncreaseHandle();
-	TInt CurrentHandle();
+	void IncreaseControlHandle();
+	TInt CurrentControlHandle();
+	
+	void IncreaseFullScreenHandle();
+	TInt CurrentFullScreenHandle();
 	
 	void StartEndChecker();
 	void CancelEndChecker();
@@ -130,22 +138,26 @@
     static TInt ControlTimeout( TAny* aServerDrawer );
     void HandleControlTimeout();
     
-    static TInt TransitionFinished( TAny* aServerDrawer );
-    void HandleTransitionFinished(); 
+    static TInt FullScreenTransitionFinished( TAny* aServerDrawer );
+    void HandleFullScreenTransitionFinished(); 
+
+    static TInt ControlTransitionFinished( TAny* aServerDrawer );
+    void HandleControlTransitionFinished();
     
     TBool FileExistsL( TPtrC& aResourceDir, TPtrC& aFileName );
         
 private: // data
 
 public:
-	CWsServerDrawerController* iController;
+	CWsServerDrawerController* iControlController;
+	CWsServerDrawerController* iFullScreenController;
+	    
 	CAlfWindowManager* iWindowManager;
     CPolicyHandler& iPolicyHandler;
 	TBool iInScreenModeChange;
 
-    CIdle* iIdle; //CIdle for async function calls.
-
-    TInt iCurrHandle;
+    TInt iCurrentControlHandle;
+    TInt iCurrentFullScreenHandle;
 
     TUint iAction;
     TUint iOldAction;
@@ -154,7 +166,8 @@
     TRect iControlRect; // demarcation rectangle for control effects
     TUid iFromUid;
     TUid iToUid;
-    
+    TSecureId iFromSid;
+    TSecureId iToSid;
     TInt iFromWg;
     TInt iToWg;
     TBool iWaitingForRootWgId;
@@ -173,22 +186,20 @@
     TInt iType; // parameter type for GFX parameters
     TScreenModeChangedStates iScrModeChangedState;
     CAlfFinishTimer* iFullScreenTimeout;
+    CAlfFinishTimer* iControlTimeout;
+    
     CAlfFinishTimer* iFinishFullScreen;
     
     // This variable tells if the full screen transition was finished
     // by a signal from Effect Engine (via AlfBridge)
     // or if timeout finished the transaction.
     TBool iFullScreenFinished;
-
-    // This is an array of reserverd windows
-    // We do not own these pointers, and must not delete them.
-    RPointerArray<CAlfWindow> iReservedWindows;
     
-    CPSObserver* iTransitionEndObserver;
+    CPSObserver* iFullScreenTransitionEndObserver;
+    CPSObserver* iControlTransitionEndObserver;
+    
     RProperty iProperty;
     
-    TBool iDoNotClearEffectRect;
-    
     RFs iFs;
     TBool iFullScreenFxSent;
     TBool iFullScreenEndSent;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/wsserverdrawercontroller.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/wsserverdrawercontroller.h	Fri Apr 16 15:56:24 2010 +0300
@@ -88,6 +88,9 @@
         const TUid& FocusUid() const;
         TBool SetFocusUid(TInt aWgId); 
         
+        void SetSecureId( const TUid& aUid, const TSecureId& aSecureId );
+        void SetWgId( const TUid& aUid, TInt aWgId );
+        
         void ClearActions();
         
     private:
@@ -99,7 +102,9 @@
                 iUid(aUid),
                 iFlags(TAppInfo::ENone),
                 iParent(KNullUid),
-                iAction(KErrNotFound)
+                iRootWgId(0),
+                iAction(KErrNotFound),
+                iSecureId(0)
                 {}
             enum TFlags
                 {
@@ -112,6 +117,7 @@
             TUid    iParent;
             TInt    iRootWgId;
             TInt    iAction;
+            TUint   iSecureId;
             };
     private:
         void ConstructL();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -152,7 +152,11 @@
     TInt op = inStream.ReadInt32L();
     TUint action = 0;
     TUid uid1( KNullUid );
+    TSecureId sid1( KNullUid );
+    TInt wgid1= 0;
     TUid uid2( KNullUid );
+    TSecureId sid2( KNullUid );
+    TInt wgid2= 0;
     HBufC* resourceDir = NULL;
     HBufC* fileName = NULL;
     HBufC* backgroundFileName = NULL;
@@ -174,7 +178,7 @@
     // The engine reservers the windows if needed, it first runs all the checks
     // to see if the effects are allowed (effects are not done for some combinations)
     
-    __ALFFXLOGSTRING2("CAlfGfxEffects::HandleMessageL - Operation: %d, Action: %d", op, action );
+    __ALFFXLOGSTRING4("CAlfGfxEffects::HandleMessageL - Operation: %d, Action: %d, Cenrep error: %d, Effect value: %d", op, action, error, value & AknTransEffect::EFullScreenTransitionsOff);
     __ALFFXLOGSTRING2("CAlfGfxEffects::HandleMessageL - Dir: %S, File: %S", &resourceDir, &fileName );
     switch ( op )
         {
@@ -202,8 +206,17 @@
                 uid1 = TUid::Uid( inStream.ReadInt32L() );
                 uid2 = TUid::Uid( inStream.ReadInt32L() );
                 TInt data = inStream.ReadInt32L();
+                
+                if ( type == AknTransEffect::EParameterType )
+                    {
+                    sid1 = TSecureId( inStream.ReadInt32L() );
+                    wgid1 = inStream.ReadInt32L();
+                    sid2 = TSecureId( inStream.ReadInt32L() );
+                    wgid2 = inStream.ReadInt32L();
+                    }
+                
                 iEngine->BeginFullscreen( action, effectRect, type,
-                    uid1, uid2, data );
+                    uid1, uid2, data, sid1, wgid1, sid2, wgid2 );
 		        }
             break;
         case MAlfGfxEffectPlugin::EEndFullscreen:
@@ -970,4 +983,15 @@
     delete buffer; 
     }
 #endif
+
+void CAlfGfxEffects::ClientAboutToExit(TThreadId aClientId)
+    {
+    if (iPolicyHandler)
+        {
+        iPolicyHandler->RemoveClient( aClientId );
+        }   
+    }
+
+
+
 //  End of File  
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -37,16 +37,12 @@
 #include <alflogger.h>
 #include <uiacceltk/HuiUtil.h>
 
-#ifdef __WINS__
+// 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;
-#else
-const TInt KAlfShortEffectTimeout = 2000000;
-const TInt KAlfLongEffectTimeout  = 3000000;
-#endif
+
 //const TInt KAlfLongEffectTimeout  = 500000;
-
-
 // Timer to send finish full screen effect
 // ---------------------------------------------------------
 // CAlfFinishTimer
@@ -228,14 +224,16 @@
 //
 void CAlfServerDrawer::ConstructL()
     {
-    iController = CWsServerDrawerController::NewL(this);
-
-    iIdle = CIdle::NewL(CActive::EPriorityIdle);
+    iControlController = CWsServerDrawerController::NewL(this);
+    iFullScreenController = CWsServerDrawerController::NewL(this);
 
     iFullScreenTimeout = CAlfFinishTimer::NewL();
+    iControlTimeout = CAlfFinishTimer::NewL();
     iFinishFullScreen = CAlfFinishTimer::NewL();
     
-    iTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
+	// note, that the PS key is actually never updated and these do not do anything
+    iControlTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
+    iFullScreenTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus );
     iProperty.Attach( KPSAlfDomain, KAlfTransitionStatus );
     iProperty.Set( KPSAlfDomain, KAlfTransitionStatus, 0 );
     iFs.Connect();
@@ -258,11 +256,12 @@
 //	
 CAlfServerDrawer::~CAlfServerDrawer()
     {
-    delete iTransitionEndObserver;
+    delete iControlTransitionEndObserver;
+    delete iFullScreenTransitionEndObserver;
     iProperty.Close();
     iFs.Close();
-    delete iController;
-    delete iIdle;
+    delete iControlController;
+    delete iFullScreenController;
     delete iFinishFullScreen;
     delete iFullScreenTimeout;
         
@@ -286,7 +285,7 @@
         iControlUid = aControlUid;
         iControlWindowGroup = aWindowGroup;
         iControlHandle = aWindowHandle;
-        return iController->BeginControlTransition();
+        return iControlController->BeginControlTransition();
         }
     }
 
@@ -295,7 +294,7 @@
 //	
 void CAlfServerDrawer::EndControlTransition(TInt aHandle)
     {
-    iController->EndControlTransition(aHandle);
+    iControlController->EndControlTransition(aHandle);
     }
 
 // ---------------------------------------------------------------------------
@@ -378,30 +377,37 @@
 // ---------------------------------------------------------------------------
 //	
 void CAlfServerDrawer::BeginFullscreen(	TInt aAction, const TRect& aEffectRect,
-                                        TInt aType, const TUid aUid1, const TUid aUid2, TInt aData )
-    {  
-    if ( iController->AppInfoCache().Action(aUid1) == aAction && 
-         iController->AppInfoCache().Action(aUid1) !=  AknTransEffect::EApplicationExit )
+                                        TInt aType, const TUid aUid1, const TUid aUid2, TInt aData,
+                                        TSecureId aSid1, TInt aWg1, TSecureId aSid2, TInt aWg2 )
+    {
+    __ALFFXLOGSTRING2("CAlfServerDrawer::BeginFullscreen - Action: %d, Type: %d", aAction, aType);
+    __ALFFXLOGSTRING4("CAlfServerDrawer::BeginFullscreen - ToAppUid/SecureId: 0x%x/0x%x, ToAppUid/SecureId: 0x%x/0x%x", aUid1, aSid1.iId, aUid2, aSid2.iId);
+    if ( iFullScreenController->AppInfoCache().Action(aUid1) == aAction && 
+         iFullScreenController->AppInfoCache().Action(aUid1) !=  AknTransEffect::EApplicationExit )
         {
-        __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - skipping action: %d, because previous action is stronger: %d", aAction, iAction);
+        __ALFFXLOGSTRING2("CAlfServerDrawer::BeginFullscreen - skipping action: %d, because previous action is stronger: %d", aAction, iAction);
         // the action must be skipped, because stronger action has been request already.
         return;
         }
     
-    __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - Action: %d, aType: %d", aAction, aType);
-    TInt action = iController->AppInfoCache().SetAction(aUid1, aAction);
+    TInt action = iFullScreenController->AppInfoCache().SetAction(aUid1, aAction);
     
     // Skip all embedded and background application effects, for now.
     // This addition is to prevent messaging app popping up in startup.
     // AVKON uses wrong parameter type and so NoEffects is not applied.
     if ( action == AknTransEffect::EEmbeddedApplicationExit ||
          action == AknTransEffect::EEmbeddedApplicationStart || 
-         action == AknTransEffect::EAppStartupBackground )
+         (action == AknTransEffect::EAppStartupBackground && aType != AknTransEffect::EParameterAvkonInternal) )
         {
-        __ALFFXLOGSTRING1(" -> CAlfServerDrawer::BeginFullscreen - Embedded/background (%d) application, skip effect", aAction);
+        __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - Embedded/background (%d) application, skip effect for AppUid: 0x%x", aAction, aUid1);
         return;
         }
   
+    if (action == AknTransEffect::EAppStartupBackground && aType == AknTransEffect::EParameterAvkonInternal)
+        {
+    	__ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - Embedded/background (%d) application, skip effect for AppUid: 0x%x, but update the avkon info.", aAction, aUid1);
+        }
+    
     if ( aAction != AknTransEffect::ENone && aAction != AknTransEffect::EAppStartupBackground )
         {
         // no action or background activity won't stop current effect
@@ -436,6 +442,10 @@
         iToUid = aUid1;
         iFromUid = aUid2;
         iFlags = aData;  
+        iFromSid = aSid2;
+        iToSid = aSid1;
+        iFromWg = aWg2;
+        iToWg = aWg1;
 		}
 	if ( aType == AknTransEffect::EParameterAvkonInternal )
 	    {
@@ -483,7 +493,7 @@
         iScrModeChangedState = EScreenModeChangedIdle;
         }
 
-    iController->BeginFullscreen( aType, aUid1, aUid2, aData );
+    iFullScreenController->BeginFullscreen( aType, aUid1, aUid2, aData );
     __ALFFXLOGSTRING("CAlfServerDrawer::BeginFullscreen end");
     }
 
@@ -492,11 +502,11 @@
 //
 void CAlfServerDrawer::EndFullscreen()
     {
-    __ALFFXLOGSTRING(" -> CAlfServerDrawer::EndFullscreen");
+    __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen >>");
     CancelEndChecker();
-    iController->EndFullscreen(EFalse);
-    iController->AppInfoCache().ClearActions();
-    __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen end");
+    iFullScreenController->EndFullscreen(EFalse);
+    iFullScreenController->AppInfoCache().ClearActions();
+    __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen <<");
     }
 
 // ---------------------------------------------------------------------------
@@ -514,19 +524,11 @@
 void CAlfServerDrawer::AbortFullscreen()
     {
     __ALFFXLOGSTRING(" -> CAlfServerDrawer::AbortFullscreen");
-    iController->AbortTransition(EAbortFullscreen);
-    iController->AppInfoCache().ClearActions();
+    iFullScreenController->AbortTransition(EAbortFullscreen);
+    iFullScreenController->AppInfoCache().ClearActions();
     __ALFFXLOGSTRING("CAlfServerDrawer::AbortFullscreen end");
     }
 
-
-TInt CAlfServerDrawer::FailedFullscreen(TAny* aArg) 
-	{
-	CAlfServerDrawer* self = static_cast<CAlfServerDrawer*>(aArg);
-	self->iController->EndExpired(); // The same as if End Checker Expires.
-	return EFalse;
-	}
-
 TBool CAlfServerDrawer::EffectFinishedFullScreen() const
     {
     return iFullScreenFinished;
@@ -559,85 +561,8 @@
     // Here we can start doing some effect for the application that is currently on the
     // screen. The new application effect should start at "EndFullScreen"
     // That normally means that the application has drawn something to its window.
-    
-    iFromWg = 0;
-    iToWg = 0;
-    
-	// TODO: using temp getter for window group ids vs app uids
-	//
-	// Official implementation pending on new window server APIs expected to available be around W40 
-	
-    if ( iType == AknTransEffect::EParameterType )
-        {
-        // TODO TODO TODO TODO TODO TODO TODO
-        //  THIS MUST BE FIXED IN ORDER TO HAVE APPLICATION START EFFECTS WORKING!
-        //
-        // THE WINDOWGROUP LIST FOR APPLICATIONS IS NOT UP-TO-DATE, BECAUSE WE CANNOT ASK IT ANYMORE DIRECTLY 
-        // FROM WSERV (DEADLOCK ISSUES).
-        // THUS IT IS UP TO CHANCE THAT WE GET A VALID REPLY IN THIS POINT.
-        // WE WILL VERY LIKELY NOT INITIATE THE EFFECT AT ALL, WHEN APPLICATION IS REALLY STARTING INSTEAD OF
-        // BEING BROUGHT FORWARD FROM BACKGROUND.
-        // TODO TODO TODO TODO TODO TODO TODO
-        iFromWg = iWindowManager->Bridge()->FindWgForAppUid(iFromUid);
-        __ALFFXLOGSTRING2("Window group from from-Application UID: 0x%X wg: 0x%x", iFromUid, iFromWg);    
-        //                                                    ---> YES --> id must be valid. continue
-        //                        YES --> Is this exit event? 
-        // Id found in cache? -->                             ---> NO  --> continue, but refreshed value should overwrite this valua in iEngine.
-        //                        NO  --> we must wait for the value.                    
-          
         
-        if (!iToWg)
-        	{
-        	iToWg = iWindowManager->Bridge()->FindWgForAppUid(iToUid); // This call might be now obsolete
-        	}
-        
-        __ALFFXLOGSTRING2("Window group from to-Application UID: 0x%X wg: 0x%x", iToUid, iToWg);    
-        }
-    
-    // How do we handle the case where we have app id, parent id and focus wg?
-    
-    if ( iType == AknTransEffect::EParameterAvkonInternal )
-        {
-        // Is this "from" or "to" or do we just use iFocusWg?
-        iToWg = iWindowManager->Bridge()->FindWgForAppUid(iToUid);
-        
-        __ALFFXLOGSTRING2("Window group from internal-Application UID: 0x%X wg: 0x%x", iToUid, iToWg);    
-        // Is this "from" or "to" or do we just use iFocusWg?
-        if ( iParentUid != KNullUid )
-            {
-            iFromWg = iWindowManager->Bridge()->FindWgForAppUid(iParentUid);
-            __ALFFXLOGSTRING2("Window group from parent-Application UID: 0x%X wg: 0x%x", iParentUid,  iFromWg);    
-            }
-        }
-        
-    // What do we do if there are no windows?
-    // We could use the built-in effect layer, but now we just stop here
-    
-    // We don't handle the EParameterAvkonInternal type
-    // TODO: revise this condition, when appui is available from wserv
-    /*if ( ( ( iFromWg == 0 || iFromWg == KErrNotFound ) && 
-        ( iToWg == 0 || iToWg == KErrNotFound ) &&
-        ( iFocusWg == 0 || iFocusWg == KErrNotFound ) ) ||
-        iType == AknTransEffect::EParameterAvkonInternal )
-        { // TODO: Uncomment, when appui available in alfbridge
-        // bail out, cannot start an effect without any windows
-        // We don't need to reset the WinIdLists as they have not been filled
-    	iIdle->Start(TCallBack(FailedFullscreen,this));
-        return;
-        }
-        */
-    // If we don't have the target window, we bail out
-    // This is because we get into trouble if another beginfullscreen
-    // follows too fast.
-    /*
-    if ( iToWg == 0 || iToWg == KErrNotFound )
-        {
-    	iIdle->Start(TCallBack(FailedFullscreen,this));
-        return;
-        }
-        */
-        
-    TBool blocked = iController->IsBlocked( iFromUid, iToUid );
+    TBool blocked = iFullScreenController->IsBlocked( iFromUid, iToUid );
     if (blocked)
         {
         return;
@@ -665,12 +590,11 @@
     if ( err != KErrNone || fileName.Length() == 0 || !FileExistsL( resourceDir, fileName ) )
         {
         // Did not find an effect file - nothing to show
-        __ALFFXLOGSTRING2(" <- CAlfServerDrawer:: Could not get full screen kml, error %d %S", err, &fileName)
+        __ALFFXLOGSTRING2("CAlfServerDrawer::DoSendBeginFullscreenL -  Could not get full screen kml, error %d %S", err, &fileName)
         iFromWg = KErrNotFound;
         iToWg = KErrNotFound;
         iFromScreen = KErrNotFound;
         iToScreen = KErrNotFound;
-    	// iIdle->Start( TCallBack( FailedFullscreen, this ) );
     	return;
         }
         
@@ -716,7 +640,7 @@
     // 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 = 13 * sizeof(TInt); //operation, TYPE, 2 wg ids, 2 app uids, 2 secure ids, flags and rect
     bufferSize += sizeof(TPtrC);
     bufferSize += resourceDir.Length() * 2;
     bufferSize += sizeof(TPtrC);
@@ -725,10 +649,9 @@
     // I don't think we need this
     TInt index = 0;
 
-    IncreaseHandle();
+    IncreaseFullScreenHandle();
 
-    iTransitionEndObserver->Cancel();
-    iIdle->Cancel(); //cancel if running.
+    iFullScreenTransitionEndObserver->Cancel();
     iFinishFullScreen->Cancel();
     iFullScreenTimeout->Cancel();
 
@@ -740,7 +663,7 @@
         RMemWriteStream stream( bridgeBuffer, bufferSize );
         // The writes should not leave if we have calculated our buffer length correctly.
         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
-        stream.WriteInt32L( iCurrHandle );
+        stream.WriteInt32L( iCurrentFullScreenHandle );
         stream.WriteInt32L( iType );
       	if ( iType == AknTransEffect::EParameterType && isExit )
       	    {
@@ -750,6 +673,10 @@
             // AppUid
             stream.WriteInt32L( iToUid.iUid );
             stream.WriteInt32L( iFromUid.iUid );
+            
+            // SecureId
+            stream.WriteInt32L( iToSid.iId );
+            stream.WriteInt32L( iFromSid.iId );
                         
             stream.WriteInt32L( KErrNotFound ); //  was iToScreen, obsolete
             stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete
@@ -762,6 +689,10 @@
             // AppUid
             stream.WriteInt32L( iToUid.iUid );
             stream.WriteInt32L( iFromUid.iUid );
+            
+            // SecureId
+            stream.WriteInt32L( iToSid.iId );
+            stream.WriteInt32L( iFromSid.iId );
                         
             stream.WriteInt32L( KErrNotFound );  // was iToScreen, obsolete
             stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete
@@ -787,7 +718,7 @@
         iWindowManager->PostIt( bridgerData );
         
         stream.Close();
-        iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle );
+        iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle );
         }
     
     // iFlags and iAction will contain some extra information that can be used to control the effect:
@@ -859,7 +790,7 @@
 //	
 TInt CAlfServerDrawer::SendEndFullscreen()
     {
-    __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendEndFullscreen");
+    __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
     
     if ( iFullScreenEndSent )
         {
@@ -868,12 +799,11 @@
         }
     iFullScreenEndSent = ETrue;
         
-    __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendEndFullscreen");
-    iTransitionEndObserver->Cancel();
+    __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
+    iFullScreenTransitionEndObserver->Cancel();
     iFullScreenTimeout->Cancel();
     iFinishFullScreen->Cancel();
-	iIdle->Cancel(); //cancel if running.
-    /*
+	/*
     TUint action = iAction;   
     if ( iType == AknTransEffect::EParameterAvkonInternal )
         {
@@ -923,7 +853,7 @@
         TRAP_IGNORE(
             {
             stream.WriteInt32L( MAlfGfxEffectPlugin::EEndFullscreen );
-            stream.WriteInt32L( iCurrHandle );
+            stream.WriteInt32L( iCurrentFullScreenHandle );
             stream.WriteInt32L( iType );
 
             stream.WriteInt32L( iToWg );
@@ -954,10 +884,10 @@
             });    
                 
         bridgerData.Set( EAlfEffectFx, iAction, bufferSize, (TAny*) index );
-        __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata");
+        __ALFFXLOGSTRING1("CAlfServerDrawer::SendEndFullscreen - sending bridgedata, Current handle %d", iCurrentFullScreenHandle);
         iWindowManager->PostIt( bridgerData );
         stream.Close();
-        iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle  );
+        iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle  );
         }
 
     iFullScreenFinished = EFalse;
@@ -987,9 +917,8 @@
         return KErrNone;
         }
 
-    iTransitionEndObserver->Cancel();
-    iIdle->Cancel(); //cancel if running.
-
+    iFullScreenTransitionEndObserver->Cancel();
+    
     iFullScreenFxSent = EFalse;
     iFullScreenEndSent = ETrue;
     
@@ -1012,7 +941,7 @@
         TRAP_IGNORE(
             {
             stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortFullscreen );
-            stream.WriteInt32L( iCurrHandle );
+            stream.WriteInt32L( iCurrentFullScreenHandle );
             stream.WriteInt32L( iType );
           	//if ( iType == AknTransEffect::EParameterType )
           	    {
@@ -1070,6 +999,7 @@
 	
 	if ( fileName.Length() == 0 || !fileExists)
 	    {
+        __ALFFXLOGSTRING2("CAlfServerDrawer::SendBeginControlTransition -  Could not get control effect kml, file exists: %d %S. ABORTING!", fileExists, &fileName)
 	    return KErrNotFound;
 	    }
 	    
@@ -1103,10 +1033,9 @@
 
     TInt index = 0;
 
-    IncreaseHandle();
-    iTransitionEndObserver->Cancel();
-    iFinishFullScreen->Cancel();
-    
+    IncreaseControlHandle();
+    iControlTransitionEndObserver->Cancel();
+    iControlTimeout->Cancel();
 
     // control transitions are not supposed to have the phasing of full screen transitions,
     // we should be ready to go immediately.
@@ -1124,7 +1053,7 @@
         TRAP_IGNORE(
             {
             stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginComponentTransition );
-            stream.WriteInt32L( iCurrHandle );
+            stream.WriteInt32L( iCurrentControlHandle );
             stream.WriteInt32L( iControlHandle ); // window handle
             stream.WriteInt32L( iControlWindowGroup ); // window group id
             stream.WriteInt32L( 0 ); // "screen number"; not used; save place for future
@@ -1136,14 +1065,15 @@
             stream.CommitL();
             });
         bridgerData.Set( EAlfControlEffectFx, iControlAction, bufferSize, (TAny*) index );
-        __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata");
+        __ALFFXLOGSTRING1("CAlfServerDrawer::SendBeginControlTransition - sending bridgedata, Current handle: %d", iCurrentControlHandle);
         iWindowManager->PostIt( bridgerData );
         stream.Close();
-        iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle );
+        iControlTransitionEndObserver->StartObserving( TCallBack( ControlTransitionFinished, this ), iCurrentControlHandle );
         }
 	
     iFullScreenFinished = EFalse;
-    iFinishFullScreen->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) );
+    
+    iControlTimeout->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) );
 	
     return KErrNone;
     }
@@ -1154,11 +1084,9 @@
 TInt CAlfServerDrawer::SendFinishControlTransition()
     {
     // We should now delete the effects from any controls that remain active.
-    __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendFinishControlTransition");
-    iTransitionEndObserver->Cancel();
-	iIdle->Cancel(); //cancel if running.
-	iFinishFullScreen->Cancel();
-    
+    __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition >>");
+    iControlTransitionEndObserver->Cancel();
+	
     // Send the data to CAlfAppUI via bridge
     TAlfBridgerData bridgerData;
     
@@ -1178,19 +1106,20 @@
         TRAP_IGNORE(
             {
             stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortComponentTransition );
-            stream.WriteInt32L( iCurrHandle );
+            stream.WriteInt32L( iCurrentControlHandle );
             stream.WriteInt32L( 0 );
             stream.WriteInt32L( 0 );
             stream.WriteInt32L( 0 );
             stream.WriteInt32L( 0 ); 
             stream.CommitL();    
             });
-        bridgerData.Set( EAlfStopEffectFx, iAction, bufferSize, (TAny*) index );
-        __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata");
+			// TODO, check, if iCurrentHandle is approriate
+        bridgerData.Set( EAlfStopControlEffectFx, iCurrentControlHandle, bufferSize, (TAny*) index );
+        __ALFFXLOGSTRING1("CAlfServerDrawer::sending bridgedata, Stop control handle: %d", iCurrentControlHandle);
         iWindowManager->PostIt( bridgerData );
         stream.Close();
         }
-        
+    __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition <<");
     return KErrNone;
     }
 	
@@ -1200,28 +1129,67 @@
 TInt CAlfServerDrawer::SendAbortControlTransition()
     {
     __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendAbortControlTransition");
-    iTransitionEndObserver->Cancel();
+    iControlTransitionEndObserver->Cancel();
     // We should now delete the effects from any controls that remain active.
     return SendFinishControlTransition();
     }
 
 // ---------------------------------------------------------------------------
+// CAlfServerDrawer::FromUid
 // ---------------------------------------------------------------------------
 //		
 TUid& CAlfServerDrawer::FromUid()
 	{
 	return iFromUid;
 	}
-	
+
+// ---------------------------------------------------------------------------
+// CAlfServerDrawer::FromSid
+// ---------------------------------------------------------------------------
+//      
+TSecureId& CAlfServerDrawer::FromSid()
+    {
+    return iFromSid;
+    }
+    
 // ---------------------------------------------------------------------------
+// CAlfServerDrawer::FromWg
 // ---------------------------------------------------------------------------
-//		
+//      
+TInt CAlfServerDrawer::FromWg()
+    {
+    return iFromWg;
+    }
+
+
+// ---------------------------------------------------------------------------
+// CAlfServerDrawer::ToUid
+// ---------------------------------------------------------------------------
+//   	
 TUid& CAlfServerDrawer::ToUid()
 	{
 	return iToUid;
 	}
 
 // ---------------------------------------------------------------------------
+// CAlfServerDrawer::ToSid
+// ---------------------------------------------------------------------------
+// 
+TSecureId& CAlfServerDrawer::ToSid()
+    {
+    return iToSid;
+    }
+
+// ---------------------------------------------------------------------------
+// CAlfServerDrawer::ToWg
+// ---------------------------------------------------------------------------
+// 
+TInt CAlfServerDrawer::ToWg()
+    {
+    return iToWg;
+    }
+
+// ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //		
 TUint& CAlfServerDrawer::Action()
@@ -1238,27 +1206,46 @@
 	}
 
 // ---------------------------------------------------------------------------
+// Guarantee, that control and fullscreen handles are unique. 
 // ---------------------------------------------------------------------------
 //		
-void CAlfServerDrawer::IncreaseHandle()
+void CAlfServerDrawer::IncreaseControlHandle()
 	{
-	iCurrHandle++;
+    // handles must be unique, but increasing control handle should not change fullscreen handle
+    TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
+    highestHandle++;
+    iCurrentControlHandle = highestHandle; 
 	}
 	
+void CAlfServerDrawer::IncreaseFullScreenHandle()
+    {
+    TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
+    highestHandle++;
+    iCurrentFullScreenHandle = highestHandle;
+    }
+
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //		
-TInt CAlfServerDrawer::CurrentHandle()
+TInt CAlfServerDrawer::CurrentControlHandle()
 	{
-	return iCurrHandle;
+	return iCurrentControlHandle;
 	}
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
+//      
+TInt CAlfServerDrawer::CurrentFullScreenHandle()
+    {
+    return iCurrentFullScreenHandle;
+    }
+
+// ---------------------------------------------------------------------------
+// ---------------------------------------------------------------------------
 //		
 void CAlfServerDrawer::StartEndChecker()
 	{
-	iController->StartEndChecker();
+    iFullScreenController->StartEndChecker();
 	}
 	
 // ---------------------------------------------------------------------------
@@ -1266,7 +1253,7 @@
 //		
 void CAlfServerDrawer::CancelEndChecker()
 	{
-	iController->CancelEndChecker();
+    iFullScreenController->CancelEndChecker();
 	}
 
 TInt CAlfServerDrawer::FullScreenTimeout( TAny* aServerDrawer )
@@ -1294,13 +1281,13 @@
 
 void CAlfServerDrawer::HandleFinishFullScreenTimeout()
     {
-    iTransitionEndObserver->Cancel();
+    iFullScreenTransitionEndObserver->Cancel();
     iFullScreenTimeout->Cancel();
     // if we haven't got a pubsub trigger,
     // we must finish the transition by calling AlfBridge.
     // If we gor the pubsub trigger, AlfBridge has done its part,
     // and all we have to do is release the reserved windows.
-    iController->FullscreenFinished( iCurrHandle );
+    iFullScreenController->FullscreenFinished( iCurrentFullScreenHandle );
     }
 
 TInt CAlfServerDrawer::ControlTimeout( TAny* aServerDrawer )
@@ -1311,25 +1298,37 @@
 
 void CAlfServerDrawer::HandleControlTimeout()
     {
-    iTransitionEndObserver->Cancel();
+    iControlTransitionEndObserver->Cancel();
     iFullScreenFinished = EFalse;
-    iFullScreenTimeout->Cancel();
-    iController->EndControlTransition( iCurrHandle );
+    iControlTimeout->Cancel();
+    iControlController->EndControlTransition( iCurrentControlHandle );
     }
 
-TInt CAlfServerDrawer::TransitionFinished( TAny* aServerDrawer )
+TInt CAlfServerDrawer::FullScreenTransitionFinished( TAny* aServerDrawer )
     {
-    static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleTransitionFinished();
+    static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleFullScreenTransitionFinished();
     return KErrNone;
     }
 
-void CAlfServerDrawer::HandleTransitionFinished()
+TInt CAlfServerDrawer::ControlTransitionFinished( TAny* aServerDrawer )
+    {
+    static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleControlTransitionFinished();
+    return KErrNone;
+    }
+
+
+void CAlfServerDrawer::HandleFullScreenTransitionFinished()
     {
     iFullScreenFinished = ETrue;
-    iIdle->Cancel(); //cancel if running.
-	iFinishFullScreen->Cancel();
+    iFinishFullScreen->Cancel();
     iFullScreenTimeout->Cancel();
-    iController->FullscreenFinished( iCurrHandle );
+    iFullScreenController->FullscreenFinished( iCurrentFullScreenHandle );
+    } 
+
+void CAlfServerDrawer::HandleControlTransitionFinished() 
+    {
+    iControlTimeout->Cancel();
+    iControlController->EndControlTransition( iCurrentControlHandle );
     }
 
 
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/repositoryhandler.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/repositoryhandler.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -67,6 +67,7 @@
 //
 void CRepositoryHandler::RunL()
     {
+    __ALFFXLOGSTRING("CRepositoryHandler::RunL (alf)");
     iError = iCrep->NotifyRequest(iKey, iStatus);
     TInt value;
     TInt err = iCrep->Get(iKey, value);
@@ -80,6 +81,7 @@
     	SetActive();
     	iError = err;
     	}
+    __ALFFXLOGSTRING2("CRepositoryHandler::RunL (alf) iValue: %d, iError %d <<", iValue, iError);
     }
     
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -44,7 +44,7 @@
 //
 CStateBase* CRestingState::SignalL(TSignal aSignal)
 	{
-	__ALFFXLOGSTRING1("CRestingState::SignalL %d >>", aSignal);
+	__ALFFXLOGSTRING1("CRestingState::SignalL %d (Alf)>>", aSignal);
 	TInt error = KErrNone;
 	switch( aSignal ) 
 		{
@@ -99,7 +99,7 @@
 //
 CStateBase* CControlState::SignalL(TSignal aSignal)
 	{
-    __ALFFXLOGSTRING1("CControlState::SignalL %d >>", aSignal);
+    __ALFFXLOGSTRING1("CControlState::SignalL %d (Alf)>>", aSignal);
 
     TInt error = KErrNone;	
 	switch( aSignal )
@@ -159,6 +159,7 @@
 CStateBase* CPhase1State::SignalL(TSignal aSignal)
 	{
     TInt error = KErrNone;	
+    __ALFFXLOGSTRING1("CPhase1State::SignalL(TSignal %d) (Alf)", aSignal);
 	switch(aSignal)
 		{
 		case EAbort:
@@ -215,7 +216,8 @@
 //
 CStateBase* CPhase2State::SignalL(TSignal aSignal)
 	{
-    TInt error = KErrNone;	
+    TInt error = KErrNone;
+    __ALFFXLOGSTRING1("CPhase2State::SignalL %d (Alf)>>", aSignal);
 	switch(aSignal)
 		{
 		case EAbort:
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp	Fri Apr 16 15:56:24 2010 +0300
@@ -238,12 +238,15 @@
 		const TUint aToUid = buf();
 		User::LeaveIfError(aFile.Read(buf));
 		const TUint root = buf();
+		User::LeaveIfError(aFile.Read(buf));
+		const TUint sid = buf();
 		if(KErrNone == Append(value)) //dont allow duplicates
 			{
 			const TInt index = IndexOf(value);
 			iAppInfo[index].iFlags = static_cast<TAppInfo::TFlags>(flags);
 			iAppInfo[index].iParent = TUid::Uid(aToUid);
 			iAppInfo[index].iRootWgId = static_cast<TInt>(root);
+			iAppInfo[index].iSecureId = static_cast<TUint>(sid);
 			}
 		}
 	}
@@ -259,6 +262,7 @@
 		User::LeaveIfError(aFile.Write(TPckgC<TUint>(info.iFlags)));
 		User::LeaveIfError(aFile.Write(TPckgC<TUint>(info.iParent.iUid)));
 		User::LeaveIfError(aFile.Write(TPckgC<TUint>(info.iRootWgId)));
+		User::LeaveIfError(aFile.Write(TPckgC<TUint>(info.iSecureId)));
 		}
 	}
 
@@ -362,7 +366,7 @@
 	    {
 	    err = KErrNone;
 	    }
-	
+	__ALFFXLOGSTRING2("CAppInfoCache::SetUid - 0x%x, append result: %d (alf)", aUid, err);
 	return err;
 	}
 
@@ -375,7 +379,8 @@
 			iAppInfo[index].iFlags |= aFlag;
 		else
 			iAppInfo[index].iFlags &= ~aFlag;
-		}	
+		}
+	__ALFFXLOGSTRING2("CAppInfoCache::SetAppFlags - 0x%x, index: %d (alf)", aUid, index);
 	}
 	
  
@@ -386,12 +391,14 @@
 
 	
 void CAppInfoCache::SetAvkonUid(const TUid& aUid)
-	{	
+	{
+    __ALFFXLOGSTRING1("CAppInfoCache::SetAvkonUid 0x%x (alf)", aUid)
   	SetAppFlags(aUid, TAppInfo::EAvkonApp, ETrue);
 	}
 
 void CAppInfoCache::RemoveAvkonUid(const TUid& aUid)
 	{
+    __ALFFXLOGSTRING1("CAppInfoCache::RemoveAvkonUid 0x%x (alf)", aUid)
 	SetAppFlags(aUid, TAppInfo::EAvkonApp, EFalse);
 	}
 
@@ -421,6 +428,16 @@
 	iAppInfo[IndexOf(aUid.iUid)].iParent = aParentUid;
 	}
 
+void CAppInfoCache::SetSecureId( const TUid& aUid, const TSecureId& aSecureId )
+    {
+    iAppInfo[IndexOf(aUid.iUid)].iSecureId = aSecureId.iId;
+    }
+    
+void CAppInfoCache::SetWgId( const TUid& aUid, TInt aWgId )
+    {
+    iAppInfo[IndexOf(aUid.iUid)].iRootWgId = aWgId;
+    }
+
      
 TInt CAppInfoCache::SetAction(const TUid& aUid, TInt aAction)
     {
@@ -655,7 +672,11 @@
 void CWsServerDrawerController::BeginFullscreen(TInt aType, const TUid aUid1, const TUid aUid2, TInt aData )
 	{	
 	TUid toUid = iEngine->ToUid();
+	TSecureId toSid = iEngine->ToSid();
+	TInt toWg = iEngine->ToWg();
 	TUid fromUid = iEngine->FromUid();
+	TSecureId fromSid = iEngine->FromSid();
+	TInt fromWg = iEngine->FromWg();
 	TInt flags = iEngine->Flags();
 #ifdef WSSERVERDRAWER_TIME_LOG //time log
 	if(aFromGfx)
@@ -695,7 +716,17 @@
     	(iEngine->Action() == AknTransEffect::EEmbeddedApplicationStart);
     	
     iAppInfoCache->SetUid(toUid);
+    if ( toUid != TUid::Null() )
+        {
+        iAppInfoCache->SetSecureId( toUid, toSid );
+        iAppInfoCache->SetWgId( toUid, toWg );
+        }
     iAppInfoCache->SetUid(fromUid);
+    if ( fromUid != TUid::Null() )
+        {
+        iAppInfoCache->SetSecureId( fromUid, fromSid );
+        iAppInfoCache->SetWgId( fromUid, fromWg );
+        }
 		
 	if ((toUid != KNullUid) && !isEmbeddedAppContext) 
 		{
@@ -749,7 +780,8 @@
 	if(iLastTypeTried == CStateHandler::EExit &&
        fstype == CStateHandler::EActivation)
 		{ //the current uid is not valid
-    	return; // activation not ok if exiting
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Last tried type was exit. Abort.");
+        return; // activation not ok if exiting
 		}
 		
     iLastTypeTried = fstype;
@@ -758,6 +790,7 @@
 	if(iExitAborted &&
 	 CStateHandler::EActivation == fstype) 
 		{ //the current uid is not valid
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Exit was aborted. Activation should not happen. Abort.");
 		AbortTransition();  //if exit is aborted, we dont want either activation	
     	return; // activation not ok if exiting
 		}
@@ -767,6 +800,7 @@
 	//we should know if its a dsa app before end can be called
 	if(iDSAActive)
 	    {
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
 	    return; //Do nothing if dsa active.
 	    }
 
@@ -774,6 +808,7 @@
 	// TODO: remove && !iEngine->WaitingForRootWgId() when appuids available from wserv
 	if(fstype == CStateHandler::ENone) 
 		{
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
 		return;
 		}
 
@@ -781,7 +816,8 @@
 	//Phone is booting, stop any FS effect.
 	if(!StartCheck(flags)) 
 		{
-		AbortTransition();
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
+        AbortTransition();
 		return;
 		}		
 	
@@ -789,6 +825,7 @@
 	// that should be blocked then we abort all ongoing transitions.
 	if(!(AllowedCustomUid(toUid) && AllowedCustomUid(fromUid)))
         {
+        __ALFFXLOGSTRING2("CWsServerDrawerController::BeginFullscreen - Blocked uid 0x%x or 0x%x. Abort.", toUid, fromUid);
         AbortTransition();
         return;
         }
@@ -826,6 +863,7 @@
 	if(CStateHandler::EActivation == fstype && currtype != CStateHandler::EStart &&
 	 !iAppInfoCache->AvkonUid(toUid))
 		{
+        __ALFFXLOGSTRING1("CWsServerDrawerController::BeginFullscreen - Non avkon app 0x%x. Abort.", toUid);
 		return;
 		}
 
@@ -937,10 +975,10 @@
 //
 void CWsServerDrawerController::EndExpired()
 	{
-	__ALFFXLOGSTRING("CWsServerDrawerController::EndExpired >>");
+	__ALFFXLOGSTRING("CWsServerDrawerController::EndExpired (Alf)>>");
 	AbortTransition(EAbortFullscreen);
 	iExitAborted = EFalse; //This is not valid when we have a time-out
-	__ALFFXLOGSTRING("CWsServerDrawerController::EndExpired <<");
+	__ALFFXLOGSTRING("CWsServerDrawerController::EndExpired (Alf)<<");
 	}
 
 // ---------------------------------------------------------------------------
@@ -948,11 +986,13 @@
 //	
 void CWsServerDrawerController::EndFullscreen(TBool /*aFromGfx*/)
 	{
+    __ALFFXLOGSTRING("CWsServerDrawerController::EndFullscreen (Alf)>>");
  	/*
 	DSA end fix
 	*/
 	if(iDSAActive)
 	    {
+        __ALFFXLOGSTRING("CWsServerDrawerController::EndFullscreen - DSA Active - ABORTING (Alf)");
 	    AbortTransition();
 	    return; //Do nothing if dsa active.
 	    }
@@ -963,6 +1003,8 @@
 #endif	//WSSERVERDRAWER_TIME_LOG
 
 	iStates->Signal(CStateBase::EEndFullscreen);
+	// the callback for FullScreenFinished will not come. this must be resetted here.
+	iLastTypeTried = CStateHandler::ENone; 
 	}
 
 
@@ -971,7 +1013,7 @@
 //	
 void CWsServerDrawerController::FullscreenFinished(TInt aHandle)
 	{
-	if(aHandle == iEngine->CurrentHandle()) // Filter away stray finish signals.
+	if(aHandle == iEngine->CurrentFullScreenHandle()) // Filter away stray finish signals.
 		{
 		iLastTypeTried = CStateHandler::ENone;
 		iStates->Signal(CStateBase::EFinishFullscreen);
@@ -1009,7 +1051,7 @@
 	
 	if(iStates->GetState() == CStateBase::EComponent) 
 		{
-		return iEngine->CurrentHandle();
+		return iEngine->CurrentControlHandle();
 		}
 	else
 		{
@@ -1022,7 +1064,7 @@
 //	
 void CWsServerDrawerController::EndControlTransition(TInt aHandle)
 	{
-	if(aHandle == iEngine->CurrentHandle()) //Filter out stray endcomponent.
+	if(aHandle == iEngine->CurrentControlHandle()) //Filter out stray endcomponent.
 		{
 		iStates->Signal(CStateBase::EFinishComponent);
 		}
@@ -1082,12 +1124,14 @@
 //
 void CWsServerDrawerController::AbortTransition(TInt aToAbort)
     {
-    __ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition >>");
+    __ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition (Alf) >>");
     if ( aToAbort == EAbortFullscreen )
         {
         iLastTypeTried = CStateHandler::ENone;
 	    iExitAborted = iStates->GetCurrentFullscreenType() == CStateHandler::EExit;
+	    __ALFFXLOGSTRING1("CWsServerDrawerController::AbortTransition , iExitAborted %d (Alf)", iExitAborted);
         iStates->Signal(CStateBase::EAbortFullscreen);
+        iExitAborted = EFalse; // end of story for exit effect.
         }
     else if ( aToAbort == EAbortControl )
         {
@@ -1097,9 +1141,11 @@
     	{
     	iLastTypeTried = CStateHandler::ENone;
 	    iExitAborted = iStates->GetCurrentFullscreenType() == CStateHandler::EExit;
-    	iStates->Signal(CStateBase::EAbort);
+	    __ALFFXLOGSTRING1("CWsServerDrawerController::AbortTransition , iExitAborted %d (Alf)", iExitAborted);
+	    iStates->Signal(CStateBase::EAbort);
+    	iExitAborted = EFalse; // end of story for exit effect.
     	}
-	__ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition <<");
+	__ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition (Alf) <<");
     }
 
 // ---------------------------------------------------------------------------
@@ -1108,7 +1154,7 @@
 TBool CWsServerDrawerController::IsBlocked( const TUid& aFromUid, const TUid& aToUid )
     {
     TBool result = iStates->IsBlocked( aFromUid, aToUid );
-    __ALFFXLOGSTRING1("CWsServerDrawerController::IsBlocked - return %d", result);
+    __ALFFXLOGSTRING1("CWsServerDrawerController::IsBlocked - return %d (Alf)", result);
     return result;
     }