1 /* |
1 /* |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
8 * |
8 * |
9 * Initial Contributors: |
9 * Initial Contributors: |
10 * Nokia Corporation - initial contribution. |
10 * Nokia Corporation - initial contribution. |
11 * |
11 * |
12 * Contributors: |
12 * Contributors: |
13 * |
13 * |
14 * Description: Basic PIN query operation in secui dialog |
14 * Description: Basic PIN query operation in secui dialog |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include "secuidialogoperbasicpinquery.h" // CBasicPinQueryOperation |
18 #include "secuidialogoperbasicpinquery.h" // CBasicPinQueryOperation |
19 #include "secuidialogoperationobserver.h" // MSecuiDialogOperationObserver |
19 #include "secuidialogoperationobserver.h" // MSecuiDialogOperationObserver |
20 #include <hb/hbcore/hbtextresolversymbian.h> // HbTextResolverSymbian |
20 #include <hb/hbcore/hbtextresolversymbian.h> // HbTextResolverSymbian |
21 #include "secuidialogstrace.h" // TRACE macro |
21 #include "secuidialogstrace.h" // TRACE macro |
22 |
|
23 // TODO: fix this |
22 // TODO: fix this |
24 #include "../../../securitydialogs/SecUi/Inc/SecQueryUi.h" // CSecQueryUi |
23 #include "../../../securitydialogs/SecUi/Inc/SecQueryUi.h" // CSecQueryUi |
25 |
|
26 #include <secui.h> |
24 #include <secui.h> |
27 #include <secuisecurityhandler.h> |
25 #include <secuisecurityhandler.h> |
28 #include <gsmerror.h> |
26 #include <gsmerror.h> |
29 #include <etelmm.h> |
27 #include <etelmm.h> |
30 #include <rmmcustomapi.h> |
28 #include <rmmcustomapi.h> |
31 #include <startupdomainpskeys.h> |
29 #include <startupdomainpskeys.h> |
32 #include <featmgr.h> |
30 #include <featmgr.h> |
33 |
31 |
34 const TInt KPhoneIndex( 0 ); |
32 const TInt KPhoneIndex(0); |
35 const TInt KTriesToConnectServer( 2 ); |
33 const TInt KTriesToConnectServer(2); |
36 const TInt KTimeBeforeRetryingServerConnection( 50000 ); |
34 const TInt KTimeBeforeRetryingServerConnection(50000); |
37 |
35 |
38 _LIT( KMmTsyModuleName, "PhoneTsy"); |
36 _LIT( KMmTsyModuleName, "PhoneTsy"); |
39 |
|
40 // Descriptors for different password queries |
|
41 _LIT( KBasicPinQueryKeyStorePassphrase, "Key store passphrase" ); |
|
42 _LIT( KBasicPinQueryNewKeyStorePassphrase, "New key store passphrase" ); |
|
43 _LIT( KBasicPinQueryImportedKeyFilePassphrase, "Passphrase of the imported key file" ); |
|
44 _LIT( KBasicPinQueryExportedKeyFilePassphrase, "Passphrase of the exported key file" ); |
|
45 _LIT( KBasicPinQueryPKCS12, "PKCS12"); |
|
46 |
|
47 |
|
48 |
|
49 |
37 |
50 // ======== MEMBER FUNCTIONS ======== |
38 // ======== MEMBER FUNCTIONS ======== |
51 |
39 |
52 // --------------------------------------------------------------------------- |
40 // --------------------------------------------------------------------------- |
53 // CBasicPinQueryOperation::NewL() |
41 // CBasicPinQueryOperation::NewL() |
54 // --------------------------------------------------------------------------- |
42 // --------------------------------------------------------------------------- |
55 // |
43 // |
56 CBasicPinQueryOperation* CBasicPinQueryOperation::NewL( |
44 CBasicPinQueryOperation* CBasicPinQueryOperation::NewL(MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, TInt aReplySlot) |
57 MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, |
45 { |
58 TInt aReplySlot ) |
46 RDEBUG("aMessage.Handle()", aMessage.Handle()); |
59 { |
47 RDEBUG("aMessage.Function()", aMessage.Function()); |
60 TRACE( "CBasicPinQueryOperation::NewL, aMessage 0x%08x", aMessage.Handle() ); |
48 return new (ELeave) CBasicPinQueryOperation(aObserver, aMessage, aReplySlot); |
61 TRACE( "CBasicPinQueryOperation::NewL, aMessage.Function = 0x%08x", aMessage.Function() ); |
|
62 return new( ELeave ) CBasicPinQueryOperation( aObserver, aMessage, aReplySlot ); |
|
63 } |
49 } |
64 |
50 |
65 // --------------------------------------------------------------------------- |
51 // --------------------------------------------------------------------------- |
66 // CBasicPinQueryOperation::~CBasicPinQueryOperation() |
52 // CBasicPinQueryOperation::~CBasicPinQueryOperation() |
67 // --------------------------------------------------------------------------- |
53 // --------------------------------------------------------------------------- |
68 // |
54 // |
69 CBasicPinQueryOperation::~CBasicPinQueryOperation() |
55 CBasicPinQueryOperation::~CBasicPinQueryOperation() |
70 { |
56 { |
71 TRACE( "CBasicPinQueryOperation::~CBasicPinQueryOperation" ); |
57 RDEBUG("0", 0); |
72 Cancel(); |
58 Cancel(); |
73 iPinInput = NULL; // not owned |
59 iPinInput = NULL; // not owned |
74 } |
60 } |
75 |
61 |
76 // --------------------------------------------------------------------------- |
62 // --------------------------------------------------------------------------- |
77 // CBasicPinQueryOperation::StartL() |
63 // CBasicPinQueryOperation::StartL() |
78 // --------------------------------------------------------------------------- |
64 // --------------------------------------------------------------------------- |
79 // |
65 // |
80 void CBasicPinQueryOperation::StartL( const TDesC8& aBuffer ) |
66 void CBasicPinQueryOperation::StartL(const TDesC8& aBuffer) |
81 { |
67 { |
82 TRACE( "CBasicPinQueryOperation::StartL" ); |
68 RDEBUG("0", 0); |
83 iPinInput = reinterpret_cast< const TPINInput* >( aBuffer.Ptr() ); |
69 iPinInput = reinterpret_cast<const TPINInput*> (aBuffer.Ptr()); |
84 ASSERT( iPinInput != NULL ); |
70 ASSERT(iPinInput != NULL); |
85 |
71 |
86 iStatus = KRequestPending; |
72 iStatus = KRequestPending; |
87 TRequestStatus* status = &iStatus; |
73 TRequestStatus* status = &iStatus; |
88 User::RequestComplete( status, KErrNone ); |
74 User::RequestComplete(status, KErrNone); |
89 SetActive(); |
75 SetActive(); |
90 } |
76 } |
91 |
77 |
92 // --------------------------------------------------------------------------- |
78 // --------------------------------------------------------------------------- |
93 // CBasicPinQueryOperation::CancelOperation() |
79 // CBasicPinQueryOperation::CancelOperation() |
94 // --------------------------------------------------------------------------- |
80 // --------------------------------------------------------------------------- |
95 // |
81 // |
96 void CBasicPinQueryOperation::CancelOperation() |
82 void CBasicPinQueryOperation::CancelOperation() |
97 { |
83 { |
98 TRACE( "CBasicPinQueryOperation::CancelOperation" ); |
84 RDEBUG("0", 0); |
99 // nothing to do |
85 // nothing to do |
100 } |
86 } |
101 |
87 |
102 // --------------------------------------------------------------------------- |
88 // --------------------------------------------------------------------------- |
103 // CBasicPinQueryOperation::RunL() |
89 // CBasicPinQueryOperation::RunL() |
104 // --------------------------------------------------------------------------- |
90 // --------------------------------------------------------------------------- |
105 // |
91 // |
106 void CBasicPinQueryOperation::RunL() |
92 void CBasicPinQueryOperation::RunL() |
107 { |
93 { |
108 TRACE( "CBasicPinQueryOperation::RunL, iStatus.Int()=%d", iStatus.Int() ); |
94 RDEBUG("iStatus.Int()", iStatus.Int()); |
109 User::LeaveIfError( iStatus.Int() ); |
95 User::LeaveIfError(iStatus.Int()); |
110 |
96 |
111 TBool isRetry = ( iPinInput->iOperation & EPINValueIncorrect ); |
97 TBool isRetry = (iPinInput->iOperation & EPINValueIncorrect); |
112 if( isRetry ) |
98 if (isRetry) |
113 { |
99 { |
114 // Show "Invalid PIN code" error note, as previous attempt was failed. |
100 // Show "Invalid PIN code" error note, as previous attempt was failed. |
115 // TODO: localized UI string needed |
101 // TODO: localized UI string needed |
116 _LIT( KInvalidPinCode, "Invalid PIN code" ); |
102 _LIT(KInvalidPinCode, "Invalid PIN code"); |
117 ShowWarningNoteL( KInvalidPinCode ); |
103 ShowWarningNoteL( KInvalidPinCode); |
118 } |
104 } |
119 TRACE( "CBasicPinQueryOperation::RunL, iPinInput->iOperation=%d", iPinInput->iOperation ); |
105 RDEBUG("iPinInput->iOperation", iPinInput->iOperation); |
120 |
106 |
121 HBufC* caption = NULL; |
107 iPinValue.Copy(_L("0")); |
122 if( iPinInput->iPIN.iPINLabel == KBasicPinQueryKeyStorePassphrase ) |
108 RDEBUG("0", 0); |
|
109 |
|
110 TInt resultVerif = KErrNone; |
|
111 RDEBUG("0", 0); |
|
112 |
123 { |
113 { |
124 TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryKeyStorePassphrase =%d", 1 ); |
114 RMobilePhone iPhone; |
125 |
115 |
126 // TODO: localized UI string needed |
116 TInt err(KErrGeneral); |
127 _LIT( KText, "Keystore password:" ); |
117 RDEBUG("ESecurityQueryActive", ESecurityQueryActive); |
128 caption = KText().AllocLC(); |
118 err = RProperty::Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryActive); |
|
119 RDEBUG("err", err); |
|
120 |
|
121 TInt thisTry(0); |
|
122 RTelServer iTelServer; |
|
123 RMmCustomAPI iCustomPhone; |
|
124 while ((err = iTelServer.Connect()) != KErrNone && (thisTry++) <= KTriesToConnectServer) |
|
125 { |
|
126 User::After( KTimeBeforeRetryingServerConnection); |
|
127 } |
|
128 err = iTelServer.LoadPhoneModule(KMmTsyModuleName); |
|
129 RTelServer::TPhoneInfo PhoneInfo; |
|
130 err = iTelServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended); |
|
131 err = iTelServer.GetPhoneInfo(KPhoneIndex, PhoneInfo); |
|
132 err = iPhone.Open(iTelServer, PhoneInfo.iName); |
|
133 err = iCustomPhone.Open(iPhone); |
|
134 RDEBUG("err", err); |
|
135 CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); |
|
136 CleanupStack::PushL(handler); |
|
137 // TSecUi::InitializeLibL(); |
|
138 RDEBUG("0", 0); |
|
139 RMobilePhone::TMobilePhoneSecurityEvent iEvent; |
|
140 TInt lEvent = iPinInput->iOperation; |
|
141 RDEBUG("lEvent", lEvent); |
|
142 if (lEvent >= 0x1000) // flag for iStartUp |
|
143 { |
|
144 lEvent -= 0x1000; |
|
145 } |
|
146 iEvent = static_cast<RMobilePhone::TMobilePhoneSecurityEvent> (lEvent); |
|
147 RDEBUG("iEvent", iEvent); |
|
148 RDEBUG("iStartUp", iStartUp); |
|
149 TRAPD(resultHandler, handler->HandleEventL(iEvent, iStartUp, resultVerif)); |
|
150 RDEBUG("resultHandler", resultHandler); |
|
151 RDEBUG("resultVerif", resultVerif); |
|
152 |
|
153 // if something went wrong cancel the code request |
|
154 if (resultHandler) |
|
155 { |
|
156 if (resultVerif == KErrNone) // if the process failed, then the result shoud also indicate the failure (unless it does it already) |
|
157 resultVerif = resultHandler; |
|
158 RDEBUG("iEvent", iEvent); |
|
159 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
|
160 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
|
161 switch (iEvent) |
|
162 { |
|
163 case RMobilePhone::EUniversalPinRequired: |
|
164 if (wcdmaSupported || upinSupported) |
|
165 { |
|
166 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); |
|
167 } |
|
168 break; |
|
169 case RMobilePhone::EUniversalPukRequired: |
|
170 if (wcdmaSupported || upinSupported) |
|
171 { |
|
172 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPuk); |
|
173 } |
|
174 break; |
|
175 case RMobilePhone::EPin1Required: |
|
176 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); |
|
177 break; |
|
178 case RMobilePhone::EPuk1Required: |
|
179 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk1); |
|
180 break; |
|
181 case RMobilePhone::EPin2Required: |
|
182 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); |
|
183 break; |
|
184 case RMobilePhone::EPuk2Required: |
|
185 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk2); |
|
186 break; |
|
187 case RMobilePhone::EPhonePasswordRequired: |
|
188 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); |
|
189 break; |
|
190 default: |
|
191 RDEBUG("default iEvent", iEvent); |
|
192 break; |
|
193 } |
|
194 } |
|
195 |
|
196 // uninitialize security ui |
|
197 RDEBUG("PopAndDestroy 0", 0); |
|
198 CleanupStack::PopAndDestroy(handler); // handler |
|
199 RDEBUG("UnInitializeLib 0", 0); |
|
200 TSecUi::UnInitializeLib(); |
|
201 RDEBUG("ESecurityQueryNotActive", ESecurityQueryNotActive); |
|
202 err = RProperty::Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryNotActive); |
|
203 RDEBUG("err", err); |
|
204 //close ETel connection |
|
205 if (iTelServer.Handle()) |
|
206 { |
|
207 RDEBUG("iPhone.Close()", 0); |
|
208 iPhone.Close(); |
|
209 iTelServer.UnloadPhoneModule(KMmTsyModuleName); |
|
210 iTelServer.Close(); |
|
211 RDEBUG("0", 0); |
|
212 } |
129 } |
213 } |
130 else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryNewKeyStorePassphrase ) |
214 |
|
215 ReturnResultL(resultVerif); |
|
216 |
|
217 } |
|
218 |
|
219 // --------------------------------------------------------------------------- |
|
220 // CBasicPinQueryOperation::DoCancel() |
|
221 // --------------------------------------------------------------------------- |
|
222 // |
|
223 void CBasicPinQueryOperation::DoCancel() |
|
224 { |
|
225 RDEBUG("0", 0); |
|
226 } |
|
227 |
|
228 // --------------------------------------------------------------------------- |
|
229 // CBasicPinQueryOperation::CBasicPinQueryOperation() |
|
230 // --------------------------------------------------------------------------- |
|
231 // |
|
232 CBasicPinQueryOperation::CBasicPinQueryOperation(MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, TInt aReplySlot) : |
|
233 CSecuiDialogOperation(aObserver, aMessage, aReplySlot) |
|
234 { |
|
235 RDEBUG("aMessage.Handle()", aMessage.Handle()); |
|
236 RDEBUG("aMessage.Function()", aMessage.Function()); |
|
237 iStartUp = EFalse; |
|
238 if (aMessage.Function() >= 0x1000) |
|
239 iStartUp = ETrue; |
|
240 } |
|
241 |
|
242 // --------------------------------------------------------------------------- |
|
243 // CBasicPinQueryOperation::ReturnResultL() |
|
244 // --------------------------------------------------------------------------- |
|
245 // |
|
246 void CBasicPinQueryOperation::ReturnResultL(TInt aErrorCode) |
|
247 { |
|
248 RDEBUG("aErrorCode", aErrorCode); |
|
249 if (aErrorCode <= KErrNone) // TODO should skip WriteL is error? |
131 { |
250 { |
132 TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryNewKeyStorePassphrase =%d", 1 ); |
251 TPINValueBuf output(iPinValue); |
133 |
252 iMessage.WriteL(iReplySlot, output); |
134 // "Keystore password must be created for using private keys." |
|
135 // SecUi creates two input fields when caption contains two labels |
|
136 // separated with a vertical bar. SecUi verifies that user types the |
|
137 // same passphrase in both fields. |
|
138 // TODO: localized UI strings needed |
|
139 _LIT( KText, "Create keystore password:|Verify:" ); |
|
140 caption = KText().AllocLC(); |
|
141 } |
253 } |
142 else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryImportedKeyFilePassphrase ) |
254 RDEBUG("Complete iMessage.Handle()", iMessage.Handle()); |
143 { |
255 iMessage.Complete(aErrorCode); |
144 TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryImportedKeyFilePassphrase =%d", 1 ); |
256 RDEBUG("informing observer 0", 0); |
145 |
|
146 // "Enter code for imported key:" |
|
147 // TODO: localized UI strings needed |
|
148 _LIT( KText, "Enter code for imported key:|Verify:" ); |
|
149 caption = KText().AllocLC(); |
|
150 } |
|
151 else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryExportedKeyFilePassphrase ) |
|
152 { |
|
153 TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryExportedKeyFilePassphrase =%d", 1 ); |
|
154 |
|
155 // "Enter new code for exported key:" |
|
156 // TODO: localized UI strings needed |
|
157 _LIT( KText, "Enter new code for exported key:|Verify:" ); |
|
158 caption = KText().AllocLC(); |
|
159 } |
|
160 else if( iPinInput->iPIN.iPINLabel == KBasicPinQueryPKCS12 ) |
|
161 { |
|
162 TRACE( "CBasicPinQueryOperation::RunL, KBasicPinQueryPKCS12 =%d", 1 ); |
|
163 |
|
164 // "Password for %U:", PKCS#12 password query prompt |
|
165 // TODO: localized UI string needed |
|
166 _LIT( KText, "Password for PKCS#12 file:" ); |
|
167 caption = KText().AllocLC(); |
|
168 } |
|
169 else |
|
170 { |
|
171 TRACE( "CBasicPinQueryOperation::RunL, else =%d", 1 ); |
|
172 |
|
173 // "Enter code for %0U in %1U" |
|
174 // Data query for PIN request in keystore where %0U is the PIN's name %1U is the keystore's name. |
|
175 // TODO: EEnterPinNR |
|
176 _LIT( KText, "86" ); |
|
177 caption = KText().AllocLC(); |
|
178 } |
|
179 iPinValue.Copy(_L("0")); |
|
180 TRACE( "CBasicPinQueryOperation::RunL, 1 =%d", 1 ); |
|
181 |
|
182 TInt resultVerif = KErrNone; |
|
183 TRACE( "CBasicPinQueryOperation::RunL, 1 =%d", 1 ); |
|
184 |
|
185 { |
|
186 RMobilePhone iPhone; |
|
187 |
|
188 TInt err( KErrGeneral); |
|
189 TRACE( "CBasicPinQueryOperation::RunL, ESecurityQueryActive =%d", ESecurityQueryActive ); |
|
190 err = RProperty::Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryActive); |
|
191 TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); |
|
192 |
|
193 TInt thisTry( 0); |
|
194 RTelServer iTelServer; |
|
195 RMmCustomAPI iCustomPhone; |
|
196 while ( ( err = iTelServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
|
197 { |
|
198 User::After( KTimeBeforeRetryingServerConnection ); |
|
199 } |
|
200 err = iTelServer.LoadPhoneModule( KMmTsyModuleName ); |
|
201 RTelServer::TPhoneInfo PhoneInfo; |
|
202 err = iTelServer.SetExtendedErrorGranularity( RTelServer::EErrorExtended ) ; |
|
203 err = iTelServer.GetPhoneInfo( KPhoneIndex, PhoneInfo ) ; |
|
204 err = iPhone.Open( iTelServer, PhoneInfo.iName ) ; |
|
205 err = iCustomPhone.Open( iPhone ) ; |
|
206 TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); |
|
207 CSecurityHandler* handler = new(ELeave) CSecurityHandler(iPhone); |
|
208 CleanupStack::PushL(handler); |
|
209 // TSecUi::InitializeLibL(); |
|
210 TRACE( "CBasicPinQueryOperation::RunL, TMobilePhoneSecurityEvent 1 =%d", 1 ); |
|
211 RMobilePhone::TMobilePhoneSecurityEvent iEvent; |
|
212 TInt lEvent = iPinInput->iOperation; |
|
213 TRACE( "CBasicPinQueryOperation::RunL, lEvent =%d", lEvent ); |
|
214 if( lEvent >= 0x1000 ) // flag for iStartUp |
|
215 { |
|
216 lEvent-=0x1000; |
|
217 } |
|
218 iEvent = static_cast<RMobilePhone::TMobilePhoneSecurityEvent>(lEvent); |
|
219 TRACE( "CBasicPinQueryOperation::RunL, iEvent =%d", iEvent ); |
|
220 TRACE( "CBasicPinQueryOperation::RunL, TBool iStartUp =%d", iStartUp ); |
|
221 TRAPD( resultHandler, handler->HandleEventL( iEvent, iStartUp, resultVerif ) ); |
|
222 TRACE( "CBasicPinQueryOperation::RunL, resultHandler =%d", resultHandler ); |
|
223 TRACE( "CBasicPinQueryOperation::RunL, resultVerif =%d", resultVerif ); |
|
224 |
|
225 // if something went wrong cancel the code request |
|
226 if (resultHandler) |
|
227 { |
|
228 if(resultVerif==KErrNone) // if the process failed, then the result shoud also indicate the failure (unless it does it already) |
|
229 resultVerif = resultHandler; |
|
230 TRACE( "CBasicPinQueryOperation::RunL, iEvent =%d", iEvent ); |
|
231 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
|
232 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
|
233 switch (iEvent) |
|
234 { |
|
235 case RMobilePhone::EUniversalPinRequired: |
|
236 if(wcdmaSupported || upinSupported) |
|
237 { |
|
238 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); |
|
239 } |
|
240 break; |
|
241 case RMobilePhone::EUniversalPukRequired: |
|
242 if(wcdmaSupported || upinSupported) |
|
243 { |
|
244 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPuk); |
|
245 } |
|
246 break; |
|
247 case RMobilePhone::EPin1Required: |
|
248 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); |
|
249 break; |
|
250 case RMobilePhone::EPuk1Required: |
|
251 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk1); |
|
252 break; |
|
253 case RMobilePhone::EPin2Required: |
|
254 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); |
|
255 break; |
|
256 case RMobilePhone::EPuk2Required: |
|
257 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePuk2); |
|
258 break; |
|
259 case RMobilePhone::EPhonePasswordRequired: |
|
260 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); |
|
261 break; |
|
262 default: |
|
263 TRACE( "CBasicPinQueryOperation::RunL, default iEvent =%d", iEvent ); |
|
264 break; |
|
265 } |
|
266 } |
|
267 |
|
268 // uninitialize security ui |
|
269 TRACE( "CBasicPinQueryOperation::RunL, PopAndDestroy(handler) =%d", 0 ); |
|
270 CleanupStack::PopAndDestroy(handler); // handler |
|
271 TRACE( "CBasicPinQueryOperation::RunL, UnInitializeLib =%d", 1 ); |
|
272 TSecUi::UnInitializeLib(); |
|
273 TRACE( "CBasicPinQueryOperation::RunL, ESecurityQueryNotActive =%d", ESecurityQueryNotActive ); |
|
274 err = RProperty::Set(KPSUidStartup, KStartupSecurityCodeQueryStatus, ESecurityQueryNotActive); |
|
275 TRACE( "CBasicPinQueryOperation::RunL, err =%d", err ); |
|
276 //close ETel connection |
|
277 if (iTelServer.Handle()) |
|
278 { |
|
279 TRACE( "CBasicPinQueryOperation::RunL, iPhone.Close =%d", 0 ); |
|
280 iPhone.Close(); |
|
281 iTelServer.UnloadPhoneModule(KMmTsyModuleName); |
|
282 iTelServer.Close(); |
|
283 TRACE( "CBasicPinQueryOperation::RunL, iTelServer.Close =%d", 1 ); |
|
284 } |
|
285 } |
|
286 |
|
287 |
|
288 ReturnResultL( resultVerif ); |
|
289 |
|
290 if( caption ) |
|
291 { |
|
292 CleanupStack::PopAndDestroy( caption ); |
|
293 caption = NULL; |
|
294 } |
|
295 } |
|
296 |
|
297 // --------------------------------------------------------------------------- |
|
298 // CBasicPinQueryOperation::DoCancel() |
|
299 // --------------------------------------------------------------------------- |
|
300 // |
|
301 void CBasicPinQueryOperation::DoCancel() |
|
302 { |
|
303 TRACE( "CBasicPinQueryOperation::DoCancel" ); |
|
304 } |
|
305 |
|
306 // --------------------------------------------------------------------------- |
|
307 // CBasicPinQueryOperation::CBasicPinQueryOperation() |
|
308 // --------------------------------------------------------------------------- |
|
309 // |
|
310 CBasicPinQueryOperation::CBasicPinQueryOperation( |
|
311 MSecuiDialogOperationObserver& aObserver, const RMessage2& aMessage, |
|
312 TInt aReplySlot ) : CSecuiDialogOperation( aObserver, aMessage, aReplySlot ) |
|
313 { |
|
314 TRACE( "CBasicPinQueryOperation::CBasicPinQueryOperation, aMessage 0x%08x", aMessage.Handle() ); |
|
315 TRACE( "CBasicPinQueryOperation::CBasicPinQueryOperation, aMessage.Function = 0x%08x", aMessage.Function() ); |
|
316 iStartUp=EFalse; |
|
317 if(aMessage.Function()>=0x1000) |
|
318 iStartUp=ETrue; |
|
319 } |
|
320 |
|
321 // --------------------------------------------------------------------------- |
|
322 // CBasicPinQueryOperation::ReturnResultL() |
|
323 // --------------------------------------------------------------------------- |
|
324 // |
|
325 void CBasicPinQueryOperation::ReturnResultL( TInt aErrorCode ) |
|
326 { |
|
327 TRACE( "CBasicPinQueryOperation::ReturnResultL, begin, aErrorCode=%d", aErrorCode ); |
|
328 if( aErrorCode <= KErrNone ) // TODO should skip WriteL is error? |
|
329 { |
|
330 TPINValueBuf output( iPinValue ); |
|
331 iMessage.WriteL( iReplySlot, output ); |
|
332 } |
|
333 TRACE( "CBasicPinQueryOperation::ReturnResultL, completing msg 0x%08x", iMessage.Handle() ); |
|
334 iMessage.Complete( aErrorCode ); |
|
335 TRACE( "CBasicPinQueryOperation::ReturnResultL, informing observer" ); |
|
336 iObserver.OperationComplete(); |
257 iObserver.OperationComplete(); |
337 TRACE( "CBasicPinQueryOperation::ReturnResultL, end" ); |
258 RDEBUG("0x99", 0x99); |
338 } |
259 } |
339 |
260 |