18 #include <s32mem.h> |
18 #include <s32mem.h> |
19 #include "alfeffectutils.h" |
19 #include "alfeffectutils.h" |
20 #include <akntransitionutils.h> |
20 #include <akntransitionutils.h> |
21 #include <alflogger.h> |
21 #include <alflogger.h> |
22 |
22 |
|
23 // Delay after which first end check is performed. |
23 const TInt KRosterFreezeEndTimeoutInMs = 100; |
24 const TInt KRosterFreezeEndTimeoutInMs = 100; |
|
25 // Interval between end checks. |
|
26 const TInt KRosterFreezeEndIntervalInMs = 50; |
|
27 // Maximum amount of end checks to be performed. |
|
28 // This can be lower, should be visible enough to see, if heuristics fail. |
|
29 const TInt KRosterFreezeEndAttempts = 50; |
24 |
30 |
25 // --------------------------------------------------------- |
31 // --------------------------------------------------------- |
26 // CAlfRosterFreezeEndTimer |
32 // CAlfRosterFreezeEndTimer |
27 // --------------------------------------------------------- |
33 // --------------------------------------------------------- |
28 // |
34 // |
69 |
76 |
70 TBool timeout = EFalse; |
77 TBool timeout = EFalse; |
71 |
78 |
72 if (iSafeCounter >= 0) |
79 if (iSafeCounter >= 0) |
73 { |
80 { |
74 iSafeCounter++; |
81 iSafeCounter += iSafeCounterDelta; |
75 if (iSafeCounter == 100) // can be lower, 100 should be visible enough to see, if heuristics fail |
82 if (iSafeCounter >= KRosterFreezeEndAttempts) |
76 { |
83 { |
77 timeout = ETrue; |
84 timeout = ETrue; |
78 iSafeCounter = 0; |
85 iSafeCounter = 0; |
79 } |
86 } |
80 } |
87 } |
81 |
88 |
82 if (!iBridge.IsFullScreenDrawn(0) && !timeout) |
89 if (!iBridge.IsLayoutSwitchReady(iSafeCounter) && !timeout) |
83 { |
90 { |
84 __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Not ready in new orientation. waiting 50ms more"); |
91 __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Not ready in new orientation. waiting 50ms more"); |
85 After( 50000 ); |
92 iSafeCounterDelta = 1; |
|
93 After( KRosterFreezeEndIntervalInMs * 1000 ); |
86 return; |
94 return; |
87 } |
95 } |
88 else |
96 else |
89 { |
97 { |
|
98 __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Ready in new orientation."); |
90 iCallBack.CallBack(); |
99 iCallBack.CallBack(); |
91 } |
100 } |
92 } |
101 } |
93 |
102 |
94 void CAlfRosterFreezeEndTimer::DoCancel() |
103 void CAlfRosterFreezeEndTimer::DoCancel() |
166 // From EStateIdle: |
175 // From EStateIdle: |
167 // - EEventBlankOn: EStateBlankFx |
176 // - EEventBlankOn: EStateBlankFx |
168 // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. |
177 // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. |
169 // |
178 // |
170 // From EStateFreezeFx: |
179 // From EStateFreezeFx: |
171 // - EEventBlankOn: EStateBlankFx |
|
172 // - implicit Finish - EStateIdle |
180 // - implicit Finish - EStateIdle |
173 // |
181 // |
174 // From EStateBlankFx: |
182 // From EStateBlankFx: |
175 // - EEventBlankOff: EStateFreezeFx (we use freeze to ensure that result is ok) |
183 // - EEventBlankOff: EStateFreezeFx (we use freeze to ensure that result is ok) |
176 // - EEventLayoutSwitch: If effect available, EStateThemeFx. |
184 // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. |
177 // |
185 // |
178 // From EStateThemeFx: |
186 // From EStateThemeFx: |
179 // - EEventLowMemory: If blank still on, EStateBlankFx. Otherwise EStateFreezeFx. |
187 // - EEventLowMemory: If blank still on, EStateBlankFx. Otherwise EStateFreezeFx. |
180 // - implicit Finish - EStateIdle |
188 // - implicit Finish - EStateIdle |
|
189 // |
|
190 // There is special handling if layout switch event is received while previous |
|
191 // layout switch is ongoing. |
181 |
192 |
182 TState nextState = EStateIdle; |
193 TState nextState = EStateIdle; |
183 |
194 |
184 switch ( iCurrentState ) |
195 switch ( iCurrentState ) |
185 { |
196 { |
203 |
214 |
204 if ( nextState != iCurrentState ) |
215 if ( nextState != iCurrentState ) |
205 { |
216 { |
206 Transition( nextState, iCurrentState ); |
217 Transition( nextState, iCurrentState ); |
207 } |
218 } |
|
219 else |
|
220 { |
|
221 // We stay in the same state, but still need special handling in a couple of scenarios |
|
222 if ( nextState == EStateFreezeFx ) |
|
223 { |
|
224 HandleFreezeEvent( aEvent ); |
|
225 } |
|
226 if ( nextState == EStateThemeFx ) |
|
227 { |
|
228 HandleThemeEvent( aEvent ); |
|
229 } |
|
230 } |
|
231 } |
|
232 |
|
233 // --------------------------------------------------------- |
|
234 // CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent |
|
235 // Special handling for Freeze effect. |
|
236 // --------------------------------------------------------- |
|
237 // |
|
238 void CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent(TEvent aEvent) |
|
239 { |
|
240 if ( aEvent == EEventLayoutSwitch && iRosterFreezeEndTimer && iRosterFreezeEndTimer->IsActive() ) |
|
241 { |
|
242 // New layout switch while previous is ongoing => restart freeze end timer. |
|
243 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent restart timer"); |
|
244 iRosterFreezeEndTimer->Cancel(); |
|
245 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); |
|
246 } |
|
247 } |
|
248 |
|
249 // --------------------------------------------------------- |
|
250 // CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent |
|
251 // Special handling for Theme effect. |
|
252 // --------------------------------------------------------- |
|
253 // |
|
254 void CAlfLayoutSwitchEffectCoordinator::HandleThemeEvent(TEvent aEvent) |
|
255 { |
|
256 if ( aEvent == EEventLayoutSwitch ) |
|
257 { |
|
258 // If layout switch occurs while freeze end timer is ongoing, restart. |
|
259 if ( iRosterFreezeEndTimer && iRosterFreezeEndTimer->IsActive() ) |
|
260 { |
|
261 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::HandleThemeEvent restart timer"); |
|
262 iRosterFreezeEndTimer->Cancel(); |
|
263 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoNextLayoutSwitchContext, this)); |
|
264 } |
|
265 |
|
266 // If layout switch occurs while theme effect is ongoing in exit phase, restart. |
|
267 if ( iLayoutSwitchEffectContext == AknTransEffect::ELayoutSwitchExit ) |
|
268 { |
|
269 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::HandleThemeEvent restart themefx"); |
|
270 TBool oldLayoutSwitchNotCompleted = iLayoutSwitchNotCompleted; |
|
271 iLayoutSwitchNotCompleted = EFalse; |
|
272 |
|
273 Transition( EStateIdle, iCurrentState ); |
|
274 Transition( EStateThemeFx, iCurrentState ); |
|
275 |
|
276 if (oldLayoutSwitchNotCompleted) |
|
277 { |
|
278 iLayoutSwitchNotCompleted = ETrue; |
|
279 } |
|
280 } |
|
281 } |
208 } |
282 } |
209 |
283 |
210 // --------------------------------------------------------- |
284 // --------------------------------------------------------- |
211 // CAlfLayoutSwitchEffectCoordinator::Transition |
285 // CAlfLayoutSwitchEffectCoordinator::Transition |
212 // --------------------------------------------------------- |
286 // --------------------------------------------------------- |
213 // |
287 // |
214 void CAlfLayoutSwitchEffectCoordinator::Transition( |
288 void CAlfLayoutSwitchEffectCoordinator::Transition( |
215 TState aNewState, TState aPreviousState) |
289 TState aNewState, TState aPreviousState) |
216 { |
290 { |
217 __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aNewState, aPreviousState); |
291 __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aPreviousState, aNewState); |
218 iCurrentState = aNewState; |
292 iCurrentState = aNewState; |
219 |
293 |
220 // Undo previous state - don't unfreeze roster. |
294 // Undo previous state - don't unfreeze roster. |
221 switch ( aPreviousState ) |
295 switch ( aPreviousState ) |
222 { |
296 { |
267 |
341 |
268 FreezeRoster(ETrue); |
342 FreezeRoster(ETrue); |
269 |
343 |
270 // Remove all other effects |
344 // Remove all other effects |
271 iBridge.HandleGfxStopEvent( EFalse ); |
345 iBridge.HandleGfxStopEvent( EFalse ); |
272 iBridge.RemoveAllTemporaryPresenterVisuals(); |
346 iBridge.CleanAllFxVisuals(); |
273 |
347 |
274 // Set remove freeze timer |
348 // Set remove freeze timer |
275 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition - Freeze timer started"); |
349 __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition - Freeze timer started"); |
276 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); |
350 iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); |
277 } |
351 } |
870 |
940 |
871 void CFullScreenEffectState::SetState(TEffectState aState) |
941 void CFullScreenEffectState::SetState(TEffectState aState) |
872 { |
942 { |
873 if (aState >= iState) |
943 if (aState >= iState) |
874 { |
944 { |
|
945 __ALFFXLOGSTRING2("CFullScreenEffectState::SetState - Set %d -> %d", iState, aState); |
875 iState = aState; |
946 iState = aState; |
876 } |
947 } |
877 else |
948 else |
878 { |
949 { |
879 __ALFFXLOGSTRING2("CFullScreenEffectState::SetState - WARNING! Trying to set to previous state. %d -> %d", iState, aState); |
950 __ALFFXLOGSTRING2("CFullScreenEffectState::SetState - WARNING! Trying to set to previous state. %d -> %d", iState, aState); |
880 } |
951 } |
881 }; |
952 }; |
882 |
953 |
883 TEffectState CFullScreenEffectState::State() |
954 TEffectState CFullScreenEffectState::State() |
884 { |
955 { |
|
956 __ALFFXLOGSTRING1("CFullScreenEffectState::State - %d", iState); |
885 return iState; |
957 return iState; |
886 } |
958 } |
887 |
959 |
888 |
960 |
889 void CControlEffectState::ConstructL(TInt aAction, |
961 void CControlEffectState::ConstructL(TInt aAction, |