105 // |
102 // |
106 // ---------------------------------------------------------- |
103 // ---------------------------------------------------------- |
107 // CSecurityHandler::HandleEventL() |
104 // CSecurityHandler::HandleEventL() |
108 // Handles different security events |
105 // Handles different security events |
109 // ---------------------------------------------------------- |
106 // ---------------------------------------------------------- |
110 // |
107 // qtdone |
111 EXPORT_C void CSecurityHandler::HandleEventL( |
108 EXPORT_C void CSecurityHandler::HandleEventL( |
112 RMobilePhone::TMobilePhoneSecurityEvent aEvent ) |
109 RMobilePhone::TMobilePhoneSecurityEvent aEvent ) |
113 { |
110 { |
114 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
111 RDEBUG( "0", 0 ); |
115 |
112 |
116 TInt result = KErrNone; |
113 TInt result = KErrNone; |
117 HandleEventL( aEvent, result ); |
114 HandleEventL( aEvent, result ); |
118 } |
115 } |
119 |
116 |
120 // |
117 // |
121 // ---------------------------------------------------------- |
118 // ---------------------------------------------------------- |
122 // CSecurityHandler::HandleEventL() |
119 // CSecurityHandler::HandleEventL() |
123 // Handles different security events |
120 // Handles different security events |
124 // ---------------------------------------------------------- |
121 // ---------------------------------------------------------- |
125 // |
122 // qtdone |
126 EXPORT_C void CSecurityHandler::HandleEventL( |
123 EXPORT_C void CSecurityHandler::HandleEventL( |
127 RMobilePhone::TMobilePhoneSecurityEvent aEvent, |
124 RMobilePhone::TMobilePhoneSecurityEvent aEvent, |
128 TBool aStartup, TInt& aResult ) |
125 TBool aStartup, TInt& aResult ) |
129 { |
126 { |
130 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
127 RDEBUG( "0", 0 ); |
131 |
128 |
132 iStartup = aStartup; |
129 iStartup = aStartup; |
133 HandleEventL( aEvent, aResult ); |
130 HandleEventL( aEvent, aResult ); |
134 } |
131 } |
135 |
132 |
136 // |
133 // |
137 // ---------------------------------------------------------- |
134 // ---------------------------------------------------------- |
138 // CSecurityHandler::HandleEventL() |
135 // CSecurityHandler::HandleEventL() |
139 // Handles different security events |
136 // Handles different security events |
140 // ---------------------------------------------------------- |
137 // ---------------------------------------------------------- |
141 // |
138 // qtdone |
142 EXPORT_C void CSecurityHandler::HandleEventL( |
139 EXPORT_C void CSecurityHandler::HandleEventL( |
143 RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult ) |
140 RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult ) |
144 { |
141 { |
145 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
142 RDEBUG( "0", 0 ); |
146 |
143 |
147 /***************************************************** |
144 /***************************************************** |
148 * Series 60 Customer / ETel |
145 * Series 60 Customer / ETel |
149 * Series 60 ETel API |
146 * Series 60 ETel API |
150 *****************************************************/ |
147 *****************************************************/ |
151 #if defined(_DEBUG) |
|
152 RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL()")); |
|
153 RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() EVENT: %d"), aEvent); |
|
154 #endif |
|
155 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
148 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
156 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
149 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
157 RDebug::Printf( "%s %s (%u) aEvent=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aEvent ); |
150 RDEBUG( "aEvent", aEvent ); |
158 |
151 |
159 switch(aEvent) |
152 switch(aEvent) |
160 { |
153 { |
161 case RMobilePhone::EPin1Required: |
154 case RMobilePhone::EPin1Required: |
162 #if defined(_DEBUG) |
155 #if defined(_DEBUG) |
248 |
236 |
249 iQueryCanceled = EFalse; |
237 iQueryCanceled = EFalse; |
250 RMobilePhone::TMobilePassword required_fourth; |
238 RMobilePhone::TMobilePassword required_fourth; |
251 |
239 |
252 TInt ret = KErrNone; |
240 TInt ret = KErrNone; |
253 TInt err = KErrNone; |
|
254 TInt status = KErrNone; |
241 TInt status = KErrNone; |
255 |
242 |
256 RMobilePhone::TMobilePassword iSecUi_password; |
243 RMobilePhone::TMobilePassword iSecUi_password; |
257 TBool queryAccepted = EFalse; |
244 TInt queryAccepted = KErrCancel; |
258 |
245 |
259 |
246 while (queryAccepted!=KErrNone) |
260 while (!queryAccepted) |
|
261 { |
247 { |
262 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
248 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
263 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
249 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
264 |
250 |
265 /* request PIN using QT */ |
251 /* request PIN using QT */ |
266 CSecQueryUi *iSecQueryUi; |
252 CSecQueryUi *iSecQueryUi; |
267 RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
253 RDEBUG( "CSecQueryUi", 0 ); |
268 iSecQueryUi = CSecQueryUi::NewL(); |
254 iSecQueryUi = CSecQueryUi::NewL(); |
269 RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
255 lAlphaSupported = ESecUiAlphaSupported; |
270 iSecUi_password.Copy(_L("666")); |
256 lCancelSupported = ESecUiCancelSupported; |
271 RDebug::Printf( "%s %s (%u) InstallConfirmationQueryL=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
257 TBuf<0x100> title; title.Zero(); title.Append(_L("AskSecCodeL")); title.Append(_L("#")); title.AppendNum(-1); |
272 queryAccepted = iSecQueryUi->SecQueryDialog( _L("AskSecCodeL"), iSecUi_password, 4, 8, secCodeType /*aMode*/ ); |
258 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH, lAlphaSupported | lCancelSupported | secCodeType /*aMode*/ ); |
273 RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
259 RDEBUG( "iSecUi_password", 0 ); |
274 RDebug::Print( iSecUi_password ); |
260 RDebug::Print( iSecUi_password ); |
275 RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
261 RDEBUG( "delete", 0 ); |
276 delete iSecQueryUi; |
262 delete iSecQueryUi; |
277 RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
263 RDEBUG( "queryAccepted", queryAccepted ); |
278 if(queryAccepted) res=0xFFFFFFFE; // this is the value returned from iSecurityDlg |
|
279 /* end request PIN using QT */ |
264 /* end request PIN using QT */ |
280 |
265 if (queryAccepted!=KErrNone) |
281 CWait* wait = CWait::NewL(); |
|
282 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
|
283 status = wait->WaitForRequestL(); |
|
284 delete wait; |
|
285 |
|
286 ret = ETrue; |
|
287 if (!queryAccepted) |
|
288 { |
266 { |
289 ret = EFalse; |
267 ret = EFalse; |
290 return ret; |
268 return ret; |
291 } |
269 } |
292 queryAccepted = EFalse; // because it's not yet validated |
270 |
|
271 CWait* wait = CWait::NewL(); |
|
272 RDEBUG( "VerifySecurityCode", 0 ); |
|
273 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
|
274 RDEBUG( "WaitForRequestL", 0 ); |
|
275 status = wait->WaitForRequestL(); |
|
276 RDEBUG( "status", status ); |
|
277 delete wait; |
|
278 #ifdef __WINS__ |
|
279 if(status==KErrNotSupported ) |
|
280 { |
|
281 RDEBUG( "status", status ); |
|
282 status=KErrNone; |
|
283 } |
|
284 #endif |
|
285 |
|
286 ret = ETrue; |
|
287 queryAccepted = KErrCancel; // because it's not yet validated |
293 switch(status) |
288 switch(status) |
294 { |
289 { |
295 case KErrNone: |
290 case KErrNone: |
296 { |
291 { |
297 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
292 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
298 !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) |
293 !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) |
299 { |
294 { |
|
295 RDEBUG( "calling RSCPClient", 0 ); |
300 RSCPClient scpClient; |
296 RSCPClient scpClient; |
301 User::LeaveIfError( scpClient.Connect() ); |
297 User::LeaveIfError( scpClient.Connect() ); |
302 CleanupClosePushL( scpClient ); |
298 CleanupClosePushL( scpClient ); |
303 |
299 |
304 TSCPSecCode newCode; |
300 TSCPSecCode newCode; |
305 newCode.Copy( iSecUi_password ); |
301 newCode.Copy( iSecUi_password ); |
306 scpClient.StoreCode( newCode ); |
302 scpClient.StoreCode( newCode ); |
|
303 RDEBUG( "called StoreCode", 1 ); |
307 |
304 |
308 CleanupStack::PopAndDestroy(); //scpClient |
305 CleanupStack::PopAndDestroy(); //scpClient |
309 queryAccepted = ETrue; |
306 queryAccepted = KErrNone; |
310 } |
307 } |
311 |
308 |
312 iQueryCanceled = ETrue; // TODO |
309 iQueryCanceled = ETrue; // TODO |
313 return ETrue; |
310 return ETrue; |
314 } |
311 } |
315 case KErrGsmSSPasswordAttemptsViolation: |
312 case KErrGsmSSPasswordAttemptsViolation: |
316 case KErrLocked: |
313 case KErrLocked: |
317 { |
314 { |
318 // security code blocked! |
315 // security code blocked! |
319 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); // TODO |
316 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
320 break; |
317 break; |
321 } |
318 } |
322 case KErrGsm0707IncorrectPassword: |
319 case KErrGsm0707IncorrectPassword: |
323 case KErrAccessDenied: |
320 case KErrAccessDenied: |
324 { |
321 { |
325 // code was entered erroneusly |
322 // code was entered erroneusly |
326 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); // TODO |
323 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
327 } |
324 } |
328 default: |
325 default: |
329 { |
326 { |
330 CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); // TODO |
327 CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); |
331 } |
328 } |
332 } |
329 } |
333 } // while |
330 } // while |
334 |
331 |
335 iQueryCanceled = ETrue; |
332 iQueryCanceled = ETrue; |
453 |
455 |
454 lockChange = RMobilePhone::ELockSetDisabled; |
456 lockChange = RMobilePhone::ELockSetDisabled; |
455 |
457 |
456 #endif // RD_REMOTELOCK |
458 #endif // RD_REMOTELOCK |
457 |
459 |
|
460 RDEBUG( "lockChange", lockChange ); |
458 wait = CWait::NewL(); |
461 wait = CWait::NewL(); |
|
462 RDEBUG( "0", 0 ); |
|
463 // this also calls PassPhraseRequiredL ??? |
|
464 RDEBUG( "SetLockSetting", 1 ); |
459 iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); |
465 iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); |
|
466 res = KErrNone; |
|
467 RDEBUG( "WaitForRequestL", 0 ); |
460 res = wait->WaitForRequestL(); |
468 res = wait->WaitForRequestL(); |
|
469 RDEBUG( "res", res ); |
461 delete wait; |
470 delete wait; |
462 #if defined(_DEBUG) |
471 #if defined(_DEBUG) |
463 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() SetLockSetting RESULT:%d"), res); |
472 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() SetLockSetting RESULT:%d"), res); |
464 #endif |
473 #endif |
465 } |
474 } // from period == 0 |
466 else |
475 else |
467 { // ask security code |
476 { // ask security code |
468 #if defined(_DEBUG) |
477 #if defined(_DEBUG) |
469 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Ask sec code via notifier")); |
478 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Ask sec code via notifier")); |
470 #endif |
479 #endif |
|
480 RDEBUG( "0", 0 ); |
471 RNotifier codeQueryNotifier; |
481 RNotifier codeQueryNotifier; |
472 User::LeaveIfError(codeQueryNotifier.Connect()); |
482 User::LeaveIfError(codeQueryNotifier.Connect()); |
473 CWait* wait = CWait::NewL(); |
483 CWait* wait = CWait::NewL(); |
474 CleanupStack::PushL(wait); |
484 CleanupStack::PushL(wait); |
475 TInt queryResponse = 0; |
485 TInt queryResponse = 0; |
476 TPckg<TInt> response(queryResponse); |
486 TPckg<TInt> response(queryResponse); |
|
487 RDEBUG( "0", 0 ); |
477 TSecurityNotificationPckg params; |
488 TSecurityNotificationPckg params; |
478 params().iEvent = static_cast<TInt>(RMobilePhone::EPhonePasswordRequired); |
489 params().iEvent = static_cast<TInt>(RMobilePhone::EPhonePasswordRequired); |
479 params().iStartup = EFalse; |
490 params().iStartup = EFalse; |
480 #if defined(_DEBUG) |
491 #if defined(_DEBUG) |
481 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Start Notifier")); |
492 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Start Notifier")); |
482 #endif |
493 #endif |
|
494 RDEBUG( "0", 0 ); |
|
495 RDEBUG( "StartNotifierAndGetResponse", 0 ); |
483 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid,params, response); |
496 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid,params, response); |
484 // this will eventually call PassPhraseRequiredL |
497 // this will eventually call PassPhraseRequiredL |
|
498 RDEBUG( "WaitForRequestL", 0 ); |
485 res = wait->WaitForRequestL(); |
499 res = wait->WaitForRequestL(); |
|
500 RDEBUG( "WaitForRequestL", 1 ); |
|
501 RDEBUG( "res", res ); |
486 CleanupStack::PopAndDestroy(); // wait |
502 CleanupStack::PopAndDestroy(); // wait |
487 #if defined(_DEBUG) |
|
488 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() results:")); |
|
489 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() res:%d"), res); |
|
490 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() queryResponse:%d"), queryResponse); |
|
491 #endif |
|
492 if(res == KErrNone) |
503 if(res == KErrNone) |
493 res = queryResponse; |
504 res = queryResponse; |
494 } |
505 } // from else period == 0 |
|
506 RDEBUG( "0", 0 ); |
495 } |
507 } |
496 else |
508 else |
497 { |
509 { // can't read repository for KSettingsAutoLockTime |
498 #if defined(_DEBUG) |
510 RDEBUG( "KERRSOMETHING:Call SetLockSetting", 0 ); |
499 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KERRSOMETHING:Call SetLockSetting")); |
|
500 #endif |
|
501 |
511 |
502 #ifdef RD_REMOTELOCK |
512 #ifdef RD_REMOTELOCK |
503 |
513 |
504 // If remote lock is enabled, don't disable the domestic OS device lock |
514 // If remote lock is enabled, don't disable the domestic OS device lock |
505 // since that would render the RemoteLock useless. |
515 // since that would render the RemoteLock useless. |
545 |
555 |
546 // could not get the current autolock time... disable autolock in Domestic OS side. |
556 // could not get the current autolock time... disable autolock in Domestic OS side. |
547 lockChange = RMobilePhone::ELockSetDisabled; |
557 lockChange = RMobilePhone::ELockSetDisabled; |
548 |
558 |
549 #endif // RD_REMOTELOCK |
559 #endif // RD_REMOTELOCK |
|
560 RDEBUG( "0", 0 ); |
550 |
561 |
551 wait = CWait::NewL(); |
562 wait = CWait::NewL(); |
|
563 RDEBUG( "SetLockSetting", 0 ); |
552 iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); |
564 iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); |
|
565 RDEBUG( "WaitForRequestL", 0 ); |
553 res = wait->WaitForRequestL(); |
566 res = wait->WaitForRequestL(); |
|
567 RDEBUG( "WaitForRequestL", 1 ); |
554 delete wait; |
568 delete wait; |
555 #if defined(_DEBUG) |
569 #if defined(_DEBUG) |
556 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KES: SetLockSetting RESULT:%d"), res); |
570 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KES: SetLockSetting RESULT:%d"), res); |
557 #endif |
571 #endif |
558 } |
572 } |
559 |
573 |
|
574 RDEBUG( "res", res ); |
560 switch (res) |
575 switch (res) |
561 { |
576 { |
562 case KErrNone: |
577 case KErrNone: |
563 { |
578 { |
564 return ETrue; |
579 return ETrue; |
565 } |
580 } |
566 |
|
567 case KErrGsmSSPasswordAttemptsViolation: |
581 case KErrGsmSSPasswordAttemptsViolation: |
568 case KErrLocked: |
582 case KErrLocked: |
569 case KErrGsm0707IncorrectPassword: |
583 case KErrGsm0707IncorrectPassword: |
570 case KErrAccessDenied: |
584 case KErrAccessDenied: |
571 { |
585 { |
572 return AskSecCodeInAutoLockL(); |
586 RDEBUG( "KErrAccessDenied", KErrAccessDenied ); |
|
587 return AskSecCodeInAutoLockL(); |
573 } |
588 } |
574 case KErrAbort: |
589 case KErrAbort: |
575 case KErrCancel: |
590 case KErrCancel: |
576 // user pressed "cancel" |
591 // user pressed "cancel" |
577 return EFalse; |
592 return EFalse; |
578 default: |
593 default: |
579 { |
594 { |
|
595 RDEBUG( "default", res ); |
580 return AskSecCodeInAutoLockL(); |
596 return AskSecCodeInAutoLockL(); |
581 } |
597 } |
582 } |
598 } |
583 #endif // WINS |
|
584 } |
599 } |
585 // |
600 // |
586 // ---------------------------------------------------------- |
601 // ---------------------------------------------------------- |
587 // CSecurityHandler::PassPhraseRequired() |
602 // CSecurityHandler::PassPhraseRequired() |
588 // Handles PassPhraseRequired event |
603 // Handles PassPhraseRequired event |
589 // ---------------------------------------------------------- |
604 // ---------------------------------------------------------- |
590 // |
605 // qtdone |
591 TInt CSecurityHandler::PassPhraseRequiredL() |
606 TInt CSecurityHandler::PassPhraseRequiredL() |
592 { |
607 { |
593 /***************************************************** |
608 /***************************************************** |
594 * Series 60 Customer / ETel |
609 * Series 60 Customer / ETel |
595 * Series 60 ETel API |
610 * Series 60 ETel API |
596 *****************************************************/ |
611 *****************************************************/ |
597 #if defined(_DEBUG) |
612 RDEBUG( "0", 0 ); |
598 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()")); |
|
599 #endif |
|
600 TBool StartUp = iStartup; |
613 TBool StartUp = iStartup; |
601 |
614 |
602 RMobilePhone::TMobilePassword iSecUi_password; |
615 RMobilePhone::TMobilePassword iSecUi_password; |
603 RMobilePhone::TMobilePassword required_fourth; |
616 RMobilePhone::TMobilePassword required_fourth; |
604 TBool queryAccepted = EFalse; |
617 TInt queryAccepted = KErrCancel; |
605 |
618 |
606 TInt status=0; |
|
607 TInt autolockState=0; |
619 TInt autolockState=0; |
608 TInt lCancelSupported=0; |
620 TInt lCancelSupported=0; |
609 TInt lEmergencySupported=0; |
621 TInt lEmergencySupported=0; |
|
622 TInt lAlphaSupported=0; |
610 |
623 |
611 TInt err( KErrGeneral ); |
624 TInt err( KErrGeneral ); |
612 err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); |
625 err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); |
613 #if defined(_DEBUG) |
626 RDEBUG( "StartUp", StartUp ); |
614 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Autolock Status result: %d"), err); |
627 RDEBUG( "err", err ); |
615 #endif |
|
616 if(!StartUp) |
628 if(!StartUp) |
617 User::LeaveIfError( err ); |
629 User::LeaveIfError( err ); |
618 TBool isConditionSatisfied = EFalse; |
630 TBool isConditionSatisfied = EFalse; |
619 TInt tarmFlag=0; |
631 TInt tarmFlag=0; |
620 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
632 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
665 { |
677 { |
666 // from settings. Cancel+NoEmergency |
678 // from settings. Cancel+NoEmergency |
667 lCancelSupported = ESecUiCancelSupported; |
679 lCancelSupported = ESecUiCancelSupported; |
668 lEmergencySupported = ESecUiEmergencyNotSupported; |
680 lEmergencySupported = ESecUiEmergencyNotSupported; |
669 } |
681 } |
670 |
682 lAlphaSupported = ESecUiAlphaSupported; |
|
683 |
671 /* request PIN using QT */ |
684 /* request PIN using QT */ |
672 status = KErrNone; |
|
673 CSecQueryUi *iSecQueryUi; |
685 CSecQueryUi *iSecQueryUi; |
674 RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
675 iSecQueryUi = CSecQueryUi::NewL(); |
686 iSecQueryUi = CSecQueryUi::NewL(); |
676 RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
687 TInt lType = lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; |
677 iSecUi_password.Copy(_L("666")); |
688 RDEBUG( "lType", lType ); |
678 RDebug::Printf( "%s %s (%u) SecQueryDialog aType=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lCancelSupported | lEmergencySupported | secCodeTypeToAsk ); |
689 queryAccepted = iSecQueryUi->SecQueryDialog( _L("PassPhraseRequiredL"), iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH, lType ); |
679 queryAccepted = iSecQueryUi->SecQueryDialog( _L("PassPhraseRequiredL"), iSecUi_password, 4, 8, lCancelSupported | lEmergencySupported | secCodeTypeToAsk ); |
690 RDEBUG( "iSecUi_password", 0 ); |
680 RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
681 RDebug::Print( iSecUi_password ); |
691 RDebug::Print( iSecUi_password ); |
682 RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
692 RDEBUG( "queryAccepted", queryAccepted ); |
683 delete iSecQueryUi; |
693 delete iSecQueryUi; |
684 RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
685 if(queryAccepted) status=0xFFFFFFFE; // this is the value returned from iSecurityDlg |
|
686 /* end request PIN using QT */ |
694 /* end request PIN using QT */ |
687 |
695 |
688 // TODO if Emergency was possible, then consider status == ESecUiEmergencyCall |
|
689 /* I don't think I need this |
|
690 TInt secUiOriginatedQuery(ESecurityUIsETelAPIOriginated); |
|
691 RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
|
692 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
693 */ |
|
694 |
696 |
695 TBool wasCancelledOrEmergency = EFalse; |
697 TBool wasCancelledOrEmergency = EFalse; |
696 if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
698 RDEBUG( "KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements ); |
697 { |
699 if ( (queryAccepted==KErrAbort /* =emergency */) || (queryAccepted == KErrCancel)) |
698 if (!status || (status == ESecUiEmergencyCall) |
|
699 || (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) |
|
700 wasCancelledOrEmergency = ETrue; |
700 wasCancelledOrEmergency = ETrue; |
701 } |
701 RDEBUG( "wasCancelledOrEmergency", wasCancelledOrEmergency ); |
702 else |
|
703 { |
|
704 if ( ( status == KErrCancel ) || (status == ESecUiEmergencyCall) || |
|
705 (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) |
|
706 wasCancelledOrEmergency = ETrue; |
|
707 } |
|
708 RDebug::Printf( "%s %s (%u) wasCancelledOrEmergency=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, wasCancelledOrEmergency ); |
|
709 if (wasCancelledOrEmergency) |
702 if (wasCancelledOrEmergency) |
710 { |
703 { |
711 #if defined(_DEBUG) |
704 #if defined(_DEBUG) |
712 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DIALOG ERROR")); |
705 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DIALOG ERROR")); |
713 #endif |
706 #endif |
714 if (!StartUp) |
707 if (!StartUp) |
715 { |
708 { |
716 #if defined(_DEBUG) |
709 RDEBUG( "AbortSecurityCode", 0 ); |
717 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() ABORT CALLED!!!!!!")); |
|
718 #endif |
|
719 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); |
710 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); |
|
711 RDEBUG( "AbortSecurityCode", 1 ); |
720 } |
712 } |
721 return KErrCancel; |
713 return KErrCancel; |
722 } |
714 } |
723 |
715 |
724 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
716 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
725 CWait* wait = NULL; |
717 CWait* wait = NULL; |
726 |
718 TInt status = KErrNone;; |
727 RDebug::Printf( "%s %s (%u) VerifySecurityCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
728 wait = CWait::NewL(); |
719 wait = CWait::NewL(); |
|
720 RDEBUG( "VerifySecurityCode", 0 ); |
|
721 #ifndef __WINS__ |
729 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
722 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
|
723 RDEBUG( "WaitForRequestL", 0 ); |
730 status = wait->WaitForRequestL(); |
724 status = wait->WaitForRequestL(); |
731 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() VerifySecurityCode STATUS: %d"), status); |
725 #else |
|
726 status = KErrTimedOut; |
|
727 RDEBUG( "WaitForRequestL not waint WINS", 0 ); |
|
728 #endif |
|
729 RDEBUG( "WaitForRequestL status", status ); |
|
730 #ifdef __WINS__ |
|
731 if (status == KErrTimedOut) |
|
732 { |
|
733 status = KErrNone; |
|
734 } |
|
735 #endif |
732 delete wait; |
736 delete wait; |
733 |
737 |
734 TInt returnValue = status; |
738 TInt returnValue = status; |
735 RDebug::Printf( "%s %s (%u) status=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, status ); |
739 RDEBUG( "tarmFlag", tarmFlag ); |
736 RDebug::Printf( "%s %s (%u) tarmFlag=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tarmFlag ); |
740 RDEBUG( "StartUp", StartUp ); |
737 RDebug::Printf( "%s %s (%u) StartUp=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, StartUp ); |
|
738 switch(status) |
741 switch(status) |
739 { |
742 { |
740 case KErrNone: |
743 case KErrNone: |
741 #if defined(_DEBUG) |
744 #if defined(_DEBUG) |
742 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrNone")); |
745 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrNone")); |
743 #endif |
746 #endif |
744 // code approved |
747 // code approved |
745 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
748 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
|
749 RDEBUG( "R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE ); |
746 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
750 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
747 { |
751 { |
|
752 RDEBUG( "KFeatureIdSapTerminalControlFw", KFeatureIdSapTerminalControlFw ); |
748 // Unset the admin flag if set |
753 // Unset the admin flag if set |
749 if ( tarmFlag & KSCPFlagResyncQuery ) |
754 if ( tarmFlag & KSCPFlagResyncQuery ) |
750 { |
755 { |
751 TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); |
756 TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); |
752 |
757 |
915 #endif |
916 #endif |
916 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
917 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
917 break; |
918 break; |
918 case KErrGsm0707IncorrectPassword: |
919 case KErrGsm0707IncorrectPassword: |
919 case KErrAccessDenied: |
920 case KErrAccessDenied: |
|
921 RDEBUG( "KErrAccessDenied", KErrAccessDenied ); |
920 // TODO should this try again? It seems that it's not asked again. |
922 // TODO should this try again? It seems that it's not asked again. |
921 #if defined(_DEBUG) |
923 #if defined(_DEBUG) |
922 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrGsm0707IncorrectPassword")); |
924 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrGsm0707IncorrectPassword")); |
923 #endif |
925 #endif |
924 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
926 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
925 break; |
927 break; |
926 default: |
928 default: |
927 #if defined(_DEBUG) |
929 RDEBUG( "default", status ); |
928 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DEFAULT")); |
|
929 #endif |
|
930 CSecuritySettings::ShowErrorNoteL(status); |
930 CSecuritySettings::ShowErrorNoteL(status); |
931 // TODO should this try again? It seems that it's not asked again. |
931 // TODO should this try again? It seems that it's not asked again. |
932 break; |
932 break; |
933 } |
933 } |
934 |
934 RDEBUG( "returnValue", returnValue ); |
935 return returnValue; |
935 return returnValue; |
936 } |
936 } |
937 // |
937 // |
938 // ---------------------------------------------------------- |
938 // ---------------------------------------------------------- |
939 // CSecurityHandler::Pin1Required() |
939 // CSecurityHandler::Pin1Required() |
940 // Handles Pin1Required event |
940 // Handles Pin1Required event |
941 // ---------------------------------------------------------- |
941 // ---------------------------------------------------------- |
942 // |
942 // qtdone |
943 TInt CSecurityHandler::Pin1RequiredL() |
943 TInt CSecurityHandler::Pin1RequiredL() |
944 { |
944 { |
945 /***************************************************** |
945 /***************************************************** |
946 * Series 60 Customer / ETel |
946 * Series 60 Customer / ETel |
947 * Series 60 ETel API |
947 * Series 60 ETel API |
948 *****************************************************/ |
948 *****************************************************/ |
949 RDebug::Printf( "%s %s (%u) 11=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
949 RDEBUG( "0", 0 ); |
950 |
950 |
951 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
952 RMobilePhone::TMobilePassword iSecUi_password; |
951 RMobilePhone::TMobilePassword iSecUi_password; |
953 TInt lCancelSupported = ESecUiCancelNotSupported; |
952 TInt lCancelSupported = ESecUiCancelNotSupported; |
954 TBool queryAccepted = EFalse; |
953 TInt queryAccepted = KErrCancel; |
|
954 TInt lAlphaSupported=0; |
955 RMobilePhone::TMobilePassword required_fourth; |
955 RMobilePhone::TMobilePassword required_fourth; |
956 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; |
956 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; |
957 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
957 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
958 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
958 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
959 TBool StartUp = ETrue; |
959 TBool StartUp = ETrue; |
960 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
960 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
961 TInt err = KErrNone; |
961 TInt err = KErrNone; |
962 TInt res = KErrGeneral; |
962 TInt res = KErrGeneral; |
963 CWait* wait = CWait::NewL(); |
963 CWait* wait = CWait::NewL(); |
964 CleanupStack::PushL(wait); |
964 CleanupStack::PushL(wait); |
965 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
965 RDEBUG( "0", 0 ); |
966 |
|
967 |
966 |
968 StartUp = iStartup; |
967 StartUp = iStartup; |
969 |
968 |
970 #if defined(_DEBUG) |
969 RDEBUG( "StartUp", StartUp ); |
971 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL()")); |
|
972 #endif |
|
973 |
|
974 RDebug::Printf( "%s %s (%u) StartUp=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, StartUp ); |
|
975 if(!StartUp) |
970 if(!StartUp) |
976 { |
971 { |
977 // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL |
972 // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL |
978 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
973 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
979 |
974 |
994 } |
989 } |
995 #if defined(_DEBUG) |
990 #if defined(_DEBUG) |
996 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg")); |
991 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg")); |
997 #endif |
992 #endif |
998 |
993 |
999 RDebug::Printf( "%s %s (%u) StartUp=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, StartUp ); |
994 RDEBUG( "StartUp", StartUp ); |
1000 RDebug::Printf( "%s %s (%u) secUiOriginatedQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, secUiOriginatedQuery ); |
995 RDEBUG( "secUiOriginatedQuery", secUiOriginatedQuery ); |
1001 RDebug::Printf( "%s %s (%u) ESecurityUIsSecUIOriginated=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ESecurityUIsSecUIOriginated ); |
996 RDEBUG( "ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated ); |
1002 RDebug::Printf( "%s %s (%u) err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err ); |
997 RDEBUG( "err", err ); |
1003 if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
998 if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
1004 { |
999 { |
1005 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
1000 RDEBUG( "0", 0 ); |
1006 lCancelSupported = ESecUiCancelSupported; |
1001 lCancelSupported = ESecUiCancelNotSupported; |
1007 } |
1002 } |
1008 else |
1003 else |
1009 { |
1004 { |
1010 /* TODO do I need this ? */ |
1005 lCancelSupported = ESecUiCancelSupported; |
1011 /* |
|
1012 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
1013 CleanupStack::PushL(deviceLockStatusObserver); |
|
1014 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
|
1015 CleanupStack::PushL(queryStatusObserver); |
|
1016 ... |
|
1017 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
|
1018 */ |
|
1019 // it will be RMobilePhone::ESecurityCodePin1 , equivalent to ESecUiNone |
1006 // it will be RMobilePhone::ESecurityCodePin1 , equivalent to ESecUiNone |
1020 } |
1007 } |
1021 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1008 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1009 RDEBUG( "GetSecurityCodeInfo", 0 ); |
1022 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1010 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1023 res = wait->WaitForRequestL(); |
1011 res = wait->WaitForRequestL(); |
1024 #if defined(_DEBUG) |
1012 |
1025 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1013 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1026 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts query status: %d"), res); |
1014 RDEBUG( "attempts", attempts ); |
1027 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts: %d"), attempts); |
1015 |
1028 #endif |
1016 RDEBUG( "res", res ); |
1029 RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); |
|
1030 #ifdef __WINS__ |
1017 #ifdef __WINS__ |
1031 RDebug::Printf( "%s %s (%u) emulator can't read PIN attempts=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); |
1018 RDEBUG( "emulator can't read PIN attempts", res ); |
1032 res=KErrNone; |
1019 res=KErrNone; |
1033 codeInfo.iRemainingEntryAttempts=3; |
1020 codeInfo.iRemainingEntryAttempts=3; |
1034 #endif |
1021 #endif |
1035 |
1022 |
1036 User::LeaveIfError(res); |
1023 User::LeaveIfError(res); |
1037 /* request PIN using QT */ |
1024 /* request PIN using QT */ |
1038 CSecQueryUi *iSecQueryUi; |
1025 CSecQueryUi *iSecQueryUi; |
1039 RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1026 RDEBUG( "CSecQueryUi", 0 ); |
1040 iSecQueryUi = CSecQueryUi::NewL(); |
1027 iSecQueryUi = CSecQueryUi::NewL(); |
1041 RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1028 RDEBUG( "SecQueryDialog", 1 ); |
1042 iSecUi_password.Copy(_L("666")); |
|
1043 RDebug::Printf( "%s %s (%u) SecQueryDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1044 // TODO use codeInfo.iRemainingEntryAttempts for setting the Caption |
|
1045 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1029 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1046 // TODO also support Emergency |
1030 // TODO also support Emergency |
1047 queryAccepted = iSecQueryUi->SecQueryDialog( _L("Pin1RequiredL"), iSecUi_password, 4, 8, lCancelSupported | secCodeType /*aMode*/ ); |
1031 lAlphaSupported = ESecUiAlphaNotSupported; |
1048 RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1032 TBuf<0x100> title; title.Zero(); title.Append(_L("Pin1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); |
|
1033 TInt amode = lAlphaSupported | lCancelSupported | ESecUiEmergencySupported | secCodeType; |
|
1034 RDEBUG( "amode", amode ); |
|
1035 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode ); |
|
1036 RDEBUG( "iSecUi_password", 0 ); |
1049 RDebug::Print( iSecUi_password ); |
1037 RDebug::Print( iSecUi_password ); |
1050 RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1051 delete iSecQueryUi; |
1038 delete iSecQueryUi; |
1052 RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1039 RDEBUG( "queryAccepted", queryAccepted ); |
1053 if(queryAccepted) res=0xFFFFFFFE; // this is the value returned from iSecurityDlg |
|
1054 // TODO handle emergency |
1040 // TODO handle emergency |
1055 /* end request PIN using QT */ |
1041 /* end request PIN using QT */ |
1056 |
1042 |
1057 RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); |
1043 if ( queryAccepted == KErrAbort ) // emergency call |
1058 if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1059 { |
1044 { |
1060 #if defined(_DEBUG) |
1045 #if defined(_DEBUG) |
1061 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_REQUEST_QUERY CANCEL!")); |
1046 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_REQUEST_QUERY CANCEL!")); |
1062 #endif |
1047 #endif |
1063 CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? |
1048 CleanupStack::PopAndDestroy(wait); // this is needed |
1064 return KErrCancel; |
1049 return KErrCancel; |
1065 } |
1050 } |
1066 if( lCancelSupported && (!res || (res == ESecUiDeviceLocked))) |
1051 if( lCancelSupported && (queryAccepted == KErrCancel) ) |
1067 { |
1052 { |
1068 // cancel code request |
1053 // cancel code request |
|
1054 RDEBUG( "AbortSecurityCode", 0 ); |
1069 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); |
1055 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); |
1070 CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? |
1056 RDEBUG( "AbortSecurityCode", 1 ); |
|
1057 CleanupStack::PopAndDestroy(wait); // this is needed |
1071 return KErrCancel; |
1058 return KErrCancel; |
1072 } |
1059 } |
1073 |
1060 |
1074 #if defined(_DEBUG) |
1061 RDEBUG( "iSecUi_password", iSecUi_password ); |
1075 RDebug::Print(_L("CSecurityNotifier::Pin1RequiredL()VerifySecurityCode")); |
|
1076 #endif |
|
1077 |
|
1078 RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1079 RDebug::Print( iSecUi_password ); |
1062 RDebug::Print( iSecUi_password ); |
|
1063 RDEBUG( "VerifySecurityCode", 0 ); |
1080 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
1064 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
1081 |
1065 RDEBUG( "WaitForRequestL", 0 ); |
1082 res = wait->WaitForRequestL(); |
1066 res = wait->WaitForRequestL(); |
|
1067 RDEBUG( "WaitForRequestL res", res ); |
1083 CleanupStack::PopAndDestroy(wait); |
1068 CleanupStack::PopAndDestroy(wait); |
1084 #if defined(_DEBUG) |
1069 |
1085 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL() VerifySecurityCode STATUS: %d"), res); |
|
1086 #endif |
|
1087 TInt returnValue = res; |
1070 TInt returnValue = res; |
1088 switch(res) |
1071 switch(res) |
1089 { |
1072 { |
1090 case KErrNone: |
1073 case KErrNone: |
1091 // code approved |
1074 // code approved |
1151 TBool StartUp(ETrue); |
1135 TBool StartUp(ETrue); |
1152 StartUp = iStartup; |
1136 StartUp = iStartup; |
1153 |
1137 |
1154 TInt res(KErrNone); |
1138 TInt res(KErrNone); |
1155 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1139 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1156 #if defined(_DEBUG) |
|
1157 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info")); |
|
1158 #endif |
|
1159 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
|
1160 res = wait->WaitForRequestL(); |
|
1161 |
1140 |
1162 TInt thisTry = 0; |
1141 TInt thisTry = 0; |
1163 |
1142 |
1164 // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. |
1143 // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. |
1165 while ( res != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
1144 while ( res != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
1166 { |
1145 { |
1167 User::After( KTimeBeforeRetryingRequest ); |
1146 if(thisTry>0) |
|
1147 User::After( KTimeBeforeRetryingRequest ); |
|
1148 RDEBUG( "GetSecurityCodeInfo", 0 ); |
1168 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1149 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1169 res = wait->WaitForRequestL(); |
1150 RDEBUG( "WaitForRequestL", 0 ); |
|
1151 res = wait->WaitForRequestL(); |
|
1152 RDEBUG( "WaitForRequestL res", res ); |
1170 } |
1153 } |
1171 #if defined(_DEBUG) |
1154 #if defined(_DEBUG) |
1172 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info result: %d"), res); |
1155 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info result: %d"), res); |
1173 #endif |
1156 #endif |
1174 //If there's still an error we're doomed. Bail out. |
1157 //If there's still an error we're doomed. Bail out. |
1175 User::LeaveIfError(res); |
1158 User::LeaveIfError(res); |
1176 |
1159 |
1177 #if defined(_DEBUG) |
1160 #if defined(_DEBUG) |
1178 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); |
1161 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); |
1179 #endif |
1162 #endif |
|
1163 |
|
1164 RDEBUG( "StartUp", StartUp ); |
|
1165 RDEBUG( "codeInfo.iRemainingEntryAttempts", codeInfo.iRemainingEntryAttempts ); |
1180 //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
1166 //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
1181 if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
1167 if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
1182 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1168 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1183 |
1169 |
1184 // ask PUK code |
1170 // ask PUK code |
1185 iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); |
1171 /* request PIN using QT */ |
1186 if(AknLayoutUtils::PenEnabled()) |
1172 CSecQueryUi *iSecQueryUi; |
1187 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1173 RDEBUG( "CSecQueryUi", 0 ); |
1188 else |
1174 iSecQueryUi = CSecQueryUi::NewL(); |
1189 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1175 RDEBUG( "SecQueryDialog", 1 ); |
1190 #ifdef __COVER_DISPLAY |
1176 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1191 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
1177 // TODO also support Emergency |
1192 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
1178 TBuf<0x100> title; title.Zero(); title.Append(_L("Puk1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1193 if (covercl) // returns null if __COVER_DISPLAY is not defined |
1179 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); |
1194 { |
1180 RDEBUG( "iSecUi_password", 0 ); |
1195 // … - add data that cover ui is interested in |
1181 RDebug::Print( iSecUi_password ); |
1196 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK1); // adds int to additional data to be posted to cover ui |
1182 delete iSecQueryUi; |
1197 covercl->BufStream().CommitL(); // no more data to send so commit buf |
1183 RDEBUG( "queryAccepted", queryAccepted ); |
1198 } |
1184 |
1199 #endif //__COVER_DISPLAY |
1185 if( (queryAccepted == KErrAbort) || (queryAccepted==KErrCancel) ) |
1200 |
|
1201 #if defined(_DEBUG) |
|
1202 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show dialog")); |
|
1203 #endif |
|
1204 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) |
|
1205 res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY); |
|
1206 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1207 { |
|
1208 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1209 res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); |
|
1210 CleanupStack::PopAndDestroy(queryPrompt); |
|
1211 } |
|
1212 else |
|
1213 { |
|
1214 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK_ATTEMPT); |
|
1215 res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); |
|
1216 CleanupStack::PopAndDestroy(queryPrompt); |
|
1217 } |
|
1218 |
|
1219 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1220 { |
1186 { |
1221 CleanupStack::PopAndDestroy(wait); |
1187 CleanupStack::PopAndDestroy(wait); // TODO this is needed ??? |
1222 return KErrCancel; |
1188 return KErrCancel; |
1223 } |
1189 } |
1224 |
1190 |
1225 RMobilePhone::TMobilePassword verifcationPassword; |
1191 { |
1226 // new pin code query |
1192 // new pin code query |
1227 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
1193 CSecQueryUi *iSecQueryUi; |
1228 if(AknLayoutUtils::PenEnabled()) |
1194 RDEBUG( "CSecQueryUi", 0 ); |
1229 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1195 iSecQueryUi = CSecQueryUi::NewL(); |
1230 else |
1196 RDEBUG( "SecQueryDialog", 1 ); |
1231 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1197 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1232 res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); |
1198 // TODO also support Emergency |
1233 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
1199 |
|
1200 queryAccepted = iSecQueryUi->SecQueryDialog( _L("Puk1-New|Puk1-Verif"), aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); |
|
1201 RDEBUG( "aNewPassword", 0 ); |
|
1202 RDebug::Print( aNewPassword ); |
|
1203 delete iSecQueryUi; |
|
1204 RDEBUG( "queryAccepted", queryAccepted ); |
|
1205 } |
|
1206 |
|
1207 if( (queryAccepted == KErrAbort) || (queryAccepted==KErrCancel) ) |
1234 { |
1208 { |
1235 CleanupStack::PopAndDestroy(wait); |
1209 CleanupStack::PopAndDestroy(wait); |
1236 return KErrCancel; |
1210 return KErrCancel; |
1237 } |
1211 } |
1238 |
|
1239 // verification code query |
|
1240 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1241 if(AknLayoutUtils::PenEnabled()) |
|
1242 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1243 else |
|
1244 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1245 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); |
|
1246 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1247 { |
|
1248 CleanupStack::PopAndDestroy(wait); |
|
1249 return KErrCancel; |
|
1250 } |
|
1251 |
|
1252 while (aNewPassword.CompareF(verifcationPassword) != 0) |
|
1253 { |
|
1254 // codes do not match -> note -> ask new pin and verification codes again |
|
1255 CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
1256 |
|
1257 verifcationPassword = _L(""); |
|
1258 aNewPassword = _L(""); |
|
1259 |
|
1260 // new pin code query |
|
1261 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1262 if(AknLayoutUtils::PenEnabled()) |
|
1263 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1264 else |
|
1265 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1266 res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); |
|
1267 if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1268 { |
|
1269 CleanupStack::PopAndDestroy(wait); |
|
1270 return KErrCancel; |
|
1271 } |
|
1272 |
|
1273 // verification code query |
|
1274 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1275 if(AknLayoutUtils::PenEnabled()) |
|
1276 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1277 else |
|
1278 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1279 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); |
|
1280 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1281 { |
|
1282 CleanupStack::PopAndDestroy(wait); |
|
1283 return KErrCancel; |
|
1284 } |
|
1285 } |
|
1286 |
1212 |
1287 // send code |
1213 // send code |
1288 #if defined(_DEBUG) |
1214 RDEBUG( "VerifySecurityCode", 0 ); |
1289 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Verify Code")); |
1215 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,iSecUi_password); |
1290 #endif |
1216 RDEBUG( "WaitForRequestL", 0 ); |
1291 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); |
|
1292 res = wait->WaitForRequestL(); |
1217 res = wait->WaitForRequestL(); |
|
1218 RDEBUG( "WaitForRequestL res", res ); |
1293 CleanupStack::PopAndDestroy(wait); |
1219 CleanupStack::PopAndDestroy(wait); |
1294 |
1220 |
1295 TInt returnValue = res; |
1221 TInt returnValue = res; |
1296 switch(res) |
1222 switch(res) |
1297 { |
1223 { |
1323 // |
1250 // |
1324 // ---------------------------------------------------------- |
1251 // ---------------------------------------------------------- |
1325 // CSecurityHandler::Pin2Required() |
1252 // CSecurityHandler::Pin2Required() |
1326 // Handles Pin2Required event |
1253 // Handles Pin2Required event |
1327 // ---------------------------------------------------------- |
1254 // ---------------------------------------------------------- |
1328 // |
1255 // qtdone |
1329 void CSecurityHandler::Pin2RequiredL() |
1256 void CSecurityHandler::Pin2RequiredL() |
1330 { |
1257 { |
1331 /***************************************************** |
1258 /***************************************************** |
1332 * Series 60 Customer / ETel |
1259 * Series 60 Customer / ETel |
1333 * Series 60 ETel API |
1260 * Series 60 ETel API |
1334 *****************************************************/ |
1261 *****************************************************/ |
1335 /* request PIN using QT */ |
|
1336 TBool queryAccepted = EFalse; |
|
1337 RMobilePhone::TMobilePassword iSecUi_password; |
|
1338 CSecQueryUi *iSecQueryUi; |
|
1339 RDebug::Printf( "%s %s (%u) CSecQueryUi=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1340 iSecQueryUi = CSecQueryUi::NewL(); |
|
1341 RDebug::Printf( "%s %s (%u) Copy=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1342 iSecUi_password.Copy(_L("666")); |
|
1343 RDebug::Printf( "%s %s (%u) SecQueryDialog=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1344 queryAccepted = iSecQueryUi->SecQueryDialog( _L("Pin2RequiredL"), iSecUi_password, 4, 8, RMobilePhone::ESecurityCodePin2 /*aMode*/ ); |
|
1345 RDebug::Printf( "%s %s (%u) iSecUi_password=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1346 RDebug::Print( iSecUi_password ); |
|
1347 RDebug::Printf( "%s %s (%u) delete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1348 delete iSecQueryUi; |
|
1349 RDebug::Printf( "%s %s (%u) done=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
1350 // if(queryAccepted) res=0xFFFFFFFE; // this is the value returned from iSecurityDlg |
|
1351 /* end request PIN using QT */ |
|
1352 |
|
1353 |
1262 |
1354 #if defined(_DEBUG) |
1263 #if defined(_DEBUG) |
1355 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL() BEGIN")); |
1264 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL() BEGIN")); |
1356 #endif |
1265 #endif |
1357 RMobilePhone::TMobilePassword password; |
1266 TInt queryAccepted = KErrCancel; |
|
1267 RMobilePhone::TMobilePassword iSecUi_password; |
1358 RMobilePhone::TMobilePassword required_fourth; |
1268 RMobilePhone::TMobilePassword required_fourth; |
1359 RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); |
1269 RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); |
1360 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1270 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1361 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1271 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1362 CWait* wait = CWait::NewL(); |
1272 CWait* wait = CWait::NewL(); |
1363 CleanupStack::PushL(wait); |
1273 CleanupStack::PushL(wait); |
1364 |
1274 |
1365 #if defined(_DEBUG) |
1275 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1366 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): create dialog")); |
1276 RDEBUG( "GetSecurityCodeInfo", 0 ); |
1367 #endif |
|
1368 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
1369 #ifdef __COVER_DISPLAY |
|
1370 #if defined(_DEBUG) |
|
1371 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): publish dialog")); |
|
1372 #endif |
|
1373 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1374 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1375 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1376 { |
|
1377 // … - add data that cover ui is interested in |
|
1378 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN2); // adds int to additional data to be posted to cover ui |
|
1379 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1380 } |
|
1381 #endif //__COVER_DISPLAY |
|
1382 |
|
1383 #if defined(_DEBUG) |
|
1384 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info")); |
|
1385 #endif |
|
1386 |
|
1387 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1388 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1277 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1278 RDEBUG( "WaitForRequestL", 0 ); |
1389 TInt ret = wait->WaitForRequestL(); |
1279 TInt ret = wait->WaitForRequestL(); |
1390 |
1280 RDEBUG( "WaitForRequestL ret", ret ); |
1391 #if defined(_DEBUG) |
1281 |
1392 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); |
1282 User::LeaveIfError(ret); |
|
1283 |
1393 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1284 TInt attempts(codeInfo.iRemainingEntryAttempts); |
1394 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); |
1285 RDEBUG( "attempts", attempts ); |
1395 #endif |
1286 |
1396 User::LeaveIfError(ret); |
1287 /* request PIN using QT */ |
1397 |
1288 CSecQueryUi *iSecQueryUi; |
1398 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
1289 RDEBUG( "CSecQueryUi", 0 ); |
1399 CleanupStack::PushL(deviceLockStatusObserver); |
1290 iSecQueryUi = CSecQueryUi::NewL(); |
1400 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
1291 RDEBUG( "SecQueryDialog", 1 ); |
1401 CleanupStack::PushL(queryStatusObserver); |
1292 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt |
1402 |
1293 // TODO also support Emergency |
1403 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
1294 |
1404 ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY); |
1295 TBuf<0x100> title; title.Zero(); title.Append(_L("Pin2RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1405 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1296 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType ); |
1406 { |
1297 RDEBUG( "iSecUi_password", 0 ); |
1407 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
1298 RDebug::Print( iSecUi_password ); |
1408 ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
1299 RDEBUG( "queryAccepted", queryAccepted ); |
1409 CleanupStack::PopAndDestroy(queryPrompt); |
1300 delete iSecQueryUi; |
1410 } |
1301 |
1411 else |
1302 // If failed or device became locked, any pending request should be cancelled. |
1412 { |
1303 if ( queryAccepted!=KErrNone ) |
1413 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); |
|
1414 ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
|
1415 CleanupStack::PopAndDestroy(queryPrompt); |
|
1416 } |
|
1417 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
|
1418 iSecurityDlg = NULL; |
|
1419 if (!ret || (ret == ESecUiDeviceLocked)) |
|
1420 { |
1304 { |
1421 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); |
1305 RDEBUG( "AbortSecurityCode", 0 ); |
|
1306 iPhone.AbortSecurityCode(secCodeType); |
|
1307 RDEBUG( "AbortSecurityCode", 1 ); |
1422 CleanupStack::PopAndDestroy(wait); |
1308 CleanupStack::PopAndDestroy(wait); |
1423 return; |
1309 return; |
1424 } |
1310 } |
1425 |
1311 |
1426 #if defined(_DEBUG) |
1312 RDEBUG( "VerifySecurityCode", 0 ); |
1427 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): Verify Code")); |
1313 iPhone.VerifySecurityCode(wait->iStatus,secCodeType,iSecUi_password,required_fourth); |
1428 #endif |
1314 RDEBUG( "WaitForRequestL", 0 ); |
1429 iPhone.VerifySecurityCode(wait->iStatus,secCodeType,password,required_fourth); |
|
1430 TInt status = wait->WaitForRequestL(); |
1315 TInt status = wait->WaitForRequestL(); |
1431 #if defined(_DEBUG) |
1316 RDEBUG( "WaitForRequestL status", status ); |
1432 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): destroy wait")); |
|
1433 #endif |
|
1434 CleanupStack::PopAndDestroy(wait); |
1317 CleanupStack::PopAndDestroy(wait); |
1435 |
1318 |
1436 switch(status) |
1319 switch(status) |
1437 { |
1320 { |
1438 case KErrNone: |
1321 case KErrNone: |
1458 // |
1341 // |
1459 // ---------------------------------------------------------- |
1342 // ---------------------------------------------------------- |
1460 // CSecurityHandler::Puk2Required() |
1343 // CSecurityHandler::Puk2Required() |
1461 // Handles Puk2Required event |
1344 // Handles Puk2Required event |
1462 // ---------------------------------------------------------- |
1345 // ---------------------------------------------------------- |
1463 // |
1346 // qtdone |
1464 void CSecurityHandler::Puk2RequiredL() |
1347 void CSecurityHandler::Puk2RequiredL() |
1465 { |
1348 { |
1466 /***************************************************** |
1349 /***************************************************** |
1467 * Series 60 Customer / ETel |
1350 * Series 60 Customer / ETel |
1468 * Series 60 ETel API |
1351 * Series 60 ETel API |
1469 *****************************************************/ |
1352 *****************************************************/ |
1470 RMobilePhone::TMobilePassword aPassword; |
1353 TInt queryAccepted = KErrCancel; |
|
1354 RMobilePhone::TMobilePassword iSecUi_password; |
1471 RMobilePhone::TMobilePassword aNewPassword; |
1355 RMobilePhone::TMobilePassword aNewPassword; |
1472 RMobilePhone::TMobilePassword verifcationPassword; |
1356 RMobilePhone::TMobilePassword verifcationPassword; |
1473 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1357 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1474 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1358 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1475 |
1359 |
1476 RMobilePhone::TMobilePhoneSecurityCode blockCodeType; |
1360 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePuk2; |
1477 blockCodeType = RMobilePhone::ESecurityCodePuk2; |
|
1478 CWait* wait = CWait::NewL(); |
1361 CWait* wait = CWait::NewL(); |
1479 CleanupStack::PushL(wait); |
1362 CleanupStack::PushL(wait); |
1480 |
1363 |
1481 #if defined(_DEBUG) |
1364 #if defined(_DEBUG) |
1482 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL()")); |
1365 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL()")); |
1483 #endif |
1366 #endif |
1484 // ask PUK2 |
1367 // ask PUK2 |
1485 iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH,ESecUiNone); |
|
1486 #ifdef __COVER_DISPLAY |
|
1487 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1488 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1489 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1490 { |
|
1491 // … - add data that cover ui is interested in |
|
1492 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK2); // adds int to additional data to be posted to cover ui |
|
1493 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1494 } |
|
1495 #endif //__COVER_DISPLAY |
|
1496 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
1497 CleanupStack::PushL(deviceLockStatusObserver); |
|
1498 |
1368 |
1499 TInt ret(KErrNone); |
1369 TInt ret(KErrNone); |
1500 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1370 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1501 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1371 RDEBUG( "GetSecurityCodeInfo", 0 ); |
|
1372 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1373 RDEBUG( "WaitForRequestL", 0 ); |
1502 ret = wait->WaitForRequestL(); |
1374 ret = wait->WaitForRequestL(); |
|
1375 RDEBUG( "WaitForRequestL ret", ret ); |
1503 User::LeaveIfError(ret); |
1376 User::LeaveIfError(ret); |
1504 |
1377 |
1505 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) |
1378 /* request PIN using QT */ |
1506 ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY); |
1379 CSecQueryUi *iSecQueryUi; |
1507 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1380 RDEBUG( "CSecQueryUi", 0 ); |
1508 { |
1381 iSecQueryUi = CSecQueryUi::NewL(); |
1509 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK2_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
1382 RDEBUG( "SecQueryDialog", 1 ); |
1510 ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); |
1383 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1511 CleanupStack::PopAndDestroy(queryPrompt); |
1384 // TODO also support Emergency |
1512 } |
1385 |
1513 else |
1386 TBuf<0x100> title; title.Zero(); title.Append(_L("Puk2RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1514 { |
1387 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType /*aMode*/ ); |
1515 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK2_ATTEMPT); |
1388 RDEBUG( "iSecUi_password", 0 ); |
1516 ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); |
1389 RDebug::Print( iSecUi_password ); |
1517 CleanupStack::PopAndDestroy(queryPrompt); |
1390 delete iSecQueryUi; |
1518 } |
1391 RDEBUG( "queryAccepted", queryAccepted ); |
1519 |
1392 |
1520 iSecurityDlg = NULL; |
1393 if( queryAccepted!=KErrNone ) |
1521 if(!ret || (ret == ESecUiDeviceLocked)) |
|
1522 { |
1394 { |
1523 #if defined(_DEBUG) |
|
1524 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() PUK QUERY CANCEL")); |
|
1525 #endif |
|
1526 // cancel "get security unblock code" request |
1395 // cancel "get security unblock code" request |
1527 iPhone.AbortSecurityCode(blockCodeType); |
1396 RDEBUG( "AbortSecurityCode", 0 ); |
1528 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
1397 iPhone.AbortSecurityCode(secCodeType); |
|
1398 RDEBUG( "AbortSecurityCode", 1 ); |
|
1399 CleanupStack::PopAndDestroy(1); //wait |
1529 return; |
1400 return; |
1530 } |
1401 } |
1531 #if defined(_DEBUG) |
1402 |
1532 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY")); |
1403 { |
1533 #endif |
1404 // new pin code query |
1534 // new pin2 code query |
1405 CSecQueryUi *iSecQueryUi; |
1535 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
1406 RDEBUG( "CSecQueryUi", 0 ); |
1536 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
1407 iSecQueryUi = CSecQueryUi::NewL(); |
1537 ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); |
1408 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1538 if(!ret || (ret == ESecUiDeviceLocked)) |
1409 // TODO also support Emergency |
1539 { |
1410 |
1540 #if defined(_DEBUG) |
1411 queryAccepted = iSecQueryUi->SecQueryDialog( _L("Puk2-New|Puk2-Verif"), aNewPassword, SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | secCodeType ); |
1541 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY CANCEL")); |
1412 RDEBUG( "aNewPassword", 0 ); |
1542 #endif |
1413 RDebug::Print( aNewPassword ); |
1543 // cancel "get security unblock code" request |
1414 delete iSecQueryUi; |
1544 iPhone.AbortSecurityCode(blockCodeType); |
1415 RDEBUG( "queryAccepted", queryAccepted ); |
1545 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
1416 if( queryAccepted!=KErrNone ) |
1546 return; |
1417 { |
1547 } |
1418 // cancel "get security unblock code" request |
1548 |
1419 RDEBUG( "AbortSecurityCode", 0 ); |
1549 // verification code query |
1420 iPhone.AbortSecurityCode(secCodeType); |
1550 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
1421 RDEBUG( "AbortSecurityCode", 1 ); |
1551 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
1422 CleanupStack::PopAndDestroy(1); //wait |
1552 ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); |
1423 return; |
1553 if (!ret || (ret == ESecUiDeviceLocked)) |
1424 } |
1554 { |
1425 } |
1555 #if defined(_DEBUG) |
|
1556 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() VERIFY QUERY CANCEL")); |
|
1557 #endif |
|
1558 // cancel "get security unblock code" request |
|
1559 iPhone.AbortSecurityCode(blockCodeType); |
|
1560 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1561 return; |
|
1562 } |
|
1563 |
|
1564 while (aNewPassword.CompareF(verifcationPassword) != 0) |
|
1565 { |
|
1566 // codes do not match -> note -> ask new pin and verification codes again |
|
1567 CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
1568 |
|
1569 verifcationPassword = _L(""); |
|
1570 aNewPassword = _L(""); |
|
1571 |
|
1572 // new pin2 code query |
|
1573 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
1574 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
|
1575 deviceLockStatusObserver->StartObserver(); |
|
1576 |
|
1577 ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); |
|
1578 |
|
1579 if(!ret || (ret == ESecUiDeviceLocked)) |
|
1580 { |
|
1581 // cancel "get security unblock code" request |
|
1582 iPhone.AbortSecurityCode(blockCodeType); |
|
1583 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1584 return; |
|
1585 } |
|
1586 |
|
1587 // verification code query |
|
1588 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
1589 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
|
1590 deviceLockStatusObserver->StartObserver(); |
|
1591 ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); |
|
1592 |
|
1593 if (!ret || (ret == ESecUiDeviceLocked)) |
|
1594 { |
|
1595 // cancel "get security unblock code" request |
|
1596 iPhone.AbortSecurityCode(blockCodeType); |
|
1597 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1598 return; |
|
1599 } |
|
1600 } |
|
1601 CleanupStack::PopAndDestroy(deviceLockStatusObserver); |
|
1602 // send code |
1426 // send code |
1603 |
1427 // TODO the current code should be verified before |
1604 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); |
1428 RDEBUG( "VerifySecurityCode", 0 ); |
|
1429 iPhone.VerifySecurityCode(wait->iStatus,secCodeType,aNewPassword,iSecUi_password); |
|
1430 RDEBUG( "WaitForRequestL", 0 ); |
1605 TInt res = wait->WaitForRequestL(); |
1431 TInt res = wait->WaitForRequestL(); |
|
1432 RDEBUG( "WaitForRequestL res", res ); |
1606 CleanupStack::PopAndDestroy(wait); |
1433 CleanupStack::PopAndDestroy(wait); |
1607 |
1434 |
1608 switch(res) |
1435 switch(res) |
1609 { |
1436 { |
1610 case KErrNone: |
1437 case KErrNone: |
1632 // |
1459 // |
1633 // ---------------------------------------------------------- |
1460 // ---------------------------------------------------------- |
1634 // CSecurityHandler::UPinRequiredL() |
1461 // CSecurityHandler::UPinRequiredL() |
1635 // Hendles UniversalPinRequired event |
1462 // Hendles UniversalPinRequired event |
1636 // ---------------------------------------------------------- |
1463 // ---------------------------------------------------------- |
1637 // |
1464 // qtdone |
1638 TInt CSecurityHandler::UPinRequiredL() |
1465 TInt CSecurityHandler::UPinRequiredL() |
1639 { |
1466 { |
1640 /***************************************************** |
1467 /***************************************************** |
1641 * Series 60 Customer / ETel |
1468 * Series 60 Customer / ETel |
1642 * Series 60 ETel API |
1469 * Series 60 ETel API |
1643 *****************************************************/ |
1470 *****************************************************/ |
1644 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1471 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1645 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1472 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1646 if(wcdmaSupported || upinSupported) |
1473 if(wcdmaSupported || upinSupported) |
1647 { |
1474 { |
1648 RMobilePhone::TMobilePassword password; |
1475 TInt queryAccepted = KErrCancel; |
|
1476 TInt lCancelSupported = ESecUiCancelNotSupported; |
|
1477 RMobilePhone::TMobilePassword iSecUi_password; |
1649 RMobilePhone::TMobilePassword required_fourth; |
1478 RMobilePhone::TMobilePassword required_fourth; |
1650 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1479 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1651 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1480 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1652 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin; |
1481 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin; |
1653 CWait* wait = CWait::NewL(); |
1482 CWait* wait = CWait::NewL(); |
1656 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
1485 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
1657 TInt err = KErrNone; |
1486 TInt err = KErrNone; |
1658 TInt res = KErrGeneral; |
1487 TInt res = KErrGeneral; |
1659 |
1488 |
1660 StartUp = iStartup; |
1489 StartUp = iStartup; |
1661 |
1490 RDEBUG( "StartUp", StartUp ); |
1662 #if defined(_DEBUG) |
1491 |
1663 RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL()")); |
1492 |
1664 #endif |
1493 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1665 |
1494 RDEBUG( "GetSecurityCodeInfo", 0 ); |
|
1495 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1496 RDEBUG( "WaitForRequestL", 0 ); |
|
1497 res = wait->WaitForRequestL(); |
|
1498 RDEBUG( "WaitForRequestL res", res ); |
|
1499 User::LeaveIfError(res); |
|
1500 |
1666 if(!StartUp) |
1501 if(!StartUp) |
1667 { |
1502 { |
1668 // read a flag to see whether the query is SecUi originated. |
1503 // read a flag to see whether the query is SecUi originated. |
1669 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1504 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1670 } |
1505 } |
1671 |
1506 |
1672 #if defined(_DEBUG) |
1507 /* request PIN using QT */ |
1673 RDebug::Print(_L("CSecurityHandler::UPinRequiredL() Execute dlg")); |
1508 CSecQueryUi *iSecQueryUi; |
1674 #endif |
1509 RDEBUG( "CSecQueryUi", 0 ); |
1675 if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
1510 iSecQueryUi = CSecQueryUi::NewL(); |
1676 { |
1511 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1677 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); |
1512 // TODO also support Emergency |
1678 if(AknLayoutUtils::PenEnabled()) |
1513 if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
1679 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1514 lCancelSupported = ESecUiCancelNotSupported; |
1680 else |
1515 else |
1681 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1516 lCancelSupported = ESecUiCancelSupported; |
1682 #ifdef __COVER_DISPLAY |
1517 |
1683 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
1518 TBuf<0x100> title; title.Zero(); title.Append(_L("UPin1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1684 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
1519 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | lCancelSupported | ESecUiCodeEtelReqest ); |
1685 if (covercl) // returns null if __COVER_DISPLAY is not defined |
1520 RDEBUG( "iSecUi_password", 0 ); |
1686 { |
1521 RDebug::Print( iSecUi_password ); |
1687 // … - add data that cover ui is interested in |
1522 delete iSecQueryUi; |
1688 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui |
1523 RDEBUG( "queryAccepted", queryAccepted ); |
1689 covercl->BufStream().CommitL(); // no more data to send so commit buf |
1524 if ( queryAccepted!=KErrNone ) |
1690 } |
1525 { |
1691 #endif //__COVER_DISPLAY |
1526 CleanupStack::PopAndDestroy(wait); |
1692 |
1527 RDEBUG( "AbortSecurityCode", 0 ); |
1693 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1528 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); |
1694 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1529 RDEBUG( "AbortSecurityCode", 1 ); |
1695 res = wait->WaitForRequestL(); |
1530 |
1696 User::LeaveIfError(res); |
1531 return KErrCancel; |
1697 |
1532 } |
1698 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
1533 RDEBUG( "VerifySecurityCode", 0 ); |
1699 res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY); |
1534 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, iSecUi_password, required_fourth); |
1700 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1535 RDEBUG( "WaitForRequestL", 0 ); |
1701 { |
|
1702 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1703 res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); |
|
1704 CleanupStack::PopAndDestroy(queryPrompt); |
|
1705 } |
|
1706 else |
|
1707 { |
|
1708 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); |
|
1709 res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); |
|
1710 CleanupStack::PopAndDestroy(queryPrompt); |
|
1711 } |
|
1712 |
|
1713 |
|
1714 if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1715 { |
|
1716 CleanupStack::PopAndDestroy(wait); |
|
1717 return KErrCancel; |
|
1718 } |
|
1719 } |
|
1720 else |
|
1721 { |
|
1722 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
1723 #ifdef __COVER_DISPLAY |
|
1724 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1725 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1726 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1727 { |
|
1728 // … - add data that cover ui is interested in |
|
1729 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui |
|
1730 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1731 } |
|
1732 #endif //__COVER_DISPLAY |
|
1733 |
|
1734 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1735 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1736 res = wait->WaitForRequestL(); |
|
1737 User::LeaveIfError(res); |
|
1738 |
|
1739 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
1740 CleanupStack::PushL(deviceLockStatusObserver); |
|
1741 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
|
1742 CleanupStack::PushL(queryStatusObserver); |
|
1743 |
|
1744 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
1745 res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY); |
|
1746 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1747 { |
|
1748 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1749 res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
|
1750 CleanupStack::PopAndDestroy(queryPrompt); |
|
1751 } |
|
1752 else |
|
1753 { |
|
1754 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); |
|
1755 res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
|
1756 CleanupStack::PopAndDestroy(queryPrompt); |
|
1757 } |
|
1758 |
|
1759 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
|
1760 iSecurityDlg = NULL; |
|
1761 if( !res || (res == ESecUiDeviceLocked)) |
|
1762 { |
|
1763 // cancel code request |
|
1764 CleanupStack::PopAndDestroy(wait); |
|
1765 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); |
|
1766 return KErrCancel; |
|
1767 } |
|
1768 } |
|
1769 |
|
1770 #if defined(_DEBUG) |
|
1771 RDebug::Print(_L("CSecurityNotifier::UPinRequiredL()VerifySecurityCode")); |
|
1772 #endif |
|
1773 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); |
|
1774 res = wait->WaitForRequestL(); |
1536 res = wait->WaitForRequestL(); |
|
1537 RDEBUG( "WaitForRequestL res", res ); |
1775 CleanupStack::PopAndDestroy(wait); |
1538 CleanupStack::PopAndDestroy(wait); |
1776 #if defined(_DEBUG) |
1539 |
1777 RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL() VerifySecurityCode STATUS: %d"), res); |
|
1778 #endif |
|
1779 TInt returnValue = res; |
1540 TInt returnValue = res; |
1780 switch(res) |
1541 switch(res) |
1781 { |
1542 { |
1782 case KErrNone: |
1543 case KErrNone: |
1783 // code approved |
1544 // code approved |
1846 TBool StartUp(ETrue); |
1606 TBool StartUp(ETrue); |
1847 StartUp = iStartup; |
1607 StartUp = iStartup; |
1848 |
1608 |
1849 TInt res(KErrNone); |
1609 TInt res(KErrNone); |
1850 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1610 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1611 RDEBUG( "GetSecurityCodeInfo", 0 ); |
1851 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1612 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
|
1613 RDEBUG( "WaitForRequestL", 0 ); |
1852 res = wait->WaitForRequestL(); |
1614 res = wait->WaitForRequestL(); |
|
1615 RDEBUG( "WaitForRequestL res", res ); |
1853 User::LeaveIfError(res); |
1616 User::LeaveIfError(res); |
1854 //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog |
1617 //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog |
1855 if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
1618 if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
1856 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1619 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1857 |
1620 |
1858 // ask UPUK code |
1621 // ask UPUK code |
1859 iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); |
1622 /* request PIN using QT */ |
1860 if(AknLayoutUtils::PenEnabled()) |
1623 { |
1861 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1624 CSecQueryUi *iSecQueryUi; |
1862 else |
1625 RDEBUG( "CSecQueryUi", 0 ); |
1863 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1626 iSecQueryUi = CSecQueryUi::NewL(); |
1864 #ifdef __COVER_DISPLAY |
1627 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1865 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
1628 // TODO also support Emergency |
1866 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
1629 |
1867 if (covercl) // returns null if __COVER_DISPLAY is not defined |
1630 TBuf<0x100> title; title.Zero(); title.Append(_L("Pin1RequiredL")); title.Append(_L("#")); title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1868 { |
1631 queryAccepted = iSecQueryUi->SecQueryDialog( title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); |
1869 // … - add data that cover ui is interested in |
1632 RDEBUG( "iSecUi_password", 0 ); |
1870 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPUK);// adds int to additional data to be posted to cover ui |
1633 RDebug::Print( iSecUi_password ); |
1871 covercl->BufStream().CommitL(); // no more data to send so commit buf |
1634 delete iSecQueryUi; |
1872 } |
1635 RDEBUG( "queryAccepted", queryAccepted ); |
1873 #endif //__COVER_DISPLAY |
|
1874 |
1636 |
1875 |
1637 if( queryAccepted!=KErrNone ) |
1876 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) |
|
1877 res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY); |
|
1878 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1879 { |
|
1880 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1881 res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); |
|
1882 CleanupStack::PopAndDestroy(queryPrompt); |
|
1883 } |
|
1884 else |
|
1885 { |
|
1886 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPUK_ATTEMPT); |
|
1887 res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); |
|
1888 CleanupStack::PopAndDestroy(queryPrompt); |
|
1889 } |
|
1890 |
|
1891 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1892 { |
1638 { |
1893 CleanupStack::PopAndDestroy(wait); |
1639 CleanupStack::PopAndDestroy(wait); |
1894 return KErrCancel; |
1640 return KErrCancel; |
1895 } |
1641 } |
1896 |
1642 } |
1897 RMobilePhone::TMobilePassword verifcationPassword; |
1643 |
1898 // new upin code query |
1644 { |
1899 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
1645 /* request PIN using QT */ |
1900 if(AknLayoutUtils::PenEnabled()) |
1646 CSecQueryUi *iSecQueryUi; |
1901 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1647 RDEBUG( "CSecQueryUi", 0 ); |
1902 else |
1648 iSecQueryUi = CSecQueryUi::NewL(); |
1903 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1649 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
1904 res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); |
1650 // TODO also support Emergency |
1905 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
1651 |
|
1652 queryAccepted = iSecQueryUi->SecQueryDialog( _L("UPuk-New|UPuk-Verif"), aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported | ESecUiPukRequired ); |
|
1653 RDEBUG( "aNewPassword", 0 ); |
|
1654 RDebug::Print( aNewPassword ); |
|
1655 delete iSecQueryUi; |
|
1656 RDEBUG( "queryAccepted", queryAccepted ); |
|
1657 if( queryAccepted!=KErrNone ) |
1906 { |
1658 { |
1907 CleanupStack::PopAndDestroy(wait); |
1659 CleanupStack::PopAndDestroy(wait); |
1908 return KErrCancel; |
1660 return KErrCancel; |
1909 } |
1661 } |
1910 |
1662 } |
1911 // verification code query |
1663 |
1912 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1913 if(AknLayoutUtils::PenEnabled()) |
|
1914 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1915 else |
|
1916 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1917 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); |
|
1918 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1919 { |
|
1920 CleanupStack::PopAndDestroy(wait); |
|
1921 return KErrCancel; |
|
1922 } |
|
1923 |
|
1924 while (aNewPassword.CompareF(verifcationPassword) != 0) |
|
1925 { |
|
1926 // codes do not match -> note -> ask new upin and verification codes again |
|
1927 CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
1928 |
|
1929 verifcationPassword = _L(""); |
|
1930 aNewPassword = _L(""); |
|
1931 |
|
1932 // new upin code query |
|
1933 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1934 if(AknLayoutUtils::PenEnabled()) |
|
1935 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1936 else |
|
1937 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1938 res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); |
|
1939 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1940 { |
|
1941 CleanupStack::PopAndDestroy(wait); |
|
1942 return KErrCancel; |
|
1943 } |
|
1944 |
|
1945 // verification code query |
|
1946 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1947 if(AknLayoutUtils::PenEnabled()) |
|
1948 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1949 else |
|
1950 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1951 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); |
|
1952 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1953 { |
|
1954 CleanupStack::PopAndDestroy(wait); |
|
1955 return KErrCancel; |
|
1956 } |
|
1957 } |
|
1958 |
|
1959 // send code |
1664 // send code |
1960 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); |
1665 RDEBUG( "VerifySecurityCode", 0 ); |
|
1666 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,iSecUi_password); |
|
1667 RDEBUG( "WaitForRequestL", 0 ); |
1961 res = wait->WaitForRequestL(); |
1668 res = wait->WaitForRequestL(); |
|
1669 RDEBUG( "WaitForRequestL res", res ); |
1962 CleanupStack::PopAndDestroy(wait); |
1670 CleanupStack::PopAndDestroy(wait); |
1963 |
1671 |
1964 TInt returnValue = res; |
1672 TInt returnValue = res; |
1965 switch(res) |
1673 switch(res) |
1966 { |
1674 { |