35 #include "alfstreamerbridge.h" |
35 #include "alfstreamerbridge.h" |
36 #include "alfpolicyhandler.h" |
36 #include "alfpolicyhandler.h" |
37 #include <alflogger.h> |
37 #include <alflogger.h> |
38 #include <uiacceltk/HuiUtil.h> |
38 #include <uiacceltk/HuiUtil.h> |
39 |
39 |
40 #ifdef __WINS__ |
40 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, |
|
41 // this will stop the effect. |
41 const TInt KAlfShortEffectTimeout = 4000000; |
42 const TInt KAlfShortEffectTimeout = 4000000; |
42 const TInt KAlfLongEffectTimeout = 5000000; |
43 const TInt KAlfLongEffectTimeout = 5000000; |
43 #else |
44 |
44 const TInt KAlfShortEffectTimeout = 2000000; |
|
45 const TInt KAlfLongEffectTimeout = 3000000; |
|
46 #endif |
|
47 //const TInt KAlfLongEffectTimeout = 500000; |
45 //const TInt KAlfLongEffectTimeout = 500000; |
48 |
|
49 |
|
50 // Timer to send finish full screen effect |
46 // Timer to send finish full screen effect |
51 // --------------------------------------------------------- |
47 // --------------------------------------------------------- |
52 // CAlfFinishTimer |
48 // CAlfFinishTimer |
53 // --------------------------------------------------------- |
49 // --------------------------------------------------------- |
54 // |
50 // |
226 // --------------------------------------------------------------------------- |
222 // --------------------------------------------------------------------------- |
227 // --------------------------------------------------------------------------- |
223 // --------------------------------------------------------------------------- |
228 // |
224 // |
229 void CAlfServerDrawer::ConstructL() |
225 void CAlfServerDrawer::ConstructL() |
230 { |
226 { |
231 iController = CWsServerDrawerController::NewL(this); |
227 iControlController = CWsServerDrawerController::NewL(this); |
232 |
228 iFullScreenController = CWsServerDrawerController::NewL(this); |
233 iIdle = CIdle::NewL(CActive::EPriorityIdle); |
|
234 |
229 |
235 iFullScreenTimeout = CAlfFinishTimer::NewL(); |
230 iFullScreenTimeout = CAlfFinishTimer::NewL(); |
|
231 iControlTimeout = CAlfFinishTimer::NewL(); |
236 iFinishFullScreen = CAlfFinishTimer::NewL(); |
232 iFinishFullScreen = CAlfFinishTimer::NewL(); |
237 |
233 |
238 iTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus ); |
234 // note, that the PS key is actually never updated and these do not do anything |
|
235 iControlTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus ); |
|
236 iFullScreenTransitionEndObserver = CPSObserver::NewL( KPSAlfDomain, KAlfTransitionStatus ); |
239 iProperty.Attach( KPSAlfDomain, KAlfTransitionStatus ); |
237 iProperty.Attach( KPSAlfDomain, KAlfTransitionStatus ); |
240 iProperty.Set( KPSAlfDomain, KAlfTransitionStatus, 0 ); |
238 iProperty.Set( KPSAlfDomain, KAlfTransitionStatus, 0 ); |
241 iFs.Connect(); |
239 iFs.Connect(); |
242 |
240 |
243 } |
241 } |
284 { |
283 { |
285 iControlAction = aAction; |
284 iControlAction = aAction; |
286 iControlUid = aControlUid; |
285 iControlUid = aControlUid; |
287 iControlWindowGroup = aWindowGroup; |
286 iControlWindowGroup = aWindowGroup; |
288 iControlHandle = aWindowHandle; |
287 iControlHandle = aWindowHandle; |
289 return iController->BeginControlTransition(); |
288 return iControlController->BeginControlTransition(); |
290 } |
289 } |
291 } |
290 } |
292 |
291 |
293 // --------------------------------------------------------------------------- |
292 // --------------------------------------------------------------------------- |
294 // --------------------------------------------------------------------------- |
293 // --------------------------------------------------------------------------- |
295 // |
294 // |
296 void CAlfServerDrawer::EndControlTransition(TInt aHandle) |
295 void CAlfServerDrawer::EndControlTransition(TInt aHandle) |
297 { |
296 { |
298 iController->EndControlTransition(aHandle); |
297 iControlController->EndControlTransition(aHandle); |
299 } |
298 } |
300 |
299 |
301 // --------------------------------------------------------------------------- |
300 // --------------------------------------------------------------------------- |
302 // --------------------------------------------------------------------------- |
301 // --------------------------------------------------------------------------- |
303 // |
302 // |
376 } |
375 } |
377 // --------------------------------------------------------------------------- |
376 // --------------------------------------------------------------------------- |
378 // --------------------------------------------------------------------------- |
377 // --------------------------------------------------------------------------- |
379 // |
378 // |
380 void CAlfServerDrawer::BeginFullscreen( TInt aAction, const TRect& aEffectRect, |
379 void CAlfServerDrawer::BeginFullscreen( TInt aAction, const TRect& aEffectRect, |
381 TInt aType, const TUid aUid1, const TUid aUid2, TInt aData ) |
380 TInt aType, const TUid aUid1, const TUid aUid2, TInt aData, |
382 { |
381 TSecureId aSid1, TInt aWg1, TSecureId aSid2, TInt aWg2 ) |
383 if ( iController->AppInfoCache().Action(aUid1) == aAction && |
382 { |
384 iController->AppInfoCache().Action(aUid1) != AknTransEffect::EApplicationExit ) |
383 __ALFFXLOGSTRING2("CAlfServerDrawer::BeginFullscreen - Action: %d, Type: %d", aAction, aType); |
385 { |
384 __ALFFXLOGSTRING4("CAlfServerDrawer::BeginFullscreen - ToAppUid/SecureId: 0x%x/0x%x, ToAppUid/SecureId: 0x%x/0x%x", aUid1, aSid1.iId, aUid2, aSid2.iId); |
386 __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - skipping action: %d, because previous action is stronger: %d", aAction, iAction); |
385 if ( iFullScreenController->AppInfoCache().Action(aUid1) == aAction && |
|
386 iFullScreenController->AppInfoCache().Action(aUid1) != AknTransEffect::EApplicationExit ) |
|
387 { |
|
388 __ALFFXLOGSTRING2("CAlfServerDrawer::BeginFullscreen - skipping action: %d, because previous action is stronger: %d", aAction, iAction); |
387 // the action must be skipped, because stronger action has been request already. |
389 // the action must be skipped, because stronger action has been request already. |
388 return; |
390 return; |
389 } |
391 } |
390 |
392 |
391 __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - Action: %d, aType: %d", aAction, aType); |
393 TInt action = iFullScreenController->AppInfoCache().SetAction(aUid1, aAction); |
392 TInt action = iController->AppInfoCache().SetAction(aUid1, aAction); |
|
393 |
394 |
394 // Skip all embedded and background application effects, for now. |
395 // Skip all embedded and background application effects, for now. |
395 // This addition is to prevent messaging app popping up in startup. |
396 // This addition is to prevent messaging app popping up in startup. |
396 // AVKON uses wrong parameter type and so NoEffects is not applied. |
397 // AVKON uses wrong parameter type and so NoEffects is not applied. |
397 if ( action == AknTransEffect::EEmbeddedApplicationExit || |
398 if ( action == AknTransEffect::EEmbeddedApplicationExit || |
398 action == AknTransEffect::EEmbeddedApplicationStart || |
399 action == AknTransEffect::EEmbeddedApplicationStart || |
399 action == AknTransEffect::EAppStartupBackground ) |
400 (action == AknTransEffect::EAppStartupBackground && aType != AknTransEffect::EParameterAvkonInternal) ) |
400 { |
401 { |
401 __ALFFXLOGSTRING1(" -> CAlfServerDrawer::BeginFullscreen - Embedded/background (%d) application, skip effect", aAction); |
402 __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - Embedded/background (%d) application, skip effect for AppUid: 0x%x", aAction, aUid1); |
402 return; |
403 return; |
403 } |
404 } |
404 |
405 |
|
406 if (action == AknTransEffect::EAppStartupBackground && aType == AknTransEffect::EParameterAvkonInternal) |
|
407 { |
|
408 __ALFFXLOGSTRING2(" -> CAlfServerDrawer::BeginFullscreen - Embedded/background (%d) application, skip effect for AppUid: 0x%x, but update the avkon info.", aAction, aUid1); |
|
409 } |
|
410 |
405 if ( aAction != AknTransEffect::ENone && aAction != AknTransEffect::EAppStartupBackground ) |
411 if ( aAction != AknTransEffect::ENone && aAction != AknTransEffect::EAppStartupBackground ) |
406 { |
412 { |
407 // no action or background activity won't stop current effect |
413 // no action or background activity won't stop current effect |
408 // Matrix Menu sends start rect and avkon sends start for the same application! |
414 // Matrix Menu sends start rect and avkon sends start for the same application! |
409 // We assume that we want to keep the rect from Matrix Menu if the app id matches |
415 // We assume that we want to keep the rect from Matrix Menu if the app id matches |
481 else |
491 else |
482 { |
492 { |
483 iScrModeChangedState = EScreenModeChangedIdle; |
493 iScrModeChangedState = EScreenModeChangedIdle; |
484 } |
494 } |
485 |
495 |
486 iController->BeginFullscreen( aType, aUid1, aUid2, aData ); |
496 iFullScreenController->BeginFullscreen( aType, aUid1, aUid2, aData ); |
487 __ALFFXLOGSTRING("CAlfServerDrawer::BeginFullscreen end"); |
497 __ALFFXLOGSTRING("CAlfServerDrawer::BeginFullscreen end"); |
488 } |
498 } |
489 |
499 |
490 // --------------------------------------------------------------------------- |
500 // --------------------------------------------------------------------------- |
491 // --------------------------------------------------------------------------- |
501 // --------------------------------------------------------------------------- |
492 // |
502 // |
493 void CAlfServerDrawer::EndFullscreen() |
503 void CAlfServerDrawer::EndFullscreen() |
494 { |
504 { |
495 __ALFFXLOGSTRING(" -> CAlfServerDrawer::EndFullscreen"); |
505 __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen >>"); |
496 CancelEndChecker(); |
506 CancelEndChecker(); |
497 iController->EndFullscreen(EFalse); |
507 iFullScreenController->EndFullscreen(EFalse); |
498 iController->AppInfoCache().ClearActions(); |
508 iFullScreenController->AppInfoCache().ClearActions(); |
499 __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen end"); |
509 __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen <<"); |
500 } |
510 } |
501 |
511 |
502 // --------------------------------------------------------------------------- |
512 // --------------------------------------------------------------------------- |
503 // --------------------------------------------------------------------------- |
513 // --------------------------------------------------------------------------- |
504 // |
514 // |
512 // --------------------------------------------------------------------------- |
522 // --------------------------------------------------------------------------- |
513 // |
523 // |
514 void CAlfServerDrawer::AbortFullscreen() |
524 void CAlfServerDrawer::AbortFullscreen() |
515 { |
525 { |
516 __ALFFXLOGSTRING(" -> CAlfServerDrawer::AbortFullscreen"); |
526 __ALFFXLOGSTRING(" -> CAlfServerDrawer::AbortFullscreen"); |
517 iController->AbortTransition(EAbortFullscreen); |
527 iFullScreenController->AbortTransition(EAbortFullscreen); |
518 iController->AppInfoCache().ClearActions(); |
528 iFullScreenController->AppInfoCache().ClearActions(); |
519 __ALFFXLOGSTRING("CAlfServerDrawer::AbortFullscreen end"); |
529 __ALFFXLOGSTRING("CAlfServerDrawer::AbortFullscreen end"); |
520 } |
530 } |
521 |
|
522 |
|
523 TInt CAlfServerDrawer::FailedFullscreen(TAny* aArg) |
|
524 { |
|
525 CAlfServerDrawer* self = static_cast<CAlfServerDrawer*>(aArg); |
|
526 self->iController->EndExpired(); // The same as if End Checker Expires. |
|
527 return EFalse; |
|
528 } |
|
529 |
531 |
530 TBool CAlfServerDrawer::EffectFinishedFullScreen() const |
532 TBool CAlfServerDrawer::EffectFinishedFullScreen() const |
531 { |
533 { |
532 return iFullScreenFinished; |
534 return iFullScreenFinished; |
533 } |
535 } |
557 // when we get EndFullScreen |
559 // when we get EndFullScreen |
558 // Originally this was where the screen capture was made and the drawing redirected. |
560 // Originally this was where the screen capture was made and the drawing redirected. |
559 // Here we can start doing some effect for the application that is currently on the |
561 // Here we can start doing some effect for the application that is currently on the |
560 // screen. The new application effect should start at "EndFullScreen" |
562 // screen. The new application effect should start at "EndFullScreen" |
561 // That normally means that the application has drawn something to its window. |
563 // That normally means that the application has drawn something to its window. |
562 |
|
563 iFromWg = 0; |
|
564 iToWg = 0; |
|
565 |
|
566 // TODO: using temp getter for window group ids vs app uids |
|
567 // |
|
568 // Official implementation pending on new window server APIs expected to available be around W40 |
|
569 |
|
570 if ( iType == AknTransEffect::EParameterType ) |
|
571 { |
|
572 // TODO TODO TODO TODO TODO TODO TODO |
|
573 // THIS MUST BE FIXED IN ORDER TO HAVE APPLICATION START EFFECTS WORKING! |
|
574 // |
|
575 // THE WINDOWGROUP LIST FOR APPLICATIONS IS NOT UP-TO-DATE, BECAUSE WE CANNOT ASK IT ANYMORE DIRECTLY |
|
576 // FROM WSERV (DEADLOCK ISSUES). |
|
577 // THUS IT IS UP TO CHANCE THAT WE GET A VALID REPLY IN THIS POINT. |
|
578 // WE WILL VERY LIKELY NOT INITIATE THE EFFECT AT ALL, WHEN APPLICATION IS REALLY STARTING INSTEAD OF |
|
579 // BEING BROUGHT FORWARD FROM BACKGROUND. |
|
580 // TODO TODO TODO TODO TODO TODO TODO |
|
581 iFromWg = iWindowManager->Bridge()->FindWgForAppUid(iFromUid); |
|
582 __ALFFXLOGSTRING2("Window group from from-Application UID: 0x%X wg: 0x%x", iFromUid, iFromWg); |
|
583 // ---> YES --> id must be valid. continue |
|
584 // YES --> Is this exit event? |
|
585 // Id found in cache? --> ---> NO --> continue, but refreshed value should overwrite this valua in iEngine. |
|
586 // NO --> we must wait for the value. |
|
587 |
|
588 |
564 |
589 if (!iToWg) |
565 TBool blocked = iFullScreenController->IsBlocked( iFromUid, iToUid ); |
590 { |
|
591 iToWg = iWindowManager->Bridge()->FindWgForAppUid(iToUid); // This call might be now obsolete |
|
592 } |
|
593 |
|
594 __ALFFXLOGSTRING2("Window group from to-Application UID: 0x%X wg: 0x%x", iToUid, iToWg); |
|
595 } |
|
596 |
|
597 // How do we handle the case where we have app id, parent id and focus wg? |
|
598 |
|
599 if ( iType == AknTransEffect::EParameterAvkonInternal ) |
|
600 { |
|
601 // Is this "from" or "to" or do we just use iFocusWg? |
|
602 iToWg = iWindowManager->Bridge()->FindWgForAppUid(iToUid); |
|
603 |
|
604 __ALFFXLOGSTRING2("Window group from internal-Application UID: 0x%X wg: 0x%x", iToUid, iToWg); |
|
605 // Is this "from" or "to" or do we just use iFocusWg? |
|
606 if ( iParentUid != KNullUid ) |
|
607 { |
|
608 iFromWg = iWindowManager->Bridge()->FindWgForAppUid(iParentUid); |
|
609 __ALFFXLOGSTRING2("Window group from parent-Application UID: 0x%X wg: 0x%x", iParentUid, iFromWg); |
|
610 } |
|
611 } |
|
612 |
|
613 // What do we do if there are no windows? |
|
614 // We could use the built-in effect layer, but now we just stop here |
|
615 |
|
616 // We don't handle the EParameterAvkonInternal type |
|
617 // TODO: revise this condition, when appui is available from wserv |
|
618 /*if ( ( ( iFromWg == 0 || iFromWg == KErrNotFound ) && |
|
619 ( iToWg == 0 || iToWg == KErrNotFound ) && |
|
620 ( iFocusWg == 0 || iFocusWg == KErrNotFound ) ) || |
|
621 iType == AknTransEffect::EParameterAvkonInternal ) |
|
622 { // TODO: Uncomment, when appui available in alfbridge |
|
623 // bail out, cannot start an effect without any windows |
|
624 // We don't need to reset the WinIdLists as they have not been filled |
|
625 iIdle->Start(TCallBack(FailedFullscreen,this)); |
|
626 return; |
|
627 } |
|
628 */ |
|
629 // If we don't have the target window, we bail out |
|
630 // This is because we get into trouble if another beginfullscreen |
|
631 // follows too fast. |
|
632 /* |
|
633 if ( iToWg == 0 || iToWg == KErrNotFound ) |
|
634 { |
|
635 iIdle->Start(TCallBack(FailedFullscreen,this)); |
|
636 return; |
|
637 } |
|
638 */ |
|
639 |
|
640 TBool blocked = iController->IsBlocked( iFromUid, iToUid ); |
|
641 if (blocked) |
566 if (blocked) |
642 { |
567 { |
643 return; |
568 return; |
644 } |
569 } |
645 |
570 |
663 |
588 |
664 |
589 |
665 if ( err != KErrNone || fileName.Length() == 0 || !FileExistsL( resourceDir, fileName ) ) |
590 if ( err != KErrNone || fileName.Length() == 0 || !FileExistsL( resourceDir, fileName ) ) |
666 { |
591 { |
667 // Did not find an effect file - nothing to show |
592 // Did not find an effect file - nothing to show |
668 __ALFFXLOGSTRING2(" <- CAlfServerDrawer:: Could not get full screen kml, error %d %S", err, &fileName) |
593 __ALFFXLOGSTRING2("CAlfServerDrawer::DoSendBeginFullscreenL - Could not get full screen kml, error %d %S", err, &fileName) |
669 iFromWg = KErrNotFound; |
594 iFromWg = KErrNotFound; |
670 iToWg = KErrNotFound; |
595 iToWg = KErrNotFound; |
671 iFromScreen = KErrNotFound; |
596 iFromScreen = KErrNotFound; |
672 iToScreen = KErrNotFound; |
597 iToScreen = KErrNotFound; |
673 // iIdle->Start( TCallBack( FailedFullscreen, this ) ); |
|
674 return; |
598 return; |
675 } |
599 } |
676 |
600 |
677 // TODO: This context switch is done because matrix menu uses opposite context numbers |
601 // TODO: This context switch is done because matrix menu uses opposite context numbers |
678 // from the screen saver, and we want to handle folder open the same way as application |
602 // from the screen saver, and we want to handle folder open the same way as application |
714 // We must make a stream of the data as the length may vary. |
638 // We must make a stream of the data as the length may vary. |
715 // At the moment we only send some numbers, but we should probably include |
639 // At the moment we only send some numbers, but we should probably include |
716 // also the effect file name or something else to identify the effect |
640 // also the effect file name or something else to identify the effect |
717 // that is going to be used |
641 // that is going to be used |
718 |
642 |
719 TInt bufferSize = 11 * sizeof(TInt); //operation, TYPE, 2 wg ids, 2 app uids, flags and rect |
643 TInt bufferSize = 13 * sizeof(TInt); //operation, TYPE, 2 wg ids, 2 app uids, 2 secure ids, flags and rect |
720 bufferSize += sizeof(TPtrC); |
644 bufferSize += sizeof(TPtrC); |
721 bufferSize += resourceDir.Length() * 2; |
645 bufferSize += resourceDir.Length() * 2; |
722 bufferSize += sizeof(TPtrC); |
646 bufferSize += sizeof(TPtrC); |
723 bufferSize += fileName.Length() * 2; |
647 bufferSize += fileName.Length() * 2; |
724 |
648 |
725 // I don't think we need this |
649 // I don't think we need this |
726 TInt index = 0; |
650 TInt index = 0; |
727 |
651 |
728 IncreaseHandle(); |
652 IncreaseFullScreenHandle(); |
729 |
653 |
730 iTransitionEndObserver->Cancel(); |
654 iFullScreenTransitionEndObserver->Cancel(); |
731 iIdle->Cancel(); //cancel if running. |
|
732 iFinishFullScreen->Cancel(); |
655 iFinishFullScreen->Cancel(); |
733 iFullScreenTimeout->Cancel(); |
656 iFullScreenTimeout->Cancel(); |
734 |
657 |
735 // The first stage should actually just show some wait dialog - it is waiting for the second |
658 // The first stage should actually just show some wait dialog - it is waiting for the second |
736 // stage of the effect to start. |
659 // stage of the effect to start. |
738 if ( bridgeBuffer ) |
661 if ( bridgeBuffer ) |
739 { |
662 { |
740 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
663 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
741 // The writes should not leave if we have calculated our buffer length correctly. |
664 // The writes should not leave if we have calculated our buffer length correctly. |
742 stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen ); |
665 stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen ); |
743 stream.WriteInt32L( iCurrHandle ); |
666 stream.WriteInt32L( iCurrentFullScreenHandle ); |
744 stream.WriteInt32L( iType ); |
667 stream.WriteInt32L( iType ); |
745 if ( iType == AknTransEffect::EParameterType && isExit ) |
668 if ( iType == AknTransEffect::EParameterType && isExit ) |
746 { |
669 { |
747 stream.WriteInt32L( iToWg ); |
670 stream.WriteInt32L( iToWg ); |
748 stream.WriteInt32L( 0 ); |
671 stream.WriteInt32L( 0 ); |
749 |
672 |
750 // AppUid |
673 // AppUid |
751 stream.WriteInt32L( iToUid.iUid ); |
674 stream.WriteInt32L( iToUid.iUid ); |
752 stream.WriteInt32L( iFromUid.iUid ); |
675 stream.WriteInt32L( iFromUid.iUid ); |
|
676 |
|
677 // SecureId |
|
678 stream.WriteInt32L( iToSid.iId ); |
|
679 stream.WriteInt32L( iFromSid.iId ); |
753 |
680 |
754 stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete |
681 stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete |
755 stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete |
682 stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete |
756 } |
683 } |
757 else if ( iType == AknTransEffect::EParameterType ) |
684 else if ( iType == AknTransEffect::EParameterType ) |
857 // --------------------------------------------------------------------------- |
788 // --------------------------------------------------------------------------- |
858 // --------------------------------------------------------------------------- |
789 // --------------------------------------------------------------------------- |
859 // |
790 // |
860 TInt CAlfServerDrawer::SendEndFullscreen() |
791 TInt CAlfServerDrawer::SendEndFullscreen() |
861 { |
792 { |
862 __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendEndFullscreen"); |
793 __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen"); |
863 |
794 |
864 if ( iFullScreenEndSent ) |
795 if ( iFullScreenEndSent ) |
865 { |
796 { |
866 __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen END no need"); |
797 __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen END no need"); |
867 return KErrNone; |
798 return KErrNone; |
868 } |
799 } |
869 iFullScreenEndSent = ETrue; |
800 iFullScreenEndSent = ETrue; |
870 |
801 |
871 __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendEndFullscreen"); |
802 __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen"); |
872 iTransitionEndObserver->Cancel(); |
803 iFullScreenTransitionEndObserver->Cancel(); |
873 iFullScreenTimeout->Cancel(); |
804 iFullScreenTimeout->Cancel(); |
874 iFinishFullScreen->Cancel(); |
805 iFinishFullScreen->Cancel(); |
875 iIdle->Cancel(); //cancel if running. |
806 /* |
876 /* |
|
877 TUint action = iAction; |
807 TUint action = iAction; |
878 if ( iType == AknTransEffect::EParameterAvkonInternal ) |
808 if ( iType == AknTransEffect::EParameterAvkonInternal ) |
879 { |
809 { |
880 action = iOldAction; |
810 action = iOldAction; |
881 } |
811 } |
952 stream << fileName; |
882 stream << fileName; |
953 stream.CommitL(); |
883 stream.CommitL(); |
954 }); |
884 }); |
955 |
885 |
956 bridgerData.Set( EAlfEffectFx, iAction, bufferSize, (TAny*) index ); |
886 bridgerData.Set( EAlfEffectFx, iAction, bufferSize, (TAny*) index ); |
957 __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata"); |
887 __ALFFXLOGSTRING1("CAlfServerDrawer::SendEndFullscreen - sending bridgedata, Current handle %d", iCurrentFullScreenHandle); |
958 iWindowManager->PostIt( bridgerData ); |
888 iWindowManager->PostIt( bridgerData ); |
959 stream.Close(); |
889 stream.Close(); |
960 iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle ); |
890 iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle ); |
961 } |
891 } |
962 |
892 |
963 iFullScreenFinished = EFalse; |
893 iFullScreenFinished = EFalse; |
964 if ( iAction == AknTransEffect::EApplicationExit /*|| |
894 if ( iAction == AknTransEffect::EApplicationExit /*|| |
965 iAction == 1001*/ ) |
895 iAction == 1001*/ ) |
1010 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
939 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
1011 // The writes should not leave if we have calculated our buffer length correctly. |
940 // The writes should not leave if we have calculated our buffer length correctly. |
1012 TRAP_IGNORE( |
941 TRAP_IGNORE( |
1013 { |
942 { |
1014 stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortFullscreen ); |
943 stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortFullscreen ); |
1015 stream.WriteInt32L( iCurrHandle ); |
944 stream.WriteInt32L( iCurrentFullScreenHandle ); |
1016 stream.WriteInt32L( iType ); |
945 stream.WriteInt32L( iType ); |
1017 //if ( iType == AknTransEffect::EParameterType ) |
946 //if ( iType == AknTransEffect::EParameterType ) |
1018 { |
947 { |
1019 stream.WriteInt32L( iToWg ); |
948 stream.WriteInt32L( iToWg ); |
1020 stream.WriteInt32L( iFromWg ); |
949 stream.WriteInt32L( iFromWg ); |
1101 bufferSize += sizeof(TPtrC); |
1031 bufferSize += sizeof(TPtrC); |
1102 bufferSize += fileName.Length() * 2; |
1032 bufferSize += fileName.Length() * 2; |
1103 |
1033 |
1104 TInt index = 0; |
1034 TInt index = 0; |
1105 |
1035 |
1106 IncreaseHandle(); |
1036 IncreaseControlHandle(); |
1107 iTransitionEndObserver->Cancel(); |
1037 iControlTransitionEndObserver->Cancel(); |
1108 iFinishFullScreen->Cancel(); |
1038 iControlTimeout->Cancel(); |
1109 |
|
1110 |
1039 |
1111 // control transitions are not supposed to have the phasing of full screen transitions, |
1040 // control transitions are not supposed to have the phasing of full screen transitions, |
1112 // we should be ready to go immediately. |
1041 // we should be ready to go immediately. |
1113 |
1042 |
1114 // However, if we are doing control exit, we should reserve the window in order |
1043 // However, if we are doing control exit, we should reserve the window in order |
1122 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
1051 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
1123 // The writes should not leave if we have calculated our buffer length correctly. |
1052 // The writes should not leave if we have calculated our buffer length correctly. |
1124 TRAP_IGNORE( |
1053 TRAP_IGNORE( |
1125 { |
1054 { |
1126 stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginComponentTransition ); |
1055 stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginComponentTransition ); |
1127 stream.WriteInt32L( iCurrHandle ); |
1056 stream.WriteInt32L( iCurrentControlHandle ); |
1128 stream.WriteInt32L( iControlHandle ); // window handle |
1057 stream.WriteInt32L( iControlHandle ); // window handle |
1129 stream.WriteInt32L( iControlWindowGroup ); // window group id |
1058 stream.WriteInt32L( iControlWindowGroup ); // window group id |
1130 stream.WriteInt32L( 0 ); // "screen number"; not used; save place for future |
1059 stream.WriteInt32L( 0 ); // "screen number"; not used; save place for future |
1131 // should send starting and ending points and possible other position/rectange |
1060 // should send starting and ending points and possible other position/rectange |
1132 // data, too. |
1061 // data, too. |
1134 stream << resourceDir; |
1063 stream << resourceDir; |
1135 stream << actionFile; |
1064 stream << actionFile; |
1136 stream.CommitL(); |
1065 stream.CommitL(); |
1137 }); |
1066 }); |
1138 bridgerData.Set( EAlfControlEffectFx, iControlAction, bufferSize, (TAny*) index ); |
1067 bridgerData.Set( EAlfControlEffectFx, iControlAction, bufferSize, (TAny*) index ); |
1139 __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata"); |
1068 __ALFFXLOGSTRING1("CAlfServerDrawer::SendBeginControlTransition - sending bridgedata, Current handle: %d", iCurrentControlHandle); |
1140 iWindowManager->PostIt( bridgerData ); |
1069 iWindowManager->PostIt( bridgerData ); |
1141 stream.Close(); |
1070 stream.Close(); |
1142 iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle ); |
1071 iControlTransitionEndObserver->StartObserving( TCallBack( ControlTransitionFinished, this ), iCurrentControlHandle ); |
1143 } |
1072 } |
1144 |
1073 |
1145 iFullScreenFinished = EFalse; |
1074 iFullScreenFinished = EFalse; |
1146 iFinishFullScreen->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) ); |
1075 |
|
1076 iControlTimeout->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) ); |
1147 |
1077 |
1148 return KErrNone; |
1078 return KErrNone; |
1149 } |
1079 } |
1150 |
1080 |
1151 // --------------------------------------------------------------------------- |
1081 // --------------------------------------------------------------------------- |
1152 // --------------------------------------------------------------------------- |
1082 // --------------------------------------------------------------------------- |
1153 // |
1083 // |
1154 TInt CAlfServerDrawer::SendFinishControlTransition() |
1084 TInt CAlfServerDrawer::SendFinishControlTransition() |
1155 { |
1085 { |
1156 // We should now delete the effects from any controls that remain active. |
1086 // We should now delete the effects from any controls that remain active. |
1157 __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendFinishControlTransition"); |
1087 __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition >>"); |
1158 iTransitionEndObserver->Cancel(); |
1088 iControlTransitionEndObserver->Cancel(); |
1159 iIdle->Cancel(); //cancel if running. |
1089 |
1160 iFinishFullScreen->Cancel(); |
|
1161 |
|
1162 // Send the data to CAlfAppUI via bridge |
1090 // Send the data to CAlfAppUI via bridge |
1163 TAlfBridgerData bridgerData; |
1091 TAlfBridgerData bridgerData; |
1164 |
1092 |
1165 // We must make a stream of the data as the length may vary. |
1093 // We must make a stream of the data as the length may vary. |
1166 // This function only sends numbers, others send filenames, too. |
1094 // This function only sends numbers, others send filenames, too. |
1176 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
1104 RMemWriteStream stream( bridgeBuffer, bufferSize ); |
1177 // The writes should not leave if we have calculated our buffer length correctly. |
1105 // The writes should not leave if we have calculated our buffer length correctly. |
1178 TRAP_IGNORE( |
1106 TRAP_IGNORE( |
1179 { |
1107 { |
1180 stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortComponentTransition ); |
1108 stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortComponentTransition ); |
1181 stream.WriteInt32L( iCurrHandle ); |
1109 stream.WriteInt32L( iCurrentControlHandle ); |
1182 stream.WriteInt32L( 0 ); |
1110 stream.WriteInt32L( 0 ); |
1183 stream.WriteInt32L( 0 ); |
1111 stream.WriteInt32L( 0 ); |
1184 stream.WriteInt32L( 0 ); |
1112 stream.WriteInt32L( 0 ); |
1185 stream.WriteInt32L( 0 ); |
1113 stream.WriteInt32L( 0 ); |
1186 stream.CommitL(); |
1114 stream.CommitL(); |
1187 }); |
1115 }); |
1188 bridgerData.Set( EAlfStopEffectFx, iAction, bufferSize, (TAny*) index ); |
1116 // TODO, check, if iCurrentHandle is approriate |
1189 __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata"); |
1117 bridgerData.Set( EAlfStopControlEffectFx, iCurrentControlHandle, bufferSize, (TAny*) index ); |
|
1118 __ALFFXLOGSTRING1("CAlfServerDrawer::sending bridgedata, Stop control handle: %d", iCurrentControlHandle); |
1190 iWindowManager->PostIt( bridgerData ); |
1119 iWindowManager->PostIt( bridgerData ); |
1191 stream.Close(); |
1120 stream.Close(); |
1192 } |
1121 } |
1193 |
1122 __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition <<"); |
1194 return KErrNone; |
1123 return KErrNone; |
1195 } |
1124 } |
1196 |
1125 |
1197 // --------------------------------------------------------------------------- |
1126 // --------------------------------------------------------------------------- |
1198 // --------------------------------------------------------------------------- |
1127 // --------------------------------------------------------------------------- |
1199 // |
1128 // |
1200 TInt CAlfServerDrawer::SendAbortControlTransition() |
1129 TInt CAlfServerDrawer::SendAbortControlTransition() |
1201 { |
1130 { |
1202 __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendAbortControlTransition"); |
1131 __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendAbortControlTransition"); |
1203 iTransitionEndObserver->Cancel(); |
1132 iControlTransitionEndObserver->Cancel(); |
1204 // We should now delete the effects from any controls that remain active. |
1133 // We should now delete the effects from any controls that remain active. |
1205 return SendFinishControlTransition(); |
1134 return SendFinishControlTransition(); |
1206 } |
1135 } |
1207 |
1136 |
1208 // --------------------------------------------------------------------------- |
1137 // --------------------------------------------------------------------------- |
|
1138 // CAlfServerDrawer::FromUid |
1209 // --------------------------------------------------------------------------- |
1139 // --------------------------------------------------------------------------- |
1210 // |
1140 // |
1211 TUid& CAlfServerDrawer::FromUid() |
1141 TUid& CAlfServerDrawer::FromUid() |
1212 { |
1142 { |
1213 return iFromUid; |
1143 return iFromUid; |
1214 } |
1144 } |
1215 |
1145 |
1216 // --------------------------------------------------------------------------- |
1146 // --------------------------------------------------------------------------- |
1217 // --------------------------------------------------------------------------- |
1147 // CAlfServerDrawer::FromSid |
1218 // |
1148 // --------------------------------------------------------------------------- |
|
1149 // |
|
1150 TSecureId& CAlfServerDrawer::FromSid() |
|
1151 { |
|
1152 return iFromSid; |
|
1153 } |
|
1154 |
|
1155 // --------------------------------------------------------------------------- |
|
1156 // CAlfServerDrawer::FromWg |
|
1157 // --------------------------------------------------------------------------- |
|
1158 // |
|
1159 TInt CAlfServerDrawer::FromWg() |
|
1160 { |
|
1161 return iFromWg; |
|
1162 } |
|
1163 |
|
1164 |
|
1165 // --------------------------------------------------------------------------- |
|
1166 // CAlfServerDrawer::ToUid |
|
1167 // --------------------------------------------------------------------------- |
|
1168 // |
1219 TUid& CAlfServerDrawer::ToUid() |
1169 TUid& CAlfServerDrawer::ToUid() |
1220 { |
1170 { |
1221 return iToUid; |
1171 return iToUid; |
1222 } |
1172 } |
|
1173 |
|
1174 // --------------------------------------------------------------------------- |
|
1175 // CAlfServerDrawer::ToSid |
|
1176 // --------------------------------------------------------------------------- |
|
1177 // |
|
1178 TSecureId& CAlfServerDrawer::ToSid() |
|
1179 { |
|
1180 return iToSid; |
|
1181 } |
|
1182 |
|
1183 // --------------------------------------------------------------------------- |
|
1184 // CAlfServerDrawer::ToWg |
|
1185 // --------------------------------------------------------------------------- |
|
1186 // |
|
1187 TInt CAlfServerDrawer::ToWg() |
|
1188 { |
|
1189 return iToWg; |
|
1190 } |
1223 |
1191 |
1224 // --------------------------------------------------------------------------- |
1192 // --------------------------------------------------------------------------- |
1225 // --------------------------------------------------------------------------- |
1193 // --------------------------------------------------------------------------- |
1226 // |
1194 // |
1227 TUint& CAlfServerDrawer::Action() |
1195 TUint& CAlfServerDrawer::Action() |
1236 { |
1204 { |
1237 return iFlags; |
1205 return iFlags; |
1238 } |
1206 } |
1239 |
1207 |
1240 // --------------------------------------------------------------------------- |
1208 // --------------------------------------------------------------------------- |
|
1209 // Guarantee, that control and fullscreen handles are unique. |
1241 // --------------------------------------------------------------------------- |
1210 // --------------------------------------------------------------------------- |
1242 // |
1211 // |
1243 void CAlfServerDrawer::IncreaseHandle() |
1212 void CAlfServerDrawer::IncreaseControlHandle() |
1244 { |
1213 { |
1245 iCurrHandle++; |
1214 // handles must be unique, but increasing control handle should not change fullscreen handle |
|
1215 TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle; |
|
1216 highestHandle++; |
|
1217 iCurrentControlHandle = highestHandle; |
1246 } |
1218 } |
1247 |
1219 |
|
1220 void CAlfServerDrawer::IncreaseFullScreenHandle() |
|
1221 { |
|
1222 TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle; |
|
1223 highestHandle++; |
|
1224 iCurrentFullScreenHandle = highestHandle; |
|
1225 } |
|
1226 |
1248 // --------------------------------------------------------------------------- |
1227 // --------------------------------------------------------------------------- |
1249 // --------------------------------------------------------------------------- |
1228 // --------------------------------------------------------------------------- |
1250 // |
1229 // |
1251 TInt CAlfServerDrawer::CurrentHandle() |
1230 TInt CAlfServerDrawer::CurrentControlHandle() |
1252 { |
1231 { |
1253 return iCurrHandle; |
1232 return iCurrentControlHandle; |
1254 } |
1233 } |
|
1234 |
|
1235 // --------------------------------------------------------------------------- |
|
1236 // --------------------------------------------------------------------------- |
|
1237 // |
|
1238 TInt CAlfServerDrawer::CurrentFullScreenHandle() |
|
1239 { |
|
1240 return iCurrentFullScreenHandle; |
|
1241 } |
1255 |
1242 |
1256 // --------------------------------------------------------------------------- |
1243 // --------------------------------------------------------------------------- |
1257 // --------------------------------------------------------------------------- |
1244 // --------------------------------------------------------------------------- |
1258 // |
1245 // |
1259 void CAlfServerDrawer::StartEndChecker() |
1246 void CAlfServerDrawer::StartEndChecker() |
1260 { |
1247 { |
1261 iController->StartEndChecker(); |
1248 iFullScreenController->StartEndChecker(); |
1262 } |
1249 } |
1263 |
1250 |
1264 // --------------------------------------------------------------------------- |
1251 // --------------------------------------------------------------------------- |
1265 // --------------------------------------------------------------------------- |
1252 // --------------------------------------------------------------------------- |
1266 // |
1253 // |
1267 void CAlfServerDrawer::CancelEndChecker() |
1254 void CAlfServerDrawer::CancelEndChecker() |
1268 { |
1255 { |
1269 iController->CancelEndChecker(); |
1256 iFullScreenController->CancelEndChecker(); |
1270 } |
1257 } |
1271 |
1258 |
1272 TInt CAlfServerDrawer::FullScreenTimeout( TAny* aServerDrawer ) |
1259 TInt CAlfServerDrawer::FullScreenTimeout( TAny* aServerDrawer ) |
1273 { |
1260 { |
1274 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleFullScreenTimeout(); |
1261 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleFullScreenTimeout(); |
1292 return KErrNone; |
1279 return KErrNone; |
1293 } |
1280 } |
1294 |
1281 |
1295 void CAlfServerDrawer::HandleFinishFullScreenTimeout() |
1282 void CAlfServerDrawer::HandleFinishFullScreenTimeout() |
1296 { |
1283 { |
1297 iTransitionEndObserver->Cancel(); |
1284 iFullScreenTransitionEndObserver->Cancel(); |
1298 iFullScreenTimeout->Cancel(); |
1285 iFullScreenTimeout->Cancel(); |
1299 // if we haven't got a pubsub trigger, |
1286 // if we haven't got a pubsub trigger, |
1300 // we must finish the transition by calling AlfBridge. |
1287 // we must finish the transition by calling AlfBridge. |
1301 // If we gor the pubsub trigger, AlfBridge has done its part, |
1288 // If we gor the pubsub trigger, AlfBridge has done its part, |
1302 // and all we have to do is release the reserved windows. |
1289 // and all we have to do is release the reserved windows. |
1303 iController->FullscreenFinished( iCurrHandle ); |
1290 iFullScreenController->FullscreenFinished( iCurrentFullScreenHandle ); |
1304 } |
1291 } |
1305 |
1292 |
1306 TInt CAlfServerDrawer::ControlTimeout( TAny* aServerDrawer ) |
1293 TInt CAlfServerDrawer::ControlTimeout( TAny* aServerDrawer ) |
1307 { |
1294 { |
1308 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleControlTimeout(); |
1295 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleControlTimeout(); |
1309 return KErrNone; |
1296 return KErrNone; |
1310 } |
1297 } |
1311 |
1298 |
1312 void CAlfServerDrawer::HandleControlTimeout() |
1299 void CAlfServerDrawer::HandleControlTimeout() |
1313 { |
1300 { |
1314 iTransitionEndObserver->Cancel(); |
1301 iControlTransitionEndObserver->Cancel(); |
1315 iFullScreenFinished = EFalse; |
1302 iFullScreenFinished = EFalse; |
|
1303 iControlTimeout->Cancel(); |
|
1304 iControlController->EndControlTransition( iCurrentControlHandle ); |
|
1305 } |
|
1306 |
|
1307 TInt CAlfServerDrawer::FullScreenTransitionFinished( TAny* aServerDrawer ) |
|
1308 { |
|
1309 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleFullScreenTransitionFinished(); |
|
1310 return KErrNone; |
|
1311 } |
|
1312 |
|
1313 TInt CAlfServerDrawer::ControlTransitionFinished( TAny* aServerDrawer ) |
|
1314 { |
|
1315 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleControlTransitionFinished(); |
|
1316 return KErrNone; |
|
1317 } |
|
1318 |
|
1319 |
|
1320 void CAlfServerDrawer::HandleFullScreenTransitionFinished() |
|
1321 { |
|
1322 iFullScreenFinished = ETrue; |
|
1323 iFinishFullScreen->Cancel(); |
1316 iFullScreenTimeout->Cancel(); |
1324 iFullScreenTimeout->Cancel(); |
1317 iController->EndControlTransition( iCurrHandle ); |
1325 iFullScreenController->FullscreenFinished( iCurrentFullScreenHandle ); |
1318 } |
1326 } |
1319 |
1327 |
1320 TInt CAlfServerDrawer::TransitionFinished( TAny* aServerDrawer ) |
1328 void CAlfServerDrawer::HandleControlTransitionFinished() |
1321 { |
1329 { |
1322 static_cast<CAlfServerDrawer*>(aServerDrawer)->HandleTransitionFinished(); |
1330 iControlTimeout->Cancel(); |
1323 return KErrNone; |
1331 iControlController->EndControlTransition( iCurrentControlHandle ); |
1324 } |
|
1325 |
|
1326 void CAlfServerDrawer::HandleTransitionFinished() |
|
1327 { |
|
1328 iFullScreenFinished = ETrue; |
|
1329 iIdle->Cancel(); //cancel if running. |
|
1330 iFinishFullScreen->Cancel(); |
|
1331 iFullScreenTimeout->Cancel(); |
|
1332 iController->FullscreenFinished( iCurrHandle ); |
|
1333 } |
1332 } |
1334 |
1333 |
1335 |
1334 |
1336 // --------------------------------------------------------------------------- |
1335 // --------------------------------------------------------------------------- |
1337 TBool CAlfServerDrawer::FileExistsL( TPtrC& aResourceDir, TPtrC& aFileName ) |
1336 TBool CAlfServerDrawer::FileExistsL( TPtrC& aResourceDir, TPtrC& aFileName ) |