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