55 #include "SecQueryUi.h" |
54 #include "SecQueryUi.h" |
56 |
55 |
57 // LOCAL CONSTANTS AND MACROS |
56 // LOCAL CONSTANTS AND MACROS |
58 const TInt KMaxNumberOfPUKAttempts(10); |
57 const TInt KMaxNumberOfPUKAttempts(10); |
59 const TInt KMaxNumberOfPINAttempts(3); |
58 const TInt KMaxNumberOfPINAttempts(3); |
60 const TInt KLastRemainingInputAttempt(1); |
59 // not used |
|
60 // const TInt KLastRemainingInputAttempt(1); |
61 |
61 |
62 const TInt KTriesToConnectServer(2); |
62 const TInt KTriesToConnectServer(2); |
63 const TInt KTimeBeforeRetryingRequest(50000); |
63 const TInt KTimeBeforeRetryingRequest(50000); |
64 |
64 |
65 // ================= MEMBER FUNCTIONS ======================= |
65 // ================= MEMBER FUNCTIONS ======================= |
387 * Series 60 Customer / ETel |
387 * Series 60 Customer / ETel |
388 * Series 60 ETel API |
388 * Series 60 ETel API |
389 *****************************************************/ |
389 *****************************************************/ |
390 |
390 |
391 RDEBUG("0", 0); |
391 RDEBUG("0", 0); |
392 |
|
393 #if defined(_DEBUG) |
|
394 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL()")); |
|
395 #endif |
|
396 TInt res; |
392 TInt res; |
397 CWait* wait; |
393 CWait* wait; |
398 |
394 |
399 RMobilePhone::TMobilePhoneLockSetting lockChange( |
395 RMobilePhone::TMobilePhoneLockSetting lockChange( |
400 RMobilePhone::ELockSetDisabled); |
396 RMobilePhone::ELockSetDisabled); |
401 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
397 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
402 |
|
403 #if defined(_DEBUG) |
|
404 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() get autolock period")); |
|
405 #endif |
|
406 |
398 |
407 // get autolock period from Central Repository. |
399 // get autolock period from Central Repository. |
408 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
400 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
409 TInt period = 0; |
401 TInt period = 0; |
410 res = repository->Get(KSettingsAutoLockTime, period); |
402 res = repository->Get(KSettingsAutoLockTime, period); |
411 delete repository; |
403 delete repository; |
412 |
404 |
413 RDEBUG("res", res); |
405 RDEBUG("res", res); |
414 |
406 RDEBUG("period", period); |
415 #if defined(_DEBUG) |
407 |
416 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() autolock period:%d"), res); |
|
417 #endif |
|
418 if (res == KErrNone) |
408 if (res == KErrNone) |
419 { |
409 { |
420 // disable autolock in Domestic OS side too if autolock period is 0. |
410 // disable autolock in Domestic OS side too if autolock period is 0. |
421 RDEBUG("period", period); |
|
422 if (period == 0) |
411 if (period == 0) |
423 { |
412 { |
424 #if defined(_DEBUG) |
413 RDEBUG("period", period); |
425 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Call SetLockSetting")); |
414 |
426 #endif |
|
427 |
|
428 #ifdef RD_REMOTELOCK |
|
429 // If remote lock is enabled, don't disable the domestic OS device lock |
415 // If remote lock is enabled, don't disable the domestic OS device lock |
430 // since that would render the RemoteLock useless. |
416 // since that would render the RemoteLock useless. |
431 // Instead just re-set the DOS lock to enabled which as a side effect |
417 // Instead just re-set the DOS lock to enabled which as a side effect |
432 // requests the security code from the user. |
418 // requests the security code from the user. |
433 |
419 |
438 { |
424 { |
439 RDEBUG( "0", 0 ); |
425 RDEBUG( "0", 0 ); |
440 if ( remoteLockStatus ) |
426 if ( remoteLockStatus ) |
441 { |
427 { |
442 // Remote lock is enabled |
428 // Remote lock is enabled |
443 #ifdef _DEBUG |
|
444 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); |
|
445 #endif // _DEBUG |
|
446 lockChange = RMobilePhone::ELockSetEnabled; |
429 lockChange = RMobilePhone::ELockSetEnabled; |
|
430 RDEBUG("lockChange", lockChange); |
447 } |
431 } |
448 else |
432 else |
449 { |
433 { |
450 // Remote lock is disabled |
434 // Remote lock is disabled |
451 #ifdef _DEBUG |
|
452 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); |
|
453 #endif // _DEBUG |
|
454 lockChange = RMobilePhone::ELockSetDisabled; |
435 lockChange = RMobilePhone::ELockSetDisabled; |
|
436 RDEBUG("lockChange", lockChange); |
455 } |
437 } |
456 } |
438 } |
457 else |
439 else |
458 { |
440 { |
459 // Failed to get remote lock status |
441 // Failed to get remote lock status |
460 #ifdef _DEBUG |
442 RDEBUG("Failed", lockChange); |
461 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get RemoteLock status" ) ); |
|
462 #endif // _DEBUG |
|
463 } |
443 } |
464 |
444 |
465 delete remoteLockSettings; |
445 delete remoteLockSettings; |
466 remoteLockSettings = NULL; |
446 remoteLockSettings = NULL; |
467 |
447 |
468 #else // not defined RD_REMOTELOCK |
|
469 lockChange = RMobilePhone::ELockSetDisabled; |
|
470 |
|
471 #endif // RD_REMOTELOCK |
|
472 RDEBUG("lockChange", lockChange); |
448 RDEBUG("lockChange", lockChange); |
473 wait = CWait::NewL(); |
449 wait = CWait::NewL(); |
474 RDEBUG("0", 0); |
450 RDEBUG("0", 0); |
475 // this also calls PassPhraseRequiredL ??? |
451 // this also calls PassPhraseRequiredL ??? |
476 RDEBUG("SetLockSetting", 1); |
452 RDEBUG("SetLockSetting", 1); |
478 res = KErrNone; |
454 res = KErrNone; |
479 RDEBUG("WaitForRequestL", 0); |
455 RDEBUG("WaitForRequestL", 0); |
480 res = wait->WaitForRequestL(); |
456 res = wait->WaitForRequestL(); |
481 RDEBUG("res", res); |
457 RDEBUG("res", res); |
482 delete wait; |
458 delete wait; |
483 #if defined(_DEBUG) |
|
484 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() SetLockSetting RESULT:%d"), res); |
|
485 #endif |
|
486 } // from period == 0 |
459 } // from period == 0 |
487 else |
460 else |
488 { // ask security code |
461 { // ask security code |
489 #if defined(_DEBUG) |
462 RDEBUG("codeQueryNotifier 0", 0); |
490 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Ask sec code via notifier")); |
|
491 #endif |
|
492 RDEBUG("0", 0); |
|
493 RNotifier codeQueryNotifier; |
463 RNotifier codeQueryNotifier; |
494 User::LeaveIfError(codeQueryNotifier.Connect()); |
464 User::LeaveIfError(codeQueryNotifier.Connect()); |
495 CWait* wait = CWait::NewL(); |
465 CWait* wait = CWait::NewL(); |
496 CleanupStack::PushL(wait); |
466 CleanupStack::PushL(wait); |
497 TInt queryResponse = 0; |
467 TInt queryResponse = 0; |
499 RDEBUG("0", 0); |
469 RDEBUG("0", 0); |
500 TSecurityNotificationPckg params; |
470 TSecurityNotificationPckg params; |
501 params().iEvent |
471 params().iEvent |
502 = static_cast<TInt> (RMobilePhone::EPhonePasswordRequired); |
472 = static_cast<TInt> (RMobilePhone::EPhonePasswordRequired); |
503 params().iStartup = EFalse; |
473 params().iStartup = EFalse; |
504 #if defined(_DEBUG) |
474 |
505 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Start Notifier")); |
|
506 #endif |
|
507 RDEBUG("0", 0); |
|
508 RDEBUG("StartNotifierAndGetResponse", 0); |
475 RDEBUG("StartNotifierAndGetResponse", 0); |
509 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, |
476 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, |
510 KSecurityNotifierUid, params, response); |
477 KSecurityNotifierUid, params, response); |
511 // this will eventually call PassPhraseRequiredL |
478 // this will eventually call PassPhraseRequiredL |
512 RDEBUG("WaitForRequestL", 0); |
479 RDEBUG("WaitForRequestL", 0); |
521 } |
488 } |
522 else |
489 else |
523 { // can't read repository for KSettingsAutoLockTime |
490 { // can't read repository for KSettingsAutoLockTime |
524 RDEBUG("KERRSOMETHING:Call SetLockSetting", 0); |
491 RDEBUG("KERRSOMETHING:Call SetLockSetting", 0); |
525 |
492 |
526 #ifdef RD_REMOTELOCK |
|
527 |
|
528 // If remote lock is enabled, don't disable the domestic OS device lock |
493 // If remote lock is enabled, don't disable the domestic OS device lock |
529 // since that would render the RemoteLock useless. |
494 // since that would render the RemoteLock useless. |
530 // Instead just re-set the DOS lock to enabled which as a side effect |
495 // Instead just re-set the DOS lock to enabled which as a side effect |
531 // requests the security code from the user. |
496 // requests the security code from the user. |
532 |
497 |
536 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
501 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
537 { |
502 { |
538 if ( remoteLockStatus ) |
503 if ( remoteLockStatus ) |
539 { |
504 { |
540 // Remote lock is enabled |
505 // Remote lock is enabled |
541 #ifdef _DEBUG |
|
542 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); |
|
543 #endif // _DEBUG |
|
544 lockChange = RMobilePhone::ELockSetEnabled; |
506 lockChange = RMobilePhone::ELockSetEnabled; |
|
507 RDEBUG("lockChange", lockChange); |
545 } |
508 } |
546 else |
509 else |
547 { |
510 { |
548 // Remote lock is disabled |
511 // Remote lock is disabled |
549 #ifdef _DEBUG |
|
550 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); |
|
551 #endif // _DEBUG |
|
552 lockChange = RMobilePhone::ELockSetDisabled; |
512 lockChange = RMobilePhone::ELockSetDisabled; |
|
513 RDEBUG("lockChange", lockChange); |
553 } |
514 } |
554 } |
515 } |
555 else |
516 else |
556 { |
517 { |
557 // Failed to get remote lock status |
518 // Failed to get remote lock status |
558 #ifdef _DEBUG |
519 RDEBUG("Failed", lockChange); |
559 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and failed to get RemoteLock status" ) ); |
|
560 #endif // _DEBUG |
|
561 } |
520 } |
562 |
521 |
563 delete remoteLockSettings; |
522 delete remoteLockSettings; |
564 remoteLockSettings = NULL; |
523 remoteLockSettings = NULL; |
565 |
524 |
566 #else // not defined RD_REMOTELOCK |
|
567 // could not get the current autolock time... disable autolock in Domestic OS side. |
|
568 lockChange = RMobilePhone::ELockSetDisabled; |
|
569 |
|
570 #endif // RD_REMOTELOCK |
|
571 RDEBUG("0", 0); |
525 RDEBUG("0", 0); |
572 |
|
573 wait = CWait::NewL(); |
526 wait = CWait::NewL(); |
574 RDEBUG("SetLockSetting", 0); |
527 RDEBUG("SetLockSetting", 0); |
575 iPhone.SetLockSetting(wait->iStatus, lockType, lockChange); |
528 iPhone.SetLockSetting(wait->iStatus, lockType, lockChange); |
576 RDEBUG("WaitForRequestL", 0); |
529 RDEBUG("WaitForRequestL", 0); |
577 res = wait->WaitForRequestL(); |
530 res = wait->WaitForRequestL(); |
578 RDEBUG("WaitForRequestL", 1); |
531 RDEBUG("WaitForRequestL res", res); |
579 delete wait; |
532 delete wait; |
580 #if defined(_DEBUG) |
|
581 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KES: SetLockSetting RESULT:%d"), res); |
|
582 #endif |
|
583 } |
533 } |
584 |
534 |
585 RDEBUG("res", res); |
535 RDEBUG("res", res); |
586 switch (res) |
536 switch (res) |
587 { |
537 { |
665 else |
615 else |
666 { |
616 { |
667 if (StartUp) |
617 if (StartUp) |
668 isConditionSatisfied = ETrue; |
618 isConditionSatisfied = ETrue; |
669 } |
619 } |
670 #if defined(_DEBUG) |
620 |
671 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 1")); |
|
672 #endif |
|
673 // Security code at bootup: No "cancel" softkey; Emergency calls enabled. |
621 // Security code at bootup: No "cancel" softkey; Emergency calls enabled. |
674 RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = |
622 RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = |
675 RMobilePhone::ESecurityCodePhonePassword; // for starters |
623 RMobilePhone::ESecurityCodePhonePassword; // for starters |
676 RDEBUG("isConditionSatisfied", isConditionSatisfied); |
624 RDEBUG("isConditionSatisfied", isConditionSatisfied); |
677 if (isConditionSatisfied) |
625 if (isConditionSatisfied) |
730 |
678 |
731 RMobilePhone::TMobilePhoneSecurityCode secCodeType = |
679 RMobilePhone::TMobilePhoneSecurityCode secCodeType = |
732 RMobilePhone::ESecurityCodePhonePassword; |
680 RMobilePhone::ESecurityCodePhonePassword; |
733 CWait* wait = NULL; |
681 CWait* wait = NULL; |
734 TInt status = KErrNone; |
682 TInt status = KErrNone; |
735 ; |
683 |
736 wait = CWait::NewL(); |
684 wait = CWait::NewL(); |
737 RDEBUG("VerifySecurityCode", 0); |
685 RDEBUG("VerifySecurityCode", 0); |
738 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, |
686 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, |
739 required_fourth); |
687 required_fourth); |
740 RDEBUG("WaitForRequestL", 0); |
688 RDEBUG("WaitForRequestL", 0); |
750 #endif |
698 #endif |
751 |
699 |
752 TInt returnValue = status; |
700 TInt returnValue = status; |
753 RDEBUG("tarmFlag", tarmFlag); |
701 RDEBUG("tarmFlag", tarmFlag); |
754 RDEBUG("StartUp", StartUp); |
702 RDEBUG("StartUp", StartUp); |
|
703 RDEBUG("status", status); |
755 switch (status) |
704 switch (status) |
756 { |
705 { |
757 case KErrNone: |
706 case KErrNone: |
758 #if defined(_DEBUG) |
707 // code approved |
759 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrNone")); |
708 RDEBUG( "KErrNone", KErrNone ); |
760 #endif |
|
761 // code approved |
|
762 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, |
709 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, |
763 CAknNoteDialog::EConfirmationTone); |
710 CAknNoteDialog::EConfirmationTone); |
764 RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); |
711 RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); |
765 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
712 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
766 { |
713 { |
779 SCP_TARM_ADMIN_FLAG_UID, tarmFlag); |
726 SCP_TARM_ADMIN_FLAG_UID, tarmFlag); |
780 } |
727 } |
781 |
728 |
782 if (tRet != KErrNone) |
729 if (tRet != KErrNone) |
783 { |
730 { |
784 #if defined(_DEBUG) |
731 RDEBUG( "FAILED to unset TARM Admin Flag tRet=", tRet ); |
785 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL():\ |
|
786 FAILED to unset TARM Admin Flag")); |
|
787 #endif |
|
788 } |
732 } |
789 } |
733 } |
790 if (!FeatureManager::FeatureSupported( |
734 if (!FeatureManager::FeatureSupported( |
791 KFeatureIdSapDeviceLockEnhancements)) |
735 KFeatureIdSapDeviceLockEnhancements)) |
792 { |
736 { |
806 |
750 |
807 } |
751 } |
808 RDEBUG("StartUp", StartUp); |
752 RDEBUG("StartUp", StartUp); |
809 if (StartUp) |
753 if (StartUp) |
810 { |
754 { |
811 #if defined(_DEBUG) |
|
812 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; get autolock period.")); |
|
813 #endif |
|
814 |
|
815 // get autolock period from Central Repository. |
755 // get autolock period from Central Repository. |
816 CRepository* repository = CRepository::NewL( |
756 CRepository* repository = CRepository::NewL( |
817 KCRUidSecuritySettings); |
757 KCRUidSecuritySettings); |
818 TInt period = 0; |
758 TInt period = 0; |
819 TInt res = repository->Get(KSettingsAutoLockTime, period); |
759 TInt res = repository->Get(KSettingsAutoLockTime, period); |
820 delete repository; |
760 delete repository; |
|
761 RDEBUG("res", res); |
|
762 RDEBUG("period", period); |
821 |
763 |
822 _LIT_SECURITY_POLICY_PASS( KReadPolicy); |
764 _LIT_SECURITY_POLICY_PASS( KReadPolicy); |
823 _LIT_SECURITY_POLICY_C1(KWritePolicy, |
765 _LIT_SECURITY_POLICY_C1(KWritePolicy, |
824 ECapabilityWriteDeviceData); |
766 ECapabilityWriteDeviceData); |
825 RProperty::Define(KPSUidCoreApplicationUIs, |
767 RProperty::Define(KPSUidCoreApplicationUIs, |
826 KCoreAppUIsAutolockStatus, RProperty::EInt, |
768 KCoreAppUIsAutolockStatus, RProperty::EInt, |
827 KReadPolicy, KWritePolicy); |
769 KReadPolicy, KWritePolicy); |
828 RProperty::Set(KPSUidCoreApplicationUIs, |
770 RProperty::Set(KPSUidCoreApplicationUIs, |
829 KCoreAppUIsAutolockStatus, EAutolockOff); |
771 KCoreAppUIsAutolockStatus, EAutolockOff); |
830 #if defined(_DEBUG) |
772 RDEBUG("KCoreAppUIsAutolockStatus", KCoreAppUIsAutolockStatus); |
831 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() EAutolockOff")); |
|
832 #endif |
|
833 |
773 |
834 if (res == KErrNone) |
774 if (res == KErrNone) |
835 { |
775 { |
836 // disable autolock in Domestic OS side too if autolock period is 0. |
776 // disable autolock in Domestic OS side too if autolock period is 0. |
837 if (period == 0) |
777 if (period == 0) |
846 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
786 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
847 { |
787 { |
848 if ( !remoteLockStatus ) |
788 if ( !remoteLockStatus ) |
849 { |
789 { |
850 // Remote lock is disabled |
790 // Remote lock is disabled |
851 #ifdef _DEBUG |
791 RDEBUG("Autolock and RemoteLock are disabled -> disable DOS device lock", 0); |
852 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Autolock and RemoteLock are disabled -> disable DOS device lock" ) ); |
|
853 #endif // _DEBUG |
|
854 // Disable DOS device lock setting |
792 // Disable DOS device lock setting |
855 RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); |
793 RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); |
856 wait = CWait::NewL(); |
794 wait = CWait::NewL(); |
857 iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); |
795 iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); |
858 wait->WaitForRequestL(); |
796 RDEBUG( "WaitForRequestL", 0 ); |
859 RDEBUG( "iCustomPhone.DisablePhoneLock", 1 ); |
797 status = wait->WaitForRequestL(); |
|
798 RDEBUG( "WaitForRequestL", status ); |
860 delete wait; |
799 delete wait; |
861 } |
800 } |
862 } |
801 } |
863 else |
802 else |
864 { |
803 { |
865 // Failed to get remote lock status |
804 // Failed to get remote lock status |
866 #ifdef _DEBUG |
805 RDEBUG( "Autolock is disabled, but failed to get RemoteLock status, so do nothing", 0 ); |
867 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Autolock is disabled, but failed to get RemoteLock status, so do nothing." ) ); |
|
868 #endif // _DEBUG |
|
869 } |
806 } |
870 |
807 |
871 delete remoteLockSettings; |
808 delete remoteLockSettings; |
872 remoteLockSettings = NULL; |
809 remoteLockSettings = NULL; |
873 |
810 |
874 #else // not defined RD_REMOTELOCK |
811 #else // not defined RD_REMOTELOCK |
875 RDEBUG("iCustomPhone.DisablePhoneLock", 0); |
812 RDEBUG("iCustomPhone.DisablePhoneLock", 0); |
876 wait = CWait::NewL(); |
813 wait = CWait::NewL(); |
877 iCustomPhone.DisablePhoneLock(wait->iStatus, |
814 iCustomPhone.DisablePhoneLock(wait->iStatus, |
878 iSecUi_password); |
815 iSecUi_password); |
879 wait->WaitForRequestL(); |
816 RDEBUG( "WaitForRequestL", 0 ); |
880 RDEBUG("iCustomPhone.DisablePhoneLock", 1); |
817 status = wait->WaitForRequestL(); |
|
818 RDEBUG( "WaitForRequestL status", status ); |
881 delete wait; |
819 delete wait; |
882 #endif // RD_REMOTELOCK |
820 #endif // RD_REMOTELOCK |
883 } |
821 } |
884 } |
822 } |
885 else // error getting repository |
823 else // error getting repository |
898 { |
836 { |
899 // Remote lock is disabled |
837 // Remote lock is disabled |
900 RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); |
838 RDEBUG( "iCustomPhone.DisablePhoneLock", 0 ); |
901 wait = CWait::NewL(); |
839 wait = CWait::NewL(); |
902 iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); |
840 iCustomPhone.DisablePhoneLock(wait->iStatus,iSecUi_password); |
903 wait->WaitForRequestL(); |
841 RDEBUG( "WaitForRequestL", 0 ); |
904 RDEBUG( "iCustomPhone.DisablePhoneLock", 1 ); |
842 status = wait->WaitForRequestL(); |
|
843 RDEBUG( "WaitForRequestL status", status ); |
905 delete wait; |
844 delete wait; |
906 } |
845 } |
907 } |
846 } |
908 else |
847 else |
909 { |
848 { |
910 // Failed to get remote lock status |
849 // Failed to get remote lock status |
911 #ifdef _DEBUG |
850 RDEBUG( "Failed to get Autolock period and RemoteLock status, so do nothing", 0 ); |
912 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Failed to get Autolock period and RemoteLock status, so do nothing." ) ); |
|
913 #endif // _DEBUG |
|
914 } |
851 } |
915 |
852 |
916 delete remoteLockSettings; |
853 delete remoteLockSettings; |
917 remoteLockSettings = NULL; |
854 remoteLockSettings = NULL; |
918 |
855 |
920 // could not get the current autolock time... disable autolock in Domestic OS side. |
857 // could not get the current autolock time... disable autolock in Domestic OS side. |
921 RDEBUG("iCustomPhone.DisablePhoneLock", 0); |
858 RDEBUG("iCustomPhone.DisablePhoneLock", 0); |
922 wait = CWait::NewL(); |
859 wait = CWait::NewL(); |
923 iCustomPhone.DisablePhoneLock(wait->iStatus, |
860 iCustomPhone.DisablePhoneLock(wait->iStatus, |
924 iSecUi_password); |
861 iSecUi_password); |
925 wait->WaitForRequestL(); |
862 RDEBUG( "WaitForRequestL", 0 ); |
926 RDEBUG("iCustomPhone.DisablePhoneLock", 1); |
863 status = wait->WaitForRequestL(); |
|
864 RDEBUG( "WaitForRequestL status", status ); |
927 delete wait; |
865 delete wait; |
928 |
866 |
929 #endif // RD_REMOTELOCK |
867 #endif // RD_REMOTELOCK |
930 } |
868 } |
931 |
869 |
943 break; |
881 break; |
944 case KErrGsm0707IncorrectPassword: |
882 case KErrGsm0707IncorrectPassword: |
945 case KErrAccessDenied: |
883 case KErrAccessDenied: |
946 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
884 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
947 // TODO should this try again? It seems that it's not asked again. |
885 // TODO should this try again? It seems that it's not asked again. |
948 #if defined(_DEBUG) |
|
949 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrGsm0707IncorrectPassword")); |
|
950 #endif |
|
951 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
886 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
952 CAknNoteDialog::EErrorTone); |
887 CAknNoteDialog::EErrorTone); |
953 break; |
888 break; |
954 default: |
889 default: |
955 RDEBUG("default", status); |
890 RDEBUG("default", status); |
997 if (!StartUp) |
932 if (!StartUp) |
998 { |
933 { |
999 // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL |
934 // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL |
1000 err = RProperty::Get(KPSUidSecurityUIs, |
935 err = RProperty::Get(KPSUidSecurityUIs, |
1001 KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
936 KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1002 |
|
1003 if (err != KErrNone) |
937 if (err != KErrNone) |
1004 { |
938 { |
1005 #if defined(_DEBUG) |
939 RDEBUG("FAILED to get the SECUI query Flag err", err); |
1006 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL():\ |
940 } |
1007 FAILED to get the SECUI query Flag: %d"), err); |
941 } |
1008 #endif |
|
1009 } |
|
1010 else |
|
1011 { |
|
1012 #if defined(_DEBUG) |
|
1013 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL():\ |
|
1014 SECUI query Flag: %d"), secUiOriginatedQuery); |
|
1015 #endif |
|
1016 } |
|
1017 } |
|
1018 #if defined(_DEBUG) |
|
1019 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg")); |
|
1020 #endif |
|
1021 |
|
1022 RDEBUG("StartUp", StartUp); |
942 RDEBUG("StartUp", StartUp); |
1023 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
943 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
1024 RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); |
944 RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); |
1025 RDEBUG("err", err); |
945 RDEBUG("err", err); |
1026 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) |
946 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) |
1078 // TODO handle emergency |
998 // TODO handle emergency |
1079 /* end request PIN using QT */ |
999 /* end request PIN using QT */ |
1080 |
1000 |
1081 if (queryAccepted == KErrAbort) // emergency call |
1001 if (queryAccepted == KErrAbort) // emergency call |
1082 { |
1002 { |
1083 #if defined(_DEBUG) |
1003 RDEBUG("queryAccepted", queryAccepted); |
1084 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_REQUEST_QUERY CANCEL!")); |
|
1085 #endif |
|
1086 CleanupStack::PopAndDestroy(wait); // this is needed |
1004 CleanupStack::PopAndDestroy(wait); // this is needed |
1087 return KErrCancel; |
1005 return KErrCancel; |
1088 } |
1006 } |
1089 if (lCancelSupported && (queryAccepted == KErrCancel)) |
1007 if (lCancelSupported && (queryAccepted == KErrCancel)) |
1090 { |
1008 { |
1108 |
1026 |
1109 TInt returnValue = res; |
1027 TInt returnValue = res; |
1110 switch (res) |
1028 switch (res) |
1111 { |
1029 { |
1112 case KErrNone: |
1030 case KErrNone: |
1113 // code approved |
1031 // code approved |
1114 #if defined(_DEBUG) |
1032 RDEBUG("code approved", res); |
1115 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL()code approved ")); |
1033 if(lCancelSupported == ESecUiCancelNotSupported) |
1116 #endif |
1034 { // OK note is not displayed in boot-up, to make things faster |
1117 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, |
1035 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, |
1118 CAknNoteDialog::EConfirmationTone); |
1036 CAknNoteDialog::EConfirmationTone); |
|
1037 } |
1119 break; |
1038 break; |
1120 case KErrGsm0707IncorrectPassword: |
1039 case KErrGsm0707IncorrectPassword: |
1121 case KErrAccessDenied: |
1040 case KErrAccessDenied: |
1122 // code was entered erroneously |
1041 // code was entered erroneously |
1123 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1042 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1202 #if defined(_DEBUG) |
1121 #if defined(_DEBUG) |
1203 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); |
1122 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); |
1204 #endif |
1123 #endif |
1205 |
1124 |
1206 RDEBUG("StartUp", StartUp); |
1125 RDEBUG("StartUp", StartUp); |
1207 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1126 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1208 codeInfo.iRemainingEntryAttempts); |
1127 RDEBUG( "attempts", attempts ); |
1209 //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
1128 //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
1210 if (!StartUp && (codeInfo.iRemainingEntryAttempts |
1129 if (!StartUp && (attempts |
1211 == KMaxNumberOfPUKAttempts)) |
1130 == KMaxNumberOfPUKAttempts)) |
1212 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1131 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, |
1213 CAknNoteDialog::EErrorTone); |
1132 CAknNoteDialog::EErrorTone); |
1214 |
1133 |
1215 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1134 |
1216 codeInfo.iRemainingEntryAttempts); |
1135 if (attempts == KMaxNumberOfPINAttempts) |
1217 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
1136 attempts = -1; |
1218 codeInfo.iRemainingEntryAttempts = -1; |
|
1219 |
1137 |
1220 // ask PUK code |
1138 // ask PUK code |
1221 /* request PIN using QT */ |
1139 /* request PIN using QT */ |
1222 CSecQueryUi *iSecQueryUi; |
1140 CSecQueryUi *iSecQueryUi; |
1223 RDEBUG("CSecQueryUi", 0); |
1141 RDEBUG("CSecQueryUi", 0); |
1227 // TODO also support Emergency |
1145 // TODO also support Emergency |
1228 TBuf<0x100> title; |
1146 TBuf<0x100> title; |
1229 title.Zero(); |
1147 title.Zero(); |
1230 title.Append(_L("Puk1RequiredL")); |
1148 title.Append(_L("Puk1RequiredL")); |
1231 title.Append(_L("#")); |
1149 title.Append(_L("#")); |
1232 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1150 title.AppendNum(attempts); |
1233 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, |
1151 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, |
1234 SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, |
1152 SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, |
1235 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1153 ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1236 | ESecUiCancelSupported | ESecUiPukRequired); |
1154 | ESecUiCancelSupported | ESecUiPukRequired); |
1237 RDEBUG("iSecUi_password", 0); |
1155 RDEBUG("iSecUi_password", 0); |