58 const TInt KMemoryRequestAmountInBytes = 524288; |
58 const TInt KMemoryRequestAmountInBytes = 524288; |
59 const TInt KMinMemoryAmountInBytes = 524288; |
59 const TInt KMinMemoryAmountInBytes = 524288; |
60 |
60 |
61 // time to wait before sending the task to background |
61 // time to wait before sending the task to background |
62 // (must give time to animation) |
62 // (must give time to animation) |
63 const TInt KWaitBeforeGoingToBackground = 175000; |
63 const TInt KWaitBeforeGoingToBackground = 200000; |
|
64 |
|
65 const TUid KTsAppUid = { KTsAppUidValue }; |
64 |
66 |
65 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
66 // CTsAppUi::ConstructL() |
68 // CTsAppUi::ConstructL() |
67 // ConstructL is called by the application framework |
69 // ConstructL is called by the application framework |
68 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
116 iDeviceState = CTsDeviceState::NewL(); |
118 iDeviceState = CTsDeviceState::NewL(); |
117 |
119 |
118 // Create custom window group |
120 // Create custom window group |
119 iWg = RWindowGroup(CCoeEnv::Static()->WsSession()); |
121 iWg = RWindowGroup(CCoeEnv::Static()->WsSession()); |
120 iWg.Construct((TUint32)&iWg, ETrue); |
122 iWg.Construct((TUint32)&iWg, ETrue); |
|
123 iWg.EnableScreenChangeEvents(); |
121 |
124 |
122 // Create UI |
125 // Create UI |
123 iAppView = CTsAppView::NewL( ApplicationRect(), *iDeviceState, iWg ); |
126 iAppView = CTsAppView::NewL( ApplicationRect(), *iDeviceState, iWg ); |
124 AddToStackL( iAppView ); |
127 AddToStackL( iAppView ); |
125 |
128 |
145 MoveAppToBackground( ENoneTransition ); |
148 MoveAppToBackground( ENoneTransition ); |
146 |
149 |
147 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
150 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
148 iEikonEnv->RootWin().EnableReceiptOfFocus(EFalse); |
151 iEikonEnv->RootWin().EnableReceiptOfFocus(EFalse); |
149 |
152 |
|
153 RWindowGroup& windowGroup = CCoeEnv::Static()->RootWin(); |
|
154 windowGroup.EnableGroupListChangeEvents(); |
|
155 |
150 iIsPopUpShown = EFalse; |
156 iIsPopUpShown = EFalse; |
151 iUiStarted = EFalse; |
157 iUiStarted = EFalse; |
152 iDisableAppKeyHandling = EFalse; |
158 iDisableAppKeyHandling = EFalse; |
153 |
159 |
154 TSLOG_OUT(); |
160 TSLOG_OUT(); |
207 |
213 |
208 // ----------------------------------------------------------------------------- |
214 // ----------------------------------------------------------------------------- |
209 // CTsAppUi::StartTransion |
215 // CTsAppUi::StartTransion |
210 // ----------------------------------------------------------------------------- |
216 // ----------------------------------------------------------------------------- |
211 // |
217 // |
212 void CTsAppUi::StartTransion( TUint aTransitionType ) |
218 void CTsAppUi::StartTransion( TUint aTransitionType, TUid aNextAppUid, TInt aWgId ) |
213 { |
219 { |
214 if( !EffectsEnabled() ) |
220 if( !EffectsEnabled() ) |
215 { |
221 { |
216 return; |
222 return; |
217 } |
223 } |
257 CAknTransitionUtils::MakeVisibleSubComponents( |
260 CAknTransitionUtils::MakeVisibleSubComponents( |
258 iAppView, |
261 iAppView, |
259 static_cast<CAknTransitionUtils::TMakeVisibleSubComponentsInfo>(aSubCom) ); |
262 static_cast<CAknTransitionUtils::TMakeVisibleSubComponentsInfo>(aSubCom) ); |
260 GfxTransEffect::NotifyExternalState( ECaptureComponentsEnd, ptr ); |
263 GfxTransEffect::NotifyExternalState( ECaptureComponentsEnd, ptr ); |
261 GfxTransEffect::End( iAppView ); |
264 GfxTransEffect::End( iAppView ); |
|
265 } |
|
266 |
|
267 // ----------------------------------------------------------------------------- |
|
268 // CTsAppUi::StartAppActivateTransition |
|
269 // ----------------------------------------------------------------------------- |
|
270 // |
|
271 void CTsAppUi::StartAppActivateTransition( TUid aNextAppUid, TInt aWgId ) |
|
272 { |
|
273 // Check what type of transition will be trigerred |
|
274 if ( aWgId == iUnderAppWgId ) |
|
275 { |
|
276 // App under task switcher was launched |
|
277 StartTransition( EActivationTransition, |
|
278 EFalse, |
|
279 ETrue, |
|
280 CAknTransitionUtils::EForceInvisible ); |
|
281 } |
|
282 else |
|
283 { |
|
284 // App start animation |
|
285 TRAP_IGNORE( RequestPopUpL() ); |
|
286 const TDesC8* ptr = reinterpret_cast<const TDesC8*>(iAppView); |
|
287 GfxTransEffect::Abort(iAppView); |
|
288 TInt groupId = GfxTransEffect::BeginGroup(); |
|
289 GfxTransEffect::BeginFullScreen( |
|
290 EActivationAppShowTransition, ApplicationRect(), |
|
291 AknTransEffect::EParameterType, |
|
292 AknTransEffect::GfxTransParam( aNextAppUid , KTsAppUid ) ); |
|
293 GfxTransEffect::Begin( iAppView, EActivationTransition ); |
|
294 GfxTransEffect::SetDemarcation( iAppView, iAppView->Rect() ); |
|
295 GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, ptr ); |
|
296 iAppView->MakeVisible( EFalse ); |
|
297 CAknTransitionUtils::MakeVisibleSubComponents( |
|
298 iAppView, |
|
299 static_cast<CAknTransitionUtils::TMakeVisibleSubComponentsInfo>(CAknTransitionUtils::EForceInvisible) ); |
|
300 GfxTransEffect::NotifyExternalState( ECaptureComponentsEnd, ptr ); |
|
301 GfxTransEffect::End( iAppView ); |
|
302 GfxTransEffect::EndFullScreen(); |
|
303 GfxTransEffect::EndGroup(groupId); |
|
304 } |
262 } |
305 } |
263 |
306 |
264 // ----------------------------------------------------------------------------- |
307 // ----------------------------------------------------------------------------- |
265 // CTsAppUi::TransitionFinished |
308 // CTsAppUi::TransitionFinished |
266 // ----------------------------------------------------------------------------- |
309 // ----------------------------------------------------------------------------- |
444 |
487 |
445 // ----------------------------------------------------------------------------- |
488 // ----------------------------------------------------------------------------- |
446 // CTsAppUi::MoveAppToBackground() |
489 // CTsAppUi::MoveAppToBackground() |
447 // ----------------------------------------------------------------------------- |
490 // ----------------------------------------------------------------------------- |
448 // |
491 // |
449 void CTsAppUi::MoveAppToBackground( TUint aTransitionType ) |
492 void CTsAppUi::MoveAppToBackground( TUint aTransitionType, TUid aAppUid, TInt aWgId ) |
450 { |
493 { |
451 TSLOG_CONTEXT( MoveAppToBackground, TSLOG_LOCAL ); |
494 TSLOG_CONTEXT( MoveAppToBackground, TSLOG_LOCAL ); |
452 TSLOG_IN(); |
495 TSLOG_IN(); |
453 |
496 |
454 if ( ENoneTransition == aTransitionType || !EffectsEnabled() ) |
497 if ( ENoneTransition == aTransitionType || !EffectsEnabled() ) |
455 { |
498 { |
456 GoToBackgroundTimerCallback( this ); |
499 GoToBackgroundTimerCallback( this ); |
457 } |
500 } |
458 else |
501 else |
459 { |
502 { |
460 StartTransion(aTransitionType); |
503 StartTransion(aTransitionType, aAppUid, aWgId); |
461 iGoToBackgroundTimer->Cancel(); |
504 iGoToBackgroundTimer->Cancel(); |
462 iGoToBackgroundTimer->Start( |
505 iGoToBackgroundTimer->Start( |
463 KWaitBeforeGoingToBackground, |
506 KWaitBeforeGoingToBackground, |
464 0, |
507 0, |
465 TCallBack( GoToBackgroundTimerCallback, this ) ); |
508 TCallBack( GoToBackgroundTimerCallback, this ) ); |
696 retVal = ETrue; |
739 retVal = ETrue; |
697 } |
740 } |
698 return retVal; |
741 return retVal; |
699 } |
742 } |
700 |
743 |
|
744 |
|
745 // ----------------------------------------------------------------------------- |
|
746 // CTsAppUi::HandleWsEventL |
|
747 // ----------------------------------------------------------------------------- |
|
748 // |
|
749 void CTsAppUi::HandleWsEventL(const TWsEvent& aEvent, |
|
750 CCoeControl* aDestination) |
|
751 { |
|
752 CAknAppUi::HandleWsEventL(aEvent, aDestination); |
|
753 TInt eventType = aEvent.Type(); |
|
754 if ( eventType == EEventWindowGroupListChanged ) |
|
755 { |
|
756 TInt wgId = WgIdOfUnderlyingApp(EFalse); |
|
757 if ( iForeground && |
|
758 wgId != iUnderAppWgId && |
|
759 !iAppView->AppCloseInProgress(iUnderAppWgId) ) |
|
760 { |
|
761 MoveAppToBackground( ENoneTransition ); |
|
762 } |
|
763 if ( WgIdOfUnderlyingApp(ETrue) != iUnderAppWgId ) |
|
764 { |
|
765 HandleResourceChangeL(KEikDynamicLayoutVariantSwitch); |
|
766 } |
|
767 iUnderAppWgId = wgId; |
|
768 } |
|
769 } |
|
770 |
|
771 |
|
772 // ----------------------------------------------------------------------------- |
|
773 // CTsAppUi::WgIdOfUnderlyingApp |
|
774 // ----------------------------------------------------------------------------- |
|
775 // |
|
776 TInt CTsAppUi::WgIdOfUnderlyingApp( TBool aIgnoreParentChild ) |
|
777 { |
|
778 TInt retVal(0); |
|
779 TApaTaskList taskList( iEikonEnv->WsSession() ); |
|
780 TInt underlyingWg = taskList.FindByPos(0).WgId(); |
|
781 if ( aIgnoreParentChild ) |
|
782 { |
|
783 retVal = underlyingWg; |
|
784 } |
|
785 else |
|
786 { |
|
787 TInt parentWg = GetTopParentWg( underlyingWg ); |
|
788 retVal = parentWg ? parentWg : underlyingWg; |
|
789 } |
|
790 return retVal; |
|
791 } |
|
792 |
|
793 // ----------------------------------------------------------------------------- |
|
794 // CTsAppUi::GetTopParentWg |
|
795 // ----------------------------------------------------------------------------- |
|
796 // |
|
797 TInt CTsAppUi::GetTopParentWg( TInt aChildWg ) |
|
798 { |
|
799 TInt parentWg = GetParentWg( aChildWg ); |
|
800 if( parentWg ) |
|
801 { |
|
802 TInt topParentWg = GetTopParentWg( parentWg ); |
|
803 if( topParentWg ) |
|
804 { |
|
805 parentWg = topParentWg; |
|
806 } |
|
807 } |
|
808 return parentWg; |
|
809 } |
|
810 |
|
811 // ----------------------------------------------------------------------------- |
|
812 // CTsAppUi::GetParentWg |
|
813 // ----------------------------------------------------------------------------- |
|
814 // |
|
815 TInt CTsAppUi::GetParentWg( TInt aChildWg ) |
|
816 { |
|
817 TInt retVal(0); |
|
818 RArray<RWsSession::TWindowGroupChainInfo> allWgIds; |
|
819 // Ask for window group list from RWsSession |
|
820 TInt error = iEikonEnv->WsSession().WindowGroupList( 0, &allWgIds ); |
|
821 if ( !error ) |
|
822 { |
|
823 TInt count( allWgIds.Count() ); |
|
824 for ( TInt i( 0 ); i < count; i++ ) |
|
825 { |
|
826 RWsSession::TWindowGroupChainInfo info = allWgIds[i]; |
|
827 if ( info.iId == aChildWg && info.iParentId > 0) |
|
828 { |
|
829 retVal = info.iParentId; |
|
830 break; |
|
831 } |
|
832 } |
|
833 } |
|
834 allWgIds.Close(); |
|
835 return retVal; |
|
836 } |
|
837 |
701 // End of file |
838 // End of file |