telephonyserverplugins/common_tsy/commontsy/src/mmtsy/cmmsecuritytsy.cpp
branchRCL_3
changeset 19 630d2f34d719
parent 18 17af172ffa5f
child 20 07a122eea281
equal deleted inserted replaced
18:17af172ffa5f 19:630d2f34d719
    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 
   286 // CMmSecurityTsy::GetLockInfoL
   292 // CMmSecurityTsy::GetLockInfoL
   287 // This method retrieves the current status and setting of a lock.   
   293 // This method retrieves the current status and setting of a lock.   
   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 TTsyReqHandle aTsyReqHandle, const TDataPackage& aPackage ) 
   297 TInt CMmSecurityTsy::GetLockInfoL( const TTsyReqHandle aTsyReqHandle, 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     
   329 //
   335 //
   330 TInt CMmSecurityTsy::NotifyLockInfoChange(
   336 TInt CMmSecurityTsy::NotifyLockInfoChange(
   331     RMobilePhone::TMobilePhoneLock* aLock, 
   337     RMobilePhone::TMobilePhoneLock* aLock, 
   332     TDes8* aLockInfo ) 
   338     TDes8* aLockInfo ) 
   333     {
   339     {
   334 TFLOGSTRING2("LTSY: CMmSecurityTsy::NotifyLockInfoChange - Lock: %d", aLock);
   340 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYLOCKINFOCHANGE_1, "LTSY: CMmSecurityTsy::NotifyLockInfoChange - Lock: %d", aLock);
   335     
   341     
   336     TInt ret( KErrNone );
   342     TInt ret( KErrNone );
   337     
   343     
   338     if ( sizeof ( RMobilePhone::TMobilePhoneLockInfoV1 ) <= 
   344     if ( sizeof ( RMobilePhone::TMobilePhoneLockInfoV1 ) <= 
   339         aLockInfo->MaxLength() )
   345         aLockInfo->MaxLength() )
   360 // ---------------------------------------------------------------------------
   366 // ---------------------------------------------------------------------------
   361 //
   367 //
   362 TInt CMmSecurityTsy::NotifyLockInfoChangeCancel(
   368 TInt CMmSecurityTsy::NotifyLockInfoChangeCancel(
   363     const TTsyReqHandle aTsyReqHandle ) 
   369     const TTsyReqHandle aTsyReqHandle ) 
   364     {
   370     {
   365 TFLOGSTRING("LTSY: CMmSecurityTsy::NotifyLockInfoChangeCancel");
   371 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYLOCKINFOCHANGECANCEL_1, "LTSY: CMmSecurityTsy::NotifyLockInfoChangeCancel");
   366     
   372     
   367     iRetNotifyLockInfoChange = NULL;
   373     iRetNotifyLockInfoChange = NULL;
   368     iRetNotifyPhoneLockChange = NULL;
   374     iRetNotifyPhoneLockChange = NULL;
   369         
   375         
   370     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( 
   376     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( 
   427 //
   433 //
   428 TInt CMmSecurityTsy::SetLockSettingL(
   434 TInt CMmSecurityTsy::SetLockSettingL(
   429     const TTsyReqHandle aTsyReqHandle,    
   435     const TTsyReqHandle aTsyReqHandle,    
   430     const TDataPackage& aPackage ) 
   436     const TDataPackage& aPackage ) 
   431     {
   437     {
   432 TFLOGSTRING("LTSY: CMmSecurityTsy::SetLockSettingL - Client call" );
   438 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_SETLOCKSETTINGL_1, "LTSY: CMmSecurityTsy::SetLockSettingL - Client call" );
   433 
   439 
   434     TInt ret( KErrNone );
   440     TInt ret( KErrNone );
   435 
   441 
   436     // Check if request handle already exists
   442     // Check if request handle already exists
   437     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   443     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   499                                                         ( aPackage.Ptr1() );
   505                                                         ( aPackage.Ptr1() );
   500     RMobilePhone::TMobilePhoneLockSetting* setting = 
   506     RMobilePhone::TMobilePhoneLockSetting* setting = 
   501         reinterpret_cast<RMobilePhone::TMobilePhoneLockSetting* >
   507         reinterpret_cast<RMobilePhone::TMobilePhoneLockSetting* >
   502         ( aPackage.Ptr2() );
   508         ( aPackage.Ptr2() );
   503 
   509 
   504 TFLOGSTRING3("LTSY: CMmSecurityTsy::LockSetting - Lock:%d, Setting:%d",
   510 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_LOCKSETTINGL_1, "LTSY: CMmSecurityTsy::LockSetting - Lock:%d, Setting:%d",*lock, *setting );
   505     *lock, *setting );
       
   506 
   511 
   507     // Some SIM cards might not support PIN1 disable. Thus
   512     // Some SIM cards might not support PIN1 disable. Thus
   508     // return error if client tries to disable it.
   513     // return error if client tries to disable it.
   509     // complete the request immediately with error.
   514     // complete the request immediately with error.
   510     if ( ( RMobilePhone::ELockSetDisabled == *setting ) &&
   515     if ( ( RMobilePhone::ELockSetDisabled == *setting ) &&
   545                     // This is here to prompt PIN query in case of replacing
   550                     // This is here to prompt PIN query in case of replacing
   546                     // PIN1 with UPIN
   551                     // PIN1 with UPIN
   547                     event = RMobilePhone::EUniversalPinRequired;
   552                     event = RMobilePhone::EUniversalPinRequired;
   548                     if ( RMobilePhone::ELockReplaced == *setting )
   553                     if ( RMobilePhone::ELockReplaced == *setting )
   549                         {
   554                         {
   550 TFLOGSTRING("TSY: CMmSecurityTsy::LockSetting RMobilePhone::ELockReplaced");
   555 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_LOCKSETTINGL_2, "TSY: CMmSecurityTsy::LockSetting RMobilePhone::ELockReplaced");
   551                         iActiveCodeToUpinState = EActiveCodeToUpinAskUpin;
   556                         iActiveCodeToUpinState = EActiveCodeToUpinAskUpin;
   552                         }
   557                         }
   553                     break;
   558                     break;
   554                 // This setting is not supported
   559                 // This setting is not supported
   555                 case RMobilePhone::ELockPhoneToFirstICC:
   560                 case RMobilePhone::ELockPhoneToFirstICC:
   606 void CMmSecurityTsy::CompleteSetLockSetting(
   611 void CMmSecurityTsy::CompleteSetLockSetting(
   607     TInt aErrorCode, //Error code
   612     TInt aErrorCode, //Error code
   608     RMobilePhone::TMobilePhoneLockStatus, 
   613     RMobilePhone::TMobilePhoneLockStatus, 
   609     RMobilePhone::TMobilePhoneLockSetting ) 
   614     RMobilePhone::TMobilePhoneLockSetting ) 
   610     {
   615     {
   611 TFLOGSTRING2("LTSY: CMmSecurityTsy::CompleteSetLockSetting - Error:%d", aErrorCode);
   616 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETESETLOCKSETTING_1, "LTSY: CMmSecurityTsy::CompleteSetLockSetting - Error:%d", aErrorCode);
   612 
   617 
   613     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   618     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   614         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting );
   619         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneSetLockSetting );
   615 
   620 
   616     // Check if handle for set lock setting exists
   621     // Check if handle for set lock setting exists
   669 // ---------------------------------------------------------------------------
   674 // ---------------------------------------------------------------------------
   670 //
   675 //
   671 TInt CMmSecurityTsy::CompleteChangeSecurityCode(
   676 TInt CMmSecurityTsy::CompleteChangeSecurityCode(
   672     TInt aErrorCode ) // Error code
   677     TInt aErrorCode ) // Error code
   673     {
   678     {
   674     TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteChangeSecurityCode - Error:%d", aErrorCode);
   679     OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETECHANGESECURITYCODE_1, "TSY: CMmSecurityTsy::CompleteChangeSecurityCode - Error:%d", aErrorCode);
   675 
   680 
   676 
   681 
   677     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   682     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   678         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneChangeSecurityCode );
   683         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneChangeSecurityCode );
   679 
   684 
   706     // security indication as Security server boots up faster than 
   711     // security indication as Security server boots up faster than 
   707     // TSY and has already sent the indications when TSY is loaded.
   712     // TSY and has already sent the indications when TSY is loaded.
   708     // Thus this is the only way to get the information in boot.
   713     // Thus this is the only way to get the information in boot.
   709     if  ( iSecurityCheckedForBoot == EFalse )
   714     if  ( iSecurityCheckedForBoot == EFalse )
   710         {
   715         {
   711 TFLOGSTRING( "TSY: CMmSecurityTsy::NotifySecurityEvent - Checking PIN state");
   716 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYEVENTL_1,  "TSY: CMmSecurityTsy::NotifySecurityEvent - Checking PIN state");
   712         // We can't do anything if sending fails. If this happens,
   717         // We can't do anything if sending fails. If this happens,
   713         // then every send to IsaApi should fail.
   718         // then every send to IsaApi should fail.
   714         (void)iMmPhoneTsy->iMmPhoneExtInterface->GetICCTypeL();
   719         (void)iMmPhoneTsy->iMmPhoneExtInterface->GetICCTypeL();
   715         }
   720         }
   716 
   721 
   717     // If we have cached notification for security code in boot, then
   722     // If we have cached notification for security code in boot, then
   718     // complete it once to client.
   723     // complete it once to client.
   719     if ( iIsSecurityCodeRequestCachedInBoot  && 
   724     if ( iIsSecurityCodeRequestCachedInBoot  && 
   720          !iMmPhoneTsy->iBootState.iSecReady  )
   725          !iMmPhoneTsy->iBootState.iSecReady  )
   721         {
   726         {
   722 TFLOGSTRING( "TSY: CMmSecurityTsy::NotifySecurityEventL - Completing security code event");
   727 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYEVENTL_2,  "TSY: CMmSecurityTsy::NotifySecurityEventL - Completing security code event");
   723 
   728 
   724         CompleteNotifySecurityEventL( RMobilePhone::EPhonePasswordRequired,
   729         CompleteNotifySecurityEventL( RMobilePhone::EPhonePasswordRequired,
   725             KErrNone );
   730             KErrNone );
   726         iIsSecurityCodeRequestCachedInBoot = EFalse;
   731         iIsSecurityCodeRequestCachedInBoot = EFalse;
   727         }
   732         }
   760 //
   765 //
   761 void CMmSecurityTsy::CompleteNotifySecurityEventL(
   766 void CMmSecurityTsy::CompleteNotifySecurityEventL(
   762     RMobilePhone::TMobilePhoneSecurityEvent aEvent, 
   767     RMobilePhone::TMobilePhoneSecurityEvent aEvent, 
   763     TInt aErrorCode ) 
   768     TInt aErrorCode ) 
   764     {
   769     {
   765 TFLOGSTRING3("TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Event: %d, Error: %d",
   770 OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYEVENTL_1, "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Event: %d, Error: %d",aEvent, aErrorCode );
   766     aEvent, aErrorCode );
       
   767 
   771 
   768 	if ( iLastPinRequested != EPinUnknown && 
   772 	if ( iLastPinRequested != EPinUnknown && 
   769 		( RMobilePhone::EPin1Verified == aEvent ) || 
   773 		( RMobilePhone::EPin1Verified == aEvent ) || 
   770 		( RMobilePhone::EPin2Verified == aEvent ) )
   774 		( RMobilePhone::EPin2Verified == aEvent ) )
   771 		{
   775 		{
   772 TFLOGSTRING( "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - iLastPinRequested != EPinUnknown");
   776 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYEVENTL_2,  "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - iLastPinRequested != EPinUnknown");
   773     	iLastPinRequested = EPinUnknown;
   777     	iLastPinRequested = EPinUnknown;
   774         }
   778         }
   775 
   779 
   776     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   780     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
   777         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent );
   781         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneNotifySecurityEvent );
   803         if ( ( RMobilePhone::EPhonePasswordRequired == aEvent ) &&
   807         if ( ( RMobilePhone::EPhonePasswordRequired == aEvent ) &&
   804                !iMmPhoneTsy->iBootState.iSecReady &&
   808                !iMmPhoneTsy->iBootState.iSecReady &&
   805                !iIsSecurityCodeRequestCachedInBoot  )
   809                !iIsSecurityCodeRequestCachedInBoot  )
   806 
   810 
   807             {
   811             {
   808 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Caching event");
   812 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYEVENTL_3, "TSY: CMmSecurityTsy::CompleteNotifySecurityEvent - Caching event");
   809             iIsSecurityCodeRequestCachedInBoot = ETrue;
   813             iIsSecurityCodeRequestCachedInBoot = ETrue;
   810             }
   814             }
   811 
   815 
   812         // Check if the event is a PIN2 requirement
   816         // Check if the event is a PIN2 requirement
   813         if ( aEvent == RMobilePhone::EPin2Required )
   817         if ( aEvent == RMobilePhone::EPin2Required )
   960             return KErrNone;
   964             return KErrNone;
   961             }
   965             }
   962 
   966 
   963         if ( RMobilePhone::ESecurityCodePin1 == *type )
   967         if ( RMobilePhone::ESecurityCodePin1 == *type )
   964             {
   968             {
   965 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN VERIFY REQUESTED");
   969 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_1, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN VERIFY REQUESTED");
   966             iLastPinRequested = EPin1Requested;
   970             iLastPinRequested = EPin1Requested;
   967             }
   971             }
   968         if ( RMobilePhone::ESecurityCodePin2 == *type )
   972         if ( RMobilePhone::ESecurityCodePin2 == *type )
   969             {
   973             {
   970 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN2 VERIFY REQUESTED");
   974 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_2, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PIN2 VERIFY REQUESTED");
   971             iLastPinRequested = EPin2Requested;
   975             iLastPinRequested = EPin2Requested;
   972             }
   976             }
   973         //This is to prevent unnecessary PIN1 request after PUK code 
   977         //This is to prevent unnecessary PIN1 request after PUK code 
   974         //request. Corrected at the same time with error TKEN-5WFJ7Y
   978         //request. Corrected at the same time with error TKEN-5WFJ7Y
   975         if ( ( ( RMobilePhone::ESecurityCodePuk1 == *type ) ||
   979         if ( ( ( RMobilePhone::ESecurityCodePuk1 == *type ) ||
   976                ( RMobilePhone::ESecurityCodePuk2 == *type ) ) &&  
   980                ( RMobilePhone::ESecurityCodePuk2 == *type ) ) &&  
   977                ( 0 < codes->iUnblockCode.Length() ) )
   981                ( 0 < codes->iUnblockCode.Length() ) )
   978             {
   982             {
   979 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PUK VERIFY REQUESTED");
   983 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_3, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PUK VERIFY REQUESTED");
   980             iPukCodeVerify = ETrue;
   984             iPukCodeVerify = ETrue;
   981             }
   985             }
   982         //This is to prevent unnecessary PIN1 request after phone password
   986         //This is to prevent unnecessary PIN1 request after phone password
   983         //request (PYRA-5UBCLC)
   987         //request (PYRA-5UBCLC)
   984         if ( RMobilePhone::ESecurityCodePhonePassword == *type )
   988         if ( RMobilePhone::ESecurityCodePhonePassword == *type )
   985             {
   989             {
   986 TFLOGSTRING("TSY: CMmSecurityTsy::VerifySecurityCodeL - PHONE PASSWORD VERIFY REQUESTED");
   990 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_VERIFYSECURITYCODEL_4, "TSY: CMmSecurityTsy::VerifySecurityCodeL - PHONE PASSWORD VERIFY REQUESTED");
   987             iPhonePasswordVerify = ETrue;
   991             iPhonePasswordVerify = ETrue;
   988             }
   992             }
   989         iMmPhoneTsy->iMmPhoneExtInterface->DeliverCode( *codes );
   993         iMmPhoneTsy->iMmPhoneExtInterface->DeliverCode( *codes );
   990 
   994 
   991         // CheckSecurityCode needs to set the lock as well, so pass the
   995         // CheckSecurityCode needs to set the lock as well, so pass the
  1074 // ---------------------------------------------------------------------------
  1078 // ---------------------------------------------------------------------------
  1075 //
  1079 //
  1076 void CMmSecurityTsy::CompleteVerifySecurityCodeL(
  1080 void CMmSecurityTsy::CompleteVerifySecurityCodeL(
  1077         TInt aErrorCode ) 
  1081         TInt aErrorCode ) 
  1078     {
  1082     {
  1079 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteVerifySecurityCode - Error:%d", aErrorCode);
  1083 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_1, "TSY: CMmSecurityTsy::CompleteVerifySecurityCode - Error:%d", aErrorCode);
  1080 
  1084 
  1081     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1085     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1082         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneVerifySecurityCode );
  1086         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneVerifySecurityCode );
  1083 
  1087 
  1084     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1088     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1111              ( !iPhonePasswordVerify ) )
  1115              ( !iPhonePasswordVerify ) )
  1112             {
  1116             {
  1113             // IF PIN1 REQUESTED LAST
  1117             // IF PIN1 REQUESTED LAST
  1114             if ( iLastPinRequested == EPin1Requested )
  1118             if ( iLastPinRequested == EPin1Requested )
  1115                 {
  1119                 {
  1116 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN VERIFICATION NEEDED");
  1120 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_2, "TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN VERIFICATION NEEDED");
  1117             	CompleteNotifySecurityEventL( RMobilePhone::EPin1Required,
  1121             	CompleteNotifySecurityEventL( RMobilePhone::EPin1Required,
  1118                 KErrNone );
  1122                 KErrNone );
  1119             	iLastPinRequested = EPinUnknown;
  1123             	iLastPinRequested = EPinUnknown;
  1120                 }
  1124                 }
  1121             // IF PIN2 REQUESTED LAST
  1125             // IF PIN2 REQUESTED LAST
  1122             if (iLastPinRequested == EPin2Requested)
  1126             if (iLastPinRequested == EPin2Requested)
  1123             	{
  1127             	{
  1124 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN2");
  1128 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_3, "TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - PIN2");
  1125             	iLastPinRequested = EPinUnknown;
  1129             	iLastPinRequested = EPinUnknown;
  1126             	}
  1130             	}
  1127             }
  1131             }
  1128         else if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != 
  1132         else if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != 
  1129                   phoneSetLockSettingHandle && EActiveCodeToUpinAskUpin == 
  1133                   phoneSetLockSettingHandle && EActiveCodeToUpinAskUpin == 
  1130                                                       iActiveCodeToUpinState )
  1134                                                       iActiveCodeToUpinState )
  1131             {
  1135             {
  1132 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - iActiveCodeToUpinState = EActiveCodeToUpinAskPin");
  1136 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEVERIFYSECURITYCODEL_4, "TSY: CMmSecurityTsy::CompleteVerifySecurityCodeL - iActiveCodeToUpinState = EActiveCodeToUpinAskPin");
  1133             if ( KErrNone == aErrorCode )
  1137             if ( KErrNone == aErrorCode )
  1134                 {
  1138                 {
  1135                 iActiveCodeToUpinState = EActiveCodeToUpinAskPin;
  1139                 iActiveCodeToUpinState = EActiveCodeToUpinAskPin;
  1136                 CompleteNotifySecurityEventL( 
  1140                 CompleteNotifySecurityEventL( 
  1137                     RMobilePhone::EPin1Required, KErrNone );
  1141                     RMobilePhone::EPin1Required, KErrNone );
  1260 // ---------------------------------------------------------------------------
  1264 // ---------------------------------------------------------------------------
  1261 //
  1265 //
  1262 void CMmSecurityTsy::CompleteAbortSecurityCode(
  1266 void CMmSecurityTsy::CompleteAbortSecurityCode(
  1263     TInt aErrorCode )
  1267     TInt aErrorCode )
  1264     {
  1268     {
  1265 TFLOGSTRING2("TSY: CMmSecurityTsy::CompleteAbortSecurityCode - Error:%d", aErrorCode);
  1269 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEABORTSECURITYCODE_1, "TSY: CMmSecurityTsy::CompleteAbortSecurityCode - Error:%d", aErrorCode);
  1266 
  1270 
  1267     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1271     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1268         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneAbortSecurityCode );
  1272         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneAbortSecurityCode );
  1269 
  1273 
  1270     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1274     if ( CMmPhoneTsy::EMultimodePhoneReqHandleUnknown != reqHandle )
  1293 //
  1297 //
  1294 void CMmSecurityTsy::CompleteGetLockInfo(
  1298 void CMmSecurityTsy::CompleteGetLockInfo(
  1295     CMmDataPackage* aDataPackage, 
  1299     CMmDataPackage* aDataPackage, 
  1296     TInt aErrorCode )
  1300     TInt aErrorCode )
  1297     {
  1301     {
  1298 TFLOGSTRING2("LTSY: CMmSecurityTsy::CompleteGetLockInfo - Error:%d", aErrorCode);
  1302 OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEGETLOCKINFO_1, "LTSY: CMmSecurityTsy::CompleteGetLockInfo - Error:%d", aErrorCode);
  1299 
  1303 
  1300     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1304     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1301         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneGetLockInfo );
  1305         ResetTsyReqHandle( CMmPhoneTsy::EMultimodePhoneGetLockInfo );
  1302 
  1306 
  1303     // check if handle is present
  1307     // check if handle is present
  1359 TInt CMmSecurityTsy::GetSecurityCodeInfoL( 
  1363 TInt CMmSecurityTsy::GetSecurityCodeInfoL( 
  1360     const TTsyReqHandle aTsyReqHandle,
  1364     const TTsyReqHandle aTsyReqHandle,
  1361     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1365     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1362     TDes8* aSecurityCodeInfo )
  1366     TDes8* aSecurityCodeInfo )
  1363     {
  1367     {
  1364 TFLOGSTRING("TSY: CMmSecurityTsy::GetSecurityCodeInfoL");
  1368 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_GETSECURITYCODEINFOL_1, "TSY: CMmSecurityTsy::GetSecurityCodeInfoL");
  1365 
  1369 
  1366     TInt ret( KErrNone );
  1370     TInt ret( KErrNone );
  1367     
  1371     
  1368     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5  ) <= 
  1372     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5  ) <= 
  1369         aSecurityCodeInfo->MaxLength() )
  1373         aSecurityCodeInfo->MaxLength() )
  1476 //
  1480 //
  1477 void CMmSecurityTsy::CompleteGetSecurityCodeInfo( 
  1481 void CMmSecurityTsy::CompleteGetSecurityCodeInfo( 
  1478     CMmDataPackage* aDataPackage, 
  1482     CMmDataPackage* aDataPackage, 
  1479     TInt aErrorCode )
  1483     TInt aErrorCode )
  1480     {
  1484     {
  1481 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteGetSecurityCodeInfo");
  1485 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETEGETSECURITYCODEINFO_1, "TSY: CMmSecurityTsy::CompleteGetSecurityCodeInfo");
  1482 
  1486 
  1483 	RMobilePhone::TMobilePhoneSecurityCode* securityCode;
  1487 	RMobilePhone::TMobilePhoneSecurityCode* securityCode;
  1484 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5* securityCodeInfoV5;
  1488 	RMobilePhone::TMobilePhoneSecurityCodeInfoV5* securityCodeInfoV5;
  1485 	aDataPackage->UnPackData( &securityCode, &securityCodeInfoV5 );
  1489 	aDataPackage->UnPackData( &securityCode, &securityCodeInfoV5 );
  1486 	
  1490 	
  1522 // ---------------------------------------------------------------------------
  1526 // ---------------------------------------------------------------------------
  1523 //
  1527 //
  1524 TInt CMmSecurityTsy::GetSecurityCodeInfoCancel( 
  1528 TInt CMmSecurityTsy::GetSecurityCodeInfoCancel( 
  1525     TTsyReqHandle aTsyReqHandle )
  1529     TTsyReqHandle aTsyReqHandle )
  1526     {
  1530     {
  1527 TFLOGSTRING("TSY: CMmSecurityTsy::GetSecurityCodeInfoCancel");
  1531 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_GETSECURITYCODEINFOCANCEL_1, "TSY: CMmSecurityTsy::GetSecurityCodeInfoCancel");
  1528 
  1532 
  1529 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
  1533 	RMobilePhone::TMobilePhoneSecurityCode secCode = RMobilePhone::ESecurityCodePin1;
  1530 	TBool reqHandleExist = EFalse;
  1534 	TBool reqHandleExist = EFalse;
  1531 	
  1535 	
  1532 	for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ )
  1536 	for ( TInt i = 0; i < iGetSecurityCodeInfoRequests.Count(); i++ )
  1647 //
  1651 //
  1648 TInt CMmSecurityTsy::NotifySecurityCodeInfoChange( 
  1652 TInt CMmSecurityTsy::NotifySecurityCodeInfoChange( 
  1649     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1653     RMobilePhone::TMobilePhoneSecurityCode* aSecurityCode, 
  1650     TDes8* aSecurityCodeInfo )
  1654     TDes8* aSecurityCodeInfo )
  1651     {
  1655     {
  1652 TFLOGSTRING("TSY: CMmSecurityTsy::NotifySecurityCodeInfoChange");
  1656 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYCODEINFOCHANGE_1, "TSY: CMmSecurityTsy::NotifySecurityCodeInfoChange");
  1653 
  1657 
  1654     TInt ret( KErrNone );
  1658     TInt ret( KErrNone );
  1655 
  1659 
  1656     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5 ) <= 
  1660     if ( sizeof ( RMobilePhone::TMobilePhoneSecurityCodeInfoV5 ) <= 
  1657         aSecurityCodeInfo->MaxLength() )
  1661         aSecurityCodeInfo->MaxLength() )
  1677 //
  1681 //
  1678 void CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange( 
  1682 void CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange( 
  1679     CMmDataPackage* aDataPackage, 
  1683     CMmDataPackage* aDataPackage, 
  1680     TInt aErrorCode )
  1684     TInt aErrorCode )
  1681     {
  1685     {
  1682 TFLOGSTRING("TSY: CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange");
  1686 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_COMPLETENOTIFYSECURITYCODEINFOCHANGE_1, "TSY: CMmSecurityTsy::CompleteNotifySecurityCodeInfoChange");
  1683 
  1687 
  1684     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1688     TTsyReqHandle reqHandle = iMmPhoneTsy->iTsyReqHandleStore->
  1685         ResetTsyReqHandle( 
  1689         ResetTsyReqHandle( 
  1686         CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange );
  1690         CMmPhoneTsy::EMultimodePhoneNotifySecurityCodeInfoChange );
  1687 
  1691 
  1721 // ---------------------------------------------------------------------------
  1725 // ---------------------------------------------------------------------------
  1722 //
  1726 //
  1723 TInt CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel( 
  1727 TInt CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel( 
  1724     TTsyReqHandle aTsyReqHandle )
  1728     TTsyReqHandle aTsyReqHandle )
  1725     {
  1729     {
  1726 TFLOGSTRING("TSY: CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel");
  1730 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CMMSECURITYTSY_NOTIFYSECURITYCODEINFOCHANGECANCEL_1, "TSY: CMmSecurityTsy::NotifySecurityCodeInfoChangeCancel");
  1727 
  1731 
  1728     iRetNotifySecurityCodeInfo = NULL;
  1732     iRetNotifySecurityCodeInfo = NULL;
  1729     iRetNotifySecurityCode = NULL;
  1733     iRetNotifySecurityCode = NULL;
  1730 
  1734 
  1731     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle( 
  1735     iMmPhoneTsy->iTsyReqHandleStore->ResetTsyReqHandle(