153 // our application ( so that it represent our app ) |
153 // our application ( so that it represent our app ) |
154 //iApplicationTask.SetWgId( iCoeEnv->RootWin().Identifier() ); |
154 //iApplicationTask.SetWgId( iCoeEnv->RootWin().Identifier() ); |
155 iApplicationTask.SetWgId( iWg.Identifier() ); |
155 iApplicationTask.SetWgId( iWg.Identifier() ); |
156 |
156 |
157 // And finally, go to background. |
157 // And finally, go to background. |
|
158 iForeground = ETrue; |
158 MoveAppToBackground( ENoneTransition ); |
159 MoveAppToBackground( ENoneTransition ); |
159 |
160 |
160 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
161 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
161 iEikonEnv->RootWin().EnableReceiptOfFocus(EFalse); |
162 iEikonEnv->RootWin().EnableReceiptOfFocus(EFalse); |
162 |
163 |
165 |
166 |
166 iIsPopUpShown = EFalse; |
167 iIsPopUpShown = EFalse; |
167 iUiStarted = EFalse; |
168 iUiStarted = EFalse; |
168 iDisableAppKeyHandling = EFalse; |
169 iDisableAppKeyHandling = EFalse; |
169 |
170 |
170 // Set process priority to high to avoid being |
|
171 // locked by heavy ui apps processing |
|
172 iEikonEnv->WsSession().ComputeMode(RWsSession::EPriorityControlDisabled); |
|
173 RProcess().SetPriority(EPriorityHigh); |
|
174 |
|
175 iForegroundDelayed = EFalse; |
171 iForegroundDelayed = EFalse; |
176 iDelayedForegroundInProgress = EFalse; |
172 iDelayedForegroundInProgress = EFalse; |
177 |
173 |
178 TSLOG_OUT(); |
174 TSLOG_OUT(); |
179 } |
175 } |
181 // ----------------------------------------------------------------------------- |
177 // ----------------------------------------------------------------------------- |
182 // CTsAppUi::CTsAppUi() |
178 // CTsAppUi::CTsAppUi() |
183 // Perform the first phase of two phase construction |
179 // Perform the first phase of two phase construction |
184 // ----------------------------------------------------------------------------- |
180 // ----------------------------------------------------------------------------- |
185 // |
181 // |
186 CTsAppUi::CTsAppUi(): iForeground( ETrue ), |
182 CTsAppUi::CTsAppUi(): iForeground( EFalse ), |
187 iApplicationTask( iCoeEnv->WsSession() ) |
183 iApplicationTask( iCoeEnv->WsSession() ) |
188 { |
184 { |
189 // no implementation required |
185 // no implementation required |
190 } |
186 } |
191 |
187 |
194 // Destructor |
190 // Destructor |
195 // ----------------------------------------------------------------------------- |
191 // ----------------------------------------------------------------------------- |
196 // |
192 // |
197 CTsAppUi::~CTsAppUi() |
193 CTsAppUi::~CTsAppUi() |
198 { |
194 { |
199 if( GfxTransEffect::IsRegistered( iAppView ) ) |
195 if( iAppView && GfxTransEffect::IsRegistered( iAppView ) ) |
200 { |
196 { |
201 GfxTransEffect::Deregister(iAppView); |
197 GfxTransEffect::Deregister(iAppView); |
202 |
198 |
203 } |
199 } |
204 GfxTransEffect::SetTransitionObserver(0); |
200 GfxTransEffect::SetTransitionObserver(0); |
268 TBool aVisibility, |
264 TBool aVisibility, |
269 TBool /*aLayers*/, |
265 TBool /*aLayers*/, |
270 TUint aSubCom ) |
266 TUint aSubCom ) |
271 { |
267 { |
272 const TDesC8* ptr = reinterpret_cast<const TDesC8*>(iAppView); |
268 const TDesC8* ptr = reinterpret_cast<const TDesC8*>(iAppView); |
|
269 GfxTransEffect::AbortFullScreen(); |
273 GfxTransEffect::Abort(iAppView); |
270 GfxTransEffect::Abort(iAppView); |
274 GfxTransEffect::Begin( iAppView, aTranstionId ); |
271 GfxTransEffect::Begin( iAppView, aTranstionId ); |
275 GfxTransEffect::SetDemarcation( iAppView, iAppView->Rect() ); |
272 GfxTransEffect::SetDemarcation( iAppView, iAppView->Rect() ); |
276 GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, ptr ); |
273 GfxTransEffect::NotifyExternalState( ECaptureComponentsBegin, ptr ); |
277 iAppView->MakeVisible( aVisibility ); |
274 iAppView->MakeVisible( aVisibility ); |
299 } |
296 } |
300 else |
297 else |
301 { |
298 { |
302 // App start animation |
299 // App start animation |
303 const TDesC8* ptr = reinterpret_cast<const TDesC8*>(iAppView); |
300 const TDesC8* ptr = reinterpret_cast<const TDesC8*>(iAppView); |
|
301 GfxTransEffect::AbortFullScreen(); |
304 GfxTransEffect::Abort(iAppView); |
302 GfxTransEffect::Abort(iAppView); |
305 TInt groupId = GfxTransEffect::BeginGroup(); |
303 TInt groupId = GfxTransEffect::BeginGroup(); |
306 GfxTransEffect::BeginFullScreen( |
304 GfxTransEffect::BeginFullScreen( |
307 EActivationAppShowTransition, ApplicationRect(), |
305 EActivationAppShowTransition, ApplicationRect(), |
308 AknTransEffect::EParameterType, |
306 AknTransEffect::EParameterType, |
536 // CTsAppUi::GoToBackgroundTimerCallback |
534 // CTsAppUi::GoToBackgroundTimerCallback |
537 // ----------------------------------------------------------------------------- |
535 // ----------------------------------------------------------------------------- |
538 // |
536 // |
539 TInt CTsAppUi::GoToBackgroundTimerCallback( TAny* aParam ) |
537 TInt CTsAppUi::GoToBackgroundTimerCallback( TAny* aParam ) |
540 { |
538 { |
|
539 TSLOG_STATIC_CONTEXT( GoToBackgroundTimerCallback, TSLOG_LOCAL, RThread().Id() ); |
|
540 TSLOG_IN(); |
541 CTsAppUi* self = static_cast<CTsAppUi*>( aParam ); |
541 CTsAppUi* self = static_cast<CTsAppUi*>( aParam ); |
542 if ( self->iGoToBackgroundTimer ) |
542 if ( self->iGoToBackgroundTimer ) |
543 { |
543 { |
544 self->iGoToBackgroundTimer->Cancel(); |
544 self->iGoToBackgroundTimer->Cancel(); |
545 } |
545 } |
582 void CTsAppUi::MoveAppToForeground( TUint /*aTransitionType*/ ) |
582 void CTsAppUi::MoveAppToForeground( TUint /*aTransitionType*/ ) |
583 { |
583 { |
584 TSLOG_CONTEXT( MoveAppToForeground, TSLOG_LOCAL ); |
584 TSLOG_CONTEXT( MoveAppToForeground, TSLOG_LOCAL ); |
585 TSLOG_IN(); |
585 TSLOG_IN(); |
586 |
586 |
|
587 if ( !iUiStarted ) |
|
588 { |
|
589 TRAP_IGNORE( iUnderAppWgId = WgIdOfUnderlyingAppL(EFalse) ); |
|
590 } |
587 iUiStarted = ETrue; |
591 iUiStarted = ETrue; |
588 |
592 |
589 // Request window server to bring our application |
593 // Request window server to bring our application |
590 // to foreground |
594 // to foreground |
591 iApplicationTask.BringToForeground(); |
595 iApplicationTask.BringToForeground(); |
624 |
628 |
625 if( iForeground ) |
629 if( iForeground ) |
626 { |
630 { |
627 iForeground = EFalse; |
631 iForeground = EFalse; |
628 SetTaskswitcherStateProperty( KTaskswitcherBackgroundValue ); |
632 SetTaskswitcherStateProperty( KTaskswitcherBackgroundValue ); |
629 |
633 |
|
634 iAppView->MakeVisible( EFalse ); |
630 // notify view |
635 // notify view |
631 iAppView->HandleSwitchToBackgroundEvent(); |
636 iAppView->HandleSwitchToBackgroundEvent(); |
632 |
637 |
633 iWg.SetOrdinalPosition(-1, ECoeWinPriorityNormal); |
638 iWg.SetOrdinalPosition(-1, ECoeWinPriorityNormal); |
634 |
639 |
763 { |
767 { |
764 iIsPopUpShown = EFalse; |
768 iIsPopUpShown = EFalse; |
765 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
769 iEikonEnv->RootWin().SetOrdinalPosition(-1, ECoeWinPriorityNeverAtFront); |
766 SetOrientationL(EAppUiOrientationAutomatic); |
770 SetOrientationL(EAppUiOrientationAutomatic); |
767 SetFullScreenApp(EFalse); |
771 SetFullScreenApp(EFalse); |
768 RProcess().SetPriority(EPriorityHigh); |
|
769 } |
772 } |
770 TSLOG_OUT(); |
773 TSLOG_OUT(); |
771 } |
774 } |
772 |
775 |
773 |
776 |
800 // ----------------------------------------------------------------------------- |
803 // ----------------------------------------------------------------------------- |
801 // |
804 // |
802 void CTsAppUi::HandleWsEventL(const TWsEvent& aEvent, |
805 void CTsAppUi::HandleWsEventL(const TWsEvent& aEvent, |
803 CCoeControl* aDestination) |
806 CCoeControl* aDestination) |
804 { |
807 { |
|
808 TSLOG_CONTEXT( CTsAppUi::HandleWsEventL, TSLOG_LOCAL ); |
805 CAknAppUi::HandleWsEventL(aEvent, aDestination); |
809 CAknAppUi::HandleWsEventL(aEvent, aDestination); |
806 TInt eventType = aEvent.Type(); |
810 TInt eventType = aEvent.Type(); |
807 if ( eventType == EEventWindowGroupListChanged ) |
811 if ( eventType == EEventWindowGroupListChanged ) |
808 { |
812 { |
809 TInt wgId = WgIdOfUnderlyingAppL(EFalse); |
813 TInt wgId = WgIdOfUnderlyingAppL(EFalse); |
|
814 TSLOG2( TSLOG_INFO, "WgIdOfUnderlyingAppL: %d appId: %d", |
|
815 wgId, GetAppIdL( wgId ).iUid ); |
810 if ( iForeground && |
816 if ( iForeground && |
|
817 wgId && |
811 wgId != iUnderAppWgId && |
818 wgId != iUnderAppWgId && |
812 !iAppView->AppCloseInProgress(iUnderAppWgId) && |
819 !iAppView->AppCloseInProgress(iUnderAppWgId) && |
813 !iAppView->WgOnTaskList(wgId) ) |
820 !iAppView->WgOnTaskList(wgId) ) |
814 { |
821 { |
815 MoveAppToBackground( ENoneTransition ); |
822 MoveAppToBackground( ENoneTransition ); |
818 { |
825 { |
819 HandleResourceChangeL(KEikDynamicLayoutVariantSwitch); |
826 HandleResourceChangeL(KEikDynamicLayoutVariantSwitch); |
820 } |
827 } |
821 iUnderAppWgId = wgId; |
828 iUnderAppWgId = wgId; |
822 } |
829 } |
|
830 TSLOG_OUT(); |
823 } |
831 } |
824 |
832 |
825 |
833 |
826 // ----------------------------------------------------------------------------- |
834 // ----------------------------------------------------------------------------- |
827 // CTsAppUi::WgIdOfUnderlyingApp |
835 // CTsAppUi::WgIdOfUnderlyingApp |
828 // ----------------------------------------------------------------------------- |
836 // ----------------------------------------------------------------------------- |
829 // |
837 // |
830 TInt CTsAppUi::WgIdOfUnderlyingAppL( TBool aIgnoreParentChild ) |
838 TInt CTsAppUi::WgIdOfUnderlyingAppL( TBool aIgnoreParentChild ) |
831 { |
839 { |
|
840 TSLOG_CONTEXT( CTsAppUi::WgIdOfUnderlyingAppL, TSLOG_LOCAL ); |
832 TInt retVal(0); |
841 TInt retVal(0); |
833 TInt underlyingWg = CheckForUnderlyingHiddenAppsL(); |
842 TInt underlyingWg = CheckForUnderlyingHiddenAppsL(); |
834 if ( !underlyingWg ) |
843 if ( !underlyingWg ) |
835 { |
844 { |
836 TApaTaskList taskList( iEikonEnv->WsSession() ); |
845 TApaTaskList taskList(iEikonEnv->WsSession()); |
837 underlyingWg = taskList.FindByPos(0).WgId(); |
846 underlyingWg = taskList.FindByPos(0).WgId(); |
|
847 if ( !(GetAppIdL(underlyingWg).iUid) ) |
|
848 { |
|
849 TSLOG1 (TSLOG_INFO, "Incorrect underlying window group: %d.", underlyingWg ); |
|
850 TSLOG0 (TSLOG_INFO, "No association to appId, nor special handling for underlying hidden apps.Change return value into 0."); |
|
851 underlyingWg = 0; |
|
852 } |
838 } |
853 } |
839 |
854 |
840 if ( aIgnoreParentChild ) |
855 if ( aIgnoreParentChild ) |
841 { |
856 { |
842 retVal = underlyingWg; |
857 retVal = underlyingWg; |
914 CleanupClosePushL(allWgIds); |
930 CleanupClosePushL(allWgIds); |
915 User::LeaveIfError(iEikonEnv->WsSession().WindowGroupList(0, &allWgIds)); |
931 User::LeaveIfError(iEikonEnv->WsSession().WindowGroupList(0, &allWgIds)); |
916 TInt underlyingWg(allWgIds[0].iId); |
932 TInt underlyingWg(allWgIds[0].iId); |
917 CleanupStack::PopAndDestroy(&allWgIds); |
933 CleanupStack::PopAndDestroy(&allWgIds); |
918 |
934 |
919 CApaWindowGroupName* windowName = |
935 TUid appUid = GetAppIdL( underlyingWg ); |
920 CApaWindowGroupName::NewLC( iEikonEnv->WsSession(), underlyingWg ); |
|
921 TUid appUid = windowName->AppUid(); |
|
922 CleanupStack::PopAndDestroy( windowName ); |
|
923 if( appUid == KTsCameraUid || |
936 if( appUid == KTsCameraUid || |
924 appUid == KTsTelephoneUid ) |
937 appUid == KTsTelephoneUid ) |
925 { |
938 { |
926 wgId = underlyingWg; |
939 wgId = underlyingWg; |
927 } |
940 } |
937 TBool retVal(EFalse); |
950 TBool retVal(EFalse); |
938 |
951 |
939 TApaTaskList taskList( iEikonEnv->WsSession() ); |
952 TApaTaskList taskList( iEikonEnv->WsSession() ); |
940 TInt underlyingWg = taskList.FindByPos(0).WgId(); |
953 TInt underlyingWg = taskList.FindByPos(0).WgId(); |
941 |
954 |
|
955 TUid appUid = GetAppIdL( underlyingWg ); |
|
956 if ( appUid == KTsCameraUid ) |
|
957 { |
|
958 retVal = ETrue; |
|
959 } |
|
960 |
|
961 return retVal; |
|
962 } |
|
963 |
|
964 |
|
965 // ----------------------------------------------------------------------------- |
|
966 // CTsAppUi::DelayedForegroundLaunched |
|
967 // ----------------------------------------------------------------------------- |
|
968 // |
|
969 TBool CTsAppUi::DelayedForegroundLaunched() |
|
970 { |
|
971 return iDelayedForegroundInProgress; |
|
972 } |
|
973 |
|
974 // ----------------------------------------------------------------------------- |
|
975 // CTsAppUi::GetAppIdL |
|
976 // ----------------------------------------------------------------------------- |
|
977 // |
|
978 TUid CTsAppUi::GetAppIdL( TInt aWgId ) |
|
979 { |
|
980 TUid retVal; |
942 CApaWindowGroupName* windowName = |
981 CApaWindowGroupName* windowName = |
943 CApaWindowGroupName::NewLC( iEikonEnv->WsSession(), underlyingWg ); |
982 CApaWindowGroupName::NewLC( iEikonEnv->WsSession(), aWgId ); |
944 TUid appUid = windowName->AppUid(); |
983 retVal = windowName->AppUid(); |
945 CleanupStack::PopAndDestroy( windowName ); |
984 CleanupStack::PopAndDestroy( windowName ); |
946 if ( appUid == KTsCameraUid ) |
|
947 { |
|
948 retVal = ETrue; |
|
949 } |
|
950 |
|
951 return retVal; |
985 return retVal; |
952 } |
986 } |
953 |
987 |
954 |
|
955 // ----------------------------------------------------------------------------- |
|
956 // CTsAppUi::DelayedForegroundLaunched |
|
957 // ----------------------------------------------------------------------------- |
|
958 // |
|
959 TBool CTsAppUi::DelayedForegroundLaunched() |
|
960 { |
|
961 return iDelayedForegroundInProgress; |
|
962 } |
|
963 |
|
964 // End of file |
988 // End of file |