1 /* |
1 /* |
2 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2002 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: Provides api for handling security events. |
14 * Description: Provides api for handling security events. |
15 * |
15 * |
16 * |
16 * |
17 */ |
17 */ |
18 |
18 #include <e32notif.h> |
19 |
|
20 #include <aknnotedialog.h> |
19 #include <aknnotedialog.h> |
21 #include <etelmm.h> |
20 #include <etelmm.h> |
22 #include <SecUi.rsg> |
21 // #include <SecUi.rsg> |
23 #include <exterror.h> |
22 #include <exterror.h> |
24 #include <textresolver.h> |
23 #include <textresolver.h> |
25 |
24 |
26 #ifdef __COVER_DISPLAY |
25 #ifdef __COVER_DISPLAY |
27 #include <aknmediatorfacade.h> |
26 #include <aknmediatorfacade.h> |
28 #include <secondarydisplay/SecondaryDisplayStartupAPI.h> |
|
29 #endif //__COVER_DISPLAY |
27 #endif //__COVER_DISPLAY |
30 |
|
31 #include <centralrepository.h> |
28 #include <centralrepository.h> |
32 #include <starterclient.h> //used for RemoveSplashScreen |
|
33 #include <e32property.h> |
29 #include <e32property.h> |
|
30 |
34 #include <PSVariables.h> // Property values |
31 #include <PSVariables.h> // Property values |
35 #include <coreapplicationuisdomainpskeys.h> |
32 #include <coreapplicationuisdomainpskeys.h> |
36 #include <startupdomainpskeys.h> |
33 #include <startupdomainpskeys.h> |
37 #include <uikon/eiksrvui.h> |
34 // #include <uikon/eiksrvui.h> |
38 #include <settingsinternalcrkeys.h> |
35 #include <settingsinternalcrkeys.h> |
39 #include <securityuisprivatepskeys.h> |
36 #include <securityuisprivatepskeys.h> |
40 #include <AknNotiferAppServerApplication.h> |
37 // #include <AknNotiferAppServerApplication.h> |
41 |
38 |
42 #include <SCPClient.h> |
39 #include <SCPClient.h> |
43 #include <securitynotification.h> |
40 #include <securitynotification.h> |
44 #include "secui.hrh" |
41 #include "secui.hrh" |
|
42 #include "SecUi.h" |
45 #include "secuisecurityhandler.h" |
43 #include "secuisecurityhandler.h" |
46 #include "secuicodequerydialog.h" |
44 #include "secuicodequerydialog.h" |
47 #include "secuisecuritysettings.h" |
45 #include "secuisecuritysettings.h" |
48 #include "SecUiWait.h" |
46 #include "SecUiWait.h" |
49 #include "SecUiLockObserver.h" |
47 // #include "SecUiLockObserver.h" |
50 #ifdef RD_REMOTELOCK |
|
51 #include <RemoteLockSettings.h> |
48 #include <RemoteLockSettings.h> |
52 #endif // RD_REMOTELOCK |
|
53 #include <StringLoader.h> |
49 #include <StringLoader.h> |
54 #include <featmgr.h> |
50 #include <featmgr.h> |
|
51 #include <hb/hbcore/hbtextresolversymbian.h> |
|
52 |
|
53 #include "SecQueryUi.h" |
|
54 |
55 // LOCAL CONSTANTS AND MACROS |
55 // LOCAL CONSTANTS AND MACROS |
56 const TInt KMaxNumberOfPUKAttempts(10); |
56 const TInt KMaxNumberOfPUKAttempts(10); |
57 const TInt KMaxNumberOfPINAttempts(3); |
57 const TInt KMaxNumberOfPINAttempts(3); |
58 const TInt KLastRemainingInputAttempt(1); |
58 // not used |
59 |
59 // const TInt KLastRemainingInputAttempt(1); |
60 const TInt KTriesToConnectServer( 2 ); |
60 |
61 const TInt KTimeBeforeRetryingRequest( 50000 ); |
61 const TInt KTriesToConnectServer(2); |
|
62 const TInt KTimeBeforeRetryingRequest(50000); |
62 |
63 |
63 // ================= MEMBER FUNCTIONS ======================= |
64 // ================= MEMBER FUNCTIONS ======================= |
64 // |
65 // |
65 // ---------------------------------------------------------- |
66 // ---------------------------------------------------------- |
66 // CSecurityHandler::CSecurityHandler() |
67 // CSecurityHandler::CSecurityHandler() |
67 // C++ constructor |
68 // C++ constructor |
68 // ---------------------------------------------------------- |
69 // ---------------------------------------------------------- |
69 // |
70 // qtdone |
70 EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone): |
71 EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone) : |
71 iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL) |
72 iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL) |
72 { |
73 { |
73 TInt result = iCustomPhone.Open(aPhone); |
74 RDEBUG("0", 0); |
74 TRAP_IGNORE( FeatureManager::InitializeLibL() ); //Shouldn't this panic if FM does not initialise?? |
75 |
|
76 TInt result = iCustomPhone.Open(aPhone); |
|
77 RDEBUG("result", result); |
|
78 TRAP_IGNORE(FeatureManager::InitializeLibL()); //Shouldn't this panic if FM does not initialise?? |
|
79 |
|
80 _LIT(KFileName, "secui_"); |
|
81 _LIT(KPath, "z:/resource/qt/translations/"); |
|
82 RDEBUG("HbTextResolverSymbian", 0); |
|
83 result = HbTextResolverSymbian::Init(KFileName, KPath); |
|
84 RDEBUG("result", result); |
75 } |
85 } |
76 |
86 |
77 // |
87 // |
78 // ---------------------------------------------------------- |
88 // ---------------------------------------------------------- |
79 // CSecurityHandler::~CSecurityHandler() |
89 // CSecurityHandler::~CSecurityHandler() |
80 // Destructor |
90 // Destructor |
81 // ---------------------------------------------------------- |
91 // ---------------------------------------------------------- |
82 // |
92 // qtdone |
83 EXPORT_C CSecurityHandler::~CSecurityHandler() |
93 EXPORT_C CSecurityHandler::~CSecurityHandler() |
84 { |
94 { |
85 #if defined(_DEBUG) |
95 RDEBUG("0", 0); |
86 RDebug::Print(_L("CSecurityHandler::~CSecurityHandler()")); |
96 |
87 #endif |
97 if (iDestroyedPtr) |
88 if ( iDestroyedPtr ) |
|
89 { |
98 { |
90 *iDestroyedPtr = ETrue; |
99 *iDestroyedPtr = ETrue; |
91 iDestroyedPtr = NULL; |
100 iDestroyedPtr = NULL; |
92 } |
101 } |
93 CancelSecCodeQuery(); |
102 RDEBUG("calling CancelOpenQuery", 0); |
|
103 TInt err = CancelOpenQuery(-1); |
|
104 RDEBUG("err", err); |
94 iCustomPhone.Close(); |
105 iCustomPhone.Close(); |
95 FeatureManager::UnInitializeLib(); |
106 FeatureManager::UnInitializeLib(); |
|
107 RDEBUG("1", 1); |
96 } |
108 } |
97 // |
109 // |
98 // ---------------------------------------------------------- |
110 // ---------------------------------------------------------- |
99 // CSecurityHandler::HandleEventL() |
111 // CSecurityHandler::HandleEventL() |
100 // Handles different security events |
112 // Handles different security events |
101 // ---------------------------------------------------------- |
113 // ---------------------------------------------------------- |
102 // |
114 // qtdone |
103 EXPORT_C void CSecurityHandler::HandleEventL( |
115 EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent) |
104 RMobilePhone::TMobilePhoneSecurityEvent aEvent ) |
|
105 { |
116 { |
|
117 RDEBUG("0", 0); |
|
118 |
106 TInt result = KErrNone; |
119 TInt result = KErrNone; |
107 HandleEventL( aEvent, result ); |
120 HandleEventL(aEvent, result); |
108 } |
121 } |
109 |
122 |
110 // |
123 // |
111 // ---------------------------------------------------------- |
124 // ---------------------------------------------------------- |
112 // CSecurityHandler::HandleEventL() |
125 // CSecurityHandler::HandleEventL() |
113 // Handles different security events |
126 // Handles different security events |
114 // ---------------------------------------------------------- |
127 // ---------------------------------------------------------- |
115 // |
128 // qtdone |
116 EXPORT_C void CSecurityHandler::HandleEventL( |
129 EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult) |
117 RMobilePhone::TMobilePhoneSecurityEvent aEvent, |
|
118 TBool aStartup, TInt& aResult ) |
|
119 { |
130 { |
|
131 RDEBUG("0", 0); |
|
132 |
120 iStartup = aStartup; |
133 iStartup = aStartup; |
121 HandleEventL( aEvent, aResult ); |
134 HandleEventL(aEvent, aResult); |
122 } |
135 } |
123 |
136 |
124 // |
137 // |
125 // ---------------------------------------------------------- |
138 // ---------------------------------------------------------- |
126 // CSecurityHandler::HandleEventL() |
139 // CSecurityHandler::HandleEventL() |
127 // Handles different security events |
140 // Handles different security events |
128 // ---------------------------------------------------------- |
141 // ---------------------------------------------------------- |
|
142 // qtdone |
|
143 EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult) |
|
144 { |
|
145 RDEBUG("0", 0); |
|
146 |
|
147 /***************************************************** |
|
148 * Series 60 Customer / ETel |
|
149 * Series 60 ETel API |
|
150 *****************************************************/ |
|
151 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
|
152 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
|
153 RDEBUG("aEvent", aEvent); |
|
154 |
|
155 switch (aEvent) |
|
156 { |
|
157 case RMobilePhone::EPin1Required: |
|
158 RDEBUG("RMobilePhone::EPin1Required", 0) |
|
159 ; |
|
160 aResult = Pin1RequiredL(); |
|
161 break; |
|
162 case RMobilePhone::EPuk1Required: |
|
163 RDEBUG("RMobilePhone::EPuk1Required", 0) |
|
164 ; |
|
165 Puk1RequiredL(); |
|
166 break; |
|
167 case RMobilePhone::EPin2Required: |
|
168 Pin2RequiredL(); |
|
169 break; |
|
170 case RMobilePhone::EPuk2Required: |
|
171 Puk2RequiredL(); |
|
172 break; |
|
173 case RMobilePhone::EUniversalPinRequired: |
|
174 if (wcdmaSupported || upinSupported) |
|
175 { |
|
176 aResult = UPinRequiredL(); |
|
177 } |
|
178 else |
|
179 aResult = KErrNotSupported; |
|
180 break; |
|
181 case RMobilePhone::EUniversalPukRequired: |
|
182 if (wcdmaSupported || upinSupported) |
|
183 { |
|
184 aResult = UPukRequiredL(); |
|
185 } |
|
186 else |
|
187 aResult = KErrNotSupported; |
|
188 break; |
|
189 case RMobilePhone::EPhonePasswordRequired: |
|
190 aResult = PassPhraseRequiredL(); |
|
191 break; |
|
192 case RMobilePhone::EICCTerminated: |
|
193 SimLockEventL(); |
|
194 break; |
|
195 default: |
|
196 RDEBUG("default", aEvent) |
|
197 ; |
|
198 break; |
|
199 } |
|
200 RDEBUG("aResult", aResult); |
|
201 } |
129 // |
202 // |
130 EXPORT_C void CSecurityHandler::HandleEventL( |
203 // ---------------------------------------------------------- |
131 RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult ) |
204 // CSecurityHandler::AskSecCodeL() |
|
205 // For asking security code e.g in settings |
|
206 // ---------------------------------------------------------- |
|
207 // qtdone |
|
208 EXPORT_C TBool CSecurityHandler::AskSecCodeL() |
132 { |
209 { |
133 /***************************************************** |
210 /***************************************************** |
134 * Series 60 Customer / ETel |
211 * Series 60 Customer / ETel |
135 * Series 60 ETel API |
212 * Series 60 ETel API |
136 *****************************************************/ |
213 *****************************************************/ |
137 #if defined(_DEBUG) |
214 RDEBUG("0", 0); |
138 RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL()")); |
215 // if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code. |
139 RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() EVENT: %d"), aEvent); |
216 const TUid KCRUidSCPLockCode = |
140 #endif |
217 { |
141 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
218 0x2002677B |
142 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
219 }; |
143 |
|
144 switch(aEvent) |
|
145 { |
|
146 case RMobilePhone::EPin1Required: |
|
147 #if defined(_DEBUG) |
|
148 RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() Pin1Required")); |
|
149 #endif |
|
150 aResult = Pin1RequiredL(); |
|
151 break; |
|
152 case RMobilePhone::EPuk1Required: |
|
153 #if defined(_DEBUG) |
|
154 RDebug::Print(_L("(SECUI)CSecurityHandler::HandleEventL() PUK1Required")); |
|
155 #endif |
|
156 ((CAknNotifierAppServerAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(ETrue); |
|
157 TRAPD(err,aResult = Puk1RequiredL()); |
|
158 ((CAknNotifierAppServerAppUi*)(CEikonEnv::Static())->EikAppUi())->SuppressAppSwitching(EFalse); |
|
159 User::LeaveIfError(err); |
|
160 break; |
|
161 case RMobilePhone::EPin2Required: |
|
162 Pin2RequiredL(); |
|
163 break; |
|
164 case RMobilePhone::EPuk2Required: |
|
165 Puk2RequiredL(); |
|
166 break; |
|
167 case RMobilePhone::EUniversalPinRequired: |
|
168 if(wcdmaSupported || upinSupported) |
|
169 { |
|
170 aResult = UPinRequiredL(); |
|
171 } |
|
172 else |
|
173 aResult = KErrNotSupported; |
|
174 break; |
|
175 case RMobilePhone::EUniversalPukRequired: |
|
176 if(wcdmaSupported || upinSupported) |
|
177 { |
|
178 aResult = UPukRequiredL(); |
|
179 } |
|
180 else |
|
181 aResult = KErrNotSupported; |
|
182 break; |
|
183 case RMobilePhone::EPhonePasswordRequired: |
|
184 aResult = PassPhraseRequiredL(); |
|
185 break; |
|
186 case RMobilePhone::EICCTerminated: |
|
187 SimLockEventL(); |
|
188 break; |
|
189 default: |
|
190 break; |
|
191 } |
|
192 #if defined(_DEBUG) |
|
193 RDebug::Print( _L( "CSecurityHandler::HandleEventL() returning %d." ), aResult ); |
|
194 #endif |
|
195 } |
|
196 // |
|
197 // ---------------------------------------------------------- |
|
198 // CSecurityHandler::AskSecCodeL() |
|
199 // For asking security code e.g in settings |
|
200 // ---------------------------------------------------------- |
|
201 // |
|
202 EXPORT_C TBool CSecurityHandler::AskSecCodeL() |
|
203 { |
|
204 /***************************************************** |
|
205 * Series 60 Customer / ETel |
|
206 * Series 60 ETel API |
|
207 *****************************************************/ |
|
208 #if defined(_DEBUG) |
|
209 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeL()")); |
|
210 #endif |
|
211 |
|
212 /* if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code */ |
|
213 const TUid KCRUidSCPLockCode = {0x2002677B}; |
|
214 const TUint32 KSCPLockCodeDefaultLockCode = 0x00000001; |
220 const TUint32 KSCPLockCodeDefaultLockCode = 0x00000001; |
215 |
221 |
216 CRepository* repository = CRepository::NewL(KCRUidSCPLockCode); |
222 CRepository* repository = CRepository::NewL(KCRUidSCPLockCode); |
217 TInt currentLockStatus = -1; |
223 TInt currentLockStatus = -1; |
218 TInt res=-1; |
224 TInt res = -1; |
219 |
225 TInt lAlphaSupported = 0; |
220 res = repository->Get(KSCPLockCodeDefaultLockCode , currentLockStatus); |
226 TInt lCancelSupported = 0; |
221 #if defined(_DEBUG) |
227 RMobilePhone::TMobilePassword iSecUi_password; |
222 RDebug::Printf( "%s %s (%u) res=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, res ); |
228 |
223 RDebug::Printf( "%s %s (%u) currentLockStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, currentLockStatus ); |
229 res = repository->Get(KSCPLockCodeDefaultLockCode, currentLockStatus); // 0x3039 = 12345 |
224 #endif |
230 RDEBUG("res", res); |
|
231 RDEBUG("currentLockStatus", currentLockStatus); |
225 delete repository; |
232 delete repository; |
226 if(res==0 && currentLockStatus>=1 ) |
233 if (res == 0 && (currentLockStatus == 1 || currentLockStatus == 12345) ) |
227 { |
234 { |
228 // code is the default one; no need to request it. |
235 // code is the default one |
229 return ETrue; |
236 RDEBUG("code is the default one; supply as default", 1); |
230 } |
237 iSecUi_password.Copy(_L("12345")); |
231 /* end check for default code */ |
238 // RDEBUG("code is the default one; no need to request it", 1); |
232 |
239 // return ETrue; |
233 // Destructor sets thisDestroyed to ETrue |
240 } |
234 TBool thisDestroyed( EFalse ); |
241 // end check for default code |
235 iDestroyedPtr = &thisDestroyed; |
242 |
236 |
|
237 iQueryCanceled = EFalse; |
|
238 RMobilePhone::TMobilePassword password; |
|
239 RMobilePhone::TMobilePassword required_fourth; |
243 RMobilePhone::TMobilePassword required_fourth; |
240 |
244 |
241 TInt ret = KErrNone; |
245 TInt ret = KErrNone; |
242 TInt err = KErrNone; |
|
243 TInt status = KErrNone; |
246 TInt status = KErrNone; |
244 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
247 |
245 FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
248 TInt queryAccepted = KErrCancel; |
246 { |
249 |
247 // Connect to the SCP server, and request the code query |
250 while (queryAccepted != KErrNone) |
248 RSCPClient scpClient; |
251 { |
249 User::LeaveIfError( scpClient.Connect() ); |
252 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
250 CleanupClosePushL( scpClient ); |
253 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
251 status = scpClient.SecCodeQuery( password, |
254 |
252 RSCPClient::SCP_OK_CANCEL, |
255 /* request PIN using QT */ |
253 EFalse, |
256 CSecQueryUi *iSecQueryUi; |
254 0 ); |
257 RDEBUG("CSecQueryUi", 0); |
255 |
258 iSecQueryUi = CSecQueryUi::NewL(); |
256 if ( status != KErrCancel ) |
259 iQueryCanceled = EFalse; |
257 { |
260 lAlphaSupported = ESecUiAlphaSupported; |
258 // Set this "true" to indicate that the input wasn't cancelled |
261 lCancelSupported = ESecUiCancelSupported; |
259 ret = ETrue; |
262 TBuf<0x100> title; |
260 } |
263 title.Zero(); |
261 else |
264 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); |
|
265 title.Append(stringHolder->Des()); |
|
266 CleanupStack::PopAndDestroy(stringHolder); |
|
267 title.Append(_L("$")); |
|
268 title.AppendNum(-1); // Don't know the number of remaining attempts |
|
269 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported |
|
270 | lCancelSupported | secCodeType); |
|
271 RDEBUG("iSecUi_password", 0); |
|
272 RDEBUGSTR(iSecUi_password); |
|
273 RDEBUG("delete", 0); |
|
274 iQueryCanceled = ETrue; |
|
275 delete iSecQueryUi; |
|
276 RDEBUG("queryAccepted", queryAccepted); |
|
277 /* end request PIN using QT */ |
|
278 if (queryAccepted != KErrNone) |
262 { |
279 { |
263 ret = EFalse; |
280 ret = EFalse; |
264 } |
281 return ret; |
265 |
282 } |
266 CleanupStack::PopAndDestroy(); //scpClient |
283 |
267 } |
284 CWait* wait = CWait::NewL(); |
268 else |
285 RDEBUG("VerifySecurityCode", 0); |
269 { |
286 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); |
270 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); |
287 RDEBUG("WaitForRequestL", 0); |
271 #ifdef __COVER_DISPLAY |
288 status = wait->WaitForRequestL(); |
272 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
289 RDEBUG("status", status); |
273 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
290 delete wait; |
274 if (covercl) // returns null if __COVER_DISPLAY is not defined |
291 #ifdef __WINS__ |
275 { |
292 if (status == KErrNotSupported || status == KErrTimedOut) |
276 // … - add data that cover ui is interested in |
293 { |
277 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode);// adds int to additional data to be posted to cover ui |
294 RDEBUG("status", status); |
278 covercl->BufStream().CommitL(); // no more data to send so commit buf |
295 status = KErrNone; |
279 } |
296 } |
280 #endif //__COVER_DISPLAY |
297 #endif |
281 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
298 |
282 CleanupStack::PushL(deviceLockStatusObserver); |
299 ret = ETrue; |
283 err =KErrNone; |
300 queryAccepted = KErrCancel; // because it's not yet validated |
284 TRAP(err,ret = iSecurityDlg->ExecuteLD(R_SECURITY_QUERY)); |
301 switch (status) |
285 CleanupStack::PopAndDestroy(deviceLockStatusObserver); |
302 { |
286 } |
303 case KErrNone: |
287 |
304 { |
288 // check if CSecurityHandler has been "killed" |
305 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw) && !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) |
289 if ( thisDestroyed ) |
|
290 { |
|
291 return EFalse; |
|
292 } |
|
293 |
|
294 iDestroyedPtr = NULL; |
|
295 iSecurityDlg = NULL; |
|
296 |
|
297 if (err != KErrNone) |
|
298 { |
|
299 User::Leave(err); |
|
300 } |
|
301 |
|
302 if (ret) |
|
303 { |
|
304 while (!iQueryCanceled) |
|
305 { |
|
306 if (!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
|
307 { |
|
308 RMobilePhone::TMobilePhoneSecurityCode secCodeType; |
|
309 secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
|
310 CWait* wait = CWait::NewL(); |
|
311 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); |
|
312 status = wait->WaitForRequestL(); |
|
313 delete wait; |
|
314 |
|
315 } |
|
316 |
|
317 switch(status) |
|
318 { |
|
319 case KErrNone: |
|
320 { |
306 { |
321 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
307 RDEBUG("calling RSCPClient", 0); |
322 !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))) |
308 RSCPClient scpClient; |
323 { |
309 User::LeaveIfError(scpClient.Connect()); |
324 RSCPClient scpClient; |
310 CleanupClosePushL(scpClient); |
325 User::LeaveIfError( scpClient.Connect() ); |
311 |
326 CleanupClosePushL( scpClient ); |
312 TSCPSecCode newCode; |
327 |
313 RDEBUG("iSecUi_password", 1); |
328 TSCPSecCode newCode; |
314 RDEBUGSTR(iSecUi_password); |
329 newCode.Copy( password ); |
315 newCode.Copy(iSecUi_password); |
330 scpClient.StoreCode( newCode ); |
316 RDEBUG( |
331 |
317 "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode", |
332 CleanupStack::PopAndDestroy(); //scpClient |
318 0); |
333 } |
319 scpClient.StoreCode(newCode); |
334 |
320 RDEBUG("called StoreCode", 1); |
335 iQueryCanceled = ETrue; |
321 |
336 return ETrue; |
322 CleanupStack::PopAndDestroy(); //scpClient |
337 } |
323 queryAccepted = KErrNone; |
338 case KErrGsmSSPasswordAttemptsViolation: |
|
339 case KErrLocked: |
|
340 { |
|
341 iDestroyedPtr = &thisDestroyed; |
|
342 // security code blocked! |
|
343 iNoteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNoteDlg)); |
|
344 iNoteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
345 iNoteDlg->SetTone(CAknNoteDialog::EErrorTone); |
|
346 err =KErrNone; |
|
347 TRAP(err,iNoteDlg->ExecuteLD(R_SEC_BLOCKED)); |
|
348 |
|
349 // check if CSecurityHandler has been "killed" |
|
350 if ( thisDestroyed ) |
|
351 { |
|
352 return EFalse; |
|
353 } |
|
354 |
|
355 iDestroyedPtr = NULL; |
|
356 iNoteDlg = NULL; |
|
357 |
|
358 if (err != KErrNone) |
|
359 { |
|
360 User::Leave(err); |
|
361 } |
|
362 break; |
|
363 } |
324 } |
364 case KErrGsm0707IncorrectPassword: |
325 |
365 case KErrAccessDenied: |
326 iQueryCanceled = ETrue; |
366 { |
327 return ETrue; |
367 iDestroyedPtr = &thisDestroyed; |
328 } |
368 // code was entered erroneusly |
329 case KErrGsmSSPasswordAttemptsViolation: |
369 iNoteDlg = new (ELeave) CAknNoteDialog(REINTERPRET_CAST(CEikDialog**,&iNoteDlg)); |
330 case KErrLocked: |
370 iNoteDlg->SetTimeout(CAknNoteDialog::ELongTimeout); |
|
371 iNoteDlg->SetTone(CAknNoteDialog::EErrorTone); |
|
372 err =KErrNone; |
|
373 TRAP(err,iNoteDlg->ExecuteLD(R_CODE_ERROR)); |
|
374 |
|
375 // check if CSecurityHandler has been "killed" |
|
376 if ( thisDestroyed ) |
|
377 { |
|
378 return EFalse; |
|
379 } |
|
380 |
|
381 iDestroyedPtr = NULL; |
|
382 iNoteDlg = NULL; |
|
383 |
|
384 if (err != KErrNone) |
|
385 { |
|
386 User::Leave(err); |
|
387 } |
|
388 break; |
|
389 } |
|
390 default: |
|
391 { |
|
392 iDestroyedPtr = &thisDestroyed; |
|
393 err =KErrNone; |
|
394 TRAP(err,ShowGenericErrorNoteL(status)); |
|
395 |
|
396 // check if CSecurityHandler has been "killed" |
|
397 if ( thisDestroyed ) |
|
398 { |
|
399 return EFalse; |
|
400 } |
|
401 |
|
402 iDestroyedPtr = NULL; |
|
403 iNoteDlg = NULL; |
|
404 |
|
405 if (err != KErrNone) |
|
406 { |
|
407 User::Leave(err); |
|
408 } |
|
409 break; |
|
410 } |
|
411 } |
|
412 |
|
413 if (iQueryCanceled) |
|
414 { |
331 { |
415 ret = EFalse; |
332 // security code blocked! |
|
333 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
416 break; |
334 break; |
417 } |
335 } |
418 |
336 case KErrGsm0707IncorrectPassword: |
419 password = _L(""); |
337 case KErrAccessDenied: |
420 iDestroyedPtr = &thisDestroyed; |
|
421 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
422 FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
|
423 { |
|
424 // Connect to the SCP server, and request the code query |
|
425 RSCPClient scpClient; |
|
426 User::LeaveIfError( scpClient.Connect() ); |
|
427 CleanupClosePushL( scpClient ); |
|
428 status = scpClient.SecCodeQuery( password, |
|
429 RSCPClient::SCP_OK_CANCEL, |
|
430 EFalse, |
|
431 0 ); |
|
432 |
|
433 if ( status != KErrCancel ) |
|
434 { |
|
435 // Set this "true" to indicate that the input wasn't cancelled |
|
436 ret = ETrue; |
|
437 } |
|
438 else |
|
439 { |
|
440 ret = EFalse; |
|
441 } |
|
442 |
|
443 CleanupStack::PopAndDestroy(); //scpClient |
|
444 } |
|
445 else |
|
446 { |
|
447 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); |
|
448 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
449 CleanupStack::PushL(deviceLockStatusObserver); |
|
450 err =KErrNone; |
|
451 TRAP(err,ret = iSecurityDlg->ExecuteLD(R_SECURITY_QUERY)); |
|
452 CleanupStack::PopAndDestroy(deviceLockStatusObserver); |
|
453 } |
|
454 |
|
455 // check if CSecurityHandler has been "killed" |
|
456 if ( thisDestroyed ) |
|
457 { |
338 { |
458 return EFalse; |
339 // code was entered erroneusly |
|
340 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
341 break; |
459 } |
342 } |
460 |
343 default: |
461 iDestroyedPtr = NULL; |
|
462 iSecurityDlg = NULL; |
|
463 |
|
464 if (err != KErrNone) |
|
465 { |
344 { |
466 User::Leave(err); |
345 CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone); |
467 } |
346 } |
468 |
347 } |
469 if (!ret) |
|
470 break; |
|
471 } // while |
348 } // while |
472 } // if |
|
473 |
349 |
474 iQueryCanceled = ETrue; |
350 iQueryCanceled = ETrue; |
475 return ret; |
351 return ret; |
476 } |
352 } |
477 // |
353 // |
478 // ---------------------------------------------------------- |
354 // ---------------------------------------------------------- |
|
355 // Cancels all security code queries |
|
356 // aStatus = -1 from destructor |
|
357 // aStatus = 1 from API. Will kill all dialogs through signal P&S |
|
358 // ---------------------------------------------------------- |
|
359 // qtdone |
|
360 TInt CSecurityHandler::CancelOpenQuery(TInt aStatus) |
|
361 { |
|
362 RDEBUG("aStatus", aStatus); |
|
363 RDEBUG("iQueryCanceled", iQueryCanceled); |
|
364 TInt res = 0; |
|
365 |
|
366 if (aStatus == 1) // also signal all other dialogs |
|
367 { |
|
368 RDEBUG( |
|
369 "set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn", |
|
370 ESecurityUIsDismissDialogOn); |
|
371 TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn); |
|
372 RDEBUG("err", err); |
|
373 res += 1; |
|
374 } |
|
375 |
|
376 if (!iQueryCanceled) |
|
377 { |
|
378 // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged |
|
379 // this will cancel only the dialog which was opened by same client. |
|
380 res += 0x10; |
|
381 iQueryCanceled = ETrue; |
|
382 if (iSecurityDlg != NULL) |
|
383 { |
|
384 RDEBUG("deleting iSecurityDlg", 0); |
|
385 res += 0x100; |
|
386 delete iSecurityDlg; |
|
387 } |
|
388 if (iNoteDlg != NULL) |
|
389 { |
|
390 RDEBUG("deleting iNoteDlg", 0); |
|
391 res += 0x1000; |
|
392 delete iNoteDlg; |
|
393 } |
|
394 iNoteDlg = NULL; |
|
395 iSecurityDlg = NULL; |
|
396 } |
|
397 res += 0x10000; |
|
398 RDEBUG("res", res); |
|
399 return res; |
|
400 } |
|
401 |
|
402 // |
|
403 // ---------------------------------------------------------- |
479 // CSecurityHandler::CancelSecCodeQuery() |
404 // CSecurityHandler::CancelSecCodeQuery() |
480 // Cancels PIN2 and security code queries |
405 // Cancels PIN2 and security code queries |
481 // ---------------------------------------------------------- |
406 // this is used by rfsHandler |
482 // |
407 // ---------------------------------------------------------- |
483 EXPORT_C void CSecurityHandler::CancelSecCodeQuery() |
408 // qtdone |
|
409 EXPORT_C void CSecurityHandler::CancelSecCodeQuery() |
484 { |
410 { |
485 #if defined(_DEBUG) |
411 RDEBUG("0", 0); |
486 RDebug::Print(_L("(SECUI)CSecurityHandler::CancelSecCodeQuery()")); |
412 |
487 #endif |
413 TInt err = CancelOpenQuery(1); |
488 if (!iQueryCanceled) |
414 |
489 { |
415 RDEBUG("err", err); |
490 iQueryCanceled = ETrue; |
|
491 if (iSecurityDlg != NULL) |
|
492 { |
|
493 delete iSecurityDlg; |
|
494 } |
|
495 if (iNoteDlg != NULL) |
|
496 { |
|
497 delete iNoteDlg; |
|
498 } |
|
499 iNoteDlg = NULL; |
|
500 iSecurityDlg = NULL; |
|
501 } |
|
502 } |
416 } |
503 // |
417 // |
504 // ---------------------------------------------------------- |
418 // ---------------------------------------------------------- |
505 // CSecurityHandler::AskSecCodeInAutoLock() |
419 // CSecurityHandler::AskSecCodeInAutoLock() |
506 // for asking security code in autolock |
420 // for asking security code in autolock |
507 // ---------------------------------------------------------- |
421 // ---------------------------------------------------------- |
508 // |
422 // qtdone |
509 EXPORT_C TBool CSecurityHandler::AskSecCodeInAutoLockL() |
423 EXPORT_C TBool CSecurityHandler::AskSecCodeInAutoLockL() |
510 { |
424 { |
511 /***************************************************** |
425 /***************************************************** |
512 * Series 60 Customer / ETel |
426 * Series 60 Customer / ETel |
513 * Series 60 ETel API |
427 * Series 60 ETel API |
514 *****************************************************/ |
428 *****************************************************/ |
515 |
429 |
516 #ifdef __WINS__ |
430 RDEBUG("0", 0); |
517 return ETrue; |
|
518 #else |
|
519 #if defined(_DEBUG) |
|
520 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL()")); |
|
521 #endif |
|
522 TInt res; |
431 TInt res; |
523 CWait* wait; |
432 CWait* wait; |
524 |
433 |
525 RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); |
434 RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); |
526 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
435 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
527 |
|
528 #if defined(_DEBUG) |
|
529 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() get autolock period")); |
|
530 #endif |
|
531 |
436 |
532 // get autolock period from Central Repository. |
437 // get autolock period from Central Repository. |
533 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
438 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
534 TInt period = 0; |
439 TInt period = 0; |
535 res = repository->Get(KSettingsAutoLockTime, period); |
440 res = repository->Get(KSettingsAutoLockTime, period); |
536 delete repository; |
441 delete repository; |
537 |
442 |
538 #if defined(_DEBUG) |
443 RDEBUG("res", res); |
539 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() autolock period:%d"), res); |
444 RDEBUG("period", period); |
540 #endif |
445 |
541 if (res == KErrNone) |
446 if (res == KErrNone) |
542 { |
447 { |
543 // disable autolock in Domestic OS side too if autolock period is 0. |
448 // disable autolock in Domestic OS side too if autolock period is 0. |
544 if (period == 0 ) |
449 if (period == 0) |
545 { |
450 { |
546 #if defined(_DEBUG) |
451 RDEBUG("period", period); |
547 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Call SetLockSetting")); |
|
548 #endif |
|
549 |
|
550 #ifdef RD_REMOTELOCK |
|
551 |
452 |
552 // If remote lock is enabled, don't disable the domestic OS device lock |
453 // If remote lock is enabled, don't disable the domestic OS device lock |
553 // since that would render the RemoteLock useless. |
454 // since that would render the RemoteLock useless. |
554 // Instead just re-set the DOS lock to enabled which as a side effect |
455 // Instead just re-set the DOS lock to enabled which as a side effect |
555 // requests the security code from the user. |
456 // requests the security code from the user. |
556 |
457 |
557 TBool remoteLockStatus( EFalse ); |
458 TBool remoteLockStatus(EFalse); |
558 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
459 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
559 |
460 |
560 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
461 if (remoteLockSettings->GetEnabled(remoteLockStatus)) |
561 { |
462 { |
562 if ( remoteLockStatus ) |
463 RDEBUG("0", 0); |
|
464 if (remoteLockStatus) |
563 { |
465 { |
564 // Remote lock is enabled |
466 // Remote lock is enabled |
565 #ifdef _DEBUG |
|
566 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); |
|
567 #endif // _DEBUG |
|
568 |
|
569 lockChange = RMobilePhone::ELockSetEnabled; |
467 lockChange = RMobilePhone::ELockSetEnabled; |
|
468 RDEBUG("lockChange", lockChange); |
570 } |
469 } |
571 else |
470 else |
572 { |
471 { |
573 // Remote lock is disabled |
472 // Remote lock is disabled |
574 #ifdef _DEBUG |
|
575 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); |
|
576 #endif // _DEBUG |
|
577 |
|
578 lockChange = RMobilePhone::ELockSetDisabled; |
473 lockChange = RMobilePhone::ELockSetDisabled; |
|
474 RDEBUG("lockChange", lockChange); |
579 } |
475 } |
580 } |
476 } |
581 else |
477 else |
582 { |
478 { |
583 // Failed to get remote lock status |
479 // Failed to get remote lock status |
584 #ifdef _DEBUG |
480 RDEBUG("Failed", lockChange); |
585 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get RemoteLock status" ) ); |
|
586 #endif // _DEBUG |
|
587 } |
481 } |
588 |
482 |
589 delete remoteLockSettings; |
483 delete remoteLockSettings; |
590 remoteLockSettings = NULL; |
484 remoteLockSettings = NULL; |
591 |
485 |
592 #else // not defined RD_REMOTELOCK |
486 RDEBUG("lockChange", lockChange); |
593 |
487 wait = CWait::NewL(); |
594 lockChange = RMobilePhone::ELockSetDisabled; |
488 RDEBUG("0", 0); |
595 |
489 // this also calls PassPhraseRequiredL ??? |
596 #endif // RD_REMOTELOCK |
490 RDEBUG("SetLockSetting", 1); |
597 |
491 iPhone.SetLockSetting(wait->iStatus, lockType, lockChange); |
598 wait = CWait::NewL(); |
492 res = KErrNone; |
599 iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); |
493 RDEBUG("WaitForRequestL", 0); |
600 res = wait->WaitForRequestL(); |
494 res = wait->WaitForRequestL(); |
601 delete wait; |
495 RDEBUG("res", res); |
602 #if defined(_DEBUG) |
496 delete wait; |
603 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() SetLockSetting RESULT:%d"), res); |
497 } // from period == 0 |
604 #endif |
|
605 } |
|
606 else |
498 else |
607 { // ask security code |
499 { // ask security code |
608 #if defined(_DEBUG) |
500 RDEBUG("codeQueryNotifier 0", 0); |
609 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Ask sec code via notifier")); |
501 RNotifier codeQueryNotifier; |
610 #endif |
502 User::LeaveIfError(codeQueryNotifier.Connect()); |
611 RNotifier codeQueryNotifier; |
503 CWait* wait = CWait::NewL(); |
612 User::LeaveIfError(codeQueryNotifier.Connect()); |
504 CleanupStack::PushL(wait); |
613 CWait* wait = CWait::NewL(); |
505 TInt queryResponse = 0; |
614 CleanupStack::PushL(wait); |
506 TPckg<TInt> response(queryResponse); |
615 TInt queryResponse = 0; |
507 RDEBUG("0", 0); |
616 TPckg<TInt> response(queryResponse); |
508 TSecurityNotificationPckg params; |
617 TSecurityNotificationPckg params; |
509 params().iEvent = static_cast<TInt> (RMobilePhone::EPhonePasswordRequired); |
618 params().iEvent = static_cast<TInt>(RMobilePhone::EPhonePasswordRequired); |
510 params().iStartup = EFalse; |
619 params().iStartup = EFalse; |
511 |
620 #if defined(_DEBUG) |
512 RDEBUG("StartNotifierAndGetResponse", 0); |
621 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() Start Notifier")); |
513 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response); |
622 #endif |
514 // this will eventually call PassPhraseRequiredL |
623 codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid,params, response); |
515 RDEBUG("WaitForRequestL", 0); |
624 res = wait->WaitForRequestL(); |
516 res = wait->WaitForRequestL(); |
625 CleanupStack::PopAndDestroy(); // wait |
517 RDEBUG("WaitForRequestL", 1); |
626 #if defined(_DEBUG) |
518 RDEBUG("res", res); |
627 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() results:")); |
519 CleanupStack::PopAndDestroy(); // wait |
628 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() res:%d"), res); |
520 if (res == KErrNone) |
629 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() queryResponse:%d"), queryResponse); |
521 res = queryResponse; |
630 #endif |
522 } // from else period == 0 |
631 if(res == KErrNone) |
523 RDEBUG("0", 0); |
632 res = queryResponse; |
|
633 } |
|
634 } |
524 } |
635 else |
525 else |
636 { |
526 { // can't read repository for KSettingsAutoLockTime |
637 #if defined(_DEBUG) |
527 RDEBUG("KERRSOMETHING:Call SetLockSetting", 0); |
638 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KERRSOMETHING:Call SetLockSetting")); |
|
639 #endif |
|
640 |
|
641 #ifdef RD_REMOTELOCK |
|
642 |
528 |
643 // If remote lock is enabled, don't disable the domestic OS device lock |
529 // If remote lock is enabled, don't disable the domestic OS device lock |
644 // since that would render the RemoteLock useless. |
530 // since that would render the RemoteLock useless. |
645 // Instead just re-set the DOS lock to enabled which as a side effect |
531 // Instead just re-set the DOS lock to enabled which as a side effect |
646 // requests the security code from the user. |
532 // requests the security code from the user. |
647 |
533 |
648 TBool remoteLockStatus( EFalse ); |
534 TBool remoteLockStatus(EFalse); |
649 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
535 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
650 |
536 |
651 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
537 if (remoteLockSettings->GetEnabled(remoteLockStatus)) |
652 { |
538 { |
653 if ( remoteLockStatus ) |
539 if (remoteLockStatus) |
654 { |
540 { |
655 // Remote lock is enabled |
541 // Remote lock is enabled |
656 #ifdef _DEBUG |
|
657 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and RemoteLock is enabled: lockChange = RMobilePhone::ELockSetEnabled" ) ); |
|
658 #endif // _DEBUG |
|
659 |
|
660 lockChange = RMobilePhone::ELockSetEnabled; |
542 lockChange = RMobilePhone::ELockSetEnabled; |
|
543 RDEBUG("lockChange", lockChange); |
661 } |
544 } |
662 else |
545 else |
663 { |
546 { |
664 // Remote lock is disabled |
547 // Remote lock is disabled |
665 #ifdef _DEBUG |
|
666 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and RemoteLock is disabled: lockChange = RMobilePhone::ELockSetDisabled" ) ); |
|
667 #endif // _DEBUG |
|
668 |
|
669 lockChange = RMobilePhone::ELockSetDisabled; |
548 lockChange = RMobilePhone::ELockSetDisabled; |
|
549 RDEBUG("lockChange", lockChange); |
670 } |
550 } |
671 } |
551 } |
672 else |
552 else |
673 { |
553 { |
674 // Failed to get remote lock status |
554 // Failed to get remote lock status |
675 #ifdef _DEBUG |
555 RDEBUG("Failed", lockChange); |
676 RDebug::Print( _L( "(SecUi)CSecurityHandler::AskSecCodeInAutoLockL() - Failed to get AutoLock status and failed to get RemoteLock status" ) ); |
|
677 #endif // _DEBUG |
|
678 } |
556 } |
679 |
557 |
680 delete remoteLockSettings; |
558 delete remoteLockSettings; |
681 remoteLockSettings = NULL; |
559 remoteLockSettings = NULL; |
682 |
560 |
683 #else // not defined RD_REMOTELOCK |
561 RDEBUG("0", 0); |
684 |
|
685 // could not get the current autolock time... disable autolock in Domestic OS side. |
|
686 lockChange = RMobilePhone::ELockSetDisabled; |
|
687 |
|
688 #endif // RD_REMOTELOCK |
|
689 |
|
690 wait = CWait::NewL(); |
562 wait = CWait::NewL(); |
691 iPhone.SetLockSetting(wait->iStatus,lockType,lockChange); |
563 RDEBUG("SetLockSetting", 0); |
|
564 iPhone.SetLockSetting(wait->iStatus, lockType, lockChange); |
|
565 RDEBUG("WaitForRequestL", 0); |
692 res = wait->WaitForRequestL(); |
566 res = wait->WaitForRequestL(); |
|
567 RDEBUG("WaitForRequestL res", res); |
693 delete wait; |
568 delete wait; |
694 #if defined(_DEBUG) |
569 } |
695 RDebug::Print(_L("(SECUI)CSecurityHandler::AskSecCodeInAutoLockL() KES: SetLockSetting RESULT:%d"), res); |
570 |
696 #endif |
571 RDEBUG("res", res); |
697 } |
|
698 |
|
699 switch (res) |
572 switch (res) |
700 { |
573 { |
701 case KErrNone: |
574 case KErrNone: |
702 { |
575 { |
703 return ETrue; |
576 return ETrue; |
704 } |
577 } |
705 |
|
706 case KErrGsmSSPasswordAttemptsViolation: |
578 case KErrGsmSSPasswordAttemptsViolation: |
707 case KErrLocked: |
579 case KErrLocked: |
708 case KErrGsm0707IncorrectPassword: |
580 case KErrGsm0707IncorrectPassword: |
709 case KErrAccessDenied: |
581 case KErrAccessDenied: |
710 { |
582 { |
711 return AskSecCodeInAutoLockL(); |
583 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
|
584 return AskSecCodeInAutoLockL(); |
|
585 } |
|
586 case KErrInUse: |
|
587 { |
|
588 RDEBUG("KErrInUse", KErrInUse); |
|
589 return EFalse; |
|
590 } |
|
591 case KErrDied: |
|
592 { |
|
593 RDEBUG("KErrDied ", KErrDied); |
|
594 return EFalse; |
|
595 } |
|
596 case KErrServerTerminated: |
|
597 { |
|
598 RDEBUG("KErrServerTerminated ", KErrServerTerminated); |
|
599 return EFalse; |
|
600 } |
|
601 case KErrServerBusy: |
|
602 { |
|
603 RDEBUG("KErrServerBusy ", KErrServerBusy); |
|
604 return EFalse; |
712 } |
605 } |
713 case KErrAbort: |
606 case KErrAbort: |
|
607 { |
|
608 RDEBUG("KErrAbort", KErrAbort); |
|
609 return EFalse; |
|
610 } |
714 case KErrCancel: |
611 case KErrCancel: |
|
612 { |
|
613 RDEBUG("KErrCancel", KErrCancel); |
715 // user pressed "cancel" |
614 // user pressed "cancel" |
716 return EFalse; |
615 return EFalse; |
|
616 } |
717 default: |
617 default: |
718 { |
618 { |
|
619 RDEBUG("default", res); |
719 return AskSecCodeInAutoLockL(); |
620 return AskSecCodeInAutoLockL(); |
720 } |
621 } |
721 } |
622 } |
722 #endif // WINS |
|
723 } |
623 } |
724 // |
624 // |
725 // ---------------------------------------------------------- |
625 // ---------------------------------------------------------- |
726 // CSecurityHandler::PassPhraseRequired() |
626 // CSecurityHandler::PassPhraseRequired() |
727 // Handles PassPhraseRequired event |
627 // Handles PassPhraseRequired event |
728 // ---------------------------------------------------------- |
628 // ---------------------------------------------------------- |
729 // |
629 // qtdone |
730 TInt CSecurityHandler::PassPhraseRequiredL() |
630 TInt CSecurityHandler::PassPhraseRequiredL() |
731 { |
631 { |
732 /***************************************************** |
632 /***************************************************** |
733 * Series 60 Customer / ETel |
633 * Series 60 Customer / ETel |
734 * Series 60 ETel API |
634 * Series 60 ETel API |
735 *****************************************************/ |
635 *****************************************************/ |
736 #if defined(_DEBUG) |
636 RDEBUG("0", 0); |
737 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()")); |
|
738 #endif |
|
739 TBool StartUp = iStartup; |
637 TBool StartUp = iStartup; |
740 |
638 |
741 RMobilePhone::TMobilePassword password; |
639 RMobilePhone::TMobilePassword iSecUi_password; |
742 RMobilePhone::TMobilePassword required_fourth; |
640 RMobilePhone::TMobilePassword required_fourth; |
743 TInt status; |
641 TInt queryAccepted = KErrCancel; |
744 TInt autolockState; |
642 |
745 TInt err( KErrGeneral ); |
643 TInt autolockState = 0; |
|
644 TInt lCancelSupported = 0; |
|
645 TInt lEmergencySupported = 0; |
|
646 |
|
647 TInt err(KErrGeneral); |
746 err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); |
648 err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); |
747 #if defined(_DEBUG) |
649 RDEBUG("StartUp", StartUp); |
748 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Autolock Status result: %d"), err); |
650 RDEBUG("err", err); |
749 #endif |
651 if (!StartUp) |
750 if(!StartUp) |
652 { |
751 User::LeaveIfError( err ); |
653 RDebug::Printf("%s %s (%u) might leave if StartUp=0 and err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err); |
752 TBool isConditionSatisfied = EFalse; |
654 User::LeaveIfError(err); |
753 TInt tarmFlag=0; |
655 } |
754 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
656 TBool isConditionSatisfied = EFalse; |
755 { |
657 TInt tarmFlag = 0; |
756 TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); |
658 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
757 |
659 { |
758 if ( tRet != KErrNone ) |
660 TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); |
759 { |
661 |
760 #if defined(_DEBUG) |
662 if (tRet != KErrNone) |
761 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL():\ |
663 { |
762 Warning: failed to get TARM Admin Flag state")); |
664 RDEBUG("Warning: failed to get TARM Admin Flag state", tRet); |
763 #endif |
665 } |
|
666 else |
|
667 { |
|
668 RDEBUG("TARM flag", tarmFlag); |
|
669 } |
|
670 |
|
671 if ((StartUp) || (tarmFlag & KSCPFlagResyncQuery)) |
|
672 isConditionSatisfied = ETrue; |
764 } |
673 } |
765 else |
674 else |
766 { |
675 { |
767 #if defined(_DEBUG) |
676 if (StartUp) |
768 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL(): TARM flag: %d"), tarmFlag ); |
677 isConditionSatisfied = ETrue; |
769 #endif |
678 } |
770 } |
679 |
771 |
680 // Security code at bootup: No "cancel" softkey; Emergency calls enabled. |
772 if ( ( StartUp ) || ( tarmFlag & KSCPFlagResyncQuery ) ) |
681 RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = RMobilePhone::ESecurityCodePhonePassword; |
773 isConditionSatisfied = ETrue; |
682 RDEBUG("isConditionSatisfied", isConditionSatisfied); |
774 } |
683 if (isConditionSatisfied) |
775 else |
684 { |
776 { |
685 // starter or special TARM. NoCancel+Emergency |
777 if (StartUp) |
686 lCancelSupported = ESecUiCancelNotSupported; |
778 isConditionSatisfied = ETrue; |
687 lEmergencySupported = ESecUiEmergencySupported; |
779 } |
688 } |
780 |
689 else if (autolockState > EAutolockOff) |
781 // call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query. |
690 { |
782 #if defined(_DEBUG) |
691 // from unlock. Cancel+Emergency |
783 RDebug::Printf( "%s %s (%u) pre isConditionSatisfied=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, isConditionSatisfied ); |
692 lCancelSupported = ESecUiCancelSupported; |
784 #endif |
693 lEmergencySupported = ESecUiEmergencySupported; |
785 RSCPClient scpClientConfiguration; |
694 } |
786 User::LeaveIfError( scpClientConfiguration.Connect() ); |
695 else |
787 CleanupClosePushL( scpClientConfiguration ); |
696 { |
788 #if defined(_DEBUG) |
697 // from settings. Cancel+NoEmergency |
789 RDebug::Printf( "%s %s (%u) calling CheckConfiguration KSCPComplete=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KSCPComplete ); |
698 lCancelSupported = ESecUiCancelSupported; |
790 #endif |
699 lEmergencySupported = ESecUiEmergencyNotSupported; |
791 TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete ); |
700 } |
792 #if defined(_DEBUG) |
701 |
793 RDebug::Printf( "%s %s (%u) finalConfStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, finalConfStatus ); |
702 CSecQueryUi *iSecQueryUi; |
794 RDebug::Printf( "%s %s (%u) isConditionSatisfied=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, isConditionSatisfied ); |
703 iSecQueryUi = CSecQueryUi::NewL(); |
795 #endif |
704 iQueryCanceled = EFalse; |
796 CleanupStack::PopAndDestroy(); // scpClientConfiguration |
705 TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk; |
797 |
706 RDEBUG("lType", lType); |
798 if (isConditionSatisfied) |
707 TBuf<0x100> title; |
799 { |
708 title.Zero(); |
800 #if defined(_DEBUG) |
709 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code")); |
801 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 1")); |
710 title.Append(stringHolder->Des()); |
802 #endif |
711 CleanupStack::PopAndDestroy(stringHolder); |
803 // Security code at bootup: No "cancel" softkey; Emergency calls enabled. |
712 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType); |
804 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
713 RDEBUG("iSecUi_password", 0); |
805 FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
714 RDEBUGSTR(iSecUi_password); |
806 { |
715 RDEBUG("queryAccepted", queryAccepted); |
807 // Connect to the SCP server, and request the code query |
716 iQueryCanceled = ETrue; |
808 RSCPClient scpClient; |
717 delete iSecQueryUi; |
809 User::LeaveIfError( scpClient.Connect() ); |
718 |
810 CleanupClosePushL( scpClient ); |
719 TBool wasCancelledOrEmergency = EFalse; |
811 |
720 RDEBUG("KFeatureIdSapDeviceLockEnhancements", |
812 status = scpClient.SecCodeQuery( password, |
721 KFeatureIdSapDeviceLockEnhancements); |
813 RSCPClient::SCP_OK_ETEL, |
722 if ((queryAccepted == KErrAbort /* =emergency */) || (queryAccepted == KErrCancel)) |
814 ETrue, |
723 wasCancelledOrEmergency = ETrue; |
815 KSCPEtelRequest ); |
724 RDEBUG("wasCancelledOrEmergency", wasCancelledOrEmergency); |
816 // Note that SecCodeQuery doesn't indicate the return value from the dialog |
725 if (wasCancelledOrEmergency) |
817 |
726 { |
818 CleanupStack::PopAndDestroy(); //scpClient |
727 RDEBUG("StartUp", StartUp); |
819 } |
|
820 else |
|
821 { |
|
822 CCodeQueryDialog* securityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); |
|
823 if(AknLayoutUtils::PenEnabled()) |
|
824 securityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
825 else |
|
826 securityDlg->SetEmergencyCallSupport(ETrue); |
|
827 #ifdef __COVER_DISPLAY |
|
828 securityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
829 CAknMediatorFacade* covercl = AknMediatorFacade(securityDlg); // uses MOP, so control provided |
|
830 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
831 { |
|
832 // … - add data that cover ui is interested in |
|
833 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode); // adds int to additional data to be posted to cover ui |
|
834 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
835 } |
|
836 #endif //__COVER_DISPLAY |
|
837 status = securityDlg->ExecuteLD(R_SECURITY_REQUEST_QUERY); |
|
838 } |
|
839 } |
|
840 else if ( (autolockState > EAutolockOff)) |
|
841 { |
|
842 #if defined(_DEBUG) |
|
843 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 2")); |
|
844 #endif |
|
845 // Autolock is On. Security event came from user pressing "unlock". |
|
846 // Emergency call support must be enabled and there must be a "cancel" softkey. |
|
847 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
848 FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
|
849 { |
|
850 // Connect to the SCP server, and request the code query |
|
851 RSCPClient scpClient; |
|
852 User::LeaveIfError( scpClient.Connect() ); |
|
853 CleanupClosePushL( scpClient ); |
|
854 |
|
855 status = scpClient.SecCodeQuery( password, |
|
856 RSCPClient::SCP_OK_CANCEL, |
|
857 ETrue, |
|
858 KSCPEtelRequest ); |
|
859 // Note that SecCodeQuery doesn't indicate the return value from the dialog |
|
860 |
|
861 CleanupStack::PopAndDestroy(); //scpClient |
|
862 } |
|
863 else |
|
864 { |
|
865 CCodeQueryDialog* securityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); |
|
866 if(AknLayoutUtils::PenEnabled()) |
|
867 securityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
868 else |
|
869 securityDlg->SetEmergencyCallSupport(ETrue); |
|
870 #ifdef __COVER_DISPLAY |
|
871 securityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
872 CAknMediatorFacade* covercl = AknMediatorFacade(securityDlg); // uses MOP, so control provided |
|
873 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
874 { |
|
875 // … - add data that cover ui is interested in |
|
876 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode); // adds int to additional data to be posted to cover ui |
|
877 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
878 } |
|
879 #endif //__COVER_DISPLAY |
|
880 status = securityDlg->ExecuteLD(R_SECURITY_QUERY); |
|
881 } |
|
882 } |
|
883 else |
|
884 { |
|
885 #if defined(_DEBUG) |
|
886 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() Dialog 3")); |
|
887 #endif |
|
888 // Code query due to a setting change; "Cancel" softkey active; |
|
889 // no emergency call support. |
|
890 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw ) && |
|
891 FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
|
892 { |
|
893 // Connect to the SCP server, and request the code query |
|
894 RSCPClient scpClient; |
|
895 User::LeaveIfError( scpClient.Connect() ); |
|
896 CleanupClosePushL( scpClient ); |
|
897 |
|
898 status = scpClient.SecCodeQuery( password, |
|
899 RSCPClient::SCP_OK_CANCEL, |
|
900 EFalse, |
|
901 KSCPEtelRequest ); |
|
902 // Note that SecCodeQuery doesn't indicate the return value from the dialog |
|
903 |
|
904 CleanupStack::PopAndDestroy(); //scpClient |
|
905 } |
|
906 else |
|
907 { |
|
908 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_SECURITY_CODE_MIN_LENGTH,SEC_C_SECURITY_CODE_MAX_LENGTH,ESecUiNone); |
|
909 #ifdef __COVER_DISPLAY |
|
910 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
911 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
912 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
913 { |
|
914 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowSecCode); // adds int to additional data to be posted to cover ui |
|
915 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
916 } |
|
917 #endif //__COVER_DISPLAY |
|
918 // read a flag to see whether the query is SecUi originated. |
|
919 TInt secUiOriginatedQuery(ESecurityUIsETelAPIOriginated); |
|
920 RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
|
921 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
922 CleanupStack::PushL(deviceLockStatusObserver); |
|
923 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
|
924 CleanupStack::PushL(queryStatusObserver); |
|
925 CSecUiLockObserver* callStatusObserver = NULL; |
|
926 if(secUiOriginatedQuery == ESecurityUIsSystemLockOriginated) |
|
927 { |
|
928 callStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiCallStateObserver); |
|
929 CleanupStack::PushL(callStatusObserver); |
|
930 } |
|
931 status = iSecurityDlg->ExecuteLD(R_SECURITY_QUERY); |
|
932 |
|
933 if(callStatusObserver == NULL) |
|
934 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
|
935 else |
|
936 CleanupStack::PopAndDestroy(3); //deviceLockStatusObserver, queryStatusObserver, callStatusObserver |
|
937 iSecurityDlg = NULL; |
|
938 } |
|
939 } |
|
940 TBool isCondition = EFalse; |
|
941 if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
|
942 { |
|
943 if (!status || (status == ESecUiEmergencyCall) |
|
944 || (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) |
|
945 isCondition = ETrue; |
|
946 } |
|
947 else |
|
948 { |
|
949 if ( ( status == KErrCancel ) || (status == ESecUiEmergencyCall) || |
|
950 (status == EAknSoftkeyEmergencyCall) || (status == ESecUiDeviceLocked)) |
|
951 isCondition = ETrue; |
|
952 } |
|
953 if (isCondition) |
|
954 { |
|
955 #if defined(_DEBUG) |
|
956 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DIALOG ERROR")); |
|
957 #endif |
|
958 if (!StartUp) |
728 if (!StartUp) |
959 { |
729 { |
960 #if defined(_DEBUG) |
730 RDEBUG("AbortSecurityCode", 0); |
961 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() ABORT CALLED!!!!!!")); |
|
962 #endif |
|
963 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); |
731 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword); |
|
732 RDEBUG("AbortSecurityCode", 1); |
964 } |
733 } |
965 return KErrCancel; |
734 return KErrCancel; |
966 } |
735 } |
967 |
736 |
968 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
737 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword; |
969 CWait* wait = NULL; |
738 CWait* wait = NULL; |
970 if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
739 TInt status = KErrNone; |
971 { |
740 |
972 #if defined(_DEBUG) |
741 // Validate the code using SCP. This is needed to check expiration |
973 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() VerifySecurityCode")); |
742 RDEBUG("AbortSecurityCode", 0); |
974 #endif |
743 RSCPClient scpClient; |
|
744 RDEBUG("scpClient.Connect", 0); |
|
745 TInt tRet = scpClient.Connect(); |
|
746 RDEBUG("tRet", tRet); |
|
747 |
|
748 CleanupClosePushL(scpClient); |
|
749 |
|
750 RArray<TDevicelockPolicies> aFailedPolicies; |
|
751 TDevicelockPolicies failedPolicy; |
|
752 TInt retLockcode = KErrNone; |
|
753 RMobilePhone::TMobilePassword aISACode; |
|
754 TInt aFlags = 0; |
|
755 RDEBUG("scpClient.VerifyCurrentLockcode", 0); |
|
756 // this validate on ISA . No need to do iPhone.VerifySecurityCode |
|
757 retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, aFlags); |
|
758 RDEBUG("retLockcode", retLockcode); |
|
759 |
|
760 RDEBUG("aISACode", 0); |
|
761 RDEBUGSTR(aISACode); |
|
762 |
|
763 RDEBUG("aFailedPolicies.Count()", aFailedPolicies.Count()); |
|
764 RDEBUG("EDeviceLockPasscodeExpiration", EDeviceLockPasscodeExpiration); // 8 |
|
765 TInt failedEDeviceLockPasscodeExpiration = 0; |
|
766 for (TInt i = 0; i < aFailedPolicies.Count(); i++) |
|
767 { |
|
768 failedPolicy = aFailedPolicies[i]; |
|
769 RDEBUG("failedPolicy", failedPolicy); |
|
770 if (failedPolicy == EDeviceLockPasscodeExpiration) |
|
771 failedEDeviceLockPasscodeExpiration = EDeviceLockPasscodeExpiration; |
|
772 } |
|
773 RDEBUG("Close", 0); |
|
774 scpClient.Close(); |
|
775 RDEBUG("PopAndDestroy", 0); |
|
776 CleanupStack::PopAndDestroy(); //scpClient |
|
777 |
|
778 RDEBUG("failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration); |
|
779 if (failedEDeviceLockPasscodeExpiration > 0) |
|
780 { |
|
781 // the password has expired. Note that it has NOT been validated. It will be revalidated inside ChangeSecCodeParamsL |
|
782 RMobilePhone::TMobilePassword iNewPassword; |
|
783 TInt iFlags = 0; |
|
784 iNewPassword.Copy(_L("")); |
|
785 TBuf<0x80> iCaption; |
|
786 iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate because it's not used |
|
787 TInt iShowError = 1; |
|
788 CSecuritySettings* iSecSettings; |
|
789 iSecSettings = CSecuritySettings::NewL(); |
|
790 TSecUi::InitializeLibL(); |
|
791 RDEBUG("calling ChangeSecCodeParamsL", 0); |
|
792 status = iSecSettings->ChangeSecCodeParamsL(iSecUi_password, iNewPassword, iFlags, iCaption, iShowError); |
|
793 // note that it might have been aborted. The error KErrAbort is shown in this method, not inside ChangeSecCodeParamsL |
|
794 if(status==KErrAccessDenied || status==KErrGsm0707IncorrectPassword) |
|
795 { |
|
796 // the password expired, but the user typed wrongly. The error was already displayed. |
|
797 RDEBUG("SCP returned ", KErrAccessDenied); |
|
798 status=R_CODES_DONT_MATCH; |
|
799 RDEBUG("SCP changed to R_CODES_DONT_MATCH", R_CODES_DONT_MATCH); |
|
800 } |
|
801 RDEBUG("status", status); |
|
802 RDEBUG("iNewPassword", 0); |
|
803 RDEBUGSTR(iNewPassword); |
|
804 TSecUi::UnInitializeLib(); |
|
805 RDEBUG("deleting iSecSettings", 0); |
|
806 delete iSecSettings; |
|
807 RDEBUG("deleted iSecSettings", 1); |
|
808 } |
|
809 else |
|
810 { |
|
811 RDEBUG( "wait", 0 ); |
975 wait = CWait::NewL(); |
812 wait = CWait::NewL(); |
976 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); |
813 RDEBUG("VerifySecurityCode", 0); |
|
814 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); |
|
815 RDEBUG("WaitForRequestL", |
|
816 0); |
977 status = wait->WaitForRequestL(); |
817 status = wait->WaitForRequestL(); |
978 #if defined(_DEBUG) |
818 RDEBUG("WaitForRequestL status", |
979 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() VerifySecurityCode STATUS: %d"), status); |
819 status); |
980 #endif |
|
981 delete wait; |
820 delete wait; |
982 } |
821 #ifdef __WINS__ |
983 else |
822 if (status == KErrNotSupported || status == KErrTimedOut) |
984 { |
823 { |
985 wait = NULL; |
824 RDEBUG( "status", status ); |
986 } |
825 status = KErrNone; |
987 |
826 } |
|
827 #endif |
|
828 } |
|
829 |
988 TInt returnValue = status; |
830 TInt returnValue = status; |
989 switch(status) |
831 RDEBUG("tarmFlag", tarmFlag); |
990 { |
832 RDEBUG("StartUp", StartUp); |
|
833 RDEBUG("status", status); |
|
834 switch (status) |
|
835 { |
991 case KErrNone: |
836 case KErrNone: |
992 #if defined(_DEBUG) |
837 // code approved |
993 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrNone")); |
838 { |
994 #endif |
839 RDEBUG("KErrNone", KErrNone); |
995 // code approved |
840 if( failedEDeviceLockPasscodeExpiration > 0) |
996 if(FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
841 { |
997 { |
842 RDEBUG("code has just been changed. No need to show Confirmation note. failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration); |
|
843 } |
|
844 else |
|
845 { |
|
846 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
|
847 } |
|
848 RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE); |
|
849 if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw)) |
|
850 { |
|
851 RDEBUG("KFeatureIdSapTerminalControlFw", |
|
852 KFeatureIdSapTerminalControlFw); |
998 // Unset the admin flag if set |
853 // Unset the admin flag if set |
999 if ( tarmFlag & KSCPFlagResyncQuery ) |
854 if (tarmFlag & KSCPFlagResyncQuery) |
1000 { |
855 { |
1001 TInt tRet = RProperty::Get( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); |
856 TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); |
1002 |
857 |
1003 if ( tRet == KErrNone ) |
858 if (tRet == KErrNone) |
1004 { |
|
1005 tarmFlag &= ~KSCPFlagResyncQuery; |
|
1006 tRet = RProperty::Set( KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag ); |
|
1007 } |
|
1008 |
|
1009 if ( tRet != KErrNone ) |
|
1010 { |
859 { |
1011 #if defined(_DEBUG) |
860 tarmFlag &= ~KSCPFlagResyncQuery; |
1012 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL():\ |
861 tRet = RProperty::Set(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag); |
1013 FAILED to unset TARM Admin Flag")); |
862 } |
1014 #endif |
863 |
1015 } |
864 if (tRet != KErrNone) |
1016 } |
865 { |
1017 if(!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
866 RDEBUG( |
1018 { |
867 "FAILED to unset TARM Admin Flag tRet=", |
1019 RSCPClient scpClient; |
868 tRet); |
1020 User::LeaveIfError( scpClient.Connect() ); |
869 } |
1021 CleanupClosePushL( scpClient ); |
870 } |
1022 TSCPSecCode newCode; |
871 if (!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)) |
1023 newCode.Copy( password ); |
872 { |
1024 scpClient.StoreCode( newCode ); |
873 RDEBUG("KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements); |
1025 CleanupStack::PopAndDestroy(); //scpClient |
874 RSCPClient scpClient; |
|
875 RDEBUG("scpClient.Connect", 0); |
|
876 TInt tRet = scpClient.Connect(); |
|
877 RDEBUG("tRet", tRet); |
|
878 User::LeaveIfError(tRet); |
|
879 RDEBUG("scpClient.Connect", 1); |
|
880 CleanupClosePushL(scpClient); |
|
881 TSCPSecCode newCode; |
|
882 newCode.Copy(iSecUi_password); |
|
883 RDEBUG( |
|
884 "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode", |
|
885 0); |
|
886 scpClient.StoreCode(newCode); |
|
887 RDEBUG("scpClient.StoreCode", 1); |
|
888 // TODO check whether code is expired. |
|
889 // This should be done by TARM, and they should ask to change the code |
|
890 CleanupStack::PopAndDestroy(); //scpClient |
|
891 } |
|
892 |
1026 } |
893 } |
1027 |
894 RDEBUG("StartUp", StartUp); |
1028 } |
|
1029 |
|
1030 if (StartUp) |
895 if (StartUp) |
1031 { |
896 { |
1032 #if defined(_DEBUG) |
|
1033 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; get autolock period.")); |
|
1034 #endif |
|
1035 |
|
1036 // get autolock period from Central Repository. |
897 // get autolock period from Central Repository. |
1037 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
898 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
1038 TInt period = 0; |
899 TInt period = 0; |
1039 TInt res = repository->Get(KSettingsAutoLockTime, period); |
900 TInt res = repository->Get(KSettingsAutoLockTime, period); |
1040 delete repository; |
901 delete repository; |
1041 |
902 RDEBUG("res", res); |
1042 _LIT_SECURITY_POLICY_PASS(KReadPolicy); |
903 RDEBUG("period", period); |
1043 _LIT_SECURITY_POLICY_C1(KWritePolicy, ECapabilityWriteDeviceData); |
904 _LIT_SECURITY_POLICY_PASS( KReadPolicy); |
1044 RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); |
905 _LIT_SECURITY_POLICY_C1(KWritePolicy, |
|
906 ECapabilityWriteDeviceData); |
|
907 RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy); |
1045 RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); |
908 RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff); |
1046 #if defined(_DEBUG) |
909 RDEBUG("KCoreAppUIsAutolockStatus", |
1047 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() EAutolockOff")); |
910 KCoreAppUIsAutolockStatus); |
1048 #endif |
|
1049 |
911 |
1050 if (res == KErrNone) |
912 if (res == KErrNone) |
1051 { |
913 { |
1052 // disable autolock in Domestic OS side too if autolock period is 0. |
914 // disable autolock in Domestic OS side too if autolock period is 0. |
1053 if (period == 0 ) |
915 if (period == 0) |
1054 { |
916 { |
1055 #ifdef RD_REMOTELOCK |
917 // Don't disable the domestic OS device lock |
1056 // If remote lock is enabled, don't disable the domestic OS device lock |
|
1057 // since that would render the RemoteLock useless. |
918 // since that would render the RemoteLock useless. |
1058 |
919 |
1059 TBool remoteLockStatus( EFalse ); |
920 TBool remoteLockStatus(EFalse); |
1060 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
921 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
1061 |
922 |
1062 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
923 if (remoteLockSettings->GetEnabled(remoteLockStatus)) |
1063 { |
924 { |
1064 if ( !remoteLockStatus ) |
925 if (!remoteLockStatus) |
1065 { |
926 { |
1066 // Remote lock is disabled |
927 // Remote lock is disabled |
1067 #ifdef _DEBUG |
928 RDEBUG( |
1068 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Autolock and RemoteLock are disabled -> disable DOS device lock" ) ); |
929 "Autolock and RemoteLock are disabled -> disable DOS device lock", |
1069 #endif // _DEBUG |
930 0); |
1070 |
|
1071 // Disable DOS device lock setting |
931 // Disable DOS device lock setting |
|
932 RDEBUG( |
|
933 "iCustomPhone.DisablePhoneLock", |
|
934 0); |
1072 wait = CWait::NewL(); |
935 wait = CWait::NewL(); |
1073 iCustomPhone.DisablePhoneLock(wait->iStatus,password); |
936 iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password); |
1074 wait->WaitForRequestL(); |
937 RDEBUG("WaitForRequestL", 0); |
|
938 status = wait->WaitForRequestL(); |
|
939 RDEBUG("WaitForRequestL", status); |
1075 delete wait; |
940 delete wait; |
1076 } |
941 } |
1077 } |
942 } |
1078 else |
943 else |
1079 { |
944 { |
1080 // Failed to get remote lock status |
945 // Failed to get remote lock status |
1081 #ifdef _DEBUG |
946 RDEBUG( |
1082 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Autolock is disabled, but failed to get RemoteLock status, so do nothing." ) ); |
947 "Autolock is disabled, but failed to get RemoteLock status, so do nothing", |
1083 #endif // _DEBUG |
948 0); |
1084 } |
949 } |
1085 |
950 |
1086 delete remoteLockSettings; |
951 delete remoteLockSettings; |
1087 remoteLockSettings = NULL; |
952 remoteLockSettings = NULL; |
1088 |
953 |
1089 #else // not defined RD_REMOTELOCK |
|
1090 |
|
1091 #if defined(_DEBUG) |
|
1092 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; DisablePhoneLock.")); |
|
1093 #endif |
|
1094 wait = CWait::NewL(); |
|
1095 iCustomPhone.DisablePhoneLock(wait->iStatus,password); |
|
1096 wait->WaitForRequestL(); |
|
1097 #if defined(_DEBUG) |
|
1098 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; DisablePhoneLock completed.")); |
|
1099 #endif |
|
1100 delete wait; |
|
1101 #endif // RD_REMOTELOCK |
|
1102 } |
954 } |
1103 } |
955 } |
1104 else |
956 else // error getting repository |
1105 { |
957 { |
1106 #ifdef RD_REMOTELOCK |
958 RDEBUG("error getting repository", 0); |
1107 // If remote lock is enabled, don't disable the domestic OS device lock |
959 // Don't disable the domestic OS device lock |
1108 // since that would render the RemoteLock useless. |
960 // since that would render the RemoteLock useless. |
1109 |
961 |
1110 TBool remoteLockStatus( EFalse ); |
962 TBool remoteLockStatus(EFalse); |
1111 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
963 CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL(); |
1112 |
964 |
1113 if ( remoteLockSettings->GetEnabled( remoteLockStatus ) ) |
965 if (remoteLockSettings->GetEnabled(remoteLockStatus)) |
1114 { |
966 { |
1115 if ( !remoteLockStatus ) |
967 if (!remoteLockStatus) |
1116 { |
968 { |
1117 // Remote lock is disabled |
969 // Remote lock is disabled |
1118 #ifdef _DEBUG |
970 RDEBUG("iCustomPhone.DisablePhoneLock", 0); |
1119 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Failed to get Autolock period and RemoteLock is disabled -> disable DOS device lock" ) ); |
|
1120 #endif // _DEBUG |
|
1121 |
|
1122 wait = CWait::NewL(); |
971 wait = CWait::NewL(); |
1123 iCustomPhone.DisablePhoneLock(wait->iStatus,password); |
972 iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password); |
1124 wait->WaitForRequestL(); |
973 RDEBUG("WaitForRequestL", 0); |
|
974 status = wait->WaitForRequestL(); |
|
975 RDEBUG("WaitForRequestL status", status); |
1125 delete wait; |
976 delete wait; |
1126 } |
977 } |
1127 } |
978 } |
1128 else |
979 else |
1129 { |
980 { |
1130 // Failed to get remote lock status |
981 // Failed to get remote lock status |
1131 #ifdef _DEBUG |
982 RDEBUG( |
1132 RDebug::Print( _L( "(SecUi)CSecurityHandler::PassPhraseRequiredL() - Failed to get Autolock period and RemoteLock status, so do nothing." ) ); |
983 "Failed to get Autolock period and RemoteLock status, so do nothing", |
1133 #endif // _DEBUG |
984 0); |
1134 } |
985 } |
1135 |
986 |
1136 delete remoteLockSettings; |
987 delete remoteLockSettings; |
1137 remoteLockSettings = NULL; |
988 remoteLockSettings = NULL; |
1138 |
989 |
1139 #else // not defined RD_REMOTELOCK |
|
1140 |
|
1141 #if defined(_DEBUG) |
|
1142 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; Could not get autolock period.")); |
|
1143 #endif |
|
1144 // could not get the current autolock time... disable autolock in Domestic OS side. |
|
1145 wait = CWait::NewL(); |
|
1146 iCustomPhone.DisablePhoneLock(wait->iStatus,password); |
|
1147 wait->WaitForRequestL(); |
|
1148 #if defined(_DEBUG) |
|
1149 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL()KErrNone: Startup; NO AUTOLOCK PERIOD; DisablePhoneLock completed.")); |
|
1150 #endif |
|
1151 delete wait; |
|
1152 |
|
1153 #endif // RD_REMOTELOCK |
|
1154 } |
990 } |
1155 |
991 |
1156 } |
992 } // no Startup |
1157 |
993 } |
1158 break; |
994 break; |
1159 case KErrGsmSSPasswordAttemptsViolation: |
995 case KErrGsmSSPasswordAttemptsViolation: |
1160 case KErrLocked: |
996 case KErrLocked: |
|
997 { |
1161 // security code blocked! |
998 // security code blocked! |
1162 #if defined(_DEBUG) |
999 RDEBUG("KErrLocked", KErrLocked) |
1163 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() ErrGsmSSPasswordAttemptsViolation")); |
1000 ; |
1164 #endif |
|
1165 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
1001 CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone); |
|
1002 } |
1166 break; |
1003 break; |
1167 case KErrGsm0707IncorrectPassword: |
1004 case KErrGsm0707IncorrectPassword: |
1168 case KErrAccessDenied: |
1005 case KErrAccessDenied: |
1169 #if defined(_DEBUG) |
1006 { |
1170 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() KErrGsm0707IncorrectPassword")); |
1007 RDEBUG("KErrAccessDenied", KErrAccessDenied); |
1171 #endif |
1008 // The Settings caller might retry |
1172 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1009 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1010 } |
|
1011 break; |
|
1012 case R_CODES_DONT_MATCH: // if password was supposed to be changed, but it failed (the initial verification) |
|
1013 { |
|
1014 RDEBUG("R_CODES_DONT_MATCH", R_CODES_DONT_MATCH); |
|
1015 // Error was already displayed |
|
1016 returnValue = KErrAccessDenied; |
|
1017 } |
1173 break; |
1018 break; |
1174 default: |
1019 default: |
1175 #if defined(_DEBUG) |
1020 { |
1176 RDebug::Print(_L("(SECUI)CSecurityHandler::PassPhraseRequiredL() DEFAULT")); |
1021 RDEBUG("default", status); |
1177 #endif |
|
1178 CSecuritySettings::ShowErrorNoteL(status); |
1022 CSecuritySettings::ShowErrorNoteL(status); |
1179 break; |
1023 // The Settings caller might retry |
1180 } |
1024 } |
1181 |
1025 break; |
|
1026 } |
|
1027 RDEBUG("returnValue", returnValue); |
1182 return returnValue; |
1028 return returnValue; |
1183 } |
1029 } |
1184 // |
1030 // |
1185 // ---------------------------------------------------------- |
1031 // ---------------------------------------------------------- |
1186 // CSecurityHandler::Pin1Required() |
1032 // CSecurityHandler::Pin1Required() |
1187 // Handles Pin1Required event |
1033 // Handles Pin1Required event |
1188 // ---------------------------------------------------------- |
1034 // ---------------------------------------------------------- |
1189 // |
1035 // qtdone |
1190 TInt CSecurityHandler::Pin1RequiredL() |
1036 TInt CSecurityHandler::Pin1RequiredL() |
1191 { |
1037 { |
1192 /***************************************************** |
1038 /***************************************************** |
1193 * Series 60 Customer / ETel |
1039 * Series 60 Customer / ETel |
1194 * Series 60 ETel API |
1040 * Series 60 ETel API |
1195 *****************************************************/ |
1041 *****************************************************/ |
1196 |
1042 RDEBUG("0", 0); |
1197 RMobilePhone::TMobilePassword password; |
1043 |
|
1044 RMobilePhone::TMobilePassword iSecUi_password; |
|
1045 TInt lCancelSupported = ESecUiCancelNotSupported; |
|
1046 TInt lEmergencySupported = ESecUiEmergencyNotSupported; |
|
1047 TInt queryAccepted = KErrCancel; |
|
1048 TInt lAlphaSupported = 0; |
1198 RMobilePhone::TMobilePassword required_fourth; |
1049 RMobilePhone::TMobilePassword required_fourth; |
1199 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; |
1050 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1; |
1200 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1051 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1201 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1052 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1202 TBool StartUp = ETrue; |
1053 TBool StartUp = ETrue; |
1203 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
1054 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
1204 TInt err = KErrNone; |
1055 TInt err = KErrNone; |
1205 TInt res = KErrGeneral; |
1056 TInt res = KErrGeneral; |
1206 CWait* wait = CWait::NewL(); |
1057 CWait* wait = CWait::NewL(); |
1207 CleanupStack::PushL(wait); |
1058 CleanupStack::PushL(wait); |
1208 |
1059 RDEBUG("0", 0); |
1209 |
1060 |
1210 StartUp = iStartup; |
1061 StartUp = iStartup; |
1211 |
1062 |
1212 #if defined(_DEBUG) |
1063 RDEBUG("StartUp", StartUp); |
1213 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL()")); |
1064 if (!StartUp) |
1214 #endif |
1065 { |
1215 |
1066 // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL |
1216 if(!StartUp) |
|
1217 { |
|
1218 // read a flag to see whether the query is SecUi originated. |
|
1219 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1067 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1220 |
1068 if (err != KErrNone) |
1221 if ( err != KErrNone ) |
1069 { |
1222 { |
1070 RDEBUG("FAILED to get the SECUI query Flag err", err); |
1223 #if defined(_DEBUG) |
1071 } |
1224 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL():\ |
1072 } |
1225 FAILED to get the SECUI query Flag: %d"), err); |
1073 RDEBUG("err", err); |
1226 #endif |
1074 RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery); |
|
1075 RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated); |
|
1076 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
|
1077 { |
|
1078 RDEBUG("0", 0); |
|
1079 lCancelSupported = ESecUiCancelNotSupported; |
|
1080 lEmergencySupported = ESecUiEmergencySupported; |
1227 } |
1081 } |
1228 else |
1082 else |
1229 { |
1083 { |
1230 #if defined(_DEBUG) |
1084 lCancelSupported = ESecUiCancelSupported; |
1231 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL():\ |
1085 lEmergencySupported = ESecUiEmergencyNotSupported; |
1232 SECUI query Flag: %d"), secUiOriginatedQuery); |
1086 // it will be RMobilePhone::ESecurityCodePin1 , equivalent to ESecUiNone |
1233 #endif |
1087 } |
1234 } |
1088 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1235 } |
1089 RDEBUG("GetSecurityCodeInfo", 0); |
1236 #if defined(_DEBUG) |
1090 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1237 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg")); |
|
1238 #endif |
|
1239 |
|
1240 if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
|
1241 { |
|
1242 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); |
|
1243 if(AknLayoutUtils::PenEnabled()) |
|
1244 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1245 else |
|
1246 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1247 #ifdef __COVER_DISPLAY |
|
1248 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1249 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1250 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1251 { |
|
1252 // … - add data that cover ui is interested in |
|
1253 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN1); // adds int to additional data to be posted to cover ui |
|
1254 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1255 } |
|
1256 #endif //__COVER_DISPLAY |
|
1257 |
|
1258 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1259 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1260 res = wait->WaitForRequestL(); |
|
1261 #if defined(_DEBUG) |
|
1262 TInt attempts(codeInfo.iRemainingEntryAttempts); |
|
1263 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts query status: %d"), res); |
|
1264 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Remaining Attempts: %d"), attempts); |
|
1265 #endif |
|
1266 User::LeaveIfError(res); |
|
1267 |
|
1268 if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
|
1269 res = iSecurityDlg->ExecuteLD(R_PIN_REQUEST_QUERY); |
|
1270 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1271 { |
|
1272 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1273 res = iSecurityDlg->ExecuteLD(R_PIN_REQUEST_QUERY, *queryPrompt); |
|
1274 CleanupStack::PopAndDestroy(queryPrompt); |
|
1275 } |
|
1276 else |
|
1277 { |
|
1278 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); |
|
1279 res = iSecurityDlg->ExecuteLD(R_PIN_REQUEST_QUERY, *queryPrompt); |
|
1280 CleanupStack::PopAndDestroy(queryPrompt); |
|
1281 } |
|
1282 |
|
1283 iSecurityDlg = NULL; |
|
1284 #if defined(_DEBUG) |
|
1285 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() Execute dlg RESULT: %d"), res); |
|
1286 #endif |
|
1287 if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1288 { |
|
1289 #if defined(_DEBUG) |
|
1290 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_REQUEST_QUERY CANCEL!")); |
|
1291 #endif |
|
1292 CleanupStack::PopAndDestroy(wait); |
|
1293 return KErrCancel; |
|
1294 } |
|
1295 } |
|
1296 else |
|
1297 { |
|
1298 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
1299 #ifdef __COVER_DISPLAY |
|
1300 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1301 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1302 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1303 { |
|
1304 // … - add data that cover ui is interested in |
|
1305 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN1); // adds int to additional data to be posted to cover ui |
|
1306 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1307 } |
|
1308 #endif //__COVER_DISPLAY |
|
1309 |
|
1310 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1311 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1312 res = wait->WaitForRequestL(); |
|
1313 User::LeaveIfError(res); |
|
1314 |
|
1315 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
1316 CleanupStack::PushL(deviceLockStatusObserver); |
|
1317 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
|
1318 CleanupStack::PushL(queryStatusObserver); |
|
1319 |
|
1320 if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
|
1321 res = iSecurityDlg->ExecuteLD(R_PIN_QUERY); |
|
1322 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1323 { |
|
1324 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
|
1325 res = iSecurityDlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); |
|
1326 CleanupStack::PopAndDestroy(queryPrompt); |
|
1327 } |
|
1328 else |
|
1329 { |
|
1330 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN_ATTEMPT); |
|
1331 res = iSecurityDlg->ExecuteLD(R_PIN_QUERY, *queryPrompt); |
|
1332 CleanupStack::PopAndDestroy(queryPrompt); |
|
1333 } |
|
1334 |
|
1335 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
|
1336 iSecurityDlg = NULL; |
|
1337 if( !res || (res == ESecUiDeviceLocked)) |
|
1338 { |
|
1339 #if defined(_DEBUG) |
|
1340 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL() R_PIN_QUERY cancel!")); |
|
1341 #endif |
|
1342 // cancel code request |
|
1343 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); |
|
1344 CleanupStack::PopAndDestroy(wait); |
|
1345 return KErrCancel; |
|
1346 } |
|
1347 } |
|
1348 #if defined(_DEBUG) |
|
1349 RDebug::Print(_L("CSecurityNotifier::Pin1RequiredL()VerifySecurityCode")); |
|
1350 #endif |
|
1351 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); |
|
1352 res = wait->WaitForRequestL(); |
1091 res = wait->WaitForRequestL(); |
1353 CleanupStack::PopAndDestroy(wait); |
1092 |
1354 #if defined(_DEBUG) |
1093 RDEBUG("res", res); |
1355 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin1RequiredL() VerifySecurityCode STATUS: %d"), res); |
1094 #ifdef __WINS__ |
1356 #endif |
1095 RDEBUG("emulator can't read PIN attempts", res); |
|
1096 res = KErrNone; |
|
1097 codeInfo.iRemainingEntryAttempts = 3; |
|
1098 #endif |
|
1099 User::LeaveIfError(res); |
|
1100 |
|
1101 RDEBUG("codeInfo.iRemainingEntryAttempts", |
|
1102 codeInfo.iRemainingEntryAttempts); |
|
1103 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
|
1104 codeInfo.iRemainingEntryAttempts = -1; |
|
1105 |
|
1106 /* request PIN using QT */ |
|
1107 CSecQueryUi *iSecQueryUi; |
|
1108 RDEBUG("CSecQueryUi", 0); |
|
1109 iSecQueryUi = CSecQueryUi::NewL(); |
|
1110 iQueryCanceled = EFalse; |
|
1111 RDEBUG("SecQueryDialog", 1); |
|
1112 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
|
1113 lAlphaSupported = ESecUiAlphaNotSupported; |
|
1114 TBuf<0x100> title; |
|
1115 title.Zero(); |
|
1116 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code")); |
|
1117 title.Append(stringHolder->Des()); |
|
1118 CleanupStack::PopAndDestroy(stringHolder); |
|
1119 title.Append(_L("$")); |
|
1120 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
|
1121 TInt amode = ESecUiSecretSupported | lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeType; |
|
1122 RDEBUG("amode", amode); |
|
1123 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode); |
|
1124 RDEBUG("iSecUi_password", 0); |
|
1125 RDEBUGSTR(iSecUi_password); |
|
1126 iQueryCanceled = ETrue; |
|
1127 delete iSecQueryUi; |
|
1128 RDEBUG("queryAccepted", queryAccepted); |
|
1129 /* end request PIN using QT */ |
|
1130 |
|
1131 if (queryAccepted == KErrAbort) // emergency call |
|
1132 { |
|
1133 RDEBUG("queryAccepted", queryAccepted); |
|
1134 CleanupStack::PopAndDestroy(wait); // this is needed |
|
1135 return KErrCancel; |
|
1136 } |
|
1137 if (lCancelSupported && (queryAccepted == KErrCancel)) |
|
1138 { |
|
1139 // cancel code request |
|
1140 RDEBUG("AbortSecurityCode", 0); |
|
1141 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1); |
|
1142 RDEBUG("AbortSecurityCode", 1); |
|
1143 CleanupStack::PopAndDestroy(wait); // this is needed |
|
1144 return KErrCancel; |
|
1145 } |
|
1146 |
|
1147 RDEBUG("iSecUi_password", 0); |
|
1148 RDEBUGSTR(iSecUi_password); |
|
1149 RDEBUG("VerifySecurityCode", 0); |
|
1150 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); |
|
1151 RDEBUG("WaitForRequestL", 0); |
|
1152 res = wait->WaitForRequestL(); |
|
1153 RDEBUG("WaitForRequestL res", res); |
|
1154 CleanupStack::PopAndDestroy(wait); |
|
1155 |
1357 TInt returnValue = res; |
1156 TInt returnValue = res; |
1358 switch(res) |
1157 switch (res) |
1359 { |
1158 { |
1360 case KErrNone: |
1159 case KErrNone: |
1361 // code approved |
1160 // code approved |
1362 #if defined(_DEBUG) |
1161 RDEBUG("code approved", res) |
1363 RDebug::Print(_L("CSecurityHandler::Pin1RequiredL()code approved ")); |
1162 ; |
1364 #endif |
1163 if (lCancelSupported == ESecUiCancelNotSupported) |
1365 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
1164 { // OK note is not displayed in boot-up, to make things faster |
|
1165 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
|
1166 } |
1366 break; |
1167 break; |
1367 case KErrGsm0707IncorrectPassword: |
1168 case KErrGsm0707IncorrectPassword: |
1368 case KErrAccessDenied: |
1169 case KErrAccessDenied: |
1369 // code was entered erroneously |
1170 // code was entered erroneously |
1370 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1171 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1371 if(StartUp) |
1172 if (StartUp) |
1372 { |
1173 { |
1373 returnValue = Pin1RequiredL(); |
1174 returnValue = Pin1RequiredL(); |
1374 } |
1175 } |
1375 break; |
1176 break; |
1376 case KErrGsmSSPasswordAttemptsViolation: |
1177 case KErrGsmSSPasswordAttemptsViolation: |
1377 case KErrLocked: |
1178 case KErrLocked: |
1378 // code blocked; show error note and terminate. |
1179 // code blocked; show error note and terminate. |
1379 // code blocked |
1180 // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp |
1380 if(StartUp) |
1181 if (StartUp) |
1381 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1182 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1382 break; |
1183 break; |
1383 case KErrGsm0707SimWrong: |
1184 case KErrGsm0707SimWrong: |
1384 // sim lock active |
1185 // sim lock active |
|
1186 // no error? This is strange |
1385 break; |
1187 break; |
1386 default: |
1188 default: |
1387 CSecuritySettings::ShowErrorNoteL(res); |
1189 { |
1388 if(StartUp) |
1190 CSecuritySettings::ShowErrorNoteL(res); |
1389 { |
1191 if (StartUp) |
1390 returnValue = Pin1RequiredL(); |
1192 { |
|
1193 returnValue = Pin1RequiredL(); |
|
1194 } |
1391 } |
1195 } |
1392 break; |
1196 break; |
1393 } |
1197 } |
1394 return returnValue; |
1198 return returnValue; |
1395 } |
1199 } |
1396 // |
1200 // |
1397 // ---------------------------------------------------------- |
1201 // ---------------------------------------------------------- |
1398 // CSecurityHandler::Puk1Required() |
1202 // CSecurityHandler::Puk1Required() |
1399 // Handles Puk1Required event |
1203 // Handles Puk1Required event |
1400 // ---------------------------------------------------------- |
1204 // First asks the PUK1, then verifies, then the newPIN + re-type , and then writes . This is odd, but the API needs the PUK and newPIN in same step. |
1401 // |
1205 // Afterwards, the PIN1 might be asked (because the initial program still needs it) |
|
1206 // ---------------------------------------------------------- |
|
1207 // qtdone |
1402 TInt CSecurityHandler::Puk1RequiredL() |
1208 TInt CSecurityHandler::Puk1RequiredL() |
1403 { |
1209 { |
1404 /***************************************************** |
1210 /***************************************************** |
1405 * Series 60 Customer / ETel |
1211 * Series 60 Customer / ETel |
1406 * Series 60 ETel API |
1212 * Series 60 ETel API |
1407 *****************************************************/ |
1213 *****************************************************/ |
1408 #if defined(_DEBUG) |
1214 RDEBUG("0", 0); |
1409 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL()")); |
1215 TInt queryAccepted = KErrCancel; |
1410 #endif |
1216 RMobilePhone::TMobilePassword puk1_password; |
1411 RMobilePhone::TMobilePassword aPassword; |
1217 RMobilePhone::TMobilePassword aNewPinPassword; |
1412 RMobilePhone::TMobilePassword aNewPassword; |
|
1413 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1218 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1414 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1219 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1415 RMobilePhone::TMobilePhoneSecurityCode blockCodeType; |
1220 RMobilePhone::TMobilePhoneSecurityCode blockCodeType; |
1416 blockCodeType = RMobilePhone::ESecurityCodePuk1; |
1221 blockCodeType = RMobilePhone::ESecurityCodePuk1; |
1417 CWait* wait = CWait::NewL(); |
1222 CWait* wait = CWait::NewL(); |
1418 CleanupStack::PushL(wait); |
1223 CleanupStack::PushL(wait); |
1419 |
1224 |
1420 TBool StartUp(ETrue); |
1225 TBool StartUp(ETrue); |
1421 StartUp = iStartup; |
1226 StartUp = iStartup; |
1422 |
1227 |
1423 TInt res(KErrNone); |
1228 TInt res(KErrCancel); // for the first try |
1424 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1229 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1425 #if defined(_DEBUG) |
1230 |
1426 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info")); |
1231 TInt thisTry = 0; |
1427 #endif |
1232 |
1428 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1233 // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. |
|
1234 while (res != KErrNone && (thisTry++) <= KTriesToConnectServer) |
|
1235 { |
|
1236 if (thisTry > 0) |
|
1237 User::After(KTimeBeforeRetryingRequest); |
|
1238 RDEBUG("GetSecurityCodeInfo", 0); |
|
1239 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
|
1240 RDEBUG("WaitForRequestL", 0); |
|
1241 res = wait->WaitForRequestL(); |
|
1242 RDEBUG("WaitForRequestL res", res); |
|
1243 } |
|
1244 RDEBUG("res", res); |
|
1245 // If there's still an error we're doomed. Bail out. |
|
1246 User::LeaveIfError(res); |
|
1247 |
|
1248 RDEBUG("StartUp", StartUp); |
|
1249 RDEBUG("codeInfo.iRemainingEntryAttempts", |
|
1250 codeInfo.iRemainingEntryAttempts); |
|
1251 TInt attempts(codeInfo.iRemainingEntryAttempts); |
|
1252 RDEBUG("attempts", attempts); |
|
1253 // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
|
1254 if (!StartUp && (attempts == KMaxNumberOfPUKAttempts)) |
|
1255 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1256 |
|
1257 if (attempts == KMaxNumberOfPINAttempts) |
|
1258 attempts = -1; |
|
1259 |
|
1260 CSecQueryUi *iSecQueryUi; |
|
1261 RDEBUG("CSecQueryUi", 0); |
|
1262 iSecQueryUi = CSecQueryUi::NewL(); |
|
1263 iQueryCanceled = EFalse; |
|
1264 RDEBUG("SecQueryDialog", 1); |
|
1265 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
|
1266 TBuf<0x100> title; |
|
1267 title.Zero(); |
|
1268 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); |
|
1269 title.Append(stringHolder->Des()); |
|
1270 CleanupStack::PopAndDestroy(stringHolder); |
|
1271 title.Append(_L("$")); |
|
1272 title.AppendNum(attempts); |
|
1273 TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported; |
|
1274 if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ??? |
|
1275 lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported; |
|
1276 queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
|
1277 | lSecUiCancelSupported | ESecUiPukRequired); |
|
1278 RDEBUG("puk1_password", 0); |
|
1279 RDEBUGSTR(puk1_password); |
|
1280 iQueryCanceled = ETrue; |
|
1281 delete iSecQueryUi; |
|
1282 RDEBUG("queryAccepted", queryAccepted); |
|
1283 |
|
1284 if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) |
|
1285 { |
|
1286 CleanupStack::PopAndDestroy(wait); // this is needed |
|
1287 return KErrCancel; |
|
1288 } |
|
1289 |
|
1290 // send code |
|
1291 // first we verify the puk. For this, we reset the PIN to the same as the PUK |
|
1292 // Hopefully this will never fail in the case "new PIN too long" |
|
1293 RDEBUG("VerifySecurityCode", 0); |
|
1294 iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, puk1_password, puk1_password); |
|
1295 RDEBUG("WaitForRequestL", 0); |
1429 res = wait->WaitForRequestL(); |
1296 res = wait->WaitForRequestL(); |
1430 |
1297 RDEBUG("WaitForRequestL res", res); |
1431 TInt thisTry = 0; |
|
1432 |
|
1433 // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times. |
|
1434 while ( res != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
|
1435 { |
|
1436 User::After( KTimeBeforeRetryingRequest ); |
|
1437 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
|
1438 res = wait->WaitForRequestL(); |
|
1439 } |
|
1440 #if defined(_DEBUG) |
|
1441 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Get Code info result: %d"), res); |
|
1442 #endif |
|
1443 //If there's still an error we're doomed. Bail out. |
|
1444 User::LeaveIfError(res); |
|
1445 |
|
1446 #if defined(_DEBUG) |
|
1447 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show last note")); |
|
1448 #endif |
|
1449 //show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog |
|
1450 if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
|
1451 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1452 |
|
1453 // ask PUK code |
|
1454 iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1455 if(AknLayoutUtils::PenEnabled()) |
|
1456 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1457 else |
|
1458 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1459 #ifdef __COVER_DISPLAY |
|
1460 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1461 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1462 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1463 { |
|
1464 // … - add data that cover ui is interested in |
|
1465 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK1); // adds int to additional data to be posted to cover ui |
|
1466 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1467 } |
|
1468 #endif //__COVER_DISPLAY |
|
1469 |
|
1470 #if defined(_DEBUG) |
|
1471 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Show dialog")); |
|
1472 #endif |
|
1473 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) |
|
1474 res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY); |
|
1475 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1476 { |
|
1477 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1478 res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); |
|
1479 CleanupStack::PopAndDestroy(queryPrompt); |
|
1480 } |
|
1481 else |
|
1482 { |
|
1483 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK_ATTEMPT); |
|
1484 res = iSecurityDlg->ExecuteLD(R_PUK_REQUEST_QUERY, *queryPrompt); |
|
1485 CleanupStack::PopAndDestroy(queryPrompt); |
|
1486 } |
|
1487 |
|
1488 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1489 { |
|
1490 CleanupStack::PopAndDestroy(wait); |
|
1491 return KErrCancel; |
|
1492 } |
|
1493 |
|
1494 RMobilePhone::TMobilePassword verifcationPassword; |
|
1495 // new pin code query |
|
1496 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1497 if(AknLayoutUtils::PenEnabled()) |
|
1498 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1499 else |
|
1500 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1501 res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); |
|
1502 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1503 { |
|
1504 CleanupStack::PopAndDestroy(wait); |
|
1505 return KErrCancel; |
|
1506 } |
|
1507 |
|
1508 // verification code query |
|
1509 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1510 if(AknLayoutUtils::PenEnabled()) |
|
1511 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1512 else |
|
1513 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1514 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); |
|
1515 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1516 { |
|
1517 CleanupStack::PopAndDestroy(wait); |
|
1518 return KErrCancel; |
|
1519 } |
|
1520 |
|
1521 while (aNewPassword.CompareF(verifcationPassword) != 0) |
|
1522 { |
|
1523 // codes do not match -> note -> ask new pin and verification codes again |
|
1524 CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
1525 |
|
1526 verifcationPassword = _L(""); |
|
1527 aNewPassword = _L(""); |
|
1528 |
|
1529 // new pin code query |
|
1530 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1531 if(AknLayoutUtils::PenEnabled()) |
|
1532 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1533 else |
|
1534 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1535 res = iSecurityDlg->ExecuteLD(R_NEW_PIN_CODE_REQUEST_QUERY); |
|
1536 if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1537 { |
|
1538 CleanupStack::PopAndDestroy(wait); |
|
1539 return KErrCancel; |
|
1540 } |
|
1541 |
|
1542 // verification code query |
|
1543 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
1544 if(AknLayoutUtils::PenEnabled()) |
|
1545 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
1546 else |
|
1547 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1548 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN_CODE_REQUEST_QUERY); |
|
1549 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1550 { |
|
1551 CleanupStack::PopAndDestroy(wait); |
|
1552 return KErrCancel; |
|
1553 } |
|
1554 } |
|
1555 |
|
1556 // send code |
|
1557 #if defined(_DEBUG) |
|
1558 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk1RequiredL(): Verify Code")); |
|
1559 #endif |
|
1560 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); |
|
1561 res = wait->WaitForRequestL(); |
|
1562 CleanupStack::PopAndDestroy(wait); |
1298 CleanupStack::PopAndDestroy(wait); |
1563 |
1299 |
1564 TInt returnValue = res; |
1300 TInt returnValue = res; |
1565 switch(res) |
1301 switch (res) |
1566 { |
1302 { |
1567 case KErrNone: |
1303 case KErrNone: |
1568 // code approved -> note |
1304 // code approved -> note . The process continue and new-pin is requested |
1569 CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
1305 CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); |
1570 break; |
1306 break; |
1571 case KErrGsm0707IncorrectPassword: |
1307 case KErrGsm0707IncorrectPassword: |
1572 case KErrAccessDenied: |
1308 case KErrAccessDenied: |
1573 // wrong PUK code -> note -> ask PUK code again |
1309 // wrong PUK code -> note -> ask PUK code again |
1574 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1310 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1575 returnValue = Puk1RequiredL(); |
1311 returnValue = Puk1RequiredL(); |
1576 break; |
1312 break; |
1577 case KErrGsm0707SimWrong: |
1313 case KErrGsm0707SimWrong: |
1578 // sim lock active |
1314 // sim lock active |
|
1315 // no message ? |
1579 break; |
1316 break; |
1580 case KErrGsmSSPasswordAttemptsViolation: |
1317 case KErrGsmSSPasswordAttemptsViolation: |
1581 case KErrLocked: |
1318 case KErrLocked: |
1582 // sim card rejected. |
1319 // sim card rejected. |
1583 break; |
1320 break; |
1584 default: |
1321 default: |
1585 CSecuritySettings::ShowErrorNoteL(res); |
1322 CSecuritySettings::ShowErrorNoteL(res); |
1586 returnValue = Puk1RequiredL(); |
1323 returnValue = Puk1RequiredL(); |
1587 break; |
1324 break; |
1588 } |
1325 } |
1589 |
1326 |
1590 return returnValue; |
1327 // Now the PUK1 is validated. It's time for asking the new PIN1 |
|
1328 RDEBUG("new wait", 0); |
|
1329 wait = CWait::NewL(); |
|
1330 CleanupStack::PushL(wait); |
|
1331 { |
|
1332 // new-pin query |
|
1333 CSecQueryUi * iSecQueryUi; |
|
1334 RDEBUG("CSecQueryUi", 0); |
|
1335 iSecQueryUi = CSecQueryUi::NewL(); |
|
1336 iQueryCanceled = EFalse; |
|
1337 RDEBUG("SecQueryDialog", 1); |
|
1338 TBuf<0x100> title; |
|
1339 title.Zero(); |
|
1340 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code")); |
|
1341 title.Append(stringHolder->Des()); |
|
1342 CleanupStack::PopAndDestroy(stringHolder); |
|
1343 title.Append(_L("|")); |
|
1344 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code")); |
|
1345 title.Append(stringHolder2->Des()); |
|
1346 CleanupStack::PopAndDestroy(stringHolder2); |
|
1347 queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPinPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1348 | ESecUiPukRequired); |
|
1349 RDEBUG("aNewPinPassword", 0); |
|
1350 RDEBUGSTR(aNewPinPassword); |
|
1351 iQueryCanceled = ETrue; |
|
1352 delete iSecQueryUi; |
|
1353 RDEBUG("queryAccepted", queryAccepted); |
|
1354 } |
|
1355 |
|
1356 if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel)) |
|
1357 { |
|
1358 CleanupStack::PopAndDestroy(wait); |
|
1359 return KErrCancel; |
|
1360 } |
|
1361 |
|
1362 // send code again, now with the user pin |
|
1363 RDEBUG("VerifySecurityCode", 0); |
|
1364 iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password); |
|
1365 RDEBUG("WaitForRequestL", 0); |
|
1366 res = wait->WaitForRequestL(); |
|
1367 RDEBUG("WaitForRequestL res", res); |
|
1368 CleanupStack::PopAndDestroy(wait); |
|
1369 |
|
1370 returnValue = res; |
|
1371 switch (res) |
|
1372 { |
|
1373 case KErrNone: |
|
1374 // code approved -> note |
|
1375 CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
1376 break; |
|
1377 case KErrGsm0707IncorrectPassword: |
|
1378 case KErrAccessDenied: |
|
1379 // wrong PUK code -> note -> ask PUK code again |
|
1380 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1381 returnValue = Puk1RequiredL(); |
|
1382 break; |
|
1383 case KErrGsm0707SimWrong: |
|
1384 // sim lock active |
|
1385 // no message ? |
|
1386 break; |
|
1387 case KErrGsmSSPasswordAttemptsViolation: |
|
1388 case KErrLocked: |
|
1389 // sim card rejected. |
|
1390 break; |
|
1391 default: |
|
1392 CSecuritySettings::ShowErrorNoteL(res); |
|
1393 returnValue = Puk1RequiredL(); |
|
1394 break; |
|
1395 } |
|
1396 RDEBUG("returnValue", returnValue); |
|
1397 return returnValue; |
1591 } |
1398 } |
1592 // |
1399 // |
1593 // ---------------------------------------------------------- |
1400 // ---------------------------------------------------------- |
1594 // CSecurityHandler::Pin2Required() |
1401 // CSecurityHandler::Pin2Required() |
1595 // Handles Pin2Required event |
1402 // Handles Pin2Required event |
1596 // ---------------------------------------------------------- |
1403 // ---------------------------------------------------------- |
1597 // |
1404 // qtdone |
1598 void CSecurityHandler::Pin2RequiredL() |
1405 void CSecurityHandler::Pin2RequiredL() |
1599 { |
1406 { |
1600 /***************************************************** |
1407 /***************************************************** |
1601 * Series 60 Customer / ETel |
1408 * Series 60 Customer / ETel |
1602 * Series 60 ETel API |
1409 * Series 60 ETel API |
1603 *****************************************************/ |
1410 *****************************************************/ |
1604 #if defined(_DEBUG) |
1411 |
1605 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL() BEGIN")); |
1412 RDEBUG("0", 0); |
1606 #endif |
1413 TInt queryAccepted = KErrCancel; |
1607 RMobilePhone::TMobilePassword password; |
1414 RMobilePhone::TMobilePassword iSecUi_password; |
1608 RMobilePhone::TMobilePassword required_fourth; |
1415 RMobilePhone::TMobilePassword required_fourth; |
1609 RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); |
1416 RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2); |
1610 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1417 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1611 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1418 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1612 CWait* wait = CWait::NewL(); |
1419 CWait* wait = CWait::NewL(); |
1613 CleanupStack::PushL(wait); |
1420 CleanupStack::PushL(wait); |
1614 |
1421 |
1615 #if defined(_DEBUG) |
1422 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1616 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): create dialog")); |
1423 RDEBUG("GetSecurityCodeInfo", 0); |
1617 #endif |
|
1618 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
1619 #ifdef __COVER_DISPLAY |
|
1620 #if defined(_DEBUG) |
|
1621 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): publish dialog")); |
|
1622 #endif |
|
1623 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1624 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1625 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1626 { |
|
1627 // … - add data that cover ui is interested in |
|
1628 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPIN2); // adds int to additional data to be posted to cover ui |
|
1629 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1630 } |
|
1631 #endif //__COVER_DISPLAY |
|
1632 |
|
1633 #if defined(_DEBUG) |
|
1634 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info")); |
|
1635 #endif |
|
1636 |
|
1637 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1638 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1424 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1425 RDEBUG("WaitForRequestL", 0); |
1639 TInt ret = wait->WaitForRequestL(); |
1426 TInt ret = wait->WaitForRequestL(); |
1640 |
1427 RDEBUG("WaitForRequestL ret", ret); |
1641 #if defined(_DEBUG) |
|
1642 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): get PIN2 info result: %d"), ret); |
|
1643 TInt attempts(codeInfo.iRemainingEntryAttempts); |
|
1644 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): attempts remaining: %d"), attempts); |
|
1645 #endif |
|
1646 User::LeaveIfError(ret); |
1428 User::LeaveIfError(ret); |
1647 |
1429 |
1648 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
1430 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1649 CleanupStack::PushL(deviceLockStatusObserver); |
1431 codeInfo.iRemainingEntryAttempts); |
1650 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
1432 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
1651 CleanupStack::PushL(queryStatusObserver); |
1433 codeInfo.iRemainingEntryAttempts = -1; |
1652 |
1434 |
1653 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) |
1435 /* request PIN using QT */ |
1654 ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY); |
1436 CSecQueryUi *iSecQueryUi; |
1655 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1437 RDEBUG("CSecQueryUi", 0); |
1656 { |
1438 iSecQueryUi = CSecQueryUi::NewL(); |
1657 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PIN2_ATTEMPTS, codeInfo.iRemainingEntryAttempts ); |
1439 iQueryCanceled = EFalse; |
1658 ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
1440 RDEBUG("SecQueryDialog", 1); |
1659 CleanupStack::PopAndDestroy(queryPrompt); |
1441 // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt |
1660 } |
1442 |
1661 else |
1443 TBuf<0x100> title; |
1662 { |
1444 title.Zero(); |
1663 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PIN2_ATTEMPT); |
1445 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code")); |
1664 ret = iSecurityDlg->ExecuteLD(R_PIN2_QUERY, *queryPrompt); |
1446 title.Append(stringHolder->Des()); |
1665 CleanupStack::PopAndDestroy(queryPrompt); |
1447 CleanupStack::PopAndDestroy(stringHolder); |
1666 } |
1448 title.Append(_L("$")); |
1667 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
1449 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1668 iSecurityDlg = NULL; |
1450 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
1669 if (!ret || (ret == ESecUiDeviceLocked)) |
1451 | ESecUiCancelSupported | secCodeType); |
1670 { |
1452 RDEBUG("iSecUi_password", 0); |
1671 iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin2); |
1453 RDEBUGSTR(iSecUi_password); |
|
1454 RDEBUG("queryAccepted", queryAccepted); |
|
1455 iQueryCanceled = ETrue; |
|
1456 delete iSecQueryUi; |
|
1457 |
|
1458 // If failed or device became locked, any pending request should be cancelled. |
|
1459 if (queryAccepted != KErrNone) |
|
1460 { |
|
1461 RDEBUG("AbortSecurityCode", 0); |
|
1462 iPhone.AbortSecurityCode(secCodeType); |
|
1463 RDEBUG("AbortSecurityCode", 1); |
1672 CleanupStack::PopAndDestroy(wait); |
1464 CleanupStack::PopAndDestroy(wait); |
1673 return; |
1465 return; |
1674 } |
1466 } |
1675 |
1467 |
1676 #if defined(_DEBUG) |
1468 RDEBUG("VerifySecurityCode", 0); |
1677 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): Verify Code")); |
1469 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); |
1678 #endif |
1470 RDEBUG("WaitForRequestL", 0); |
1679 iPhone.VerifySecurityCode(wait->iStatus,secCodeType,password,required_fourth); |
|
1680 TInt status = wait->WaitForRequestL(); |
1471 TInt status = wait->WaitForRequestL(); |
1681 #if defined(_DEBUG) |
1472 RDEBUG("WaitForRequestL status", status); |
1682 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): destroy wait")); |
|
1683 #endif |
|
1684 CleanupStack::PopAndDestroy(wait); |
1473 CleanupStack::PopAndDestroy(wait); |
1685 |
1474 |
1686 switch(status) |
1475 switch (status) |
1687 { |
1476 { |
1688 case KErrNone: |
1477 case KErrNone: |
1689 break; |
1478 break; |
1690 case KErrGsm0707IncorrectPassword: |
1479 case KErrGsm0707IncorrectPassword: |
1691 case KErrAccessDenied: |
1480 case KErrAccessDenied: |
1692 // code was entered erroneously |
1481 // code was entered erroneously |
1693 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1482 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1694 break; |
1483 break; |
1695 case KErrGsmSSPasswordAttemptsViolation: |
1484 case KErrGsmSSPasswordAttemptsViolation: |
1696 case KErrLocked: |
1485 case KErrLocked: |
1697 // blocked |
1486 // blocked |
1698 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1487 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1699 break; |
1488 break; |
1700 default: |
1489 default: |
1701 CSecuritySettings::ShowErrorNoteL(status); |
1490 CSecuritySettings::ShowErrorNoteL(status); |
1702 break; |
1491 break; |
1703 } |
1492 } |
1704 #if defined(_DEBUG) |
|
1705 RDebug::Print(_L("(SECUI)CSecurityHandler::Pin2RequiredL(): END")); |
|
1706 #endif |
|
1707 } |
1493 } |
1708 // |
1494 // |
1709 // ---------------------------------------------------------- |
1495 // ---------------------------------------------------------- |
1710 // CSecurityHandler::Puk2Required() |
1496 // CSecurityHandler::Puk2Required() |
1711 // Handles Puk2Required event |
1497 // Handles Puk2Required event |
1712 // ---------------------------------------------------------- |
1498 // ---------------------------------------------------------- |
1713 // |
1499 // qtdone |
1714 void CSecurityHandler::Puk2RequiredL() |
1500 void CSecurityHandler::Puk2RequiredL() |
1715 { |
1501 { |
1716 /***************************************************** |
1502 /***************************************************** |
1717 * Series 60 Customer / ETel |
1503 * Series 60 Customer / ETel |
1718 * Series 60 ETel API |
1504 * Series 60 ETel API |
1719 *****************************************************/ |
1505 *****************************************************/ |
1720 RMobilePhone::TMobilePassword aPassword; |
1506 RDEBUG("0", 0); |
|
1507 TInt queryAccepted = KErrCancel; |
|
1508 RMobilePhone::TMobilePassword iSecUi_password; |
1721 RMobilePhone::TMobilePassword aNewPassword; |
1509 RMobilePhone::TMobilePassword aNewPassword; |
1722 RMobilePhone::TMobilePassword verifcationPassword; |
1510 RMobilePhone::TMobilePassword verifcationPassword; |
1723 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1511 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1724 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1512 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1725 |
1513 |
1726 RMobilePhone::TMobilePhoneSecurityCode blockCodeType; |
1514 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePuk2; |
1727 blockCodeType = RMobilePhone::ESecurityCodePuk2; |
|
1728 CWait* wait = CWait::NewL(); |
1515 CWait* wait = CWait::NewL(); |
1729 CleanupStack::PushL(wait); |
1516 CleanupStack::PushL(wait); |
1730 |
1517 |
1731 #if defined(_DEBUG) |
|
1732 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL()")); |
|
1733 #endif |
|
1734 // ask PUK2 |
1518 // ask PUK2 |
1735 iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK2_CODE_MIN_LENGTH,SEC_C_PUK2_CODE_MAX_LENGTH,ESecUiNone); |
1519 |
1736 #ifdef __COVER_DISPLAY |
1520 TInt ret(KErrNone); |
1737 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1738 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1739 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1740 { |
|
1741 // … - add data that cover ui is interested in |
|
1742 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowPUK2); // adds int to additional data to be posted to cover ui |
|
1743 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1744 } |
|
1745 #endif //__COVER_DISPLAY |
|
1746 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
|
1747 CleanupStack::PushL(deviceLockStatusObserver); |
|
1748 |
|
1749 TInt ret(KErrNone); |
|
1750 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1521 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1751 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1522 RDEBUG("GetSecurityCodeInfo", 0); |
|
1523 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1524 RDEBUG("WaitForRequestL", 0); |
1752 ret = wait->WaitForRequestL(); |
1525 ret = wait->WaitForRequestL(); |
|
1526 RDEBUG("WaitForRequestL ret", ret); |
1753 User::LeaveIfError(ret); |
1527 User::LeaveIfError(ret); |
1754 |
1528 |
1755 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) |
1529 /* request PIN using QT */ |
1756 ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY); |
1530 CSecQueryUi *iSecQueryUi; |
1757 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1531 RDEBUG("CSecQueryUi", 0); |
1758 { |
1532 iSecQueryUi = CSecQueryUi::NewL(); |
1759 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_PUK2_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
1533 iQueryCanceled = EFalse; |
1760 ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); |
1534 RDEBUG("SecQueryDialog", 1); |
1761 CleanupStack::PopAndDestroy(queryPrompt); |
1535 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
1762 } |
1536 |
1763 else |
1537 RDEBUG("codeInfo.iRemainingEntryAttempts", |
1764 { |
1538 codeInfo.iRemainingEntryAttempts); |
1765 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_PUK2_ATTEMPT); |
1539 if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ? |
1766 ret = iSecurityDlg->ExecuteLD(R_PUK2_REQUEST_QUERY, *queryPrompt); |
1540 codeInfo.iRemainingEntryAttempts = -1; |
1767 CleanupStack::PopAndDestroy(queryPrompt); |
1541 |
1768 } |
1542 TBuf<0x100> title; |
1769 |
1543 title.Zero(); |
1770 iSecurityDlg = NULL; |
1544 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk2_code")); |
1771 if(!ret || (ret == ESecUiDeviceLocked)) |
1545 title.Append(stringHolder->Des()); |
1772 { |
1546 CleanupStack::PopAndDestroy(stringHolder); |
1773 #if defined(_DEBUG) |
1547 title.Append(_L("$")); |
1774 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() PUK QUERY CANCEL")); |
1548 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1775 #endif |
1549 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported |
|
1550 | ESecUiCancelSupported | secCodeType); |
|
1551 RDEBUG("iSecUi_password", 0); |
|
1552 RDEBUGSTR(iSecUi_password); |
|
1553 iQueryCanceled = ETrue; |
|
1554 delete iSecQueryUi; |
|
1555 RDEBUG("queryAccepted", queryAccepted); |
|
1556 |
|
1557 if (queryAccepted != KErrNone) |
|
1558 { |
1776 // cancel "get security unblock code" request |
1559 // cancel "get security unblock code" request |
1777 iPhone.AbortSecurityCode(blockCodeType); |
1560 RDEBUG("AbortSecurityCode", 0); |
1778 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
1561 iPhone.AbortSecurityCode(secCodeType); |
|
1562 RDEBUG("AbortSecurityCode", 1); |
|
1563 CleanupStack::PopAndDestroy(1); //wait |
1779 return; |
1564 return; |
1780 } |
1565 } |
1781 #if defined(_DEBUG) |
1566 |
1782 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY")); |
1567 RDEBUG("VerifySecurityCode", 0); |
1783 #endif |
1568 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, iSecUi_password); |
1784 // new pin2 code query |
1569 // this writes the newPIN2 with the value of PUK2. It's ok, since the user forgot it |
1785 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
1570 RDEBUG("WaitForRequestL", 0); |
1786 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
|
1787 ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); |
|
1788 if(!ret || (ret == ESecUiDeviceLocked)) |
|
1789 { |
|
1790 #if defined(_DEBUG) |
|
1791 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() NEW QUERY CANCEL")); |
|
1792 #endif |
|
1793 // cancel "get security unblock code" request |
|
1794 iPhone.AbortSecurityCode(blockCodeType); |
|
1795 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1796 return; |
|
1797 } |
|
1798 |
|
1799 // verification code query |
|
1800 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
1801 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
|
1802 ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); |
|
1803 if (!ret || (ret == ESecUiDeviceLocked)) |
|
1804 { |
|
1805 #if defined(_DEBUG) |
|
1806 RDebug::Print(_L("(SECUI)CSecurityHandler::Puk2RequiredL() VERIFY QUERY CANCEL")); |
|
1807 #endif |
|
1808 // cancel "get security unblock code" request |
|
1809 iPhone.AbortSecurityCode(blockCodeType); |
|
1810 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1811 return; |
|
1812 } |
|
1813 |
|
1814 while (aNewPassword.CompareF(verifcationPassword) != 0) |
|
1815 { |
|
1816 // codes do not match -> note -> ask new pin and verification codes again |
|
1817 CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
1818 |
|
1819 verifcationPassword = _L(""); |
|
1820 aNewPassword = _L(""); |
|
1821 |
|
1822 // new pin2 code query |
|
1823 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN2_CODE_MIN_LENGTH,SEC_C_PIN2_CODE_MAX_LENGTH,ESecUiNone); |
|
1824 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
|
1825 deviceLockStatusObserver->StartObserver(); |
|
1826 |
|
1827 ret = iSecurityDlg->ExecuteLD(R_NEW_PIN2_CODE_QUERY); |
|
1828 |
|
1829 if(!ret || (ret == ESecUiDeviceLocked)) |
|
1830 { |
|
1831 // cancel "get security unblock code" request |
|
1832 iPhone.AbortSecurityCode(blockCodeType); |
|
1833 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1834 return; |
|
1835 } |
|
1836 |
|
1837 // verification code query |
|
1838 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
|
1839 deviceLockStatusObserver->SetAddress(iSecurityDlg); |
|
1840 deviceLockStatusObserver->StartObserver(); |
|
1841 ret = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_PIN2_CODE_QUERY); |
|
1842 |
|
1843 if (!ret || (ret == ESecUiDeviceLocked)) |
|
1844 { |
|
1845 // cancel "get security unblock code" request |
|
1846 iPhone.AbortSecurityCode(blockCodeType); |
|
1847 CleanupStack::PopAndDestroy(2); //wait, deviceLockStatusObserver |
|
1848 return; |
|
1849 } |
|
1850 } |
|
1851 CleanupStack::PopAndDestroy(deviceLockStatusObserver); |
|
1852 // send code |
|
1853 |
|
1854 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); |
|
1855 TInt res = wait->WaitForRequestL(); |
1571 TInt res = wait->WaitForRequestL(); |
|
1572 RDEBUG("WaitForRequestL res", res); |
1856 CleanupStack::PopAndDestroy(wait); |
1573 CleanupStack::PopAndDestroy(wait); |
1857 |
1574 |
1858 switch(res) |
1575 switch (res) |
1859 { |
1576 { |
1860 case KErrNone: |
1577 case KErrNone: |
1861 // code approved -> note |
1578 // code approved -> note |
1862 CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
1579 CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone); |
1863 break; |
1580 break; |
1864 case KErrGsm0707IncorrectPassword: |
1581 case KErrGsm0707IncorrectPassword: |
1865 case KErrAccessDenied: |
1582 case KErrAccessDenied: |
1866 // wrong PUK2 code -> note -> ask PUK2 code again |
1583 // wrong PUK2 code -> note -> ask PUK2 code again |
1867 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1584 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1868 Puk2RequiredL(); |
1585 Puk2RequiredL(); |
1869 break; |
1586 break; |
1870 case KErrGsmSSPasswordAttemptsViolation: |
1587 case KErrGsmSSPasswordAttemptsViolation: |
1871 case KErrLocked: |
1588 case KErrLocked: |
1872 // Pin2 features blocked permanently! |
1589 // Pin2 features blocked permanently! |
1873 CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
1590 CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
1874 break; |
1591 break; |
1875 default: |
1592 default: |
1876 CSecuritySettings::ShowErrorNoteL(res); |
1593 CSecuritySettings::ShowErrorNoteL(res); |
1877 Puk2RequiredL(); |
1594 Puk2RequiredL(); |
1878 break; |
1595 break; |
1879 } |
1596 } |
|
1597 |
|
1598 // now the PUK2 is valid. Time to get the new PIN2 |
|
1599 wait = CWait::NewL(); |
|
1600 CleanupStack::PushL(wait); |
|
1601 { |
|
1602 // new pin2 code query |
|
1603 CSecQueryUi * iSecQueryUi; |
|
1604 RDEBUG("CSecQueryUi", 0); |
|
1605 iSecQueryUi = CSecQueryUi::NewL(); |
|
1606 iQueryCanceled = EFalse; |
|
1607 TBuf<0x100> title; |
|
1608 title.Zero(); |
|
1609 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code")); |
|
1610 title.Append(stringHolder->Des()); |
|
1611 CleanupStack::PopAndDestroy(stringHolder); |
|
1612 title.Append(_L("|")); |
|
1613 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); |
|
1614 title.Append(stringHolder2->Des()); |
|
1615 CleanupStack::PopAndDestroy(stringHolder2); |
|
1616 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
|
1617 queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1618 | secCodeType); |
|
1619 RDEBUG("aNewPassword", 0); |
|
1620 RDEBUGSTR(aNewPassword); |
|
1621 iQueryCanceled = ETrue; |
|
1622 delete iSecQueryUi; |
|
1623 RDEBUG("queryAccepted", queryAccepted); |
|
1624 if (queryAccepted != KErrNone) |
|
1625 { |
|
1626 // cancel "get security unblock code" request |
|
1627 RDEBUG("AbortSecurityCode", 0); |
|
1628 iPhone.AbortSecurityCode(secCodeType); |
|
1629 RDEBUG("AbortSecurityCode", 1); |
|
1630 CleanupStack::PopAndDestroy(1); //wait |
|
1631 return; |
|
1632 } |
|
1633 } |
|
1634 // send code. The code was temporarilly changed before. Thus, this really done to set the new-new one |
|
1635 RDEBUG("VerifySecurityCode", 0); |
|
1636 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, iSecUi_password); |
|
1637 RDEBUG("WaitForRequestL", 0); |
|
1638 res = wait->WaitForRequestL(); |
|
1639 RDEBUG("WaitForRequestL res", res); |
|
1640 CleanupStack::PopAndDestroy(wait); |
|
1641 |
|
1642 switch (res) |
|
1643 { |
|
1644 case KErrNone: |
|
1645 // code approved -> note |
|
1646 CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
|
1647 break; |
|
1648 case KErrGsm0707IncorrectPassword: |
|
1649 case KErrAccessDenied: |
|
1650 // wrong PUK2 code -> note -> ask PUK2 code again |
|
1651 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
|
1652 Puk2RequiredL(); |
|
1653 break; |
|
1654 case KErrGsmSSPasswordAttemptsViolation: |
|
1655 case KErrLocked: |
|
1656 // Pin2 features blocked permanently! |
|
1657 CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone); |
|
1658 break; |
|
1659 default: |
|
1660 CSecuritySettings::ShowErrorNoteL(res); |
|
1661 Puk2RequiredL(); |
|
1662 break; |
|
1663 } |
1880 } |
1664 } |
1881 |
1665 |
1882 // |
1666 // |
1883 // ---------------------------------------------------------- |
1667 // ---------------------------------------------------------- |
1884 // CSecurityHandler::UPinRequiredL() |
1668 // CSecurityHandler::UPinRequiredL() |
1885 // Hendles UniversalPinRequired event |
1669 // Hendles UniversalPinRequired event |
1886 // ---------------------------------------------------------- |
1670 // ---------------------------------------------------------- |
1887 // |
1671 // qtdone |
1888 TInt CSecurityHandler::UPinRequiredL() |
1672 TInt CSecurityHandler::UPinRequiredL() |
1889 { |
1673 { |
1890 /***************************************************** |
1674 /***************************************************** |
1891 * Series 60 Customer / ETel |
1675 * Series 60 Customer / ETel |
1892 * Series 60 ETel API |
1676 * Series 60 ETel API |
1893 *****************************************************/ |
1677 *****************************************************/ |
1894 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1678 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
1895 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1679 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
1896 if(wcdmaSupported || upinSupported) |
1680 RDEBUG("wcdmaSupported", wcdmaSupported); |
1897 { |
1681 RDEBUG("upinSupported", upinSupported); |
1898 RMobilePhone::TMobilePassword password; |
1682 if (wcdmaSupported || upinSupported) |
|
1683 { |
|
1684 TInt queryAccepted = KErrCancel; |
|
1685 TInt lCancelSupported = ESecUiCancelNotSupported; |
|
1686 RMobilePhone::TMobilePassword iSecUi_password; |
1899 RMobilePhone::TMobilePassword required_fourth; |
1687 RMobilePhone::TMobilePassword required_fourth; |
1900 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1688 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1901 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1689 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1902 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin; |
1690 RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin; |
1903 CWait* wait = CWait::NewL(); |
1691 CWait* wait = CWait::NewL(); |
1904 CleanupStack::PushL(wait); |
1692 CleanupStack::PushL(wait); |
1905 TBool StartUp = ETrue; |
1693 TBool StartUp = ETrue; |
1906 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
1694 TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized); |
1907 TInt err = KErrNone; |
1695 TInt err = KErrNone; |
1908 TInt res = KErrGeneral; |
1696 TInt res = KErrGeneral; |
1909 |
1697 |
1910 StartUp = iStartup; |
1698 StartUp = iStartup; |
1911 |
1699 RDEBUG("StartUp", StartUp); |
1912 #if defined(_DEBUG) |
1700 |
1913 RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL()")); |
1701 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1914 #endif |
1702 RDEBUG("GetSecurityCodeInfo", 0); |
1915 |
1703 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1916 if(!StartUp) |
1704 RDEBUG("WaitForRequestL", 0); |
1917 { |
1705 res = wait->WaitForRequestL(); |
|
1706 RDEBUG("WaitForRequestL res", res); |
|
1707 User::LeaveIfError(res); |
|
1708 |
|
1709 if (!StartUp) |
|
1710 { |
1918 // read a flag to see whether the query is SecUi originated. |
1711 // read a flag to see whether the query is SecUi originated. |
1919 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1712 err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery); |
1920 } |
1713 } |
1921 |
1714 |
1922 #if defined(_DEBUG) |
1715 /* request PIN using QT */ |
1923 RDebug::Print(_L("CSecurityHandler::UPinRequiredL() Execute dlg")); |
1716 CSecQueryUi *iSecQueryUi; |
1924 #endif |
1717 RDEBUG("CSecQueryUi", 0); |
1925 if(StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
1718 iSecQueryUi = CSecQueryUi::NewL(); |
1926 { |
1719 iQueryCanceled = EFalse; |
1927 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiCodeEtelReqest); |
1720 // ESecUiCodeEtelReqest/ESecUiNone might be useful |
1928 if(AknLayoutUtils::PenEnabled()) |
1721 // TODO also support Emergency |
1929 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1722 if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone)) |
1930 else |
1723 lCancelSupported = ESecUiCancelNotSupported; |
1931 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
1932 #ifdef __COVER_DISPLAY |
|
1933 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
|
1934 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
|
1935 if (covercl) // returns null if __COVER_DISPLAY is not defined |
|
1936 { |
|
1937 // … - add data that cover ui is interested in |
|
1938 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui |
|
1939 covercl->BufStream().CommitL(); // no more data to send so commit buf |
|
1940 } |
|
1941 #endif //__COVER_DISPLAY |
|
1942 |
|
1943 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1944 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
|
1945 res = wait->WaitForRequestL(); |
|
1946 User::LeaveIfError(res); |
|
1947 |
|
1948 if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
|
1949 res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY); |
|
1950 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
|
1951 { |
|
1952 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
|
1953 res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); |
|
1954 CleanupStack::PopAndDestroy(queryPrompt); |
|
1955 } |
|
1956 else |
|
1957 { |
|
1958 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); |
|
1959 res = iSecurityDlg->ExecuteLD(R_UPIN_REQUEST_QUERY, *queryPrompt); |
|
1960 CleanupStack::PopAndDestroy(queryPrompt); |
|
1961 } |
|
1962 |
|
1963 |
|
1964 if ((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
1965 { |
|
1966 CleanupStack::PopAndDestroy(wait); |
|
1967 return KErrCancel; |
|
1968 } |
|
1969 } |
|
1970 else |
1724 else |
1971 { |
1725 lCancelSupported = ESecUiCancelSupported; |
1972 iSecurityDlg = new (ELeave) CCodeQueryDialog (password,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiNone); |
1726 |
1973 #ifdef __COVER_DISPLAY |
1727 TBuf<0x100> title; |
1974 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
1728 title.Zero(); |
1975 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
1729 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code")); |
1976 if (covercl) // returns null if __COVER_DISPLAY is not defined |
1730 title.Append(stringHolder->Des()); |
1977 { |
1731 CleanupStack::PopAndDestroy(stringHolder); |
1978 // … - add data that cover ui is interested in |
1732 title.Append(_L("$")); |
1979 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPIN); // adds int to additional data to be posted to cover ui |
1733 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
1980 covercl->BufStream().CommitL(); // no more data to send so commit buf |
1734 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiSecretSupported | ESecUiAlphaNotSupported |
1981 } |
1735 | lCancelSupported | ESecUiCodeEtelReqest); |
1982 #endif //__COVER_DISPLAY |
1736 RDEBUG("iSecUi_password", 0); |
1983 |
1737 RDEBUGSTR(iSecUi_password); |
1984 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1738 iQueryCanceled = ETrue; |
1985 iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg); |
1739 delete iSecQueryUi; |
1986 res = wait->WaitForRequestL(); |
1740 RDEBUG("queryAccepted", queryAccepted); |
1987 User::LeaveIfError(res); |
1741 if (queryAccepted != KErrNone) |
1988 |
1742 { |
1989 CSecUiLockObserver* deviceLockStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg); |
1743 CleanupStack::PopAndDestroy(wait); |
1990 CleanupStack::PushL(deviceLockStatusObserver); |
1744 RDEBUG("AbortSecurityCode", 0); |
1991 CSecUiLockObserver* queryStatusObserver = CSecUiLockObserver::NewL(iSecurityDlg, ESecUiRequestStateObserver); |
1745 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); |
1992 CleanupStack::PushL(queryStatusObserver); |
1746 RDEBUG("AbortSecurityCode", 1); |
1993 |
1747 |
1994 if( codeInfo.iRemainingEntryAttempts >= KMaxNumberOfPINAttempts ) |
1748 return KErrCancel; |
1995 res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY); |
1749 } |
1996 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1750 RDEBUG("VerifySecurityCode", 0); |
1997 { |
1751 iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth); |
1998 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPIN_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
1752 RDEBUG("WaitForRequestL", 0); |
1999 res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
|
2000 CleanupStack::PopAndDestroy(queryPrompt); |
|
2001 } |
|
2002 else |
|
2003 { |
|
2004 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPIN_ATTEMPT); |
|
2005 res = iSecurityDlg->ExecuteLD(R_UPIN_QUERY, *queryPrompt); |
|
2006 CleanupStack::PopAndDestroy(queryPrompt); |
|
2007 } |
|
2008 |
|
2009 CleanupStack::PopAndDestroy(2); //deviceLockStatusObserver, queryStatusObserver |
|
2010 iSecurityDlg = NULL; |
|
2011 if( !res || (res == ESecUiDeviceLocked)) |
|
2012 { |
|
2013 // cancel code request |
|
2014 CleanupStack::PopAndDestroy(wait); |
|
2015 iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin); |
|
2016 return KErrCancel; |
|
2017 } |
|
2018 } |
|
2019 |
|
2020 #if defined(_DEBUG) |
|
2021 RDebug::Print(_L("CSecurityNotifier::UPinRequiredL()VerifySecurityCode")); |
|
2022 #endif |
|
2023 iPhone.VerifySecurityCode(wait->iStatus,secCodeType, password, required_fourth); |
|
2024 res = wait->WaitForRequestL(); |
1753 res = wait->WaitForRequestL(); |
|
1754 RDEBUG("WaitForRequestL res", res); |
2025 CleanupStack::PopAndDestroy(wait); |
1755 CleanupStack::PopAndDestroy(wait); |
2026 #if defined(_DEBUG) |
1756 |
2027 RDebug::Print(_L("(SECUI)CSecurityHandler::UPinRequiredL() VerifySecurityCode STATUS: %d"), res); |
|
2028 #endif |
|
2029 TInt returnValue = res; |
1757 TInt returnValue = res; |
2030 switch(res) |
1758 switch (res) |
2031 { |
1759 { |
2032 case KErrNone: |
1760 case KErrNone: |
2033 // code approved |
1761 // code approved |
2034 #if defined(_DEBUG) |
1762 RDEBUG("code approved ", 0) |
2035 RDebug::Print(_L("CSecurityHandler::UPinRequiredL()code approved ")); |
1763 ; |
2036 #endif |
|
2037 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
1764 CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone); |
2038 break; |
1765 break; |
2039 case KErrGsm0707IncorrectPassword: |
1766 case KErrGsm0707IncorrectPassword: |
2040 case KErrAccessDenied: |
1767 case KErrAccessDenied: |
2041 // code was entered erroneously |
1768 // code was entered erroneously |
2042 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1769 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
2043 if(StartUp) |
1770 if (StartUp) |
2044 { |
1771 { |
2045 returnValue = UPinRequiredL(); |
1772 returnValue = UPinRequiredL(); |
2046 } |
1773 } |
2047 break; |
1774 break; |
2048 case KErrGsmSSPasswordAttemptsViolation: |
1775 case KErrGsmSSPasswordAttemptsViolation: |
2049 case KErrLocked: |
1776 case KErrLocked: |
2050 // code blocked; show error note and terminate. |
1777 // code blocked; show error note and terminate. |
2051 if(StartUp) |
1778 if (StartUp) |
2052 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1779 CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone); |
2053 break; |
1780 break; |
2054 case KErrGsm0707SimWrong: |
1781 case KErrGsm0707SimWrong: |
2055 // sim lock active |
1782 // sim lock active |
2056 break; |
1783 break; |
2057 default: |
1784 default: // for example, KErrArgument |
2058 CSecuritySettings::ShowErrorNoteL(res); |
1785 CSecuritySettings::ShowErrorNoteL(res); |
2059 if(StartUp) |
1786 if (StartUp) |
2060 { |
1787 { |
2061 returnValue = UPinRequiredL(); |
1788 returnValue = UPinRequiredL(); |
2062 } |
1789 } |
2063 break; |
1790 break; |
2064 } |
1791 } |
2065 |
1792 |
2066 return returnValue; |
1793 return returnValue; |
2067 } |
1794 } |
2068 else |
1795 else |
2069 return KErrNone; |
1796 return KErrNone; |
2070 } |
1797 } |
2071 // |
1798 // |
2072 // ---------------------------------------------------------- |
1799 // ---------------------------------------------------------- |
2073 // CSecurityHandler::UPukRequiredL() |
1800 // CSecurityHandler::UPukRequiredL() |
2074 // Handles UPukRequired event |
1801 // Handles UPukRequired event |
2075 // ---------------------------------------------------------- |
1802 // ---------------------------------------------------------- |
2076 // |
1803 // qtdone |
2077 TInt CSecurityHandler::UPukRequiredL() |
1804 TInt CSecurityHandler::UPukRequiredL() |
2078 { |
1805 { |
2079 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1806 TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma)); |
2080 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1807 TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin)); |
2081 if(wcdmaSupported || upinSupported) |
1808 if (wcdmaSupported || upinSupported) |
2082 { |
1809 { |
2083 #if defined(_DEBUG) |
1810 RDEBUG("0", 0); |
2084 RDebug::Print(_L("(SECUI)CSecurityHandler::UPukRequiredL()")); |
1811 TInt queryAccepted = KErrCancel; |
2085 #endif |
1812 RMobilePhone::TMobilePassword iSecUi_password; |
2086 RMobilePhone::TMobilePassword aPassword; |
|
2087 RMobilePhone::TMobilePassword aNewPassword; |
1813 RMobilePhone::TMobilePassword aNewPassword; |
2088 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
1814 RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo; |
2089 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
1815 RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo); |
2090 |
1816 |
2091 RMobilePhone::TMobilePhoneSecurityCode blockCodeType; |
1817 RMobilePhone::TMobilePhoneSecurityCode blockCodeType; |
2092 blockCodeType = RMobilePhone::ESecurityUniversalPuk; |
1818 blockCodeType = RMobilePhone::ESecurityUniversalPuk; |
2093 CWait* wait = CWait::NewL(); |
1819 CWait* wait = CWait::NewL(); |
2094 CleanupStack::PushL(wait); |
1820 CleanupStack::PushL(wait); |
2095 |
1821 |
2096 TBool StartUp(ETrue); |
1822 TBool StartUp(ETrue); |
2097 StartUp = iStartup; |
1823 StartUp = iStartup; |
2098 |
1824 |
2099 TInt res(KErrNone); |
1825 TInt res(KErrNone); |
2100 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
1826 wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo); |
|
1827 RDEBUG("GetSecurityCodeInfo", 0); |
2101 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
1828 iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg); |
|
1829 RDEBUG("WaitForRequestL", 0); |
2102 res = wait->WaitForRequestL(); |
1830 res = wait->WaitForRequestL(); |
|
1831 RDEBUG("WaitForRequestL res", res); |
2103 User::LeaveIfError(res); |
1832 User::LeaveIfError(res); |
2104 //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog |
1833 //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog |
2105 if(!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
1834 if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts)) |
2106 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
1835 CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone); |
2107 |
1836 |
2108 // ask UPUK code |
1837 // ask UPUK code |
2109 iSecurityDlg = new (ELeave) CCodeQueryDialog (aPassword,SEC_C_PUK_CODE_MIN_LENGTH,SEC_C_PUK_CODE_MAX_LENGTH,ESecUiPukRequired); |
1838 /* request PIN using QT */ |
2110 if(AknLayoutUtils::PenEnabled()) |
1839 { |
2111 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1840 CSecQueryUi *iSecQueryUi; |
2112 else |
1841 RDEBUG("CSecQueryUi", 0); |
2113 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1842 iSecQueryUi = CSecQueryUi::NewL(); |
2114 #ifdef __COVER_DISPLAY |
1843 iQueryCanceled = EFalse; |
2115 iSecurityDlg->PublishDialogL(SecondaryDisplay::ECmdShowSecurityQuery, SecondaryDisplay::KCatStartup); |
1844 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
2116 CAknMediatorFacade* covercl = AknMediatorFacade(iSecurityDlg); // uses MOP, so control provided |
1845 // TODO also support Emergency |
2117 if (covercl) // returns null if __COVER_DISPLAY is not defined |
1846 |
2118 { |
1847 TBuf<0x100> title; |
2119 // … - add data that cover ui is interested in |
1848 title.Zero(); |
2120 covercl->BufStream().WriteInt32L(SecondaryDisplay::EShowUPUK);// adds int to additional data to be posted to cover ui |
1849 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code")); |
2121 covercl->BufStream().CommitL(); // no more data to send so commit buf |
1850 title.Append(stringHolder->Des()); |
2122 } |
1851 CleanupStack::PopAndDestroy(stringHolder); |
2123 #endif //__COVER_DISPLAY |
1852 title.Append(_L("$")); |
2124 |
1853 title.AppendNum(codeInfo.iRemainingEntryAttempts); |
2125 |
1854 queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported |
2126 if(codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts) |
1855 | ESecUiCancelSupported | ESecUiPukRequired); |
2127 res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY); |
1856 RDEBUG("iSecUi_password", 0); |
2128 else if(codeInfo.iRemainingEntryAttempts > KLastRemainingInputAttempt) |
1857 RDEBUGSTR(iSecUi_password); |
2129 { |
1858 iQueryCanceled = ETrue; |
2130 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_REMAINING_UPUK_ATTEMPTS, codeInfo.iRemainingEntryAttempts); |
1859 delete iSecQueryUi; |
2131 res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); |
1860 RDEBUG("queryAccepted", queryAccepted); |
2132 CleanupStack::PopAndDestroy(queryPrompt); |
1861 |
2133 } |
1862 if (queryAccepted != KErrNone) |
2134 else |
|
2135 { |
|
2136 HBufC* queryPrompt = StringLoader::LoadLC(R_SECUI_FINAL_UPUK_ATTEMPT); |
|
2137 res = iSecurityDlg->ExecuteLD(R_UPUK_REQUEST_QUERY, *queryPrompt); |
|
2138 CleanupStack::PopAndDestroy(queryPrompt); |
|
2139 } |
|
2140 |
|
2141 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
2142 { |
|
2143 CleanupStack::PopAndDestroy(wait); |
|
2144 return KErrCancel; |
|
2145 } |
|
2146 |
|
2147 RMobilePhone::TMobilePassword verifcationPassword; |
|
2148 // new upin code query |
|
2149 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
2150 if(AknLayoutUtils::PenEnabled()) |
|
2151 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
2152 else |
|
2153 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
2154 res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); |
|
2155 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
2156 { |
|
2157 CleanupStack::PopAndDestroy(wait); |
|
2158 return KErrCancel; |
|
2159 } |
|
2160 |
|
2161 // verification code query |
|
2162 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
2163 if(AknLayoutUtils::PenEnabled()) |
|
2164 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
2165 else |
|
2166 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
2167 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); |
|
2168 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
2169 { |
|
2170 CleanupStack::PopAndDestroy(wait); |
|
2171 return KErrCancel; |
|
2172 } |
|
2173 |
|
2174 while (aNewPassword.CompareF(verifcationPassword) != 0) |
|
2175 { |
|
2176 // codes do not match -> note -> ask new upin and verification codes again |
|
2177 CSecuritySettings::ShowResultNoteL(R_CODES_DONT_MATCH, CAknNoteDialog::EErrorTone); |
|
2178 |
|
2179 verifcationPassword = _L(""); |
|
2180 aNewPassword = _L(""); |
|
2181 |
|
2182 // new upin code query |
|
2183 iSecurityDlg = new (ELeave) CCodeQueryDialog (aNewPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
|
2184 if(AknLayoutUtils::PenEnabled()) |
|
2185 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
|
2186 else |
|
2187 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
|
2188 res = iSecurityDlg->ExecuteLD(R_NEW_UPIN_CODE_REQUEST_QUERY); |
|
2189 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
|
2190 { |
1863 { |
2191 CleanupStack::PopAndDestroy(wait); |
1864 CleanupStack::PopAndDestroy(wait); |
2192 return KErrCancel; |
1865 return KErrCancel; |
2193 } |
1866 } |
2194 |
1867 } |
2195 // verification code query |
1868 |
2196 iSecurityDlg = new (ELeave) CCodeQueryDialog (verifcationPassword,SEC_C_PIN_CODE_MIN_LENGTH,SEC_C_PIN_CODE_MAX_LENGTH,ESecUiPukRequired); |
1869 { |
2197 if(AknLayoutUtils::PenEnabled()) |
1870 /* request PIN using QT */ |
2198 iSecurityDlg->SetEmergencyCallSupportForCBA( ETrue ); |
1871 CSecQueryUi *iSecQueryUi; |
2199 else |
1872 RDEBUG("CSecQueryUi", 0); |
2200 iSecurityDlg->SetEmergencyCallSupport(ETrue); |
1873 iSecQueryUi = CSecQueryUi::NewL(); |
2201 res = iSecurityDlg->ExecuteLD(R_VERIFY_NEW_UPIN_CODE_REQUEST_QUERY); |
1874 iQueryCanceled = EFalse; |
2202 if((!res) || (res == ESecUiEmergencyCall) || (res == EAknSoftkeyEmergencyCall)) |
1875 // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful |
|
1876 // TODO also support Emergency |
|
1877 TBuf<0x100> title; |
|
1878 title.Zero(); |
|
1879 HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code")); |
|
1880 title.Append(stringHolder->Des()); |
|
1881 CleanupStack::PopAndDestroy(stringHolder); |
|
1882 title.Append(_L("|")); |
|
1883 HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify")); |
|
1884 title.Append(stringHolder2->Des()); |
|
1885 CleanupStack::PopAndDestroy(stringHolder2); |
|
1886 queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported |
|
1887 | ESecUiPukRequired); |
|
1888 RDEBUG("aNewPassword", 0); |
|
1889 RDEBUGSTR(aNewPassword); |
|
1890 iQueryCanceled = ETrue; |
|
1891 delete iSecQueryUi; |
|
1892 RDEBUG("queryAccepted", queryAccepted); |
|
1893 if (queryAccepted != KErrNone) |
2203 { |
1894 { |
2204 CleanupStack::PopAndDestroy(wait); |
1895 CleanupStack::PopAndDestroy(wait); |
2205 return KErrCancel; |
1896 return KErrCancel; |
2206 } |
1897 } |
2207 } |
1898 } |
2208 |
1899 |
2209 // send code |
1900 // send code |
2210 iPhone.VerifySecurityCode(wait->iStatus,blockCodeType,aNewPassword,aPassword); |
1901 RDEBUG("VerifySecurityCode", 0); |
|
1902 iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPassword, iSecUi_password); |
|
1903 RDEBUG("WaitForRequestL", 0); |
2211 res = wait->WaitForRequestL(); |
1904 res = wait->WaitForRequestL(); |
|
1905 RDEBUG("WaitForRequestL res", res); |
2212 CleanupStack::PopAndDestroy(wait); |
1906 CleanupStack::PopAndDestroy(wait); |
2213 |
1907 |
2214 TInt returnValue = res; |
1908 TInt returnValue = res; |
2215 switch(res) |
1909 switch (res) |
2216 { |
1910 { |
2217 case KErrNone: |
1911 case KErrNone: |
2218 // code approved -> note |
1912 // code approved -> note |
2219 CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
1913 CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone); |
2220 break; |
1914 break; |