187 const TInt KHWSwitchGroup( 29 ); |
187 const TInt KHWSwitchGroup( 29 ); |
188 const TInt KHWSwitchGrip( 2 ); |
188 const TInt KHWSwitchGrip( 2 ); |
189 |
189 |
190 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy); |
190 _LIT_SECURITY_POLICY_PASS(KAlwaysPassPolicy); |
191 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData); |
191 _LIT_SECURITY_POLICY_C1(KWriteDeviceDataPolicy, ECapabilityWriteDeviceData); |
|
192 |
|
193 |
|
194 _LIT(KPowerSaveActivate,"Power saving mode activated"); |
|
195 _LIT(KPowerSaveDeActivate,"Power saving mode deactivated"); |
192 |
196 |
193 // ============================ MEMBER FUNCTIONS ============================== |
197 // ============================ MEMBER FUNCTIONS ============================== |
194 |
198 |
195 // ---------------------------------------------------------------------------- |
199 // ---------------------------------------------------------------------------- |
196 // CSysApAppUi::CSysApAppUi() |
200 // CSysApAppUi::CSysApAppUi() |
262 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: START") ) ); |
266 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: START") ) ); |
263 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying BaseConstructL( EAknEnableSkin )") ) ); |
267 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: trying BaseConstructL( EAknEnableSkin )") ) ); |
264 BaseConstructL( EAknEnableSkin ); |
268 BaseConstructL( EAknEnableSkin ); |
265 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: BaseConstructL() OK") ) ); |
269 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: BaseConstructL() OK") ) ); |
266 |
270 |
267 iFlagForRmvMmcFrmShortPwrKey = EFalse; |
271 |
268 |
|
269 /*SysAp is set as system application (Symbian terminology). This means some special privilege compared |
272 /*SysAp is set as system application (Symbian terminology). This means some special privilege compared |
270 to other applications. For example it does not get closed when system is asked to close applications |
273 to other applications. For example it does not get closed when system is asked to close applications |
271 */ |
274 */ |
272 iEikonEnv->SetSystem( ETrue ); |
275 iEikonEnv->SetSystem( ETrue ); |
273 |
276 |
345 iSysApCenRepFmTxObserver = CSysApCenRepFmTxObserver::NewL( *this ); |
348 iSysApCenRepFmTxObserver = CSysApCenRepFmTxObserver::NewL( *this ); |
346 } |
349 } |
347 |
350 |
348 // Define P&S keys "owned" by SysAp |
351 // Define P&S keys "owned" by SysAp |
349 RProperty::Define( KPSUidUikon, KUikMMCInserted, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy ); |
352 RProperty::Define( KPSUidUikon, KUikMMCInserted, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy ); |
350 |
353 //initially set the value as 0 assuming mmc is not inserted |
|
354 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
351 TDriveInfo driveInfo; |
355 TDriveInfo driveInfo; |
352 TInt driveNumber; |
356 TInt driveNumber; |
353 TInt err; |
357 TInt err; |
354 RFs& fileServer = iEikonEnv->FsSession(); |
358 RFs& fileServer = iEikonEnv->FsSession(); |
355 for ( driveNumber = EDriveD; driveNumber < EDriveZ; driveNumber++ ) |
359 for ( driveNumber = EDriveD; driveNumber < EDriveZ; driveNumber++ ) |
356 { |
360 { |
357 err = fileServer.Drive(driveInfo,driveNumber); |
361 err = fileServer.Drive(driveInfo,driveNumber); |
358 if(err == KErrNone && driveInfo.iType == EMediaHardDisk && driveInfo.iDriveAtt & KDriveAttRemovable) |
362 if(driveNumber==EDriveF && err == KErrNone && driveInfo.iType == EMediaHardDisk && driveInfo.iDriveAtt & KDriveAttRemovable) |
359 { |
363 { |
360 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: err = %d, driveInfo.iType = %d, driveInfo.iDriveAtt %d, KDriveAttRemovable = %d "),err,driveInfo.iType,driveInfo.iDriveAtt,KDriveAttRemovable) ); |
364 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: err = %d, driveInfo.iType = %d, driveInfo.iDriveAtt %d, KDriveAttRemovable = %d "),err,driveInfo.iType,driveInfo.iDriveAtt,KDriveAttRemovable) ); |
361 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
365 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
362 break; // Memory card drive found... |
366 break; // Memory card drive found... |
363 } |
367 } |
364 } |
368 } |
365 |
369 |
366 RProperty::Define( KPSUidCoreApplicationUIs, KCoreAppUIsHideAlarm, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy ); |
370 RProperty::Define( KPSUidCoreApplicationUIs, KCoreAppUIsHideAlarm, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy ); |
367 RProperty::Define( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy ); |
371 RProperty::Define( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, RProperty::EInt, KAlwaysPassPolicy, KWriteDeviceDataPolicy ); |
483 #endif // RD_LIGHT_CONTROL_CHANGE |
487 #endif // RD_LIGHT_CONTROL_CHANGE |
484 |
488 |
485 // Create HAC setting observer now because telephony state may change before entering to normal state |
489 // Create HAC setting observer now because telephony state may change before entering to normal state |
486 TRACES( RDebug::Print( _L("CCSysApAppUi::ConstructL trying CSysApCenRepHacSettingObserver::NewL") ) ); |
490 TRACES( RDebug::Print( _L("CCSysApAppUi::ConstructL trying CSysApCenRepHacSettingObserver::NewL") ) ); |
487 iSysApCenRepHacSettingObserver = CSysApCenRepHacSettingObserver::NewL( *this ); |
491 iSysApCenRepHacSettingObserver = CSysApCenRepHacSettingObserver::NewL( *this ); |
488 |
492 |
|
493 DeactivatePSMifBatteryNotLowL (); |
|
494 |
489 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: END") ) ); |
495 TRACES( RDebug::Print( _L("CSysApAppUi::ConstructL: END") ) ); |
490 } |
496 } |
|
497 |
|
498 |
|
499 // ---------------------------------------------------------------------------- |
|
500 // CSysApAppUi::DeactivatePSMifBatteryNotLow() |
|
501 // ---------------------------------------------------------------------------- |
|
502 void CSysApAppUi::DeactivatePSMifBatteryNotLowL () |
|
503 { |
|
504 TRACES( RDebug::Print( _L("CSysApAppUi::DeactivatePSMifBatteryNotLow: Start") ) ); |
|
505 if ( iSysApFeatureManager->PowerSaveSupported()) //&& iSysApFeatureManager->Supported( KSysApFeatureIdBatteryInfoPopup )) |
|
506 { |
|
507 // Create batteruInfoController to get current battery status; |
|
508 if(iSysApBatteryInfoController == NULL) |
|
509 { |
|
510 iSysApBatteryInfoController = CSysApBatteryInfoController::NewL( |
|
511 iSysApCenRepController->GetInt( |
|
512 KCRUidCoreApplicationUIsConf, |
|
513 KCoreAppUIsBatteryInformationLowThreshold ) ); |
|
514 } |
|
515 //Querry the battery level |
|
516 TBool status = iSysApBatteryInfoController->IsBatteryInfoAboveThreshold(); |
|
517 TRACES( RDebug::Print( _L("CCSysApAppUi::DeactivatePSMifBatteryNotLow IsBatteryInfoAboveThreshold=%d"), status ) ); |
|
518 // Querry to deactivate PSM if PSM is activated and battery status is above threshold |
|
519 if (status) |
|
520 { |
|
521 if(iSysApPsmController == NULL) |
|
522 { |
|
523 iSysApPsmController = CSysApPsmController::NewL( *this ); |
|
524 } |
|
525 if ( iSysApPsmController->ShowDeactivateQuery()) |
|
526 ShowQueryL( ESysApBattChargingPowerSavingQuery ); |
|
527 else |
|
528 iSysApPsmController->DoEnablePartialPsm( EFalse ); |
|
529 } |
|
530 } |
|
531 TRACES( RDebug::Print( _L("CSysApAppUi::DeactivatePSMifBatteryNotLow: End") ) ); |
|
532 } |
491 |
533 |
492 // ---------------------------------------------------------------------------- |
534 // ---------------------------------------------------------------------------- |
493 // CSysApAppUi::~CSysApAppUi() |
535 // CSysApAppUi::~CSysApAppUi() |
494 // ---------------------------------------------------------------------------- |
536 // ---------------------------------------------------------------------------- |
495 |
537 |
1544 |
1586 |
1545 if ( noteStringBuf ) |
1587 if ( noteStringBuf ) |
1546 { |
1588 { |
1547 TPtr textBuffer = noteStringBuf->Des(); |
1589 TPtr textBuffer = noteStringBuf->Des(); |
1548 TRACES( RDebug::Print( _L("CSysApAppUi::ShowUiNoteL Next:note->ShowNoteL" ) ) ); |
1590 TRACES( RDebug::Print( _L("CSysApAppUi::ShowUiNoteL Next:note->ShowNoteL" ) ) ); |
|
1591 if(textBuffer.Compare(KPowerSaveActivate)==0) |
|
1592 { |
|
1593 CleanupStack::PopAndDestroy(2); // note and noteStringbuf |
|
1594 return; |
|
1595 } |
|
1596 if(textBuffer.Compare(KPowerSaveDeActivate)==0) |
|
1597 { |
|
1598 CleanupStack::PopAndDestroy(2); // note and noteStringbuf |
|
1599 return; |
|
1600 } |
1549 note->ShowNoteL( noteType, textBuffer ); |
1601 note->ShowNoteL( noteType, textBuffer ); |
1550 CleanupStack::PopAndDestroy( ); // noteStringbuf |
1602 CleanupStack::PopAndDestroy( ); // noteStringbuf |
1551 } |
1603 } |
1552 else |
1604 else |
1553 { |
1605 { |
3964 iInsertedMemoryCards[ aSelection - iPowerkeyMenuEjectSelectionBase ].iDrive; |
4016 iInsertedMemoryCards[ aSelection - iPowerkeyMenuEjectSelectionBase ].iDrive; |
3965 TRACES( RDebug::Print( |
4017 TRACES( RDebug::Print( |
3966 _L( "CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Eject\" selected, drive=%d" ), |
4018 _L( "CSysApAppUi::PowerKeyPopUpMenuSelectionDoneL: \"Eject\" selected, drive=%d" ), |
3967 iDriveToEject ) ); |
4019 iDriveToEject ) ); |
3968 iSysApDriveList->ResetDrivesToEject(); |
4020 iSysApDriveList->ResetDrivesToEject(); |
3969 iFlagForRmvMmcFrmShortPwrKey = ETrue; |
|
3970 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
4021 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
3971 EjectMMCL(); |
4022 EjectMMCL(); |
3972 } |
4023 } |
3973 #endif // RD_MULTIPLE_DRIVE |
4024 #endif // RD_MULTIPLE_DRIVE |
3974 else if ( iSysApPsmController && aSelection == iSysApPsmController->UiItemId() ) |
4025 else if ( iSysApPsmController && aSelection == iSysApPsmController->UiItemId() ) |
4936 iSysApCenRepMsgWaitingObserver = CSysApCenRepMsgWaitingObserver::NewL( *this ); |
4987 iSysApCenRepMsgWaitingObserver = CSysApCenRepMsgWaitingObserver::NewL( *this ); |
4937 |
4988 |
4938 |
4989 |
4939 if ( iSysApFeatureManager->Supported( KSysApFeatureIdBatteryInfoPopup ) ) |
4990 if ( iSysApFeatureManager->Supported( KSysApFeatureIdBatteryInfoPopup ) ) |
4940 { |
4991 { |
4941 iSysApBatteryInfoController = CSysApBatteryInfoController::NewL( iSysApCenRepController->GetInt( KCRUidCoreApplicationUIsConf, |
4992 if( iSysApBatteryInfoController == NULL) |
|
4993 { |
|
4994 iSysApBatteryInfoController = CSysApBatteryInfoController::NewL( iSysApCenRepController->GetInt( KCRUidCoreApplicationUIsConf, |
4942 KCoreAppUIsBatteryInformationLowThreshold ) ); |
4995 KCoreAppUIsBatteryInformationLowThreshold ) ); |
|
4996 } |
4943 } |
4997 } |
4944 |
4998 |
4945 |
4999 |
4946 TRACES( RDebug::Print( _L("CSysApAppUi::DoSwStateNormalConstructionL : END" ) ) ); |
5000 TRACES( RDebug::Print( _L("CSysApAppUi::DoSwStateNormalConstructionL : END" ) ) ); |
4947 } |
5001 } |
5486 |
5540 |
5487 if ( aDrive == defaultMemoryCard ) |
5541 if ( aDrive == defaultMemoryCard ) |
5488 { |
5542 { |
5489 if ( memoryCardStatus == ESysApMemoryCardInserted ) |
5543 if ( memoryCardStatus == ESysApMemoryCardInserted ) |
5490 { |
5544 { |
5491 if(!iFlagForRmvMmcFrmShortPwrKey) |
5545 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
5492 { |
|
5493 RProperty::Set( KPSUidUikon, KUikMMCInserted, 1 ); |
|
5494 } |
|
5495 iFlagForRmvMmcFrmShortPwrKey = EFalse; |
|
5496 } |
5546 } |
5497 else |
5547 else |
5498 { |
5548 { |
5499 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
5549 RProperty::Set( KPSUidUikon, KUikMMCInserted, 0 ); |
5500 } |
5550 } |
6657 TRACES( RDebug::Print( _L("CSysApAppUi::NotifyPowerSaveModeL aStatus: %d"), aStatus ) ); |
6707 TRACES( RDebug::Print( _L("CSysApAppUi::NotifyPowerSaveModeL aStatus: %d"), aStatus ) ); |
6658 |
6708 |
6659 // cancel any active power saving query because user has changed the state manually |
6709 // cancel any active power saving query because user has changed the state manually |
6660 CancelQuery( ESysApBattChargingPowerSavingQuery ); |
6710 CancelQuery( ESysApBattChargingPowerSavingQuery ); |
6661 CancelQuery( ESysApBattLowPowerSavingQuery ); |
6711 CancelQuery( ESysApBattLowPowerSavingQuery ); |
6662 |
6712 |
6663 switch ( aStatus ) |
6713 switch ( aStatus ) |
6664 { |
6714 { |
6665 case MSysApPsmControllerNotifyCallback::EPsmActivationComplete: |
6715 case MSysApPsmControllerNotifyCallback::EPsmActivationComplete: |
6666 UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) ); |
6716 UpdateBatteryBarsL( StateOfProperty( KPSUidHWRMPowerState, KHWRMBatteryLevel ) ); |
6667 ShowUiNoteL( EPowerSaveModeActivated ); |
6717 ShowUiNoteL( EPowerSaveModeActivated ); |