coreapplicationuis/SysAp/Src/SysApAppUi.cpp
changeset 21 c4cbaa4fb734
parent 0 2e3d3ce01487
child 28 b0b858956ed5
equal deleted inserted replaced
0:2e3d3ce01487 21:c4cbaa4fb734
     1 /*
     1 /*
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). 
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    34 
    34 
    35 #include <hwrmpowerstatesdkpskeys.h>
    35 #include <hwrmpowerstatesdkpskeys.h>
    36 #include <hwrmdomainpskeys.h>
    36 #include <hwrmdomainpskeys.h>
    37 
    37 
    38 #include <PSVariables.h>
    38 #include <PSVariables.h>
    39 #include "CoreApplicationUIsPrivatePSKeys.h"
    39 #include "coreapplicationuisprivatepskeys.h"
    40 #include <ctsydomainpskeys.h>
    40 #include <ctsydomainpskeys.h>
    41 #include <startupdomainpskeys.h>
    41 #include <startupdomainpskeys.h>
    42 #include <startupdomaincrkeys.h>
    42 #include <startupdomaincrkeys.h>
    43 
    43 
    44 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    44 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
    75 #include "sysapcenreplightsettingsobserver.h"
    75 #include "sysapcenreplightsettingsobserver.h"
    76 #include "SysApCenRepLogsObserver.h"
    76 #include "SysApCenRepLogsObserver.h"
    77 #include "SysApCenRepBTObserver.h"
    77 #include "SysApCenRepBTObserver.h"
    78 #include "SysApCenRepHacSettingObserver.h"
    78 #include "SysApCenRepHacSettingObserver.h"
    79 #include "SysApCenRepController.h"
    79 #include "SysApCenRepController.h"
    80 #include "CoreApplicationUIsPrivateCRKeys.h"
    80 #include "coreapplicationuisprivatecrkeys.h"
    81 #include "CoreApplicationUIsPrivatePSKeys.h"
    81 #include "coreapplicationuisprivatepskeys.h"
    82 #include <UikonInternalPSKeys.h>
    82 #include <UikonInternalPSKeys.h>
    83 
    83 
    84 #include "SysApStartupController.h"
    84 #include "SysApStartupController.h"
    85 #include "SysApConnectionMonitorObserver.h"
    85 #include "SysApConnectionMonitorObserver.h"
    86 #include "SysApPowerKeyMenuObserver.h"
    86 #include "SysApPowerKeyMenuObserver.h"
   259     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: START") ) );
   259     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: START") ) );
   260     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying BaseConstructL( EAknEnableSkin )") ) );
   260     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying BaseConstructL( EAknEnableSkin )") ) );
   261     BaseConstructL( EAknEnableSkin );
   261     BaseConstructL( EAknEnableSkin );
   262     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: BaseConstructL() OK") ) );
   262     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: BaseConstructL() OK") ) );
   263     
   263     
   264     iFlagForRmvMmcFrmShortPwrKey = EFalse;
   264    
   265 
   265 
   266     /*SysAp is set as system application (Symbian terminology). This means some special privilege compared
   266     /*SysAp is set as system application (Symbian terminology). This means some special privilege compared
   267       to other applications. For example it does not get closed when system is asked to close applications
   267       to other applications. For example it does not get closed when system is asked to close applications
   268     */
   268     */
   269     iEikonEnv->SetSystem( ETrue );
   269     iEikonEnv->SetSystem( ETrue );
   342         iSysApCenRepFmTxObserver = CSysApCenRepFmTxObserver::NewL( *this );    
   342         iSysApCenRepFmTxObserver = CSysApCenRepFmTxObserver::NewL( *this );    
   343         }
   343         }
   344 
   344 
   345     // Define P&S keys "owned" by SysAp
   345     // Define P&S keys "owned" by SysAp
   346     RProperty::Define( KPSUidUikon, KUikMMCInserted, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy );
   346     RProperty::Define( KPSUidUikon, KUikMMCInserted, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy );
   347     
   347     //initially assuming that the memory card is not inserted
       
   348     RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
   348     TDriveInfo driveInfo;
   349     TDriveInfo driveInfo;
   349     TInt driveNumber; 
   350     TInt driveNumber; 
   350     TInt err;    
   351     TInt err;    
   351     RFs& fileServer = iEikonEnv->FsSession();  
   352     RFs& fileServer = iEikonEnv->FsSession();  
   352     for ( driveNumber = EDriveD; driveNumber < EDriveZ; driveNumber++ )
   353     for ( driveNumber = EDriveD; driveNumber < EDriveZ; driveNumber++ )
   353          {
   354          {
   354 	  err = fileServer.Drive(driveInfo,driveNumber);
   355 	  err = fileServer.Drive(driveInfo,driveNumber);
   355           if(err == KErrNone && driveInfo.iType == EMediaHardDisk &&  driveInfo.iDriveAtt & KDriveAttRemovable)     
   356           if(driveNumber == EDriveF && err == KErrNone && driveInfo.iType == EMediaHardDisk &&  driveInfo.iDriveAtt & KDriveAttRemovable)     
   356         	{     
   357         	{     
   357         	TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: err = %d, driveInfo.iType = %d, driveInfo.iDriveAtt %d, KDriveAttRemovable = %d "),err,driveInfo.iType,driveInfo.iDriveAtt,KDriveAttRemovable) );     
   358         	TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: err = %d, driveInfo.iType = %d, driveInfo.iDriveAtt %d, KDriveAttRemovable = %d "),err,driveInfo.iType,driveInfo.iDriveAtt,KDriveAttRemovable) );     
   358         	RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
   359         	RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
   359                 break;  // Memory card drive found...     
   360                 break;  // Memory card drive found...     
   360       		}
   361       		}
  3895                 iInsertedMemoryCards[ aSelection - iPowerkeyMenuEjectSelectionBase ].iDrive;
  3896                 iInsertedMemoryCards[ aSelection - iPowerkeyMenuEjectSelectionBase ].iDrive;
  3896             TRACES( RDebug::Print(
  3897             TRACES( RDebug::Print(
  3897                 _L( "CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Eject\" selected, drive=%d" ),
  3898                 _L( "CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Eject\" selected, drive=%d" ),
  3898                 iDriveToEject ) );
  3899                 iDriveToEject ) );
  3899             iSysApDriveList->ResetDrivesToEject();
  3900             iSysApDriveList->ResetDrivesToEject();
  3900             iFlagForRmvMmcFrmShortPwrKey = ETrue;
       
  3901             RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
  3901             RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
  3902             EjectMMCL();
  3902             EjectMMCL();
  3903             }
  3903             }
  3904 #endif // RD_MULTIPLE_DRIVE
  3904 #endif // RD_MULTIPLE_DRIVE
  3905         else if ( iSysApPsmController && aSelection == iSysApPsmController->UiItemId() )
  3905         else if ( iSysApPsmController && aSelection == iSysApPsmController->UiItemId() )
  4669         {
  4669         {
  4670         return EFalse;
  4670         return EFalse;
  4671         }
  4671         }
  4672     }
  4672     }
  4673 
  4673 
       
  4674 /**
       
  4675  * To check the for an emergency call. 
       
  4676  * 
       
  4677  * @return ETrue if there is an emergency call active otherwise, EFalse.
       
  4678  */
       
  4679 TBool IsEmergencyCall()
       
  4680         {
       
  4681         TBool retVal( EFalse );
       
  4682         TInt err( KErrNone );
       
  4683         TInt state( 0 );
       
  4684      
       
  4685         err = RProperty::Get(KPSUidCtsyEmergencyCallInfo, KCTSYEmergencyCallInfo, state );
       
  4686         if ( err == KErrNone && state )
       
  4687             {
       
  4688             retVal = ETrue;            
       
  4689             }
       
  4690         return retVal;
       
  4691         }	
       
  4692 
  4674 // ----------------------------------------------------------------------------
  4693 // ----------------------------------------------------------------------------
  4675 // CSysApAppUi::HandleCurrentCallStateChangeL()
  4694 // CSysApAppUi::HandleCurrentCallStateChangeL()
  4676 // ----------------------------------------------------------------------------
  4695 // ----------------------------------------------------------------------------
  4677 
  4696 
  4678 void CSysApAppUi::HandleCurrentCallStateChangeL( TInt aCurrentCallState )
  4697 void CSysApAppUi::HandleCurrentCallStateChangeL( TInt aCurrentCallState )
  4685         }
  4704         }
  4686 
  4705 
  4687     switch ( aCurrentCallState )
  4706     switch ( aCurrentCallState )
  4688         {
  4707         {
  4689         case EPSCTsyCallStateRinging:
  4708         case EPSCTsyCallStateRinging:
       
  4709             {
  4690             iSysApLightsController->CallComingInL( ETrue );
  4710             iSysApLightsController->CallComingInL( ETrue );
  4691             // disable keylock when a call is coming in
  4711             // Disable keylock when a call is coming in
  4692             if ( iKeyLockEnabled || iDeviceLockEnabled || iKeyLockOnBeforeCradle || iKeyLockOnBeforeAlarm )
  4712             if ( iKeyLockEnabled || iDeviceLockEnabled || iKeyLockOnBeforeCradle || iKeyLockOnBeforeAlarm )
  4693                 {
  4713                 {
  4694                 TRACES( RDebug::Print( _L("CSysApAppUi::HandleCurrentCallStateChangeL: EPSCTsyCallStateRinging: disable keylock") ) );
  4714                 TRACES( RDebug::Print( _L("CSysApAppUi::HandleCurrentCallStateChangeL: EPSCTsyCallStateRinging: disable keylock") ) );
  4695                 iKeyLockOnBeforeCall = ETrue;
  4715                 iKeyLockOnBeforeCall = ETrue;
  4696 
  4716 
  4701                         KeyLock().DisableWithoutNote();
  4721                         KeyLock().DisableWithoutNote();
  4702                         }
  4722                         }
  4703                     }
  4723                     }
  4704                 }
  4724                 }
  4705             break;
  4725             break;
  4706 
  4726             }
       
  4727             
  4707         case EPSCTsyCallStateDialling:
  4728         case EPSCTsyCallStateDialling:
  4708             // disable keylock during an emergency call
  4729             {
       
  4730             // Disable keypad lock during an emergency call
       
  4731             // no need to disable the key lock when a call is made using the wireless car-kit
       
  4732             // but if the call is an emergency one then we will disable the keypad lock
  4709             if ( iKeyLockEnabled || iDeviceLockEnabled || iKeyLockOnBeforeCradle )
  4733             if ( iKeyLockEnabled || iDeviceLockEnabled || iKeyLockOnBeforeCradle )
  4710                 {
  4734                 {
  4711                 TRACES( RDebug::Print( _L("CSysApAppUi::HandleCurrentCallStateChangeL: EPSCTsyCallStateDialling: disable keylock") ) );
  4735                 TRACES( RDebug::Print( _L("CSysApAppUi::HandleCurrentCallStateChangeL: EPSCTsyCallStateDialling: disable keylock") ) );
  4712                 iKeyLockOnBeforeCall = ETrue;
  4736                 iKeyLockOnBeforeCall = ETrue;
  4713 
  4737 
  4714                 if ( iKeyLockEnabled || iDeviceLockEnabled )
  4738                 if ( IsEmergencyCall() && (iKeyLockEnabled || iDeviceLockEnabled ))
  4715                     {
  4739                     {
  4716                     KeyLock().DisableWithoutNote();
  4740                     KeyLock().DisableWithoutNote();
  4717                     }
  4741                     }
  4718                 }
  4742                 }
  4719 
  4743 
  4720             // enable signal & network indicators when an emergency call is made in Offline Mode
  4744             // Enable signal & network indicators when an emergency call is made in Offline Mode
  4721             if( iSysApOfflineModeController->OfflineModeActive() )
  4745             if( iSysApOfflineModeController->OfflineModeActive() )
  4722                     {
  4746                     {
  4723                     if ( StateOfProperty(KPSUidCtsyCallInformation, KCTsyCallType) != EPSCTsyCallTypeVoIP) // signal indicators not updated with VoIP call
  4747                     // Signal indicators not updated with VoIP call
       
  4748                     if ( StateOfProperty(KPSUidCtsyCallInformation, KCTsyCallType) != EPSCTsyCallTypeVoIP) 
  4724                         {
  4749                         {
  4725                         iEmergencyCallActive = ETrue;
  4750                         iEmergencyCallActive = ETrue;
  4726                         UpdateSignalBarsL();
  4751                         UpdateSignalBarsL();
  4727                         SetSignalIndicatorL();
  4752                         SetSignalIndicatorL();
  4728                         }
  4753                         }
  4729                     }
  4754                     }
  4730             break;
  4755             break;
  4731 
  4756             }
       
  4757             
  4732         case EPSCTsyCallStateConnected:
  4758         case EPSCTsyCallStateConnected:
       
  4759             {
  4733             if (StateOfProperty(KPSUidCtsyCallInformation, KCTsyCallType) == EPSCTsyCallTypeCSVoice)
  4760             if (StateOfProperty(KPSUidCtsyCallInformation, KCTsyCallType) == EPSCTsyCallTypeCSVoice)
  4734                 {
  4761                 {
  4735                 // check if GPRS suspended note is required
  4762                 // Check if GPRS suspended note is required
  4736                 iCallActivated = ETrue;
  4763                 iCallActivated = ETrue;
  4737                 HandleGprsNotesL();
  4764                 HandleGprsNotesL();
  4738                 }
  4765                 }
  4739             if ( iDeviceLockEnabled )
  4766             if ( iDeviceLockEnabled )
  4740                 {
  4767                 {
  4741                 // Enable keylock via autolock emulation if device lock enabled. 
  4768                 // Enable keylock via autolock emulation if device lock enabled. 
  4742                 // Otherwise e.g. messages can be read using softkeys during ongoing call.
  4769                 // Otherwise e.g. messages can be read using softkeys during ongoing call.
  4743                 KeyLock().EnableAutoLockEmulation();
  4770                 KeyLock().EnableAutoLockEmulation();
  4744                 }
  4771                 }
  4745             break;
  4772             break;
       
  4773             }
  4746 
  4774 
  4747         case EPSCTsyCallStateNone:
  4775         case EPSCTsyCallStateNone:
  4748             // reset timers in ScreenSaver and Autolock
  4776             {
       
  4777             // Reset timers in ScreenSaver and Autolock
  4749             User::ResetInactivityTime();
  4778             User::ResetInactivityTime();
  4750 
  4779 
  4751             if ( iEmergencyCallActive )
  4780             if ( iEmergencyCallActive )
  4752                 {
  4781                 {
  4753                 iEmergencyCallActive = EFalse;
  4782                 iEmergencyCallActive = EFalse;
  4783                 ShowUiNoteL( EKeypadActiveNote );
  4812                 ShowUiNoteL( EKeypadActiveNote );
  4784                 iShowkeypadActivatedNoteAfterSoftReject = EFalse;
  4813                 iShowkeypadActivatedNoteAfterSoftReject = EFalse;
  4785                 }
  4814                 }
  4786             iCallActivated = EFalse;
  4815             iCallActivated = EFalse;
  4787             break;
  4816             break;
       
  4817             }
       
  4818             
  4788         default:
  4819         default:
  4789             break;
  4820             break;
  4790         }
  4821         }
  4791 
  4822 
  4792     if ( aCurrentCallState != EPSCTsyCallStateRinging )
  4823     if ( aCurrentCallState != EPSCTsyCallStateRinging )
  5384 
  5415 
  5385                 if ( aDrive == defaultMemoryCard )
  5416                 if ( aDrive == defaultMemoryCard )
  5386                     {
  5417                     {
  5387                     if ( memoryCardStatus == ESysApMemoryCardInserted )
  5418                     if ( memoryCardStatus == ESysApMemoryCardInserted )
  5388                         {
  5419                         {
  5389                         if(!iFlagForRmvMmcFrmShortPwrKey)
  5420                          RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
  5390                         	{
  5421                       	}
  5391                         	RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 );
       
  5392                       		}
       
  5393                       		iFlagForRmvMmcFrmShortPwrKey = EFalse;
       
  5394                         }
       
  5395                     else
  5422                     else
  5396                         {
  5423                         {
  5397                         RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
  5424                         RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 );
  5398                         }
  5425                         }
  5399                     }
  5426                     }