201023_01
authorhgs
Wed, 09 Jun 2010 11:48:49 +0300
changeset 32 27a3ad0677c1
parent 31 1b6909418757
child 38 69409653e863
201023_01
uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h
uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
--- a/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Tue Jun 08 13:16:48 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Wed Jun 09 11:48:49 2010 +0300
@@ -91,7 +91,7 @@
             }
         }
 
-    
+    TInt FindParentIdL(TInt aWgId);    
     
 private:    
 
@@ -99,7 +99,6 @@
     
     void RemovePropertiesForClosedWindowsL();
 
-    TInt FindParentIdL(TInt aWgId);
 
 private:
     
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Tue Jun 08 13:16:48 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Wed Jun 09 11:48:49 2010 +0300
@@ -363,12 +363,45 @@
             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);
                 
                 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)
+                {
+                iCurrentActionIndex++;
                 continue;
                 }
             }