uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
changeset 53 5ba07f7750a9
parent 46 180438f24a1e
equal deleted inserted replaced
46:180438f24a1e 53:5ba07f7750a9
   234     TInt oldcount = iActionRefs.Count();
   234     TInt oldcount = iActionRefs.Count();
   235     
   235     
   236     if (aWindowGroupList.Count())
   236     if (aWindowGroupList.Count())
   237             {
   237             {
   238             // Go through each item in the wglist, create an app close action for this application
   238             // Go through each item in the wglist, create an app close action for this application
   239             TInt wgIndex = aWindowGroupList.Count() - 1;
   239             TInt wgIndex = 0;
   240             
   240             
   241             TRACES1("BuildActionListL: Windowgroup list count %d ",aWindowGroupList.Count());
   241             TRACES1("BuildActionListL: Windowgroup list count %d ",aWindowGroupList.Count());
   242     
   242     
   243             // Fix for when fast swap has focus, or pen input server has put itself into the foreground:
   243             // Fix for when fast swap has focus, or pen input server has put itself into the foreground:
   244             // the wg at index 1 should be considered as the foreground app.
   244             // the wg at index 1 should be considered as the foreground app.
   245             // stopIndex is calculated to take this into account.
   245             // stopIndex is calculated to take this into account.
   246             TUid foregroundUid = TUid::Uid(iMonitor.ForegroundAppUid());
   246             TUid foregroundUid = TUid::Uid(iMonitor.ForegroundAppUid());
   247     
   247     
   248             TRACES1("BuildActionListL: Foreground App %x ", foregroundUid);
   248             TRACES1("BuildActionListL: Foreground App %x ", foregroundUid);
   249             
   249             
   250             while (wgIndex >= 0)
   250             while (wgIndex < aWindowGroupList.Count())
   251                 {
   251                 {
   252                 CGOomCloseAppConfig* appCloseConfig = NULL;
   252                 CGOomCloseAppConfig* appCloseConfig = NULL;
   253     
   253     
   254                 // Get the app ID for the wglist item
   254                 // Get the app ID for the wglist item
   255                 // This sets the window group name
   255                 // This sets the window group name
   256                 TInt32 appId = aWindowGroupList.AppId(wgIndex, ETrue);
   256                 TInt32 appId = aWindowGroupList.AppId(wgIndex, ETrue);
   257                 
   257                 
   258                 if(AppCloseActionAlreadyExists(aWindowGroupList, appId))
   258                 if(AppCloseActionAlreadyExists(aWindowGroupList, appId))
   259                     {
   259                     {
   260                     wgIndex--;
   260                     TRACES2("CGOomActionList::BuildKillAppActionListL - Action item already exists for this app %x wgid %d", appId, aWindowGroupList.WgId(wgIndex).iId)
       
   261                     wgIndex++;
   261                     continue;
   262                     continue;
   262                     }
   263                     }
   263                     
   264                     
   264                 CApaWindowGroupName* wgName = aWindowGroupList.WgName();
   265                 CApaWindowGroupName* wgName = aWindowGroupList.WgName();
   265                 __ASSERT_DEBUG(wgName, GOomMonitorPanic(KInvalidWgName));
   266                 __ASSERT_DEBUG(wgName, GOomMonitorPanic(KInvalidWgName));
   317                         User::Leave(err);
   318                         User::Leave(err);
   318                         }
   319                         }
   319                     TRACES3("BuildActionListL: Adding app to action list, Uid = %x, wgId = %d, wgIndex = %d", appId, wgId, wgIndex);
   320                     TRACES3("BuildActionListL: Adding app to action list, Uid = %x, wgId = %d, wgIndex = %d", appId, wgId, wgIndex);
   320                     }
   321                     }
   321     
   322     
   322                 wgIndex--;
   323                 wgIndex++;
   323                 }
   324                 }
   324             }
   325             }
   325             
   326             
   326         TRACES1("BuildActionListL: Action list built with %d  new items",iActionRefs.Count()- oldcount);
   327         TRACES1("BuildActionListL: Action list built with %d  new items",iActionRefs.Count()- oldcount);
   327     }    
   328     }    
   660 
   661 
   661 void CGOomActionList::AppNotExiting(TInt aWgId)
   662 void CGOomActionList::AppNotExiting(TInt aWgId)
   662     {
   663     {
   663     FUNC_LOG;
   664     FUNC_LOG;
   664 
   665 
   665     TInt index = iCloseAppActions.Count();
   666     TInt index = 0;
   666     TRACES1("CGOomCloseApp::AppNotExiting: count of actions %d",index);
   667 
   667 
   668     while (index < iCloseAppActions.Count())
   668     while (index--)
       
   669         {
   669         {
   670         CGOomCloseApp* action = iCloseAppActions[index];
   670         CGOomCloseApp* action = iCloseAppActions[index];
   671         TRACES3("CGOomCloseApp::AppNotExiting: %d %d %d", aWgId, action->WgId(), action->IsRunning());
   671         TRACES3("CGOomCloseApp::AppNotExiting: recvd from %d , checking against %d , isRunning %d", aWgId, action->WgId(), action->IsRunning());
   672         
   672         
   673         if ( (action->WgId() == aWgId) && (action->IsRunning()) )
   673         if ( (action->WgId() == aWgId) && (action->IsRunning()) )
   674             {
   674             {
   675             TRACES1("CGOomCloseApp::AppNotExiting: App with window group id %d has not responded to the close event", aWgId);
   675             TRACES1("CGOomCloseApp::AppNotExiting: App with window group id %d has responded to the close event", aWgId);
   676             action->CloseAppEvent();
   676             action->CloseAppEvent();
   677             }
   677             break;
       
   678             }
       
   679         
       
   680         index++;
   678         }
   681         }
   679     }
   682     }
   680 
   683 
   681 // From MGOomActionObserver
   684 // From MGOomActionObserver
   682 // An action has changed state (possibly it has completed freeing memory)
   685 // An action has changed state (possibly it has completed freeing memory)