Revision: 201031
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 18 Aug 2010 10:42:48 +0300
changeset 48 7ced047fb7ae
parent 43 95d73125a086
child 56 93c3782a0a3b
Revision: 201031 Kit: 201033
package_definition.xml
package_map.xml
uiaccelerator_plat/alf_client_server_api/inc/alf/alfappsrvsessionbase.h
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp
uiacceltk/hitchcock/goommonitor/data/goomconfig.xml
uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h
uiacceltk/hitchcock/goommonitor/inc/goomrunpluginconfig.h
uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp
uiacceltk/hitchcock/goommonitor/src/goomconfig.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp
uiacceltk/hitchcock/goommonitor/src/goomrunpluginconfig.cpp
uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
uiacceltk/hitchcock/group/bld.inf
uiacceltk/hitchcock/plugins/alfoogmplugin/src/alfoogmplugin.cpp
uiacceltk/rom/bld.inf
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml	Wed Aug 18 10:42:48 2010 +0300
@@ -0,0 +1,42 @@
+<?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="uiaccelerator_plat" name="UI Accelerator Platform Interfaces" level="if">
+   <component id="alf_core_toolkit_api" name="ALF Core Toolkit API" class="api" filter="s60">
+    <meta rel="Api" href="uiaccelerator_plat/alf_core_toolkit_api/alf_core_toolkit_api.metaxml"/>
+    <unit bldFile="uiaccelerator_plat/alf_core_toolkit_api/group" filter="!test"/>
+      <unit bldFile="uiaccelerator_plat/alf_core_toolkit_api/tsrc/group" filter="test,unit_test"/>
+   </component>
+   <component id="alf_visual_api" name="ALF Visual API" class="api" filter="s60">
+    <meta rel="Api" href="uiaccelerator_plat/alf_visual_api/alf_visual_api.metaxml"/>
+    <unit bldFile="uiaccelerator_plat/alf_visual_api/group" filter="!test"/>
+      <unit bldFile="uiaccelerator_plat/alf_visual_api/tsrc/group" filter="test,unit_test"/>
+   </component>
+   <component id="alf_extended_visual_api" name="ALF Extended Visual API" class="api" filter="s60">
+    <meta rel="Api" href="uiaccelerator_plat/alf_extended_visual_api/alf_extended_visual_api.metaxml"/>
+    <unit bldFile="uiaccelerator_plat/alf_extended_visual_api/group" filter="!test"/>
+      <unit bldFile="uiaccelerator_plat/alf_extended_visual_api/tsrc/group" filter="test,unit_test"/>
+   </component>
+   <component id="alf_extension_api" name="ALF Extension API" class="api" filter="s60">
+    <meta rel="Api" href="uiaccelerator_plat/alf_extension_api/alf_extension_api.metaxml"/>
+    <unit bldFile="uiaccelerator_plat/alf_extension_api/group"/>
+   </component>
+   <component id="alf_tracing_api" name="ALF Tracing API" class="api" filter="s60">
+    <meta rel="Api" href="uiaccelerator_plat/alf_tracing_api/alf_tracing_api.metaxml"/>
+    <unit bldFile="uiaccelerator_plat/alf_tracing_api/group"/>
+   </component>
+   <component id="alf_client_server_api" name="ALF Client Server API" class="api" filter="s60">
+    <meta rel="Api" href="uiaccelerator_plat/alf_client_server_api/alf_client_server_api.metaxml"/>
+    <unit bldFile="uiaccelerator_plat/alf_client_server_api/group"/>
+   </component>
+  </collection>
+  <collection id="uiacceltk" name="UI Accelerator Toolkit" level="framework">
+   <component id="hitchcock" filter="s60" name="Hitchcock">
+    <unit bldFile="uiacceltk/hitchcock/group"/>
+   </component>
+   <component id="uiacceltk_rom" filter="s60" name="UI Accelerator Toolkit ROM">
+    <unit bldFile="uiacceltk/rom"/>
+   </component>
+  </collection>
+ </package>
+</SystemDefinition>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml	Wed Aug 18 10:42:48 2010 +0300
@@ -0,0 +1,1 @@
+<PackageMap root="sf" layer="mw"/>
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappsrvsessionbase.h	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappsrvsessionbase.h	Wed Aug 18 10:42:48 2010 +0300
@@ -288,6 +288,8 @@
     
     // creates subsession
     CAlfSrvSubSessionBase* CreateSubSessionLC(const RMessage2& aMessage);
+    
+    TUint SecureId();
 
 protected: // from baseclasses
 
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -32,6 +32,10 @@
 #include "alfclientserver.h"
 #include "alfsrvtexturemanager.h"
 #include "alfsrvscreenbuffermanager.h"
+#include "alfstreamerconsts.h"
+#include "alfdecoderserverclient.h"
+
+
 
 #include <coemain.h>
 
@@ -292,20 +296,6 @@
        	iAnimatedTextures.operator[](index)->EnableAnimation(ETrue);     
         }
 
-    if ( aDoTransitionEffect && AlfServer()->TransitionEffects()->IsEnabled() &&
-         (display->DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer))        
-        {
-       	ASSERT(AlfServer()->TransitionEffects() != NULL);
-       	AlfServer()->TransitionEffects()->StartPhase( MAlfTransEffectPlugin::EFirstPhase, 
-       	    aDoTransitionEffect, *iEffectEnv );            
-       	
-       	iControlGroupOrder.Reset();
-        }
-    else
-        {
-//        ShowControlGroupsInOrderL(*display);
-        }    
-
 	// This is needed for Huitk BitBlit() to succeed 
     
 #ifdef SYMBIAN_BUILD_GCE
@@ -354,9 +344,6 @@
         return didTransition;
         }
 
-/*        
-#ifdef HUI_FX
-*/
     if (display->DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer) 
     	{
     	// Disable all animated textures for the session
@@ -371,40 +358,6 @@
        	// as the background will be visible if the effect does not cover full screen
        	// or is partially transparent.
     	}
-/*    	
-#else
-    // Do not hide or set transparency if this is off-screen buffer         
-    if (display->DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer) 
-    	{
-    	// Disable all animated textures for the session
-    	for (TInt index = 0; index < iAnimatedTextures.Count(); index++)
-        	{
-      		iAnimatedTextures.operator[](index)->EnableAnimation(EFalse); 
-        	}
-
-     	if ( aDoTransitionEffect && AlfServer()->TransitionEffects()->IsEnabled() )
-        	{
-        	StoreControlGroupOrderL(*display, EFalse ); // do not hide  
-        	ASSERT(AlfServer()->TransitionEffects() != NULL);
-        	AlfServer()->TransitionEffects()->StartPhase( MAlfTransEffectPlugin::EFirstPhase, 
-            	aDoTransitionEffect, *iEffectEnv );            
-        	didTransition = ETrue;
-        	}
-    	// Hide control groups 
-    	else 
-        	{
-        	StoreControlGroupOrderL(*display, ETrue ); // hide as well     
-    		}
-    		
-#ifdef SYMBIAN_BUILD_GCE
-        // When alf application is not focused we dont draw background because it is
-        // not visible as the alf application is not visible either (its controlgroups
-        // were just hidden in the code above).
-   	    display->SetClearBackgroundL(CHuiDisplay::EClearNone);
-#endif
-    	}
-#endif    		
-*/
     
     return didTransition;
     }
@@ -2737,6 +2690,17 @@
         {
         iTextureInfo.Remove( pos );
         }
+
+    //Photos is never killed if it is excluded here. hence commenting
+	/*
+	if (!iTextureInfo.Count())
+        {
+        if (AlfAppUi()->BridgerClient())
+            {
+            AlfAppUi()->BridgerClient()->SendBlind(EAlfExcludeFromGoomTargets, TIpcArgs(SecureId(),ClientWindowGroup()));
+            }
+        }
+	*/
     }
 
 TInt CAlfAppSrvSession::GetTextureSize( 
@@ -2765,6 +2729,15 @@
     aPriority = Max( 0, aPriority );
     aPriority = Min( 1, aPriority );
 
+    if (!iTextureInfo.Count())
+        {
+        if (AlfAppUi()->BridgerClient())
+            {
+            AlfAppUi()->BridgerClient()->SendBlind(EAlfVolunteerForGoomTarget, TIpcArgs(SecureId(), ClientWindowGroup()));
+            }
+        }
+
+
     TInt pos = FindTextureInfoById( aTextureId );
     if ( pos != KErrNotFound )
         {
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -406,6 +406,7 @@
     {
     __ASSERT_DEBUG(iData, USER_INVARIANT());
     iData->iClientWindowGroupId = aId;
+	//Adding this app to goom list - otherwise app like photos will never be killed
     if (AlfAppUi()->BridgerClient())
         {
         AlfAppUi()->BridgerClient()->SendBlind(EAlfVolunteerForGoomTarget, TIpcArgs(iData->iSecureId, iData->iClientWindowGroupId));
@@ -1140,6 +1141,15 @@
         CleanupStack::PopAndDestroy();
         }
     }
+    
+TUint CAlfAppSrvSessionBase::SecureId()
+    {
+    if (iData)
+        {
+        return iData->iSecureId;
+        }
+    return 0;
+    }            
    
 // End of file    
 
--- a/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml	Wed Aug 18 10:42:48 2010 +0300
@@ -47,7 +47,7 @@
 <!--		The uid DEFAULT_APP refers to all applications, which priority is not specifically
 		defined in the conf file.
 -->
-		<close_app uid="DEFAULT_APP" priority="80" sync_mode="check" close_timeout="1000" wait_after_close="2000">
+		<close_app uid="DEFAULT_APP" priority="80" sync_mode="check" close_timeout="1000" wait_after_close="1000">
 			<app_close_idle_priority idle_time="900" priority="50"></app_close_idle_priority>
 			<app_close_idle_priority idle_time="43200" priority="20"></app_close_idle_priority>
 		</close_app>
@@ -79,9 +79,10 @@
 		defined in the conf file.
 -->
 		<system_plugin uid="DEFAULT_PLUGIN" priority="10" sync_mode="check" sw_rend="not_supported"></system_plugin>
-		<system_plugin uid="E4B6C988" priority="3" sync_mode="check" sw_rend="supported"></system_plugin> <!-- ALFOOGMPLUGIN -->
-		<system_plugin uid="2002DC75" priority="4" sync_mode="check" sw_rend="supported"></system_plugin> <!-- HbThemeserverOOGMPLUGIN? -->
-		<system_plugin uid="2002C30A" priority="5" sync_mode="continue"></system_plugin> <!-- FLASHOOGMPLUGIN -->
+		<system_plugin uid="2002DC75" priority="3" sync_mode="continue" sw_rend="not_supported"></system_plugin> <!-- HbThemeserverOOGMPLUGIN? -->
+		<system_plugin uid="E4B6C988" priority="4" sync_mode="check" sw_rend="supported"></system_plugin> <!-- ALFOOGMPLUGIN -->
+		<system_plugin uid="2002DC75" priority="5" sync_mode="continue" sw_rend="supported" ></system_plugin> <!-- HbThemeserverOOGMPLUGIN? -->
+		<system_plugin uid="2002C30A" priority="6" sync_mode="continue"></system_plugin> <!-- FLASHOOGMPLUGIN -->
 	</system_plugin_settings>
 	
 <!--	The priority of executing each application plugin is defined here.
--- a/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Wed Aug 18 10:42:48 2010 +0300
@@ -225,6 +225,10 @@
     
     void ConstructL(CGOomConfig& aConfig);
     
+    TBool IsOkToKillApp(TInt aAppId);
+    
+    TBool AppCloseActionAlreadyExists(CGOomWindowGroupList& aWindowGroupList, TInt32 appId);
+    
 private: //data    
     
     RWsSession& iWs;
--- a/uiacceltk/hitchcock/goommonitor/inc/goomrunpluginconfig.h	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomrunpluginconfig.h	Wed Aug 18 10:42:48 2010 +0300
@@ -60,6 +60,8 @@
     
     inline TBool IsSwRendSupported();
     
+    CGOomRunPluginConfig * iNextConfig;
+    
 private:
     CGOomRunPluginConfig(TUint aPluginId, TGOomPluginType aPluginType);
     
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -163,20 +163,6 @@
         {
         // Get the config for this plugin
         CGOomRunPluginConfig& pluginConfig = aConfig.GetPluginConfig(iPluginList->Uid(pluginIndex));
-        TInt priority = pluginConfig.CalculatePluginPriority(aWindowGroupList);
-
-        TGOomSyncMode syncMode = pluginConfig.iSyncMode;
-        TInt ramEstimate = pluginConfig.iRamEstimate;
-
-        TActionRef::TActionType actionType;
-
-        if (pluginConfig.PluginType() == EGOomAppPlugin)
-            {
-            actionType = TActionRef::EAppPlugin;
-            }
-        else
-            actionType = TActionRef::ESystemPlugin;
-
 
         //get skip plugin config for foreground app
         TUint foregroundUid = iMonitor.ForegroundAppUid();
@@ -197,12 +183,27 @@
                         continue ; //skip this and continue with next plugin
                         }
             }
-        
-        TActionRef ref = TActionRef(actionType, priority, syncMode, ramEstimate, *(iRunPluginActions[actionsIndex]), aWindowGroupList.GetIndexFromAppId(pluginConfig.TargetApp()));
-        iAppsProtectedByPlugins.Append(pluginConfig.TargetApp());
-        TRACES2("Creating Plugin Action Item %x , TargetAppId %x", iPluginList->Uid(pluginIndex), pluginConfig.TargetApp());
-        //It is valid to have plugins with equal priority
-        User::LeaveIfError(iActionRefs.InsertInOrderAllowRepeats(ref, ComparePriorities));
+
+        actionsIndex--;
+        CGOomRunPluginConfig * nextConfigForSamePlugin = &pluginConfig; 
+        while(nextConfigForSamePlugin)
+            {
+            TInt priority = nextConfigForSamePlugin->CalculatePluginPriority(aWindowGroupList);
+            TGOomSyncMode syncMode = nextConfigForSamePlugin->iSyncMode;
+            TInt ramEstimate = nextConfigForSamePlugin->iRamEstimate;
+            TActionRef::TActionType actionType;
+            if (nextConfigForSamePlugin->PluginType() == EGOomAppPlugin)
+                actionType = TActionRef::EAppPlugin;
+            else
+                actionType = TActionRef::ESystemPlugin;
+
+            TActionRef ref = TActionRef(actionType, priority, syncMode, ramEstimate, *(iRunPluginActions[++actionsIndex]), aWindowGroupList.GetIndexFromAppId(nextConfigForSamePlugin->TargetApp()));
+            iAppsProtectedByPlugins.Append(nextConfigForSamePlugin->TargetApp());
+            TRACES2("Creating Plugin Action Item %x , TargetAppId %x", iPluginList->Uid(pluginIndex), nextConfigForSamePlugin->TargetApp());
+            //It is valid to have plugins with equal priority
+            User::LeaveIfError(iActionRefs.InsertInOrderAllowRepeats(ref, ComparePriorities));
+            nextConfigForSamePlugin = nextConfigForSamePlugin->iNextConfig;
+            }
 
         actionsIndex++;
         }
@@ -230,6 +231,8 @@
 */        
     iRunningKillAppActions = ETrue;
     
+    TInt oldcount = iActionRefs.Count();
+    
     if (aWindowGroupList.Count())
             {
             // Go through each item in the wglist, create an app close action for this application
@@ -252,6 +255,12 @@
                 // This sets the window group name
                 TInt32 appId = aWindowGroupList.AppId(wgIndex, ETrue);
                 
+                if(AppCloseActionAlreadyExists(aWindowGroupList, appId))
+                    {
+                    wgIndex--;
+                    continue;
+                    }
+                    
                 CApaWindowGroupName* wgName = aWindowGroupList.WgName();
                 __ASSERT_DEBUG(wgName, GOomMonitorPanic(KInvalidWgName));
 
@@ -314,10 +323,24 @@
                 }
             }
             
-        TRACES1("BuildActionListL: Action list built with %d items",iActionRefs.Count());
+        TRACES1("BuildActionListL: Action list built with %d  new items",iActionRefs.Count()- oldcount);
     }    
 
 
+TBool CGOomActionList::AppCloseActionAlreadyExists(CGOomWindowGroupList& aWindowGroupList, TInt32 appId)
+    {
+    for(TInt i = 0 ; i < iActionRefs.Count() ; i++)
+        {
+        TActionRef ref = iActionRefs[i];
+        if(ref.Type() == TActionRef::EAppClose )
+            {
+            if(aWindowGroupList.AppIdfromWgId(ref.WgId(), ETrue) == appId)
+                return ETrue;
+            }
+        }
+        return EFalse;
+    }
+
 // Execute the OOM actions according to their priority
 // Run batches of OOM actions according to their sync mode
 void CGOomActionList::FreeMemory(TInt aMaxPriority)
@@ -364,48 +387,9 @@
             
             ref.iAppPlugin = action;
             
-            //Double checking again if this app is now in foreground, if yes then we dont kill
-            CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(iWs, iWs.GetFocusWindowGroup());
-            
-            TInt32 fgApp = wgName->AppUid().iUid;
             TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue);
-                  
-            if(appId == fgApp)
-                {
-                TRACES1("Foreground App wgid %x, spared by GOOM", appId);
-                
-                iCurrentActionIndex++;
-                CleanupStack::PopAndDestroy();
-                continue;
-                }
             
-            //check if this is not parent of foreground app
-            TBool spared = EFalse;
-            TRACES1("CGOomActionList::FreeMemory - Going to kill Appid %x ",appId);
-            TInt prevWgId = 0;
-            while(prevWgId != KErrNotFound)
-                {
-                wgName->FindByAppUid(wgName->AppUid(), iWs, prevWgId);
-                
-                if(prevWgId == KErrNotFound)
-                    break;
-                
-                TInt parentId = 0;
-                TRAPD(err, parentId = iMonitor.GetWindowGroupList()->FindParentIdL(prevWgId));
-                TRACES2("CGOomActionList::FreeMemory - Foreground App wgid %d, parent wgid %d",prevWgId, parentId);
-                if( err == KErrNone && parentId != 0)
-                    {
-                    TInt32 parentAppId = iMonitor.GetWindowGroupList()->AppIdfromWgId(parentId, ETrue);       
-                    if(parentAppId == appId)
-                        {
-                        TRACES3("Parent App %x (wgId %d), of Foreground App %x, spared by GOOM", parentAppId, parentId, fgApp);
-                        spared = ETrue;
-                        break;
-                        }
-                    }
-                }
-            CleanupStack::PopAndDestroy();
-            if(spared)
+            if(!IsOkToKillApp(appId))
                 {
                 iCurrentActionIndex++;
                 if (iCurrentActionIndex >= iActionRefs.Count())
@@ -427,6 +411,7 @@
 
         iFreeingMemory = ETrue;
         TRACES2("CGOomActionList::FreeMemory: Running action %d which has priority %d", iCurrentActionIndex,ref.Priority());
+        iCurrentActionIndex++;
         action->FreeMemory(iCurrentTarget - memoryEstimate, iUseSwRendering);
         iCurrentPluginRun = 0;
         memoryFreeingActionRun = ETrue;
@@ -449,18 +434,16 @@
         if ((ref.SyncMode() == ECheckRam)
                 || (numberOfRunningActions >= maxBatchSize)
                 || estimatedEnoughMemoryFreed
-                || globalConfig.ForceCheckAtPriority(iActionRefs[iCurrentActionIndex].Priority()))
+                || globalConfig.ForceCheckAtPriority(iActionRefs[iCurrentActionIndex-1].Priority()))
             // If this actions requires a RAM check then wait for it to complete
             // Also force a check if we've reached the maximum number of concurrent operations
             // 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;
             }
         // ... otherwise continue running actions, don't wait for any existing ones to complete
-        iCurrentActionIndex++;
         
         if (iCurrentActionIndex >= iActionRefs.Count())
             {
@@ -493,6 +476,55 @@
         }
     }
 
+TBool CGOomActionList::IsOkToKillApp(TInt aAppId)
+    {
+    
+    //Double checking again if this app is now in foreground, if yes then we dont kill
+    TUid fgAppuid = TUid::Uid(iMonitor.ForegroundAppUid());
+    TInt32 fgApp = fgAppuid.iUid;
+    TRACES1("Foreground Appuid %x", fgApp);
+        
+    if (aAppId == fgApp)
+        {
+        TRACES1("Foreground App wgid %x, spared by GOOM", aAppId);
+        return EFalse;
+        }
+
+    //check if this is not parent of foreground app
+    TBool spared = EFalse;
+    TRACES2("CGOomActionList::FreeMemory - Going to kill Appid %x, Foreground app %x ", aAppId, fgApp);
+    TInt prevWgId = 0;
+    
+    CApaWindowGroupName::FindByAppUid(fgAppuid, iWs, prevWgId);
+    TInt i = 0;
+    while ((prevWgId == KErrNotFound) && (i++ < 3))   //try 3 times before quiting. It takes time to get the wgid info when app is starting
+            {
+            TRACES1("Cannot find any more parent, trying again %d",i);
+            User::After(200000);
+            prevWgId = 0;
+            CApaWindowGroupName::FindByAppUid(fgAppuid, iWs, prevWgId);
+            }
+   
+    while (prevWgId != KErrNotFound)
+        {
+        TInt parentId = 0;
+        TRAPD(err, parentId = iMonitor.GetWindowGroupList()->FindParentIdL(prevWgId));
+        TRACES3("CGOomActionList::FreeMemory - Foreground App AppId %x, wgid %d, parent wgid %d", fgApp, prevWgId, parentId);
+        if (err == KErrNone && parentId > 0)
+            {
+            TInt32 parentAppId = iMonitor.GetWindowGroupList()->AppIdfromWgId(parentId, ETrue);
+            if (parentAppId == aAppId)
+                {
+                TRACES3("Parent App %x (wgId %d), of Foreground App %x, spared by GOOM", parentAppId, parentId, fgApp);
+                spared = ETrue;
+                break;
+                }
+            }
+        CApaWindowGroupName::FindByAppUid(fgAppuid, iWs, prevWgId);
+        }
+    return !spared;
+    }
+
 // Should be called when the memory situation is good
 // It results in notifications of the good memory state to all plugins with an outstanding FreeMemory request
 void CGOomActionList::MemoryGood()
@@ -706,6 +738,7 @@
                 }
             else
                 {
+                iMonitor.SwitchMemMode(CMemoryMonitor::EGOomLowMemMode);
                 TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory);
                 iRunningKillAppActions = ETrue;
                 iMonitor.RunCloseAppActions(iMaxPriority);
@@ -751,6 +784,14 @@
         CGOomRunPlugin* action = CGOomRunPlugin::NewL(iPluginList->Uid(pluginIndex), pluginConfig, *this, iPluginList->Implementation(pluginIndex));
 
         iRunPluginActions.AppendL(action);
+        
+        CGOomRunPluginConfig * nextConfigForSamePlugin = pluginConfig.iNextConfig; 
+        while(nextConfigForSamePlugin)
+            {
+            CGOomRunPlugin* action = CGOomRunPlugin::NewL(iPluginList->Uid(pluginIndex), *(nextConfigForSamePlugin), *this, iPluginList->Implementation(pluginIndex));
+            iRunPluginActions.AppendL(action);
+            nextConfigForSamePlugin = nextConfigForSamePlugin->iNextConfig; 
+            }
         }
 
 	//references to v2 plugin types removed as these are not yet used by GOOM
--- a/uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -153,6 +153,7 @@
     // Start a timer and the thread watcher 
     iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing);
     iAppCloseTimer->After(iCloseTimeout * 1000);
+    iAppCloseWatcher->Start(iCurrentTask);
     // Tell the app to close
 	// We are not asking system applications to exit anyway, so we'll send legacy event only
 	// even we have powermgmt capability 
@@ -184,7 +185,8 @@
         }
         
     if(IsConsumingMemory(iWgId))    
-        {    
+        {
+        TRACES1("REST IN PEACE - App wgid %d", iWgId);
         iCurrentTask.KillTask();
         iAppCloserRunning = EFalse; // not sure if intended (?)
         iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled);
@@ -192,9 +194,10 @@
         }
     else
         { // application has released its graphics resources -> we are no more interested about it
-        CloseAppEvent();
+        //CloseAppEvent();
+        iAppCloserRunning = EFalse; 
+        MemoryFreed(KErrNone);
         }    
-    //MemoryFreed(KErrNone);
     }
 
 void CGOomCloseApp::KillTaskWaitDone()
--- a/uiacceltk/hitchcock/goommonitor/src/goomconfig.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomconfig.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -75,7 +75,12 @@
     CGOomRunPluginConfig** runPluginConfig = iPluginToConfigMapping.Find(aPluginConfig->Id());
     if (runPluginConfig)
         {
-        GOomMonitorPanic(KPluginConfigAddedTwice);
+        //GOomMonitorPanic(KPluginConfigAddedTwice);
+        while((*runPluginConfig)->iNextConfig != NULL)
+            *runPluginConfig = (*runPluginConfig)->iNextConfig;
+        
+        (*runPluginConfig)->iNextConfig = aPluginConfig;
+        return;
         }
     
     iPluginToConfigMapping.InsertL(aPluginConfig->Id(), aPluginConfig);
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -253,7 +253,17 @@
         {
         return;
         }
-    iForegroundAppUid = aForegroundAppUid;    
+    
+    if(iForegroundAppUid != aForegroundAppUid)
+        {
+        iForegroundAppUid = aForegroundAppUid;
+        iForegroundAppHasChanged = ETrue;
+        iRendswitched = 0;
+        }
+    else
+        {
+        iForegroundAppHasChanged = EFalse;
+        }
 
     // Refresh the low and good memory thresholds as they may have changed due to the new foreground application
     RefreshThresholds(aForegroundAppUid);
@@ -325,31 +335,59 @@
     // Run the memory freeing actions
     iGOomActionList->FreeMemory(aMaxPriority);
     
-    SwitchMemMode(EGOomLowMemMode);
     }
 
 void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode)
     {
     if(iMemMode == aMemMode)
+        {
+        if(iMemMode == EGOomGoodMemMode)
+            {
+            TRACES("CMemoryMonitor::SwitchMemMode NOT switching rendering mode. Already in GOOD Mode");
+            }
+        else
+            {
+            TRACES("CMemoryMonitor::SwitchMemMode NOT switching rendering mode. Already in LOW Mode");
+            }
         return;
+        }
 
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS    
     TWsEvent event;
  
     if(aMemMode == EGOomLowMemMode)
         {
+        if(iRendswitched < 3)
+            iRendswitched ++;
+        else
+            return;
+        
         iLowOnMemWgs.Reset();
         iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs);
         event.SetType(KGoomMemoryLowEvent);
+        TRACES("CMemoryMonitor::SwitchMemMode. Switching rendering mode to SW, Sending KGoomMemoryLowEvent");
         }
     else
         {
+        if(iRendswitched > 0)
+            {
+            if(iRendswitched < 3)
+                iRendswitched ++;
+            else
+                {
+                TRACES("CMemoryMonitor::SwitchMemMode GOOM Detected SW-HW-SW looping. NOT switching to HW rendering mode");
+                return;
+                }
+            }
+    
         event.SetType(KGoomMemoryGoodEvent);
+        TRACES("CMemoryMonitor::SwitchMemMode. Switching rendering mode to HW, Sending KGoomMemoryGoodEvent");
         }
     
     for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--)
         {
         iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event);
+        TRACES1("CMemoryMonitor::SwitchMemMode. Sending event to wg %d",iLowOnMemWgs[i]);
         }
 #endif
     
@@ -612,6 +650,7 @@
 
 	/* Allocate room for the profiling data */
 	prof_data = (EGLint*)User::Alloc(data_count * sizeof(EGLint));
+	TRACES("eglQueryProfilingData - alloc for data done");
 	if (prof_data == NULL)
 	    {
     	TRACES1("eglQueryProfilingData - could not alloc: %d", data_count * sizeof(EGLint));	
@@ -625,7 +664,9 @@
 							 prof_data,
 							 data_count,
 							 &data_count);
-
+	
+	TRACES("eglQueryProfilingData - profiling data acquired");
+	
 	/* Iterate over the returned data */
 	while (i < data_count)
 		{
--- a/uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -53,10 +53,13 @@
 		TInt flags = KGOomUseSwRendering;
         iPlugin.FreeRam(aBytesRequested, flags);
         iFreeMemoryWithSwRenderingCalled = ETrue;
+        TRACES("CGOomRunPlugin::FreeMemory: UseSwRendering TRUE");
         }
     else
         {
         iPlugin.FreeRam(aBytesRequested, 0);
+        iFreeMemoryWithSwRenderingCalled = EFalse;
+        TRACES("CGOomRunPlugin::FreeMemory: UseSwRendering FALSE");
         }
 
     iFreeMemoryCalled = ETrue;
--- a/uiacceltk/hitchcock/goommonitor/src/goomrunpluginconfig.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomrunpluginconfig.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -42,6 +42,7 @@
 CGOomRunPluginConfig::~CGOomRunPluginConfig()
     {
     FUNC_LOG;
+    delete iNextConfig;
     }
     
 
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -231,6 +231,7 @@
                     processIds.Close();
                     privMemUsed.Close();
                     TRACES("Only WServ using GFX mem, no need for app actions");
+                    iWgIds.Reset();
                     return;
                     }
                 }
--- a/uiacceltk/hitchcock/group/bld.inf	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/group/bld.inf	Wed Aug 18 10:42:48 2010 +0300
@@ -12,11 +12,15 @@
 * Contributors:
 *
 * Description:   Build information file for project alfappserver
-*  Version     : %version: tr1sido#128.1.10 %
+*  Version     : %version: tr1sido#128.1.12 %
 *
 */
 
-
+#ifndef ALF_USE_OPENWF_COMPOSITION
+#ifdef SYMBIAN_GRAPHICS_BUILD_OPENWF_WSERV
+#define ALF_USE_OPENWF_COMPOSITION
+#endif
+#endif
 
 PRJ_PLATFORMS
 DEFAULT
--- a/uiacceltk/hitchcock/plugins/alfoogmplugin/src/alfoogmplugin.cpp	Tue Jul 06 15:18:10 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alfoogmplugin/src/alfoogmplugin.cpp	Wed Aug 18 10:42:48 2010 +0300
@@ -51,7 +51,7 @@
 //
 CAlfOogmMonitorPlugin::~CAlfOogmMonitorPlugin()
     {
-    
+    iAlfDirectClient.Disconnect();
     }
 
 // -----------------------------------------------------------------------------
@@ -90,10 +90,16 @@
 //
 TAny* CreatePlugin()
     {
-    CAlfOogmMonitorPlugin* plugin = new(ELeave) CAlfOogmMonitorPlugin;
-    CleanupStack::PushL(plugin);
-    plugin->ConstructL();
-    CleanupStack::Pop(plugin);
+    CAlfOogmMonitorPlugin* plugin = new CAlfOogmMonitorPlugin;
+    if ( plugin )
+        {
+        TRAPD( err, plugin->ConstructL() );
+        if ( err != KErrNone )
+            {
+            delete plugin;
+            plugin = NULL;
+            }
+        }
     return plugin;
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/uiacceltk/rom/bld.inf	Wed Aug 18 10:42:48 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* Copyright (c) 2006 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:   Build information file for UI Accelerator Toolkit ROM
+*
+*/
+
+
+#include <bldvariant.hrh>
+#include <platform_paths.hrh>
+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