20 #include <e32property.h> |
20 #include <e32property.h> |
21 #include <PSVariables.h> // Property values |
21 #include <PSVariables.h> // Property values |
22 #include <coreapplicationuisdomainpskeys.h> |
22 #include <coreapplicationuisdomainpskeys.h> |
23 #include "SecUiSystemLock.h" |
23 #include "SecUiSystemLock.h" |
24 #include <eikenv.h> |
24 #include <eikenv.h> |
25 #include <AknNotifierController.h> |
25 // #include <AknNotifierController.h> |
26 #include <rmmcustomapi.h> |
26 #include <rmmcustomapi.h> |
27 #include "secuisecuritysettings.h" |
27 #include "secuisecuritysettings.h" |
28 #include "SecUiWait.h" |
28 #include "SecUiWait.h" |
29 #include <mmtsy_names.h> |
29 #include <mmtsy_names.h> |
30 #include <e32property.h> |
30 #include <e32property.h> |
31 #include <ctsydomainpskeys.h> |
31 #include <ctsydomainpskeys.h> |
32 #include <securityuisprivatepskeys.h> |
32 #include <securityuisprivatepskeys.h> |
|
33 #include <devicelockaccessapi.h> |
|
34 |
33 /***************************************************** |
35 /***************************************************** |
34 * Series 60 Customer / TSY |
36 * Series 60 Customer / TSY |
35 * Needs customer TSY implementation |
37 * Needs customer TSY implementation |
36 *****************************************************/ |
38 *****************************************************/ |
37 // LOCAL CONSTANTS AND MACROS |
39 // LOCAL CONSTANTS AND MACROS |
139 } |
143 } |
140 } |
144 } |
141 // |
145 // |
142 // ---------------------------------------------------------- |
146 // ---------------------------------------------------------- |
143 // CSystemLock::SetLockedL() |
147 // CSystemLock::SetLockedL() |
144 // Activates system lock |
148 // Activates system lock |
|
149 // this was used by SysAp, but it's not longer used |
145 // ---------------------------------------------------------- |
150 // ---------------------------------------------------------- |
146 // |
151 // |
147 EXPORT_C void CSystemLock::SetLockedL() |
152 EXPORT_C void CSystemLock::SetLockedL() |
148 { |
153 { |
149 /***************************************************** |
154 /***************************************************** |
150 * Series 60 Customer / ETel |
155 * Series 60 Customer / ETel |
151 * Series 60 ETel API |
156 * Series 60 ETel API |
152 *****************************************************/ |
157 *****************************************************/ |
|
158 RDebug::Printf( "%s %s (%u) this should not be called=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
153 #if defined(_DEBUG) |
159 #if defined(_DEBUG) |
154 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL()")); |
160 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL()")); |
155 #endif |
161 #endif |
156 // close fast-swap window |
162 // close fast-swap window |
157 CEikonEnv::Static()->DismissTaskList(); |
163 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
158 |
164 CDevicelockAccessApi* iDevicelockAccess = CDevicelockAccessApi::NewL( ); |
159 #ifdef __WINS__ |
165 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
160 // can not verify security code in emulator ---> lock system |
166 iDevicelockAccess->OfferDevicelock(); |
161 #ifdef RD_REMOTELOCK |
167 // this will do EnableDevicelock( EDevicelockManual ); |
162 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); |
168 RDebug::Printf( "%s %s (%u) value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
163 #else// !RD_REMOTELOCK |
|
164 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); |
|
165 #endif//RD_REMOTELOCK |
|
166 #else //__WINS__ |
|
167 |
|
168 if(IsActive()) |
|
169 return; |
|
170 |
|
171 |
|
172 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
|
173 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
|
174 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
|
175 RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled); |
|
176 CWait* wait = CWait::NewL(); |
|
177 CleanupStack::PushL( wait ); |
|
178 #if defined(_DEBUG) |
|
179 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() GetLockInfo")); |
|
180 #endif |
|
181 iPhone.GetLockInfo(wait->iStatus, lockType, lockInfoPkg); |
|
182 if (wait->WaitForRequestL() == KErrNone) |
|
183 { |
|
184 #if defined(_DEBUG) |
|
185 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() KErrNone")); |
|
186 #endif |
|
187 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
188 { |
|
189 #if defined(_DEBUG) |
|
190 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ELockSetDisabled")); |
|
191 #endif |
|
192 // ask code |
|
193 #if defined(_DEBUG) |
|
194 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() SetLockSetting")); |
|
195 #endif |
|
196 //iCustomPhone.CheckSecurityCode(iStatus, RMmCustomAPI::ESecurityCodePassPhrase); |
|
197 lockChange = RMobilePhone::ELockSetEnabled; |
|
198 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated); |
|
199 iPhone.SetLockSetting(iStatus, lockType, lockChange); |
|
200 SetActive(); |
|
201 } |
|
202 else |
|
203 { |
|
204 #if defined(_DEBUG) |
|
205 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System")); |
|
206 #endif |
|
207 // lock system |
|
208 #ifdef RD_REMOTELOCK |
|
209 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); |
|
210 #else// !RD_REMOTELOCK |
|
211 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); |
|
212 #endif //RD_REMOTELOCK |
|
213 |
|
214 #if defined(_DEBUG) |
|
215 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() Lock System OK")); |
|
216 #endif |
|
217 } |
|
218 } |
|
219 else |
|
220 { |
|
221 // ask code |
|
222 #if defined(_DEBUG) |
|
223 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() ask code (SLS) ")); |
|
224 #endif |
|
225 lockChange = RMobilePhone::ELockSetEnabled; |
|
226 RProperty::Set(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, ESecurityUIsSystemLockOriginated); |
|
227 iPhone.SetLockSetting(iStatus, lockType, lockChange); |
|
228 SetActive(); |
|
229 } |
|
230 CleanupStack::PopAndDestroy(); |
|
231 #if defined(_DEBUG) |
|
232 RDebug::Print(_L("(SECUI)CSystemLock::SetLockedL() END")); |
|
233 #endif // DEBUG |
|
234 #endif // WINS |
|
235 } |
169 } |
236 // |
170 // |
237 // ---------------------------------------------------------- |
171 // ---------------------------------------------------------- |
238 // CSystemLock::RunL() |
172 // CSystemLock::RunL() |
239 // Handles query result |
173 // Handles query result |
|
174 // this was used by SysAp, but it's not longer used |
240 // ---------------------------------------------------------- |
175 // ---------------------------------------------------------- |
241 // |
176 // |
242 void CSystemLock::RunL() |
177 void CSystemLock::RunL() |
243 { |
178 { |
|
179 RDebug::Printf( "%s %s (%u) this should not be called=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
180 |
244 #if defined(_DEBUG) |
181 #if defined(_DEBUG) |
245 TInt status(iStatus.Int()); |
182 TInt status(iStatus.Int()); |
246 RDebug::Print(_L("(SECUI)CSystemLock::RunL(): %d"), status); |
183 RDebug::Print(_L("(SECUI)CSystemLock::RunL(): %d"), status); |
247 #endif |
184 #endif |
248 //lower the flag |
185 //lower the flag |
256 { |
193 { |
257 #if defined(_DEBUG) |
194 #if defined(_DEBUG) |
258 RDebug::Print(_L("(SECUI)CSystemLock::RunL() KErrNone")); |
195 RDebug::Print(_L("(SECUI)CSystemLock::RunL() KErrNone")); |
259 #endif |
196 #endif |
260 // clear notifiers |
197 // clear notifiers |
261 AknNotifierController::HideAllNotifications(ETrue); |
198 // not any more. Avkon is deprecated. Besides, this function should not be called. |
|
199 // AknNotifierController::HideAllNotifications(ETrue); |
262 // query approved -> lock system |
200 // query approved -> lock system |
263 #ifdef RD_REMOTELOCK |
201 #ifdef RD_REMOTELOCK |
264 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); |
202 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EManualLocked); |
265 #else// !RD_REMOTELOCK |
203 #else// !RD_REMOTELOCK |
266 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); |
204 iProperty.Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOn); |
267 #endif//RD_REMOTELOCK |
205 #endif//RD_REMOTELOCK |
268 AknNotifierController::HideAllNotifications(EFalse); |
206 // not any more. Avkon is deprecated. Besides, this function should not be called. |
|
207 // AknNotifierController::HideAllNotifications(EFalse); |
269 } |
208 } |
270 } |
209 } |
271 else if((iStatus != KErrCancel) && (iStatus != KErrAbort)) |
210 else if((iStatus != KErrCancel) && (iStatus != KErrAbort)) |
272 { //Code error or something like that. Show the dialog again. |
211 { //Code error or something like that. Show the dialog again. |
273 #if defined(_DEBUG) |
212 #if defined(_DEBUG) |