taskswitcher/taskswitcherui/taskswitcherapp/src/tsappui.cpp
branchRCL_3
changeset 12 9674c1a575e9
parent 11 ff572dfe6d86
child 17 b8fae6b8a148
equal deleted inserted replaced
11:ff572dfe6d86 12:9674c1a575e9
    55 const TInt KAppKeyTypeLong = 2;
    55 const TInt KAppKeyTypeLong = 2;
    56 
    56 
    57 //values for checking the OOM
    57 //values for checking the OOM
    58 const TInt KMemoryRequestAmountInBytes = 524288;
    58 const TInt KMemoryRequestAmountInBytes = 524288;
    59 const TInt KMinMemoryAmountInBytes = 524288;
    59 const TInt KMinMemoryAmountInBytes = 524288;
    60 const TInt KMemoryToBeReservedInBytes = 524288; // 512 KB
       
    61 
    60 
    62 // time to wait before sending the task to background
    61 // time to wait before sending the task to background
    63 // (must give time to animation)
    62 // (must give time to animation)
    64 const TInt KWaitBeforeGoingToBackground = 100000;
    63 const TInt KWaitBeforeGoingToBackground = 100000;
    65 
    64 
   188         RemoveFromStack( iAppView );
   187         RemoveFromStack( iAppView );
   189         delete iAppView;
   188         delete iAppView;
   190         }
   189         }
   191 
   190 
   192     delete iDeviceState;
   191     delete iDeviceState;
   193     delete iMemAllocBuf;
       
   194     delete iThemeEffectsEnabledWatcher;
   192     delete iThemeEffectsEnabledWatcher;
   195     
   193     
   196     iWg.Close();
   194     iWg.Close();
   197     }
   195     }
   198 
   196 
   263 
   261 
   264 // -----------------------------------------------------------------------------
   262 // -----------------------------------------------------------------------------
   265 // CTsAppUi::TransitionFinished
   263 // CTsAppUi::TransitionFinished
   266 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
   267 //
   265 //
   268 void CTsAppUi::TransitionFinished(const CCoeControl* /*aControl*/, 
   266 void CTsAppUi::TransitionFinished(const CCoeControl* aControl, 
   269                                   TUint /*aAction*/)
   267                                   TUint /*aAction*/)
   270     {
   268     {
   271     TRAP_IGNORE( DisablePopUpL() );
   269     if ( aControl == iAppView )
       
   270         {
       
   271         TRAP_IGNORE( DisablePopUpL() );
       
   272         }
   272     }
   273     }
   273 
   274 
   274 // -----------------------------------------------------------------------------
   275 // -----------------------------------------------------------------------------
   275 // CTsAppUi::HandleCommandL()
   276 // CTsAppUi::HandleCommandL()
   276 // Takes care of command handling.
   277 // Takes care of command handling.
   524     if( iForeground  )  
   525     if( iForeground  )  
   525         {
   526         {
   526         iForeground = EFalse;
   527         iForeground = EFalse;
   527         SetTaskswitcherStateProperty( KTaskswitcherBackgroundValue );
   528         SetTaskswitcherStateProperty( KTaskswitcherBackgroundValue );
   528 
   529 
   529         //allocating extra memory space
       
   530         if ( !iMemAllocBuf )
       
   531             {
       
   532             iMemAllocBuf =
       
   533                 (TUint8*) User::Alloc( KMemoryToBeReservedInBytes );
       
   534             }
       
   535 
       
   536         // notify view
   530         // notify view
   537         iAppView->HandleSwitchToBackgroundEvent();
   531         iAppView->HandleSwitchToBackgroundEvent();
   538         }
   532         }
   539 
   533 
   540     TSLOG_OUT();
   534     TSLOG_OUT();
   550     TSLOG_IN();
   544     TSLOG_IN();
   551 
   545 
   552     // must not do anything if iForeground is already up-to-date
   546     // must not do anything if iForeground is already up-to-date
   553     if ( !iForeground )
   547     if ( !iForeground )
   554         {
   548         {
   555         //freeing extra memory space
       
   556         delete iMemAllocBuf;
       
   557         iMemAllocBuf = NULL;
       
   558 
       
   559         TInt freeRamMemory;
   549         TInt freeRamMemory;
   560         HAL::Get( HALData::EMemoryRAMFree, freeRamMemory );
   550         HAL::Get( HALData::EMemoryRAMFree, freeRamMemory );
   561         if ( freeRamMemory <= KMinMemoryAmountInBytes )
   551         if ( freeRamMemory <= KMinMemoryAmountInBytes )
   562             {
   552             {
   563             FreeMemoryRequest();
   553             FreeMemoryRequest();