coreapplicationuis/SysAp/Src/SysApAppUi.cpp
changeset 56 11a052f4b02e
parent 49 76883296a0d5
child 65 8a530a83576a
equal deleted inserted replaced
49:76883296a0d5 56:11a052f4b02e
    30 #include <hwrmpowerstatesdkpskeys.h>
    30 #include <hwrmpowerstatesdkpskeys.h>
    31 #include <wlaninternalpskeys.h> 
    31 #include <wlaninternalpskeys.h> 
    32 #include <HbDeviceNotificationDialogSymbian.h>
    32 #include <HbDeviceNotificationDialogSymbian.h>
    33 //#include <HbDeviceInputDialogSymbian.h>
    33 //#include <HbDeviceInputDialogSymbian.h>
    34 #include <hbsymbianvariant.h>
    34 #include <hbsymbianvariant.h>
    35 //#include <hbtextresolversymbian.h>
    35 #include <hbtextresolversymbian.h>
    36 #include <UikonInternalPSKeys.h>
    36 #include <UikonInternalPSKeys.h>
    37 
    37 
    38 //#include "SysApWsClient.h"
    38 //#include "SysApWsClient.h"
    39 #include "SysApFeatureManager.h"
    39 #include "SysApFeatureManager.h"
    40 #include "SysApNspsHandler.h"
    40 #include "SysApNspsHandler.h"
    51 #include "sysapbatteryinfocontroller.h"
    51 #include "sysapbatteryinfocontroller.h"
    52 #include "SysApSimChanged.h"
    52 #include "SysApSimChanged.h"
    53 #include "MSysApBtSapController.h"
    53 #include "MSysApBtSapController.h"
    54 #include "MSysApBtController.h"
    54 #include "MSysApBtController.h"
    55 #include "MSysApUsbIndicator.h"
    55 #include "MSysApUsbIndicator.h"
    56 //#include <hbindicatorsymbian.h>
    56 
    57 //#include <psmclient.h>
       
    58 //#include <psmsettings.h>
       
    59 #include "sysapkeymanagement.h"
    57 #include "sysapkeymanagement.h"
    60 #include "SysApShutdownImage.h"
    58 #include "SysApShutdownImage.h"
    61 #include "SysApKeySndHandler.h"
    59 #include "SysApKeySndHandler.h"
       
    60 
       
    61 #include "SysApShutdownAnimation.h"
       
    62 #include "SysApEtelConnector.h"
       
    63 
       
    64 
    62 
    65 
    63 #include <settingsinternalcrkeys.h>
    66 #include <settingsinternalcrkeys.h>
    64 #include <keyguardaccessapi.h>
    67 #include <keyguardaccessapi.h>
    65 #include <eikdef.h>
    68 #include <eikdef.h>
    66 #include <eikenv.h>
    69 #include <eikenv.h>
       
    70 #include <UsbWatcherInternalPSKeys.h> // USB transfer modes
       
    71 #include <usbpersonalityids.h>
       
    72 #include "sysap.rsg"
       
    73 #include <hbindicatorsymbian.h>
    67 
    74 
    68 class CHbSymbianVariant;
    75 class CHbSymbianVariant;
    69 const TInt KModifierMask( 0 );
    76 const TInt KModifierMask( 0 );
    70 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy);
    77 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy);
    71 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
    78 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData);
    72 const TInt KDelayBeforeNextScanningRound( 1000000 );
    79 const TInt KDelayBeforeNextScanningRound( 1000000 );
    73 /*
    80 
       
    81 /* ENABLE ANIMATION: Add id of background image.
       
    82    Example: const TInt KBackgroundImageID = EMbmSysapQgn_graf_startup_bg;
       
    83    If there is no image defined, clear screen is used.*/
       
    84 const TInt KBackgroundImageID = 0;
       
    85 
       
    86 
       
    87 _LIT(KAccesoryPlugin,"com.nokia.accessory.indicatorplugin/1.0");
       
    88 _LIT(KAccMode, "AccMode");
       
    89 _LIT(KAccPhyConType, "AccType");
       
    90 
    74 _LIT(KPsmPlugin,"com.nokia.hb.powersavemodeplugin/1.0");
    91 _LIT(KPsmPlugin,"com.nokia.hb.powersavemodeplugin/1.0");
    75 _LIT(KPsm,"PSM");
    92 _LIT(KPsm,"PSM");
    76 _LIT(KCharging,"Charging");
    93 _LIT(KCharging,"Charging");
    77 _LIT(KPsmlocalisationfile, "powermanagement_");
    94 _LIT(KPsmlocalisationfile, "powermanagement_");
    78 _LIT(KtsfilePath, "z:/resource/qt/translations/");
    95 _LIT(KtsfilePath, "z:/resource/qt/translations/");
    79 _LIT(KlowbatteryIcon,"qtg_small_bt_low_battery.svg");
    96 _LIT(KlowbatteryIcon,"qtg_small_bt_low_battery.svg");
    80 _LIT(KbatteryFullIcon,"qtg_status_battery.svg");
    97 _LIT(KbatteryFullIcon,"qtg_status_battery.svg");
    81 
    98 
    82 */
    99 
    83 
   100 
    84 // ============================ MEMBER FUNCTIONS ==============================
   101 // ============================ MEMBER FUNCTIONS ==============================
    85 
   102 
    86 // ----------------------------------------------------------------------------
   103 // ----------------------------------------------------------------------------
    87 // CSysApAppUi::CSysApAppUi()
   104 // CSysApAppUi::CSysApAppUi()
   217     iSysApStartupController = CSysApStartupController::NewL( *this, iSysApFeatureManager->OfflineModeSupported() );
   234     iSysApStartupController = CSysApStartupController::NewL( *this, iSysApFeatureManager->OfflineModeSupported() );
   218 
   235 
   219     iActiveProfileBeforeOfflineMode = iSysApCenRepController->GetInt( KCRUidCoreApplicationUIsSysAp, KSysApProfileBeforeOfflineMode );    
   236     iActiveProfileBeforeOfflineMode = iSysApCenRepController->GetInt( KCRUidCoreApplicationUIsSysAp, KSysApProfileBeforeOfflineMode );    
   220            
   237            
   221     iSysApFeatureManager->FeatureVariationCheckDone();        
   238     iSysApFeatureManager->FeatureVariationCheckDone();        
   222     // iHbIndicatorSymbian = CHbIndicatorSymbian::NewL();
       
   223     
   239     
   224     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CSysApLightsController::NewL()") ) );
   240     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CSysApLightsController::NewL()") ) );
   225     iSysApLightsController = CSysApLightsController::NewL( *this,
   241     iSysApLightsController = CSysApLightsController::NewL( *this,
   226                                                            iSysApCenRepLightSettingsObserver->GetLightsTimeout(),
   242                                                            iSysApCenRepLightSettingsObserver->GetLightsTimeout(),
   227                                                            iSysApFeatureManager->CoverDisplaySupported() );
   243                                                            iSysApFeatureManager->CoverDisplaySupported() );
   242     if (keyManagementErr)
   258     if (keyManagementErr)
   243         {
   259         {
   244         TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL : CSysApKeyManagement::NewL returns error=%d"), keyManagementErr ) );
   260         TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL : CSysApKeyManagement::NewL returns error=%d"), keyManagementErr ) );
   245         }
   261         }
   246     
   262     
       
   263     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CSysApEtelConnector::NewL()") ) );
       
   264     iSysApEtelConnector = CSysApEtelConnector::NewL( *this );
       
   265     
   247     // Initialize animdll for handling side volume keys
   266     // Initialize animdll for handling side volume keys
   248     // (needed before normal mode in case emergency number is dialed from PIN query)
   267     // (needed before normal mode in case emergency number is dialed from PIN query)
   249     iSysApKeySndHandler = CSysApKeySndHandler::NewL(iEikonEnv->WsSession());
   268     iSysApKeySndHandler = CSysApKeySndHandler::NewL(iEikonEnv->WsSession());
   250     iKeyguardController = CKeyguardAccessApi::NewL();
   269     iKeyguardController = CKeyguardAccessApi::NewL();
   251     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CSysApShutdownImage::NewL()") ) );
   270     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CSysApShutdownImage::NewL()") ) );
   256     iSysApNspsHandler = CSysApNspsHandler::NewL( iEikonEnv->WsSession(), iSysApShutdownImage->ShutdownCoeControlWindow() );
   275     iSysApNspsHandler = CSysApNspsHandler::NewL( iEikonEnv->WsSession(), iSysApShutdownImage->ShutdownCoeControlWindow() );
   257 
   276 
   258     RProperty::Define( KPSUidCoreApplicationUIs,KCoreAppUIsPowerMenuCustomDialogStatus, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy );
   277     RProperty::Define( KPSUidCoreApplicationUIs,KCoreAppUIsPowerMenuCustomDialogStatus, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy );
   259     RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogUninitialized );
   278     RProperty::Set( KPSUidCoreApplicationUIs, KCoreAppUIsPowerMenuCustomDialogStatus, ECoreAppUIsPowerMenuCustomDialogUninitialized );
   260     
   279     
   261 
   280 	TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying CHbIndicatorSymbian::NewL()") ) );
   262                     
   281     iHbIndicatorSymbian = CHbIndicatorSymbian::NewL();
   263     // TBool result = HbTextResolverSymbian::Init(KPsmlocalisationfile, KtsfilePath);
   282 	
   264     
   283 	  TBool result = HbTextResolverSymbian::Init(KPsmlocalisationfile, KtsfilePath);
       
   284 	
   265     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: END") ) );    
   285     TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: END") ) );    
   266     }
   286     }
   267 
   287 
   268 // ----------------------------------------------------------------------------
   288 // ----------------------------------------------------------------------------
   269 // CSysApAppUi::FreeResources()
   289 // CSysApAppUi::FreeResources()
   272 void CSysApAppUi::FreeResources()
   292 void CSysApAppUi::FreeResources()
   273     {
   293     {
   274     TRACES( RDebug::Print( _L("CSysApAppUi::FreeResources") ) );
   294     TRACES( RDebug::Print( _L("CSysApAppUi::FreeResources") ) );
   275     delete iSysApBatteryInfoController;
   295     delete iSysApBatteryInfoController;
   276     delete iSysApPsmController;
   296     delete iSysApPsmController;
   277     //delete iVariantAccState; 
   297     delete iVariantAccState; 
   278 
   298 
   279     delete iSysApAudioRoutingObserver;
   299     delete iSysApAudioRoutingObserver;
   280 
   300 
   281     if ( iSapTimer )
   301     if ( iSapTimer )
   282         {
   302         {
   309     delete iSysApCenRepLogsObserver;
   329     delete iSysApCenRepLogsObserver;
   310     delete iSysApOfflineModeController;
   330     delete iSysApOfflineModeController;
   311     
   331     
   312     delete iSysApUsbIndicatorController;
   332     delete iSysApUsbIndicatorController;
   313     delete iKeyguardController;
   333     delete iKeyguardController;
   314     // delete iHbIndicatorSymbian; 
   334     delete iHbIndicatorSymbian; 
   315     delete iSysApKeyManagement;
   335     delete iSysApKeyManagement;
   316     iSysApKeyManagement = NULL;
   336     iSysApKeyManagement = NULL;
   317     
   337     
   318     REComSession::FinalClose();
   338     REComSession::FinalClose();
   319     iResourcesFreed = ETrue;
   339     iResourcesFreed = ETrue;
   323 // ---------------------------------------------------------------------------
   343 // ---------------------------------------------------------------------------
   324 // CStartupAppUi::PrepareToExit()
   344 // CStartupAppUi::PrepareToExit()
   325 // ---------------------------------------------------------------------------
   345 // ---------------------------------------------------------------------------
   326 void CSysApAppUi::PrepareToExit()
   346 void CSysApAppUi::PrepareToExit()
   327     {
   347     {
   328     TRACES("CSysApAppUi::PrepareToExit()");
   348     TRACES(RDebug::Print( _L("CSysApAppUi::PrepareToExit()")));
   329     CEikAppUi::PrepareToExit();
   349     CEikAppUi::PrepareToExit();
   330     }
   350     }
   331 
   351 
   332 
   352 
   333 // ----------------------------------------------------------------------------
   353 // ----------------------------------------------------------------------------
   404     TRACES( RDebug::Print(_L("CSysApAppUi::HandleUiReadyAfterBootL" ) ) );    
   424     TRACES( RDebug::Print(_L("CSysApAppUi::HandleUiReadyAfterBootL" ) ) );    
   405     TInt state( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
   425     TInt state( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
   406 
   426 
   407     UpdateBatteryBarsL( state );   
   427     UpdateBatteryBarsL( state );   
   408     DoSwStateNormalConstructionL();
   428     DoSwStateNormalConstructionL();
   409     HandleAccessoryProfileInStartupL();       
   429     HandleAccessoryProfileInStartupL();
       
   430           
       
   431 
       
   432       
       
   433        
   410    
   434    
   411     if ( !iSysApPsmController ) // created here if first state change has not occurred yet
   435     if ( !iSysApPsmController ) // created here if first state change has not occurred yet
   412        {
   436        {
   413        iSysApPsmController = CSysApPsmController::NewL( *this );        
   437        iSysApPsmController = CSysApPsmController::NewL( *this );        
   414        }
   438        }
   415 
   439 
   416     if ( iSysApPsmController )
   440     if ( iSysApPsmController )
   417        {
   441        {
   418         if ( iCharging ) // if charger is connected on boot PSM queries may need to be shown
   442 	   if ( iCharging ) // if charger is connected on boot PSM queries may need to be shown
   419         {
   443         {
   420          HandleChargingStatusL( StateOfProperty( KPSUidHWRMPowerState, KHWRMChargingStatus ) );
   444          HandleChargingStatusL( StateOfProperty( KPSUidHWRMPowerState, KHWRMChargingStatus ) );
   421         }
   445         }
       
   446 		
       
   447        if ( iSysApPsmController->FullPsmEnabled() )
       
   448            {
       
   449            // activate psm indicator 
       
   450             iVariantAccState = CHbSymbianVariant::NewL(&KPsm, CHbSymbianVariant::EDes);
       
   451             if (!iHbIndicatorSymbian->Activate(KPsmPlugin,iVariantAccState)) 
       
   452                {
       
   453                int error = iHbIndicatorSymbian->Error();
       
   454                //use the errorcode...
       
   455                }
       
   456            }
       
   457      
   422        }
   458        }
   423     
   459     
   424     TInt batteryStatus = StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryStatus );
   460     TInt batteryStatus = StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryStatus );
   425     TRACES( RDebug::Print(_L("CSysApAppUi::HandleUiReadyAfterBootL: batteryStatus %d" ), batteryStatus ) );
   461     TRACES( RDebug::Print(_L("CSysApAppUi::HandleUiReadyAfterBootL: batteryStatus %d" ), batteryStatus ) );
   426     if(  batteryStatus == EBatteryStatusLow || batteryStatus == EBatteryStatusEmpty )
   462     if(  batteryStatus == EBatteryStatusLow || batteryStatus == EBatteryStatusEmpty )
   470 
   506 
   471         // in charger boot explicitly disable  power save mode
   507         // in charger boot explicitly disable  power save mode
   472         if ( aSwState == RStarterSession::ECharging )
   508         if ( aSwState == RStarterSession::ECharging )
   473             {
   509             {
   474             iSysApPsmController->ChargerConnected();
   510             iSysApPsmController->ChargerConnected();
   475             iSysApPsmController->DoEnablePartialPsm( EFalse ); // disable  power save now
   511             iSysApPsmController->DoEnableFullPsm(EFalse); // disable  power save now
   476             }
   512             }
   477         }
   513         }
   478 
   514 
   479     if ( aSwState == RStarterSession::ECharging || aSwState == RStarterSession::EAlarm )
   515     if ( aSwState == RStarterSession::ECharging || aSwState == RStarterSession::EAlarm )
   480         {
   516         {
   527     {
   563     {
   528     TRACES( RDebug::Print( _L("~CSysApAppUi() started") ) );
   564     TRACES( RDebug::Print( _L("~CSysApAppUi() started") ) );
   529     if( !iResourcesFreed )
   565     if( !iResourcesFreed )
   530       {
   566       {
   531         FreeResources();
   567         FreeResources();
   532       }
   568 
       
   569         iStarterSession.Close();
       
   570 
       
   571         }
       
   572 
       
   573     delete iSysApShutdownImage;
       
   574 
       
   575 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   576     if (iSysApShutdownAnimation)
       
   577         {
       
   578         RemoveFromStack( iSysApShutdownAnimation );
       
   579 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   580         delete iSysApShutdownAnimation;
       
   581 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   582         }
       
   583 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   584 
       
   585 //    delete iProfileNote;
       
   586 
       
   587 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   588     if( iAnimTimer )
       
   589         {
       
   590         iAnimTimer->Cancel();
       
   591         }
       
   592     delete iAnimTimer;
       
   593 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
   594 
   533     delete iSysApStartupController;
   595     delete iSysApStartupController;
       
   596     TRACES( RDebug::Print( _L("~CSysApAppUi() completed") ) );
   534     }
   597     }
   535         
   598         
   536 TBool CSysApAppUi::ResourcesFreed() const
   599 TBool CSysApAppUi::ResourcesFreed() const
   537     {
   600     {
   538     return iResourcesFreed;
   601     return iResourcesFreed;
   880             }
   943             }
   881 
   944 
   882         if( !aReset )
   945         if( !aReset )
   883             {
   946             {
   884     #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   947     #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
   885 //            TRAPD( err, ShowAnimationL() );
   948             TRAPD( err, ShowAnimationL() );
   886 //            if ( err )
   949             if ( err )
   887                 {
   950                 {
   888      //           TRACES( RDebug::Print(_L("CSysApAppUi::DoShutdownL ShowAnimationL() leaved: %d" ), err ) );
   951                 TRACES( RDebug::Print(_L("CSysApAppUi::DoShutdownL ShowAnimationL() leaved: %d" ), err ) );
   889                 CompleteShutdown(aReset, aResetReason);
   952                 CompleteShutdown(aReset, aResetReason);
   890                 }
   953                 }
   891             }
   954             }
   892         else // aReset
   955         else // aReset
   893            {
   956            {
  1199         accessoryState = iSysApAccessoryObserver->GetAccessoryMode();
  1262         accessoryState = iSysApAccessoryObserver->GetAccessoryMode();
  1200         }
  1263         }
  1201 
  1264 
  1202     if ( accessoryState == EAccModeHandPortable )
  1265     if ( accessoryState == EAccModeHandPortable )
  1203         {
  1266         {
       
  1267         TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryDisconnectedL:Before Deactivating accessory Plugin")));
       
  1268         iHbIndicatorSymbian->Deactivate(KAccesoryPlugin);
       
  1269         TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryDisconnectedL:After  Deactivating accessory Plugin")));
  1204         iSysApLightsController->AccessoryConnectedL( EFalse );
  1270         iSysApLightsController->AccessoryConnectedL( EFalse );
  1205         iSysApCenRepController->SetInt( KCRUidCoreApplicationUIsSysAp, KSysApAccessoryConnected, 0 );
  1271         iSysApCenRepController->SetInt( KCRUidCoreApplicationUIsSysAp, KSysApAccessoryConnected, 0 );
  1206         }
  1272         }
  1207 
  1273 
  1208     SetIhfIndicatorL();
  1274     SetIhfIndicatorL();
  1229 
  1295 
  1230 // ----------------------------------------------------------------------------
  1296 // ----------------------------------------------------------------------------
  1231 // CSysApAppUi::HandleAccessoryConnectedL()
  1297 // CSysApAppUi::HandleAccessoryConnectedL()
  1232 // ----------------------------------------------------------------------------
  1298 // ----------------------------------------------------------------------------
  1233 
  1299 
  1234 void CSysApAppUi::HandleAccessoryConnectedL( TAccMode aAccessoryState )
  1300 void CSysApAppUi::HandleAccessoryConnectedL( TAccMode aAccessoryState, TInt aPhysicalConnectionType )
  1235     {
  1301     {
  1236     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL( aAccessoryState: %d ) "), aAccessoryState ) );
  1302     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL( aAccessoryState: %d )(aPhysicalConnectionType: %d "), aAccessoryState, aPhysicalConnectionType ) );
  1237 
  1303 
  1238     if ( aAccessoryState == EAccModeWirelessHeadset ||
  1304     CHbSymbianVariantMap* iAccVariantMap = CHbSymbianVariantMap::NewL();
  1239          aAccessoryState == EAccModeWiredHeadset ||
  1305     CleanupStack::PushL(iAccVariantMap);
  1240          aAccessoryState == EAccModeHeadphones )
  1306     CHbSymbianVariant* variantAccState = CHbSymbianVariant::NewL(&aAccessoryState, CHbSymbianVariant::EInt);
  1241         {
  1307     iAccVariantMap->Add(KAccMode,variantAccState);
  1242         }
  1308     CHbSymbianVariant* variantAccType = CHbSymbianVariant::NewL(&aPhysicalConnectionType, CHbSymbianVariant::EInt);
  1243     else if ( aAccessoryState == EAccModeLoopset )
  1309     iAccVariantMap->Add(KAccPhyConType,variantAccType);
  1244         {
  1310     
  1245         }
  1311     
  1246     else if ( aAccessoryState == EAccModeTextDevice )
  1312     CHbSymbianVariant* iAccVariant = CHbSymbianVariant::NewL(iAccVariantMap, CHbSymbianVariant::EVariantMap ); 
  1247         {
  1313     CleanupStack::PushL(iAccVariant);
  1248         }
  1314     iHbIndicatorSymbian->Activate(KAccesoryPlugin, iAccVariant);
  1249     else if ( aAccessoryState == EAccModeWirelessCarKit || aAccessoryState == EAccModeWiredCarKit )
  1315 
  1250         {
       
  1251         }
       
  1252     else if ( aAccessoryState == EAccModeTVOut )
       
  1253         {
       
  1254         }
       
  1255     else if (aAccessoryState == EAccModeHDMI )
       
  1256             {
       
  1257             }
       
  1258 
  1316 
  1259     TInt swState( StateOfProperty( KPSUidStartup, KPSGlobalSystemState ) );
  1317     TInt swState( StateOfProperty( KPSUidStartup, KPSGlobalSystemState ) );
  1260     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL: swState: %d"), swState ) );
  1318     TRACES( RDebug::Print( _L("CSysApAppUi::HandleAccessoryConnectedL: swState: %d"), swState ) );
  1261 
  1319 
  1262     if( UiReady() || swState == ESwStateSecurityCheck )
  1320     if( UiReady() || swState == ESwStateSecurityCheck )
  1288                 }
  1346                 }
  1289             }
  1347             }
  1290         }
  1348         }
  1291     SetIhfIndicatorL();
  1349     SetIhfIndicatorL();
  1292     SetHacIndicatorL();
  1350     SetHacIndicatorL();
       
  1351     CleanupStack::PopAndDestroy(2);
  1293     }
  1352     }
  1294 
  1353 
  1295 
  1354 
  1296 // ----------------------------------------------------------------------------
  1355 // ----------------------------------------------------------------------------
  1297 // CSysApAppUi::SetHacIndicatorL()
  1356 // CSysApAppUi::SetHacIndicatorL()
  1618     
  1677     
  1619     switch ( aStatus )
  1678     switch ( aStatus )
  1620         {
  1679         {
  1621         case MSysApPsmControllerNotifyCallback::EPsmActivationComplete:
  1680         case MSysApPsmControllerNotifyCallback::EPsmActivationComplete:
  1622              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1681              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1623              ShowUiNoteL( EPowerSaveModeActivated );
  1682              iVariantAccState = CHbSymbianVariant::NewL(&KPsm, CHbSymbianVariant::EDes);
       
  1683              if (!iHbIndicatorSymbian->Activate(KPsmPlugin,iVariantAccState)) 
       
  1684                 {
       
  1685                 int error = iHbIndicatorSymbian->Error();
       
  1686                 //use the errorcode...
       
  1687                 }
  1624              break;
  1688              break;
  1625         
  1689         
  1626         case MSysApPsmControllerNotifyCallback::EPsmDeactivationComplete:
  1690         case MSysApPsmControllerNotifyCallback::EPsmDeactivationComplete:
  1627              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1691              UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) );
  1628              ShowUiNoteL( EPowerSaveModeDeactivated );
  1692              if (!iHbIndicatorSymbian->Deactivate(KPsmPlugin)) 
  1629              break;
  1693                 {
       
  1694                 int error = iHbIndicatorSymbian->Error();
       
  1695                  //use the errorcode...
       
  1696                 }
       
  1697             break;
  1630             
  1698             
  1631         case MSysApPsmControllerNotifyCallback::EPsmActivationFailed:
  1699         case MSysApPsmControllerNotifyCallback::EPsmActivationFailed:
  1632             ShowUiNoteL( ECannotActivatePowerSaveMode );
  1700             ShowUiNoteL( ECannotActivatePowerSaveMode );
  1633             break;
  1701             break;
  1634             
  1702             
  1718     iSysApLightsController->HandleLightsRequireL();
  1786     iSysApLightsController->HandleLightsRequireL();
  1719     }
  1787     }
  1720 
  1788 
  1721 
  1789 
  1722 // ----------------------------------------------------------------------------
  1790 // ----------------------------------------------------------------------------
       
  1791 // CSysApAppUi::HandleRawKeyEventLightsRequireL()
       
  1792 // ----------------------------------------------------------------------------
       
  1793 
       
  1794 void CSysApAppUi::HandleRawKeyEventLightsRequireL() const
       
  1795     {
       
  1796     iSysApLightsController->HandleRawKeyEventLightsRequireL();
       
  1797     }
       
  1798 
       
  1799 
       
  1800 // ----------------------------------------------------------------------------
  1723 // CSysApAppUi::AlertUiKeyLockOff( const TBool aKeyLockOff )
  1801 // CSysApAppUi::AlertUiKeyLockOff( const TBool aKeyLockOff )
  1724 // ----------------------------------------------------------------------------
  1802 // ----------------------------------------------------------------------------
  1725 
  1803 
  1726 void CSysApAppUi::AlertUiKeyLockOff( const TBool aKeyLockOff )
  1804 void CSysApAppUi::AlertUiKeyLockOff( const TBool aKeyLockOff )
  1727     {
  1805     {
  1830 //
  1908 //
  1831 void CSysApAppUi::HandleBatteryStatusL( const TInt aValue )
  1909 void CSysApAppUi::HandleBatteryStatusL( const TInt aValue )
  1832     {
  1910     {
  1833     TRACES( RDebug::Print( _L("CSysApAppUi::HandleBatteryStatusL aValue: %d"), aValue ) );
  1911     TRACES( RDebug::Print( _L("CSysApAppUi::HandleBatteryStatusL aValue: %d"), aValue ) );
  1834     
  1912     
       
  1913     TBool enableAutoPsm(EFalse);
       
  1914     CRepository* repository( NULL );
       
  1915     TRAPD( err, repository = CRepository::NewL( KCRUidDeviceManagementSettings ) );
       
  1916         
       
  1917     if ( err == KErrNone )
       
  1918        {
       
  1919        TInt value( 0 );
       
  1920        err = repository->Get( KSettingsPowerSavingQuery, value );
       
  1921             
       
  1922        if ( err == KErrNone )
       
  1923           {
       
  1924           enableAutoPsm = value ? EFalse: ETrue;
       
  1925           }
       
  1926        }
       
  1927       
       
  1928      _LIT(Klowbattery, "txt_power_management_dpopinfo_low_battery");
       
  1929      // returns the string "low battery"
       
  1930      HBufC* lowBattery = HbTextResolverSymbian::LoadL(Klowbattery);    
       
  1931     
       
  1932     
  1835     if ( aValue == EBatteryStatusEmpty )
  1933     if ( aValue == EBatteryStatusEmpty )
  1836         {
  1934         {
  1837         //Display Recharge Battery note
  1935         //Display Recharge Battery note
  1838         ShowUiNoteL( ERechargeBatteryNote );
  1936         ShowUiNoteL( ERechargeBatteryNote );
  1839         BatteryEmptyL();
  1937         BatteryEmptyL();
  1843         if ( iSysApPsmController && UiReady() )
  1941         if ( iSysApPsmController && UiReady() )
  1844             {
  1942             {
  1845             iSysApPsmController->BatteryLow( ETrue );
  1943             iSysApPsmController->BatteryLow( ETrue );
  1846             
  1944             
  1847                        
  1945                        
  1848             if ( iSysApPsmController->ShowActivateQuery())
  1946             if ( enableAutoPsm)
  1849                 {
  1947                 {
  1850                 // show activation query, replaces the first battery low query
  1948                 iSysApPsmController->DoEnableFullPsm( ETrue );
  1851                 ShowQueryL( ESysApBattLowPowerSavingQuery );
  1949                           
       
  1950                 _LIT(KPsmOn, "txt_power_management_dpopinfo_psm_activated_automa");
       
  1951                 // returns the string "power saving mode  on"
       
  1952                 HBufC* psmOn = HbTextResolverSymbian::LoadL(KPsmOn);
       
  1953                              
       
  1954                _LIT(Kicon, "qgn_indi_battery_ps_activate");
       
  1955                // returns the power save mode icon
       
  1956                HBufC* psmIcon = HbTextResolverSymbian::LoadL(Kicon);                  
       
  1957             
       
  1958                CHbDeviceNotificationDialogSymbian::NotificationL(*psmIcon,*psmOn,*lowBattery);       
  1852                 }
  1959                 }
  1853             else // default low warning note must be shown
  1960             else // default low warning note must be shown
  1854                 {
  1961                 {
  1855                 // activate partial power save mode on first low warning
       
  1856                 iSysApPsmController->DoEnablePartialPsm( ETrue ); // activated on first warning note
       
  1857                 //Display Battery Low note.
  1962                 //Display Battery Low note.
  1858                 ShowUiNoteL( EBatteryLowNote );    
  1963                 CHbDeviceNotificationDialogSymbian::NotificationL(KlowbatteryIcon,KNullDesC,*lowBattery);   
  1859                 }                
  1964                 }                
  1860             }
  1965             }
  1861         else
  1966         else
  1862             {
  1967             {
  1863             //Display Battery Low note.
  1968             //Display Battery Low note.
  1864             ShowUiNoteL( EBatteryLowNote );     
  1969             CHbDeviceNotificationDialogSymbian::NotificationL(KlowbatteryIcon,KNullDesC,*lowBattery);     
  1865             }            
  1970             }            
  1866         }
  1971         }
  1867         
  1972         
  1868     if ( iSysApBatteryInfoController )
  1973     if ( iSysApBatteryInfoController )
  1869     {
  1974     {
  1870      iSysApBatteryInfoController->BatteryStatusUpdated( aValue );
  1975      iSysApBatteryInfoController->BatteryStatusUpdated( aValue );
  1871     }
  1976     }
  1872       
  1977       
       
  1978  delete repository;  
  1873    }
  1979    }
  1874 
  1980 
  1875 // ----------------------------------------------------------------------------
  1981 // ----------------------------------------------------------------------------
  1876 // CSysApAppUi::ShowUiNoteL( const TSysApNoteIds aNote ) const
  1982 // CSysApAppUi::ShowUiNoteL( const TSysApNoteIds aNote ) const
  1877 // ----------------------------------------------------------------------------
  1983 // ----------------------------------------------------------------------------
  1931                 CleanupStack::PopAndDestroy(); // aString
  2037                 CleanupStack::PopAndDestroy(); // aString
  1932                 }
  2038                 }
  1933                 break;
  2039                 break;
  1934             case EBatteryFullUnplugChargerNote:
  2040             case EBatteryFullUnplugChargerNote:
  1935                 {
  2041                 {
  1936                 /*	
       
  1937                 TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) ); 
  2042                 TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) ); 
  1938                 iSysApLightsController->BatteryEmptyL( ETrue );
  2043                 iSysApLightsController->BatteryEmptyL( ETrue );
  1939                  _LIT(KunplugCharger,"txt_power_dpopinfo_unplug_charger_to_save_energy");                 
  2044                  _LIT(KunplugCharger,"txt_power_dpopinfo_unplug_charger_to_save_energy");                 
  1940                  HBufC* unplugCharger = HbTextResolverSymbian::LoadL(KunplugCharger);
  2045                  HBufC* unplugCharger = HbTextResolverSymbian::LoadL(KunplugCharger);
  1941                  _LIT(KbatteryFull,"txt_power_management_dpophead_100_full");
  2046                  _LIT(KbatteryFull,"txt_power_management_dpophead_100_full");
  1942                  HBufC* batteryFull = HbTextResolverSymbian::LoadL(KbatteryFull);
  2047                  HBufC* batteryFull = HbTextResolverSymbian::LoadL(KbatteryFull);
  1943                  CHbDeviceNotificationDialogSymbian::NotificationL(KbatteryFullIcon,*unplugCharger,*batteryFull);  
  2048                  CHbDeviceNotificationDialogSymbian::NotificationL(KbatteryFullIcon,*unplugCharger,*batteryFull);       
  1944                  */
       
  1945                  
       
  1946                  iSysApLightsController->BatteryEmptyL( ETrue );
       
  1947                  _LIT(KPowerPressKey,"Charging complete. Unplug charger to save energy.");
       
  1948                  HBufC* aString = HBufC16::NewLC(200);
       
  1949                  TPtrC aStringPointer = aString->Des();
       
  1950                  aStringPointer.Set(KPowerPressKey);
       
  1951                  TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
       
  1952                  ShowExampleUiNoteL( aStringPointer );
       
  1953                  CleanupStack::PopAndDestroy(); // aString     
       
  1954                  }
  2049                  }
  1955                 break;
  2050                 break;
  1956             case EUnplugChargerNote:
  2051             case EUnplugChargerNote:
  1957                 {
  2052                 {
  1958                 _LIT(KPowerPressKey,"Unplug charger from power supply to save energy");
  2053                 _LIT(KPowerPressKey,"Unplug charger from power supply to save energy");
  2009     if ( iSysApPsmController && UiReady() ) 
  2104     if ( iSysApPsmController && UiReady() ) 
  2010         {             
  2105         {             
  2011         if ( iCharging && !iSysApPsmController->ChargerConnected() ) // first time after charger connection
  2106         if ( iCharging && !iSysApPsmController->ChargerConnected() ) // first time after charger connection
  2012             {
  2107             {
  2013             iSysApPsmController->ConnectCharger( ETrue );
  2108             iSysApPsmController->ConnectCharger( ETrue );
  2014             if ( iSysApPsmController->ShowDeactivateQuery() )
  2109             iSysApPsmController->DoEnableFullPsm(EFalse);             
  2015                 {
  2110             iVariantAccState = CHbSymbianVariant::NewL(&KCharging, CHbSymbianVariant::EDes);
  2016                 ShowQueryL( ESysApBattChargingPowerSavingQuery );
  2111                
  2017                 // Query is on the display. Don't show the note.
  2112             if (!iHbIndicatorSymbian->Activate(KPsmPlugin,iVariantAccState)) 
  2018                 showNote = EFalse;               
  2113                {
  2019                 }
  2114                int error = iHbIndicatorSymbian->Error();
  2020             else
  2115                //use the errorcode...
  2021                 {
  2116                }
  2022                 iSysApPsmController->DoEnablePartialPsm( EFalse );
  2117               
  2023                 }              
  2118                            
  2024             }
  2119             }
  2025         else if ( aValue == EChargingStatusNotConnected )
  2120         else if ( aValue == EChargingStatusNotConnected )
  2026             {
  2121             {
  2027             iSysApPsmController->ConnectCharger( EFalse );
  2122             iSysApPsmController->ConnectCharger( EFalse );
       
  2123             if (!iHbIndicatorSymbian->Deactivate(KPsmPlugin)) 
       
  2124                {
       
  2125                int error = iHbIndicatorSymbian->Error();
       
  2126                //use the errorcode...
       
  2127                }
  2028             }            
  2128             }            
  2029         }
  2129         }
  2030     if( showNote )
  2130     if( showNote )
  2031         {
  2131         {
  2032         HandleChargerNotesL( aValue );    
  2132         HandleChargerNotesL( aValue );    
  2178             showNote = EFalse;
  2278             showNote = EFalse;
  2179             }
  2279             }
  2180         TRACES( RDebug::Print( _L("CSysApAppUi::ShowChargingNoteL KCTsyCallState=%d"), StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) ) );
  2280         TRACES( RDebug::Print( _L("CSysApAppUi::ShowChargingNoteL KCTsyCallState=%d"), StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) ) );
  2181         if ( showNote ) // Power Mgmt UI spec defines that no Charging note is shown while the phone is ringing/alerting
  2281         if ( showNote ) // Power Mgmt UI spec defines that no Charging note is shown while the phone is ringing/alerting
  2182             {
  2282             {
  2183             /* 
       
  2184             TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
  2283             TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
  2185             _LIT(KChargingNote,"txt_power_management_dblist_charging");
  2284             _LIT(KChargingNote,"txt_power_management_dblist_charging");
  2186             HBufC* chargingNote = HbTextResolverSymbian::LoadL(KChargingNote);
  2285             HBufC* chargingNote = HbTextResolverSymbian::LoadL(KChargingNote);
  2187             CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC,*chargingNote);     
  2286             CHbDeviceNotificationDialogSymbian::NotificationL(KNullDesC,*chargingNote);     
  2188             */
  2287                     
  2189              
       
  2190             _LIT(KChargingNote,"Charging");
       
  2191             HBufC* aString = HBufC16::NewLC(50);
       
  2192             TPtrC aStringPointer = aString->Des();
       
  2193             aStringPointer.Set(KChargingNote);
       
  2194             TRACES( RDebug::Print( _L("CSysApWsClient::RunL(): Key EEventKeyUp 01") ) );   
       
  2195             ShowExampleUiNoteL( aStringPointer );
       
  2196             CleanupStack::PopAndDestroy(); // aString            
       
  2197             }
  2288             }
  2198         }
  2289         }
  2199     }
  2290     }
  2200 
  2291 
  2201 
  2292 
  2429             }
  2520             }
  2430 
  2521 
  2431         TBool accessoryConnectedNow ( EFalse );
  2522         TBool accessoryConnectedNow ( EFalse );
  2432 
  2523 
  2433         TAccMode accessoryState(EAccModeHandPortable);
  2524         TAccMode accessoryState(EAccModeHandPortable);
       
  2525         TInt physicalConnectionType = 0;
  2434         if ( iSysApAccessoryObserver )
  2526         if ( iSysApAccessoryObserver )
  2435             {
  2527             {
  2436             accessoryState = iSysApAccessoryObserver->GetAccessoryMode();
  2528             accessoryState = iSysApAccessoryObserver->GetAccessoryMode();
       
  2529             physicalConnectionType = iSysApAccessoryObserver->GetAccessoryConnectionType();
  2437             }
  2530             }
  2438 
  2531 
  2439         if ( accessoryState != EAccModeHandPortable )
  2532         if ( accessoryState != EAccModeHandPortable )
  2440             {
  2533             {
  2441             accessoryConnectedNow = ETrue;
  2534             accessoryConnectedNow = ETrue;
  2447             {
  2540             {
  2448             HandleAccessoryDisconnectedL();
  2541             HandleAccessoryDisconnectedL();
  2449             }
  2542             }
  2450         else if ( !accessoryConnectedInShutdown && accessoryConnectedNow )
  2543         else if ( !accessoryConnectedInShutdown && accessoryConnectedNow )
  2451             {
  2544             {
  2452             HandleAccessoryConnectedL( accessoryState );
  2545             HandleAccessoryConnectedL( accessoryState, physicalConnectionType );
  2453             }
  2546             }
  2454         else if ( !accessoryConnectedNow )
  2547         else if ( !accessoryConnectedNow )
  2455             {
  2548             {
  2456             // not supporting this 
  2549             // not supporting this 
  2457             // TInt activeProfile ( ActiveProfileId() );
  2550             // TInt activeProfile ( ActiveProfileId() );
  2726     if (iPowerMenuDialog!=NULL)
  2819     if (iPowerMenuDialog!=NULL)
  2727         {
  2820         {
  2728         //PowerMenu already exist
  2821         //PowerMenu already exist
  2729         delete iPowerMenuDialog;
  2822         delete iPowerMenuDialog;
  2730         iPowerMenuDialog = NULL;
  2823         iPowerMenuDialog = NULL;
       
  2824         TRACES( RDebug::Print(_L("CSysApAppUi::ReleasePowerMenuCustomDialogMemory True") ) );                            
  2731         return ETrue;
  2825         return ETrue;
  2732         }
  2826         }
       
  2827     TRACES( RDebug::Print(_L("CSysApAppUi::ReleasePowerMenuCustomDialogMemory false") ) );                            
  2733     return EFalse;
  2828     return EFalse;
  2734     }
  2829     }
  2735 
  2830 
  2736 
  2831 
       
  2832 // ----------------------------------------------------------------------------
       
  2833 // CSysApAppUi::ShowAnimationL()
       
  2834 // ----------------------------------------------------------------------------
       
  2835 
       
  2836 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2837 void
       
  2838 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2839 TBool
       
  2840 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2841 CSysApAppUi::ShowAnimationL()
       
  2842     {
       
  2843     TRACES( RDebug::Print(_L("CSysApAppUi::ShowAnimationL(): START" ) ) );
       
  2844 
       
  2845     TRACES( RDebug::Print( _L("CSysApAppUi::ShowAnimationL: Initialise shutdown animation") ) );
       
  2846 
       
  2847 #ifdef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2848 
       
  2849     PrepareForShutdownAnimation();
       
  2850 
       
  2851     iSysApShutdownAnimation = CSysApShutdownAnimation::NewL( *iSysApShutdownImage );
       
  2852     iSysApShutdownAnimation->Play( TCallBack( DoStopAnimTiming, this ) );
       
  2853 
       
  2854     TRACES( RDebug::Print(_L("CSysApAppUi::ShowAnimationL(): End" ) ) );
       
  2855 
       
  2856 #else // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2857     iSysApShutdownAnimation = CSysApShutdownAnimation::NewL( this );
       
  2858     AddToStackL( iSysApShutdownAnimation );
       
  2859     iAnimationShowingTime = iSysApShutdownAnimation->ShowingTime();
       
  2860     TRACES( RDebug::Print( _L("CSysApAppUi::ShowAnimationL: Shutdown animation initialised. Animation time = %d") ,iAnimationShowingTime) );
       
  2861 
       
  2862     TBool ret_val( EFalse );
       
  2863 
       
  2864     if ( iAnimationShowingTime )
       
  2865         {
       
  2866         if ( iSysApFeatureManager->CoverDisplaySupported() )
       
  2867             {
       
  2868             // Construct mediator observer
       
  2869             iSysApMediatorObserver = CSysApMediatorObserver::NewL( this );
       
  2870 
       
  2871             // Sync animation
       
  2872             TInt err = iSysApMediatorObserver->SyncShutdownAnimation();
       
  2873 
       
  2874             if ( err != KErrNone )
       
  2875                 {
       
  2876                 // Pretend coverUI synced instantly if error in issuing command.
       
  2877                 ShutdownAnimationSyncOK();
       
  2878                 }
       
  2879             }
       
  2880         else
       
  2881             {
       
  2882             // Pretend coverUI synced instantly when it is not supported.
       
  2883             ShutdownAnimationSyncOK();
       
  2884             }
       
  2885 
       
  2886         ret_val = ETrue;
       
  2887         }
       
  2888 
       
  2889     TRACES( RDebug::Print(_L("CSysApAppUi::ShowAnimationL(): returns: %d" ),ret_val ) );
       
  2890     return ret_val;
       
  2891 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2892     }
       
  2893 
       
  2894 
       
  2895 
       
  2896 // ----------------------------------------------------------------------------
       
  2897 // CSysApAppUi::PrepareForShutdownAnimation()
       
  2898 // ----------------------------------------------------------------------------
       
  2899 void CSysApAppUi::PrepareForShutdownAnimation()
       
  2900     {
       
  2901     TRACES( RDebug::Print( _L("CSysApAppUi::PrepareForShutdownAnimation() begin") ) );
       
  2902 
       
  2903 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2904     TRACES( RDebug::Print( _L("CSysApAppUi::PrepareForShutdownAnimation() showtime = %d"), iAnimationShowingTime ) );
       
  2905     if ( iAnimationShowingTime )
       
  2906         {
       
  2907 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2908         
       
  2909         if (iPowerMenuDialog!=NULL)
       
  2910             {
       
  2911             //PowerMenu already exist
       
  2912             delete iPowerMenuDialog;
       
  2913             iPowerMenuDialog = NULL;
       
  2914             } 
       
  2915 
       
  2916         RWindowGroup groupWin = iCoeEnv->RootWin();
       
  2917         iCapturedAppskey = groupWin.CaptureKey( EKeyApplication, KModifierMask, KModifierMask );
       
  2918         iCapturedAppskeyUpAndDowns = groupWin.CaptureKeyUpAndDowns( EStdKeyApplication0, KModifierMask, KModifierMask );
       
  2919         iEikonEnv->RootWin().SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront );
       
  2920 
       
  2921         TRACES( RDebug::Print( _L("CSysApAppUi::PrepareForShutdownAnimation() Draw background image" ) ) );
       
  2922 
       
  2923         ShowShutdownImage( KBackgroundImageID );
       
  2924 
       
  2925 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2926         TRACES( RDebug::Print( _L("CSysApAppUi::PrepareForShutdownAnimation() Show Shutdown animation" ) ) );
       
  2927         TInt err(0);
       
  2928         TRAP( err, iSysApShutdownAnimation->StartL( iLastPowerKeyWasShort ) );
       
  2929         if ( err )
       
  2930             {
       
  2931             TRACES( RDebug::Print( _L("SysAp: Shutdown animation fails. Error code: %d" ), err ) );
       
  2932             // Start animation timing immediatily if animation starting fails.
       
  2933             // Otherwise animation will call StartAnimTiming when it is ready.
       
  2934             StartAnimTiming();
       
  2935             }
       
  2936         }
       
  2937 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2938 
       
  2939     TRACES( RDebug::Print( _L("CSysApAppUi::PrepareForShutdownAnimation() end") ) );
       
  2940     }
       
  2941 
       
  2942 
       
  2943 // ----------------------------------------------------------------------------
       
  2944 // CSysApAppUi::DoStopAnimTiming( TAny* aObject )
       
  2945 // ----------------------------------------------------------------------------
       
  2946 
       
  2947 TInt CSysApAppUi::DoStopAnimTiming( TAny* aObject )
       
  2948     {
       
  2949     TInt err(KErrNone);
       
  2950     CSysApAppUi* appUi = STATIC_CAST( CSysApAppUi*, aObject );
       
  2951 
       
  2952     // This method could theoretically be called by two timers (iAnimTimer and one in CSysApShutdownAnimation),
       
  2953     // so a check is needed to prevent multiple executions.
       
  2954     if ( !(appUi->iShutdownContinued) )
       
  2955         {
       
  2956         appUi->iShutdownContinued = ETrue;
       
  2957 
       
  2958         TRACES( RDebug::Print( _L("CSysApAppUi::DoStopAnimTiming() Animation timer completed or animation skipped" ) ) );
       
  2959 
       
  2960 #ifndef RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2961         if ( appUi->iAnimTimer )
       
  2962             {
       
  2963             appUi->iAnimTimer->Cancel();
       
  2964             }
       
  2965 #endif // RD_STARTUP_ANIMATION_CUSTOMIZATION
       
  2966 
       
  2967         TRACES( RDebug::Print( _L("CSysApAppUi::DoStopAnimTiming() Call ContinueShutdown(...)" ) ) );
       
  2968         appUi->ContinueShutdown();
       
  2969         TRACES( RDebug::Print( _L("CSysApAppUi::DoStopAnimTiming() end") ) );
       
  2970         }
       
  2971 
       
  2972     return err;
       
  2973     }
       
  2974 
       
  2975 
       
  2976 // ----------------------------------------------------------------------------
       
  2977 // CSysApAppUi::ContinueShutdown()
       
  2978 // ----------------------------------------------------------------------------
       
  2979 
       
  2980 void CSysApAppUi::ContinueShutdown()
       
  2981     {
       
  2982     TRACES( RDebug::Print(_L("CSysApAppUi::ContinueShutdown() started" ) ) );
       
  2983     CompleteShutdown();
       
  2984     TRACES( RDebug::Print(_L("CSysApAppUi::ContinueShutdown() completed" ) ) );
       
  2985     }
       
  2986 
       
  2987 CEikStatusPane* CSysApAppUi::StatusPane()
       
  2988 {
       
  2989 return iEikonEnv->AppUiFactory()->StatusPane();
       
  2990 }
       
  2991  
       
  2992 
       
  2993 
       
  2994 // ----------------------------------------------------------------------------
       
  2995 // CSysApAppUi::ShowEjectWaitNoteL
       
  2996 // ----------------------------------------------------------------------------
       
  2997 
       
  2998 //void CSysApAppUi::ShowEjectWaitNoteL( TInt /* aDriveToEject */ )
       
  2999  /*{
       
  3000    if ( iSysApWaitNote )
       
  3001         {
       
  3002         return;
       
  3003         }
       
  3004     HBufC* text = iSysApDriveList->GetFormattedDriveNameLC(
       
  3005         aDriveToEject,
       
  3006         0, // Not used
       
  3007         R_QTN_EJECTING_MEMORY_NAME_WAIT );
       
  3008     iSysApWaitNote = CSysApWaitNote::NewL(
       
  3009         iSysApFeatureManager->CoverDisplaySupported() );
       
  3010     iSysApWaitNote->ShowNoteL( EClosingApplicationsNote, text );
       
  3011     CleanupStack::PopAndDestroy( text );
       
  3012     }*/
       
  3013 
       
  3014 
       
  3015 // ----------------------------------------------------------------------------
       
  3016 // CSysApAppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
       
  3017 // ----------------------------------------------------------------------------
       
  3018 
       
  3019 void CSysApAppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
       
  3020     {
       
  3021     TRACES( RDebug::Print( _L("CSysApAppUi::HandleApplicationSpecificEventL: aType:%d"), aType ) );
       
  3022 
       
  3023     CEikAppUi::HandleApplicationSpecificEventL(aType, aEvent);
       
  3024     
       
  3025     if ( ResourcesFreed() )
       
  3026         {
       
  3027         TRACES( RDebug::Print( _L("CSysApAppUi::HandleApplicationSpecificEventL: discarded, shutting down") ) );
       
  3028         return;
       
  3029         }
       
  3030     
       
  3031     switch( aType )
       
  3032         {
       
  3033         case EEikKeyLockEnabled:
       
  3034             iKeyLockEnabled = ETrue;
       
  3035             iSysApCenRepController->SetInt( KCRUidCoreApplicationUIsSysAp, KSysApKeyguardActive, 1 );
       
  3036 //            SetIndicatorStateL( EAknIndicatorKeyguard, EAknIndicatorStateOn );
       
  3037             iSysApLightsController->KeylockStateChangedL( ETrue );
       
  3038             break;
       
  3039         case EEikKeyLockDisabled:
       
  3040             iKeyLockEnabled = EFalse;
       
  3041             iSysApCenRepController->SetInt( KCRUidCoreApplicationUIsSysAp, KSysApKeyguardActive, 0 );
       
  3042 //            SetIndicatorStateL( EAknIndicatorKeyguard, EAknIndicatorStateOff );
       
  3043             if (! iDeviceLockEnabled )
       
  3044                 {
       
  3045                 iSysApLightsController->KeylockStateChangedL( EFalse );
       
  3046                 if ( iSysApFeatureManager->MmcHotSwapSupported() )
       
  3047                     {
       
  3048                     if ( StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) !=  EPSCTsyCallStateRinging && StateOfProperty( KPSUidCtsyCallInformation, KCTsyCallState ) !=  EPSCTsyCallStateAlerting )
       
  3049                         {
       
  3050                         //RunUnlockNotifierL();
       
  3051                         }
       
  3052                     }
       
  3053                 }
       
  3054             break;
       
  3055         case EEikKeyLockPowerKeyPressed: //sent when power key is captured by keylockserver
       
  3056 //            HandleShortPowerKeyPressedL();
       
  3057             break;
       
  3058 
       
  3059         case EEikKeyLockLightsOnRequest:
       
  3060             iSysApLightsController->SetLightsOnUnlockNoteL();
       
  3061             break;
       
  3062 
       
  3063         case EEikEcsQueryLights: // emergency note is shown
       
  3064             iSysApLightsController->SetLightsOnEcsQueryL();
       
  3065             break;
       
  3066 
       
  3067         case EEikSecurityQueryLights: // for device lock security query
       
  3068             iSysApLightsController->SetLightsOnSecurityQueryL();
       
  3069             break;
       
  3070 
       
  3071         default:
       
  3072             break;
       
  3073             }
       
  3074     }
       
  3075 
       
  3076 
       
  3077 
       
  3078 // ----------------------------------------------------------------------------
       
  3079 // CSysApAppUi::HandleNspsRawKeyEventL()
       
  3080 // ----------------------------------------------------------------------------
       
  3081 
       
  3082 void CSysApAppUi::HandleNspsRawKeyEventL()
       
  3083     {
       
  3084 #ifdef __SYSAP_MODULE_TEST
       
  3085     ModuleTestShowUiNoteL( _L("Network wakeup from NSPS") );
       
  3086 #endif
       
  3087 
       
  3088     if ( iSysApEtelConnector )
       
  3089         {
       
  3090         iSysApEtelConnector->CommandNetCsWakeupOnNsps();
       
  3091         }
       
  3092     }
       
  3093 
       
  3094 // ----------------------------------------------------------------------------
       
  3095 // CSysApAppUi::UpdateSignalBarsL()
       
  3096 // ----------------------------------------------------------------------------
       
  3097 
       
  3098 void CSysApAppUi::UpdateSignalBarsL()
       
  3099     {
       
  3100 //    UpdateSignalBarsL(iSysApEtelConnector->GetSignalBars());
       
  3101     }
       
  3102 
       
  3103 // ----------------------------------------------------------------------------
       
  3104 // CSysApAppUi::HandleSmsStorageNotificationL( TBool aSimStoreFull )
       
  3105 // ----------------------------------------------------------------------------
       
  3106 
       
  3107 void CSysApAppUi::HandleSmsStorageNotificationL( TBool aSimStoreFull )
       
  3108     {
       
  3109     TRACES( RDebug::Print( _L("CSysApAppUi::HandleSmsStorageNotificationL: aSimStoreFull: %d "), aSimStoreFull ) );
       
  3110 
       
  3111     if ( aSimStoreFull )
       
  3112         {
       
  3113 /*        HBufC* noteStringBuf;
       
  3114         noteStringBuf = StringLoader::LoadLC( R_QTN_MEMLO_MEMORY_LOW_SIM_MES, iEikonEnv );
       
  3115         TPtr textBuffer = noteStringBuf->Des();
       
  3116         iSysApMsgSimMemLowQuery->StartL( textBuffer );
       
  3117         CleanupStack::PopAndDestroy();
       
  3118 */        }
       
  3119 
       
  3120 //    SetEnvelopeIndicatorL();
       
  3121     }
       
  3122 
       
  3123 // ----------------------------------------------------------------------------
       
  3124 // CSysApAppUi::HandleNetworkNspsNotification( RMmCustomAPI::TNspsStatus aNspsStatus )
       
  3125 // ----------------------------------------------------------------------------
       
  3126 
       
  3127 void CSysApAppUi::HandleNetworkNspsNotification( RMmCustomAPI::TNspsStatus aNspsStatus )
       
  3128     {
       
  3129     TRACES( RDebug::Print( _L("CSysApAppUi::HandleNetworkNspsNotification aNspsStatus:%d, iNsps:%d )" ), aNspsStatus, iNsps ) );
       
  3130     if( iSysApNspsHandler )
       
  3131         {
       
  3132         if( aNspsStatus == RMmCustomAPI::ENspsOn )
       
  3133             {
       
  3134             if( !iNsps )
       
  3135                 {
       
  3136 #ifdef __SYSAP_MODULE_TEST
       
  3137                 TRAPD( err, ModuleTestShowUiNoteL( _L("Setting NSPS on") ) );
       
  3138 #endif
       
  3139                 iSysApNspsHandler->SetNspsOn();
       
  3140                 iNsps = ETrue;
       
  3141                 }
       
  3142             }
       
  3143         else if( aNspsStatus == RMmCustomAPI::ENspsOff )
       
  3144             {
       
  3145             if( iNsps )
       
  3146                 {
       
  3147 #ifdef __SYSAP_MODULE_TEST
       
  3148                 TRAPD( err, ModuleTestShowUiNoteL( _L("Setting NSPS off") ) );
       
  3149 #endif
       
  3150                 iSysApNspsHandler->SetNspsOff();
       
  3151                 iNsps = EFalse;
       
  3152                 }
       
  3153             }
       
  3154         }
       
  3155     }
       
  3156 
       
  3157 
       
  3158 
  2737 //end of file
  3159 //end of file