|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 |
|
17 |
|
18 //INCLUDES |
|
19 #include "cmmsecuritytsy.h" |
|
20 #include "cmmphonetsy.h" |
|
21 #include "cmmtsyreqhandlestore.h" |
|
22 #include <ctsy/pluginapi/cmmdatapackage.h> |
|
23 #include "cmmmessagemanagerbase.h" |
|
24 #include "cmmphoneextinterface.h" |
|
25 #include "CMmCommonStaticUtility.h" |
|
26 #include "CMmCustomSecurityTsy.h" |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 CMmSecurityTsy* CMmSecurityTsy::NewL( |
|
31 CMmPhoneTsy* aPhoneTsy ) // Ptr to PhoneTsy |
|
32 { |
|
33 TFLOGSTRING("TSY: CMmSecurityTsy::NewL"); |
|
34 CMmSecurityTsy* const mmSecurityTsy = new ( ELeave ) CMmSecurityTsy(); |
|
35 CleanupStack::PushL( mmSecurityTsy ); |
|
36 mmSecurityTsy->iMmPhoneTsy = aPhoneTsy; |
|
37 mmSecurityTsy->ConstructL(); |
|
38 CleanupStack::Pop( mmSecurityTsy ); |
|
39 |
|
40 return mmSecurityTsy; |
|
41 } |
|
42 |
|
43 CMmSecurityTsy::CMmSecurityTsy() |
|
44 { |
|
45 } |
|
46 |
|
47 void CMmSecurityTsy::ConstructL() |
|
48 { |
|
49 TFLOGSTRING("TSY: CMmSecurityTsy::ConstructL"); |
|
50 // Is security codes (PIN and phone password) checked in boot |
|
51 iSecurityCheckedForBoot = EFalse; |
|
52 |
|
53 // information to know is PIN1 or PIN2 last requested |
|
54 iLastPinRequested = EPinUnknown; |
|
55 |
|
56 // Is TSY storing ntofication for "Lock if SIM changed" in boot |
|
57 iIsSecurityCodeRequestCachedInBoot = EFalse; |
|
58 |
|
59 // Is PIN1 disable supported, by default ETrue. Changed when SIM |
|
60 // Service Table is read and it does not support PIN1 disable. |
|
61 iPin1DisableSupported = ETrue; |
|
62 |
|
63 // Set lock setting to unknown |
|
64 iLockSetting = RMobilePhone::ELockSetUnknown; |
|
65 |
|
66 //Set iPhonePasswordVerify to EFalse |
|
67 iPhonePasswordVerify = EFalse; |
|
68 |
|
69 //Set change UPIN state to idle |
|
70 iActiveCodeToUpinState = EActiveCodeToUpinIdle; |
|
71 } |
|
72 |
|
73 CMmSecurityTsy::~CMmSecurityTsy() |
|
74 { |
|
75 TFLOGSTRING("TSY: CMmSecurityTsy::~CMmSecurityTsy"); |
|
76 } |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // CMmSecurityTsy::DoExtFunc |
|
80 // Security-specific functionality of CMmPhoneTsy::DoExtFuncL |
|
81 // (other items were commented in a header). |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 TInt CMmSecurityTsy::DoExtFuncL( |
|
85 const TTsyReqHandle aTsyReqHandle, |
|
86 const TInt aIpc, |
|
87 const TDataPackage& aPackage ) |
|
88 { |
|
89 TFLOGSTRING3("TSY: CMmSecurityTsy::DoExtFuncL.\n \t\t\t IPC:%d\n \t\t\t Handle:%d", aIpc, aTsyReqHandle); |
|
90 |
|
91 TInt ret ( KErrNone ); |
|
92 |
|
93 TAny* dataPtr = aPackage.Ptr1(); |
|
94 |
|
95 switch ( aIpc ) |
|
96 { |
|
97 // Get Security Capabilities |
|
98 case EMobilePhoneGetSecurityCaps: |
|
99 ret = GetSecurityCaps( aTsyReqHandle, |
|
100 REINTERPRET_CAST( TUint32*, dataPtr ) ); |
|
101 break; |
|
102 // Notify Change of Security Capabilities |
|
103 case EMobilePhoneNotifySecurityCapsChange: |
|
104 ret = NotifySecurityCapsChange( |
|
105 REINTERPRET_CAST( TUint32*, dataPtr ) ); |
|
106 break; |
|
107 case EMobilePhoneGetLockInfo: |
|
108 ret = GetLockInfoL( aPackage ); |
|
109 break; |
|
110 // Notify Change of Lock Information |
|
111 case EMobilePhoneNotifyLockInfoChange: |
|
112 ret = NotifyLockInfoChange( |
|
113 REINTERPRET_CAST( RMobilePhone::TMobilePhoneLock*, dataPtr ), |
|
114 aPackage.Des2n() ); |
|
115 break; |
|
116 // Set Lock Setting |
|
117 case EMobilePhoneSetLockSetting: |
|
118 ret = SetLockSettingL( aTsyReqHandle, |
|
119 aPackage ); |
|
120 break; |
|
121 // Change Security Code |
|
122 case EMobilePhoneChangeSecurityCode: |
|
123 ret = ChangeSecurityCodeL( aTsyReqHandle, aPackage ); |
|
124 break; |
|
125 // Notify Security Event |
|
126 case EMobilePhoneNotifySecurityEvent: |
|
127 ret = NotifySecurityEventL( |
|
128 REINTERPRET_CAST( RMobilePhone::TMobilePhoneSecurityEvent*, |
|
129 dataPtr ) ); |
|
130 break; |
|
131 // Verify Security Code |
|
132 case EMobilePhoneVerifySecurityCode: |
|
133 ret = VerifySecurityCodeL( aTsyReqHandle, aPackage ); |
|
134 break; |
|
135 // Abort Security Code |
|
136 case EMobilePhoneAbortSecurityCode: |
|
137 ret = AbortSecurityCodeL( aTsyReqHandle, aPackage ); |
|
138 break; |
|
139 case EMobilePhoneGetSecurityCodeInfo: |
|
140 ret = GetSecurityCodeInfoL( aTsyReqHandle, REINTERPRET_CAST( |
|
141 RMobilePhone::TMobilePhoneSecurityCode*, dataPtr ), |
|
142 aPackage.Des2n() ); |
|
143 break; |
|
144 case EMobilePhoneNotifySecurityCodeInfoChange: |
|
145 ret = NotifySecurityCodeInfoChange( REINTERPRET_CAST( |
|
146 RMobilePhone::TMobilePhoneSecurityCode*, dataPtr ), |
|
147 aPackage.Des2n() ); |
|
148 break; |
|
149 default: |
|
150 ret = KErrNotSupported; |
|
151 break; |
|
152 } |
|
153 |
|
154 return ret; |
|
155 } |
|
156 |
|
157 // --------------------------------------------------------------------------- |
|
158 // CMmSecurityTsy::CancelService |
|
159 // Cancels Security requests |
|
160 // (other items were commented in a header). |
|
161 // --------------------------------------------------------------------------- |
|
162 // |
|
163 TInt CMmSecurityTsy::CancelService( |
|
164 const TInt aIpc, |
|
165 const TTsyReqHandle aTsyReqHandle ) |
|
166 { |
|
167 TInt ret ( KErrNotSupported ); |
|
168 |
|
169 //When the clients close their sub-sessions (eg. by calling RLine::Close), |
|
170 //they may not have cancelled all their outstanding asynchronous requests |
|
171 //before closing. It is up to the ETel server to clean up in this |
|
172 //situation, so the server will find the list of outstanding requests |
|
173 //related to that sub-session object and pass these outstanding IPC |
|
174 //request numbers, one at a time, to the CancelService method in the TSY. |
|
175 |
|
176 switch ( aIpc ) |
|
177 { |
|
178 case EMobilePhoneNotifySecurityCapsChange: |
|
179 ret = NotifySecurityCapsChangeCancel( aTsyReqHandle ); |
|
180 break; |
|
181 case EMobilePhoneGetLockInfo: |
|
182 ret = GetLockInfoCancel ( aTsyReqHandle ); |
|
183 break; |
|
184 case EMobilePhoneSetLockSetting: |
|
185 ret = SetLockSettingCancel( aTsyReqHandle ); |
|
186 break; |
|
187 case EMobilePhoneNotifyLockInfoChange: |
|
188 ret = NotifyLockInfoChangeCancel( aTsyReqHandle ); |
|
189 break; |
|
190 case EMobilePhoneNotifySecurityEvent: |
|
191 ret = NotifySecurityEventCancel( aTsyReqHandle ); |
|
192 break; |
|
193 case EMobilePhoneGetSecurityCodeInfo: |
|
194 ret = GetSecurityCodeInfoCancel( aTsyReqHandle ); |
|
195 break; |
|
196 case EMobilePhoneNotifySecurityCodeInfoChange: |
|
197 ret = NotifySecurityCodeInfoChangeCancel( aTsyReqHandle ); |
|
198 break; |
|
199 //Default case |
|
200 default: |
|
201 ret = KErrNone; |
|
202 break; |
|
203 } |
|
204 |
|
205 return ret; |
|
206 } |
|
207 |
|
208 // --------------------------------------------------------------------------- |
|
209 // CMmSecurityTsy::GetSecurityCaps |
|
210 // returns a snapshot of the combination of the |
|
211 // static and dynamic security capabilities of the phone. |
|
212 // (other items were commented in a header). |
|
213 // --------------------------------------------------------------------------- |
|
214 // |
|
215 TInt CMmSecurityTsy::GetSecurityCaps( |
|
216 const TTsyReqHandle aTsyReqHandle, |
|
217 TUint32* aCaps ) |
|
218 { |
|
219 |
|
220 TInt ret ( KErrAccessDenied ); |
|
221 ret = iMmPhoneTsy->iMmPhoneExtInterface->GetSecurityCaps( aCaps ); |
|
222 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, ret ); |
|
223 |
|
224 return KErrNone; |
|
225 } |
|
226 |
|
227 // --------------------------------------------------------------------------- |
|
228 // CMmSecurityTsy::NotifySecurityCapsChange |
|
229 // This request allows a client to be notified when the phone's |
|
230 // security capabilities change |
|
231 // (other items were commented in a header). |
|
232 // --------------------------------------------------------------------------- |
|
233 // |
|
234 TInt CMmSecurityTsy::NotifySecurityCapsChange( |
|
235 TUint32* aCaps ) |
|
236 { |
|
237 iRetNotifySecurityCapsChange = aCaps; |
|
238 iMmPhoneTsy->iReqHandleType = |
|
239 CMmPhoneTsy::EMultimodePhoneNotifySecurityCapsChange; |
|
240 |
|
241 return KErrNone; |
|
242 } |
|
243 // --------------------------------------------------------------------------- |
|
244 // CMmSecurityTsy::NotifySecurityCapsChangeCancel |
|
245 // This method cancels an outstanding asynchronous |
|
246 // NotifySecurityCapsChange request. |
|
247 // (other items were commented in a header). |
|
248 // --------------------------------------------------------------------------- |
|
249 // |
|
250 TInt CMmSecurityTsy::NotifySecurityCapsChangeCancel( |
|
251 const TTsyReqHandle aTsyReqHandle ) |
|
252 { |
|
253 iRetNotifySecurityCapsChange = NULL; |
|
254 |
|
255 iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( |
|
256 CMmPhoneTsy::EMultimodePhoneNotifySecurityCapsChange ); |
|
257 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
258 |
|
259 return KErrNone; |
|
260 } |
|
261 |
|
262 // --------------------------------------------------------------------------- |
|
263 // CMmSecurityTsy::CompleteNotifySecurityCapsChange |
|
264 // This method completes an outstanding asynchronous |
|
265 // NotifySecurityCapsChange request. |
|
266 // (other items were commented in a header). |
|
267 // --------------------------------------------------------------------------- |
|
268 // |
|
269 TInt CMmSecurityTsy::CompleteNotifySecurityCapsChange( |
|
270 TUint32 aCaps ) |
|
271 { |
|
272 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
273 ResetTsyReqHandle( |
|
274 CMmPhoneTsy::EMultimodePhoneNotifySecurityCapsChange ); |
|
275 |
|
276 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
277 { |
|
278 *iRetNotifySecurityCapsChange = aCaps; |
|
279 iMmPhoneTsy->ReqCompleted( reqHandle, KErrNone ); |
|
280 } |
|
281 |
|
282 return KErrNone; |
|
283 } |
|
284 |
|
285 // --------------------------------------------------------------------------- |
|
286 // CMmSecurityTsy::GetLockInfoL |
|
287 // This method retrieves the current status and setting of a lock. |
|
288 // (other items were commented in a header). |
|
289 // --------------------------------------------------------------------------- |
|
290 // |
|
291 TInt CMmSecurityTsy::GetLockInfoL( const TDataPackage& aPackage ) |
|
292 { |
|
293 TFLOGSTRING("LTSY: CMmSecurityTsy::GetLockInfoL - Client call"); |
|
294 |
|
295 TInt ret ( KErrArgument ); |
|
296 |
|
297 TDes8* data = reinterpret_cast<TDes8*> ( aPackage.Des2n() ); |
|
298 |
|
299 if ( sizeof ( RMobilePhone::TMobilePhoneLockInfoV1 ) <= |
|
300 data->MaxLength() ) |
|
301 { |
|
302 //save pointer to client side for completion |
|
303 iRetGetLockInfo = data; |
|
304 |
|
305 ret = iMmPhoneTsy->iMmPhoneExtInterface->GetLockInfoL( aPackage ); |
|
306 |
|
307 if ( KErrNone == ret ) |
|
308 { |
|
309 //save req handle type |
|
310 iMmPhoneTsy->iReqHandleType = |
|
311 CMmPhoneTsy::EMultimodePhoneGetLockInfo; |
|
312 } |
|
313 } |
|
314 |
|
315 return ret; |
|
316 } |
|
317 |
|
318 // --------------------------------------------------------------------------- |
|
319 // CMmSecurityTsy::NotifyLockInfoChange |
|
320 // This method allows a client to be notified when any part of |
|
321 // the lock information changes. |
|
322 // (other items were commented in a header). |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 TInt CMmSecurityTsy::NotifyLockInfoChange( |
|
326 RMobilePhone::TMobilePhoneLock* aLock, |
|
327 TDes8* aLockInfo ) |
|
328 { |
|
329 TFLOGSTRING2("LTSY: CMmSecurityTsy::NotifyLockInfoChange - Lock: %d", aLock); |
|
330 |
|
331 TInt ret( KErrNone ); |
|
332 |
|
333 if ( sizeof ( RMobilePhone::TMobilePhoneLockInfoV1 ) <= |
|
334 aLockInfo->MaxLength() ) |
|
335 { |
|
336 iRetNotifyLockInfoChange = aLockInfo; |
|
337 iRetNotifyPhoneLockChange = aLock; |
|
338 |
|
339 //save tsy req handle type |
|
340 iMmPhoneTsy->iReqHandleType = |
|
341 CMmPhoneTsy::EMultimodePhoneNotifyLockInfoChange; |
|
342 } |
|
343 else |
|
344 { |
|
345 ret = KErrArgument; |
|
346 } |
|
347 return ret; |
|
348 } |
|
349 |
|
350 // --------------------------------------------------------------------------- |
|
351 // CMmSecurityTsy::NotifyLockInfoChangeCancel |
|
352 // This method cancels an outstanding asynchronous |
|
353 // NotifyLockInfoChange request |
|
354 // (other items were commented in a header). |
|
355 // --------------------------------------------------------------------------- |
|
356 // |
|
357 TInt CMmSecurityTsy::NotifyLockInfoChangeCancel( |
|
358 const TTsyReqHandle aTsyReqHandle ) |
|
359 { |
|
360 TFLOGSTRING("LTSY: CMmSecurityTsy::NotifyLockInfoChangeCancel"); |
|
361 |
|
362 iRetNotifyLockInfoChange = NULL; |
|
363 iRetNotifyPhoneLockChange = NULL; |
|
364 |
|
365 iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( |
|
366 CMmPhoneTsy::EMultimodePhoneNotifyLockInfoChange ); |
|
367 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
368 |
|
369 return KErrNone; |
|
370 } |
|
371 |
|
372 // --------------------------------------------------------------------------- |
|
373 // CMmSecurityTsy::CompleteNotifyLockInfoChange |
|
374 // This method completes an outstanding asynchronous |
|
375 // NotifyLockInfoChange request. |
|
376 // (other items were commented in a header). |
|
377 // --------------------------------------------------------------------------- |
|
378 // |
|
379 void CMmSecurityTsy::CompleteNotifyLockInfoChange( |
|
380 CMmDataPackage* aDataPackage, TInt aErrorCode ) |
|
381 { |
|
382 |
|
383 //reset req handle. Returns the deleted req handle |
|
384 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
385 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneNotifyLockInfoChange ); |
|
386 |
|
387 if (KErrNone != aErrorCode) |
|
388 { |
|
389 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
390 return; |
|
391 } |
|
392 |
|
393 RMobilePhone::TMobilePhoneLock* lock = NULL; |
|
394 RMobilePhone::TMobilePhoneLockInfoV1* lockInfo = NULL; |
|
395 aDataPackage->UnPackData( &lockInfo, &lock ); |
|
396 |
|
397 //update the status of the lock in the extension |
|
398 iMmPhoneTsy->iMmPhoneExtInterface->UpdateLockInfo( lockInfo->iStatus, |
|
399 lockInfo->iSetting, *lock ); |
|
400 |
|
401 |
|
402 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
403 { |
|
404 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg( *lockInfo ); |
|
405 |
|
406 *iRetNotifyLockInfoChange = lockInfoPckg; |
|
407 *iRetNotifyPhoneLockChange = *lock; |
|
408 |
|
409 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
410 } |
|
411 } |
|
412 |
|
413 // --------------------------------------------------------------------------- |
|
414 // CMmSecurityTsy::SetLockSettingL |
|
415 // This function prevents some other client to set lock setting |
|
416 // while previous process is still going on because of password query from |
|
417 // the client. If process in question is still going function then the request |
|
418 // complete with error code KErrServerBusy. Some lock settings requires |
|
419 // code verification. This method will call CompleteNotifySecurityEvent with |
|
420 // required even in each case.(other items were commented in a header). |
|
421 // --------------------------------------------------------------------------- |
|
422 // |
|
423 TInt CMmSecurityTsy::SetLockSettingL( |
|
424 const TTsyReqHandle aTsyReqHandle, |
|
425 const TDataPackage& aPackage ) |
|
426 { |
|
427 TFLOGSTRING("LTSY: CMmSecurityTsy::SetLockSettingL - Client call" ); |
|
428 |
|
429 TInt ret( KErrNone ); |
|
430 |
|
431 // Check if request handle already exists |
|
432 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
433 GetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
434 |
|
435 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
436 { |
|
437 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
438 } |
|
439 else |
|
440 { |
|
441 ret = LockSettingL( aTsyReqHandle, aPackage ); |
|
442 // if error is other than KErrAccessDenied or KErrNone, complete now |
|
443 // KErrAccessDenied means we need verification first, not that an |
|
444 // error has occured and we ought to complete the request. |
|
445 // KErrNone means that EMobilePhoneSetLockSetting request has been |
|
446 // successfully sent to LTSY. |
|
447 if ( !( KErrNone == ret || KErrAccessDenied == ret ) ) |
|
448 { |
|
449 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, ret ); |
|
450 } |
|
451 } |
|
452 return KErrNone; |
|
453 } |
|
454 |
|
455 // --------------------------------------------------------------------------- |
|
456 // CMmSecurityTsy::SetLockSettingCancel |
|
457 // Use this method to cancel a previously placed asynchronous |
|
458 // SetLockSetting request |
|
459 // (other items were commented in a header). |
|
460 // --------------------------------------------------------------------------- |
|
461 // |
|
462 TInt CMmSecurityTsy::SetLockSettingCancel( |
|
463 TTsyReqHandle aTsyReqHandle ) |
|
464 { |
|
465 iActiveCodeToUpinState = EActiveCodeToUpinIdle; |
|
466 |
|
467 //reset the req handle |
|
468 iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( |
|
469 CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
470 |
|
471 //complete with cancel |
|
472 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
473 |
|
474 return KErrNone; |
|
475 } |
|
476 |
|
477 // --------------------------------------------------------------------------- |
|
478 // CMmSecurityTsy::LockSettingL |
|
479 // This method allows a client to change the current setting of |
|
480 // a lock. If password is required, function triggers completion of |
|
481 // security event notification and stores required variables for possible |
|
482 // retry. Other possible errors are reported to client as well |
|
483 // (other items were commented in a header). |
|
484 // --------------------------------------------------------------------------- |
|
485 // |
|
486 TInt CMmSecurityTsy::LockSettingL( |
|
487 const TTsyReqHandle, |
|
488 const TDataPackage& aPackage ) |
|
489 { |
|
490 TInt ret ( KErrNotSupported ); |
|
491 |
|
492 RMobilePhone::TMobilePhoneLock* lock = |
|
493 reinterpret_cast<RMobilePhone::TMobilePhoneLock* > |
|
494 ( aPackage.Ptr1() ); |
|
495 RMobilePhone::TMobilePhoneLockSetting* setting = |
|
496 reinterpret_cast<RMobilePhone::TMobilePhoneLockSetting* > |
|
497 ( aPackage.Ptr2() ); |
|
498 |
|
499 TFLOGSTRING3("LTSY: CMmSecurityTsy::LockSetting - Lock:%d, Setting:%d", |
|
500 *lock, *setting ); |
|
501 |
|
502 // Some SIM cards might not support PIN1 disable. Thus |
|
503 // return error if client tries to disable it. |
|
504 // complete the request immediately with error. |
|
505 if ( ( RMobilePhone::ELockSetDisabled == *setting ) && |
|
506 ( RMobilePhone::ELockICC == *lock || |
|
507 RMobilePhone::ELockUniversalPin == *lock ) && |
|
508 !iPin1DisableSupported ) |
|
509 { |
|
510 // Operation is not allowed as SIM does not support changing |
|
511 // SIM from ON to OFF. |
|
512 ret = KErrGsm0707OperationNotAllowed; |
|
513 } |
|
514 else |
|
515 { |
|
516 //check if the request made is an state change attempt |
|
517 if ( RMobilePhone::ELockSetUnknown != *setting ) |
|
518 { |
|
519 //check if the lock to be set requires previous verification |
|
520 RMobilePhone::TMobilePhoneSecurityEvent event ( |
|
521 RMobilePhone::ENoICCFound ); |
|
522 //be pesimistic |
|
523 ret = KErrAccessDenied; |
|
524 |
|
525 //Check the lock to be set |
|
526 switch ( *lock ) |
|
527 { |
|
528 case RMobilePhone::ELockPhoneDevice: |
|
529 case RMobilePhone::ELockPhoneToICC: |
|
530 event = RMobilePhone::EPhonePasswordRequired; |
|
531 break; |
|
532 case RMobilePhone::ELockICC: |
|
533 event = RMobilePhone::EPin1Required; |
|
534 break; |
|
535 // In USIM cards disabling PIN2 is also allowed |
|
536 case RMobilePhone::ELockPin2: |
|
537 event = RMobilePhone::EPin2Required; |
|
538 break; |
|
539 case RMobilePhone::ELockUniversalPin: |
|
540 // This is here to prompt PIN query in case of replacing |
|
541 // PIN1 with UPIN |
|
542 event = RMobilePhone::EUniversalPinRequired; |
|
543 if ( RMobilePhone::ELockReplaced == *setting ) |
|
544 { |
|
545 TFLOGSTRING("TSY: CMmSecurityTsy::LockSetting RMobilePhone::ELockReplaced"); |
|
546 iActiveCodeToUpinState = EActiveCodeToUpinAskUpin; |
|
547 } |
|
548 break; |
|
549 // This setting is not supported |
|
550 case RMobilePhone::ELockPhoneToFirstICC: |
|
551 ret = KErrNotSupported; |
|
552 break; |
|
553 |
|
554 case RMobilePhone::ELockOTA: |
|
555 case RMobilePhone::ELockHiddenKey: |
|
556 case RMobilePhone::ELockUSimApp: |
|
557 case RMobilePhone::ELockSecondUSimApp: |
|
558 default: |
|
559 //other locks are not a problem |
|
560 ret = KErrNone; |
|
561 break; |
|
562 } |
|
563 //if the access is denied, notify the client about |
|
564 //the security event |
|
565 if ( KErrAccessDenied == ret ) |
|
566 { |
|
567 CompleteNotifySecurityEventL( event, KErrNone ); |
|
568 // Store these for the retry once the |
|
569 //VerifySecurityCode is issued by client |
|
570 iLockSettingPhoneLock = *lock; |
|
571 iLockSetting = *setting; |
|
572 //the setLockSetting is ongoing |
|
573 iMmPhoneTsy->iReqHandleType = |
|
574 CMmPhoneTsy::EMultimodePhoneSetLockSetting; |
|
575 } |
|
576 //Check if the lock can be set directly |
|
577 else if ( KErrNone == ret ) |
|
578 { |
|
579 CMmDataPackage dataPackage; |
|
580 dataPackage.SetPacketData ( &aPackage ); |
|
581 iMmPhoneTsy->iMmPhoneExtInterface-> |
|
582 SetLockSettingL( &dataPackage ); |
|
583 //the SetLockSetting is ongoing |
|
584 iMmPhoneTsy->iReqHandleType = |
|
585 CMmPhoneTsy::EMultimodePhoneSetLockSetting; |
|
586 } |
|
587 } |
|
588 |
|
589 } |
|
590 |
|
591 return ret; |
|
592 } |
|
593 |
|
594 // --------------------------------------------------------------------------- |
|
595 // CMmSecurityTsy::CompleteSetLockSetting |
|
596 // This method completes either an outstanding asynchronous |
|
597 // SimPinEnable or SetLockSetting request. |
|
598 // (other items were commented in a header). |
|
599 // --------------------------------------------------------------------------- |
|
600 // |
|
601 void CMmSecurityTsy::CompleteSetLockSetting( |
|
602 TInt aErrorCode, //Error code |
|
603 RMobilePhone::TMobilePhoneLockStatus, |
|
604 RMobilePhone::TMobilePhoneLockSetting ) |
|
605 { |
|
606 TFLOGSTRING2("LTSY: CMmSecurityTsy::CompleteSetLockSetting - Error:%d", aErrorCode); |
|
607 |
|
608 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
609 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
610 |
|
611 // Check if handle for set lock setting exists |
|
612 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
613 { |
|
614 iActiveCodeToUpinState = EActiveCodeToUpinIdle; |
|
615 |
|
616 //If the code verification has been requested complete it too. |
|
617 TTsyReqHandle verifyHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
618 ResetTsyReqHandle( |
|
619 CMmPhoneTsy::EMultimodePhoneVerifySecurityCode ); |
|
620 |
|
621 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != verifyHandle ) |
|
622 { |
|
623 // Change these so that they wont mess up anything. |
|
624 iLockSetting = RMobilePhone::ELockSetUnknown; |
|
625 // Complete verify |
|
626 iMmPhoneTsy->ReqCompleted( verifyHandle, aErrorCode ); |
|
627 } |
|
628 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
629 } |
|
630 } |
|
631 |
|
632 // --------------------------------------------------------------------------- |
|
633 // CMmSecurityTsy::ChangeSecurityCodeL |
|
634 // This method allows a client to change a security code. |
|
635 // (other items were commented in a header). |
|
636 // --------------------------------------------------------------------------- |
|
637 // |
|
638 TInt CMmSecurityTsy::ChangeSecurityCodeL( |
|
639 const TTsyReqHandle aTsyReqHandle, |
|
640 const TDataPackage& aPackage ) |
|
641 { |
|
642 |
|
643 TInt ret = iMmPhoneTsy->iMmPhoneExtInterface-> |
|
644 ChangeSecurityCodeL( aPackage ); |
|
645 |
|
646 if ( KErrNone == ret ) |
|
647 { |
|
648 iMmPhoneTsy->iReqHandleType = |
|
649 CMmPhoneTsy::EMultimodePhoneChangeSecurityCode; |
|
650 } |
|
651 else |
|
652 { |
|
653 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, ret ); |
|
654 } |
|
655 |
|
656 return KErrNone; |
|
657 } |
|
658 |
|
659 // --------------------------------------------------------------------------- |
|
660 // CMmSecurityTsy::CompleteChangeSecurityCode |
|
661 // This method completes an outstanding asynchronous |
|
662 // ChangeSecurityCode request |
|
663 // (other items were commented in a header). |
|
664 // --------------------------------------------------------------------------- |
|
665 // |
|
666 TInt CMmSecurityTsy::CompleteChangeSecurityCode( |
|
667 TInt aErrorCode ) // Error code |
|
668 { |
|
669 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteChangeSecurityCode - Error:%d", aErrorCode); |
|
670 |
|
671 |
|
672 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
673 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneChangeSecurityCode ); |
|
674 |
|
675 if ( reqHandle != CMmPhoneTsy::EMultimodePhoneReqHandleUnknown ) |
|
676 { |
|
677 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
678 } |
|
679 |
|
680 return KErrNone; |
|
681 } |
|
682 |
|
683 // --------------------------------------------------------------------------- |
|
684 // CMmSecurityTsy::NotifySecurityEventL |
|
685 // This method allows a client to be notified when the phone |
|
686 // has detected the occurrence of one of the security related events. |
|
687 // (other items were commented in a header). |
|
688 // --------------------------------------------------------------------------- |
|
689 // |
|
690 TInt CMmSecurityTsy::NotifySecurityEventL( |
|
691 RMobilePhone::TMobilePhoneSecurityEvent* aEvent ) |
|
692 { |
|
693 |
|
694 iRetNotifySecurityEvent = aEvent; |
|
695 |
|
696 iMmPhoneTsy->iReqHandleType = |
|
697 CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent; |
|
698 |
|
699 // If requested after boot, then we need to query security server |
|
700 // state for phone password. If it is enabled, we will not have |
|
701 // security indication as Security server boots up faster than |
|
702 // TSY and has already sent the indications when TSY is loaded. |
|
703 // Thus this is the only way to get the information in boot. |
|
704 if ( iSecurityCheckedForBoot == EFalse ) |
|
705 { |
|
706 TFLOGSTRING( "TSY: CMmSecurityTsy::NotifySecurityEvent - Checking PIN state"); |
|
707 // We can't do anything if sending fails. If this happens, |
|
708 // then every send to IsaApi should fail. |
|
709 (void)iMmPhoneTsy->iMmPhoneExtInterface->GetICCTypeL(); |
|
710 } |
|
711 |
|
712 // If we have cached notification for security code in boot, then |
|
713 // complete it once to client. |
|
714 if ( iIsSecurityCodeRequestCachedInBoot && |
|
715 !iMmPhoneTsy->iBootState.iSecReady ) |
|
716 { |
|
717 TFLOGSTRING( "TSY: CMmSecurityTsy::NotifySecurityEventL - Completing security code event"); |
|
718 |
|
719 CompleteNotifySecurityEventL( RMobilePhone::EPhonePasswordRequired, |
|
720 KErrNone ); |
|
721 iIsSecurityCodeRequestCachedInBoot = EFalse; |
|
722 } |
|
723 |
|
724 return KErrNone; |
|
725 } |
|
726 |
|
727 // --------------------------------------------------------------------------- |
|
728 // CMmSecurityTsy::NotifySecurityEventCancel |
|
729 // This function cancels an outstanding asynchronous |
|
730 // NotifySecurityEvent request. |
|
731 // (other items were commented in a header). |
|
732 // --------------------------------------------------------------------------- |
|
733 // |
|
734 TInt CMmSecurityTsy::NotifySecurityEventCancel( |
|
735 const TTsyReqHandle aTsyReqHandle ) |
|
736 { |
|
737 iRetNotifySecurityEvent = NULL; |
|
738 |
|
739 iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( |
|
740 CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent ); |
|
741 |
|
742 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
743 |
|
744 return KErrNone; |
|
745 } |
|
746 |
|
747 // --------------------------------------------------------------------------- |
|
748 // CMmSecurityTsy::CompleteNotifySecurityEventL |
|
749 // This function completes an outstanding asynchronous |
|
750 // NotifySecurityEvent request. If handle for security event notification |
|
751 // does not exist, it also completes those functions that would otherwise |
|
752 // require the presence of the handle to complete themselves. |
|
753 // (other items were commented in a header). |
|
754 // --------------------------------------------------------------------------- |
|
755 // |
|
756 void CMmSecurityTsy::CompleteNotifySecurityEventL( |
|
757 RMobilePhone::TMobilePhoneSecurityEvent aEvent, |
|
758 TInt aErrorCode ) |
|
759 { |
|
760 TFLOGSTRING3("TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Event: %d, Error: %d", |
|
761 aEvent, aErrorCode ); |
|
762 |
|
763 if ( iLastPinRequested != EPinUnknown && |
|
764 ( RMobilePhone::EPin1Verified == aEvent ) || |
|
765 ( RMobilePhone::EPin2Verified == aEvent ) ) |
|
766 { |
|
767 TFLOGSTRING( "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - iLastPinRequested != EPinUnknown"); |
|
768 iLastPinRequested = EPinUnknown; |
|
769 } |
|
770 |
|
771 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
772 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent ); |
|
773 |
|
774 //Check if handle exists |
|
775 if ( reqHandle != CMmPhoneTsy::EMultimodePhoneReqHandleUnknown ) |
|
776 { |
|
777 // When client is informed about security code state in boot, |
|
778 // then this flag needs to be ETrue. There will be no more checking |
|
779 // later on |
|
780 iSecurityCheckedForBoot = ETrue; |
|
781 |
|
782 // Set value if the result is KErrNone |
|
783 if ( KErrNone == aErrorCode ) |
|
784 { |
|
785 *iRetNotifySecurityEvent = aEvent; |
|
786 } |
|
787 //reset pointer to client side |
|
788 iRetNotifySecurityEvent = NULL; |
|
789 // Complete the client request |
|
790 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
791 } |
|
792 else |
|
793 { |
|
794 // Client has not yet requested this notification, so cache it |
|
795 // if event is for phone password and boot is not yet done. |
|
796 // It is possible that this indication is received before |
|
797 // client has booted up. |
|
798 if ( ( RMobilePhone::EPhonePasswordRequired == aEvent ) && |
|
799 !iMmPhoneTsy->iBootState.iSecReady && |
|
800 !iIsSecurityCodeRequestCachedInBoot ) |
|
801 |
|
802 { |
|
803 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Caching event"); |
|
804 iIsSecurityCodeRequestCachedInBoot = ETrue; |
|
805 } |
|
806 |
|
807 // Check if the event is a PIN2 requirement |
|
808 if ( aEvent == RMobilePhone::EPin2Required ) |
|
809 { |
|
810 // These are the methods that must be completed, if there is no |
|
811 // handle that can be used for informing client about password |
|
812 // verification query. |
|
813 TInt errorCode = CMmCommonStaticUtility::EpocErrorCode( |
|
814 KErrAccessDenied, KErrGsm0707SimPin2Required ); |
|
815 |
|
816 reqHandle = iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
817 CMmPhoneTsy::EMultimodePhoneSetFdnSetting ); |
|
818 // Check if handle for setfdnsetting exists |
|
819 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
820 { |
|
821 iMmPhoneTsy->CompleteSetFdnSettingL( errorCode ); |
|
822 } |
|
823 } |
|
824 // Check if the event is a PIN1 or security code requirement. |
|
825 if ( aEvent == RMobilePhone::EPin1Required || |
|
826 aEvent == RMobilePhone::EPhonePasswordRequired ) |
|
827 { |
|
828 TTsyReqHandle setLockSettingHandle = |
|
829 iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
830 CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
831 // Check if handle for setlocksetting exists. If so, complete |
|
832 // lock setting, because client can not be informed about password |
|
833 // verification requirement without notify security event handle |
|
834 if ( setLockSettingHandle > 0 ) |
|
835 { |
|
836 CompleteSetLockSetting( KErrAccessDenied, |
|
837 RMobilePhone::EStatusLockUnknown, |
|
838 RMobilePhone::ELockSetUnknown ); |
|
839 } |
|
840 } |
|
841 } |
|
842 // Update security capabilities and check if notification completion for |
|
843 // capabilities is required |
|
844 iMmPhoneTsy->iMmPhoneExtInterface->UpdateSecurityCaps( aEvent ); |
|
845 } |
|
846 |
|
847 #ifndef USING_CTSY_DISPATCHER |
|
848 |
|
849 /** |
|
850 * Checks that security codes are well formed. |
|
851 */ |
|
852 TBool CMmSecurityTsy::AreCodesWellFormed( |
|
853 const RMobilePhone::TMobilePhoneSecurityCode& aCodeType, |
|
854 const RMobilePhone::TCodeAndUnblockCode& aCodes ) const |
|
855 { |
|
856 |
|
857 const TUint8 KPukCodeLength(8); |
|
858 const TUint8 KMaxPinCodeLength(8); |
|
859 const TUint8 KMinPinCodeLength(4); |
|
860 |
|
861 switch (aCodeType) |
|
862 { |
|
863 case RMobilePhone::ESecurityCodePuk1: |
|
864 case RMobilePhone::ESecurityCodePuk2: |
|
865 { |
|
866 // |
|
867 // Verify PUK code is well formed according to 3GPP TS 11.11 |
|
868 // (8 numeric digits) |
|
869 // |
|
870 if (aCodes.iUnblockCode.Length() != KPukCodeLength) |
|
871 { |
|
872 return EFalse; |
|
873 } |
|
874 TChar c(0); |
|
875 for (TInt i=0; i<KPukCodeLength; ++i) |
|
876 { |
|
877 c = aCodes.iUnblockCode[i]; |
|
878 if (c < '0' || c > '9' ) |
|
879 return EFalse; |
|
880 } |
|
881 } |
|
882 // |
|
883 // and fall through to verify PIN is well formed too |
|
884 // |
|
885 case RMobilePhone::ESecurityCodePin1: |
|
886 case RMobilePhone::ESecurityCodePin2: |
|
887 { |
|
888 // |
|
889 // Verify PIN code conforms with 3GPP TS 11.11 |
|
890 // (between 4 and 8 numeric digits) |
|
891 // |
|
892 TInt len = aCodes.iCode.Length(); |
|
893 if ( (len < KMinPinCodeLength) || (len > KMaxPinCodeLength) ) |
|
894 return EFalse; |
|
895 TChar c(0); |
|
896 for (TInt i=0; i < len; ++i) |
|
897 { |
|
898 c = aCodes.iCode[i]; |
|
899 if (c < '0' || c > '9' ) |
|
900 return EFalse; |
|
901 } |
|
902 } |
|
903 break; |
|
904 |
|
905 default: |
|
906 // For all other types of code, check should happen in the LTSY. |
|
907 // Returning ETrue will ensure request goes on to LTSY. |
|
908 break; |
|
909 } |
|
910 |
|
911 return ETrue; |
|
912 } |
|
913 |
|
914 // --------------------------------------------------------------------------- |
|
915 // CMmSecurityTsy::VerifySecurityCodeL |
|
916 // This method sends a security code requiring verification to |
|
917 // the phone. If code is required for lock setting, it sends it to the |
|
918 // extension and orders re-execution of SetLockSetting function. |
|
919 // (other items were commented in a header). |
|
920 // --------------------------------------------------------------------------- |
|
921 // |
|
922 TInt CMmSecurityTsy::VerifySecurityCodeL( |
|
923 const TTsyReqHandle aTsyReqHandle, |
|
924 const TDataPackage& aPackage ) |
|
925 { |
|
926 |
|
927 RMobilePhone::TMobilePhoneSecurityCode* type = |
|
928 reinterpret_cast<RMobilePhone::TMobilePhoneSecurityCode*> |
|
929 ( aPackage.Ptr1() ); |
|
930 RMobilePhone::TCodeAndUnblockCode* codes = |
|
931 reinterpret_cast<RMobilePhone::TCodeAndUnblockCode*> |
|
932 ( aPackage.Ptr2() ); |
|
933 |
|
934 // Get request handle to check whether server is busy with previous |
|
935 // request |
|
936 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
937 GetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneVerifySecurityCode ); |
|
938 |
|
939 if ( 0 < reqHandle ) |
|
940 { |
|
941 //The request is already in processing because of previous request |
|
942 //Complete request with status value informing the client about |
|
943 //the situation. |
|
944 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrServerBusy ); |
|
945 } |
|
946 else |
|
947 { |
|
948 |
|
949 TInt ret( KErrArgument ); |
|
950 |
|
951 // Check that received codes are well formed |
|
952 if (!AreCodesWellFormed(*type,*codes)) |
|
953 { |
|
954 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrArgument ); |
|
955 return KErrNone; |
|
956 } |
|
957 |
|
958 if ( RMobilePhone::ESecurityCodePin1 == *type ) |
|
959 { |
|
960 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN VERIFY REQUESTED"); |
|
961 iLastPinRequested = EPin1Requested; |
|
962 } |
|
963 if ( RMobilePhone::ESecurityCodePin2 == *type ) |
|
964 { |
|
965 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN2 VERIFY REQUESTED"); |
|
966 iLastPinRequested = EPin2Requested; |
|
967 } |
|
968 //This is to prevent unnecessary PIN1 request after PUK code |
|
969 //request. Corrected at the same time with error TKEN-5WFJ7Y |
|
970 if ( ( ( RMobilePhone::ESecurityCodePuk1 == *type ) || |
|
971 ( RMobilePhone::ESecurityCodePuk2 == *type ) ) && |
|
972 ( 0 < codes->iUnblockCode.Length() ) ) |
|
973 { |
|
974 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PUK VERIFY REQUESTED"); |
|
975 iPukCodeVerify = ETrue; |
|
976 } |
|
977 //This is to prevent unnecessary PIN1 request after phone password |
|
978 //request (PYRA-5UBCLC) |
|
979 if ( RMobilePhone::ESecurityCodePhonePassword == *type ) |
|
980 { |
|
981 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PHONE PASSWORD VERIFY REQUESTED"); |
|
982 iPhonePasswordVerify = ETrue; |
|
983 } |
|
984 iMmPhoneTsy->iMmPhoneExtInterface->DeliverCode( *codes ); |
|
985 |
|
986 // CheckSecurityCode needs to set the lock as well, so pass the |
|
987 // code for lock setting |
|
988 if ( iMmPhoneTsy->iMmCustomTsy ) |
|
989 { |
|
990 iMmPhoneTsy->iMmCustomTsy->DeliverCodeL( *codes ); |
|
991 } |
|
992 |
|
993 //Check if the SetLockSetting is ongoing, in some cases |
|
994 //SetLockSetting requires a verification of PIN1 or security code |
|
995 //before continue with the lock setting |
|
996 reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
997 GetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
998 |
|
999 if ( reqHandle != CMmPhoneTsy::EMultimodePhoneReqHandleUnknown && |
|
1000 EActiveCodeToUpinAskUpin != iActiveCodeToUpinState ) |
|
1001 { |
|
1002 CMmDataPackage dataPackage; |
|
1003 //add into the package the stored lock and setting |
|
1004 dataPackage.PackData( &iLockSettingPhoneLock, &iLockSetting ); |
|
1005 ret = iMmPhoneTsy->iMmPhoneExtInterface-> |
|
1006 SetLockSettingL( &dataPackage ); |
|
1007 iMmPhoneTsy->iReqHandleType = |
|
1008 CMmPhoneTsy::EMultimodePhoneVerifySecurityCode; |
|
1009 |
|
1010 if ( KErrNone != ret ) |
|
1011 { |
|
1012 CompleteSetLockSetting( ret, |
|
1013 RMobilePhone::EStatusLockUnknown, |
|
1014 RMobilePhone::ELockSetUnknown ); |
|
1015 } |
|
1016 } |
|
1017 //This is a regular verification or active code |
|
1018 //change from PIN to UPIN |
|
1019 else |
|
1020 { |
|
1021 ret = iMmPhoneTsy->iMmPhoneExtInterface-> |
|
1022 VerifySecurityCodeL( aPackage ); |
|
1023 |
|
1024 if ( KErrNone == ret ) |
|
1025 { |
|
1026 iMmPhoneTsy->iReqHandleType = |
|
1027 CMmPhoneTsy::EMultimodePhoneVerifySecurityCode; |
|
1028 } |
|
1029 else |
|
1030 { |
|
1031 // Complete verify with error |
|
1032 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, ret ); |
|
1033 |
|
1034 // If FDN request is on-going, complete is also with error |
|
1035 reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
1036 GetTsyReqHandle( |
|
1037 CMmPhoneTsy::EMultimodePhoneSetFdnSetting ); |
|
1038 if ( reqHandle != |
|
1039 CMmPhoneTsy::EMultimodePhoneReqHandleUnknown ) |
|
1040 { |
|
1041 iMmPhoneTsy->CompleteSetFdnSettingL( ret ); |
|
1042 } |
|
1043 reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
1044 GetTsyReqHandle( |
|
1045 CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
1046 |
|
1047 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != |
|
1048 reqHandle && EActiveCodeToUpinAskUpin == |
|
1049 iActiveCodeToUpinState ) |
|
1050 { |
|
1051 //Verifying UPIN failed |
|
1052 CompleteSetLockSetting( ret, |
|
1053 RMobilePhone::EStatusLockUnknown, |
|
1054 RMobilePhone::ELockSetUnknown ); |
|
1055 } |
|
1056 } |
|
1057 } |
|
1058 |
|
1059 } // end check request handle |
|
1060 |
|
1061 return KErrNone; |
|
1062 } |
|
1063 |
|
1064 // --------------------------------------------------------------------------- |
|
1065 // CMmSecurityTsy::CompleteVerifySecurityCodeL |
|
1066 // This method completes an outstanding asynchronous |
|
1067 // VerifySecurityCode request |
|
1068 // (other items were commented in a header). |
|
1069 // --------------------------------------------------------------------------- |
|
1070 // |
|
1071 void CMmSecurityTsy::CompleteVerifySecurityCodeL( |
|
1072 TInt aErrorCode ) |
|
1073 { |
|
1074 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteVerifySecurityCode - Error:%d", aErrorCode); |
|
1075 |
|
1076 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
1077 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneVerifySecurityCode ); |
|
1078 |
|
1079 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
1080 { |
|
1081 // Complete the request |
|
1082 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
1083 |
|
1084 // This needs to be done for PIN code verification when user has |
|
1085 // dual line SIM and user has changed the line. If PIN code |
|
1086 // verification fails, we need to request PIN code again. |
|
1087 |
|
1088 // NOTE! This MUST NOT happen in bootup when PIN code is verified |
|
1089 // and NOT when PIN code is changed to ON/OFF from settings. |
|
1090 |
|
1091 // DO NOT complete if SetLockSetting is called -> PIN ON/OFF change |
|
1092 // from general settings. |
|
1093 |
|
1094 // Not completed if PUK code verify or Phonepassword verify |
|
1095 TTsyReqHandle phoneSetLockSettingHandle = |
|
1096 iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
1097 CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
1098 |
|
1099 // DO NOT complete if booting up |
|
1100 if ( ( iMmPhoneTsy->iBootState.iSecReady ) && |
|
1101 ( iLastPinRequested != EPinUnknown ) && |
|
1102 ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown == |
|
1103 phoneSetLockSettingHandle ) && |
|
1104 ( KErrNone != aErrorCode ) && |
|
1105 ( !iPukCodeVerify ) && |
|
1106 ( !iPhonePasswordVerify ) ) |
|
1107 { |
|
1108 // IF PIN1 REQUESTED LAST |
|
1109 if ( iLastPinRequested == EPin1Requested ) |
|
1110 { |
|
1111 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN VERIFICATION NEEDED"); |
|
1112 CompleteNotifySecurityEventL( RMobilePhone::EPin1Required, |
|
1113 KErrNone ); |
|
1114 iLastPinRequested = EPinUnknown; |
|
1115 } |
|
1116 // IF PIN2 REQUESTED LAST |
|
1117 if (iLastPinRequested == EPin2Requested) |
|
1118 { |
|
1119 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN2"); |
|
1120 iLastPinRequested = EPinUnknown; |
|
1121 } |
|
1122 } |
|
1123 else if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != |
|
1124 phoneSetLockSettingHandle && EActiveCodeToUpinAskUpin == |
|
1125 iActiveCodeToUpinState ) |
|
1126 { |
|
1127 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - iActiveCodeToUpinState = EActiveCodeToUpinAskPin"); |
|
1128 if ( KErrNone == aErrorCode ) |
|
1129 { |
|
1130 iActiveCodeToUpinState = EActiveCodeToUpinAskPin; |
|
1131 CompleteNotifySecurityEventL( |
|
1132 RMobilePhone::EPin1Required, KErrNone ); |
|
1133 } |
|
1134 else |
|
1135 { |
|
1136 iActiveCodeToUpinState = EActiveCodeToUpinIdle; |
|
1137 CompleteSetLockSetting( KErrAccessDenied, |
|
1138 RMobilePhone::EStatusLockUnknown, |
|
1139 RMobilePhone::ELockSetUnknown ); |
|
1140 } |
|
1141 } |
|
1142 //Set iPukCodeVerify to EFalse |
|
1143 iPukCodeVerify = EFalse; |
|
1144 |
|
1145 //Set iPhonePasswordVerify to EFalse |
|
1146 iPhonePasswordVerify = EFalse; |
|
1147 |
|
1148 // FDN HANDLING |
|
1149 reqHandle = iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
1150 CMmPhoneTsy::EMultimodePhoneSetFdnSetting ); |
|
1151 |
|
1152 if ( reqHandle != CMmPhoneTsy::EMultimodePhoneReqHandleUnknown ) |
|
1153 { |
|
1154 if ( KErrNone == aErrorCode ) |
|
1155 { |
|
1156 aErrorCode = iMmPhoneTsy->iMmPhoneExtInterface-> |
|
1157 SetFdnSetting( iMmPhoneTsy->iRetFdnSetting ); |
|
1158 } |
|
1159 else |
|
1160 { |
|
1161 iMmPhoneTsy->CompleteSetFdnSettingL( aErrorCode ); |
|
1162 } |
|
1163 } |
|
1164 |
|
1165 // Reset just used code, empty for next round. |
|
1166 RMobilePhone::TCodeAndUnblockCode codes; |
|
1167 _LIT( KNullCharacter, "\0" ); |
|
1168 codes.iCode.Copy( KNullCharacter ); |
|
1169 iMmPhoneTsy->iMmPhoneExtInterface->DeliverCode( codes ); |
|
1170 } |
|
1171 } |
|
1172 #endif //USING_CTSY_DISPATCHER |
|
1173 |
|
1174 // --------------------------------------------------------------------------- |
|
1175 // CMmSecurityTsy::AbortSecurityCodeL |
|
1176 // This function informs the phone that the user has cancelled |
|
1177 // an outstanding "get security code" request |
|
1178 // (other items were commented in a header). |
|
1179 // --------------------------------------------------------------------------- |
|
1180 // |
|
1181 TInt CMmSecurityTsy::AbortSecurityCodeL( |
|
1182 const TTsyReqHandle aTsyReqHandle, |
|
1183 const TDataPackage& aPackage ) |
|
1184 { |
|
1185 TInt ret = KErrNone; |
|
1186 |
|
1187 // Check if security code verification was aborted for the lock setting |
|
1188 TTsyReqHandle reqHandle = |
|
1189 iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
1190 CMmPhoneTsy::EMultimodePhoneSetLockSetting ); |
|
1191 |
|
1192 // Check also that VerifySecurityCode has not yet been called |
|
1193 TTsyReqHandle verifyHandle = |
|
1194 iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
1195 CMmPhoneTsy::EMultimodePhoneVerifySecurityCode ); |
|
1196 |
|
1197 // If so, complete set lock setting |
|
1198 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle && |
|
1199 CMmPhoneTsy::EMultimodePhoneReqHandleUnknown == verifyHandle ) |
|
1200 { |
|
1201 // Complete with abort error code |
|
1202 CompleteSetLockSetting( KErrAbort, |
|
1203 RMobilePhone::EStatusLockUnknown, |
|
1204 RMobilePhone::ELockSetUnknown ); |
|
1205 |
|
1206 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, ret ); |
|
1207 } |
|
1208 // In other cases we need to inform Licencee TSY about the abort request |
|
1209 //for further processing |
|
1210 else |
|
1211 { |
|
1212 // Check if security code verification was aborted for the fdn setting |
|
1213 reqHandle = iMmPhoneTsy->iTsyReqHandleStore->GetTsyReqHandle( |
|
1214 CMmPhoneTsy::EMultimodePhoneSetFdnSetting ); |
|
1215 |
|
1216 if ( reqHandle != CMmPhoneTsy::EMultimodePhoneReqHandleUnknown ) |
|
1217 { |
|
1218 // Security UI excepts KErrAbort for abort security code |
|
1219 iMmPhoneTsy->CompleteSetFdnSettingL( KErrAbort ); |
|
1220 |
|
1221 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, ret ); |
|
1222 } |
|
1223 else |
|
1224 { |
|
1225 |
|
1226 // allow for EMobilePhoneAbortSecurityCode immediate completion |
|
1227 #ifdef REQHANDLE_TIMER |
|
1228 iMmPhoneTsy->SetTypeOfResponse( |
|
1229 CMmPhoneTsy::EMultimodePhoneAbortSecurityCode, |
|
1230 aTsyReqHandle ); |
|
1231 #else |
|
1232 iMmPhoneTsy->iTsyReqHandleStore->SetTsyReqHandle( |
|
1233 CMmPhoneTsy::EMultimodePhoneAbortSecurityCode, |
|
1234 aTsyReqHandle ); |
|
1235 #endif |
|
1236 ret = iMmPhoneTsy->iMmPhoneExtInterface->AbortSecurityCodeL( |
|
1237 aPackage ); |
|
1238 |
|
1239 // dos layer returned with error and didn't complete request |
|
1240 if ( ret != KErrNone ) |
|
1241 { |
|
1242 CompleteAbortSecurityCode(ret); |
|
1243 } |
|
1244 } |
|
1245 } |
|
1246 |
|
1247 return KErrNone; |
|
1248 } |
|
1249 |
|
1250 // --------------------------------------------------------------------------- |
|
1251 // CMmSecurityTsy::CompleteAbortSecurityCode |
|
1252 // This function completes outstanding asynchronous |
|
1253 // AbortSecurityCode request. |
|
1254 // (other items were commented in a header). |
|
1255 // --------------------------------------------------------------------------- |
|
1256 // |
|
1257 void CMmSecurityTsy::CompleteAbortSecurityCode( |
|
1258 TInt aErrorCode ) |
|
1259 { |
|
1260 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteAbortSecurityCode - Error:%d", aErrorCode); |
|
1261 |
|
1262 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
1263 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneAbortSecurityCode ); |
|
1264 |
|
1265 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
1266 { |
|
1267 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
1268 } |
|
1269 } |
|
1270 |
|
1271 // --------------------------------------------------------------------------- |
|
1272 // CMmSecurityTsy::SetPin1DisableNotSupported |
|
1273 // Sets iPin1DisableSupported to EFalse. PIN can't be disabled. |
|
1274 // (other items were commented in a header). |
|
1275 // --------------------------------------------------------------------------- |
|
1276 // |
|
1277 void CMmSecurityTsy::SetPin1DisableNotSupported() |
|
1278 { |
|
1279 iPin1DisableSupported = EFalse; |
|
1280 } |
|
1281 |
|
1282 // --------------------------------------------------------------------------- |
|
1283 // CMmSecurityTsy::CompleteGetLockInfo |
|
1284 // This method completes either an outstanding asynchronous |
|
1285 // SimPinEnable, GetLockInfo or SetLockSetting request. |
|
1286 // (other items were commented in a header). |
|
1287 // --------------------------------------------------------------------------- |
|
1288 // |
|
1289 void CMmSecurityTsy::CompleteGetLockInfo( |
|
1290 CMmDataPackage* aDataPackage, |
|
1291 TInt aErrorCode ) |
|
1292 { |
|
1293 TFLOGSTRING2("LTSY: CMmSecurityTsy::CompleteGetLockInfo - Error:%d", aErrorCode); |
|
1294 |
|
1295 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
1296 ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneGetLockInfo ); |
|
1297 |
|
1298 // check if handle is present |
|
1299 if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
1300 { |
|
1301 |
|
1302 if ( KErrNone == aErrorCode ) |
|
1303 { |
|
1304 //unpack the data |
|
1305 RMobilePhone::TMobilePhoneLockStatus* status = NULL; |
|
1306 RMobilePhone::TMobilePhoneLockSetting* setting = NULL; |
|
1307 |
|
1308 aDataPackage->UnPackData( &status, &setting ); |
|
1309 |
|
1310 RMobilePhone::TMobilePhoneLockInfoV1 apckg; |
|
1311 apckg.iStatus = *status; |
|
1312 apckg.iSetting = *setting; |
|
1313 |
|
1314 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPckg( apckg ); |
|
1315 |
|
1316 *iRetGetLockInfo = lockInfoPckg; |
|
1317 } |
|
1318 |
|
1319 iRetGetLockInfo = NULL; |
|
1320 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
1321 } |
|
1322 } |
|
1323 |
|
1324 // --------------------------------------------------------------------------- |
|
1325 // CMmSecurityTsy::GetLockInfoCancel |
|
1326 // This method cancels either an outstanding asynchronous |
|
1327 // SimPinEnable, GetLockInfo or SetLockSetting request. |
|
1328 // (other items were commented in a header). |
|
1329 // --------------------------------------------------------------------------- |
|
1330 // |
|
1331 TInt CMmSecurityTsy::GetLockInfoCancel( |
|
1332 TTsyReqHandle aTsyReqHandle ) |
|
1333 { |
|
1334 //reset the pointer to the client side |
|
1335 iRetGetLockInfo = NULL; |
|
1336 |
|
1337 //reset the req handle |
|
1338 iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( |
|
1339 CMmPhoneTsy::EMultimodePhoneGetLockInfo ); |
|
1340 |
|
1341 //complete with cancel |
|
1342 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
1343 |
|
1344 return KErrNone; |
|
1345 } |
|
1346 |
|
1347 // --------------------------------------------------------------------------- |
|
1348 // CMmSecurityTsy::GetSecurityCodeInfoL |
|
1349 // This method retrieves the current number of remaining entry attemps of |
|
1350 // security code. |
|
1351 // (other items were commented in a header). |
|
1352 // --------------------------------------------------------------------------- |
|
1353 // |
|
1354 TInt CMmSecurityTsy::GetSecurityCodeInfoL( |
|
1355 const TTsyReqHandle aTsyReqHandle, |
|
1356 RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, |
|
1357 TDes8* aSecurityCodeInfo ) |
|
1358 { |
|
1359 TFLOGSTRING("TSY: CMmSecurityTsy::GetSecurityCodeInfoL"); |
|
1360 |
|
1361 TInt ret( KErrNone ); |
|
1362 |
|
1363 if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5 ) <= |
|
1364 aSecurityCodeInfo->MaxLength() ) |
|
1365 { |
|
1366 TBool reqAlreadyProcessing( EFalse ); |
|
1367 // Check if the request is already processing |
|
1368 for( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ ) |
|
1369 { |
|
1370 if( iGetSecurityCodeInfoRequests[ i ]->iSecurityCode |
|
1371 == *aSecurityCode ) |
|
1372 { |
|
1373 reqAlreadyProcessing = ETrue; |
|
1374 break; |
|
1375 } |
|
1376 } |
|
1377 |
|
1378 // The request is already in processing because of previous request |
|
1379 // Complete request with status value informing the client about |
|
1380 if( reqAlreadyProcessing ) |
|
1381 { |
|
1382 TGetSecurityCodeInfoRequest* req = new ( ELeave ) |
|
1383 TGetSecurityCodeInfoRequest(); |
|
1384 req->iReqHandle = aTsyReqHandle; |
|
1385 req->iSecurityCode = *aSecurityCode; |
|
1386 req->iSecurityCodeInfo = aSecurityCodeInfo; |
|
1387 iGetSecurityCodeInfoRequests.AppendL( req ); |
|
1388 } |
|
1389 else |
|
1390 { |
|
1391 CMmDataPackage dataPackage; |
|
1392 dataPackage.PackData( aSecurityCode ); |
|
1393 |
|
1394 ret = iMmPhoneTsy->MessageManager()->HandleRequestL( |
|
1395 EMobilePhoneGetSecurityCodeInfo, &dataPackage ); |
|
1396 |
|
1397 if ( KErrNone == ret ) |
|
1398 { |
|
1399 //save tsy req handle type |
|
1400 switch (*aSecurityCode) |
|
1401 { |
|
1402 case RMobilePhone::ESecurityCodePin1: |
|
1403 iMmPhoneTsy->iReqHandleType = |
|
1404 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPin1; |
|
1405 break; |
|
1406 case RMobilePhone::ESecurityCodePin2: |
|
1407 iMmPhoneTsy->iReqHandleType = |
|
1408 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPin2; |
|
1409 break; |
|
1410 case RMobilePhone::ESecurityCodePuk1: |
|
1411 iMmPhoneTsy->iReqHandleType = |
|
1412 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPuk1; |
|
1413 break; |
|
1414 case RMobilePhone::ESecurityCodePuk2: |
|
1415 iMmPhoneTsy->iReqHandleType = |
|
1416 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPuk2; |
|
1417 break; |
|
1418 case RMobilePhone::ESecurityCodePhonePassword: |
|
1419 iMmPhoneTsy->iReqHandleType = |
|
1420 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPhonePassword; |
|
1421 break; |
|
1422 case RMobilePhone::ESecurityCodeSPC: |
|
1423 iMmPhoneTsy->iReqHandleType = |
|
1424 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoSPC; |
|
1425 break; |
|
1426 case RMobilePhone::ESecurityHiddenKey: |
|
1427 iMmPhoneTsy->iReqHandleType = |
|
1428 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPhonebookHiddenKey; |
|
1429 break; |
|
1430 case RMobilePhone::ESecurityUSIMAppPin: |
|
1431 iMmPhoneTsy->iReqHandleType = |
|
1432 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoUSIMAppPin; |
|
1433 break; |
|
1434 case RMobilePhone::ESecuritySecondUSIMAppPin: |
|
1435 iMmPhoneTsy->iReqHandleType = |
|
1436 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoSecondUSIMAppPin; |
|
1437 break; |
|
1438 case RMobilePhone::ESecurityUniversalPin: |
|
1439 iMmPhoneTsy->iReqHandleType = |
|
1440 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoUniversalPin; |
|
1441 break; |
|
1442 case RMobilePhone::ESecurityUniversalPuk: |
|
1443 iMmPhoneTsy->iReqHandleType = |
|
1444 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoUniversalPuk; |
|
1445 break; |
|
1446 } |
|
1447 |
|
1448 // save request in queue for completion |
|
1449 TGetSecurityCodeInfoRequest* req = new ( ELeave ) |
|
1450 TGetSecurityCodeInfoRequest(); |
|
1451 req->iReqHandle = aTsyReqHandle; |
|
1452 req->iSecurityCode = *aSecurityCode; |
|
1453 req->iSecurityCodeInfo = aSecurityCodeInfo; |
|
1454 iGetSecurityCodeInfoRequests.AppendL( req ); |
|
1455 } |
|
1456 } |
|
1457 } |
|
1458 else |
|
1459 { |
|
1460 ret = KErrArgument; |
|
1461 } |
|
1462 |
|
1463 return ret; |
|
1464 } |
|
1465 |
|
1466 // --------------------------------------------------------------------------- |
|
1467 // CMmSecurityTsy::CompleteGetSecurityCodeInfo |
|
1468 // This method completes the GetSecurityCodeInfo request |
|
1469 // (other items were commented in a header). |
|
1470 // --------------------------------------------------------------------------- |
|
1471 // |
|
1472 void CMmSecurityTsy::CompleteGetSecurityCodeInfo( |
|
1473 CMmDataPackage* aDataPackage, |
|
1474 TInt aErrorCode ) |
|
1475 { |
|
1476 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteGetSecurityCodeInfo"); |
|
1477 |
|
1478 RMobilePhone::TMobilePhoneSecurityCode* securityCode; |
|
1479 RMobilePhone::TMobilePhoneSecurityCodeInfoV5* securityCodeInfoV5; |
|
1480 aDataPackage->UnPackData( &securityCode, &securityCodeInfoV5 ); |
|
1481 |
|
1482 ResetGetSecurityCodeInfoTsyReqHandle(*securityCode); |
|
1483 |
|
1484 for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ ) |
|
1485 { |
|
1486 if( iGetSecurityCodeInfoRequests[ i ]->iSecurityCode |
|
1487 == *securityCode ) |
|
1488 { |
|
1489 if (aErrorCode == KErrNone) |
|
1490 { |
|
1491 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg* |
|
1492 securityCodeInfoV5Pckg = REINTERPRET_CAST( |
|
1493 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg*, |
|
1494 iGetSecurityCodeInfoRequests[ i ]->iSecurityCodeInfo ); |
|
1495 |
|
1496 RMobilePhone::TMobilePhoneSecurityCodeInfoV5& securityCodeInfo = |
|
1497 ( *securityCodeInfoV5Pckg )(); |
|
1498 |
|
1499 securityCodeInfo.iRemainingEntryAttempts |
|
1500 = securityCodeInfoV5->iRemainingEntryAttempts; |
|
1501 } |
|
1502 iMmPhoneTsy->ReqCompleted( |
|
1503 iGetSecurityCodeInfoRequests[ i ]->iReqHandle, aErrorCode ); |
|
1504 |
|
1505 delete iGetSecurityCodeInfoRequests[ i ]; |
|
1506 iGetSecurityCodeInfoRequests.Remove( i ); |
|
1507 } |
|
1508 } |
|
1509 |
|
1510 iGetSecurityCodeInfoRequests.Compress(); |
|
1511 } |
|
1512 |
|
1513 // --------------------------------------------------------------------------- |
|
1514 // CMmSecurityTsy::GetSecurityCodeInfoCancel |
|
1515 // This method cancels the GetSecurityCodeInfo request |
|
1516 // (other items were commented in a header). |
|
1517 // --------------------------------------------------------------------------- |
|
1518 // |
|
1519 TInt CMmSecurityTsy::GetSecurityCodeInfoCancel( |
|
1520 TTsyReqHandle aTsyReqHandle ) |
|
1521 { |
|
1522 TFLOGSTRING("TSY: CMmSecurityTsy::GetSecurityCodeInfoCancel"); |
|
1523 |
|
1524 RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1; |
|
1525 TBool reqHandleExist = EFalse; |
|
1526 |
|
1527 for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ ) |
|
1528 { |
|
1529 TGetSecurityCodeInfoRequest* req = iGetSecurityCodeInfoRequests[ i ]; |
|
1530 |
|
1531 if( aTsyReqHandle == req->iReqHandle ) |
|
1532 { |
|
1533 secCode = req->iSecurityCode; |
|
1534 iMmPhoneTsy->ReqCompleted( req->iReqHandle, KErrCancel ); |
|
1535 delete iGetSecurityCodeInfoRequests[ i ]; |
|
1536 iGetSecurityCodeInfoRequests.Remove( i ); |
|
1537 reqHandleExist = ETrue; |
|
1538 break; |
|
1539 } |
|
1540 } |
|
1541 |
|
1542 if (reqHandleExist) |
|
1543 { |
|
1544 iGetSecurityCodeInfoRequests.Compress(); |
|
1545 |
|
1546 TBool secCodeExist = EFalse; |
|
1547 |
|
1548 for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ ) |
|
1549 { |
|
1550 TGetSecurityCodeInfoRequest* req = iGetSecurityCodeInfoRequests[ i ]; |
|
1551 |
|
1552 if (iGetSecurityCodeInfoRequests[i]->iSecurityCode == secCode) |
|
1553 { |
|
1554 secCodeExist = ETrue; |
|
1555 break; |
|
1556 } |
|
1557 } |
|
1558 |
|
1559 if (!secCodeExist) |
|
1560 { |
|
1561 ResetGetSecurityCodeInfoTsyReqHandle(secCode); |
|
1562 } |
|
1563 } |
|
1564 return KErrNone; |
|
1565 } |
|
1566 |
|
1567 // --------------------------------------------------------------------------- |
|
1568 // CMmSecurityTsy::ResetGetSecurityCodeInfoTsyReqHandle |
|
1569 // This method resets the (GetSecurityCodeInfo) request handle. |
|
1570 // (other items were commented in a header). |
|
1571 // --------------------------------------------------------------------------- |
|
1572 // |
|
1573 void CMmSecurityTsy::ResetGetSecurityCodeInfoTsyReqHandle( |
|
1574 const RMobilePhone::TMobilePhoneSecurityCode aSecurityCode ) |
|
1575 { |
|
1576 switch (aSecurityCode) |
|
1577 { |
|
1578 case RMobilePhone::ESecurityCodePin1: |
|
1579 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1580 ResetTsyReqHandle( |
|
1581 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPin1); |
|
1582 break; |
|
1583 case RMobilePhone::ESecurityCodePin2: |
|
1584 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1585 ResetTsyReqHandle( |
|
1586 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPin2 ); |
|
1587 break; |
|
1588 case RMobilePhone::ESecurityCodePuk1: |
|
1589 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1590 ResetTsyReqHandle( |
|
1591 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPuk1 ); |
|
1592 break; |
|
1593 case RMobilePhone::ESecurityCodePuk2: |
|
1594 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1595 ResetTsyReqHandle( |
|
1596 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPuk2 ); |
|
1597 break; |
|
1598 case RMobilePhone::ESecurityCodePhonePassword: |
|
1599 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1600 ResetTsyReqHandle( |
|
1601 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPhonePassword ); |
|
1602 break; |
|
1603 case RMobilePhone::ESecurityCodeSPC: |
|
1604 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1605 ResetTsyReqHandle( |
|
1606 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoSPC ); |
|
1607 break; |
|
1608 case RMobilePhone::ESecurityHiddenKey: |
|
1609 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1610 ResetTsyReqHandle( |
|
1611 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoPhonebookHiddenKey ); |
|
1612 break; |
|
1613 case RMobilePhone::ESecurityUSIMAppPin: |
|
1614 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1615 ResetTsyReqHandle( |
|
1616 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoUSIMAppPin ); |
|
1617 break; |
|
1618 case RMobilePhone::ESecuritySecondUSIMAppPin: |
|
1619 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1620 ResetTsyReqHandle( |
|
1621 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoSecondUSIMAppPin ); |
|
1622 break; |
|
1623 case RMobilePhone::ESecurityUniversalPin: |
|
1624 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1625 ResetTsyReqHandle( |
|
1626 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoUniversalPin ); |
|
1627 break; |
|
1628 case RMobilePhone::ESecurityUniversalPuk: |
|
1629 iMmPhoneTsy->iTsyReqHandleStore-> |
|
1630 ResetTsyReqHandle( |
|
1631 CMmPhoneTsy::EMultimodePhoneGetSecurityCodeInfoUniversalPuk ); |
|
1632 break; |
|
1633 } |
|
1634 } |
|
1635 |
|
1636 // --------------------------------------------------------------------------- |
|
1637 // CMmSecurityTsy::NotifySecurityCodeInfoChange |
|
1638 // This method allows a client to be notified when the security code |
|
1639 // information changes. |
|
1640 // (other items were commented in a header). |
|
1641 // --------------------------------------------------------------------------- |
|
1642 // |
|
1643 TInt CMmSecurityTsy::NotifySecurityCodeInfoChange( |
|
1644 RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, |
|
1645 TDes8* aSecurityCodeInfo ) |
|
1646 { |
|
1647 TFLOGSTRING("TSY: CMmSecurityTsy::NotifySecurityCodeInfoChange"); |
|
1648 |
|
1649 TInt ret( KErrNone ); |
|
1650 |
|
1651 if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5 ) <= |
|
1652 aSecurityCodeInfo->MaxLength() ) |
|
1653 { |
|
1654 iRetNotifySecurityCode = aSecurityCode; |
|
1655 iRetNotifySecurityCodeInfo = aSecurityCodeInfo; |
|
1656 |
|
1657 iMmPhoneTsy->iReqHandleType |
|
1658 = CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange; |
|
1659 } |
|
1660 else |
|
1661 { |
|
1662 ret = KErrArgument; |
|
1663 } |
|
1664 return ret; |
|
1665 } |
|
1666 |
|
1667 // --------------------------------------------------------------------------- |
|
1668 // CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange |
|
1669 // This method completes the NotifySecurityCodeInfoChange notification. |
|
1670 // (other items were commented in a header). |
|
1671 // --------------------------------------------------------------------------- |
|
1672 // |
|
1673 void CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange( |
|
1674 CMmDataPackage* aDataPackage, |
|
1675 TInt aErrorCode ) |
|
1676 { |
|
1677 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange"); |
|
1678 |
|
1679 TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore-> |
|
1680 ResetTsyReqHandle( |
|
1681 CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange ); |
|
1682 |
|
1683 if( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle ) |
|
1684 { |
|
1685 if ( KErrNone == aErrorCode ) |
|
1686 { |
|
1687 RMobilePhone::TMobilePhoneSecurityCode* securityCode; |
|
1688 RMobilePhone::TMobilePhoneSecurityCodeInfoV5* securityCodeInfoV5; |
|
1689 aDataPackage->UnPackData( &securityCode, &securityCodeInfoV5 ); |
|
1690 |
|
1691 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg* |
|
1692 securityCodeInfoV5Pckg = REINTERPRET_CAST( |
|
1693 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg*, |
|
1694 iRetNotifySecurityCodeInfo ); |
|
1695 |
|
1696 RMobilePhone::TMobilePhoneSecurityCodeInfoV5& securityCodeInfo |
|
1697 = ( *securityCodeInfoV5Pckg )(); |
|
1698 |
|
1699 securityCodeInfo.iRemainingEntryAttempts |
|
1700 = securityCodeInfoV5->iRemainingEntryAttempts; |
|
1701 *iRetNotifySecurityCode = *securityCode; |
|
1702 } |
|
1703 |
|
1704 // clean the pointers to client side |
|
1705 iRetNotifySecurityCodeInfo = NULL; |
|
1706 iRetNotifySecurityCode = NULL; |
|
1707 |
|
1708 iMmPhoneTsy->ReqCompleted( reqHandle, aErrorCode ); |
|
1709 } |
|
1710 } |
|
1711 |
|
1712 // --------------------------------------------------------------------------- |
|
1713 // CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel |
|
1714 // This method cancels the NotifySecurityCodeInfoChange notification. |
|
1715 // (other items were commented in a header). |
|
1716 // --------------------------------------------------------------------------- |
|
1717 // |
|
1718 TInt CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel( |
|
1719 TTsyReqHandle aTsyReqHandle ) |
|
1720 { |
|
1721 TFLOGSTRING("TSY: CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel"); |
|
1722 |
|
1723 iRetNotifySecurityCodeInfo = NULL; |
|
1724 iRetNotifySecurityCode = NULL; |
|
1725 |
|
1726 iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( |
|
1727 CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange ); |
|
1728 |
|
1729 iMmPhoneTsy->ReqCompleted( aTsyReqHandle, KErrCancel ); |
|
1730 |
|
1731 return KErrNone; |
|
1732 } |
|
1733 |
|
1734 |
|
1735 // End of File |