taskswitcher/teleportui/hgteleportapp/src/hgteleportappui.cpp
changeset 4 4d54b72983ae
parent 3 fb3763350a08
child 5 c743ef5928ba
equal deleted inserted replaced
3:fb3763350a08 4:4d54b72983ae
     1 /*
       
     2  * ============================================================================
       
     3  *  Name        : hgteleportappui.cpp
       
     4  *  Part of     : Hg Teleport
       
     5  *  Description : AppUi class
       
     6  *  Version     : %version: sa1spcx1#55 %
       
     7  *
       
     8  *  Copyright © 2008 Nokia.  All rights reserved.
       
     9  *  This material, including documentation and any related computer
       
    10  *  programs, is protected by copyright controlled by Nokia.  All
       
    11  *  rights are reserved.  Copying, including reproducing, storing,
       
    12  *  adapting or translating, any or all of this material requires the
       
    13  *  prior written consent of Nokia.  This material also contains
       
    14  *  confidential information which may not be disclosed to others
       
    15  *  without the prior written consent of Nokia.
       
    16  * ============================================================================
       
    17  *
       
    18  */
       
    19 
       
    20 #include "hgteleportappui.h"
       
    21 #include "hgteleportappview.h"
       
    22 #include "hgteleportapplogging.h"
       
    23 #include "hgteleportdevicestate.h"
       
    24 #include "hgteleportuid.hrh"
       
    25 #include "hgteleportcommands.hrh"
       
    26 #include <akntitle.h>
       
    27 #include <hlplch.h>
       
    28 #include <avkon.rsg>
       
    29 #include <bautils.h>
       
    30 #include <AknUtils.h>
       
    31 #include <hgteleport.rsg>
       
    32 #include <pslninternalcrkeys.h>
       
    33 #include <oommonitorsession.h>
       
    34 #include <hal.h>
       
    35 #include <hal_data.h>
       
    36 #include <akntranseffect.h>
       
    37 
       
    38 
       
    39 // AknCapServer UID, used for P&S category
       
    40 const TUid KTeleportStateCategory = { 0x10207218 };
       
    41 
       
    42 // Teleport UI, used as P&S key
       
    43 const TInt KTeleportStateKey = KHgTeleportAppUidValue;
       
    44 
       
    45 // Values for Teleport launching P&S
       
    46 const TInt KTeleportBackgroundValue = 1;
       
    47 const TInt KTeleportForegroundValue = KTeleportBackgroundValue << 1;
       
    48 const TInt KTeleportShortAppKeyPressed = KTeleportForegroundValue << 1;
       
    49 const TInt KTeleportLongAppKeyPressed = KTeleportShortAppKeyPressed << 1;
       
    50 
       
    51 //short/long App key values 
       
    52 const TInt KAppKeyTypeShort = 1;
       
    53 const TInt KAppKeyTypeLong = 2;
       
    54 
       
    55 //values for checking the OOM
       
    56 const TInt KMemoryRequestAmountInBytes = 524288;
       
    57 const TInt KMinMemoryAmountInBytes = 524288;
       
    58 const TInt KMemoryToBeReservedInBytes = 524288; // 512 KB
       
    59 
       
    60 // time to wait before sending the task to background
       
    61 // (must give time to animation)
       
    62 const TInt KWaitBeforeGoingToBackground = 100000;
       
    63 
       
    64 // -----------------------------------------------------------------------------
       
    65 // CHgTeleportAppUi::ConstructL()
       
    66 // ConstructL is called by the application framework
       
    67 // -----------------------------------------------------------------------------
       
    68 //
       
    69 void CHgTeleportAppUi::ConstructL()
       
    70     {
       
    71     HGLOG_CONTEXT( CHgTeleportAppUi::ConstructL, HGLOG_LOCAL );
       
    72     HGLOG_IN();
       
    73 
       
    74 #ifdef _DEBUG
       
    75     // create log folder
       
    76 	_LIT( KLogPath, "c:\\logs\\teleport\\" );
       
    77 	RFs fs;
       
    78 	if ( fs.Connect() == KErrNone )
       
    79 		{
       
    80 		fs.MkDirAll( KLogPath );
       
    81 		fs.Close();
       
    82 		}
       
    83 #endif
       
    84 
       
    85     // Initialise app UI with standard value.
       
    86     BaseConstructL( CAknAppUi::EAknEnableSkin | CAknAppUi::EAknEnableMSK );
       
    87 
       
    88 #ifndef _DEBUG
       
    89     // set as system application (in release build) so we never get closed
       
    90     iEikonEnv->SetSystem( ETrue );
       
    91 #endif
       
    92 
       
    93     //Initialize effects change observation
       
    94     iThemeEffectsEnabledWatcher =
       
    95         CHgCenrepListener::NewL( KCRUidThemes, KThemesTransitionEffects, *this );
       
    96     CenrepChanged( KThemesTransitionEffects, iThemeEffectsEnabledWatcher->Value() );
       
    97     
       
    98     // Hide status pane
       
    99     StatusPane()->MakeVisible( EFalse );
       
   100 
       
   101     // Change CBA if needed, default is non-touch in rss
       
   102     if ( AknLayoutUtils::PenEnabled() )
       
   103         {
       
   104         Cba()->SetCommandSetL( R_HGTELEPORT_CBA_TOUCH );
       
   105         }
       
   106     Cba()->MakeVisible(EFalse);
       
   107 
       
   108     // Create timer
       
   109     iGoToBackgroundTimer = CPeriodic::NewL( CActive::EPriorityStandard );
       
   110 
       
   111     // Create commonly used instances (device state only?)
       
   112     iDeviceState = CHgTeleportDeviceState::NewL();
       
   113 
       
   114     // Create UI
       
   115     iAppView = CHgTeleportAppView::NewL( ApplicationRect(), *iDeviceState );
       
   116     AddToStackL( iAppView );
       
   117     
       
   118     //Enable effects
       
   119     GfxTransEffect::Enable();
       
   120     GfxTransEffect::Register(iAppView,TUid::Uid(KHgTeleportAppUidValue));
       
   121     GfxTransEffect::SetTransitionObserver(this);
       
   122 
       
   123     // Listen for change in the value of the teleport state property.
       
   124     iPropListener = new ( ELeave ) CHgPropertyListener(
       
   125             KTeleportStateCategory, KTeleportStateKey, *this );
       
   126 
       
   127     // Initialise the application task object with the window group id of
       
   128     // our application ( so that it represent our app )
       
   129     iApplicationTask.SetWgId( iCoeEnv->RootWin().Identifier() );
       
   130 
       
   131     // And finally, go to background.
       
   132     MoveAppToBackground( AknTransEffect::ENone );
       
   133 
       
   134     HGLOG_OUT();
       
   135     }
       
   136 
       
   137 // -----------------------------------------------------------------------------
       
   138 // CHgTeleportAppUi::CHgTeleportAppUi()
       
   139 // Perform the first phase of two phase construction
       
   140 // -----------------------------------------------------------------------------
       
   141 //
       
   142 CHgTeleportAppUi::CHgTeleportAppUi(): iForeground( ETrue ),
       
   143                                       iApplicationTask( iCoeEnv->WsSession() )
       
   144     {
       
   145     // no implementation required
       
   146     }
       
   147 
       
   148 // -----------------------------------------------------------------------------
       
   149 // CHgTeleportAppUi::~CHgTeleportAppUi()
       
   150 // Destructor
       
   151 // -----------------------------------------------------------------------------
       
   152 //
       
   153 CHgTeleportAppUi::~CHgTeleportAppUi()
       
   154     {
       
   155     if( GfxTransEffect::IsRegistered( iAppView ) )
       
   156         {
       
   157         GfxTransEffect::Deregister(iAppView);
       
   158         
       
   159         }
       
   160     GfxTransEffect::SetTransitionObserver(0);
       
   161     
       
   162     delete iGoToBackgroundTimer;
       
   163     delete iPropListener;
       
   164 
       
   165     // destroy UI first
       
   166     if ( iAppView )
       
   167         {
       
   168         RemoveFromStack( iAppView );
       
   169         delete iAppView;
       
   170         }
       
   171 
       
   172     delete iDeviceState;
       
   173     delete iMemAllocBuf;
       
   174     delete iThemeEffectsEnabledWatcher;
       
   175     }
       
   176 
       
   177 // -----------------------------------------------------------------------------
       
   178 // CHgTeleportAppView::EffectsEnabled
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 TBool CHgTeleportAppUi::EffectsEnabled() const
       
   182     {
       
   183     return iEffectsEnabled;
       
   184     }
       
   185 
       
   186 // -----------------------------------------------------------------------------
       
   187 // CHgTeleportAppUi::StartTransion
       
   188 // -----------------------------------------------------------------------------
       
   189 //
       
   190 void CHgTeleportAppUi::StartTransion( TUint aTransitionType )
       
   191     {
       
   192     if( !EffectsEnabled() )
       
   193         {
       
   194         return;
       
   195         }
       
   196     switch(aTransitionType)
       
   197         {
       
   198     case AknTransEffect::EApplicationStart:
       
   199         StartTransition( aTransitionType, 
       
   200                          ETrue, 
       
   201                          EFalse, 
       
   202                          CAknTransitionUtils::EForceVisible);
       
   203         break;
       
   204     case AknTransEffect::EApplicationExit:
       
   205         StartTransition( aTransitionType, 
       
   206                          EFalse, 
       
   207                          EFalse, 
       
   208                          CAknTransitionUtils::EForceInvisible );
       
   209         break;
       
   210     case AknTransEffect::EApplicationStartRect:
       
   211         StartTransition( aTransitionType, 
       
   212                          EFalse, 
       
   213                          ETrue, 
       
   214                          CAknTransitionUtils::EForceInvisible );
       
   215         break;
       
   216         }
       
   217     }
       
   218 
       
   219 // -----------------------------------------------------------------------------
       
   220 // CHgTeleportAppUi::StartTransition
       
   221 // -----------------------------------------------------------------------------
       
   222 //
       
   223 void CHgTeleportAppUi::StartTransition( TUint aTranstionId,
       
   224                                         TBool aVisibility,
       
   225                                         TBool aLayers, 
       
   226                                         TUint aSubCom )
       
   227     {
       
   228     const TDesC8* ptr = reinterpret_cast<const TDesC8*>(iAppView);
       
   229     GfxTransEffect::Abort(iAppView);
       
   230     GfxTransEffect::Begin( iAppView, aTranstionId );
       
   231     GfxTransEffect::SetDemarcation( iAppView, iAppView->Rect() );
       
   232     GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, ptr );
       
   233     iAppView->MakeVisible( aVisibility );
       
   234     CAknTransitionUtils::MakeVisibleSubComponents( 
       
   235         iAppView,
       
   236         static_cast<CAknTransitionUtils::TMakeVisibleSubComponentsInfo>(aSubCom) );
       
   237     GfxTransEffect::NotifyExternalState( ECaptureComponentsEnd, ptr );
       
   238     GfxTransEffect::End( iAppView );
       
   239     }
       
   240 
       
   241 // -----------------------------------------------------------------------------
       
   242 // CHgTeleportAppUi::TransitionFinished
       
   243 // -----------------------------------------------------------------------------
       
   244 //
       
   245 void CHgTeleportAppUi::TransitionFinished(const CCoeControl* aControl, 
       
   246                                           TUint aAction)
       
   247     {
       
   248     /*if( aControl == iAppView )
       
   249         {
       
   250 		@TODO IMPLEMENT
       
   251         }*/
       
   252     }
       
   253 
       
   254 // -----------------------------------------------------------------------------
       
   255 // CHgTeleportAppUi::HandleCommandL()
       
   256 // Takes care of command handling.
       
   257 // -----------------------------------------------------------------------------
       
   258 //
       
   259 void CHgTeleportAppUi::HandleCommandL( TInt aCommand )
       
   260     {
       
   261     switch ( aCommand )
       
   262         {
       
   263         case EAknCmdExit:
       
   264         case EEikCmdExit:
       
   265             Exit();
       
   266             break;
       
   267 
       
   268         case EAknSoftkeyExit:
       
   269         case EAknSoftkeyBack:
       
   270             // RSK => just hide
       
   271             MoveAppToBackground( AknTransEffect::EApplicationExit );
       
   272             break;
       
   273 
       
   274         case EHgTeleportCmdHelp:
       
   275             {
       
   276             MoveAppToBackground( AknTransEffect::EApplicationExit );
       
   277             CArrayFix<TCoeHelpContext>* buf = CCoeAppUi::AppHelpContextL();
       
   278             HlpLauncher::LaunchHelpApplicationL( iCoeEnv->WsSession(), buf );
       
   279             }
       
   280             break;
       
   281 
       
   282         case EAknSoftkeySelect:
       
   283             {
       
   284             // select is generated by lsk and msk (see the resource file)
       
   285             // Simulate a middle key press to the controls.
       
   286             // Note that SimulateKeyEventL must not be used here or else it
       
   287             // will end up in an infinite loop.
       
   288             TKeyEvent keyEvent;
       
   289             keyEvent.iCode = EKeyOK;
       
   290             keyEvent.iScanCode = EStdKeyDevice3;
       
   291             keyEvent.iModifiers = keyEvent.iRepeats = 0;
       
   292             iAppView->OfferKeyEventL( keyEvent, EEventKeyDown );
       
   293             iAppView->OfferKeyEventL( keyEvent, EEventKey );
       
   294             iAppView->OfferKeyEventL( keyEvent, EEventKeyUp );
       
   295             }
       
   296             break;
       
   297 
       
   298         default:
       
   299             break;
       
   300         }
       
   301     }
       
   302 
       
   303 // -----------------------------------------------------------------------------
       
   304 // CHgTeleportAppUi::HandleForegroundEventL
       
   305 // Called by the system when the app is moved to foreground or background.
       
   306 // -----------------------------------------------------------------------------
       
   307 //
       
   308 void CHgTeleportAppUi::HandleForegroundEventL( TBool aForeground )
       
   309     {
       
   310     HGLOG_CONTEXT( HandleForegroundEventL, HGLOG_LOCAL );
       
   311     HGLOG1_IN( "aForeground = %d", aForeground );
       
   312 
       
   313     // These calls may be redundant but the functions will do nothing if the
       
   314     // state has already been changed.
       
   315     // Both this function and the 'manual' MoveAppTo functions must fire the events
       
   316     // because in some cases only one of them will run (e.g. when bringing to foreground
       
   317     // not with the hw key but by other means etc.)
       
   318     if ( aForeground )
       
   319         {
       
   320         HandleSwitchToForegroundEvent();
       
   321         }
       
   322     else
       
   323         {
       
   324         HandleSwitchToBackgroundEvent();
       
   325         }
       
   326 
       
   327     // Call Base class method
       
   328     CAknAppUi::HandleForegroundEventL( aForeground );
       
   329 
       
   330     HGLOG_OUT();
       
   331     }
       
   332 
       
   333 // -----------------------------------------------------------------------------
       
   334 // CHgTeleportAppUi::PropertyChanged
       
   335 // -----------------------------------------------------------------------------
       
   336 //
       
   337 void CHgTeleportAppUi::PropertyChanged( TUid aCategory, TUint aKey )
       
   338     {
       
   339     HGLOG_CONTEXT( PropertyChanged, HGLOG_LOCAL );
       
   340     HGLOG_IN();
       
   341 
       
   342     TInt value( 0 );
       
   343 
       
   344     if ( RProperty::Get( aCategory, aKey, value ) == KErrNone )
       
   345         {
       
   346         if ( iForeground && (value & KTeleportBackgroundValue) )
       
   347             {
       
   348             MoveAppToBackground( AknTransEffect::EApplicationExit );
       
   349             }
       
   350         else if ( !iForeground && (value & KTeleportForegroundValue) )
       
   351             {
       
   352             MoveAppToForeground( AknTransEffect::EApplicationStart );
       
   353             }
       
   354         else if( value & KTeleportLongAppKeyPressed )
       
   355             {
       
   356             if(!iForeground)
       
   357                 {
       
   358                 MoveAppToBackground( AknTransEffect::EApplicationExit );
       
   359                 }
       
   360             else
       
   361                 {
       
   362                 iAppView->HandleAppKey(KAppKeyTypeLong);
       
   363                 }
       
   364             }
       
   365         else if(  value & KTeleportShortAppKeyPressed )
       
   366             {
       
   367             iAppView->HandleAppKey(KAppKeyTypeShort);
       
   368             }
       
   369         }
       
   370 
       
   371     HGLOG_OUT();
       
   372     }
       
   373 
       
   374 // -----------------------------------------------------------------------------
       
   375 // CHgTeleportAppUi::HandleResourceChangeL
       
   376 // -----------------------------------------------------------------------------
       
   377 //
       
   378 void CHgTeleportAppUi::HandleResourceChangeL( TInt aType )
       
   379     {
       
   380     // Must call base class implementation first,
       
   381     // sizes from LayoutMetricsRect etc. will only be correct after this.
       
   382     CAknAppUi::HandleResourceChangeL( aType );
       
   383     if( aType == KEikDynamicLayoutVariantSwitch && iAppView )
       
   384         {
       
   385         iAppView->SetRect( ApplicationRect() );
       
   386         }
       
   387     // forward event
       
   388     iDeviceState->HandleResourceChange( aType );
       
   389     iAppView->HandleResourceChange( aType );
       
   390     }
       
   391 
       
   392 // -----------------------------------------------------------------------------
       
   393 // CHgTeleportAppUi::MoveAppToBackground()
       
   394 // -----------------------------------------------------------------------------
       
   395 //
       
   396 void CHgTeleportAppUi::MoveAppToBackground( TUint aTransitionType )
       
   397     {
       
   398     HGLOG_CONTEXT( MoveAppToBackground, HGLOG_LOCAL );
       
   399     HGLOG_IN();
       
   400 
       
   401     if ( AknTransEffect::ENone == aTransitionType || !EffectsEnabled() )
       
   402         {
       
   403         GoToBackgroundTimerCallback( this );
       
   404         }
       
   405     else
       
   406         {
       
   407         StartTransion(AknTransEffect::EApplicationExit);
       
   408         iGoToBackgroundTimer->Cancel();
       
   409         iGoToBackgroundTimer->Start( 
       
   410                 KWaitBeforeGoingToBackground, 
       
   411                 0,
       
   412                 TCallBack( GoToBackgroundTimerCallback, this ) );
       
   413         }
       
   414     HGLOG_OUT();
       
   415     }
       
   416 
       
   417 // -----------------------------------------------------------------------------
       
   418 // CHgTeleportAppUi::CenrepChanged
       
   419 // -----------------------------------------------------------------------------
       
   420 //
       
   421 void CHgTeleportAppUi::CenrepChanged( TUint32 aKey, TInt aNewValue )
       
   422     {
       
   423     iEffectsEnabled = !(aNewValue & AknTransEffect::EFullScreenTransitionsOff);
       
   424     }
       
   425 
       
   426 // -----------------------------------------------------------------------------
       
   427 // CHgTeleportAppUi::GoToBackgroundTimerCallback
       
   428 // -----------------------------------------------------------------------------
       
   429 //
       
   430 TInt CHgTeleportAppUi::GoToBackgroundTimerCallback( TAny* aParam )
       
   431     {
       
   432     CHgTeleportAppUi* self = static_cast<CHgTeleportAppUi*>( aParam );
       
   433     if ( self->iGoToBackgroundTimer )
       
   434         {
       
   435         self->iGoToBackgroundTimer->Cancel();
       
   436         }
       
   437 
       
   438     // Request window server to bring our application
       
   439     // to background
       
   440     self->iApplicationTask.SendToBackground();
       
   441 
       
   442     // Notify
       
   443     self->HandleSwitchToBackgroundEvent();
       
   444 
       
   445     return 0;
       
   446     }
       
   447 
       
   448 // -----------------------------------------------------------------------------
       
   449 // CHgTeleportAppUi::MoveAppToForeground()
       
   450 // -----------------------------------------------------------------------------
       
   451 //
       
   452 void CHgTeleportAppUi::MoveAppToForeground( TUint  /*aTransitionType*/ )
       
   453     {
       
   454     HGLOG_CONTEXT( MoveAppToForeground, HGLOG_LOCAL );
       
   455     HGLOG_IN();
       
   456 
       
   457     // Request window server to bring our application
       
   458     // to foreground
       
   459     iApplicationTask.BringToForeground();
       
   460 
       
   461     // Notify
       
   462     HandleSwitchToForegroundEvent();
       
   463 
       
   464     HGLOG_OUT();
       
   465     }
       
   466 
       
   467 // -----------------------------------------------------------------------------
       
   468 // CHgTeleportAppUi::HandleSwitchToBackgroundEvent
       
   469 // -----------------------------------------------------------------------------
       
   470 //
       
   471 void CHgTeleportAppUi::HandleSwitchToBackgroundEvent()
       
   472     {
       
   473     HGLOG_CONTEXT( HandleSwitchToBackgroundEvent, HGLOG_LOCAL );
       
   474     HGLOG_IN();
       
   475 
       
   476     // must not do anything if iForeground is already up-to-date
       
   477     // exclude cases with dialogs like power menu, memory card
       
   478     if( iForeground && !IsFaded() )  
       
   479         {
       
   480         iForeground = EFalse;
       
   481         SetTeleportStateProperty( KTeleportBackgroundValue );
       
   482 
       
   483         //allocating extra memory space
       
   484         if ( !iMemAllocBuf )
       
   485             {
       
   486             iMemAllocBuf =
       
   487                 (TUint8*) User::Alloc( KMemoryToBeReservedInBytes );
       
   488             }
       
   489 
       
   490         // notify view
       
   491         iAppView->HandleSwitchToBackgroundEvent();
       
   492         }
       
   493 
       
   494     HGLOG_OUT();
       
   495     }
       
   496 
       
   497 // -----------------------------------------------------------------------------
       
   498 // CHgTeleportAppUi::HandleSwitchToForegroundEvent
       
   499 // -----------------------------------------------------------------------------
       
   500 //
       
   501 void CHgTeleportAppUi::HandleSwitchToForegroundEvent()
       
   502     {
       
   503     HGLOG_CONTEXT( HandleSwitchToForegroundEvent, HGLOG_LOCAL );
       
   504     HGLOG_IN();
       
   505 
       
   506     // must not do anything if iForeground is already up-to-date
       
   507     if ( !iForeground )
       
   508         {
       
   509         //freeing extra memory space
       
   510         delete iMemAllocBuf;
       
   511         iMemAllocBuf = NULL;
       
   512 
       
   513         TInt freeRamMemory;
       
   514         HAL::Get( HALData::EMemoryRAMFree, freeRamMemory );
       
   515         if ( freeRamMemory <= KMinMemoryAmountInBytes )
       
   516             {
       
   517             FreeMemoryRequest();
       
   518             }
       
   519 
       
   520         iForeground = ETrue;
       
   521         SetTeleportStateProperty( KTeleportForegroundValue );
       
   522 
       
   523         // notify view
       
   524         iAppView->HandleSwitchToForegroundEvent();
       
   525         }
       
   526 
       
   527     HGLOG_OUT();
       
   528     }
       
   529 
       
   530 // -----------------------------------------------------------------------------
       
   531 // CHgTeleportAppUi::SetTeleportShowProperty
       
   532 // -----------------------------------------------------------------------------
       
   533 //
       
   534 void CHgTeleportAppUi::SetTeleportStateProperty( TInt aValue )
       
   535     {
       
   536     HGLOG_CONTEXT( CHgTeleportAppUi::SetTeleportShowProperty, HGLOG_LOCAL );
       
   537     HGLOG_IN();
       
   538 
       
   539     if ( RProperty::Set(
       
   540             KTeleportStateCategory, KTeleportStateKey, aValue ) != KErrNone )
       
   541         {
       
   542         TInt error = RProperty::Define(
       
   543                 KTeleportStateCategory, KTeleportStateKey, RProperty::EInt );
       
   544         if ( error != KErrNone )
       
   545             {
       
   546             HGLOG1( HGLOG_INFO, "RProperty::Define Error: %d", error );
       
   547             }
       
   548 
       
   549         error = RProperty::Set( KTeleportStateCategory, KTeleportStateKey, aValue );
       
   550         if ( error != KErrNone )
       
   551             {
       
   552             HGLOG1( HGLOG_INFO, "RProperty::Set Error: %d", error );
       
   553             }
       
   554         }
       
   555 
       
   556     HGLOG_OUT();
       
   557     }
       
   558 
       
   559 // -----------------------------------------------------------------------------
       
   560 // CHgTeleportAppUi::FreeMemoryRequest
       
   561 // -----------------------------------------------------------------------------
       
   562 //
       
   563 void CHgTeleportAppUi::FreeMemoryRequest()
       
   564     {
       
   565     HGLOG_CONTEXT( CHgTeleportAppUi::FreeMemoryRequest, HGLOG_LOCAL );
       
   566     HGLOG_IN();
       
   567     ROomMonitorSession oomMs;
       
   568     TInt error = oomMs.Connect();
       
   569     if ( error != KErrNone)
       
   570         {
       
   571         HGLOG1( HGLOG_INFO, "Could not connect to ROomMonitorSession, %d", error );
       
   572         }
       
   573     else
       
   574         {
       
   575         oomMs.RequestFreeMemory( KMemoryRequestAmountInBytes );
       
   576         oomMs.Close();
       
   577         }
       
   578     HGLOG_OUT();
       
   579     }
       
   580 
       
   581 
       
   582 // End of file