idlefw/src/idleint/aiuiidleintegration.cpp
branchRCL_3
changeset 14 15e4dd19031c
parent 11 bd874ee5e5e2
child 23 ace62b58f4b2
equal deleted inserted replaced
12:502e5d91ad42 14:15e4dd19031c
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 // System includes
    19 // System includes
       
    20 #include <startupdomainpskeys.h>
    20 #include <coeaui.h>
    21 #include <coeaui.h>
    21 #include <eikenv.h>
    22 #include <eikenv.h>
    22 #include <AknIncallBubbleNotify.h>
    23 #include <AknIncallBubbleNotify.h>
    23 #include <aknsoundsystem.h>
    24 #include <aknsoundsystem.h>
    24 #include <AknDef.h>
    25 #include <AknDef.h>
    25 #include <ctsydomainpskeys.h>
    26 #include <ctsydomainpskeys.h>
       
    27 #include <apgtask.h>
    26 
    28 
    27 // User includes
    29 // User includes
    28 #include <aisystemuids.hrh>
    30 #include <aisystemuids.hrh>
    29 #include <aiutility.h>
    31 #include <aiutility.h>
    30 #include <aipspropertyobserver.h>
    32 #include <aipspropertyobserver.h>
    63     {
    65     {
    64     delete iActiveIdleState;
    66     delete iActiveIdleState;
    65     
    67     
    66     delete iIncallBubble;
    68     delete iIncallBubble;
    67     
    69     
    68     Release( iCallStatusObserver );
    70     Release( iCallStatusObserver );       
       
    71     
       
    72     Release( iUiStartupStateObserver );
    69     }
    73     }
    70 
    74 
    71 // ----------------------------------------------------------------------------
    75 // ----------------------------------------------------------------------------
    72 // CAiUiIdleIntegrationImpl::CAiUiIdleIntegrationImpl()
    76 // CAiUiIdleIntegrationImpl::CAiUiIdleIntegrationImpl()
    73 // ----------------------------------------------------------------------------
    77 // ----------------------------------------------------------------------------
   117     iCallStatusObserver = AiUtility::CreatePSPropertyObserverL(          
   121     iCallStatusObserver = AiUtility::CreatePSPropertyObserverL(          
   118                             TCallBack( HandleCallEvent, this ),  
   122                             TCallBack( HandleCallEvent, this ),  
   119                                        KPSUidCtsyCallInformation, 
   123                                        KPSUidCtsyCallInformation, 
   120                                        KCTsyCallState );  
   124                                        KCTsyCallState );  
   121     
   125     
   122     ActivateUI();
   126     iUiStartupStateObserver = AiUtility::CreatePSPropertyObserverL(                           
   123            
   127                                 TCallBack( HandleUiStartupStateChange, this ),            
       
   128                                            KPSUidStartup, 
       
   129                                            KPSStartupUiPhase );        
       
   130     
       
   131     HandleUiStartupStateChange( this );
       
   132                  
   124     __TIME_ENDMARK( "CAiUiIdleIntegrationImpl::ConstructL, done", time );
   133     __TIME_ENDMARK( "CAiUiIdleIntegrationImpl::ConstructL, done", time );
   125     }
   134     }
   126 
   135 
   127 // ----------------------------------------------------------------------------
   136 // ----------------------------------------------------------------------------
   128 // CAiUiIdleIntegrationImpl::ActivateUI()
   137 // CAiUiIdleIntegrationImpl::ActivateUI()
   129 // ----------------------------------------------------------------------------
   138 // ----------------------------------------------------------------------------
   130 //
   139 //
   131 void CAiUiIdleIntegrationImpl::ActivateUI()
   140 void CAiUiIdleIntegrationImpl::ActivateUI()
   132     {   
   141     {   
   133     __TICK( "CAiUiIdleIntegrationImpl::ActivateUI - HandleActivateUI" );
   142     __TICK( "CAiUiIdleIntegrationImpl::ActivateUI" );
       
   143     
       
   144     Release( iUiStartupStateObserver );
       
   145     iUiStartupStateObserver = NULL;
   134     
   146     
   135     iAiFwEventHandler->HandleActivateUI();
   147     iAiFwEventHandler->HandleActivateUI();
   136     
   148     
   137     __PRINTS( "CAiUiIdleIntegrationImpl::ActivateUI - HandleActivateUI done" );    
   149     RWsSession& wsSession( iEikEnv.WsSession() );
       
   150     
       
   151     TApaTaskList taskList( wsSession );
       
   152     
       
   153     TApaTask task( taskList.FindApp( TUid::Uid( AI_UID3_AIFW_EXE ) ) );
       
   154     
       
   155     task.BringToForeground(); 
       
   156         
       
   157     __PRINTS( "*** CAiUiIdleIntegrationImpl::ActivateUI - done" );    
   138     }
   158     }
   139 
   159 
   140 // ----------------------------------------------------------------------------
   160 // ----------------------------------------------------------------------------
   141 // CAiUiIdleIntegrationImpl::HandleWsEventL()
   161 // CAiUiIdleIntegrationImpl::HandleWsEventL()
   142 // ----------------------------------------------------------------------------
   162 // ----------------------------------------------------------------------------
   146     {
   166     {
   147     TInt type( aEvent.Type() );
   167     TInt type( aEvent.Type() );
   148     
   168     
   149     if ( type == KAknFullOrPartialForegroundGained )
   169     if ( type == KAknFullOrPartialForegroundGained )
   150         {
   170         {
       
   171         __PRINTS( "*** CAiUiIdleIntegrationImpl::HandleWsEventL - Foreground" );
       
   172         
   151         if ( !iForeground )
   173         if ( !iForeground )
   152             {
   174             {
   153             iForeground = ETrue;
   175             iForeground = ETrue;
   154             iActiveIdleState->SetIsIdleForeground( ETrue );
   176             iActiveIdleState->SetIsIdleForeground( ETrue );
   155             SetCallBubbleIfNeededL();
   177             SetCallBubbleIfNeededL();
   156             }    
   178             }    
   157         }
   179         }
   158     else if ( type == KAknFullOrPartialForegroundLost )
   180     else if ( type == KAknFullOrPartialForegroundLost )
   159         {
   181         {
       
   182         __PRINTS( "*** CAiUiIdleIntegrationImpl::HandleWsEventL - Background" );
       
   183     
   160         if ( iForeground )
   184         if ( iForeground )
   161             {
   185             {
   162             iForeground = EFalse;
   186             iForeground = EFalse;
   163             iActiveIdleState->SetIsIdleForeground( EFalse );
   187             iActiveIdleState->SetIsIdleForeground( EFalse );
   164             ClearCallBubbleL();
   188             ClearCallBubbleL();
   241 // ----------------------------------------------------------------------------
   265 // ----------------------------------------------------------------------------
   242 //
   266 //
   243 TInt CAiUiIdleIntegrationImpl::HandleCallEvent( TAny* aPtr )
   267 TInt CAiUiIdleIntegrationImpl::HandleCallEvent( TAny* aPtr )
   244 	{
   268 	{
   245 	__ASSERT_DEBUG( aPtr, 
   269 	__ASSERT_DEBUG( aPtr, 
   246 	        AiFwPanic::Panic( AiFwPanic::EAiFwPanic_NullPointerReference ) );
   270         AiFwPanic::Panic( AiFwPanic::EAiFwPanic_NullPointerReference ) );
   247     
   271     
   248 	CAiUiIdleIntegrationImpl* self = 
   272 	CAiUiIdleIntegrationImpl* self = 
   249         static_cast<CAiUiIdleIntegrationImpl*>( aPtr );
   273         static_cast< CAiUiIdleIntegrationImpl* >( aPtr );
   250         
   274         
   251 	TInt callStatus( EPSCTsyCallStateNone );
   275 	TInt callStatus( EPSCTsyCallStateNone );
   252 	
   276 	
   253 	TInt err( self->iCallStatusObserver->Get( callStatus ) );
   277 	TInt err( self->iCallStatusObserver->Get( callStatus ) );
   254 	
   278 	
   255 	if( err == KErrNone )
   279 	if ( err == KErrNone )
   256 		{
   280 		{
   257 		// Call ongoing => show bubble if not showing already
   281 		// Call ongoing => show bubble if not showing already
   258 		TBool allowed = EFalse;
   282 		TBool allowed = EFalse;
   259 		
   283 		
   260 		if( !self->iIncallBubbleAllowed &&
   284 		if ( !self->iIncallBubbleAllowed &&
   261 		     self->iForeground &&
   285 		     self->iForeground &&
   262 		    ( callStatus > EPSCTsyCallStateNone ) )
   286 		    ( callStatus > EPSCTsyCallStateNone ) )
   263 			{
   287 			{
   264 			allowed = ETrue;
   288 			allowed = ETrue;
   265     		
   289     		
   266 			TRAP( err, 
   290 			TRAP( err, 
   267                 self->iIncallBubble->SetIncallBubbleAllowedInIdleL( allowed ) );
   291                 self->iIncallBubble->SetIncallBubbleAllowedInIdleL( allowed ) );
   268 			        
   292 			            		
   269     		
   293 			if ( err == KErrNone )
   270 			if( err == KErrNone )
       
   271     		    {
   294     		    {
   272     			self->iIncallBubbleAllowed = allowed;
   295     			self->iIncallBubbleAllowed = allowed;
   273     		    }
   296     		    }
   274 			}
   297 			}
   275 		// No call ongoing => hide if bubble is visible			
   298 		// No call ongoing => hide if bubble is visible			
   276 		else if( self->iIncallBubbleAllowed && callStatus <= EPSCTsyCallStateNone )
   299 		else if ( self->iIncallBubbleAllowed && callStatus <= EPSCTsyCallStateNone )
   277 			{
   300 			{
   278 			allowed = EFalse;
   301 			allowed = EFalse;
   279 			
   302 			
   280     		TRAP( err, 
   303     		TRAP( err, 
   281                 self->iIncallBubble->SetIncallBubbleAllowedInIdleL( allowed ) );
   304                 self->iIncallBubble->SetIncallBubbleAllowedInIdleL( allowed ) );
   282     		
   305     		
   283     		if( err == KErrNone )
   306     		if ( err == KErrNone )
   284     		    {
   307     		    {
   285     			self->iIncallBubbleAllowed = allowed;
   308     			self->iIncallBubbleAllowed = allowed;
   286     		    }
   309     		    }
   287 			}
   310 			}
   288 		}
   311 		}
   289 	
   312 	
   290 	return err;
   313 	return err;
   291 	}
   314 	}
   292 
   315 
   293 // End of file.
   316 // ----------------------------------------------------------------------------
   294 
   317 // CAiUiIdleIntegrationImpl::HandleUiStartupStateChange()
       
   318 // ----------------------------------------------------------------------------
       
   319 //
       
   320 TInt CAiUiIdleIntegrationImpl::HandleUiStartupStateChange( TAny *aPtr )
       
   321     {
       
   322     __ASSERT_DEBUG( aPtr, 
       
   323         AiFwPanic::Panic( AiFwPanic::EAiFwPanic_NullPointerReference ) );
       
   324     
       
   325     CAiUiIdleIntegrationImpl* self = 
       
   326         static_cast< CAiUiIdleIntegrationImpl* >( aPtr );
       
   327 
       
   328     if ( !self->iUiStartupPhaseOk )
       
   329         {
       
   330         TInt state( 0 );
       
   331         
       
   332         self->iUiStartupStateObserver->Get( state );
       
   333         
       
   334         if ( state == EStartupUiPhaseAllDone )
       
   335             {
       
   336             self->iUiStartupPhaseOk = ETrue;
       
   337             
       
   338             self->ActivateUI();                        
       
   339             }
       
   340         }
       
   341     
       
   342     return KErrNone;
       
   343     }
       
   344 
       
   345 // End of file