17 */ |
17 */ |
18 |
18 |
19 #include <etelmm.h> |
19 #include <etelmm.h> |
20 #include <exterror.h> |
20 #include <exterror.h> |
21 #include <textresolver.h> |
21 #include <textresolver.h> |
22 #include <SecUi.rsg> |
|
23 #include <aknnotedialog.h> |
22 #include <aknnotedialog.h> |
24 #include <mmtsy_names.h> |
23 #include <mmtsy_names.h> |
25 #include <centralrepository.h> |
24 #include <centralrepository.h> |
26 #include <gsmerror.h> |
25 #include <gsmerror.h> |
27 #include <SCPClient.h> |
26 #include <SCPClient.h> |
28 #include <StringLoader.h> |
27 #include <StringLoader.h> |
29 #include <e32property.h> |
28 #include <e32property.h> |
30 #include <PSVariables.h> // Property values |
29 #include <PSVariables.h> // Property values |
31 #include <securityuisprivatepskeys.h> |
30 #include <securityuisprivatepskeys.h> |
32 #include <startupdomainpskeys.h> |
31 #include <startupdomainpskeys.h> |
|
32 #include "SecUi.h" |
33 #include "secuisecuritysettings.h" |
33 #include "secuisecuritysettings.h" |
34 #include "SecUiAutoLockSettingPage.h" |
|
35 #include "secui.hrh" |
34 #include "secui.hrh" |
36 #include "secuisecurityhandler.h" |
35 #include "secuisecurityhandler.h" |
37 #include "secuicodequerydialog.h" |
36 #include "secuicodequerydialog.h" |
38 #include "SecUiWait.h" |
37 #include "SecUiWait.h" |
39 |
38 |
40 #ifdef RD_REMOTELOCK |
|
41 #include <aknnotewrappers.h> |
39 #include <aknnotewrappers.h> |
42 #include <StringLoader.h> |
40 #include <StringLoader.h> |
43 #include <RemoteLockSettings.h> |
41 #include <RemoteLockSettings.h> |
44 #include "SecUiRemoteLockSettingPage.h" |
|
45 #endif // RD_REMOTELOCK |
|
46 #include <featmgr.h> |
42 #include <featmgr.h> |
47 |
43 |
48 #include "SecQueryUi.h" |
44 #include "SecQueryUi.h" |
49 #include <hb/hbwidgets/hbdevicemessageboxsymbian.h> |
45 #include <hb/hbwidgets/hbdevicemessageboxsymbian.h> |
50 |
46 |
100 /***************************************************** |
96 /***************************************************** |
101 * Series 60 Customer / TSY |
97 * Series 60 Customer / TSY |
102 * Needs customer TSY implementation |
98 * Needs customer TSY implementation |
103 *****************************************************/ |
99 *****************************************************/ |
104 |
100 |
|
101 RDEBUG("0", 0); |
105 TInt err(KErrGeneral); |
102 TInt err(KErrGeneral); |
106 TInt thisTry(0); |
103 TInt thisTry(0); |
107 iWait = CWait::NewL(); |
104 iWait = CWait::NewL(); |
108 RTelServer::TPhoneInfo PhoneInfo; |
105 RTelServer::TPhoneInfo PhoneInfo; |
109 /* All server connections are tried to be made KTriesToConnectServer times because occasional |
106 /* All server connections are tried to be made KTriesToConnectServer times because occasional |
110 fails on connections are possible, at least on some servers */ |
107 fails on connections are possible, at least on some servers */ |
111 #if defined(_DEBUG) |
|
112 RDebug::Print(_L("(SECUI)CSecuritySettings::ConstructL()")); |
|
113 #endif |
|
114 |
108 |
115 FeatureManager::InitializeLibL(); |
109 FeatureManager::InitializeLibL(); |
116 // connect to ETel server |
110 // connect to ETel server |
117 while ((err = iServer.Connect()) != KErrNone && (thisTry++) |
111 while ((err = iServer.Connect()) != KErrNone && (thisTry++) |
118 <= KTriesToConnectServer) |
112 <= KTriesToConnectServer) |
159 delete iSecurityHandler; |
153 delete iSecurityHandler; |
160 |
154 |
161 // Cancel active requests |
155 // Cancel active requests |
162 if (iWait->IsActive()) |
156 if (iWait->IsActive()) |
163 { |
157 { |
164 #if defined(_DEBUG) |
158 RDEBUG("CancelAsyncRequest", 0); |
165 RDebug::Print(_L("(SECUI)CManualSecuritySettings::~CSecuritySettings() CANCEL REQ")); |
|
166 #endif |
|
167 iPhone.CancelAsyncRequest(iWait->GetRequestType()); |
159 iPhone.CancelAsyncRequest(iWait->GetRequestType()); |
168 |
160 |
169 switch (iWait->GetRequestType()) |
161 switch (iWait->GetRequestType()) |
170 { //inform query that it has beeen canceled |
162 { //inform query that it has beeen canceled |
171 case EMobilePhoneSetLockSetting: |
163 case EMobilePhoneSetLockSetting: |
318 { |
310 { |
319 TInt retValue( KErrNone ); |
311 TInt retValue( KErrNone ); |
320 RDEBUG("aRemoteLockStatus", aRemoteLockStatus); |
312 RDEBUG("aRemoteLockStatus", aRemoteLockStatus); |
321 RDEBUG("aAutoLockPeriod", aAutoLockPeriod); |
313 RDEBUG("aAutoLockPeriod", aAutoLockPeriod); |
322 |
314 |
323 TInt currentItem( 0 ); |
|
324 |
|
325 if ( aRemoteLockStatus ) |
315 if ( aRemoteLockStatus ) |
326 { |
316 { |
327 currentItem = KRemoteLockSettingItemOn; |
|
328 } |
|
329 else |
|
330 { |
|
331 currentItem = KRemoteLockSettingItemOff; |
|
332 } |
|
333 RDEBUG("currentItem", currentItem); |
|
334 |
|
335 if ( currentItem == KRemoteLockSettingItemOn ) |
|
336 { |
|
337 RDEBUG("KRemoteLockSettingItemOn", KRemoteLockSettingItemOn); |
|
338 aRemoteLockStatus = ETrue; |
317 aRemoteLockStatus = ETrue; |
339 |
318 |
340 // If user wishes to enable remote lock |
319 // If user wishes to enable remote lock |
341 // a new remote lock code is required. |
320 // a new remote lock code is required. |
342 // RemoteLockCodeQueryL also |
321 // RemoteLockCodeQueryL also |
343 retValue = RemoteLockCodeQueryL( aRemoteLockCode ); |
322 retValue = RemoteLockCodeQueryL( aRemoteLockCode ); |
344 } |
323 } |
345 else if ( currentItem == KRemoteLockSettingItemOff ) |
324 else |
346 { |
325 { |
347 RDEBUG("KRemoteLockSettingItemOff", KRemoteLockSettingItemOff); |
|
348 aRemoteLockStatus = EFalse; |
326 aRemoteLockStatus = EFalse; |
349 retValue = KErrNone; |
327 retValue = KErrNone; |
350 // TODO this should calculate aAutoLockPeriod itself, and not trust the input |
328 // TODO this should calculate aAutoLockPeriod itself, and not trust the input |
351 |
329 |
352 // Check whether AutoLock is enabled (timeout value greater |
330 // Check whether AutoLock is enabled (timeout value greater |
372 // ---------------------------------------------------------- |
350 // ---------------------------------------------------------- |
373 // CSecuritySettings::RemoteLockCodeQueryL() |
351 // CSecuritySettings::RemoteLockCodeQueryL() |
374 // Pops up remote lock code query. Requires user to enter a new remote lock |
352 // Pops up remote lock code query. Requires user to enter a new remote lock |
375 // code (RemoteMsg) twice and if they match enables the domestic OS device lock (which as |
353 // code (RemoteMsg) twice and if they match enables the domestic OS device lock (which as |
376 // a side effect pops up security code query). |
354 // a side effect pops up security code query). |
|
355 // Note: if the RemoteMsg is cancelled, nevertheless the lock is activated. This is done because the code is askedirst, and the only way to do so is by enabling the lock. |
|
356 // This is not a problem, because: |
|
357 // a) first the RemoteMsg is enable, and this function is used to change it |
|
358 // b) if lock was disabled, the "change RemoteMsg" menu is not available. |
377 // ---------------------------------------------------------- |
359 // ---------------------------------------------------------- |
378 // no qtdone |
360 // no qtdone |
379 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) |
361 TInt CSecuritySettings::RemoteLockCodeQueryL(TDes& aRemoteLockCode) |
380 { |
362 { |
381 #ifdef RD_REMOTELOCK |
363 |
382 TInt retValue( KErrNone ); |
364 TInt retValue( KErrNone ); |
383 |
365 |
|
366 // This is done because lock-code needs to be asked first. |
|
367 // Enable lock setting in domestic OS. It is safe to enable the |
|
368 // lock setting since RemoteLock API requires remote locking to |
|
369 // be enabled when changing or setting the remote lock message. |
|
370 retValue = RemoteLockSetLockSettingL( ETrue ); |
384 RDEBUG( "retValue", retValue ); |
371 RDEBUG( "retValue", retValue ); |
|
372 if (retValue != KErrNone) |
|
373 return retValue; |
385 aRemoteLockCode.Zero(); |
374 aRemoteLockCode.Zero(); |
386 |
375 |
387 TInt queryAccepted = KErrCancel; |
376 TInt queryAccepted = KErrCancel; |
388 queryAccepted = KErrCancel; |
377 queryAccepted = KErrCancel; |
389 CSecQueryUi * iSecQueryUi; |
378 CSecQueryUi * iSecQueryUi; |
399 RDEBUG("queryAccepted", queryAccepted); |
388 RDEBUG("queryAccepted", queryAccepted); |
400 delete iSecQueryUi; |
389 delete iSecQueryUi; |
401 if (queryAccepted != KErrNone) |
390 if (queryAccepted != KErrNone) |
402 return KErrAbort; |
391 return KErrAbort; |
403 |
392 |
404 // TODO it should ask first for the code, and _later_ for the RemoteMsg |
393 // Check that the new remote lock code doesn't match the security code of the device. |
405 |
394 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
406 // ----- Check against security code ------------------------------ |
|
407 |
|
408 // Check that the new remote lock code doesn't match the security |
|
409 // code of the device. |
|
410 |
|
411 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
412 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
413 RMobilePhone::TMobilePassword securityCode; |
395 RMobilePhone::TMobilePassword securityCode; |
414 RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
396 RMobilePhone::TMobilePassword unblockCode; // Required here only as a dummy parameter |
415 |
397 |
416 RDEBUG( "RMobilePhone::KMaxMobilePasswordSize", RMobilePhone::KMaxMobilePasswordSize ); |
|
417 |
398 |
418 securityCode = aRemoteLockCode; |
399 securityCode = aRemoteLockCode; |
|
400 RDEBUG( "EMobilePhoneVerifySecurityCode", EMobilePhoneVerifySecurityCode ); |
419 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
401 iWait->SetRequestType( EMobilePhoneVerifySecurityCode ); |
420 RDEBUG( "VerifySecurityCode", 0 ); |
402 RDEBUG( "VerifySecurityCode", 0 ); |
421 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
403 iPhone.VerifySecurityCode( iWait->iStatus, secCodeType, securityCode, unblockCode ); |
422 RDEBUG( "WaitForRequestL", 0 ); |
404 RDEBUG( "WaitForRequestL", 0 ); |
423 TInt res = iWait->WaitForRequestL(); |
405 TInt res = iWait->WaitForRequestL(); |
424 RDEBUG( "WaitForRequestL res", res ); |
406 RDEBUG( "WaitForRequestL res", res ); |
425 #ifdef __WINS__ |
407 #ifdef __WINS__ |
426 if (res == KErrNotSupported || res == KErrTimedOut) |
408 if (res == KErrNotSupported || res == KErrTimedOut) |
427 res = KErrNone; |
409 res = 0xffffec50; // TODO this means KErrGsm0707IncorrectPassword = incorrect code |
428 #endif |
410 #endif |
429 if(res != KErrNone) |
411 RDEBUG( "KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword ); |
|
412 if(res == KErrNone) |
430 { |
413 { |
431 // The remote lock code matches the security code |
414 // The message is also valid as a lock-code, this means that |
|
415 // remote lock code matches the security code |
432 // and that is not allowed |
416 // and that is not allowed |
433 RDEBUG( "res", res ); |
417 RDEBUG( "return KErrCancel because msg matches code", KErrCancel ); |
434 return res; |
418 ShowResultNoteL(R_REMOTELOCK_INVALID_CODE, CAknNoteDialog::EErrorTone); |
|
419 return KErrCancel; |
435 } |
420 } |
436 |
421 |
437 // ----- Enable DOS device lock (Security code query) ------------- |
422 RDEBUG( "retValue", retValue ); |
438 if ( retValue == KErrNone ) |
|
439 { |
|
440 // Enable lock setting in domestic OS. It is safe to enable the |
|
441 // lock setting since RemoteLock API requires remote locking to |
|
442 // be enabled when changing or setting the remote lock message. |
|
443 retValue = RemoteLockSetLockSettingL( ETrue ); |
|
444 } |
|
445 RDEBUG( "retValue", retValue ); |
|
446 #ifdef _DEBUG |
|
447 RDebug::Print(_L("(SecUi)CSecuritySettings::ChangeRemoteLockCodeL() - Exit" ) ); |
|
448 #endif // _DEBUG |
|
449 return retValue; |
423 return retValue; |
450 #else //! RD_REMOTELOCK |
|
451 return KErrNotSupported; |
|
452 #endif //RD_REMOTELOCK |
|
453 } |
424 } |
454 // |
425 // |
455 // ---------------------------------------------------------- |
426 // ---------------------------------------------------------- |
456 // CSecuritySettings::RemoteLockSetLockSettingL() |
427 // CSecuritySettings::RemoteLockSetLockSettingL() |
457 // Changes lock setting in domestic OS. Changing the domestic OS lock setting |
428 // Changes lock setting in domestic OS. Changing the domestic OS lock setting |
461 TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting) |
432 TInt CSecuritySettings::RemoteLockSetLockSettingL(TBool aLockSetting) |
462 { |
433 { |
463 TInt retValue( KErrNone ); |
434 TInt retValue( KErrNone ); |
464 RDEBUG( "aLockSetting", aLockSetting ); |
435 RDEBUG( "aLockSetting", aLockSetting ); |
465 |
436 |
|
437 |
466 RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; |
438 RMobilePhone::TMobilePhoneLockSetting lockSetting = RMobilePhone::ELockSetEnabled; |
467 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
439 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
468 |
440 |
|
441 |
|
442 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
443 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
444 |
|
445 //get lock info |
|
446 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
447 RDEBUG("GetLockInfo", 0); |
|
448 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
449 RDEBUG("WaitForRequestL", 0); |
|
450 TInt status = iWait->WaitForRequestL(); |
|
451 RDEBUG("WaitForRequestL status", status); |
|
452 |
|
453 #ifdef __WINS__ |
|
454 if (status == KErrNotSupported || status == KErrTimedOut) |
|
455 { |
|
456 lockInfo.iSetting = RMobilePhone::ELockSetDisabled; |
|
457 status = KErrNone; |
|
458 } |
|
459 #endif |
|
460 User::LeaveIfError(status); |
|
461 RDEBUG("current lockInfo.iSetting", lockInfo.iSetting); |
|
462 |
|
463 // disabled->disabled should not happen |
|
464 // enabled->enabled happens because a change of message also forces a code re-validation |
469 if ( aLockSetting ) |
465 if ( aLockSetting ) |
470 { |
466 { |
471 lockSetting = RMobilePhone::ELockSetEnabled; |
467 lockSetting = RMobilePhone::ELockSetEnabled; |
472 } |
468 } |
473 else |
469 else |
474 { |
470 { |
475 lockSetting = RMobilePhone::ELockSetDisabled; |
471 lockSetting = RMobilePhone::ELockSetDisabled; |
476 } |
472 } |
477 RDEBUG("lockSetting", lockSetting); |
473 RDEBUG("future lockSetting", lockSetting); |
478 |
474 |
479 iWait->SetRequestType( EMobilePhoneSetLockSetting ); |
475 iWait->SetRequestType( EMobilePhoneSetLockSetting ); |
480 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
476 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, ESecurityUIsQueryRequestOk); |
481 RDEBUG( "SetLockSetting", 0 ); |
477 RDEBUG( "SetLockSetting", 0 ); |
482 iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); // this will PassPhraseRequiredL |
478 iPhone.SetLockSetting( iWait->iStatus, lockType, lockSetting ); // this will PassPhraseRequiredL |
522 { |
518 { |
523 /***************************************************** |
519 /***************************************************** |
524 * Series 60 Customer / ETel |
520 * Series 60 Customer / ETel |
525 * Series 60 ETel API |
521 * Series 60 ETel API |
526 *****************************************************/ |
522 *****************************************************/ |
527 #if defined(_DEBUG) |
523 RDEBUG("0", 0); |
528 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSimSecurityL()")); |
|
529 #endif |
|
530 |
|
531 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
524 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
532 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
525 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
533 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; |
526 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneToICC; |
534 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
527 RMobilePhone::TMobilePhoneLockSetting lockChangeSetting; |
535 |
528 |
650 EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() |
638 EXPORT_C TBool CSecuritySettings::ChangeUPinRequestL() |
651 { |
639 { |
652 TBool wcdmaSupported( |
640 TBool wcdmaSupported( |
653 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); |
641 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); |
654 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); |
642 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); |
|
643 RDEBUG("wcdmaSupported", wcdmaSupported); |
|
644 RDEBUG("upinSupported", upinSupported); |
655 if (wcdmaSupported || upinSupported) |
645 if (wcdmaSupported || upinSupported) |
656 { |
646 { |
657 #if defined(_DEBUG) |
|
658 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL()")); |
|
659 #endif |
|
660 |
|
661 TInt simState; |
647 TInt simState; |
662 TInt err(KErrGeneral); |
648 TInt err(KErrGeneral); |
663 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
649 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
664 User::LeaveIfError(err); |
650 User::LeaveIfError(err); |
665 TBool simRemoved(simState == ESimNotPresent); |
651 TBool simRemoved(simState == ESimNotPresent); |
690 status = KErrNone; |
676 status = KErrNone; |
691 #endif |
677 #endif |
692 User::LeaveIfError(status); |
678 User::LeaveIfError(status); |
693 TInt currentItem = 0; |
679 TInt currentItem = 0; |
694 |
680 |
695 #if defined(_DEBUG) |
681 RDEBUG("lockInfo.iSetting", lockInfo.iSetting); |
696 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() GetLockInfo")); |
|
697 #endif |
|
698 |
|
699 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
682 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
700 { |
683 { |
701 #if defined(_DEBUG) |
|
702 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() lockInfo: ELockSetDisabled")); |
|
703 #endif |
|
704 currentItem = 1; // off |
684 currentItem = 1; // off |
705 } |
685 } |
706 |
686 |
707 if (currentItem == 0) // switch the flag |
687 if (currentItem == 0) // switch the flag |
708 { |
688 { |
709 #if defined(_DEBUG) |
|
710 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() currentItem: ELockSetDisabled")); |
|
711 #endif |
|
712 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
689 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
713 } |
690 } |
714 else |
691 else |
715 { |
692 { |
716 #if defined(_DEBUG) |
|
717 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeUPinRequestL() currentItem: ELockSetEnabled")); |
|
718 #endif |
|
719 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
693 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
720 } |
694 } |
721 |
695 RDEBUG("lockChangeSetting", lockChangeSetting); |
722 // Raise a flag to indicate that the UPIN |
696 // Raise a flag to indicate that the UPIN |
723 // request coming from ETEL has originated from SecUi and not from Engine. |
697 // request coming from ETEL has originated from SecUi and not from Engine. |
724 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
698 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
725 ESecurityUIsSecUIOriginated); |
699 ESecurityUIsSecUIOriginated); |
726 // Change the lock setting |
700 // Change the lock setting |
732 RDEBUG("WaitForRequestL", 0); |
706 RDEBUG("WaitForRequestL", 0); |
733 status = iWait->WaitForRequestL(); |
707 status = iWait->WaitForRequestL(); |
734 RDEBUG("WaitForRequestL status", status); |
708 RDEBUG("WaitForRequestL status", status); |
735 // Lower the flag |
709 // Lower the flag |
736 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
710 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
737 ESecurityUIsETelAPIOriginated); |
711 ESecurityUIsSecUIOriginatedUninitialized); |
738 #ifdef __WINS__ |
712 #ifdef __WINS__ |
739 if (status == KErrNotSupported || status == KErrTimedOut) |
713 if (status == KErrNotSupported || status == KErrTimedOut) |
740 status = KErrNone; |
714 status = KErrNone; |
741 #endif |
715 #endif |
742 |
716 |
792 EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() |
766 EXPORT_C TBool CSecuritySettings::SwitchPinCodesL() |
793 { |
767 { |
794 TBool wcdmaSupported( |
768 TBool wcdmaSupported( |
795 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); |
769 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); |
796 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); |
770 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); |
|
771 RDEBUG("wcdmaSupported", wcdmaSupported); |
|
772 RDEBUG("upinSupported", upinSupported); |
797 if (wcdmaSupported || upinSupported) |
773 if (wcdmaSupported || upinSupported) |
798 { |
774 { |
799 #if defined(_DEBUG) |
|
800 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL()")); |
|
801 #endif |
|
802 |
|
803 // If we are in simless offline mode the PIN codes can't obviously be switched |
775 // If we are in simless offline mode the PIN codes can't obviously be switched |
804 TInt simState; |
776 TInt simState; |
805 TInt err(KErrGeneral); |
777 TInt err(KErrGeneral); |
806 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
778 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
807 User::LeaveIfError(err); |
779 User::LeaveIfError(err); |
854 #endif |
824 #endif |
855 User::LeaveIfError(res); |
825 User::LeaveIfError(res); |
856 } |
826 } |
857 |
827 |
858 // code request must be ON to change active code. |
828 // code request must be ON to change active code. |
|
829 RDEBUG("lockInfo.iSetting", lockInfo.iSetting); |
859 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
830 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
860 { |
831 { |
861 #if defined(_DEBUG) |
832 |
862 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON.")); |
|
863 #endif |
|
864 if (activeCode != RMobilePhone::ESecurityUniversalPin) |
833 if (activeCode != RMobilePhone::ESecurityUniversalPin) |
865 { |
834 { |
866 ShowResultNoteL(R_UPIN_NOT_ALLOWED, |
835 ShowResultNoteL(R_UPIN_NOT_ALLOWED, |
867 CAknNoteDialog::EErrorTone); |
836 CAknNoteDialog::EErrorTone); |
868 } |
837 } |
869 else |
838 else |
870 { |
839 { |
871 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
840 ShowResultNoteL(R_PIN_NOT_ALLOWED, CAknNoteDialog::EErrorTone); |
872 } |
841 } |
873 #if defined(_DEBUG) |
|
874 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() CODE REQ NOT ON NOTE END.")); |
|
875 #endif |
|
876 return EFalse; |
842 return EFalse; |
877 } |
843 } |
878 |
844 |
879 iCustomPhone.GetActivePin(activeCode); |
845 iCustomPhone.GetActivePin(activeCode); |
880 TInt currentItem = 0; |
846 TInt currentItem = 0; |
881 |
847 |
882 #if defined(_DEBUG) |
848 RDEBUG("activeCode", activeCode); |
883 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() GetLockInfo")); |
|
884 #endif |
|
885 |
|
886 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
849 if (activeCode == RMobilePhone::ESecurityUniversalPin) |
887 { |
850 { |
888 #if defined(_DEBUG) |
|
889 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() active code: UPIN")); |
|
890 #endif |
|
891 currentItem = 1; // UPIN |
851 currentItem = 1; // UPIN |
892 } |
852 } |
893 |
|
894 if (currentItem == 0) // switch the flag |
853 if (currentItem == 0) // switch the flag |
895 { |
854 { |
896 #if defined(_DEBUG) |
|
897 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: UPIN")); |
|
898 #endif |
|
899 lockType = RMobilePhone::ELockUniversalPin; |
855 lockType = RMobilePhone::ELockUniversalPin; |
900 } |
856 } |
901 else |
857 else |
902 { |
858 { |
903 #if defined(_DEBUG) |
|
904 RDebug::Print(_L("(SECUI)CSecuritySettings::SwitchPinCodesL() currentItem: PIN1")); |
|
905 #endif |
|
906 lockType = RMobilePhone::ELockICC; |
859 lockType = RMobilePhone::ELockICC; |
907 } |
860 } |
|
861 RDEBUG("lockType", lockType); |
908 |
862 |
909 // Raise a flag to indicate that the code |
863 // Raise a flag to indicate that the code |
910 // request coming from ETEL has originated from SecUi and not from Engine. |
864 // request coming from ETEL has originated from SecUi and not from Engine. |
911 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
865 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
912 ESecurityUIsSecUIOriginated); |
866 ESecurityUIsSecUIOriginated); |
919 RDEBUG("WaitForRequestL", 0); |
873 RDEBUG("WaitForRequestL", 0); |
920 TInt status = iWait->WaitForRequestL(); |
874 TInt status = iWait->WaitForRequestL(); |
921 RDEBUG("WaitForRequestL status", status); |
875 RDEBUG("WaitForRequestL status", status); |
922 // Lower the flag |
876 // Lower the flag |
923 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
877 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, |
924 ESecurityUIsETelAPIOriginated); |
878 ESecurityUIsSecUIOriginatedUninitialized); |
925 #ifdef __WINS__ |
879 #ifdef __WINS__ |
926 if (status == KErrNotSupported || status == KErrTimedOut) |
880 if (status == KErrNotSupported || status == KErrTimedOut) |
927 status = KErrNone; |
881 status = KErrNone; |
928 #endif |
882 #endif |
929 |
883 |
1160 { |
1114 { |
1161 /***************************************************** |
1115 /***************************************************** |
1162 * Series 60 Customer / ETel |
1116 * Series 60 Customer / ETel |
1163 * Series 60 ETel API |
1117 * Series 60 ETel API |
1164 *****************************************************/ |
1118 *****************************************************/ |
1165 #if defined(_DEBUG) |
1119 RDEBUG("0", 0); |
1166 RDebug::Print(_L("(SECUI)CSecuritySettings::SetFdnModeL()")); |
|
1167 #endif |
|
1168 RMmCustomAPI::TSecurityCodeType secCodeType = |
1120 RMmCustomAPI::TSecurityCodeType secCodeType = |
1169 RMmCustomAPI::ESecurityCodePin2; |
1121 RMmCustomAPI::ESecurityCodePin2; |
1170 |
1122 |
1171 TBool isBlocked = EFalse; |
1123 TBool isBlocked = EFalse; |
1172 TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); |
1124 TInt ret = iCustomPhone.IsBlocked(secCodeType, isBlocked); |
1298 void CSecuritySettings::ShowResultNoteL(TInt aResourceID, |
1246 void CSecuritySettings::ShowResultNoteL(TInt aResourceID, |
1299 CAknNoteDialog::TTone aTone) |
1247 CAknNoteDialog::TTone aTone) |
1300 { |
1248 { |
1301 RDEBUG("aResourceID", aResourceID); |
1249 RDEBUG("aResourceID", aResourceID); |
1302 |
1250 |
1303 /* |
|
1304 CAknNoteDialog* noteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,¬eDlg)); |
|
1305 noteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
1306 noteDlg->SetTone(aTone); |
|
1307 noteDlg->ExecuteLD(aResourceID); |
|
1308 */ |
|
1309 CHbDeviceMessageBoxSymbian* messageBox = |
1251 CHbDeviceMessageBoxSymbian* messageBox = |
1310 CHbDeviceMessageBoxSymbian::NewL( |
1252 CHbDeviceMessageBoxSymbian::NewL( |
1311 CHbDeviceMessageBoxSymbian::EWarning); |
1253 CHbDeviceMessageBoxSymbian::EWarning); |
1312 CleanupStack::PushL(messageBox); |
1254 CleanupStack::PushL(messageBox); |
1313 _LIT(KText, "ShowResultNoteL: "); |
1255 _LIT(KText, "ShowResultNoteL: "); |
1474 { |
1420 { |
1475 TBool wcdmaSupported( |
1421 TBool wcdmaSupported( |
1476 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); |
1422 FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma)); |
1477 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); |
1423 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin)); |
1478 TBool isSupported = EFalse; |
1424 TBool isSupported = EFalse; |
|
1425 RDEBUG("wcdmaSupported", wcdmaSupported); |
|
1426 RDEBUG("upinSupported", upinSupported); |
1479 if (wcdmaSupported || upinSupported) |
1427 if (wcdmaSupported || upinSupported) |
1480 { |
1428 { |
1481 #if defined(_DEBUG) |
|
1482 RDebug::Print(_L("(SECUI)CSecuritySettings::IsUpinSupported() BEGIN")); |
|
1483 #endif |
|
1484 |
|
1485 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
1429 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
1486 |
1430 |
1487 //get lock info |
1431 //get lock info |
1488 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
1432 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
1489 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
1433 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
1591 TInt err(KErrGeneral); |
1532 TInt err(KErrGeneral); |
1592 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
1533 err = RProperty::Get(KPSUidStartup, KPSSimStatus, simState); |
1593 User::LeaveIfError(err); |
1534 User::LeaveIfError(err); |
1594 TBool simRemoved(simState == ESimNotPresent); |
1535 TBool simRemoved(simState == ESimNotPresent); |
1595 |
1536 |
|
1537 RDEBUG("simRemoved", simRemoved); |
1596 if (simRemoved) |
1538 if (simRemoved) |
1597 { |
1539 { |
1598 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
1540 ShowResultNoteL(R_INSERT_SIM, CAknNoteDialog::EErrorTone); |
1599 return KErrAccessDenied; |
1541 return KErrAccessDenied; |
1600 } |
1542 } |
1601 #if defined(_DEBUG) |
|
1602 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinParamsL()")); |
|
1603 #endif |
|
1604 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
1543 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
1605 secCodeType = RMobilePhone::ESecurityCodePin1; |
1544 secCodeType = RMobilePhone::ESecurityCodePin1; |
1606 |
1545 |
1607 RMobilePhone::TMobilePassword oldPassword; |
1546 RMobilePhone::TMobilePassword oldPassword; |
1608 RMobilePhone::TMobilePassword newPassword; |
1547 RMobilePhone::TMobilePassword newPassword; |
2212 RDEBUG("aShowError", aShowError); |
2151 RDEBUG("aShowError", aShowError); |
2213 /***************************************************** |
2152 /***************************************************** |
2214 * Series 60 Customer / ETel |
2153 * Series 60 Customer / ETel |
2215 * Series 60 ETel API |
2154 * Series 60 ETel API |
2216 *****************************************************/ |
2155 *****************************************************/ |
2217 #if defined(_DEBUG) |
|
2218 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangeSecCodeParamsL()")); |
|
2219 #endif |
|
2220 TInt res = KErrNone; |
2156 TInt res = KErrNone; |
2221 TInt queryAccepted = KErrCancel; |
2157 TInt queryAccepted = KErrCancel; |
2222 RMobilePhone::TMobilePassword newPassword; |
2158 RMobilePhone::TMobilePassword newPassword; |
2223 |
2159 |
2224 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
2160 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
2353 TSCPSecCode oldPassword; |
2289 TSCPSecCode oldPassword; |
2354 newCode.Copy(newPassword); |
2290 newCode.Copy(newPassword); |
2355 if (scpClient.Connect() == KErrNone) |
2291 if (scpClient.Connect() == KErrNone) |
2356 { |
2292 { |
2357 RDEBUG("scpClient.StoreCode", 0); |
2293 RDEBUG("scpClient.StoreCode", 0); |
2358 /* |
2294 // this is the old method. Obsolete now |
2359 // scpClient.StoreCode( newCode ); |
2295 // scpClient.StoreCode( newCode ); |
2360 RArray<TDevicelockPolicies> aFailedPolicies; |
2296 RArray<TDevicelockPolicies> aFailedPolicies; |
2361 TDevicelockPolicies failedPolicy; |
2297 TDevicelockPolicies failedPolicy; |
2362 TInt retLockcode = KErrNone; |
2298 TInt retLockcode = KErrNone; |
2363 retLockcode = scpClient.StoreLockcode( newCode, oldPassword, aFailedPolicies ); |
2299 retLockcode = scpClient.StoreLockcode( newCode, oldPassword, aFailedPolicies ); |
2364 RDEBUG( "retLockcode", retLockcode ); |
2300 RDEBUG( "retLockcode", retLockcode ); |
2365 RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); |
2301 RDEBUG( "aFailedPolicies.Count()", aFailedPolicies.Count() ); |
2366 for(TInt i=0; i<aFailedPolicies.Count(); i++) |
2302 for(TInt i=0; i<aFailedPolicies.Count(); i++) |
2367 { |
2303 { |
2368 failedPolicy = aFailedPolicies[i]; |
2304 failedPolicy = aFailedPolicies[i]; |
2369 RDEBUG( "failedPolicy", failedPolicy ); |
2305 RDEBUG( "failedPolicy", failedPolicy ); |
2370 } |
2306 } |
2371 */ |
|
2372 scpClient.Close(); |
2307 scpClient.Close(); |
2373 } |
2308 } |
2374 } |
2309 } |
2375 break; |
2310 break; |
2376 } |
2311 } |
2606 status = KErrNone; |
2541 status = KErrNone; |
2607 } |
2542 } |
2608 #endif |
2543 #endif |
2609 User::LeaveIfError(status); |
2544 User::LeaveIfError(status); |
2610 |
2545 |
2611 #if defined(_DEBUG) |
|
2612 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL() GetLockInfo")); |
|
2613 #endif |
|
2614 |
|
2615 if (aOldPassword.Length() == 0) // only if input parameters are empty |
2546 if (aOldPassword.Length() == 0) // only if input parameters are empty |
2616 { |
2547 { |
2617 // switch the value. |
2548 // switch the value. |
2618 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
2549 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
2619 lEnable = 1; // on |
2550 lEnable = 1; // on |
2620 else |
2551 else |
2621 lEnable = 0; // off |
2552 lEnable = 0; // off |
2622 } |
2553 } |
2623 |
2554 |
|
2555 RDEBUG("lEnable", lEnable); |
2624 if (lEnable == 0) |
2556 if (lEnable == 0) |
2625 { |
2557 { |
2626 #if defined(_DEBUG) |
|
2627 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL() currentItem: ELockSetDisabled")); |
|
2628 #endif |
|
2629 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
2558 lockChangeSetting = RMobilePhone::ELockSetDisabled; |
2630 } |
2559 } |
2631 else |
2560 else |
2632 { |
2561 { |
2633 #if defined(_DEBUG) |
|
2634 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL() currentItem: ELockSetEnabled")); |
|
2635 #endif |
|
2636 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
2562 lockChangeSetting = RMobilePhone::ELockSetEnabled; |
2637 } |
2563 } |
2638 |
2564 |
|
2565 RDEBUG("lockChangeSetting", lockChangeSetting); |
2639 // Raise a flag to indicate that the PIN |
2566 // Raise a flag to indicate that the PIN |
2640 // request coming from ETEL has originated from SecUi and not from Engine. |
2567 // request coming from ETEL has originated from SecUi and not from Engine. |
2641 TInt tRet = RProperty::Set(KPSUidSecurityUIs, |
2568 TInt tRet = RProperty::Set(KPSUidSecurityUIs, |
2642 KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
2569 KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSecUIOriginated); |
2643 if (tRet != KErrNone) |
2570 RDEBUG("tRet", tRet); |
2644 { |
|
2645 #if defined(_DEBUG) |
|
2646 RDebug::Print(_L("(SECUI)CSecuritySettings::ChangePinRequestParamsL():\ |
|
2647 FAILED to set the SECUI query Flag: %d"), tRet); |
|
2648 #endif |
|
2649 } |
|
2650 |
2571 |
2651 // Change the lock setting |
2572 // Change the lock setting |
2652 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
2573 iWait->SetRequestType(EMobilePhoneSetLockSetting); |
2653 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, |
2574 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, |
2654 ESecurityUIsQueryRequestOk); |
2575 ESecurityUIsQueryRequestOk); |