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