telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmsecuritytsy.cpp
changeset 42 3adadc800673
parent 0 3553901f7fa8
child 53 12b52b1a573e
equal deleted inserted replaced
31:8ab6687fb94c 42:3adadc800673
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    14 //
    14 //
    15 
    15 
    16 
    16 
    17 
    17 
    18 //INCLUDES
    18 //INCLUDES
       
    19 
       
    20 #include "OstTraceDefinitions.h"
       
    21 #ifdef OST_TRACE_COMPILER_IN_USE
       
    22 #include "cmmsecuritytsyTraces.h"
       
    23 #endif
       
    24 
    19 #include "cmmsecuritytsy.h"
    25 #include "cmmsecuritytsy.h"
    20 #include "cmmphonetsy.h"
    26 #include "cmmphonetsy.h"
    21 #include "cmmtsyreqhandlestore.h"
    27 #include "cmmtsyreqhandlestore.h"
    22 #include <ctsy/pluginapi/cmmdatapackage.h>
    28 #include <ctsy/pluginapi/cmmdatapackage.h>
    23 #include "cmmmessagemanagerbase.h"
    29 #include "cmmmessagemanagerbase.h"
    28 // ======== MEMBER FUNCTIONS ========
    34 // ======== MEMBER FUNCTIONS ========
    29 
    35 
    30 CMmSecurityTsy* CMmSecurityTsy::NewL(    
    36 CMmSecurityTsy* CMmSecurityTsy::NewL(    
    31         CMmPhoneTsy* aPhoneTsy ) // Ptr to PhoneTsy   
    37         CMmPhoneTsy* aPhoneTsy ) // Ptr to PhoneTsy   
    32     {
    38     {
    33 TFLOGSTRING("TSY: CMmSecurityTsy::NewL");
    39 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NEWL_1, "TSY: CMmSecurityTsy::NewL");
    34     CMmSecurityTsy* const mmSecurityTsy = new ( ELeave ) CMmSecurityTsy();
    40     CMmSecurityTsy* const mmSecurityTsy = new ( ELeave ) CMmSecurityTsy();
    35     CleanupStack::PushL( mmSecurityTsy );
    41     CleanupStack::PushL( mmSecurityTsy );
    36     mmSecurityTsy->iMmPhoneTsy = aPhoneTsy;
    42     mmSecurityTsy->iMmPhoneTsy = aPhoneTsy;
    37     mmSecurityTsy->ConstructL();
    43     mmSecurityTsy->ConstructL();
    38     CleanupStack::Pop( mmSecurityTsy );
    44     CleanupStack::Pop( mmSecurityTsy );
    44     {
    50     {
    45     }
    51     }
    46 
    52 
    47 void CMmSecurityTsy::ConstructL()
    53 void CMmSecurityTsy::ConstructL()
    48     {
    54     {
    49 TFLOGSTRING("TSY: CMmSecurityTsy::ConstructL");
    55 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_CONSTRUCTL_1, "TSY: CMmSecurityTsy::ConstructL");
    50     // Is security codes (PIN and phone password) checked in boot
    56     // Is security codes (PIN and phone password) checked in boot
    51     iSecurityCheckedForBoot = EFalse;
    57     iSecurityCheckedForBoot = EFalse;
    52 
    58 
    53     // information to know is PIN1 or PIN2 last requested
    59     // information to know is PIN1 or PIN2 last requested
    54     iLastPinRequested = EPinUnknown;
    60     iLastPinRequested = EPinUnknown;
    70     iActiveCodeToUpinState = EActiveCodeToUpinIdle;
    76     iActiveCodeToUpinState = EActiveCodeToUpinIdle;
    71     }
    77     }
    72       
    78       
    73 CMmSecurityTsy::~CMmSecurityTsy()
    79 CMmSecurityTsy::~CMmSecurityTsy()
    74     {
    80     {
    75 TFLOGSTRING("TSY: CMmSecurityTsy::~CMmSecurityTsy");
    81 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_DTOR_1, "TSY: CMmSecurityTsy::~CMmSecurityTsy");
    76     }  
    82     }  
    77     
    83     
    78 // ---------------------------------------------------------------------------
    84 // ---------------------------------------------------------------------------
    79 // CMmSecurityTsy::DoExtFunc
    85 // CMmSecurityTsy::DoExtFunc
    80 // Security-specific functionality of CMmPhoneTsy::DoExtFuncL
    86 // Security-specific functionality of CMmPhoneTsy::DoExtFuncL
    84 TInt CMmSecurityTsy::DoExtFuncL(
    90 TInt CMmSecurityTsy::DoExtFuncL(
    85     const TTsyReqHandle aTsyReqHandle, 
    91     const TTsyReqHandle aTsyReqHandle, 
    86     const TInt aIpc, 
    92     const TInt aIpc, 
    87     const TDataPackage& aPackage ) 
    93     const TDataPackage& aPackage ) 
    88     {
    94     {
    89 TFLOGSTRING3("TSY: CMmSecurityTsy::DoExtFuncL.\n  \t\t\t IPC:%d\n  \t\t\t Handle:%d", aIpc, aTsyReqHandle);
    95 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_DOEXTFUNCL_1, "TSY: CMmSecurityTsy::DoExtFuncL.\n  \t\t\t IPC:%d\n  \t\t\t Handle:%d", aIpc, aTsyReqHandle);
    90 
    96 
    91     TInt ret ( KErrNone );
    97     TInt ret ( KErrNone );
    92 
    98 
    93     TAny* dataPtr = aPackage.Ptr1();
    99     TAny* dataPtr = aPackage.Ptr1();
    94 
   100 
   288 // (other items were commented in a header).
   294 // (other items were commented in a header).
   289 // ---------------------------------------------------------------------------
   295 // ---------------------------------------------------------------------------
   290 //
   296 //
   291 TInt CMmSecurityTsy::GetLockInfoL( const TDataPackage& aPackage ) 
   297 TInt CMmSecurityTsy::GetLockInfoL( const TDataPackage& aPackage ) 
   292     {
   298     {
   293 TFLOGSTRING("LTSY: CMmSecurityTsy::GetLockInfoL - Client call");
   299 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_GETLOCKINFOL_1, "LTSY: CMmSecurityTsy::GetLockInfoL - Client call");
   294     
   300     
   295     TInt ret ( KErrArgument );
   301     TInt ret ( KErrArgument );
   296     
   302     
   297     TDes8* data = reinterpret_cast<TDes8*> ( aPackage.Des2n() );
   303     TDes8* data = reinterpret_cast<TDes8*> ( aPackage.Des2n() );
   298     
   304     
   324 //
   330 //
   325 TInt CMmSecurityTsy::NotifyLockInfoChange(
   331 TInt CMmSecurityTsy::NotifyLockInfoChange(
   326     RMobilePhone::TMobilePhoneLock* aLock, 
   332     RMobilePhone::TMobilePhoneLock* aLock, 
   327     TDes8* aLockInfo ) 
   333     TDes8* aLockInfo ) 
   328     {
   334     {
   329 TFLOGSTRING2("LTSY: CMmSecurityTsy::NotifyLockInfoChange - Lock: %d", aLock);
   335 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYLOCKINFOCHANGE_1, "LTSY: CMmSecurityTsy::NotifyLockInfoChange - Lock: %d", aLock);
   330     
   336     
   331     TInt ret( KErrNone );
   337     TInt ret( KErrNone );
   332     
   338     
   333     if ( sizeof ( RMobilePhone::TMobilePhoneLockInfoV1 ) <= 
   339     if ( sizeof ( RMobilePhone::TMobilePhoneLockInfoV1 ) <= 
   334         aLockInfo->MaxLength() )
   340         aLockInfo->MaxLength() )
   355 // ---------------------------------------------------------------------------
   361 // ---------------------------------------------------------------------------
   356 //
   362 //
   357 TInt CMmSecurityTsy::NotifyLockInfoChangeCancel(
   363 TInt CMmSecurityTsy::NotifyLockInfoChangeCancel(
   358     const TTsyReqHandle aTsyReqHandle ) 
   364     const TTsyReqHandle aTsyReqHandle ) 
   359     {
   365     {
   360 TFLOGSTRING("LTSY: CMmSecurityTsy::NotifyLockInfoChangeCancel");
   366 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYLOCKINFOCHANGECANCEL_1, "LTSY: CMmSecurityTsy::NotifyLockInfoChangeCancel");
   361     
   367     
   362     iRetNotifyLockInfoChange = NULL;
   368     iRetNotifyLockInfoChange = NULL;
   363     iRetNotifyPhoneLockChange = NULL;
   369     iRetNotifyPhoneLockChange = NULL;
   364         
   370         
   365     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( 
   371     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( 
   422 //
   428 //
   423 TInt CMmSecurityTsy::SetLockSettingL(
   429 TInt CMmSecurityTsy::SetLockSettingL(
   424     const TTsyReqHandle aTsyReqHandle,    
   430     const TTsyReqHandle aTsyReqHandle,    
   425     const TDataPackage& aPackage ) 
   431     const TDataPackage& aPackage ) 
   426     {
   432     {
   427 TFLOGSTRING("LTSY: CMmSecurityTsy::SetLockSettingL - Client call" );
   433 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_SETLOCKSETTINGL_1, "LTSY: CMmSecurityTsy::SetLockSettingL - Client call" );
   428 
   434 
   429     TInt ret( KErrNone );
   435     TInt ret( KErrNone );
   430 
   436 
   431     // Check if request handle already exists
   437     // Check if request handle already exists
   432     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   438     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   494                                                         ( aPackage.Ptr1() );
   500                                                         ( aPackage.Ptr1() );
   495     RMobilePhone::TMobilePhoneLockSetting* setting = 
   501     RMobilePhone::TMobilePhoneLockSetting* setting = 
   496         reinterpret_cast<RMobilePhone::TMobilePhoneLockSetting* >
   502         reinterpret_cast<RMobilePhone::TMobilePhoneLockSetting* >
   497         ( aPackage.Ptr2() );
   503         ( aPackage.Ptr2() );
   498 
   504 
   499 TFLOGSTRING3("LTSY: CMmSecurityTsy::LockSetting - Lock:%d, Setting:%d",
   505 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_LOCKSETTINGL_1, "LTSY: CMmSecurityTsy::LockSetting - Lock:%d, Setting:%d",*lock, *setting );
   500     *lock, *setting );
       
   501 
   506 
   502     // Some SIM cards might not support PIN1 disable. Thus
   507     // Some SIM cards might not support PIN1 disable. Thus
   503     // return error if client tries to disable it.
   508     // return error if client tries to disable it.
   504     // complete the request immediately with error.
   509     // complete the request immediately with error.
   505     if ( ( RMobilePhone::ELockSetDisabled == *setting ) &&
   510     if ( ( RMobilePhone::ELockSetDisabled == *setting ) &&
   540                     // This is here to prompt PIN query in case of replacing
   545                     // This is here to prompt PIN query in case of replacing
   541                     // PIN1 with UPIN
   546                     // PIN1 with UPIN
   542                     event = RMobilePhone::EUniversalPinRequired;
   547                     event = RMobilePhone::EUniversalPinRequired;
   543                     if ( RMobilePhone::ELockReplaced == *setting )
   548                     if ( RMobilePhone::ELockReplaced == *setting )
   544                         {
   549                         {
   545 TFLOGSTRING("TSY: CMmSecurityTsy::LockSetting RMobilePhone::ELockReplaced");
   550 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_LOCKSETTINGL_2, "TSY: CMmSecurityTsy::LockSetting RMobilePhone::ELockReplaced");
   546                         iActiveCodeToUpinState = EActiveCodeToUpinAskUpin;
   551                         iActiveCodeToUpinState = EActiveCodeToUpinAskUpin;
   547                         }
   552                         }
   548                     break;
   553                     break;
   549                 // This setting is not supported
   554                 // This setting is not supported
   550                 case RMobilePhone::ELockPhoneToFirstICC:
   555                 case RMobilePhone::ELockPhoneToFirstICC:
   601 void CMmSecurityTsy::CompleteSetLockSetting(
   606 void CMmSecurityTsy::CompleteSetLockSetting(
   602     TInt aErrorCode, //Error code
   607     TInt aErrorCode, //Error code
   603     RMobilePhone::TMobilePhoneLockStatus, 
   608     RMobilePhone::TMobilePhoneLockStatus, 
   604     RMobilePhone::TMobilePhoneLockSetting ) 
   609     RMobilePhone::TMobilePhoneLockSetting ) 
   605     {
   610     {
   606 TFLOGSTRING2("LTSY: CMmSecurityTsy::CompleteSetLockSetting - Error:%d", aErrorCode);
   611 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETESETLOCKSETTING_1, "LTSY: CMmSecurityTsy::CompleteSetLockSetting - Error:%d", aErrorCode);
   607 
   612 
   608     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   613     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   609         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting );
   614         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting );
   610 
   615 
   611     // Check if handle for set lock setting exists
   616     // Check if handle for set lock setting exists
   664 // ---------------------------------------------------------------------------
   669 // ---------------------------------------------------------------------------
   665 //
   670 //
   666 TInt CMmSecurityTsy::CompleteChangeSecurityCode(
   671 TInt CMmSecurityTsy::CompleteChangeSecurityCode(
   667     TInt aErrorCode ) // Error code
   672     TInt aErrorCode ) // Error code
   668     {
   673     {
   669     TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteChangeSecurityCode - Error:%d", aErrorCode);
   674     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETECHANGESECURITYCODE_1, "TSY: CMmSecurityTsy::CompleteChangeSecurityCode - Error:%d", aErrorCode);
   670 
   675 
   671 
   676 
   672     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   677     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   673         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneChangeSecurityCode );
   678         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneChangeSecurityCode );
   674 
   679 
   701     // security indication as Security server boots up faster than 
   706     // security indication as Security server boots up faster than 
   702     // TSY and has already sent the indications when TSY is loaded.
   707     // TSY and has already sent the indications when TSY is loaded.
   703     // Thus this is the only way to get the information in boot.
   708     // Thus this is the only way to get the information in boot.
   704     if  ( iSecurityCheckedForBoot == EFalse )
   709     if  ( iSecurityCheckedForBoot == EFalse )
   705         {
   710         {
   706 TFLOGSTRING( "TSY: CMmSecurityTsy::NotifySecurityEvent - Checking PIN state");
   711 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYEVENTL_1,  "TSY: CMmSecurityTsy::NotifySecurityEvent - Checking PIN state");
   707         // We can't do anything if sending fails. If this happens,
   712         // We can't do anything if sending fails. If this happens,
   708         // then every send to IsaApi should fail.
   713         // then every send to IsaApi should fail.
   709         (void)iMmPhoneTsy->iMmPhoneExtInterface->GetICCTypeL();
   714         (void)iMmPhoneTsy->iMmPhoneExtInterface->GetICCTypeL();
   710         }
   715         }
   711 
   716 
   712     // If we have cached notification for security code in boot, then
   717     // If we have cached notification for security code in boot, then
   713     // complete it once to client.
   718     // complete it once to client.
   714     if ( iIsSecurityCodeRequestCachedInBoot  && 
   719     if ( iIsSecurityCodeRequestCachedInBoot  && 
   715          !iMmPhoneTsy->iBootState.iSecReady  )
   720          !iMmPhoneTsy->iBootState.iSecReady  )
   716         {
   721         {
   717 TFLOGSTRING( "TSY: CMmSecurityTsy::NotifySecurityEventL - Completing security code event");
   722 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYEVENTL_2,  "TSY: CMmSecurityTsy::NotifySecurityEventL - Completing security code event");
   718 
   723 
   719         CompleteNotifySecurityEventL( RMobilePhone::EPhonePasswordRequired,
   724         CompleteNotifySecurityEventL( RMobilePhone::EPhonePasswordRequired,
   720             KErrNone );
   725             KErrNone );
   721         iIsSecurityCodeRequestCachedInBoot = EFalse;
   726         iIsSecurityCodeRequestCachedInBoot = EFalse;
   722         }
   727         }
   755 //
   760 //
   756 void CMmSecurityTsy::CompleteNotifySecurityEventL(
   761 void CMmSecurityTsy::CompleteNotifySecurityEventL(
   757     RMobilePhone::TMobilePhoneSecurityEvent aEvent, 
   762     RMobilePhone::TMobilePhoneSecurityEvent aEvent, 
   758     TInt aErrorCode ) 
   763     TInt aErrorCode ) 
   759     {
   764     {
   760 TFLOGSTRING3("TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Event: %d, Error: %d",
   765 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYEVENTL_1, "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Event: %d, Error: %d",aEvent, aErrorCode );
   761     aEvent, aErrorCode );
       
   762 
   766 
   763 	if ( iLastPinRequested != EPinUnknown && 
   767 	if ( iLastPinRequested != EPinUnknown && 
   764 		( RMobilePhone::EPin1Verified == aEvent ) || 
   768 		( RMobilePhone::EPin1Verified == aEvent ) || 
   765 		( RMobilePhone::EPin2Verified == aEvent ) )
   769 		( RMobilePhone::EPin2Verified == aEvent ) )
   766 		{
   770 		{
   767 TFLOGSTRING( "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - iLastPinRequested != EPinUnknown");
   771 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYEVENTL_2,  "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - iLastPinRequested != EPinUnknown");
   768     	iLastPinRequested = EPinUnknown;
   772     	iLastPinRequested = EPinUnknown;
   769         }
   773         }
   770 
   774 
   771     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   775     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   772         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent );
   776         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent );
   798         if ( ( RMobilePhone::EPhonePasswordRequired == aEvent ) &&
   802         if ( ( RMobilePhone::EPhonePasswordRequired == aEvent ) &&
   799                !iMmPhoneTsy->iBootState.iSecReady &&
   803                !iMmPhoneTsy->iBootState.iSecReady &&
   800                !iIsSecurityCodeRequestCachedInBoot  )
   804                !iIsSecurityCodeRequestCachedInBoot  )
   801 
   805 
   802             {
   806             {
   803 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Caching event");
   807 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYEVENTL_3, "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Caching event");
   804             iIsSecurityCodeRequestCachedInBoot = ETrue;
   808             iIsSecurityCodeRequestCachedInBoot = ETrue;
   805             }
   809             }
   806 
   810 
   807         // Check if the event is a PIN2 requirement
   811         // Check if the event is a PIN2 requirement
   808         if ( aEvent == RMobilePhone::EPin2Required )
   812         if ( aEvent == RMobilePhone::EPin2Required )
   955             return KErrNone;
   959             return KErrNone;
   956             }
   960             }
   957 
   961 
   958         if ( RMobilePhone::ESecurityCodePin1 == *type )
   962         if ( RMobilePhone::ESecurityCodePin1 == *type )
   959             {
   963             {
   960 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN VERIFY REQUESTED");
   964 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_1, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN VERIFY REQUESTED");
   961             iLastPinRequested = EPin1Requested;
   965             iLastPinRequested = EPin1Requested;
   962             }
   966             }
   963         if ( RMobilePhone::ESecurityCodePin2 == *type )
   967         if ( RMobilePhone::ESecurityCodePin2 == *type )
   964             {
   968             {
   965 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN2 VERIFY REQUESTED");
   969 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_2, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN2 VERIFY REQUESTED");
   966             iLastPinRequested = EPin2Requested;
   970             iLastPinRequested = EPin2Requested;
   967             }
   971             }
   968         //This is to prevent unnecessary PIN1 request after PUK code 
   972         //This is to prevent unnecessary PIN1 request after PUK code 
   969         //request. Corrected at the same time with error TKEN-5WFJ7Y
   973         //request. Corrected at the same time with error TKEN-5WFJ7Y
   970         if ( ( ( RMobilePhone::ESecurityCodePuk1 == *type ) ||
   974         if ( ( ( RMobilePhone::ESecurityCodePuk1 == *type ) ||
   971                ( RMobilePhone::ESecurityCodePuk2 == *type ) ) &&  
   975                ( RMobilePhone::ESecurityCodePuk2 == *type ) ) &&  
   972                ( 0 < codes->iUnblockCode.Length() ) )
   976                ( 0 < codes->iUnblockCode.Length() ) )
   973             {
   977             {
   974 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PUK VERIFY REQUESTED");
   978 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_3, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PUK VERIFY REQUESTED");
   975             iPukCodeVerify = ETrue;
   979             iPukCodeVerify = ETrue;
   976             }
   980             }
   977         //This is to prevent unnecessary PIN1 request after phone password
   981         //This is to prevent unnecessary PIN1 request after phone password
   978         //request (PYRA-5UBCLC)
   982         //request (PYRA-5UBCLC)
   979         if ( RMobilePhone::ESecurityCodePhonePassword == *type )
   983         if ( RMobilePhone::ESecurityCodePhonePassword == *type )
   980             {
   984             {
   981 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PHONE PASSWORD VERIFY REQUESTED");
   985 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_4, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PHONE PASSWORD VERIFY REQUESTED");
   982             iPhonePasswordVerify = ETrue;
   986             iPhonePasswordVerify = ETrue;
   983             }
   987             }
   984         iMmPhoneTsy->iMmPhoneExtInterface->DeliverCode( *codes );
   988         iMmPhoneTsy->iMmPhoneExtInterface->DeliverCode( *codes );
   985 
   989 
   986         // CheckSecurityCode needs to set the lock as well, so pass the
   990         // CheckSecurityCode needs to set the lock as well, so pass the
  1069 // ---------------------------------------------------------------------------
  1073 // ---------------------------------------------------------------------------
  1070 //
  1074 //
  1071 void CMmSecurityTsy::CompleteVerifySecurityCodeL(
  1075 void CMmSecurityTsy::CompleteVerifySecurityCodeL(
  1072         TInt aErrorCode ) 
  1076         TInt aErrorCode ) 
  1073     {
  1077     {
  1074 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteVerifySecurityCode - Error:%d", aErrorCode);
  1078 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_1, "TSY: CMmSecurityTsy::CompleteVerifySecurityCode - Error:%d", aErrorCode);
  1075 
  1079 
  1076     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1080     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1077         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneVerifySecurityCode );
  1081         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneVerifySecurityCode );
  1078 
  1082 
  1079     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1083     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1106              ( !iPhonePasswordVerify ) )
  1110              ( !iPhonePasswordVerify ) )
  1107             {
  1111             {
  1108             // IF PIN1 REQUESTED LAST
  1112             // IF PIN1 REQUESTED LAST
  1109             if ( iLastPinRequested == EPin1Requested )
  1113             if ( iLastPinRequested == EPin1Requested )
  1110                 {
  1114                 {
  1111 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN VERIFICATION NEEDED");
  1115 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_2, "TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN VERIFICATION NEEDED");
  1112             	CompleteNotifySecurityEventL( RMobilePhone::EPin1Required,
  1116             	CompleteNotifySecurityEventL( RMobilePhone::EPin1Required,
  1113                 KErrNone );
  1117                 KErrNone );
  1114             	iLastPinRequested = EPinUnknown;
  1118             	iLastPinRequested = EPinUnknown;
  1115                 }
  1119                 }
  1116             // IF PIN2 REQUESTED LAST
  1120             // IF PIN2 REQUESTED LAST
  1117             if (iLastPinRequested == EPin2Requested)
  1121             if (iLastPinRequested == EPin2Requested)
  1118             	{
  1122             	{
  1119 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN2");
  1123 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_3, "TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN2");
  1120             	iLastPinRequested = EPinUnknown;
  1124             	iLastPinRequested = EPinUnknown;
  1121             	}
  1125             	}
  1122             }
  1126             }
  1123         else if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != 
  1127         else if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != 
  1124                   phoneSetLockSettingHandle && EActiveCodeToUpinAskUpin == 
  1128                   phoneSetLockSettingHandle && EActiveCodeToUpinAskUpin == 
  1125                                                       iActiveCodeToUpinState )
  1129                                                       iActiveCodeToUpinState )
  1126             {
  1130             {
  1127 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - iActiveCodeToUpinState = EActiveCodeToUpinAskPin");
  1131 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_4, "TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - iActiveCodeToUpinState = EActiveCodeToUpinAskPin");
  1128             if ( KErrNone == aErrorCode )
  1132             if ( KErrNone == aErrorCode )
  1129                 {
  1133                 {
  1130                 iActiveCodeToUpinState = EActiveCodeToUpinAskPin;
  1134                 iActiveCodeToUpinState = EActiveCodeToUpinAskPin;
  1131                 CompleteNotifySecurityEventL( 
  1135                 CompleteNotifySecurityEventL( 
  1132                     RMobilePhone::EPin1Required, KErrNone );
  1136                     RMobilePhone::EPin1Required, KErrNone );
  1255 // ---------------------------------------------------------------------------
  1259 // ---------------------------------------------------------------------------
  1256 //
  1260 //
  1257 void CMmSecurityTsy::CompleteAbortSecurityCode(
  1261 void CMmSecurityTsy::CompleteAbortSecurityCode(
  1258     TInt aErrorCode )
  1262     TInt aErrorCode )
  1259     {
  1263     {
  1260 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteAbortSecurityCode - Error:%d", aErrorCode);
  1264 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEABORTSECURITYCODE_1, "TSY: CMmSecurityTsy::CompleteAbortSecurityCode - Error:%d", aErrorCode);
  1261 
  1265 
  1262     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1266     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1263         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneAbortSecurityCode );
  1267         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneAbortSecurityCode );
  1264 
  1268 
  1265     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1269     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1288 //
  1292 //
  1289 void CMmSecurityTsy::CompleteGetLockInfo(
  1293 void CMmSecurityTsy::CompleteGetLockInfo(
  1290     CMmDataPackage* aDataPackage, 
  1294     CMmDataPackage* aDataPackage, 
  1291     TInt aErrorCode )
  1295     TInt aErrorCode )
  1292     {
  1296     {
  1293 TFLOGSTRING2("LTSY: CMmSecurityTsy::CompleteGetLockInfo - Error:%d", aErrorCode);
  1297 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEGETLOCKINFO_1, "LTSY: CMmSecurityTsy::CompleteGetLockInfo - Error:%d", aErrorCode);
  1294 
  1298 
  1295     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1299     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1296         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneGetLockInfo );
  1300         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneGetLockInfo );
  1297 
  1301 
  1298     // check if handle is present
  1302     // check if handle is present
  1354 TInt CMmSecurityTsy::GetSecurityCodeInfoL( 
  1358 TInt CMmSecurityTsy::GetSecurityCodeInfoL( 
  1355     const TTsyReqHandle aTsyReqHandle,
  1359     const TTsyReqHandle aTsyReqHandle,
  1356     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1360     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1357     TDes8* aSecurityCodeInfo )
  1361     TDes8* aSecurityCodeInfo )
  1358     {
  1362     {
  1359 TFLOGSTRING("TSY: CMmSecurityTsy::GetSecurityCodeInfoL");
  1363 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_GETSECURITYCODEINFOL_1, "TSY: CMmSecurityTsy::GetSecurityCodeInfoL");
  1360 
  1364 
  1361     TInt ret( KErrNone );
  1365     TInt ret( KErrNone );
  1362     
  1366     
  1363     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5  ) <= 
  1367     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5  ) <= 
  1364         aSecurityCodeInfo->MaxLength() )
  1368         aSecurityCodeInfo->MaxLength() )
  1471 //
  1475 //
  1472 void CMmSecurityTsy::CompleteGetSecurityCodeInfo( 
  1476 void CMmSecurityTsy::CompleteGetSecurityCodeInfo( 
  1473     CMmDataPackage* aDataPackage, 
  1477     CMmDataPackage* aDataPackage, 
  1474     TInt aErrorCode )
  1478     TInt aErrorCode )
  1475     {
  1479     {
  1476 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteGetSecurityCodeInfo");
  1480 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEGETSECURITYCODEINFO_1, "TSY: CMmSecurityTsy::CompleteGetSecurityCodeInfo");
  1477 
  1481 
  1478 	RMobilePhone::TMobilePhoneSecurityCode* securityCode;
  1482 	RMobilePhone::TMobilePhoneSecurityCode* securityCode;
  1479 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5* securityCodeInfoV5;
  1483 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5* securityCodeInfoV5;
  1480 	aDataPackage->UnPackData( &securityCode, &securityCodeInfoV5 );
  1484 	aDataPackage->UnPackData( &securityCode, &securityCodeInfoV5 );
  1481 	
  1485 	
  1517 // ---------------------------------------------------------------------------
  1521 // ---------------------------------------------------------------------------
  1518 //
  1522 //
  1519 TInt CMmSecurityTsy::GetSecurityCodeInfoCancel( 
  1523 TInt CMmSecurityTsy::GetSecurityCodeInfoCancel( 
  1520     TTsyReqHandle aTsyReqHandle )
  1524     TTsyReqHandle aTsyReqHandle )
  1521     {
  1525     {
  1522 TFLOGSTRING("TSY: CMmSecurityTsy::GetSecurityCodeInfoCancel");
  1526 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_GETSECURITYCODEINFOCANCEL_1, "TSY: CMmSecurityTsy::GetSecurityCodeInfoCancel");
  1523 
  1527 
  1524 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
  1528 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
  1525 	TBool reqHandleExist = EFalse;
  1529 	TBool reqHandleExist = EFalse;
  1526 	
  1530 	
  1527 	for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ )
  1531 	for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ )
  1642 //
  1646 //
  1643 TInt CMmSecurityTsy::NotifySecurityCodeInfoChange( 
  1647 TInt CMmSecurityTsy::NotifySecurityCodeInfoChange( 
  1644     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1648     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1645     TDes8* aSecurityCodeInfo )
  1649     TDes8* aSecurityCodeInfo )
  1646     {
  1650     {
  1647 TFLOGSTRING("TSY: CMmSecurityTsy::NotifySecurityCodeInfoChange");
  1651 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYCODEINFOCHANGE_1, "TSY: CMmSecurityTsy::NotifySecurityCodeInfoChange");
  1648 
  1652 
  1649     TInt ret( KErrNone );
  1653     TInt ret( KErrNone );
  1650 
  1654 
  1651     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5 ) <= 
  1655     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5 ) <= 
  1652         aSecurityCodeInfo->MaxLength() )
  1656         aSecurityCodeInfo->MaxLength() )
  1672 //
  1676 //
  1673 void CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange( 
  1677 void CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange( 
  1674     CMmDataPackage* aDataPackage, 
  1678     CMmDataPackage* aDataPackage, 
  1675     TInt aErrorCode )
  1679     TInt aErrorCode )
  1676     {
  1680     {
  1677 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange");
  1681 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYCODEINFOCHANGE_1, "TSY: CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange");
  1678 
  1682 
  1679     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1683     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1680         ResetTsyReqHandle( 
  1684         ResetTsyReqHandle( 
  1681         CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange );
  1685         CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange );
  1682 
  1686 
  1716 // ---------------------------------------------------------------------------
  1720 // ---------------------------------------------------------------------------
  1717 //
  1721 //
  1718 TInt CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel( 
  1722 TInt CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel( 
  1719     TTsyReqHandle aTsyReqHandle )
  1723     TTsyReqHandle aTsyReqHandle )
  1720     {
  1724     {
  1721 TFLOGSTRING("TSY: CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel");
  1725 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYCODEINFOCHANGECANCEL_1, "TSY: CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel");
  1722 
  1726 
  1723     iRetNotifySecurityCodeInfo = NULL;
  1727     iRetNotifySecurityCodeInfo = NULL;
  1724     iRetNotifySecurityCode = NULL;
  1728     iRetNotifySecurityCode = NULL;
  1725 
  1729 
  1726     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( 
  1730     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle(