75 // ?implementation_description |
77 // ?implementation_description |
76 // ---------------------------------------------------------- |
78 // ---------------------------------------------------------- |
77 // |
79 // |
78 void CAutolockAppUi::ConstructL() |
80 void CAutolockAppUi::ConstructL() |
79 { |
81 { |
80 #if defined(_DEBUG) |
82 #if defined(_DEBUG) |
81 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL")); |
83 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL")); |
82 #endif |
84 #endif |
83 |
85 |
84 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknDisableAnimationBackground ); |
86 BaseConstructL( EAknEnableSkin | EAknEnableMSK | EAknDisableAnimationBackground ); |
85 |
87 |
86 //Disable priority control so that Autolock process priority isn't set to "background" by |
88 //Disable priority control so that Autolock process priority isn't set to "background" by |
87 //window server when it is not active. |
89 //window server when it is not active. |
88 iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); |
90 iEikonEnv->WsSession().ComputeMode( RWsSession::EPriorityControlDisabled ); |
89 RThread().SetProcessPriority( EPriorityHigh ); |
91 RThread().SetProcessPriority( EPriorityHigh ); |
90 |
92 |
91 FeatureManager::InitializeLibL(); |
93 FeatureManager::InitializeLibL(); |
92 |
94 |
93 RTelServer::TPhoneInfo PhoneInfo; |
95 RTelServer::TPhoneInfo PhoneInfo; |
94 // prevent autolock shutdown |
96 // prevent autolock shutdown |
95 iEikonEnv->SetSystem( ETrue ); |
97 iEikonEnv->SetSystem( ETrue ); |
96 |
98 |
97 iSideKey1 = 0; |
99 CKeyLockPolicyApi* iCKeyLockPolicyApi = CKeyLockPolicyApi::NewL( EPolicyActivateKeyguard ); |
98 iSideKey2 = 0; |
100 TBool keyguardAllowed = iCKeyLockPolicyApi->KeyguardAllowed(); |
99 iAppKey = 0; |
101 #if defined(_DEBUG) |
100 |
102 RDebug::Printf( "%s %s (%u) keyguardAllowed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, keyguardAllowed ); |
101 aCallButtonRect = TRect (0,0,0,0); |
103 #endif |
102 iGotEventDownDuringCall = -1; |
104 keyguardAllowed = iCKeyLockPolicyApi->EnableKeyguardFeature(); |
103 //connect to ETel |
105 #if defined(_DEBUG) |
104 |
106 RDebug::Printf( "%s %s (%u) new keyguardAllowed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, keyguardAllowed ); |
105 TInt err( KErrGeneral ); |
107 #endif |
|
108 delete iCKeyLockPolicyApi; |
|
109 |
|
110 iSideKey1 = 0; |
|
111 iSideKey2 = 0; |
|
112 iAppKey = 0; |
|
113 |
|
114 aCallButtonRect = TRect (0,0,0,0); |
|
115 iGotEventDownDuringCall = -1; |
|
116 //connect to ETel |
|
117 |
|
118 TInt err( KErrGeneral ); |
106 TInt thisTry( 0 ); |
119 TInt thisTry( 0 ); |
107 |
120 |
108 /*All server connections are tried to be made KTiesToConnectServer times because occasional |
121 /*All server connections are tried to be made KTiesToConnectServer times because occasional |
109 fails on connections are possible at least on some servers*/ |
122 fails on connections are possible at least on some servers*/ |
110 #if defined(_DEBUG) |
123 #if defined(_DEBUG) |
111 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() connect to etel server")); |
124 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() connect to etel server")); |
112 #endif |
125 #endif |
113 // connect etel server |
126 // connect etel server |
114 while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
127 while ( ( err = iServer.Connect() ) != KErrNone && ( thisTry++ ) <= KTriesToConnectServer ) |
115 { |
128 { |
116 User::After( KTimeBeforeRetryingServerConnection ); |
129 User::After( KTimeBeforeRetryingServerConnection ); |
117 } |
130 } |
118 User::LeaveIfError( err ); |
131 User::LeaveIfError( err ); |
119 |
132 |
120 #if defined(_DEBUG) |
133 #if defined(_DEBUG) |
121 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy")); |
134 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy")); |
122 #endif |
135 #endif |
123 // load tsy |
136 // load tsy |
124 err = iServer.LoadPhoneModule( KMmTsyModuleName ); |
137 err = iServer.LoadPhoneModule( KMmTsyModuleName ); |
125 #if defined(_DEBUG) |
138 #if defined(_DEBUG) |
126 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy ERROR: %d"), err); |
139 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() load tsy ERROR: %d"), err); |
127 #endif |
140 #endif |
128 if ( err != KErrAlreadyExists ) |
141 if ( err != KErrAlreadyExists ) |
129 { |
142 { |
130 // may return also KErrAlreadyExists if some other |
143 // may return also KErrAlreadyExists if some other |
131 // is already loaded the tsy module. And that is |
144 // is already loaded the tsy module. And that is |
132 // not an error. |
145 // not an error. |
133 User::LeaveIfError( err ); |
146 User::LeaveIfError( err ); |
134 } |
147 } |
135 |
148 |
136 thisTry = 0; |
149 thisTry = 0; |
137 #if defined(_DEBUG) |
150 #if defined(_DEBUG) |
138 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() open phone")); |
151 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() open phone")); |
139 #endif |
152 #endif |
140 //open phone |
153 //open phone |
141 User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); |
154 User::LeaveIfError(iServer.SetExtendedErrorGranularity(RTelServer::EErrorExtended)); |
142 User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); |
155 User::LeaveIfError(iServer.GetPhoneInfo(PhoneIndex, PhoneInfo)); |
143 User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); |
156 User::LeaveIfError(iPhone.Open(iServer,PhoneInfo.iName)); |
144 User::LeaveIfError(iCustomPhone.Open(iPhone)); |
157 User::LeaveIfError(iCustomPhone.Open(iPhone)); |
145 #if defined(_DEBUG) |
158 #if defined(_DEBUG) |
146 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() phone opened")); |
159 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() phone opened")); |
147 #endif |
160 #endif |
148 |
161 |
149 TBool systemLocked = EFalse; |
162 TBool systemLocked = EFalse; |
150 TBool phoneLocked = EFalse; |
163 TBool phoneLocked = EFalse; |
151 |
164 |
152 iWait = NULL; |
165 iWait = NULL; |
153 iWait = CWait::NewL(); |
166 iWait = CWait::NewL(); |
154 |
167 |
155 #ifndef __WINS__ |
|
156 |
|
157 |
|
158 /***************************************************** |
|
159 * Series 60 Customer / ETEL |
|
160 * Series 60 ETEL API |
|
161 *****************************************************/ |
|
162 |
|
163 // set autolock period to 0, if lock is disabled in DOS side |
|
164 #if defined(_DEBUG) |
|
165 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() set autolock period to 0")); |
|
166 #endif |
|
167 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
168 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
168 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
169 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
169 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
170 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
170 |
171 TInt cRresult = KErrNone; |
171 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
172 |
172 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
173 #ifndef __WINS__ |
173 TInt res = iWait->WaitForRequestL(); |
174 |
174 User::LeaveIfError(res); |
175 |
175 |
176 /***************************************************** |
|
177 * Series 60 Customer / ETEL |
|
178 * Series 60 ETEL API |
|
179 *****************************************************/ |
|
180 |
|
181 // set autolock period to 0, if lock is disabled in DOS side |
|
182 #if defined(_DEBUG) |
|
183 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() set autolock period to 0")); |
|
184 #endif |
|
185 |
|
186 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
|
187 iPhone.GetLockInfo(iWait->iStatus, lockType, lockInfoPkg); |
|
188 TInt res = iWait->WaitForRequestL(); |
|
189 User::LeaveIfError(res); |
|
190 |
176 // Eventhough we might lock the device on boot-up (systemLocked == ETrue), we |
191 // Eventhough we might lock the device on boot-up (systemLocked == ETrue), we |
177 // want to hide the app until the handshake is done. StartUp application will |
192 // want to hide the app until the handshake is done. StartUp application will |
178 // active the app when it is finished. |
193 // active the app when it is finished. |
179 TApaTask self(iCoeEnv->WsSession()); |
194 TApaTask self(iCoeEnv->WsSession()); |
180 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
195 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
181 self.SendToBackground(); |
196 self.SendToBackground(); |
182 // flush |
197 // flush |
183 iCoeEnv->WsSession().Flush(); |
198 iCoeEnv->WsSession().Flush(); |
184 |
199 |
185 TInt lockValue = 0; |
200 TInt lockValue = 0; |
186 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
201 CRepository* repository = CRepository::NewL(KCRUidSecuritySettings); |
187 TInt cRresult = repository->Get(KSettingsAutolockStatus, lockValue); |
202 cRresult = repository->Get(KSettingsAutolockStatus, lockValue); |
188 TBool hiddenReset = HiddenReset(); |
203 TBool hiddenReset = HiddenReset(); |
189 #if defined(_DEBUG) |
204 #if defined(_DEBUG) |
190 if(hiddenReset) |
205 if(hiddenReset) |
191 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset")); |
206 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() Hidden reset")); |
192 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR get result: %d"), cRresult); |
207 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR get result: %d"), cRresult); |
193 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lock value: %d"), lockValue); |
208 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lock value: %d"), lockValue); |
194 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lockInfo.iSetting: %d"), lockInfo.iSetting); |
209 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() CR lockInfo.iSetting: %d"), lockInfo.iSetting); |
195 #endif |
210 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() RMobilePhone::ELockSetEnabled: %d"), RMobilePhone::ELockSetEnabled); |
196 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
211 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL() RMobilePhone::ELockSetDisabled: %d"), RMobilePhone::ELockSetDisabled); |
197 { |
212 #endif |
|
213 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
|
214 { |
198 repository->Set(KSettingsAutoLockTime, 0); |
215 repository->Set(KSettingsAutoLockTime, 0); |
199 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
216 if ( FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
200 { |
217 { |
201 repository->Set(KSettingsLockOnPowerUp, 0); |
218 repository->Set(KSettingsLockOnPowerUp, 0); |
202 } |
219 } |
236 |
253 |
237 iEcsNote = new (ELeave) CEcsNote(); |
254 iEcsNote = new (ELeave) CEcsNote(); |
238 iEcsNote->ConstructSleepingNoteL(R_AVKON_EMERGENCY_CALL_NOTE); |
255 iEcsNote->ConstructSleepingNoteL(R_AVKON_EMERGENCY_CALL_NOTE); |
239 iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2); |
256 iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->DrawableWindow()->SetOrdinalPosition(0,2); |
240 |
257 |
241 if (AknLayoutUtils::PenEnabled()) // on touch devices, if Autolock is activated from IdleScreen in landscape, the buttons need to be drawn. |
258 if (AknLayoutUtils::PenEnabled()) // on touch devices, if Autolock is activated from IdleScreen in landscape, the buttons need to be drawn. |
242 { |
259 { |
243 iEcsNote->ButtonGroupContainer().SetCommandL( 0, _L("") ); // as keyboard is locked, these buttons do nothing. Better to hide their labels. |
260 iEcsNote->ButtonGroupContainer().SetCommandL( 0, _L("") ); // as keyboard is locked, these buttons do nothing. Better to hide their labels. |
244 iEcsNote->ButtonGroupContainer().SetCommandL( EAknSoftkeyCancel, _L("") ); |
261 iEcsNote->ButtonGroupContainer().SetCommandL( EAknSoftkeyCancel, _L("") ); |
245 iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->MakeVisible(ETrue); |
262 iEcsNote->ButtonGroupContainer().ButtonGroup()->AsControl()->MakeVisible(ETrue); |
246 } |
263 } |
247 |
264 |
248 // Emergency call support |
265 // Emergency call support |
249 iEcsDetector = CAknEcsDetector::NewL(); |
266 iEcsDetector = CAknEcsDetector::NewL(); |
250 iEcsDetector->SetObserver( this ); |
267 iEcsDetector->SetObserver( this ); |
251 iEmergencySupportReady = ETrue; |
268 iEmergencySupportReady = ETrue; |
252 // ------------------------------------------------------------------------------------------------------------- |
269 // ------------------------------------------------------------------------------------------------------------- |
253 |
270 |
254 |
271 |
255 // Autolock view |
272 // Autolock view |
256 CAutolockView* lockView = new(ELeave) CAutolockView; |
273 CAutolockView* lockView = new(ELeave) CAutolockView; |
257 CleanupStack::PushL(lockView); |
274 CleanupStack::PushL(lockView); |
258 lockView->ConstructL(); |
275 lockView->ConstructL(); |
259 CleanupStack::Pop(); // lockView |
276 CleanupStack::Pop(); // lockView |
260 AddViewL(lockView); // transfer ownership to CAknViewAppUi |
277 AddViewL(lockView); // transfer ownership to CAknViewAppUi |
261 SetDefaultViewL(*lockView); |
278 SetDefaultViewL(*lockView); |
262 |
279 |
263 // start autolock timer |
280 // start autolock timer |
264 iModel = CAutoLockModel::NewL(this, phoneLocked); |
281 iModel = CAutoLockModel::NewL(this, phoneLocked); |
265 |
282 |
266 // phone event observer |
283 // phone event observer |
267 iPhoneObserver = CValueObserver::NewL(this); |
284 iPhoneObserver = CValueObserver::NewL(this); |
268 //call bubble |
285 //call bubble |
269 iIncallBubble = CAknIncallBubble::NewL(); |
286 iIncallBubble = CAknIncallBubble::NewL(); |
270 |
287 |
271 //Autokeyguard Period observer |
288 //Autokeyguard Period observer |
272 #ifdef RD_AUTO_KEYGUARD |
289 #ifdef RD_AUTO_KEYGUARD |
273 iKeyguardObserver = CAutoKeyguardObserver::NewL(this); |
290 iKeyguardObserver = CAutoKeyguardObserver::NewL(this); |
274 #else //!RD_AUTO_KEYGUARD |
291 #else //!RD_AUTO_KEYGUARD |
275 iKeyguardObserver = NULL; |
292 iKeyguardObserver = NULL; |
276 #endif //RD_AUTO_KEYGUARD |
293 #endif //RD_AUTO_KEYGUARD |
277 // Create the write policy. Also processes with write device data can write the value. |
294 // Create the write policy. Also processes with write device data can write the value. |
278 TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); |
295 TSecurityPolicy writePolicy( ECapabilityWriteDeviceData ); |
279 // Create the read policy. Also processes with read device data can read the value. |
296 // Create the read policy. Also processes with read device data can read the value. |
280 TSecurityPolicy readPolicy( ECapabilityReadDeviceData ); |
297 TSecurityPolicy readPolicy( ECapabilityReadDeviceData ); |
281 |
298 |
282 TInt tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy ); |
299 TInt tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, RProperty::EInt, readPolicy, writePolicy ); |
283 |
300 |
284 if ( tRet != KErrNone ) |
301 if ( tRet != KErrNone ) |
285 { |
302 { |
286 #if defined(_DEBUG) |
303 #if defined(_DEBUG) |
287 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ |
304 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ |
288 FAILED to define the SECUI query Flag: %d"), tRet); |
305 FAILED to define the SECUI query Flag: %d"), tRet); |
289 #endif |
306 #endif |
290 } |
307 } |
291 |
308 |
292 tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy ); |
309 tRet = RProperty::Define( KPSUidSecurityUIs, KSecurityUIsQueryRequestCancel, RProperty::EInt, readPolicy, writePolicy ); |
293 if ( tRet != KErrNone ) |
310 if ( tRet != KErrNone ) |
294 { |
311 { |
295 #if defined(_DEBUG) |
312 #if defined(_DEBUG) |
318 // (3-button format) and Autolock is not active. |
335 // (3-button format) and Autolock is not active. |
319 |
336 |
320 RSCPClient scpClient; |
337 RSCPClient scpClient; |
321 if ( scpClient.Connect() == KErrNone ) |
338 if ( scpClient.Connect() == KErrNone ) |
322 { |
339 { |
323 TInt confStatus = scpClient.CheckConfiguration( KSCPInitial ); |
340 TInt confStatus = KErrNone; |
324 |
341 // check whether this is normal or exceptional boot. This solves the issue when PIN is requested, Autolock starts, and scpClient.CheckConfiguration verifies the internal lock code |
|
342 TInt startupReason(ENormalStartup); |
|
343 RProperty::Get(KPSUidStartup, KPSStartupReason, startupReason); |
|
344 |
|
345 TInt secQueryStatus = ESecurityQueryUninitialized; |
|
346 TInt tRet = RProperty::Get(KPSUidStartup, KStartupSecurityCodeQueryStatus, secQueryStatus); |
|
347 #if defined(_DEBUG) |
|
348 RDebug::Printf( "%s %s (%u) startupReason=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, startupReason ); |
|
349 RDebug::Printf( "%s %s (%u) secQueryStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, secQueryStatus ); |
|
350 RDebug::Printf( "%s %s (%u) cRresult=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, cRresult ); |
|
351 RDebug::Printf( "%s %s (%u) lockInfo.iSetting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lockInfo.iSetting ); |
|
352 RDebug::Printf( "%s %s (%u) tRet=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); |
|
353 #endif |
|
354 |
|
355 TInt simStatusValue; |
|
356 tRet = RProperty::Get(KPSUidStartup, KPSSimStatus, simStatusValue); |
|
357 #if defined(_DEBUG) |
|
358 RDebug::Printf( "%s %s (%u) tRet=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); |
|
359 RDebug::Printf( "%s %s (%u) simStatusValue=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, simStatusValue ); |
|
360 RDebug::Printf( "%s %s (%u) ESimReadable=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, ESimReadable ); |
|
361 #endif |
|
362 |
|
363 if( simStatusValue==ESimReadable && secQueryStatus==ESecurityQueryActive) |
|
364 { // query during SIM-query. This should not happen because check on CSecurityNotifier::GetParamsL iEvent != RMobilePhone::EPin1Required |
|
365 #if defined(_DEBUG) |
|
366 RDebug::Printf( "%s %s (%u) tRet=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, tRet ); |
|
367 #endif |
|
368 confStatus = KErrNone; // the best thing to do is to skip CheckConfiguration, because it might secretly accept the lock-code |
|
369 } |
|
370 else |
|
371 confStatus = scpClient.CheckConfiguration( KSCPInitial ); |
|
372 #if defined(_DEBUG) |
|
373 RDebug::Printf( "%s %s (%u) confStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, confStatus ); |
|
374 RDebug::Printf( "%s %s (%u) KErrAccessDenied=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KErrAccessDenied ); |
|
375 #endif |
325 if ( confStatus == KErrAccessDenied ) |
376 if ( confStatus == KErrAccessDenied ) |
326 { |
377 { |
327 #ifndef __WINS__ |
378 #ifndef __WINS__ |
328 if ( ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) ) |
379 if ( 1 ) // Previously was ( lockInfo.iSetting == RMobilePhone::ELockSetDisabled ) but now it needs to handle scenarios : ISA_format without drive format, and the opposite |
329 #else // __WINS__ |
380 #else // __WINS__ |
330 if ( 1 ) // DOS lock is never active in WINS |
381 if ( 1 ) // DOS lock is never active in WINS |
331 #endif // __WINS__ |
382 #endif // __WINS__ |
332 { |
383 { |
333 // DOS lock is not active. Note that if DOS is locked, checking the code here will |
384 // DOS lock is not active. Note that if DOS is locked, checking the code here will |
334 // mess up the query sequence. On initial startup DOS is not locked. |
385 // mess up the query sequence. On initial startup DOS is not locked. |
335 |
386 |
336 TInt finalConfStatus = scpClient.CheckConfiguration( KSCPComplete ); |
387 TInt finalConfStatus = scpClient.CheckConfiguration( KSCPComplete ); |
337 |
388 #if defined(_DEBUG) |
|
389 RDebug::Printf( "%s %s (%u) finalConfStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, finalConfStatus ); |
|
390 #endif |
338 if ( finalConfStatus == KErrAccessDenied ) |
391 if ( finalConfStatus == KErrAccessDenied ) |
339 { |
392 { |
340 #ifdef __WINS__ |
393 #ifdef __WINS__ |
341 #if defined(_DEBUG) |
394 #if defined(_DEBUG) |
342 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ |
395 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::ConstructL():\ |
487 delete iGripStatusObserver; |
558 delete iGripStatusObserver; |
488 delete iFpsStatusObserver; |
559 delete iFpsStatusObserver; |
489 #if defined(_DEBUG) |
560 #if defined(_DEBUG) |
490 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() END")); |
561 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::~CAutolockAppUi() END")); |
491 #endif |
562 #endif |
492 } |
563 } |
493 // ---------------------------------------------------- |
564 // ---------------------------------------------------- |
494 // CAutolockAppUi::HandleForegroundEventL() |
565 // CAutolockAppUi::HandleForegroundEventL() |
495 // Handles foreground event. |
566 // Handles foreground event. |
496 // ---------------------------------------------------- |
567 // ---------------------------------------------------- |
497 // |
568 // |
498 void CAutolockAppUi::HandleForegroundEventL(TBool aForeground) |
569 void CAutolockAppUi::HandleForegroundEventL(TBool aForeground) |
499 { |
570 { |
500 #if defined(_DEBUG) |
571 #if defined(_DEBUG) |
501 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleForegroundEventL()")); |
572 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleForegroundEventL()")); |
502 #endif |
573 #endif |
503 if (aForeground ) |
574 if (aForeground ) |
504 { |
575 { |
505 if (iLocked) |
576 if (iLocked) |
506 { |
577 { |
507 // lock voice key |
578 // lock voice key |
508 LockSideKeyL(); |
579 LockSideKeyL(); |
509 CAknView* view = View(KAutoLockViewId); |
580 CAknView* view = View(KAutoLockViewId); |
510 if(view) |
581 if(view) |
511 { |
582 { |
512 TRect aInitialRect; |
583 TRect aInitialRect; |
513 STATIC_CAST(CAutolockView*, view)->HandleCall(0x15, aInitialRect); |
584 STATIC_CAST(CAutolockView*, view)->HandleCall(0x15, aInitialRect); |
514 } |
585 } |
515 |
586 |
516 } |
587 } |
517 else |
588 else |
518 { |
589 { |
519 // app back to background |
590 // app back to background |
520 TApaTask self(iCoeEnv->WsSession()); |
591 TApaTask self(iCoeEnv->WsSession()); |
521 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
592 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
522 self.SendToBackground(); |
593 self.SendToBackground(); |
523 } |
594 } |
524 } |
595 } |
525 |
596 |
526 if (!aForeground && iLocked) |
597 if (!aForeground && iLocked) |
527 { |
598 { |
528 TInt callState=0; |
599 TInt callState=0; |
529 TInt simStatus=0; |
600 TInt simStatus=0; |
530 RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
601 RProperty::Get(KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
531 RProperty::Get(KPSUidStartup, KPSSimStatus, simStatus); |
602 RProperty::Get(KPSUidStartup, KPSSimStatus, simStatus); |
532 |
603 |
533 if (callState == EPSCTsyCallStateNone && simStatus != ESimNotPresent) |
604 if (callState == EPSCTsyCallStateNone && simStatus != ESimNotPresent) |
534 { |
605 { |
535 // try put autolock back to foreground |
606 // try put autolock back to foreground |
536 CAknView* view = View(KAutoLockViewId); |
607 CAknView* view = View(KAutoLockViewId); |
537 if(view) |
608 if(view) |
538 { |
609 { |
539 TRect aInitialRect; |
610 TRect aInitialRect; |
540 STATIC_CAST(CAutolockView*, view)->HandleCall(0x19, aInitialRect); |
611 STATIC_CAST(CAutolockView*, view)->HandleCall(0x19, aInitialRect); |
541 } |
612 } |
542 TApaTask self(iCoeEnv->WsSession()); |
613 TApaTask self(iCoeEnv->WsSession()); |
543 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
614 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
544 self.BringToForeground(); |
615 self.BringToForeground(); |
545 } |
616 } |
546 else |
617 else |
547 { |
618 { |
548 // unlock voice key while there is active call |
619 // unlock voice key while there is active call |
549 UnLockSideKey(); |
620 UnLockSideKey(); |
550 CAknView* view = View(KAutoLockViewId); |
621 CAknView* view = View(KAutoLockViewId); |
551 if(view) |
622 if(view) |
552 { |
623 { |
553 TRect aInitialRect; |
624 TRect aInitialRect; |
554 STATIC_CAST(CAutolockView*, view)->HandleCall(0x16, aInitialRect); |
625 STATIC_CAST(CAutolockView*, view)->HandleCall(0x16, aInitialRect); |
555 } |
626 } |
556 } |
627 } |
557 } |
628 } |
558 |
629 |
559 CAknAppUi::HandleForegroundEventL(aForeground); |
630 CAknAppUi::HandleForegroundEventL(aForeground); |
560 |
631 |
561 } |
632 } |
562 |
633 |
|
634 |
|
635 // ---------------------------------------------------- |
|
636 // HideSoftNotification() |
|
637 // dismiss all the pending notes just before asking the unlocking code |
|
638 // ---------------------------------------------------- |
|
639 // |
|
640 void HideSoftNotification() |
|
641 { |
|
642 #if defined(_DEBUG) |
|
643 RDebug::Print(_L("(AUTOLOCK)HideSoftNotification")); |
|
644 #endif |
|
645 CAknSoftNotifier *softNotifier = NULL; |
|
646 TRAPD (err, { |
|
647 softNotifier = CAknSoftNotifier::NewL(); |
|
648 softNotifier->AddNotificationL(ESetIdleState, 0); |
|
649 };) |
|
650 delete softNotifier; |
|
651 } |
|
652 // CAutolockAppUi::HandleCommandL(TInt aCommand) |
|
653 // ---------------------------------------------------- |
|
654 |
563 |
655 |
564 // ---------------------------------------------------- |
656 // ---------------------------------------------------- |
565 // CAutolockAppUi::HandleMessageL |
657 // CAutolockAppUi::HandleMessageL |
566 // |
658 // |
567 // Handles the TARM command to unlock the phone. |
659 // Handles the TARM command to unlock the phone. |
568 // ---------------------------------------------------- |
660 // ---------------------------------------------------- |
569 // |
661 // |
570 MCoeMessageObserver::TMessageResponse CAutolockAppUi::HandleMessageL( |
662 MCoeMessageObserver::TMessageResponse CAutolockAppUi::HandleMessageL( |
571 TUint32 aClientHandleOfTargetWindowGroup, |
663 TUint32 aClientHandleOfTargetWindowGroup, |
572 TUid aMessageUid, |
664 TUid aMessageUid, |
573 const TDesC8& aMessageParameters |
665 const TDesC8& aMessageParameters |
574 ) |
666 ) |
575 { |
667 { |
576 |
668 |
577 if(!FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
669 if(!FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw )) |
578 { |
670 { |
579 User::Leave(KErrNotSupported); |
671 User::Leave(KErrNotSupported); |
580 } |
672 } |
581 #if defined(_DEBUG) |
673 #if defined(_DEBUG) |
582 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL()")); |
674 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleMessageL()")); |
583 #endif |
675 #endif |
584 |
676 |
585 MCoeMessageObserver::TMessageResponse messageResponse( EMessageHandled ); |
677 MCoeMessageObserver::TMessageResponse messageResponse( EMessageHandled ); |
586 |
678 |
587 if ( aMessageUid.iUid == SCP_CMDUID_UNLOCK ) |
679 if ( aMessageUid.iUid == SCP_CMDUID_UNLOCK+1 ) |
|
680 { |
|
681 #if defined(_DEBUG) |
|
682 RDebug::Printf( "%s %s (%u) calling CancelDeviceLockQuery=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
|
683 #endif |
|
684 CancelDeviceLockQuery(); |
|
685 } |
|
686 else if ( aMessageUid.iUid == SCP_CMDUID_UNLOCK ) |
588 { |
687 { |
589 // For security reasons we must check from the SCP server did this |
688 // For security reasons we must check from the SCP server did this |
590 // command originate from it. |
689 // command originate from it. |
591 RSCPClient scpClient; |
690 RSCPClient scpClient; |
592 if ( scpClient.Connect() == KErrNone ) |
691 if ( scpClient.Connect() == KErrNone ) |
712 event.SetTimeNow(); |
814 event.SetTimeNow(); |
713 ws.SendEventToWindowGroup(wgId, event); |
815 ws.SendEventToWindowGroup(wgId, event); |
714 } |
816 } |
715 } |
817 } |
716 |
818 |
717 // ---------------------------------------------------- |
819 |
718 // HideSoftNotification() |
|
719 // dismiss all the pending notes just before asking the unlocking code |
|
720 // ---------------------------------------------------- |
|
721 // |
|
722 void HideSoftNotification() |
|
723 { |
|
724 #if defined(_DEBUG) |
|
725 RDebug::Print(_L("(AUTOLOCK)HideSoftNotification")); |
|
726 #endif |
|
727 CAknSoftNotifier *softNotifier = NULL; |
|
728 TRAPD (err, { |
|
729 softNotifier = CAknSoftNotifier::NewL(); |
|
730 softNotifier->AddNotificationL(ESetIdleState, 0); |
|
731 };) |
|
732 delete softNotifier; |
|
733 } |
|
734 // CAutolockAppUi::HandleCommandL(TInt aCommand) |
|
735 // ---------------------------------------------------- |
|
736 // |
|
737 void CAutolockAppUi::HandleCommandL(TInt aCommand) |
820 void CAutolockAppUi::HandleCommandL(TInt aCommand) |
738 { |
821 { |
739 #if defined(_DEBUG) |
822 #if defined(_DEBUG) |
740 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL()")); |
823 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL()")); |
741 #endif |
824 #endif |
742 switch ( aCommand ) |
825 switch ( aCommand ) |
743 { |
826 { |
744 case EEikCmdExit: |
827 case EEikCmdExit: |
745 { |
828 { |
746 #if defined(_DEBUG) |
829 #if defined(_DEBUG) |
747 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() EEikCmdExit")); |
830 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() EEikCmdExit")); |
748 #endif |
831 #endif |
749 Exit(); |
832 Exit(); |
750 break; |
833 break; |
751 } |
834 } |
752 case ESecUiCmdUnlock: |
835 case ESecUiCmdUnlock: |
753 { |
836 { |
754 #if defined(_DEBUG) |
837 #if defined(_DEBUG) |
755 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() ESecUiCmdUnlock")); |
838 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleCommandL() ESecUiCmdUnlock")); |
756 #endif |
839 #endif |
757 // stop observing emergency call event |
840 // stop observing emergency call event |
758 iEmergencySupportReady = EFalse; |
841 iEmergencySupportReady = EFalse; |
759 iEcsDetector->Reset(); // Ecs queue is cleared; keys up til here are forgotten |
842 iEcsDetector->Reset(); // Ecs queue is cleared; keys up til here are forgotten |
760 // ask secuity code |
843 // ask secuity code |
761 CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); |
844 CSecurityHandler* handler = new (ELeave) CSecurityHandler(iPhone); |
762 CleanupStack::PushL(handler); |
845 CleanupStack::PushL(handler); |
763 TSecUi::InitializeLibL(); |
846 TSecUi::InitializeLibL(); |
764 |
847 |
765 // Put the lights on when security query is shown |
848 // Put the lights on when security query is shown |
766 SendMessageToSysAp( EEikSecurityQueryLights ); |
849 SendMessageToSysAp( EEikSecurityQueryLights ); |
767 HideSoftNotification(); // dismiss all the pending notes just before asking the unlocking code |
850 HideSoftNotification(); // dismiss all the pending notes just before asking the unlocking code |
768 |
851 |
769 TRAPD(err, |
852 TRAPD(err, |
770 { |
853 { |
771 iDeviceLockQueryStatus = ETrue; |
854 iDeviceLockQueryStatus = ETrue; |
772 if(handler->AskSecCodeInAutoLockL()) |
855 if(handler->AskSecCodeInAutoLockL()) |
773 { |
856 { |
774 iLocked = EFalse; |
857 iLocked = EFalse; |
775 DisableWGListChangeEventListening(); |
858 DisableWGListChangeEventListening(); |
776 iDeviceLockQueryStatus = EFalse; |
859 iDeviceLockQueryStatus = EFalse; |
777 UnLockKeys(); |
860 UnLockKeys(); |
778 iModel->SetLockedL(EFalse); |
861 iModel->SetLockedL(EFalse); |
779 SwitchToPreviousAppL(); |
862 SwitchToPreviousAppL(); |
780 } |
863 } |
781 else |
864 else |
782 { // make sure that we will be topmost still |
865 { // make sure that we will be topmost still |
783 iDeviceLockQueryStatus = EFalse; |
866 iDeviceLockQueryStatus = EFalse; |
784 TInt callState; |
867 TInt callState; |
785 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
868 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
786 if ( callState == EPSCTsyCallStateNone && |
869 if ( callState == EPSCTsyCallStateNone && |
787 !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
870 !FeatureManager::FeatureSupported( KFeatureIdProtocolCdma ) ) |
788 { |
871 { |
789 TApaTask self(CCoeEnv::Static()->WsSession()); |
872 TApaTask self(CCoeEnv::Static()->WsSession()); |
790 self.SetWgId(CCoeEnv::Static()->RootWin().Identifier()); |
873 self.SetWgId(CCoeEnv::Static()->RootWin().Identifier()); |
791 self.BringToForeground(); |
874 self.BringToForeground(); |
792 TBool featureNoPowerkey = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); |
875 TBool featureNoPowerkey = FeatureManager::FeatureSupported( KFeatureIdNoPowerkey ); |
793 if ( featureNoPowerkey ) |
876 if ( featureNoPowerkey ) |
794 {//set lights on in case user pressed "red button". If he pressed cancel the lights are on anyway so it doesn't matter. |
877 {//set lights on in case user pressed "red button". If he pressed cancel the lights are on anyway so it doesn't matter. |
795 SendMessageToSysAp(EEikKeyLockLightsOnRequest); |
878 SendMessageToSysAp(EEikKeyLockLightsOnRequest); |
796 } |
879 } |
797 // we don't want enable lock if call in progress |
880 // we don't want enable lock if call in progress |
798 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
881 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
799 TInt keyguardDisableState(ECoreAppUIsDisableKeyguardUninitialized); |
882 TInt keyguardDisableState(ECoreAppUIsDisableKeyguardUninitialized); |
800 //If there is alarm on the keyguard status is set to disabled. In that case don't enable keyguard as it will be done by SysAp |
883 //If there is alarm on the keyguard status is set to disabled. In that case don't enable keyguard as it will be done by SysAp |
801 //after the alarm has been disabled/snoozed. Otherwise the alarm CBA is left under keyguard CBA. |
884 //after the alarm has been disabled/snoozed. Otherwise the alarm CBA is left under keyguard CBA. |
802 RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, keyguardDisableState ); |
885 RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsDisableKeyguard, keyguardDisableState ); |
803 if ((callState == EPSCTsyCallStateNone) && (keyguardDisableState != ECoreAppUIsDisableKeyguard)) |
886 if ((callState == EPSCTsyCallStateNone) && (keyguardDisableState != ECoreAppUIsDisableKeyguard)) |
804 { |
887 { |
805 RAknKeyLock keylock; |
888 RAknKeyLock keylock; |
806 if ( keylock.Connect() == KErrNone ) |
889 if ( keylock.Connect() == KErrNone ) |
807 { |
890 { |
808 keylock.EnableAutoLockEmulation(); |
891 keylock.EnableAutoLockEmulation(); |
809 keylock.Close(); |
892 keylock.Close(); |
810 } |
893 } |
811 } |
894 } |
812 } |
895 } |
813 } |
896 } |
814 };) |
897 };) |
815 |
898 |
816 // start observing emergency call event |
899 // start observing emergency call event |
817 iEmergencySupportReady = ETrue; |
900 iEmergencySupportReady = ETrue; |
818 CleanupStack::PopAndDestroy(handler); // handler |
901 CleanupStack::PopAndDestroy(handler); // handler |
819 TSecUi::UnInitializeLib(); // secui |
902 TSecUi::UnInitializeLib(); // secui |
820 |
903 |
821 User::LeaveIfError(err); |
904 User::LeaveIfError(err); |
822 |
905 |
823 break; |
906 break; |
824 } |
907 } |
825 default: |
908 default: |
826 break; |
909 break; |
827 } |
910 } |
828 } |
911 } |
829 |
912 |
879 TInt autolockState; |
962 TInt autolockState; |
880 RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); |
963 RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState); |
881 remotelockState = (autolockState == ERemoteLocked); |
964 remotelockState = (autolockState == ERemoteLocked); |
882 #endif//RD_REMOTELOCK |
965 #endif//RD_REMOTELOCK |
883 // If TARM admin flag is set, bring Autolock to foreground regardless of call state. |
966 // If TARM admin flag is set, bring Autolock to foreground regardless of call state. |
|
967 |
|
968 |
884 if(!tarmAdminFlag) |
969 if(!tarmAdminFlag) |
885 { //If phone has been remote locked bring Autolock to foreground regardless of call state. |
970 { //If phone has been remote locked bring Autolock to foreground regardless of call state. |
886 if(!remotelockState) |
971 if(!remotelockState) |
887 { // check if there is active call |
972 { // check if there is active call |
888 TInt callState; |
973 TInt callState; |
889 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
974 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
|
975 #if defined(_DEBUG) |
|
976 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
|
977 #endif |
|
978 |
|
979 TInt value(EStartupUiPhaseUninitialized); |
|
980 RProperty::Get(KPSUidStartup, KPSStartupUiPhase, value); |
|
981 #if defined(_DEBUG) |
|
982 RDebug::Printf( "%s %s (%u) KPSStartupUiPhase value=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, value ); |
|
983 RDebug::Printf( "%s %s (%u) EStartupUiPhaseSystemWelcomeDone=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStartupUiPhaseSystemWelcomeDone ); |
|
984 #endif |
|
985 if(value<EStartupUiPhaseSystemWelcomeDone && callState == EPSCTsyCallStateNone) |
|
986 { |
|
987 callState = EPSCTsyCallStateNone+1; // so that is unlocks |
|
988 iLocked = EFalse; |
|
989 #if defined(_DEBUG) |
|
990 RDebug::Printf( "%s %s (%u) iLocked=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iLocked ); |
|
991 #endif |
|
992 } |
|
993 else if(value<EStartupUiPhaseSystemWelcomeDone && callState > EPSCTsyCallStateNone) |
|
994 { |
|
995 callState = EPSCTsyCallStateNone+0; // so that is locks |
|
996 #if defined(_DEBUG) |
|
997 RDebug::Printf( "%s %s (%u) new+0 callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
|
998 #endif |
|
999 } |
890 if (callState != EPSCTsyCallStateNone ) |
1000 if (callState != EPSCTsyCallStateNone ) |
891 { |
1001 { |
892 iModel->SetLockedL(EFalse); |
1002 #if defined(_DEBUG) |
893 iModel->ResetInactivityTimeout(); |
1003 RDebug::Printf( "%s %s (%u) 1=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
894 UnLockKeys(); |
1004 #endif |
895 return; |
1005 UnLockKeys(); |
896 } |
1006 iModel->SetLockedL(EFalse); |
|
1007 iModel->ResetInactivityTimeout(); |
|
1008 return; |
|
1009 } |
897 } |
1010 } |
898 |
1011 |
899 } |
1012 } |
900 |
1013 |
901 |
1014 |
902 #ifndef __WINS__ |
1015 #ifndef __WINS__ |
903 |
1016 |
904 #ifndef __NO_DOS__ |
1017 #ifndef __NO_DOS__ |
905 |
1018 |
906 /***************************************************** |
1019 /***************************************************** |
907 * Series 60 Customer / ETEL |
1020 * Series 60 Customer / ETEL |
908 * Series 60 ETEL API |
1021 * Series 60 ETEL API |
909 *****************************************************/ |
1022 *****************************************************/ |
910 |
1023 |
911 // check that device locked in DOS side too |
1024 // check that device locked in DOS side too |
912 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
1025 RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice; |
913 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
1026 RMobilePhone::TMobilePhoneLockInfoV1 lockInfo; |
914 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
1027 RMobilePhone::TMobilePhoneLockInfoV1Pckg lockInfoPkg(lockInfo); |
915 |
1028 |
916 #if defined(_DEBUG) |
1029 #if defined(_DEBUG) |
917 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL() GetLockInfo")); |
1030 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL() GetLockInfo")); |
918 #endif |
1031 #endif |
919 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
1032 iWait->SetRequestType(EMobilePhoneGetLockInfo); |
923 if (iWait->iStatus == KErrNone) |
1036 if (iWait->iStatus == KErrNone) |
924 { |
1037 { |
925 // if not don't lock ui either |
1038 // if not don't lock ui either |
926 #if defined(_DEBUG) |
1039 #if defined(_DEBUG) |
927 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL() KErrNone")); |
1040 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::BringAppToForegroundL() KErrNone")); |
|
1041 RDebug::Printf( "%s %s (%u) lockInfo.iSetting=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, lockInfo.iSetting ); |
|
1042 RDebug::Printf( "%s %s (%u) RMobilePhone::ELockSetDisabled=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, RMobilePhone::ELockSetDisabled ); |
928 #endif |
1043 #endif |
929 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
1044 if (lockInfo.iSetting == RMobilePhone::ELockSetDisabled) |
930 { |
1045 { |
931 iModel->SetLockedL(EFalse); |
1046 iModel->SetLockedL(EFalse); |
932 UnLockKeys(); |
1047 UnLockKeys(); |
933 return; |
1048 return; |
934 } |
1049 } |
935 } |
1050 } |
936 #endif |
1051 #endif |
937 |
1052 |
|
1053 #endif |
|
1054 |
|
1055 // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. |
|
1056 // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 |
|
1057 if ( AknLayoutUtils::PenEnabled() ) |
|
1058 { |
|
1059 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
|
1060 |
|
1061 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
|
1062 if (apaTask.Exists()) |
|
1063 { |
|
1064 #if defined(_DEBUG) |
|
1065 RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Bring phone to background")); |
|
1066 #endif |
|
1067 // Bring phone to background |
|
1068 apaTask.SendToBackground(); |
|
1069 } |
|
1070 } |
|
1071 #if defined(_DEBUG) |
|
1072 RDebug::Printf( "%s %s (%u) iPhoneObserver->Start=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
938 #endif |
1073 #endif |
939 |
1074 |
940 // in case Telephone-app is topmost, then the user is confused because he sees but can't use it. |
1075 iPhoneObserver->Start(); |
941 // therefore it's required to hide it, by sending to background. ETMA-7M8A2Y 20090105 |
1076 iLocked = ETrue; |
942 if ( AknLayoutUtils::PenEnabled() ) |
1077 // app to foreground |
943 { |
1078 TApaTask self(iCoeEnv->WsSession()); |
944 TApaTaskList apaTaskList(CCoeEnv::Static()->WsSession()); |
1079 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
945 |
1080 self.BringToForeground(); |
946 TApaTask apaTask = apaTaskList.FindApp(KPhoneAppUid); |
1081 ActivateLocalViewL(KAutoLockViewId); |
947 if (apaTask.Exists()) |
1082 CAknView* view = View(KAutoLockViewId); |
948 { |
1083 if(view) |
949 #if defined(_DEBUG) |
1084 { |
950 RDebug::Print(_L("(AUTOLOCK)CAknKeyLockControl::EnableKeylock() Bring phone to background")); |
1085 TRect aInitialRect; |
951 #endif |
|
952 // Bring phone to background |
|
953 apaTask.SendToBackground(); |
|
954 } |
|
955 } |
|
956 |
|
957 iPhoneObserver->Start(); |
|
958 iLocked = ETrue; |
|
959 // app to foreground |
|
960 TApaTask self(iCoeEnv->WsSession()); |
|
961 self.SetWgId(iCoeEnv->RootWin().Identifier()); |
|
962 self.BringToForeground(); |
|
963 ActivateLocalViewL(KAutoLockViewId); |
|
964 CAknView* view = View(KAutoLockViewId); |
|
965 if(view) |
|
966 { |
|
967 TRect aInitialRect; |
|
968 STATIC_CAST(CAutolockView*, view)->HandleCall(0x17, aInitialRect); |
1086 STATIC_CAST(CAutolockView*, view)->HandleCall(0x17, aInitialRect); |
969 STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue); |
1087 STATIC_CAST(CAutolockView*, view)->MakeVisible(ETrue); |
970 } |
1088 } |
971 else |
1089 else |
972 { |
1090 { |
973 #if defined(_DEBUG) |
1091 #if defined(_DEBUG) |
974 RDebug::Printf( "%s %s (%u) no view ????=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, view ); |
1092 RDebug::Printf( "%s %s (%u) no view ????=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, view ); |
975 #endif |
1093 #endif |
976 } |
1094 } |
977 } |
1095 } |
978 |
1096 |
979 // ---------------------------------------------------- |
1097 // ---------------------------------------------------- |
980 // CAutolockAppUi::LockKeysL() |
1098 // CAutolockAppUi::LockKeysL() |
981 // locks keys |
1099 // locks keys |
982 //---------------------------------------------------- |
1100 //---------------------------------------------------- |
983 // |
1101 // |
984 void CAutolockAppUi::LockKeysL() |
1102 void CAutolockAppUi::LockKeysL() |
985 { |
1103 { |
986 #if defined(_DEBUG) |
1104 #if defined(_DEBUG) |
987 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockKeysL()")); |
1105 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockKeysL()")); |
988 #endif |
1106 #endif |
989 // capture appkey & volume key |
1107 // capture appkey & volume key |
990 if (!iAppKey) |
1108 if (!iAppKey) |
991 { |
1109 { |
992 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1110 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
993 iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key |
1111 iAppKey = groupWin.CaptureKeyUpAndDowns(EStdKeyApplication0, 0, 0); // Capture app key |
994 } |
1112 } |
995 // Any orientation change is a waste of battery and triggers unnecesary window events and paining. |
1113 TInt gripStatus = EPSHWRMGripClosed; |
996 // Not only that: in landscape the BigRedButton is too small. |
1114 RProperty::Get( KPSUidHWRM, KHWRMGripStatus, gripStatus ); |
997 // Therefore we always stay in portrait. The icon looks much nicer. |
1115 #if defined(_DEBUG) |
998 SetOrientationL( EAppUiOrientationPortrait ); |
1116 RDebug::Printf( "%s %s (%u) gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); |
999 LockSideKeyL(); |
1117 #endif |
1000 } |
1118 if(gripStatus==EPSHWRMGripOpen) |
|
1119 ForceOrientation(0); |
|
1120 else |
|
1121 ForceOrientation(1); |
|
1122 LockSideKeyL(); |
|
1123 } |
1001 // ---------------------------------------------------- |
1124 // ---------------------------------------------------- |
1002 // CAutolockAppUi::UnLockKeys() |
1125 // CAutolockAppUi::UnLockKeys() |
1003 // unlocks keys |
1126 // unlocks keys |
1004 //---------------------------------------------------- |
1127 //---------------------------------------------------- |
1005 // |
1128 // |
1006 void CAutolockAppUi::UnLockKeys() |
1129 void CAutolockAppUi::UnLockKeys() |
1007 { |
1130 { |
1008 #if defined(_DEBUG) |
1131 #if defined(_DEBUG) |
1009 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::UnLockKeysL()")); |
1132 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::UnLockKeysL()")); |
1010 #endif |
1133 #endif |
1011 // uncapture appkey |
1134 // uncapture appkey |
1012 if (iAppKey) |
1135 if (iAppKey) |
1013 { |
1136 { |
1014 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1137 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1015 groupWin.CancelCaptureKeyUpAndDowns(iAppKey); |
1138 groupWin.CancelCaptureKeyUpAndDowns(iAppKey); |
1016 iAppKey = 0; |
1139 iAppKey = 0; |
1017 } |
1140 } |
1018 UnLockSideKey(); |
1141 UnLockSideKey(); |
1019 } |
1142 } |
1020 // ---------------------------------------------------- |
1143 // ---------------------------------------------------- |
1021 // CAutolockAppUi::LockSideKeyL() |
1144 // CAutolockAppUi::LockSideKeyL() |
1022 // unlocks side-key |
1145 // unlocks side-key |
1023 //---------------------------------------------------- |
1146 //---------------------------------------------------- |
1024 // |
1147 // |
1025 void CAutolockAppUi::LockSideKeyL() |
1148 void CAutolockAppUi::LockSideKeyL() |
1026 { |
1149 { |
1027 #if defined(_DEBUG) |
1150 #if defined(_DEBUG) |
1028 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockSideKeyL()")); |
1151 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::LockSideKeyL()")); |
1029 #endif |
1152 #endif |
1030 if (!iSideKey1) |
1153 if (!iSideKey1) |
1031 { |
1154 { |
1032 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1155 RWindowGroup& groupWin=iCoeEnv->RootWin(); |
1033 iSideKey1 = groupWin.CaptureKey(EKeyDeviceF,0,0); // EKeySide -> EKeyDeviceF |
1156 iSideKey1 = groupWin.CaptureKey(EKeyDeviceF,0,0); // EKeySide -> EKeyDeviceF |
1034 #if defined(_DEBUG) |
1157 #if defined(_DEBUG) |
1035 RDebug::Printf( "%s %s (%u) capturing EStdKeyDeviceF=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyDeviceF ); |
1158 RDebug::Printf( "%s %s (%u) capturing EStdKeyDeviceF=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyDeviceF ); |
1036 #endif |
1159 #endif |
1037 iSideKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDeviceF, 0, 0); // EStdKeyDevice6 -> EStdKeyDeviceF |
1160 iSideKey2 = groupWin.CaptureKeyUpAndDowns(EStdKeyDeviceF, 0, 0); // EStdKeyDevice6 -> EStdKeyDeviceF |
1038 } |
1161 } |
1039 } |
1162 } |
1040 |
1163 |
1041 // ------------------------------------------------------------------------------------------------------------- |
1164 // ------------------------------------------------------------------------------------------------------------- |
1042 // part of emergency call handling when telephony+devicelock is active |
1165 // part of emergency call handling when telephony+devicelock is active |
1043 // this solution is meant only for 3.1 and 3.2 |
1166 // this solution is meant only for 3.1 and 3.2 |
1044 void CAutolockAppUi::HandleEcsEvent( CAknEcsDetector* aEcsDetector, CAknEcsDetector::TState aState ) |
1167 void CAutolockAppUi::HandleEcsEvent( CAknEcsDetector* aEcsDetector, CAknEcsDetector::TState aState ) |
1216 // Checks whether PIN1/UPIN is blocked |
1339 // Checks whether PIN1/UPIN is blocked |
1217 // ---------------------------------------------------------- |
1340 // ---------------------------------------------------------- |
1218 // |
1341 // |
1219 TBool CAutolockAppUi::IsPinBlocked() |
1342 TBool CAutolockAppUi::IsPinBlocked() |
1220 { |
1343 { |
1221 RMmCustomAPI::TSecurityCodeType secCodeType; |
1344 RMmCustomAPI::TSecurityCodeType secCodeType; |
1222 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1345 TBool wcdmaSupported(FeatureManager::FeatureSupported( KFeatureIdProtocolWcdma )); |
1223 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1346 TBool upinSupported(FeatureManager::FeatureSupported( KFeatureIdUpin )); |
1224 |
1347 |
1225 if(wcdmaSupported || upinSupported) |
1348 if(wcdmaSupported || upinSupported) |
1226 { |
1349 { |
1227 RMobilePhone::TMobilePhoneSecurityCode activePin; |
1350 RMobilePhone::TMobilePhoneSecurityCode activePin; |
1228 iCustomPhone.GetActivePin(activePin); |
1351 iCustomPhone.GetActivePin(activePin); |
1229 if(activePin == RMobilePhone::ESecurityUniversalPin) |
1352 if(activePin == RMobilePhone::ESecurityUniversalPin) |
1230 secCodeType = RMmCustomAPI::ESecurityUniversalPin; |
1353 secCodeType = RMmCustomAPI::ESecurityUniversalPin; |
1231 else |
1354 else |
1232 secCodeType = RMmCustomAPI::ESecurityCodePin1; |
1355 secCodeType = RMmCustomAPI::ESecurityCodePin1; |
1233 } |
1356 } |
1234 else |
1357 else |
1235 secCodeType = RMmCustomAPI::ESecurityCodePin1; |
1358 secCodeType = RMmCustomAPI::ESecurityCodePin1; |
1236 |
1359 |
1237 TBool isBlocked = EFalse; |
1360 TBool isBlocked = EFalse; |
1238 iCustomPhone.IsBlocked(secCodeType,isBlocked); |
1361 iCustomPhone.IsBlocked(secCodeType,isBlocked); |
1239 #if defined(_DEBUG) |
1362 #if defined(_DEBUG) |
1240 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::IsPinBlocked result: %d"), isBlocked); |
1363 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::IsPinBlocked result: %d"), isBlocked); |
1241 #endif |
1364 #endif |
1242 return isBlocked; |
1365 return isBlocked; |
1243 } |
1366 } |
1244 |
1367 |
1245 // |
1368 // |
1246 // ---------------------------------------------------------- |
1369 // ---------------------------------------------------------- |
1247 // CAutolockAppUi::HandleWsEventL() |
1370 // CAutolockAppUi::HandleWsEventL() |
1248 // |
1371 // |
1249 // ---------------------------------------------------------- |
1372 // ---------------------------------------------------------- |
1250 // |
1373 // |
1251 void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination ) |
1374 void CAutolockAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination ) |
1252 { |
1375 { |
1253 const TInt type = aEvent.Type(); |
1376 const TInt type = aEvent.Type(); |
1254 #if defined(_DEBUG) |
1377 #if defined(_DEBUG) |
1255 RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); |
1378 RDebug::Printf( "%s %s (%u) type=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, type ); |
1256 #endif |
1379 #endif |
1257 |
1380 |
1258 switch ( type ) |
1381 switch ( type ) |
1259 { |
1382 { |
1260 case KAknFullOrPartialForegroundLost: // partial or full fg lost |
1383 case KAknFullOrPartialForegroundLost: // partial or full fg lost |
1261 if( iIncallBubble ) |
1384 if( iIncallBubble ) |
1262 { |
1385 { |
1263 #if defined(_DEBUG) |
1386 #if defined(_DEBUG) |
1264 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleWsEventL: DISABLE call bubble")); |
1387 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleWsEventL: DISABLE call bubble")); |
1265 #endif |
1388 #endif |
1266 iIncallBubble->SetIncallBubbleAllowedInIdleL( EFalse ); |
1389 iIncallBubble->SetIncallBubbleAllowedInIdleL( EFalse ); |
1267 } |
1390 } |
1268 break; |
1391 break; |
1269 case KAknFullOrPartialForegroundGained: // partial or full fg gained |
1392 case KAknFullOrPartialForegroundGained: // partial or full fg gained |
1270 if( iIncallBubble ) |
1393 if( iIncallBubble ) |
1271 { |
1394 { |
1272 #if defined(_DEBUG) |
1395 #if defined(_DEBUG) |
1273 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleWsEventL: ENABLE call bubble")); |
1396 RDebug::Print(_L("(AUTOLOCK)CAutolockAppUi::HandleWsEventL: ENABLE call bubble")); |
1274 #endif |
1397 #endif |
1275 CAknView* view = View(KAutoLockViewId); |
1398 CAknView* view = View(KAutoLockViewId); |
1276 if(view) |
1399 if(view) |
1277 { |
1400 { |
1278 TRect aInitialRect; |
1401 TRect aInitialRect; |
1279 STATIC_CAST(CAutolockView*, view)->HandleCall(0x1A, aInitialRect); |
1402 STATIC_CAST(CAutolockView*, view)->HandleCall(0x1A, aInitialRect); |
|
1403 } |
|
1404 |
|
1405 iIncallBubble->SetIncallBubbleAllowedInIdleL( ETrue ); |
|
1406 } |
|
1407 break; |
|
1408 case EEventWindowGroupListChanged: |
|
1409 HandleWindowGroupListChange(); |
|
1410 break; |
|
1411 case EEventPointer: |
|
1412 case EEventDragDrop: |
|
1413 { |
|
1414 TInt gripStatus = EPSHWRMGripClosed; |
|
1415 RProperty::Get( KPSUidHWRM, KHWRMGripStatus, gripStatus ); |
|
1416 #if defined(_DEBUG) |
|
1417 RDebug::Printf( "%s %s (%u) 1 gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); |
|
1418 RDebug::Printf( "%s %s (%u) EPSHWRMGripClosed=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EPSHWRMGripClosed ); |
|
1419 #endif |
|
1420 if(gripStatus==EPSHWRMGripStatusUninitialized) |
|
1421 { |
|
1422 gripStatus=EPSHWRMGripClosed; |
|
1423 #if defined(_DEBUG) |
|
1424 RDebug::Printf( "%s %s (%u) new gripStatus=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, gripStatus ); |
|
1425 #endif |
1280 } |
1426 } |
1281 |
1427 TInt callState = 0; |
1282 iIncallBubble->SetIncallBubbleAllowedInIdleL( ETrue ); |
1428 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
1283 } |
1429 #if defined(_DEBUG) |
1284 break; |
1430 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
1285 case EEventWindowGroupListChanged: |
1431 #endif |
1286 HandleWindowGroupListChange(); |
1432 TPointerEvent *pointer = aEvent.Pointer(); |
1287 break; |
1433 CAknView* view = View(KAutoLockViewId); |
1288 case EEventPointer: |
1434 if(view) |
1289 case EEventDragDrop: |
1435 { |
1290 { |
1436 STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged(); |
1291 TInt callState = 0; |
1437 TRect aInitialRect; |
1292 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
1438 STATIC_CAST(CAutolockView*, view)->HandleCall(0x1, aInitialRect); |
1293 TPointerEvent *pointer = aEvent.Pointer(); |
1439 if(aCallButtonRect.iBr.iX==0) // initialize if not done already |
1294 CAknView* view = View(KAutoLockViewId); |
1440 aCallButtonRect = TRect (aInitialRect); |
1295 if(view) |
1441 } |
1296 { |
1442 if ( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized ) |
1297 STATIC_CAST(CAutolockView*, view)->ScreenDeviceChanged(); |
1443 { |
1298 TRect aInitialRect; |
1444 if(pointer->iType==TPointerEvent::EButton1Down) |
1299 STATIC_CAST(CAutolockView*, view)->HandleCall(0x1, aInitialRect); |
1445 { |
1300 if(aCallButtonRect.iBr.iX==0) // initialize if not done already |
1446 TPoint iPosition = pointer->iPosition; |
1301 aCallButtonRect = TRect (aInitialRect); |
1447 #if defined(_DEBUG) |
1302 } |
1448 RDebug::Printf( "%s %s (%u) iPosition.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iX ); |
1303 if ( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized ) |
1449 RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iX ); |
1304 { |
1450 RDebug::Printf( "%s %s (%u) iPosition.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iY ); |
1305 if(pointer->iType==TPointerEvent::EButton1Down) |
1451 RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iY ); |
1306 { |
1452 #endif |
1307 TPoint iPosition = pointer->iPosition; |
1453 if(aCallButtonRect.iBr.iX<iPosition.iX && iPosition.iX<aCallButtonRect.iBr.iX+aCallButtonRect.iTl.iX && |
1308 if(aCallButtonRect.iBr.iX<iPosition.iX && iPosition.iX<aCallButtonRect.iBr.iX+aCallButtonRect.iTl.iX && iPosition.iY>400 ) |
1454 ( (gripStatus==EPSHWRMGripClosed && iPosition.iY>400) || (gripStatus!=EPSHWRMGripClosed && aCallButtonRect.iBr.iY<iPosition.iY && iPosition.iY<aCallButtonRect.iBr.iY+aCallButtonRect.iTl.iY ) ) |
1309 { |
1455 ) |
1310 iGotEventDownDuringCall=1; |
1456 { |
1311 } |
1457 #if defined(_DEBUG) |
1312 } |
1458 RDebug::Printf( "%s %s (%u) iGotEventDownDuringCall=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iGotEventDownDuringCall ); |
1313 if(pointer->iType==TPointerEvent::EButton1Up) |
1459 #endif |
1314 { |
1460 iGotEventDownDuringCall=1; |
1315 TPoint iPosition = pointer->iPosition; |
1461 } |
1316 // touching at any point inside and below the BigRedButton. This is to handle the case where another dialog overlaps |
1462 } |
1317 if(iGotEventDownDuringCall==1 && aCallButtonRect.iBr.iX<iPosition.iX && iPosition.iX<aCallButtonRect.iBr.iX+aCallButtonRect.iTl.iX && iPosition.iY>400 ) |
1463 if(pointer->iType==TPointerEvent::EButton1Up) |
1318 { |
1464 { |
1319 TApaTaskList tasklist( iCoeEnv->WsSession() ); |
1465 TPoint iPosition = pointer->iPosition; |
1320 TApaTask phonetask = tasklist.FindApp( KPhoneAppUid ); |
1466 // touching at any point inside and below the BigRedButton. This is to handle the case where another dialog overlaps |
1321 if ( phonetask.Exists() ) |
1467 #if defined(_DEBUG) |
1322 { // send End key to Telephony to end the call |
1468 RDebug::Printf( "%s %s (%u) iGotEventDownDuringCall=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iGotEventDownDuringCall ); |
1323 TRawEvent event; |
1469 RDebug::Printf( "%s %s (%u) iPosition.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iX ); |
1324 event.Set(TRawEvent::EKeyDown, EStdKeyNo); |
1470 RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iX=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iX ); |
1325 iEikonEnv->WsSession().SimulateRawEvent(event); |
1471 RDebug::Printf( "%s %s (%u) iPosition.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, iPosition.iY ); |
1326 User::After(1000); |
1472 RDebug::Printf( "%s %s (%u) aCallButtonRect.iBr.iY=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, aCallButtonRect.iBr.iY ); |
1327 event.Set(TRawEvent::EKeyUp, EStdKeyNo); |
1473 #endif |
1328 iEikonEnv->WsSession().SimulateRawEvent(event); |
1474 if(iGotEventDownDuringCall==1 && aCallButtonRect.iBr.iX<iPosition.iX && iPosition.iX<aCallButtonRect.iBr.iX+aCallButtonRect.iTl.iX && |
1329 } |
1475 ( (gripStatus==EPSHWRMGripClosed && iPosition.iY>400) || (gripStatus!=EPSHWRMGripClosed && aCallButtonRect.iBr.iY<iPosition.iY && iPosition.iY<aCallButtonRect.iBr.iY+aCallButtonRect.iTl.iY ) ) |
1330 } |
1476 ) |
1331 iGotEventDownDuringCall=0; // even if outside |
1477 { |
1332 } |
1478 // on some devices, simulating End-Key might not end the call. First, try the API |
1333 } |
1479 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
1334 } |
1480 #if defined(_DEBUG) |
1335 break; |
1481 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
1336 case EEventKeyUp: // on touch devices, this happens only for the switch-key, which should turn on the lights. |
1482 #endif |
1337 case EEventKey: |
1483 if ( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized ) |
1338 case EEventKeyDown: |
1484 { |
1339 if(iLocked) |
1485 RTelServer telServer; |
1340 { // need to capture the switch-key for the case activeCall because Autolock stays on top, even over Akn |
1486 RMobilePhone mPhone; |
1341 TKeyEvent *key = aEvent.Key(); |
1487 User::LeaveIfError(telServer.Connect()); |
1342 #if defined(_DEBUG) |
1488 TInt err; |
1343 RDebug::Printf( "%s %s (%u) key->iCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iCode ); |
1489 err = telServer.LoadPhoneModule(KMmTsyModuleName); |
1344 RDebug::Printf( "%s %s (%u) key->iScanCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iScanCode ); |
1490 if (err != KErrNone && err != KErrAlreadyExists) |
1345 #endif |
1491 User::Leave(err); |
1346 if ( (key->iScanCode == EStdKeyDeviceF) || (key->iCode == EKeyDeviceF) ) |
1492 User::LeaveIfError(mPhone.Open(telServer, KMmTsyPhoneName)); |
1347 { |
1493 CleanupClosePushL(mPhone); |
1348 #if defined(_DEBUG) |
1494 RMobileLine mLine; |
1349 RDebug::Printf( "%s %s (%u) good key=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
1495 TPtrC lineName; |
1350 #endif |
1496 lineName.Set(KMmTsyVoice1LineName); |
1351 RWsSession& ws = iEikonEnv->WsSession(); |
1497 User::LeaveIfError(mLine.Open(mPhone, lineName)); |
1352 TApaTaskList tasklist( ws ); |
1498 CleanupClosePushL(mLine); |
1353 TApaTask capserver = tasklist.FindApp( KAknCapServerUid ); |
1499 |
1354 if( capserver.Exists() ) |
1500 TInt count(0); |
1355 { |
1501 User::LeaveIfError(mLine.EnumerateCall(count)); |
1356 #if defined(_DEBUG) |
1502 #if defined(_DEBUG) |
1357 RDebug::Printf( "%s %s (%u) found KAknCapServerUid=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KAknCapServerUid ); |
1503 RDebug::Printf( "%s %s (%u) count=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, count ); |
1358 #endif |
1504 #endif |
1359 capserver.SendKey( *key ); |
1505 for (TInt jj = 0; jj < count; jj++) |
1360 } |
1506 { |
1361 SendMessageToSysAp( EEikSecurityQueryLights ); |
1507 RLine::TCallInfo cinfo; |
1362 } |
1508 User::LeaveIfError(mLine.GetCallInfo(jj, cinfo)); |
1363 } |
1509 RMobileCall mCall; |
1364 break; |
1510 User::LeaveIfError(mCall.OpenExistingCall(mLine, cinfo.iCallName)); |
1365 default: |
1511 #if defined(_DEBUG) |
1366 iGotEventDownDuringCall=0; // any other event invalidates the Press inside the BigRedButton |
1512 RDebug::Printf( "%s %s (%u) calling mCall.HangUp 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1367 break; |
1513 #endif |
1368 } |
1514 mCall.HangUp(); // this gives an error, but succeeds |
1369 |
1515 } |
1370 // All events are sent to base class. |
1516 CleanupStack::PopAndDestroy(&mLine); |
1371 CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); |
1517 CleanupStack::PopAndDestroy(&mPhone); |
|
1518 } |
|
1519 User::After(100000); // give time for the call to end |
|
1520 #if defined(_DEBUG) |
|
1521 RProperty::Get( KPSUidCtsyCallInformation, KCTsyCallState, callState ); |
|
1522 RDebug::Printf( "%s %s (%u) callState=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, callState ); |
|
1523 #endif |
|
1524 if ( callState != EPSCTsyCallStateNone && callState != EPSCTsyCallStateUninitialized ) |
|
1525 { |
|
1526 // send End key to Telephony to end the call. This works for GSM and VOIP |
|
1527 #if defined(_DEBUG) |
|
1528 RDebug::Printf( "%s %s (%u) sending EStdKeyNo=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, EStdKeyNo ); |
|
1529 #endif |
|
1530 TRawEvent event; |
|
1531 event.Set(TRawEvent::EKeyDown, EStdKeyNo); |
|
1532 iEikonEnv->WsSession().SimulateRawEvent(event); |
|
1533 User::After(1000); |
|
1534 event.Set(TRawEvent::EKeyUp, EStdKeyNo); |
|
1535 iEikonEnv->WsSession().SimulateRawEvent(event); |
|
1536 User::After(100000); // give time for the call to end |
|
1537 } |
|
1538 } |
|
1539 iGotEventDownDuringCall=0; // even if outside the touch area |
|
1540 aCallButtonRect.iBr.iX = 0; |
|
1541 } |
|
1542 } |
|
1543 } |
|
1544 break; |
|
1545 case EEventKeyUp: // on touch devices, this happens only for the switch-key, which should turn on the lights. |
|
1546 case EEventKey: |
|
1547 case EEventKeyDown: |
|
1548 if(iLocked) |
|
1549 { // need to capture the switch-key for the case activeCall because Autolock stays on top, even over Akn |
|
1550 TKeyEvent *key = aEvent.Key(); |
|
1551 #if defined(_DEBUG) |
|
1552 RDebug::Printf( "%s %s (%u) key->iCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iCode ); |
|
1553 RDebug::Printf( "%s %s (%u) key->iScanCode=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, key->iScanCode ); |
|
1554 #endif |
|
1555 if ( (key->iScanCode == EStdKeyDeviceF) || (key->iCode == EKeyDeviceF) ) |
|
1556 { |
|
1557 #if defined(_DEBUG) |
|
1558 RDebug::Printf( "%s %s (%u) good key=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 1 ); |
|
1559 #endif |
|
1560 RWsSession& ws = iEikonEnv->WsSession(); |
|
1561 TApaTaskList tasklist( ws ); |
|
1562 TApaTask capserver = tasklist.FindApp( KAknCapServerUid ); |
|
1563 if( capserver.Exists() ) |
|
1564 { |
|
1565 #if defined(_DEBUG) |
|
1566 RDebug::Printf( "%s %s (%u) found KAknCapServerUid=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, KAknCapServerUid ); |
|
1567 #endif |
|
1568 capserver.SendKey( *key ); |
|
1569 } |
|
1570 SendMessageToSysAp( EEikSecurityQueryLights ); |
|
1571 } |
|
1572 } |
|
1573 break; |
|
1574 default: |
|
1575 iGotEventDownDuringCall=0; // any other event invalidates the Press inside the BigRedButton |
|
1576 break; |
|
1577 } |
|
1578 |
|
1579 // All events are sent to base class. |
|
1580 CAknViewAppUi::HandleWsEventL( aEvent, aDestination ); |
1372 |
1581 |
1373 // part of emergency call handling when telephony+devicelock is active |
1582 // part of emergency call handling when telephony+devicelock is active |
1374 // this solution is meant only for 3.1 and 3.2 |
1583 // this solution is meant only for 3.1 and 3.2 |
1375 // Emergency detector only handles key down events |
1584 // Emergency detector only handles key down events |
1376 if ( iEmergencySupportReady ) |
1585 if ( iEmergencySupportReady ) |
1377 iEcsDetector->HandleWsEventL( aEvent, aDestination); |
1586 iEcsDetector->HandleWsEventL( aEvent, aDestination); |
1378 #if defined(_DEBUG) |
1587 #if defined(_DEBUG) |
1379 RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1588 RDebug::Printf( "%s %s (%u) 0=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, 0 ); |
1380 #endif |
1589 #endif |
1381 } |
1590 } |
1382 |
1591 |
1383 TBool CAutolockAppUi::DeviceLockQueryStatus() |
1592 TBool CAutolockAppUi::DeviceLockQueryStatus() |