# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1277127712 -10800 # Node ID cd0ae4656946a73b8d8019f7e51f20bdeb2f23de # Parent 3a60ebea00d019b20becdd75bba6a9bee7ac40c7 Revision: 201024 Kit: 2010125 diff -r 3a60ebea00d0 -r cd0ae4656946 rom/alfred.iby --- a/rom/alfred.iby Wed Jun 09 10:41:25 2010 +0300 +++ b/rom/alfred.iby Mon Jun 21 16:41:52 2010 +0300 @@ -71,12 +71,13 @@ // Stub sis file data=ABI_DIR\BUILD_DIR\uiaccelerator_stub.sis system\install\uiaccelerator_stub.sis -//#ifdef HUI_FX // For testing purposes we put our manifest file into the rom. // 101f84b9.sel file should be put to rom by aknskins even if we override the file during build. // After aknskins has taken over 101f84b9.sel and manifest.mf, we should no longe export them // or put them onto the rom. +#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#ifndef ALF_USE_OPENWF_COMPOSITION data=DATAZ_/RESOURCE_FILES_DIR/effects/manifest.mf RESOURCE_FILES_DIR/effects/manifest.mf // Effect fxmls. Keep the list in alphabetical order. When updating the list below, REMEMBER TO ALSO UPDATE core_exports.inc! @@ -172,15 +173,8 @@ data=DATAZ_/RESOURCE_FILES_DIR/effects/warningnote_appear.fxml RESOURCE_FILES_DIR/effects/warningnote_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/warningnote_disappear.fxml RESOURCE_FILES_DIR/effects/warningnote_disappear.fxml - -// No actual effect files are included into the rom by default. -// For testing the effect files can be put onto a memory card into -// /resource/effectst/ directory. -// As long as the testing override is in effect, this directory is used for the effects. -// Only if an effect file is not found on the memory card will the one in rom be used. -// see the filenames used in the manifest.mf file or change the manifest.mf before ROM imgage is built - -//#endif +#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#endif // ALF_USE_OPENWF_COMPOSITION file=ABI_DIR\BUILD_DIR\backgroundanimhost.exe PROGRAMS_DIR\backgroundanimhost.exe file=ABI_DIR\BUILD_DIR\bga_reference_plugin.dll SHARED_LIB_DIR\bga_reference_plugin.dll diff -r 3a60ebea00d0 -r cd0ae4656946 uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h Mon Jun 21 16:41:52 2010 +0300 @@ -819,11 +819,16 @@ IMPORT_C void CopyScreenToBitmapL(CFbsBitmap* aBitmap); + /** + * Does background clearing for native alf application + */ void DoBackgroundClear(); - void ScanningAlfContent(TBool aScanning ); + void ScanningAlfContent(TBool aScanning); void SetAlfContentChanged(TBool aChanged); TBool AlfContentChanged(); + IMPORT_C void SetSkinSizeChangePending(); + TBool QueryAndResetSkinSizeChangePendingStatus(); TRect CurrentDirtyRect(); private: @@ -1041,6 +1046,7 @@ /** For handling alf content update */ TBool iScanningAlfContent; TBool iDisplayContainsChangedAlfContent; + TBool iDisplaySizeChangePending; }; #endif // __HUIDISPLAY_H__ diff -r 3a60ebea00d0 -r cd0ae4656946 uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h Mon Jun 21 16:41:52 2010 +0300 @@ -52,6 +52,7 @@ class CHuiCanvasTextureCache; class CHuiFxEngine; class MHuiSynchronizationObserver; +class CAppIconCache; class CHighResTimer; const TInt KHuiEnvReleasedActionId = 0x200100F8; @@ -759,6 +760,7 @@ CHuiDisplay* CurrentDisplay() const; CHuiCanvasTextureCache& CanvasTextureCache() const; + IMPORT_C CAppIconCache& AppIconCache() const; /** * Performs drawing synchronization. @@ -977,6 +979,7 @@ RThread iIdleCPUValueThread; CHuiCanvasTextureCache* iCanvasTextureCache; + CAppIconCache* iAppIconCache; RPointerArray iLowMemoryObservers; RPointerArray iMemoryLevelObservers; diff -r 3a60ebea00d0 -r cd0ae4656946 uiaccelerator_plat/alf_visual_api/inc/alf/alftimedvalue.h --- a/uiaccelerator_plat/alf_visual_api/inc/alf/alftimedvalue.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alftimedvalue.h Mon Jun 21 16:41:52 2010 +0300 @@ -159,7 +159,7 @@ * * @param aValueNow New currentvalue. */ - IMPORT_C void SetValueNow(const TReal32& aValueNow); + IMPORT_C void SetValueNow(const TReal32& aValueNow) __SOFTFP; /** * Gets current value. @@ -175,7 +175,7 @@ * @param aValue New target value. * @param aTime Time duration after the target value will be in effect. Transition duration in milliseconds. */ - IMPORT_C void SetTarget(const TReal32& aTarget, TInt aTime); + IMPORT_C void SetTarget(const TReal32& aTarget, TInt aTime) __SOFTFP; /** * Sets a new target value. The transition time depends on the speed. diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/AlfCommandDebug/group/alfcommanddescriptions.rss --- a/uiacceltk/hitchcock/AlfCommandDebug/group/alfcommanddescriptions.rss Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/AlfCommandDebug/group/alfcommanddescriptions.rss Mon Jun 21 16:41:52 2010 +0300 @@ -281,11 +281,6 @@ }, ALF_COMMAND_DESCRIPTION { - command = EAlfSetBrushColor; - description = "EAlfSetBrushColor"; - }, - ALF_COMMAND_DESCRIPTION - { command = EAlfSetBrushOrigin; description = "EAlfSetBrushOrigin"; }, @@ -381,11 +376,6 @@ }, ALF_COMMAND_DESCRIPTION { - command = EAlfDrawRoundRect; - description = "EAlfDrawRoundRect"; - }, - ALF_COMMAND_DESCRIPTION - { command = EAlfSetFontNoDuplicate; description = "EAlfSetFontNoDuplicate"; }, @@ -734,11 +724,6 @@ }, ALF_COMMAND_DESCRIPTION { - command = EAlfDSRequestCommandsStart; - description = "EAlfDSRequestCommandsStart"; - }, - ALF_COMMAND_DESCRIPTION - { command = EAlfDSGetAlfNativeWindowData; description = "EAlfDSGetAlfNativeWindowData"; }, diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/AlfCommandDebug/src/alfcommanddebug.cpp --- a/uiacceltk/hitchcock/AlfCommandDebug/src/alfcommanddebug.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/AlfCommandDebug/src/alfcommanddebug.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -28,6 +28,7 @@ #include "alfcommanddebug.h" #include #include +#include #include #include @@ -47,6 +48,66 @@ } // --------------------------------------------------------------------------- +// destructor +// +// Note, you can enable iPrintStatistics at run-time in debugger +// --------------------------------------------------------------------------- +// +EXPORT_C CAlfCommandDebug::~CAlfCommandDebug() + { + TInt test1 = 0; + TInt testCount1 = iCommandDescriptions->Count(); + + THashMapIter ptrHashSetIter(*iCommandDescriptions); + for ( ; ; ) + { + const TCommand* resNext = ptrHashSetIter.NextValue(); + if (!resNext) + { + break; + } + //RDebug::Print(_L("!!HV: ~CAlfCommandDebug. DELETE: command.iDescription=%S (0x%x)"), + // resNext->iDescription, resNext->iDescription); + delete resNext->iDescription; + test1++; + } + + if (test1 != testCount1) + { + RDebug::Print(_L("CAlfCommandDebug::~CAlfCommandDebug(). Mismatch in iCommandDescriptions delete: deleted=%d, array count=%d"), test1, testCount1); + } + + TInt test2 = 0; + TInt testCount2 = iBridgeCommandDescriptions->Count(); + + THashMapIter ptrHashSetIter2(*iBridgeCommandDescriptions); + for ( ; ; ) + { + const TCommand* resNext = ptrHashSetIter2.NextValue(); + if (!resNext) + { + break; + } + //RDebug::Print(_L("!!HV: ~CAlfCommandDebug. DELETE2: command.iDescription=%S (0x%x)"), + // resNext->iDescription, resNext->iDescription); + delete resNext->iDescription; + test2++; + } + + if (test2 != testCount2) + { + RDebug::Print(_L("CAlfCommandDebug::~CAlfCommandDebug(). Mismatch in iBridgeCommandDescriptions delete: deleted=%d, array count=%d"), test2, testCount2); + } + + iCommandDescriptions->Close(); + iBridgeCommandDescriptions->Close(); + + delete iCommandDescriptions; + delete iBridgeCommandDescriptions; + } + + +// --------------------------------------------------------------------------- // ConstructL // --------------------------------------------------------------------------- // @@ -158,7 +219,20 @@ TCommand command; command.iDescription = reader.ReadHBufC16L(); - aDescriptionArray->Insert(commandId, command); + TCommand* commandPtr = NULL; + commandPtr = aDescriptionArray->Find(commandId); + if (commandPtr==NULL) + { + aDescriptionArray->Insert(commandId, command); + //RDebug::Print(_L("!!HV: CAlfCommandDebug::ReadCommandDescriptionsL. INSERT: commandId=%d, command.iDescription=%S (0x%x)"), + // commandId, command.iDescription, command.iDescription); + } + else + { + RDebug::Print(_L("!!HV: CAlfCommandDebug::ReadCommandDescriptionsL. ERROR. Duplicate command descriptions in the resource file! Skip the latter description. commandId=%d, command.iDescription=%S"), + commandId, command.iDescription); + delete command.iDescription; + } } CleanupStack::PopAndDestroy(readData); } @@ -443,17 +517,6 @@ } // --------------------------------------------------------------------------- -// destructor -// -// Note, you can enable iPrintStatistics at run-time in debugger -// --------------------------------------------------------------------------- -// -EXPORT_C CAlfCommandDebug::~CAlfCommandDebug() - { - delete iCommandDescriptions; - } - -// --------------------------------------------------------------------------- // DebugPrintControlGroupOrder // Can be used only from CAlfBridge // --------------------------------------------------------------------------- diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp --- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -832,6 +832,8 @@ TRect iSurfaceRect; TInt iWaiterAoPriority; + + TTimeStamp iTimeStamp; // not used but is required parameter for NotifyWhenDisplayed }; @@ -1198,7 +1200,7 @@ TBool draw = iData->iProvider.ProduceNewFrameL(region, buffer); if(draw) { - iData->iSurfaceUpdateSession.NotifyWhenAvailable(aStatus); + iData->iSurfaceUpdateSession.NotifyWhenDisplayed(aStatus, iData->iTimeStamp); iData->iSurfaceUpdateSession.SubmitUpdate(KAllScreens, iData->iSurfaceId, aBufferNumber); } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp --- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -71,13 +71,7 @@ delete iWsGraphicsContext; delete iGoomSession; - #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF - if (Dll::Tls()!=NULL) - { - delete AMT_CONTROL(); - Dll::FreeTls(); - } - #endif + AMT_FREE_TLS(); // Used just as a temporary holding place, do not delete! iWindowDrawingNode = NULL; @@ -117,14 +111,7 @@ compcntrl->AlfBridgeCallback(MAlfBridge::ESetWindowTreeObserver,(MAlfCompositionAgnosticWindowTreeObserver*)this); } - #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF - // Setup TLS and open global module testing chunk and mutex - if (Dll::Tls()==NULL) // create only for the first render stage! - { - User::LeaveIfError(Dll::SetTls(new(ELeave) CAlfModuleTestDataControl())); - User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects()); - } - #endif + AMT_SET_TLS(); __ALFLOGSTRING("CAlfRenderStage: ready to rock"); } @@ -597,10 +584,6 @@ #endif iAlfSendBuffer->CommitL(); - AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); - AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup, iRsWindowGroupNodeCount ); - AMT_INC_COUNTER(iRsTotalNodeCount ); - AMT_MAP_RENDER_STAGE_NODE_CREATED(); } @@ -642,16 +625,7 @@ __ALFLOGSTRING("CAlfRenderStage::NodeReleased - WARNING: Node not found!!"); } - AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); - AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup, iRsWindowGroupNodeCount ); - AMT_DEC_COUNTER(iRsTotalNodeCount ); - - AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), - iIntMap, aWindowTreeNode.Window()->Handle(), - EAlfModuleTestTypeRenderStageReleaseWindow ); - AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), - iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), - EAlfModuleTestTypeRenderStageReleaseWindowGroup ); + AMT_MAP_RENDER_STAGE_NODE_RELEASED(); } // --------------------------------------------------------------------------- @@ -670,11 +644,7 @@ iAlfSendBuffer->CommitL(); __ALFLOGSTRING("CAlfRenderStage::NodeActivated <<"); - AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeActivatedCount ); - - AMT_MAP_SET_VALUE_IF( nodeType == MWsWindowTreeNode::EWinTreeNodeClient, - iBoolMap, aWindowTreeNode.Window()->Handle(), ETrue, - EAlfModuleTestTypeRenderStageActiveWindow ); + AMT_MAP_RENDER_STAGE_NODE_ACTIVATED(); } // --------------------------------------------------------------------------- @@ -712,15 +682,7 @@ } iAlfSendBuffer->CommitL(); - AMT_INC_COUNTER( iRsNodeExtentChangedCount ); - AMT_SET_VALUE( iRsLatestNodeExtentRect, aRect ); - - AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), - iSizeMap, aWindowTreeNode.Window()->Handle(), - aRect.Size(), EAlfModuleTestTypeRenderStageChangeWindowSize ); - AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), - iPositionMap, aWindowTreeNode.Window()->Handle(), - aRect.iTl, EAlfModuleTestTypeRenderStageChangeWindowPosition ); + AMT_MAP_RENDER_STAGE_NODE_EXTENT_CHANGED(); } // --------------------------------------------------------------------------- @@ -754,13 +716,7 @@ &aWindowTreeNode ); iAlfSendBuffer->CommitL(); - AMT_INC_COUNTER( iRsTotalNodeFlagChangedCount ); - - AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() && MWsWindowTreeObserver::EVisible == aFlag ), - iBoolMap, - aWindowTreeNode.Window()->Handle(), - aNewValue, - EAlfModuleTestTypeRenderStageChangeWindowVisibility ); + AMT_MAP_RENDER_STAGE_FLAG_CHANGED(); } // --------------------------------------------------------------------------- @@ -858,8 +814,6 @@ } } iAlfSendBuffer->CommitL(); - - AMT_INC_COUNTER( iRsTotalNodeAttributeChangedCount ); } AMT_MAP_RENDER_STAGE_TEXT_CURSOR_CHANGE(); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/Client/src/alftimedvalue.cpp --- a/uiacceltk/hitchcock/Client/src/alftimedvalue.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/Client/src/alftimedvalue.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -53,13 +53,13 @@ } -EXPORT_C void TAlfTimedValue::SetValueNow(const TReal32& aValueNow) +EXPORT_C void TAlfTimedValue::SetValueNow(const TReal32& aValueNow) __SOFTFP { iFlags |= EAlfValueNowChanged; iValueNow = aValueNow; } -EXPORT_C void TAlfTimedValue::SetTarget(const TReal32& aTarget, TInt aTime) +EXPORT_C void TAlfTimedValue::SetTarget(const TReal32& aTarget, TInt aTime) __SOFTFP { iFlags |= EAlfValueTargetChanged; iValueTarget = aTarget; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/CommonInc/alfbridgecommands.h --- a/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h Mon Jun 21 16:41:52 2010 +0300 @@ -85,7 +85,7 @@ EAlfDSIncludeToVisibilityCalculation, EAlfDSSetDistractionWindow, - KUnInitialized + KUnInitialized // This must be kept as last command! }; #endif /* ALFBRIDGECOMMANDS_H_ */ diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h --- a/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h Mon Jun 21 16:41:52 2010 +0300 @@ -22,6 +22,8 @@ #define AMT_MAP_PTR_TO_KEY_CAST(keyPtr) #define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC() #define AMT_MAP_GCE_SET_LAYER_POSITIONS() + #define AMT_SET_TLS() + #define AMT_FREE_TLS() #else // Module test hook has been set. @@ -107,6 +109,22 @@ gceLayer = gceLayer->Above(); \ } + // Setup TLS and open global module testing chunk and mutex. + // Create only for the first object! + #define AMT_SET_TLS() \ + if (!Dll::Tls()) \ + { \ + User::LeaveIfError(Dll::SetTls(new(ELeave) CAlfModuleTestDataControl())); \ + User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects()); \ + } + + #define AMT_FREE_TLS() \ + if (Dll::Tls()) \ + { \ + delete AMT_CONTROL(); \ + Dll::FreeTls(); \ + } + #endif // USE_MODULE_TEST_HOOKS_FOR_ALF @@ -169,37 +187,46 @@ AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeStandardTextCursor == nodeType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeRenderStageChangeTextCursorFlag ); \ AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeStandardTextCursor == nodeType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeRenderStageChangeTextCursorColor ); \ \ + AMT_MAP_APPEND_AND_LINK_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iSurfaceMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeCreateLayer ); \ + AMT_MAP_APPEND_AND_LINK_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iSurfaceMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeReleaseLayer ); \ + AMT_MAP_APPEND_AND_LINK_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), 0, EAlfModuleTestTypeLayerOrdinalPosition ); \ + AMT_MAP_APPEND_AND_LINK_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), 0, EAlfModuleTestTypeLayerNodeOrdinalPosition ); \ + \ AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), EAlfModuleTestTypeRenderStageCreateWindow ); \ AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), EAlfModuleTestTypeRenderStageCreateWindowGroup ) +#define AMT_MAP_RENDER_STAGE_NODE_RELEASED() \ + AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), EAlfModuleTestTypeRenderStageReleaseWindow ); \ + AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), EAlfModuleTestTypeRenderStageReleaseWindowGroup ) + +#define AMT_MAP_RENDER_STAGE_NODE_ACTIVATED() \ + AMT_MAP_SET_VALUE_IF( nodeType == MWsWindowTreeNode::EWinTreeNodeClient, iBoolMap, aWindowTreeNode.Window()->Handle(), ETrue, EAlfModuleTestTypeRenderStageActiveWindow ) + +#define AMT_MAP_RENDER_STAGE_NODE_EXTENT_CHANGED() \ + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), iSizeMap, aWindowTreeNode.Window()->Handle(), aRect.Size(), EAlfModuleTestTypeRenderStageChangeWindowSize ); \ + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), iPositionMap, aWindowTreeNode.Window()->Handle(), aRect.iTl, EAlfModuleTestTypeRenderStageChangeWindowPosition ) + +#define AMT_MAP_RENDER_STAGE_FLAG_CHANGED() \ + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() && MWsWindowTreeObserver::EVisible == aFlag ), iBoolMap, aWindowTreeNode.Window()->Handle(), aNewValue, EAlfModuleTestTypeRenderStageChangeWindowVisibility ) + #define AMT_MAP_RENDER_STAGE_TEXT_CURSOR_CHANGE() \ AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorType ); \ AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorClipRect ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorClipRect ); \ AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorFlags ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorFlag ); \ AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorColor ) -#define AMT_MAP_RENDER_STAGE_ADD_LAYER() \ - AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeCreateLayer ); \ - AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeReleaseLayer ); \ - AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerOrdinalPosition ); \ - AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerNodeOrdinalPosition ) - -#define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \ - AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeCreateLayer ); \ - AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeCreateLayer ); \ - AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeReleaseLayer ); \ - AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeReleaseLayer ); \ - AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerOrdinalPosition ); \ - AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerOrdinalPosition ); \ - AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerNodeOrdinalPosition ); \ - AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerNodeOrdinalPosition ); \ - AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceCreateLayer ); \ - AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceReleaseLayer ); \ - AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerPosition ); \ - AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerOpacity ); \ - AMT_MAP_APPEND_LINK( iRectMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerExtent ); \ +#define AMT_MAP_RENDER_STAGE_LAYER_ADDED() \ + AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), EAlfModuleTestTypeCreateLayer ); \ + AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), EAlfModuleTestTypeReleaseLayer ); \ + AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), EAlfModuleTestTypeLayerOrdinalPosition ); \ + AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), EAlfModuleTestTypeLayerNodeOrdinalPosition ); \ + AMT_MAP_APPEND_LINK( iSurfaceMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceCreateLayer ); \ + AMT_MAP_APPEND_LINK( iSurfaceMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceReleaseLayer ); \ + AMT_MAP_APPEND_LINK( iIntMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerPosition ); \ + AMT_MAP_APPEND_LINK( iIntMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerOpacity ); \ + AMT_MAP_APPEND_LINK( iRectMap, aWindowTreeNode.Window()->Handle(), AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerExtent ); \ \ - AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeCreateLayer ) + AMT_MAP_SET_VALUE( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), aLayer.Surface(), EAlfModuleTestTypeCreateLayer ) #define AMT_MAP_RENDER_STAGE_REMOVE_LAYER() \ AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeReleaseLayer ) @@ -231,9 +258,27 @@ AMT_MAP_INC_VALUE_IF( ( attribute == MWsWindowTreeObserver::ECursorFlags ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeHierarchyModelChangeTextCursorFlag ); \ AMT_MAP_INC_VALUE_IF( ( attribute == MWsWindowTreeObserver::ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeHierarchyModelChangeTextCursorColor ) - + // Alfserver defines +#define AMT_MAP_NODE_CREATED() \ + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, iIntMap, node->iId, EAlfModuleTestTypeHierarchyModelCreateWindow ); \ + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeGroup, iIntMap, node->iId, EAlfModuleTestTypeHierarchyModelCreateWindowGroup ) + +#define AMT_MAP_NODE_RELEASED() \ + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, iIntMap, nodeId, EAlfModuleTestTypeHierarchyModelReleaseWindow ); \ + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeGroup, iIntMap, nodeId, EAlfModuleTestTypeHierarchyModelReleaseWindowGroup ) + +#define AMT_MAP_NODE_ACTIVATED() \ + AMT_MAP_SET_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, iBoolMap, nodeId, ETrue, EAlfModuleTestTypeHierarchyModelActiveWindow ) + +#define AMT_MAP_NODE_EXTENT_CHANGED() \ + AMT_MAP_SET_VALUE_IF( node && node->iWindow, iSizeMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, rect.Size(), EAlfModuleTestTypeHierarchyModelChangeWindowSize ); \ + AMT_MAP_SET_VALUE_IF( node && node->iWindow, iPositionMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, rect.iTl, EAlfModuleTestTypeHierarchyModelChangeWindowPosition ) + +#define AMT_MAP_NODE_FLAG_CHANGED() \ + AMT_MAP_SET_VALUE_IF( node && node->iWindow && MWsWindowTreeObserver::EVisible == flag, iBoolMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, newValue, EAlfModuleTestTypeHierarchyModelChangeWindowVisibility ) + #define AMT_MAP_BRIDGE_ADD_VISUAL() \ AMT_MAP_APPEND_AND_LINK( iIntMap, aWindowNodeId, aClientSideId, 0, EAlfModuleTestTypeBridgeCreateWindow ); \ AMT_MAP_APPEND_AND_LINK( iIntMap, aWindowNodeId, aClientSideId, 0, EAlfModuleTestTypeBridgeReleaseWindow ); \ @@ -294,7 +339,7 @@ AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeGceReleaseLayer ) #define AMT_MAP_GCE_SET_LAYER_OPACITY() \ - AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), Opacity(), EAlfModuleTestTypeGceLayerOpacity ) + AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), iLayer->Opacity(), EAlfModuleTestTypeGceLayerOpacity ) #define AMT_MAP_GCE_SET_LAYER_EXTENT() \ AMT_MAP_SET_VALUE( iRectMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), aExtent, EAlfModuleTestTypeGceLayerExtent ) diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h --- a/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h Mon Jun 21 16:41:52 2010 +0300 @@ -120,22 +120,20 @@ // 80 EAlfSetShapeRegion, - EAlfContentTag, EAlfFrameFlags, - EAlfFrameOrientation, - + EAlfFrameOrientation, EAlfPacketReady, EAlfPacketNotReady, EAlfPacketPadding, EAlfDrawCommandsEnd, EAlfSetWindowId, EAlfWindowInactivateWindow, + + // 90 EAlfWrap, EAlfJumpToAnotherChunk, EAlfDestroyChunk, - - // 90 EAlfSetExtent, EAlfNodeCreated, EAlfNodeReleased, @@ -143,11 +141,11 @@ EAlfNodeExtentChanged, EAlfNodeSiblingOrderChanged, EAlfNodeFlagChanged, + + // 100 EAlfNodeAttributeChanged, EAlfNodeFadeCountChanged, EAlfNodeTransparentRegionChanged, - - // 100 EAlfNodeLayerAdded, EAlfNodeMovedToWindowGroup, EAlfNodeWindowGroupChained, @@ -155,11 +153,11 @@ EAlfCommandNotInitialized, EAlfCommitBatch, EAlfFrameContainsUnsupportedCommands, + + // 110 EAlfDebugTrackNode, EAlfNodeLayerExtentChanged, EAlfNodeLayerUsesAlphaFlagChanged, - - // 110 EAlfNodeFadeAllChildren, EAlfCommandIndexArray, EAlfCommandIndexArrayHeader, diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Mon Jun 21 16:41:52 2010 +0300 @@ -205,7 +205,7 @@ TInt FindClientWindowGroupId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ); TInt FindWindowGroupNodeId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) const; - void RemoveAllTemporaryPresenterVisuals(); + void CleanAllFxVisuals(); /** * Helper function to abort fullscreen effect @@ -304,7 +304,20 @@ TBool GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup = NULL); // Experimental - TBool IsFullScreenDrawn( TInt aOrientation); + TBool IsLayoutSwitchReady( TInt aDuration ); + TBool IsLayoutSwitchReadyRecursive( + CHuiLayout* aLayout, + CHuiControlGroup& aControlGroup, + CHuiControl& aControl, + TBool& aFullscreenCovered, + const TRect& aFullscreen, + CAlfScreen* aScreen, + TBool aChildCanBeOpaque, + TBool aOnlyForEmbeddedAlfApp, + TInt aOrientation, + TInt aDuration, + TBool& aCoverageRegionModified ); + void LayoutSwitchStart(); void LayoutSwitchComplete(); @@ -442,14 +455,14 @@ TBool SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsFullScreenEffect, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately); /* - * AddEffectItemL + * AddFxItemL * * Prepares visual for the effect. Removes previous effect if necessary. @aItemDestroyed will return EFalse, * if the visual has been destroyed during the previous effect. * * @param aItemDestroyed */ - CHuiCanvasVisual* AddEffectItemL( + CHuiCanvasVisual* AddFxItemL( TInt aEffectHandle, CHuiVisual* aSourceVisual, CHuiLayout* aTargetLayout, @@ -482,14 +495,14 @@ void ListFamilyTreeL( RPointerArray& aArray, const CHuiLayout* aLayout ); /* - * RemoveTemporaryPresenterItem + * CleanFxItem * * Effects are shown indirectly by a another visual, that is in iFullScreenEffect control group. * This methods unbinds the external content and the removes temporary presenter visual * from iFullScreenEffect group and . It does not delete the CHuiFxEffect * object associated with the content visual. See also iEffectCleanupStack. */ - TBool RemoveTemporaryPresenterItem(TEffectCleanupStruct& aEffectItem); + TBool CleanFxItem(TEffectCleanupStruct& aEffectItem); /* * FindTemporaryPresenterLayout @@ -544,21 +557,21 @@ */ TInt FindEffectHandle(CHuiVisual* aVisual); /* - * RemoveTemporaryPresenterVisual + * CleanFxVisual * * Effects are shown indirectly by a another visual, that is in iFullScreenEffect control group. * This methods unbinds the external content and the removes temporary presenter visual * from iFullScreenEffect group and . It does not delete the CHuiFxEffect * object associated with the content visual. See also iEffectCleanupStack. */ - TBool RemoveTemporaryPresenterVisual(CHuiVisual* aVisual, TInt aHandle = KErrNotFound); + TBool CleanFxVisual(CHuiVisual* aVisual, TInt aHandle = KErrNotFound); /* - * RemoveTemporaryPresenterVisuals + * CleanFxVisuals * * See above. */ - TBool RemoveTemporaryPresenterVisuals(); + TBool CleanFxVisuals(); void HandleNewWindowL( TAlfBridgerData& aData ); @@ -609,6 +622,7 @@ void HandleSetLayoutSwitchEffectL(); void ClearCanvasVisualCommandSets(TBool aInactiveOnly); + static void ClearCanvasVisualCommandSetsRecursive(CHuiCanvasVisual* aVisual, TBool aInactiveOnly); void ClipVisualRect(TRect& aRect, const TRect& aClippingRect); @@ -930,7 +944,7 @@ RArray iEffectCleanupStack; // Same as iEffectCleanupStack, but only the ones that can be now cleaned away. - // See method RemoveTemporaryPresenterVisuals. + // See method CleanFxVisuals. RArray iFinishedCleanupStackEffects; @@ -938,9 +952,18 @@ * Full screen effect state. * Own. */ - CFullScreenEffectState* iFullScreenEffectData; + CFullScreenEffectState* iFSFxData; - CFullScreenEffectState* iSecondaryFullScreenEffectData; + /** + * Long app start effect consists of two effects. The app_start_long.fxml is + * applied after a short timeout. Then system waits the EndFullScreen event is + * received or heuristics determine that new application has drawn itself + * properly. When application is drawn, the original requested effect is applied. + * + * iFSFXDataPart2 defines the original requested effect, while iFSFxData + * is used to define the coming or ongoing fullscreen app start effect. + */ + CFullScreenEffectState* iFSFXDataPart2; /** * Control effect state. @@ -1032,6 +1055,8 @@ mutable RRegionBuf iTempVisualRegion; mutable RRegionBuf iTempIntersectingRegion; mutable RRegionBuf iTempRegion; + mutable RRegionBuf iTempRegion2; + TBool iBgSurfaceFound; TBool iInLowMemMode; TBool iLayoutSwitchInProgress; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h Mon Jun 21 16:41:52 2010 +0300 @@ -26,7 +26,6 @@ EWaitEndFullScreen, EEndFullScreenReceivedWaitingWindowGroup, EEndFullscreenReceived, - ESecondPhaseSetupActive, EFinalEffectActive }; // Timer to send finish full screen effect @@ -55,6 +54,7 @@ CAlfBridge& iBridge; public: TInt iSafeCounter; + TInt iSafeCounterDelta; TCallBack iCallBack; }; @@ -134,6 +134,9 @@ TState NextBlankState(TEvent aEvent); TState NextThemeState(TEvent aEvent); + void HandleFreezeEvent(TEvent aEvent); + void HandleThemeEvent(TEvent aEvent); + void FreezeFinished(); public: @@ -162,6 +165,7 @@ void FreezeRoster(TBool aFrozen); static TInt DoFreezeFinished(TAny* aAny); + static TInt DoNextLayoutSwitchContext(TAny* aAny); private: // Data @@ -273,14 +277,15 @@ { EOnlyOnePart = 0, EFirstPartActive, - ESecondPartActive + EFirstPartRunning, + ESecondPartActive, + ESecondPartRunning }; TEffectPhase iTwoPhaseEffect; // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application TInt iAppStartScreenshotItemHandle; - enum TEffectType { ENotDefinedEffect = 0, @@ -290,16 +295,6 @@ TEffectType iEffectType; - // Display dimension, iPaintedRegion is clipped to this when determining, if there is enough drawing to the group - TSize iDisplaySize; - - // gathers the painted region for the effected application. When enough region has been painted, the effect is forced. - RRegion iPaintedRegion; - - CAlfBridge* iBridge; // for callback. not own. - // If the visual is shown by some other visual by a screenshot, this is set ETrue. TBool iCanDestroyOrHideImmediately; - - CPeriodic* iDrawingCompleteTimer; }; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -1142,7 +1142,7 @@ if ( aType == KEikDynamicLayoutVariantSwitch || aType == KAknsMessageSkinChange && iData->iHuiEnv) { - iData->iHuiEnv->Skin().NotifyDisplaySizeChangedL(); + iData->iHuiEnv->Display(0).SetSkinSizeChangePending(); } // Send notification events to clients here if needed diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -109,6 +109,30 @@ const TInt KFadeAction = 6000; +// IsLayoutSwitchReady heuristic constants: + +// Duration to wait that visual display rects are fully inside fullscreen rect. +// 1 unit = 50ms. +const TInt KAlfCheckVisualDisplayRect = 15; + +// Duration to wait that visual has drawing inside screen area. +const TInt KAlfCheckVisualDrawRect = 15; + +// Duration to wait that visual has drawing that covers the whole display rect. +const TInt KAlfCheckVisualDrawingComplete = 20; + +// Duration to wait that visual has some drawing (not necessarily complete). +const TInt KAlfCheckVisualDrawingNotEmpty = 28; + +// Duration to wait that fullscreen is covered by visual drawing. +const TInt KAlfCheckFullscreenCoveredByVisualDrawing = 50; + +// Duration to wait if coverage is modified by multiple control groups. +// This may indicate that topmost application hasn't yet had time to update +// its layout properly. +const TInt KAlfCheckCoverageFromMultipleGroups = 20; + + NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface { public: @@ -158,6 +182,8 @@ // CAlfBridge::~CAlfBridge() { + iTempRegion2.Close(); + iAlfNativeClientsWgIds.Close(); delete iOrphanStorage; delete iFadeEffectFile; @@ -170,8 +196,8 @@ delete iEffectEndTimer; iDeadControlGroups.Close(); iEffectWindowGroups.Close(); - delete iFullScreenEffectData; - delete iSecondaryFullScreenEffectData; + delete iFSFxData; + delete iFSFXDataPart2; if (iActivated) { @@ -555,9 +581,9 @@ // CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenToEffect() const { - if ( iFullScreenEffectData ) - { - return FindControlGroupBySecureId( iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg ); + if ( iFSFxData ) + { + return FindControlGroupBySecureId( iFSFxData->iToSecureId, iFSFxData->iToWg ); } return NULL; } @@ -568,9 +594,9 @@ // CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenFromEffect() const { - if ( iFullScreenEffectData ) - { - return FindControlGroupBySecureId( iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg ); + if ( iFSFxData ) + { + return FindControlGroupBySecureId( iFSFxData->iFromSecureId, iFSFxData->iFromWg ); } return NULL; } @@ -603,7 +629,7 @@ void CAlfBridge::ResolveAfterEffectAppearingApplicationL(CHuiControlGroup* aGroup) { #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT - if (iFullScreenEffectData && iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) + if (iFSFxData && iFSFxData->iEffectType == CFullScreenEffectState::EExitEffect) { CHuiControlGroup *exitingGroupInEffect = FindControlGroupByFullScreenToEffect(); if (exitingGroupInEffect == aGroup) @@ -627,9 +653,9 @@ { if (iAlfScreens[0]->iControlGroups[j].iControlGroup == nextToBecomeVisible) { - iFullScreenEffectData->iFromSecureId = iAlfScreens[0]->iControlGroups[j].iSecureId; - iFullScreenEffectData->iFromWg = iAlfScreens[0]->iControlGroups[j].iClientWindowGroupId; - __ALFFXLOGSTRING2("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x, window group: %d - Start track drawing for exit effect.", iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg ); + iFSFxData->iFromSecureId = iAlfScreens[0]->iControlGroups[j].iSecureId; + iFSFxData->iFromWg = iAlfScreens[0]->iControlGroups[j].iClientWindowGroupId; + __ALFFXLOGSTRING2("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x, window group: %d - Start track drawing for exit effect.", iFSFxData->iFromSecureId, iFSFxData->iFromWg ); break; } } @@ -675,11 +701,11 @@ if (anyVisualHasEffect) { TInt activeEffectHandle = iEffectCleanupStack[activeEffectIndex].iHandle; - if (iSecondaryFullScreenEffectData && iSecondaryFullScreenEffectData->iHandle == activeEffectHandle) + if (iFSFXDataPart2 && iFSFXDataPart2->iHandle == activeEffectHandle) { __ALFFXLOGSTRING1("CAlfBridge::DeleteControlGroupL - WARNING! Control group with 2 phase effect is being destroyed. Canceling second phase for handle %d", activeEffectHandle); - delete iSecondaryFullScreenEffectData; - iSecondaryFullScreenEffectData = NULL; + delete iFSFXDataPart2; + iFSFXDataPart2 = NULL; } __ALFFXLOGSTRING1("Layout 0x%x has external content", layout); @@ -710,7 +736,7 @@ if (!HasActiveEffect(familyTree[familyIndex])) { TInt dummy; - AddEffectItemL(activeEffectHandle, familyTree[familyIndex], NULL, NULL, EFalse, dummy, ETrue, EFalse); + AddFxItemL(activeEffectHandle, familyTree[familyIndex], NULL, NULL, EFalse, dummy, ETrue, EFalse); } } } @@ -722,13 +748,13 @@ for(TInt familyIndex = 0; familyIndex < familyTree.Count();familyIndex++) { CHuiLayout* removedVisual = familyTree[familyIndex]; - RemoveTemporaryPresenterVisual(removedVisual); + CleanFxVisual(removedVisual); if ( removedVisual != layout ) // let control group delete the layout { control.Remove(removedVisual); // remove ownership from the original control (group) __ALFFXLOGSTRING1("CAlfBridge::DeleteControlGroupL - adding to orphonage 0x%x", layout); - RemoveTemporaryPresenterVisual(removedVisual); + CleanFxVisual(removedVisual); if ( removedVisual->Layout() == layout ) { iOrphanStorage->AppendL( removedVisual ); @@ -805,14 +831,14 @@ entry.iClientWindowGroupId = aClientWindowGroupId; entry.iSecureId = aSecureId; // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group. - if (iFullScreenEffectData - && (iFullScreenEffectData->State() == EWaitingWindowGroup || iFullScreenEffectData->State() == EEndFullScreenReceivedWaitingWindowGroup) - && iFullScreenEffectData->iToSecureId == aSecureId) - { - iFullScreenEffectData->iToWg = aClientWindowGroupId; - if (iSecondaryFullScreenEffectData) - { - iSecondaryFullScreenEffectData->iToWg = aClientWindowGroupId; + if (iFSFxData + && (iFSFxData->State() == EWaitingWindowGroup || iFSFxData->State() == EEndFullScreenReceivedWaitingWindowGroup) + && iFSFxData->iToSecureId == aSecureId) + { + iFSFxData->iToWg = aClientWindowGroupId; + if (iFSFXDataPart2) + { + iFSFXDataPart2->iToWg = aClientWindowGroupId; } CHuiControlGroup* fromGroup = NULL; CHuiLayout* fromLayout = NULL; @@ -826,22 +852,22 @@ // First HandleGfxEvent, then clear iWaitingWindowGroup. __ALFFXLOGSTRING1("CAlfBridge::CreateControlGroupL - try triggering effect 0x%x", layout); - TBool failed = HandleGfxEventL( *iFullScreenEffectData, layout, fromLayout ); - if ( iFullScreenEffectData->State() == EWaitingWindowGroup) - { - iFullScreenEffectData->SetState(EWaitEndFullScreen); + TBool failed = HandleGfxEventL( *iFSFxData, layout, fromLayout ); + if ( iFSFxData->State() == EWaitingWindowGroup) + { + iFSFxData->SetState(EWaitEndFullScreen); } else { // was CFullScreenEffectState::EEndFullScreenReceivedWaitingWindowGroup - iFullScreenEffectData->SetState(EEndFullscreenReceived); + iFSFxData->SetState(EEndFullscreenReceived); } if ( failed ) { // Effect failed, reset state __ALFFXLOGSTRING1("CAlfBridge::CreateControlGroupL - effect failed on layout 0x%x", layout); - HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData + HandleGfxStopEvent( EFalse ); // destroys iFSFxData and iFSFXDataPart2 } } entry.iScreenNumber = aScreenNumber; @@ -1031,42 +1057,50 @@ TInt index = 0; // Index for Window group control groups TBool added = EFalse; for (TInt i=0; iFixedControlGroupCount(); i++) - { - if (index == aWhere) - { - TBool lSyncAlfAppAndAlfEventGroup = EFalse; - if ( i>0 && aRoster.ControlGroup(i).iAlfApp && aRoster.ControlGroup(i-1).ResourceId() == iAlfWindowGroupNodeId && &aRoster.ControlGroup(i) != &aGroup) - { - // we still need to check that there are no other alf client window groups on top. - // if one native alf application is embedding another native alf application, WServ - // seems to update wg chains so that the following check must be done - TInt u = i+1; - TBool clienWgFoundOntop =EFalse; - for(;u < aRoster.Count() - screen->FixedControlGroupCount(); u++) - { - if(aRoster.ControlGroup(u).iAlfApp) - { - clienWgFoundOntop = ETrue; - break; - } - } - - if(!clienWgFoundOntop) - { - lSyncAlfAppAndAlfEventGroup = ETrue; - } - } - aRoster.ShowL(aGroup, i); - added = ETrue; - if (lSyncAlfAppAndAlfEventGroup && i< (aRoster.Count()-1) ) - { - CHuiControlGroup &lGroup = aRoster.ControlGroup(i+1); - TInt clientWindowGroupId = FindClientWindowGroupId( aScreenNumber, lGroup ); - iAppUi->AdjustWindowGroupPositionL(clientWindowGroupId,CAlfAppServer::EBehindOfParent); - } - - break; - } + { + if (index == aWhere) + { + TBool lSyncAlfAppAndAlfEventGroup = EFalse; + if ( i>0 && aRoster.ControlGroup(i).iAlfApp && aRoster.ControlGroup(i-1).ResourceId() == iAlfWindowGroupNodeId && &aRoster.ControlGroup(i) != &aGroup) + { + // we still need to check that there are no other alf client window groups on top. + // if one native alf application is embedding another native alf application, WServ + // seems to update wg chains so that the following check must be done + TInt u = i+1; + TBool clienWgFoundOntop =EFalse; + for(;u < aRoster.Count() - screen->FixedControlGroupCount(); u++) + { + if(aRoster.ControlGroup(u).iAlfApp) + { + clienWgFoundOntop = ETrue; + break; + } + } + + if(!clienWgFoundOntop) + { + lSyncAlfAppAndAlfEventGroup = ETrue; + } + } + aRoster.ShowL(aGroup, i); + added = ETrue; + TBool lSyncDone(EFalse); + if (lSyncAlfAppAndAlfEventGroup && i< (aRoster.Count()-1) ) + { + lSyncDone = ETrue; + CHuiControlGroup &lGroup = aRoster.ControlGroup(i+1); + TInt clientWindowGroupId = FindClientWindowGroupId( aScreenNumber, lGroup ); + iAppUi->AdjustWindowGroupPositionL(clientWindowGroupId,CAlfAppServer::EBehindOfParent); + } + if(!lSyncDone && aGroup.iAlfApp && aRoster.ControlGroup(i-1).ResourceId() != iAlfWindowGroupNodeId ) + { + + CHuiControlGroup &lGroup = aRoster.ControlGroup(i); + TInt clientWindowGroupId = FindClientWindowGroupId( aScreenNumber, lGroup ); + iAppUi->AdjustWindowGroupPositionL(clientWindowGroupId,CAlfAppServer::EBehindOfParent); + } + break; + } if (aRoster.ControlGroup(i).Control(0).Role() == EHuiWindowGroupContainer && &aRoster.ControlGroup(i) != &aGroup) @@ -1231,7 +1265,7 @@ { // Look for the correct display TInt screenNumber = ResolveScreenNumber(aDisplay); - RemoveTemporaryPresenterVisuals(); + CleanFxVisuals(); if ( screenNumber != KErrNotFound ) { // FPS Counter with hitchcock drawing @@ -1408,6 +1442,7 @@ return; iTempRegion.Clear(); + iTempRegion2.Clear(); CAlfScreen* screen = iAlfScreens[aScreenNumber]; TRect fullscreen = TRect(TPoint(0,0), screen->Size()); @@ -1740,7 +1775,7 @@ } if ( iSwRenderingEnabled ) { - screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible | alfClientWindowGroupVisible ); + screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible || alfClientWindowGroupVisible ); } // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not @@ -2220,19 +2255,39 @@ for (TInt i=layout->Count()-1; i >= 0; i--) { CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)(&layout->Visual(i)); - if (!aInactiveOnly) - { - canvasVisual->ClearCommandSet(); - } - else if (aInactiveOnly && (canvasVisual->Flags() & EHuiVisualFlagInactive)) - { - canvasVisual->ClearCommandSet(); - } - else - { - // dont clear - } - } + ClearCanvasVisualCommandSetsRecursive(canvasVisual, aInactiveOnly); + } + } + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +void CAlfBridge::ClearCanvasVisualCommandSetsRecursive(CHuiCanvasVisual* aVisual, TBool aInactiveOnly) + { + if (!aVisual) + { + return; + } + + if (!aInactiveOnly) + { + aVisual->ClearCommandSet(); + } + else if (aInactiveOnly && (aVisual->Flags() & EHuiVisualFlagInactive)) + { + aVisual->ClearCommandSet(); + } + else + { + // dont clear + } + + for (TInt i=aVisual->Count()-1; i >= 0; --i) + { + CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)(&aVisual->Visual(i)); + ClearCanvasVisualCommandSetsRecursive(canvasVisual, aInactiveOnly); } } @@ -2531,6 +2586,13 @@ __ALFLOGSTRING1("AlfScreens[0]->iDisplay->SetOrientation: %d",huiOrientation); } + if (!iLayoutSwitchInProgress) // LayoutSwitchStart wasn't called, so inform that all is fine. + { + if (iActivated) + { + iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); + } + } break; } case EAlfEffectFxBeginSyncronizedGroup: @@ -2761,7 +2823,7 @@ CHuiLayout* lVisual = familyTree[familyIndex]; lVisual->Owner().Remove(lVisual); iOrphanStorage->AppendL( lVisual ); - RemoveTemporaryPresenterVisual(lVisual); + CleanFxVisual(lVisual); __ALFLOGSTRING1("CAlfBridge::DestroyWindow - orphons: %d", iOrphanStorage->VisualCount()); } @@ -2775,7 +2837,7 @@ if (!aUseForce) { // we can remove from iEffectCleanupStack only when this method was called from HandleDestroyWindow. Otherwise - // messing iEffectCleanupStack is likely to cause forever loop in some RemoveTemporaryPresenterVisuals method + // messing iEffectCleanupStack is likely to cause forever loop in some CleanFxVisuals method for (TInt i = 0; i < iEffectCleanupStack.Count(); i++) { TEffectCleanupStruct& effectItem = iEffectCleanupStack[i]; @@ -3366,14 +3428,12 @@ __ALFLOGSTRING3("CAlfBridge::HandlePostCanvasBufferL, EAlfDSPostCanvasBuffer: Visual not found! Screen: %d, Id: %d, GroupId: %d ", screenNumber, windowNodeId, windowGroupNodeId ); } #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT - if (iFullScreenEffectData - && !iSecondaryFullScreenEffectData - && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect - && iFullScreenEffectData->State() == EWaitEndFullScreen - && iFullScreenEffectData->iTwoPhaseEffect != CFullScreenEffectState::ESecondPartActive) + if (iFSFxData + && iFSFxData->iEffectType != CFullScreenEffectState::ENotDefinedEffect + && ((iFSFxData->State() == EWaitEndFullScreen && iFSFxData->iTwoPhaseEffect <= CFullScreenEffectState::EFirstPartRunning))) { CHuiControlGroup *to_group = NULL; - if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) + if (iFSFxData->iEffectType == CFullScreenEffectState::EExitEffect) { to_group = FindControlGroupByFullScreenFromEffect(); } @@ -3401,7 +3461,7 @@ // void CAlfBridge::GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData) { - if (iFullScreenEffectData->State() == EFinalEffectActive) + if (iFSFxData->State() == EFinalEffectActive) { return; } @@ -3428,7 +3488,7 @@ if (to_layout) { // from layout may be undefined - __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEndFullScreenTimeout : Enough app drawing. Trigger EndFullScreen for layout 0x%x", to_layout); + __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEndFullScreen : Enough app drawing. Trigger EndFullScreen for layout 0x%x", to_layout); HandleGfxEventL( *aFullScreenEffectData, to_layout, from_layout ); aFullScreenEffectData->SetState(EFinalEffectActive); } @@ -3461,7 +3521,7 @@ { __ALFFXLOGSTRING2("CAlfBridge::SetWindowActiveL 0x%x has active effect. New state: %d", aVisual, aActive); // Has effect - // these flags are put to action in RemoveTemporaryPresenterItem + // these flags are put to action in CleanFxItem if (aActive) { // this prevents windows appearing before their "effected" time @@ -4346,7 +4406,7 @@ { __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find new group! orphaning the visual"); - RemoveTemporaryPresenterVisual(viz); + CleanFxVisual(viz); iOrphanStorage->AppendL( viz ); } } @@ -4601,7 +4661,7 @@ if (!HasActiveEffect(aToLayout, dummy)) { __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Add layout 0x%x with handle %d to cleanupstack", aToLayout, aEvent.iHandle); - AddEffectItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, ETrue, EFalse); + AddFxItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, ETrue, EFalse); } } // Screenshot was requested, but it could not be taken. Lets cancel the effect. @@ -4623,9 +4683,9 @@ aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); aEvent.iEffectType = CFullScreenEffectState::EStartEffect; - if (iSecondaryFullScreenEffectData) + if (iFSFXDataPart2) { - iSecondaryFullScreenEffectData->iEffectType = CFullScreenEffectState::EStartEffect; + iFSFXDataPart2->iEffectType = CFullScreenEffectState::EStartEffect; } aEvent.iCanDestroyOrHideImmediately = ETrue; // enable hiding of windows during application start/activate effects @@ -4681,9 +4741,9 @@ aEvent.iSetupDone = EFalse; failed = ETrue; } - if (iSecondaryFullScreenEffectData) + if (iFSFXDataPart2) { - iSecondaryFullScreenEffectData->iSetupDone = aEvent.iSetupDone; + iFSFXDataPart2->iSetupDone = aEvent.iSetupDone; } return failed; } @@ -4769,9 +4829,9 @@ { effectFlags |= KHuiFxOpaqueHint; } - if (iSecondaryFullScreenEffectData) + if (iFSFXDataPart2) { - iSecondaryFullScreenEffectData->iSetupDone = ETrue; + iFSFXDataPart2->iSetupDone = ETrue; } if (aEvent.iRect != TRect()) @@ -4789,10 +4849,22 @@ if (err != KErrNone) { // visuals added to "active effect visual" stack, but they wont be used, because effect loading has failed. cleanup. - RemoveTemporaryPresenterVisual(NULL, aEvent.iHandle); + CleanFxVisual(NULL, aEvent.iHandle); aToLayout->SetEffect(NULL); failed = ETrue; } + else + { + switch(aEvent.iTwoPhaseEffect) + { + case CFullScreenEffectState::EFirstPartActive: + aEvent.iTwoPhaseEffect = CFullScreenEffectState::EFirstPartRunning; + break; + case CFullScreenEffectState::ESecondPartActive: + aEvent.iTwoPhaseEffect = CFullScreenEffectState::ESecondPartRunning; + break; + } + } } else { @@ -4826,8 +4898,8 @@ // Freeze only, if buffer was reserved succesfully aLayout->SetFreezeState(ETrue); TBool itemsDestroyed; - AddEffectItemL(aHandle, aLayout, NULL, NULL, EFalse, itemsDestroyed, ETrue, EFalse); - iFullScreenEffectData->iAppStartScreenshotItemHandle = aHandle; + AddFxItemL(aHandle, aLayout, NULL, NULL, EFalse, itemsDestroyed, ETrue, EFalse); + iFSFxData->iAppStartScreenshotItemHandle = aHandle; } } } @@ -4835,23 +4907,23 @@ void CAlfBridge::HandleGfxStopEvent( TBool aClientRequest ) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent BEGIN"); - if (!iFullScreenEffectData) + if (!iFSFxData) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none"); - RemoveAllTemporaryPresenterVisuals(); + CleanAllFxVisuals(); delete iControlEffectData; iControlEffectData = NULL; return; } - CFullScreenEffectState* fxData = iFullScreenEffectData; - iFullScreenEffectData = NULL; + CFullScreenEffectState* fxData = iFSFxData; + iFSFxData = NULL; CleanupStack::PushL( fxData ); __ALFFXLOGSTRING2("CAlfBridge::HandleGfxStopEvent - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); // clean effects with this handle - RemoveTemporaryPresenterVisual(NULL, fxData->iHandle); + CleanFxVisual(NULL, fxData->iHandle); // this was abort, so we might have received earlier event hiding this window. Here we'll bring it // back if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) @@ -4860,7 +4932,7 @@ RemoveEffectFromApp(fxData->iFromSecureId, fxData->iFromWg ); } // abort ALL other possible control effects - RemoveAllTemporaryPresenterVisuals(); + CleanAllFxVisuals(); delete iControlEffectData; iControlEffectData = NULL; @@ -4874,8 +4946,8 @@ } CleanupStack::PopAndDestroy( fxData ); - delete iSecondaryFullScreenEffectData; - iSecondaryFullScreenEffectData = NULL; + delete iFSFXDataPart2; + iFSFXDataPart2 = NULL; __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END"); } @@ -4906,7 +4978,7 @@ if (handle != KErrNotFound) { __ALFFXLOGSTRING2("CAlfBridge::HandleGfxStopEvent - layout visual: 0x%x ; handle: %d ", layout, handle); - RemoveTemporaryPresenterVisual(NULL, handle); + CleanFxVisual(NULL, handle); } layout->iOpacity.Set(1.0f); } @@ -4944,10 +5016,10 @@ if ( operation == MAlfGfxEffectPlugin::EBeginFullscreen ) { - if ( !iFullScreenEffectData || !iFullScreenEffectData->iSetupDone ) + if ( !iFSFxData || !iFSFxData->iSetupDone ) { // No fullsceen effect ongoing or fullscreen effect hasn't yet been set up, - // so we can initialize iFullScreenEffectData from stream. + // so we can initialize iFSFxData from stream. __ALFFXLOGSTRING("HandleGfxEffectsL - fresh start"); @@ -4958,33 +5030,33 @@ // the effect handle of freezed layout (iAppStartScreenshotItemHandle) must match the actual // effect handle that is run. Only then frozen application can be freed at the end of the effect - if (iFullScreenEffectData) + if (iFSFxData) { for (TInt i = 0; i < iEffectCleanupStack.Count(); i++) { TEffectCleanupStruct& effectItem = iEffectCleanupStack[i]; - if (iFullScreenEffectData->iAppStartScreenshotItemHandle == effectItem.iHandle) + if (iFSFxData->iAppStartScreenshotItemHandle == effectItem.iHandle) { effectItem.iHandle = fxData->iHandle; } } } - if (iFullScreenEffectData && iFullScreenEffectData->iToAppId != fxData->iToAppId) + if (iFSFxData && iFSFxData->iToAppId != fxData->iToAppId) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - WARNING - Another fullscreen effect to different app. Deleting the previous ongoing effect"); - RemoveEffectFromApp(iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called. - RemoveEffectFromApp(iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg); - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - Effect request has changed from appUid 0x%x to 0x%x. Cancel previous effect.", iFullScreenEffectData->iToAppId, fxData->iToAppId); - RemoveEffectFromApp(iFullScreenEffectData->iToAppId); + RemoveEffectFromApp(iFSFxData->iToSecureId, iFSFxData->iToWg);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called. + RemoveEffectFromApp(iFSFxData->iFromSecureId, iFSFxData->iFromWg); + __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - Effect request has changed from appUid 0x%x to 0x%x. Cancel previous effect.", iFSFxData->iToAppId, fxData->iToAppId); + RemoveEffectFromApp(iFSFxData->iToAppId); // Fullscreen effect for another } - delete iFullScreenEffectData; - delete iSecondaryFullScreenEffectData; - iSecondaryFullScreenEffectData = NULL; - iFullScreenEffectData = fxData; - iFullScreenEffectData->iAppStartScreenshotItemHandle = fxData->iHandle; + delete iFSFxData; + delete iFSFXDataPart2; + iFSFXDataPart2 = NULL; + iFSFxData = fxData; + iFSFxData->iAppStartScreenshotItemHandle = fxData->iHandle; stream.Release(); } @@ -4997,14 +5069,14 @@ __ALFFXLOGSTRING("HandleGfxEffectsL - END: ongoing"); // Client expects completion to be signalled with this handle. - iFullScreenEffectData->iCompletionHandle = stream.ReadInt32L(); - if (iSecondaryFullScreenEffectData) + iFSFxData->iCompletionHandle = stream.ReadInt32L(); + if (iFSFXDataPart2) { // Two phase effect path has been chosen. First part is now ongoing, and second part will be // triggered after that. Client has now notified, that its screen is ready. We may trigger the // second effect as soon as the first part finishes. __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Trigger second part. when 1st part done."); - iSecondaryFullScreenEffectData->iCompletionHandle = iFullScreenEffectData->iCompletionHandle; + iFSFXDataPart2->iCompletionHandle = iFSFxData->iCompletionHandle; } stream.Release(); @@ -5016,12 +5088,12 @@ // End fullscreen signal received. We proceed only if there is really // effect ongoing and "end fullscreen" hasn't already been processed. - if ( !iFullScreenEffectData - || iFullScreenEffectData->State() == EFinalEffectActive - || iFullScreenEffectData->State() == EEndFullscreenReceived) - { - if (iFullScreenEffectData) - __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEffectsL - END: fx ready, state %d ", iFullScreenEffectData->State()); + if ( !iFSFxData + || iFSFxData->State() == EFinalEffectActive + || iFSFxData->State() == EEndFullscreenReceived) + { + if (iFSFxData) + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEffectsL - END: fx ready, state %d ", iFSFxData->State()); stream.Release(); return; } @@ -5034,43 +5106,43 @@ TBool applicationExists = FindControlGroupByFullScreenToEffect() != NULL ? ETrue : EFalse; // It may be, that application exited already and it was moved already to effect group - if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect && !applicationExists ) + if (iFSFxData->iEffectType == CFullScreenEffectState::EExitEffect && !applicationExists ) { applicationExists = FindLayoutByEffectHandle(fxData->iHandle) != NULL ? ETrue : EFalse; } TBool longAppStartTimeout = fxData->iLongAppStartTimeout; - if (iFullScreenEffectData && - !iSecondaryFullScreenEffectData && // second part has not been requested yet + if (iFSFxData && + !iFSFXDataPart2 && // second part has not been requested yet longAppStartTimeout && // this is indeed timeout for app start effect - iFullScreenEffectData->iTwoPhaseEffect == CFullScreenEffectState::EOnlyOnePart && // second part has not been activated. note, that iSecondaryFullScreenEffectData would be NULL in this case - (iFullScreenEffectData->State() == EWaitEndFullScreen - || iFullScreenEffectData->State() == EWaitingWindowGroup)) + iFSFxData->iTwoPhaseEffect == CFullScreenEffectState::EOnlyOnePart && // second part has not been activated. note, that iFSFXDataPart2 would be NULL in this case + (iFSFxData->State() == EWaitEndFullScreen + || iFSFxData->State() == EWaitingWindowGroup)) { // Load the whole structure. If timeout was triggered then request effect name to be // updated. UpdateSecondaryEffectL(*fxData); - iFullScreenEffectData->iLongAppStartTimeout = fxData->iLongAppStartTimeout; - iFullScreenEffectData->iTwoPhaseEffect = CFullScreenEffectState::EFirstPartActive; - iFullScreenEffectData->iOperation = MAlfGfxEffectPlugin::EEndFullscreen; - } - - __ALFFXLOGSTRING4("HandleGfxEffectsL - iTwoPhaseEffect %d, Setup done: %d, Timeout: %d, long app start timeout: %d", iFullScreenEffectData->iTwoPhaseEffect,iFullScreenEffectData->iSetupDone, timeout,longAppStartTimeout); + iFSFxData->iLongAppStartTimeout = fxData->iLongAppStartTimeout; + iFSFxData->iTwoPhaseEffect = CFullScreenEffectState::EFirstPartActive; + iFSFxData->iOperation = MAlfGfxEffectPlugin::EEndFullscreen; + } + + __ALFFXLOGSTRING4("HandleGfxEffectsL - iTwoPhaseEffect %d, Setup done: %d, Timeout: %d, long app start timeout: %d", iFSFxData->iTwoPhaseEffect,iFSFxData->iSetupDone, timeout,longAppStartTimeout); if (!fxData->iLongAppStartTimeout) // endfullscreen originating from the application { - if (iFullScreenEffectData->State() == EWaitingWindowGroup) - { - iFullScreenEffectData->SetState(EEndFullScreenReceivedWaitingWindowGroup); + if (iFSFxData->State() == EWaitingWindowGroup) + { + iFSFxData->SetState(EEndFullScreenReceivedWaitingWindowGroup); } else { - iFullScreenEffectData->SetState(EEndFullscreenReceived); + iFSFxData->SetState(EEndFullscreenReceived); } - if (iSecondaryFullScreenEffectData) - { - iSecondaryFullScreenEffectData->SetState(EEndFullscreenReceived); + if (iFSFXDataPart2) + { + iFSFXDataPart2->SetState(EEndFullscreenReceived); } } @@ -5080,12 +5152,12 @@ __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEffectsL - Regular timeout: %d, Slow start timeout: %d, Effect setup: %d, State: %d", timeout, longAppStartTimeout, - iFullScreenEffectData->iSetupDone, - iFullScreenEffectData->State()); + iFSFxData->iSetupDone, + iFSFxData->State()); stream.Release();// We should respect normal timeouts. - if (iFullScreenEffectData->iTwoPhaseEffect > CFullScreenEffectState::EOnlyOnePart - && iFullScreenEffectData->iSetupDone && timeout && longAppStartTimeout) // timeout = endfullscreen was requested or it was normal endfullscreen timeout, longAppStartTime = + if (iFSFxData->iTwoPhaseEffect > CFullScreenEffectState::EOnlyOnePart + && iFSFxData->iSetupDone && timeout && longAppStartTimeout) // timeout = endfullscreen was requested or it was normal endfullscreen timeout, longAppStartTime = { // If this is two phased effect, it can be started only by application request of endfullscreen (!timeout) // or screen drawn (triggered from @@ -5095,14 +5167,24 @@ // If client triggered EndFullScreen has been received, and still we haven't seen sign of the application, we know // things have gone wrong and will not go right. Clean up the mess. - if (iFullScreenEffectData->State() == EEndFullscreenReceived && !applicationExists && !timeout) + if (iFSFxData->State() == EEndFullscreenReceived && !applicationExists && !timeout) { HandleGfxStopEvent(ETrue); return; } - } - - CFullScreenEffectState* fxData = iFullScreenEffectData; + // If a long two part app start effect is ongoing or about to start, we can skip directly to the + // second part when EndFullScreen request arrives. + if (iFSFXDataPart2 && iFSFxData + && applicationExists + && iFSFXDataPart2->State() == EEndFullscreenReceived + && iFSFxData->iHandle == iFSFXDataPart2->iHandle ) + { + AlfGfxEffectEndCallBack(iFSFxData->iHandle); + return; + } + } + + CFullScreenEffectState* fxData = iFSFxData; fxData->iOperation = operation; __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); @@ -5141,7 +5223,7 @@ // We found layout, and this was beginfullscreen event. Wait for endfullscreen to be triggered if (fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen) { - iFullScreenEffectData->SetState(EWaitEndFullScreen); + iFSFxData->SetState(EWaitEndFullScreen); } } else @@ -5154,7 +5236,7 @@ if ( failed ) { // Effect failed, reset state - HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData + HandleGfxStopEvent( EFalse ); // destroys iFSFxData and iFSFXDataPart2 } else { @@ -5186,14 +5268,14 @@ if (aState.iLongAppStartTimeout) // only application start effects can trigger this timeout { // clone the primary startup effect for later usage - delete iSecondaryFullScreenEffectData; - iSecondaryFullScreenEffectData = new (ELeave) CFullScreenEffectState; - iSecondaryFullScreenEffectData->ConstructL(*iFullScreenEffectData); - iSecondaryFullScreenEffectData->iLongAppStartTimeout = EFalse; + delete iFSFXDataPart2; + iFSFXDataPart2 = new (ELeave) CFullScreenEffectState; + iFSFXDataPart2->ConstructL(*iFSFxData); + iFSFXDataPart2->iLongAppStartTimeout = EFalse; - delete iFullScreenEffectData->iEffectName; - iFullScreenEffectData->iEffectName = NULL; - iFullScreenEffectData->iEffectName = aState.iEffectName->AllocL(); + delete iFSFxData->iEffectName; + iFSFxData->iEffectName = NULL; + iFSFxData->iEffectName = aState.iEffectName->AllocL(); } __ALFFXLOGSTRING("CAlfBridge::UpdateSecondaryEffectL <<" ); return EFalse; @@ -5232,10 +5314,25 @@ } } - __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Covered: %d", fullscreenCovered); + __ALFFXLOGSTRING2("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - SecureId: 0x%x, Covered: %d", aToGroup->SecureId(), fullscreenCovered); if (fullscreenCovered) { - GfxTriggerEndFullScreen(iFullScreenEffectData); + if (iFSFxData->iTwoPhaseEffect == CFullScreenEffectState::EFirstPartRunning) + { + // effect has two parts, and the first one is ongoing. We'll skip to the second part. + delete iFSFxData; + iFSFxData = iFSFXDataPart2; + iFSFXDataPart2 = NULL; + iFSFxData->iTwoPhaseEffect = CFullScreenEffectState::ESecondPartActive; + // Client notified of the EndFullScreen during the effect. Trigger the end part immediately. + __ALFFXLOGSTRING("CAlfBridge::AlfGfxEffectEndCallBack - End was received. Trigger second part."); + GfxTriggerEndFullScreen(iFSFxData); + iFSFxData->SetState(EFinalEffectActive); + } + else + { + GfxTriggerEndFullScreen(iFSFxData); // trigger effect + } return ETrue; } return EFalse; @@ -5262,7 +5359,7 @@ // operation tells if this is abort full screen or something else // When this function is used to abort control transitions, all data is 0s - if ( iFullScreenEffectData ) + if ( iFSFxData ) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEffectsL - kill fullscreen"); HandleGfxStopEvent( ETrue ); @@ -5271,7 +5368,7 @@ if ( !toAppUi ) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEffectsL - kill all"); - RemoveAllTemporaryPresenterVisuals(); + CleanAllFxVisuals(); iHuiEnv->ContinueRefresh(); } __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEffectsL - end"); @@ -5294,7 +5391,7 @@ if (handle != KErrNotFound) { __ALFFXLOGSTRING1("CAlfBridge::HandleGfxStopControlEffectsL - Remove effect with handle: %d", handle); - RemoveTemporaryPresenterVisual(NULL, handle); + CleanFxVisual(NULL, handle); iHuiEnv->ContinueRefresh(); } __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopControlEffectsL - end"); @@ -5378,7 +5475,7 @@ } } -CHuiCanvasVisual* CAlfBridge::AddEffectItemL( +CHuiCanvasVisual* CAlfBridge::AddFxItemL( TInt aEffectHandle, CHuiVisual* aSourceVisual, CHuiLayout* aTargetLayout, @@ -5414,7 +5511,7 @@ // cleanup stack iEffectCleanupStack enableEffect = aSourceVisual->Flags() & EHuiVisualFlagShouldDestroy ? 0 : 1; __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - visual 0x%x is having effect. EShouldBeDestroyed flag state %d", &aSourceVisual, enableEffect ); - RemoveTemporaryPresenterVisual(aSourceVisual); + CleanFxVisual(aSourceVisual); if (!enableEffect) { aItemDestroyed++; @@ -5471,7 +5568,7 @@ __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x is having %d children", aSourceLayout, aSourceLayout->Count()); if (aAddLayout) { - AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsFullScreenEffect, aIsExitEffect, aCanDestroyOrHideImmediately); + AddFxItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsFullScreenEffect, aIsExitEffect, aCanDestroyOrHideImmediately); } for (TInt i = 0; i < aSourceLayout->Count(); i++) @@ -5484,7 +5581,7 @@ AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, aIsFullScreenEffect, EFalse, aIsExitEffect, aCanDestroyOrHideImmediately ); } TInt oldItemsDestroyed = aItemsDestroyed; - AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsFullScreenEffect, aIsExitEffect, aCanDestroyOrHideImmediately); + AddFxItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsFullScreenEffect, aIsExitEffect, aCanDestroyOrHideImmediately); if (oldItemsDestroyed != aItemsDestroyed) { // Visual was destroyed. If so, then we must adjust index. @@ -5496,7 +5593,7 @@ TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsFullScreenEffect, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately) { - __ALFFXLOGSTRING4("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d, CanDestroyOrHideImmediately: %d >>", + __ALFFXLOGSTRING4("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: %d, CanDstrOrHideImd.:%d >>", aHandle, aSourceLayout, aIsExitEffect, @@ -5519,13 +5616,13 @@ if (aIsExitEffect) { - CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsFullScreenEffect, aIsExitEffect, EFalse); + CHuiCanvasVisual* temporaryPresenterVisual = AddFxItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsFullScreenEffect, aIsExitEffect, EFalse); aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual); } else { - AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, aIsFullScreenEffect, EFalse, EFalse); + AddFxItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, aIsFullScreenEffect, EFalse, EFalse); __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout); } iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; @@ -5644,7 +5741,7 @@ { __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual); // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing - RemoveTemporaryPresenterVisual(aCanvasVisual); + CleanFxVisual(aCanvasVisual); } TBool layoutEffectable(EFalse); if (aEvent.iAction == KGfxControlDisappearAction) @@ -5698,13 +5795,13 @@ else { // visuals added to "active effect visual" stack, but they wont be used, because effect loading has failed. cleanup. - RemoveTemporaryPresenterVisual(NULL, aEvent.iHandle); + CleanFxVisual(NULL, aEvent.iHandle); } effect = NULL; // HuiVisual has taken ownership } } -TBool CAlfBridge::RemoveTemporaryPresenterItem(TEffectCleanupStruct& aEffectItem) +TBool CAlfBridge::CleanFxItem(TEffectCleanupStruct& aEffectItem) { CHuiVisual* sourceViz = aEffectItem.iEffectedVisual; CHuiCanvasVisual* sourceViz2 = dynamic_cast (aEffectItem.iEffectedVisual); @@ -5719,16 +5816,35 @@ sourceViz->ClearFlag(EHuiVisualFlagDrawOnlyAsExternalContent); TBool hideVisual = EFalse; TBool showVisual = ETrue; + // Effect request flow: + // 1. Effect request + // 2. If component is found, effect started immediately. + // If component is not found, effect request is cached and applied when window is created. + // NOTE: Only one effect request can be cached at time. Possible TODO, if this causes + // issues. + // 3. Possible change of component visibility (hide / show) + // 4. At the end of the effect the requested visiblity is applied to the visual (hidden / shown) + + // Exceptions 1: If it was disappear effect (aEffectItem.iHideWhenFinished is ETrue), the + // component is hidden. This is to guaranteen that e.g. options menu would not popup + // after disappear effect, if visual destruction / hiding request did not come in time. + // + // Exception 2: If disapper effect was requested, and component was requested to be hidden, + // and then component was requested to be visible DURING the effect, the + // component will be shown at the end of the effect. Use case: the same component shows + // two sequentive notes and each note dismissal has disappear effect and no appear + // effect between. if(!aEffectItem.iIsFullScreenEffect) { - hideVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeHidden) || aEffectItem.iHideWhenFinished; - showVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeShown) && !aEffectItem.iHideWhenFinished; + hideVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeHidden) || (aEffectItem.iHideWhenFinished && !(sourceViz->Flags() & EHuiVisualFlagShouldBeShown)); + showVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeShown) && (!aEffectItem.iHideWhenFinished || !hideVisual); } else { hideVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeHidden); showVisual = (sourceViz->Flags() & EHuiVisualFlagShouldBeShown); } + __ALFFXLOGSTRING4("CAlfBridge::RemoveTemporaryPresenterItem - iIsFullScreenEffect: %d, iHideWhenFinished: %d, Hide: %d, Show: %d", aEffectItem.iIsFullScreenEffect, aEffectItem.iHideWhenFinished, hideVisual, showVisual); TBool destroyVisual = sourceViz->Flags() & EHuiVisualFlagShouldDestroy; TBool shouldInactivate = sourceViz->Flags() & EHuiVisualFlagShouldBeInactive; TBool shouldBeUnderOpaqueHint = sourceViz->Flags() & EHuiVisualFlagShouldBeUnderOpaqueHint; @@ -5832,8 +5948,8 @@ return TBool(destroyVisual); } -// RemoveTemporaryPresenterVisual removes the temporary presenter visual, and unbinds it from the source. -TBool CAlfBridge::RemoveTemporaryPresenterVisual(CHuiVisual* aVisual, +// CleanFxVisual removes the temporary presenter visual, and unbinds it from the source. +TBool CAlfBridge::CleanFxVisual(CHuiVisual* aVisual, TInt aHandle) { __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisual - cleaning handle: %d, 0x%x", aHandle, aVisual); @@ -5844,7 +5960,7 @@ if (aVisual == effectItem.iEffectedVisual || aHandle == effectItem.iHandle) { - if (RemoveTemporaryPresenterItem(effectItem)) + if (CleanFxItem(effectItem)) { visualsRemoved++; } @@ -5923,7 +6039,7 @@ } -TBool CAlfBridge::RemoveTemporaryPresenterVisuals() +TBool CAlfBridge::CleanFxVisuals() { if (!iFinishedCleanupStackEffects.Count()) { @@ -5943,7 +6059,7 @@ if (iFinishedCleanupStackEffects[0] == effectItem.iHandle) { - if (RemoveTemporaryPresenterItem(effectItem)) + if (CleanFxItem(effectItem)) { itemsRemoved++; } @@ -5969,7 +6085,7 @@ return itemsRemoved; } -void CAlfBridge::RemoveAllTemporaryPresenterVisuals() +void CAlfBridge::CleanAllFxVisuals() { CHuiControl& effectControlGroup = iAlfScreens[0]->iFullscreenEffectControlGroup->Control(0); CHuiLayout* effectControlGroupLayout = (CHuiLayout*) &effectControlGroup.Visual(0); @@ -5978,7 +6094,7 @@ while(iEffectCleanupStack.Count()) { TEffectCleanupStruct& effectItem = iEffectCleanupStack[0]; - RemoveTemporaryPresenterItem(effectItem); + CleanFxItem(effectItem); iEffectCleanupStack.Remove(0); } @@ -6004,30 +6120,29 @@ // iFinishedCleanupStackEffects.Append(aHandle); // check if the first part of application start effect finished - if (iFullScreenEffectData - && iFullScreenEffectData->iHandle == aHandle - && iFullScreenEffectData->iLongAppStartTimeout && iSecondaryFullScreenEffectData) - { - delete iFullScreenEffectData; - iFullScreenEffectData = iSecondaryFullScreenEffectData; - iSecondaryFullScreenEffectData = NULL; - iFullScreenEffectData->iTwoPhaseEffect = CFullScreenEffectState::ESecondPartActive; - if (iFullScreenEffectData->State() == EEndFullscreenReceived) + if (iFSFxData + && iFSFxData->iHandle == aHandle + && iFSFxData->iLongAppStartTimeout && iFSFXDataPart2) + { + delete iFSFxData; + iFSFxData = iFSFXDataPart2; + iFSFXDataPart2 = NULL; + iFSFxData->iTwoPhaseEffect = CFullScreenEffectState::ESecondPartActive; + if (iFSFxData->State() == EEndFullscreenReceived) { // Client notified of the EndFullScreen during the effect. Trigger the end part immediately. __ALFFXLOGSTRING("CAlfBridge::AlfGfxEffectEndCallBack - End was received. Trigger second part."); - iFullScreenEffectData->SetState(ESecondPhaseSetupActive); // effect setup will be skipped in HandleGfxEvent - GfxTriggerEndFullScreen(iFullScreenEffectData); - iFullScreenEffectData->SetState(EFinalEffectActive); + GfxTriggerEndFullScreen(iFSFxData); + iFSFxData->SetState(EFinalEffectActive); // skip cleanup. It will be run, when this effect finishes return; } else { - iFullScreenEffectData->SetState(EWaitEndFullScreen); + iFSFxData->SetState(EWaitEndFullScreen); } - iFullScreenEffectData->iEffectType = CFullScreenEffectState::EStartEffect; + iFSFxData->iEffectType = CFullScreenEffectState::EStartEffect; CHuiControlGroup* toGroup = FindControlGroupByFullScreenToEffect(); GfxTriggerEffectWhenFullScreenDrawn(toGroup); @@ -6068,21 +6183,21 @@ __ALFFXLOGSTRING("invalid handle"); } // alftranstion plugin may cancel end timers connected to this effect - TBool fsEffectDone = iFullScreenEffectData && aHandle == iFullScreenEffectData->iHandle; + TBool fsEffectDone = iFSFxData && aHandle == iFSFxData->iHandle; if ( fsEffectDone ) { - aHandle = iFullScreenEffectData->iCompletionHandle; + aHandle = iFSFxData->iCompletionHandle; } RProperty::Set( KPSAlfDomain, KAlfTransitionStatus, aHandle ); // Effect finished if ( fsEffectDone ) { - delete iFullScreenEffectData; - iFullScreenEffectData = NULL; + delete iFSFxData; + iFSFxData = NULL; - delete iSecondaryFullScreenEffectData; - iSecondaryFullScreenEffectData = NULL; + delete iFSFXDataPart2; + iFSFXDataPart2 = NULL; } } @@ -6754,69 +6869,68 @@ return (aVisual.Owner().ControlGroup()->ResourceId() == iAlfWindowGroupNodeId); } -// experimental -TBool CAlfBridge::IsFullScreenDrawn( TInt aOrientation) - { + +// --------------------------------------------------------------------------- +// Checks if layout switch is ready. The aDuration parameter is the duration +// since layout switch started. So this allows heuristics to loosen as there +// may be applications that do not behave as expected. aDuration is meant +// to be given in units of 50ms. +// --------------------------------------------------------------------------- +// +TBool CAlfBridge::IsLayoutSwitchReady( TInt aDuration ) + { + TBool visualTreeReady = ETrue; + if (!iAlfScreens.Count()) return EFalse; - aOrientation = iAlfScreens[0]->iDisplay->Orientation(); + iTempRegion.Clear(); + iTempRegion2.Clear(); CAlfScreen* screen = iAlfScreens[0]; TRect fullscreen = TRect(TPoint(0,0), screen->Size()); - __ALFFXLOGSTRING3("CAlfBridge::IsFullScreenDrawn - new orientation %d, screen size: (%d,%d)", aOrientation, fullscreen.iBr.iX, fullscreen.iBr.iY ); + TInt orientation = screen->iDisplay->Orientation(); + + __ALFLOGSTRING2("CAlfBridge::IsLayoutSwitchReady begin o:%d d:%d", orientation, aDuration); + TBool fullscreenCovered = EFalse; - - // Check if effect group has an effect with opaque hint. - CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); - CHuiControl& fxcontrol = fxcontrolgroup.Control(0); - CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); - CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); - - if (fxlayout && IsOpaqueEffect(fxlayout->Effect())) - { - fullscreenCovered = ETrue; - } - else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect())) - { - fullscreenCovered = ETrue; - } - - TBool alfClientWindowGroupVisible = EFalse; - - AMT_SET_VALUE( iVisibleVisualCount, 0 ); - - // skip the topmost (effect) layer, start from floating sprite group + TBool alfClientWindowGroupVisible = EFalse; + + TInt coverageModifiedGroupCount = 0; + + // Skip the topmost (effect) layer, start from floating sprite group for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) { - CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); + CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j); CHuiControl& control = controlgroup.Control(0); - __ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", controlgroup.SecureId()); - - + if (control.Role() == EHuiFpsIndicatorContainer) { // FPS container doesn't contain canvas visuals continue; } + if (controlgroup.ResourceId() == iAlfWindowGroupNodeId) + { + // ALF window doesn't have drawing and it's meant to be completely semitransparent, + // so skip. + continue; + } + CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); - + // For optimization reasons, check if all visuals below in Z-order are covered if (!fullscreenCovered) { - fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); - if(fullscreenCovered) - { - return ETrue; - } - for(TInt ii=0;ii< iTempRegion.Count(); ii++) - { - __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawn (%d,%d)-(%d,%d)", iTempRegion[ii].iTl.iX, iTempRegion[ii].iTl.iY , iTempRegion[ii].iBr.iX, iTempRegion[ii].iBr.iY ); - } - } + fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); + } + + if (fullscreenCovered) + { + break; + } - // Dont mess with alf control group visuals, alf session handling does it for us + // ALF applications are handled by checking if their visuals cover the whole screen. if (control.Role() == EHuiSessionContainer) { CHuiLayout* hostContainer = control.ContainerLayout( NULL ); @@ -6845,29 +6959,296 @@ continue; } - __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered) - TBool subTreeCovered = EFalse; - TBool hasActiveVisualsInVisualTree = - IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, IsVisualOpaque(*layout), aOrientation ); - // If root visuals effect is marked as opaque, then add whole screen area as covered. - /* - if (!fullscreenCovered) - { - fullscreenCovered = IsOpaqueEffect(layout->Effect()); - } - */ - - if(controlgroup.iAlfApp && layout->iOpacity.Now() > 0.0f ) + TBool hasActiveVisualsInVisualTree(EFalse); + TBool coverageRegionModified(EFalse); + + if (alfClientWindowGroupVisible && (controlgroup.ResourceId() == iAlfWindowGroupNodeId)) + { + visualTreeReady = + IsLayoutSwitchReadyRecursive( layout, controlgroup, control, + hasActiveVisualsInVisualTree, fullscreen, screen, + IsVisualOpaque(*layout), alfClientWindowGroupVisible, + orientation, aDuration, coverageRegionModified ); + } + else + { + visualTreeReady = + IsLayoutSwitchReadyRecursive( layout, controlgroup, control, + fullscreenCovered, fullscreen, screen, + IsVisualOpaque(*layout), EFalse, orientation, + aDuration, coverageRegionModified ); + } + + if (!visualTreeReady) + { + // Problem found in IsLayoutSwitchReadyRecursive + visualTreeReady = EFalse; + break; + } + + if (coverageRegionModified) + { + coverageModifiedGroupCount++; + } + + // Heuristic: If coverage region is modified by multiple apps, then it's possible that + // foreground application hasn't had time to update its layout. So give little time to do that. + if (aDuration <= KAlfCheckCoverageFromMultipleGroups && coverageRegionModified > 1) + { + __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - multiple groups"); + visualTreeReady = EFalse; + break; + } + + if( controlgroup.iAlfApp && layout->iOpacity.Now() > 0.0f ) { alfClientWindowGroupVisible = ETrue; } + } + + __ALFLOGSTRING2("CAlfBridge::IsLayoutSwitchReady done %d (groups %d)", visualTreeReady, coverageModifiedGroupCount); + iTempRegion2.Clear(); + + // Heuristic: Check that visual drawing covers the whole screen. + if ( visualTreeReady && ( aDuration <= KAlfCheckFullscreenCoveredByVisualDrawing ) ) + { + if ( !IsRectCoveredByRegion( fullscreen, iTempRegion ) ) + { + __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - screen not covered"); + visualTreeReady = EFalse; + } + } + + return visualTreeReady; + } + + +// --------------------------------------------------------------------------- +// Checks if rect is inside fullscreen area. +// --------------------------------------------------------------------------- +// +static TBool CheckVisualRect(const TRect aRect, const TRect& aFullScreen) + { + if (aRect.IsEmpty()) + { + return EFalse; + } + + if (!aFullScreen.Contains(aRect.iTl)) + { + return EFalse; + } + + TPoint br = aRect.iBr; + br.iX--; + br.iY--; + if (!aFullScreen.Contains(br)) + { + return EFalse; + } + + return ETrue; + } + + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TBool CAlfBridge::IsLayoutSwitchReadyRecursive( + CHuiLayout* aLayout, + CHuiControlGroup& aControlGroup, + CHuiControl& aControl, + TBool& aFullscreenCovered, + const TRect& aFullscreen, + CAlfScreen* aScreen, + TBool aChildCanBeOpaque, + TBool aOnlyForEmbeddedAlfApp, + TInt aOrientation, + TInt aDuration, + TBool& aCoverageRegionModified ) + { + TBool visualTreeReady = ETrue; + TRect visualDisplayRect; + TBool visualRectIsCovered = EFalse; + TBool visualIsOpaque = EFalse; + TBool visualIsActive = EFalse; + CHuiCanvasVisual* canvasVisual = NULL; + + for (TInt i = aLayout->Count() - 1; i >= 0; i--) + { + visualDisplayRect = TRect(0,0,0,0); + visualRectIsCovered = EFalse; + visualIsOpaque = EFalse; + visualIsActive = EFalse; - if (fullscreenCovered) - { - return ETrue; - } - } - return fullscreenCovered; + canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); + + // Distraction windows are completely ignored. + TBool distractionWindow = (canvasVisual->CanvasFlags() & EHuiCanvasFlagDistractionWindow); + if ( distractionWindow ) + { + continue; + } + + visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); + TBool visualIsVisible = (canvasVisual->iOpacity.Now() > 0.01f); + + if (canvasVisual->Count() && visualIsVisible) + { + TBool ready = IsLayoutSwitchReadyRecursive( canvasVisual, aControlGroup, aControl, + aFullscreenCovered, aFullscreen, aScreen, + visualIsOpaque, EFalse, aOrientation, + aDuration, aCoverageRegionModified ); + + if (!ready) + { + visualTreeReady = EFalse; + break; + } + } + + // Calculate visual display rect + visualDisplayRect = canvasVisual->DisplayRect(); + + ClipVisualRect(visualDisplayRect, aLayout->DisplayRect()); + ClipVisualRect(visualDisplayRect, aFullscreen); + + // Check if covered. + if (aFullscreenCovered) + { + visualRectIsCovered = ETrue; + } + else + { + // Check if this visual is covered by other opaque visuals which rects are in "covered" region + // it should not check for alf event window group, when we have embedded alf application, + // because we have assumed that alf app will have full screen covered + if(!aOnlyForEmbeddedAlfApp) + { + visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); + } + } + + // Heuristic: Check that visual display rect is ok (not empty, inside screen) + if ( aDuration <= KAlfCheckVisualDisplayRect && !visualRectIsCovered && + !CheckVisualRect(visualDisplayRect, aFullscreen) ) + { + __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - display rect not ok"); + visualTreeReady = EFalse; + break; + } + + // Determine if visual is active from coverage point of view. + visualIsActive = EFalse; + if (visualRectIsCovered) + { + if (!(canvasVisual->Flags() & EHuiVisualFlagAlwaysDraw)) + { + visualIsActive = EFalse; + } + else + { + visualIsActive = ETrue; + } + } + else + { + visualIsActive = ETrue; + } + + // Sprites and effects as we consider them always as transparent and also + // if controlgroup is transformed somehow + if (aControl.Role() == EHuiFullScreenEffectContainer || + aControl.Role() == EHuiWindowFloatingSpriteContainer || + aControlGroup.IsTransformed()) + { + visualIsOpaque = EFalse; + } + + // Check that command buffers are ok. + if ( visualIsActive ) + { + TRect displayRect = visualDisplayRect; + visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); + + // Heuristic: Check that visual drawing isn't completely empty. + if ( aDuration <= KAlfCheckVisualDrawingNotEmpty && !visualRectIsCovered && + visualIsVisible && visualDisplayRect.IsEmpty() ) + { + __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - no drawing"); + visualTreeReady = EFalse; + break; + } + + // Heuristic: Check that visual drawing isn't outside the screen. + if ( aDuration <= KAlfCheckVisualDrawRect && !visualRectIsCovered && + visualIsVisible && !CheckVisualRect(visualDisplayRect, aFullscreen) ) + { + __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - bad drawing"); + visualTreeReady = EFalse; + break; + } + + // Heuristic: Check that visual drawing is complete. + if ( aDuration <= KAlfCheckVisualDrawingComplete && !visualRectIsCovered && + visualIsVisible && displayRect != visualDisplayRect ) + { + __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - incomplete drawing"); + visualTreeReady = EFalse; + break; + } + + // Make sure we clip visual rect to visible screen area + ClipVisualRect(visualDisplayRect, aFullscreen); + + // Heuristic: Union of opaque visual drawing regions should cover the whole screen. + // Note - coverage is checked at the end of IsLayoutSwitchReady. + if (visualIsOpaque && visualIsVisible && !visualRectIsCovered) + { + iTempRegion2.AddRect( visualDisplayRect ); + iTempRegion2.Tidy(); + } + } + + if (visualIsActive && visualIsOpaque && !visualRectIsCovered) + { + // New visibility system takes only window shape into account. + if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) + { + if ( !canvasVisual->HasCustomShape() ) + { + aCoverageRegionModified = ETrue; + + TRect displayRect(canvasVisual->DisplayRect()); + ClipVisualRect(displayRect, aLayout->DisplayRect()); + ClipVisualRect(displayRect, aFullscreen); + + iTempRegion.AddRect(displayRect); + iTempRegion.Tidy(); + } + else + { + aCoverageRegionModified = ETrue; + + TRect displayRect = canvasVisual->DisplayRect(); + const TRegion& region = canvasVisual->ShapeRegion(); + TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl; + + for (TInt i = 0; i < region.Count(); ++i) + { + TRect coveredRect(region[i]); + coveredRect.Move(delta); + ClipVisualRect(coveredRect, aFullscreen); + + iTempRegion.AddRect(coveredRect); + } + iTempRegion.Tidy(); + } + } + } + } // for loop end : children checking loop + + return visualTreeReady; } TBool CAlfBridge::IsFullScreenDrawnRecursiveAlfContent(CHuiVisual* aVisual, TRect& aFullScreen) @@ -7069,6 +7450,7 @@ { iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests; iHuiEnv->Synchronize( iIdForLayoutSwitchFrameSync, this ); + AsynchRefresh(); // In SW mode, device is in manual refresh mode - enforce refresh in order to get synchronize done. } } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -20,7 +20,13 @@ #include #include +// Delay after which first end check is performed. const TInt KRosterFreezeEndTimeoutInMs = 100; +// Interval between end checks. +const TInt KRosterFreezeEndIntervalInMs = 50; +// Maximum amount of end checks to be performed. +// This can be lower, should be visible enough to see, if heuristics fail. +const TInt KRosterFreezeEndAttempts = 50; // --------------------------------------------------------- // CAlfRosterFreezeEndTimer @@ -59,6 +65,7 @@ if (!IsActive()) { iSafeCounter = 0; + iSafeCounterDelta = Min(1, aPeriod.Int() / (KRosterFreezeEndIntervalInMs*1000)); After( aPeriod ); } } @@ -71,22 +78,24 @@ if (iSafeCounter >= 0) { - iSafeCounter++; - if (iSafeCounter == 100) // can be lower, 100 should be visible enough to see, if heuristics fail + iSafeCounter += iSafeCounterDelta; + if (iSafeCounter >= KRosterFreezeEndAttempts) { timeout = ETrue; iSafeCounter = 0; } } - if (!iBridge.IsFullScreenDrawn(0) && !timeout) + if (!iBridge.IsLayoutSwitchReady(iSafeCounter) && !timeout) { __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Not ready in new orientation. waiting 50ms more"); - After( 50000 ); + iSafeCounterDelta = 1; + After( KRosterFreezeEndIntervalInMs * 1000 ); return; } else { + __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Ready in new orientation."); iCallBack.CallBack(); } } @@ -168,16 +177,18 @@ // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. // // From EStateFreezeFx: - // - EEventBlankOn: EStateBlankFx // - implicit Finish - EStateIdle // // From EStateBlankFx: // - EEventBlankOff: EStateFreezeFx (we use freeze to ensure that result is ok) - // - EEventLayoutSwitch: If effect available, EStateThemeFx. + // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. // // From EStateThemeFx: // - EEventLowMemory: If blank still on, EStateBlankFx. Otherwise EStateFreezeFx. // - implicit Finish - EStateIdle + // + // There is special handling if layout switch event is received while previous + // layout switch is ongoing. TState nextState = EStateIdle; @@ -205,6 +216,69 @@ { Transition( nextState, iCurrentState ); } + else + { + // We stay in the same state, but still need special handling in a couple of scenarios + if ( nextState == EStateFreezeFx ) + { + HandleFreezeEvent( aEvent ); + } + if ( nextState == EStateThemeFx ) + { + HandleThemeEvent( aEvent ); + } + } + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent +// Special handling for Freeze effect. +// --------------------------------------------------------- +// +void CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent(TEvent aEvent) + { + if ( aEvent == EEventLayoutSwitch && iRosterFreezeEndTimer && iRosterFreezeEndTimer->IsActive() ) + { + // New layout switch while previous is ongoing => restart freeze end timer. + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent restart timer"); + iRosterFreezeEndTimer->Cancel(); + iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); + } + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::HandleFreezeEvent +// Special handling for Theme effect. +// --------------------------------------------------------- +// +void CAlfLayoutSwitchEffectCoordinator::HandleThemeEvent(TEvent aEvent) + { + if ( aEvent == EEventLayoutSwitch ) + { + // If layout switch occurs while freeze end timer is ongoing, restart. + if ( iRosterFreezeEndTimer && iRosterFreezeEndTimer->IsActive() ) + { + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::HandleThemeEvent restart timer"); + iRosterFreezeEndTimer->Cancel(); + iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoNextLayoutSwitchContext, this)); + } + + // If layout switch occurs while theme effect is ongoing in exit phase, restart. + if ( iLayoutSwitchEffectContext == AknTransEffect::ELayoutSwitchExit ) + { + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::HandleThemeEvent restart themefx"); + TBool oldLayoutSwitchNotCompleted = iLayoutSwitchNotCompleted; + iLayoutSwitchNotCompleted = EFalse; + + Transition( EStateIdle, iCurrentState ); + Transition( EStateThemeFx, iCurrentState ); + + if (oldLayoutSwitchNotCompleted) + { + iLayoutSwitchNotCompleted = ETrue; + } + } + } } // --------------------------------------------------------- @@ -214,7 +288,7 @@ void CAlfLayoutSwitchEffectCoordinator::Transition( TState aNewState, TState aPreviousState) { - __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aNewState, aPreviousState); + __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aPreviousState, aNewState); iCurrentState = aNewState; // Undo previous state - don't unfreeze roster. @@ -269,7 +343,7 @@ // Remove all other effects iBridge.HandleGfxStopEvent( EFalse ); - iBridge.RemoveAllTemporaryPresenterVisuals(); + iBridge.CleanAllFxVisuals(); // Set remove freeze timer __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition - Freeze timer started"); @@ -299,7 +373,7 @@ // Remove all other effects iBridge.HandleGfxStopEvent( EFalse ); - iBridge.RemoveAllTemporaryPresenterVisuals(); + iBridge.CleanAllFxVisuals(); // Set first layout switch effect SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart); @@ -324,6 +398,7 @@ FreezeRoster(EFalse); iBridge.iHuiEnv->Display(0).SetDirty(); iBridge.SetVisualTreeVisibilityChanged(ETrue); + iBridge.AsynchRefresh(); } break; } @@ -394,9 +469,6 @@ switch ( aEvent ) { case EEventBlankOn: - state = EStateBlankFx; - break; - case EEventLayoutSwitch: case EEventBlankOff: case EEventLowMemory: @@ -424,6 +496,10 @@ { state = EStateThemeFx; } + else + { + state = EStateFreezeFx; + } break; case EEventBlankOff: @@ -592,7 +668,8 @@ // --------------------------------------------------------- // // todo: rename -TInt DoNextLayoutSwitchContext(TAny* aLayoutSwitchCoordinator) +TInt CAlfLayoutSwitchEffectCoordinator::DoNextLayoutSwitchContext( + TAny* aLayoutSwitchCoordinator) { CAlfLayoutSwitchEffectCoordinator* coordinator = (CAlfLayoutSwitchEffectCoordinator*)aLayoutSwitchCoordinator; coordinator->AlfGfxEffectEndCallBack(KErrNotFound); @@ -803,13 +880,6 @@ CFullScreenEffectState::~CFullScreenEffectState() { - iPaintedRegion.Close(); - if (iDrawingCompleteTimer) - { - iDrawingCompleteTimer->Cancel(); - delete iDrawingCompleteTimer; - iDrawingCompleteTimer = NULL; - } } void CFullScreenEffectState::ConstructL(const CFullScreenEffectState& aEffectState) @@ -872,6 +942,7 @@ { if (aState >= iState) { + __ALFFXLOGSTRING2("CFullScreenEffectState::SetState - Set %d -> %d", iState, aState); iState = aState; } else @@ -882,6 +953,7 @@ TEffectState CFullScreenEffectState::State() { + __ALFFXLOGSTRING1("CFullScreenEffectState::State - %d", iState); return iState; } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -803,14 +803,7 @@ } #endif - AMT_INC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeCount ); - AMT_INC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeGroup), iWindowGroupNodeCount ); - AMT_INC_COUNTER_IF(node, iTotalNodeCount ); - - AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, - iIntMap, node->iId, EAlfModuleTestTypeHierarchyModelCreateWindow ); - AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeGroup, - iIntMap, node->iId, EAlfModuleTestTypeHierarchyModelCreateWindowGroup ); + AMT_MAP_NODE_CREATED(); } // --------------------------------------------------------------------------- @@ -841,14 +834,7 @@ USER_INVARIANT(); } - AMT_DEC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeCount ); - AMT_DEC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeGroup), iWindowGroupNodeCount ); - AMT_DEC_COUNTER_IF(node, iTotalNodeCount ); - - AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, - iIntMap, nodeId, EAlfModuleTestTypeHierarchyModelReleaseWindow ); - AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeGroup, - iIntMap, nodeId, EAlfModuleTestTypeHierarchyModelReleaseWindowGroup ); + AMT_MAP_NODE_RELEASED(); } // --------------------------------------------------------------------------- @@ -868,12 +854,8 @@ { USER_INVARIANT(); } - - AMT_INC_COUNTER_IF( node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeActivatedCount ); - - AMT_MAP_SET_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, - iBoolMap, nodeId, ETrue, - EAlfModuleTestTypeHierarchyModelActiveWindow ); + + AMT_MAP_NODE_ACTIVATED(); } // --------------------------------------------------------------------------- @@ -904,14 +886,7 @@ } #endif - AMT_INC_COUNTER_IF(node, iNodeExtentChangedCount ); - AMT_SET_VALUE_IF(node, iLatestNodeExtentRect, rect ); - AMT_MAP_SET_VALUE_IF( node && node->iWindow, - iSizeMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, - rect.Size(), EAlfModuleTestTypeHierarchyModelChangeWindowSize ); - AMT_MAP_SET_VALUE_IF( node && node->iWindow, - iPositionMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, - rect.iTl, EAlfModuleTestTypeHierarchyModelChangeWindowPosition ); + AMT_MAP_NODE_EXTENT_CHANGED(); } // --------------------------------------------------------------------------- @@ -972,12 +947,7 @@ USER_INVARIANT(); } - AMT_INC_COUNTER_IF(node, iTotalNodeFlagChangedCount ); - AMT_MAP_SET_VALUE_IF( node && node->iWindow && MWsWindowTreeObserver::EVisible == flag, - iBoolMap, - node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, - newValue, - EAlfModuleTestTypeHierarchyModelChangeWindowVisibility ); + AMT_MAP_NODE_FLAG_CHANGED(); } // --------------------------------------------------------------------------- diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -739,7 +739,7 @@ for ( TInt i = 0; i +#include +#include + +NONSHARABLE_STRUCT(TRasterizedBitmap) + { + TRasterizedBitmap(TInt64 aBitmapSerial, CFbsBitmap* aBitmap) : iBitmapSerial(aBitmapSerial), iBitmap(aBitmap) + { + } + TRasterizedBitmap() : iBitmapSerial(0), iBitmap(NULL) {} + TInt64 iBitmapSerial; + CFbsBitmap* iBitmap; + }; + + +NONSHARABLE_CLASS(CAppIconCache) : public CBase + { + public: + static CAppIconCache* NewL(TInt aCacheLimit); + virtual ~CAppIconCache(); + + IMPORT_C CFbsBitmap* Find(TInt64 aSerialNumber, TSize aSize); + IMPORT_C TInt Insert(TRasterizedBitmap& aBitmap); + IMPORT_C void Clear(); + + protected: + CAppIconCache(TInt aCacheLimit); + void ConstructL(); + + private: + RArray iCache; + TInt iCacheLimit; + }; + + + +#endif diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/inc/huicanvasdebugwsgc.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvasdebugwsgc.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvasdebugwsgc.h Mon Jun 21 16:41:52 2010 +0300 @@ -116,6 +116,8 @@ // Canvas functionality virtual void BeginActionL(TInt aAction, TRect aDisplayRect,const CHuiCanvasVisual& aUser, TBool aIsCachePrepared, const TRegion& aUpdateRegion); + virtual void EnableUpdateRegion(const TRegion& aUpdateRegion, TBool aClear); + virtual void DisableUpdateRegion(); virtual void EndActionL(const TRegion& aUpdateRegion, TBool aUpdateDisplay); virtual TInt SetCapturingBufferL(CFbsBitmap* aTarget); virtual CHuiCanvasGc& CanvasGc() const; @@ -131,13 +133,14 @@ virtual THuiCanvasWsGcType Type() const; - virtual void EnableUpdateRegion(const TRegion& aUpdateRegion, TBool aClear); - virtual void DisableUpdateRegion(); + virtual void ClearCapturingBufferArea(const TRect& aRect); ~CHuiCanvasDebugWsGc(); static CHuiCanvasDebugWsGc* NewL( CHuiCanvasWsGc* aHuiCanvasGc, CAlfCommandDebug& aCommandDebugger ); + void SetInternalGc(CHuiCanvasWsGc* aHuiCanvasGc); + private: CHuiCanvasDebugWsGc( CAlfCommandDebug& aCommandDebugger ); @@ -146,8 +149,8 @@ private: - CHuiCanvasWsGc* iCanvasWsGc; - CAlfCommandDebug& iCommandDebugger; + CHuiCanvasWsGc* iCanvasWsGc; // not owned + CAlfCommandDebug& iCommandDebugger; // not owned }; #endif // __HUICANVASDEBUGWSGC_H__ diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h Mon Jun 21 16:41:52 2010 +0300 @@ -36,6 +36,10 @@ class CHuiCanvasWsHwGc; class CAlfCommandDebug; class CHuiCanvasWsBitGc; +#ifdef HUI_DEBUG_TRACK_DRAWING +class CHuiCanvasDebugWsGc; +#endif + /** * This class is used internally by the toolkit and thus should @@ -391,7 +395,7 @@ mutable RRegionBuf iTempIntersectingRegion; #ifdef HUI_DEBUG_TRACK_DRAWING - CAlfCommandDebug* iCommandDebugger; + CHuiCanvasDebugWsGc* iCanvasDebugWsGc; #endif // Boolean flag indicating if render buffer ought to be used. diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/inc/huistatictlsdata.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huistatictlsdata.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huistatictlsdata.h Mon Jun 21 16:41:52 2010 +0300 @@ -35,6 +35,12 @@ class TFakeProbe; class CAppFwProxy; +#ifdef HUI_DEBUG_TRACK_DRAWING +class CAlfCommandDebug; + #ifndef __WINSCW__ +extern TTlsData globalWriteableData; + #endif +#endif /** * Thread local storage space. Writable static data is not supported in * Symbian, so static data is stored in this struct. @@ -123,6 +129,10 @@ CAlfModuleTestDataControl* iAlfModuleTestDataControl; #endif +#ifdef HUI_DEBUG_TRACK_DRAWING + CAlfCommandDebug* iCommandDebugger; +#endif + CWsScreenDevice* WsScreenDevice(TInt aScreenNumber) { if (aScreenNumber < iScreenDevices.Count()) @@ -232,6 +242,20 @@ iAlfModuleTestDataControl = NULL; #endif } + +#ifdef HUI_DEBUG_TRACK_DRAWING + static CAlfCommandDebug* CommandDebugger() + { + #ifndef __WINSCW__ + TTlsData* data = &globalWriteableData; + #else + TTlsData* data = static_cast(Dll::Tls()); + #endif + + return data->iCommandDebugger; + } +#endif + }; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Texture.h --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Texture.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Texture.h Mon Jun 21 16:41:52 2010 +0300 @@ -160,7 +160,7 @@ * @param aDestSize Destination size for the VGImage * @return Handle to the rasterized image or VG_INVALID_HANDLE if something went wrong. */ - VGImage CreateRenderedImage(CNvgEngine* aNvgEngine, HBufC8* aNVGData, const TSize& aDestSize); + VGImage CreateRenderedImage(CNvgEngine* aNvgEngine, HBufC8* aNVGData, const TSize& aDestSize, TInt64 aSerialNumber = 0); /** * Identifies whether this texture contains extended texture data diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -29,6 +29,7 @@ #include "uiacceltk/HuiTextureProcessor.h" #include "uiacceltk/HuiUtil.h" #include "uiacceltk/HuiPanic.h" +#include "appiconcache.h" #include "huiextension.h" @@ -1155,7 +1156,7 @@ // Create the real image from NVG databuf iNVGData = dataBuf; - image = CreateRenderedImage(&nvgEngine, dataBuf, Size()); + image = CreateRenderedImage(&nvgEngine, dataBuf, Size(),aBitmap.SerialNumber()); // New functionality for checking the mask if (header.GetBitmapId() != maskHeader.GetBitmapId() && maskDataBuf && @@ -1210,7 +1211,9 @@ return returnValue; } -VGImage CHuiVg10Texture::CreateRenderedImage(CNvgEngine* aNvgEngine, HBufC8* aNVGData, const TSize& aDestSize) + + +VGImage CHuiVg10Texture::CreateRenderedImage(CNvgEngine* aNvgEngine, HBufC8* aNVGData, const TSize& aDestSize, TInt64 aSerialNumber) { HUI_VG_INVARIANT(); @@ -1339,23 +1342,41 @@ // drawn icons would show correctly, and no issues with transparency would arise) VGint blendMode = vgGeti(VG_BLEND_MODE); vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); - if (iIconCommands) + TAknIconHeader iconheader = GetNvgIconHeader(aNVGData); + TBool direct = EFalse; + if (iconheader.IsMarginCorrection() && aSerialNumber) { - //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing iIconCommands")); - iIconCommands->Draw(aDestSize, aNvgEngine); + CFbsBitmap* entry = CHuiStatic::Env().AppIconCache().Find(aSerialNumber, aDestSize); + if (entry) + { + TSize entrySize = entry->SizeInPixels(); + entry->BeginDataAccess(); + TUint8* dataPtr = (TUint8*)entry->DataAddress(); + vgImageSubData(image, dataPtr, CFbsBitmap::ScanLineLength(entrySize.iWidth, EColor16MAP), VG_sARGB_8888_PRE, 0, 0, entrySize.iWidth, entrySize.iHeight); + entry->EndDataAccess(); + direct = ETrue; + } } - else + + if (!direct) { - // If ObjectCached version failed, try to use the old way - //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing with DrawNvg")); - aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), aDestSize, NULL, NULL); + if (iIconCommands) + { + //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing iIconCommands")); + iIconCommands->Draw(aDestSize, aNvgEngine); + } + else + { + // If ObjectCached version failed, try to use the old way + //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing with DrawNvg")); + aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), aDestSize, NULL, NULL); + } } // NVG-TLV icon margin special case check: // Check, if the icon has to be margin corrected - TAknIconHeader iconheader = GetNvgIconHeader(aNVGData); TSize size = aDestSize; // For using the correct size also later on - if (iconheader.IsMarginCorrection()) + if (iconheader.IsMarginCorrection() && !direct) { size = ApplyMargin(image, aDestSize, display, newSurface, context); if( size != aDestSize) @@ -1366,6 +1387,35 @@ else aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), size, NULL, NULL); } + // assume 32bpp for the icon, don't cache if it's too large + TInt bitmapBytes = aDestSize.iWidth*aDestSize.iHeight*4; + if (bitmapBytes < 128*128*4) + { + // can't leave here (we would screw up the transformation matrix + // for the primary surface) + CFbsBitmap* rasterizedIcon = new CFbsBitmap; + TInt rastererr(KErrNone); + if (rasterizedIcon) + { + rastererr = rasterizedIcon->Create(aDestSize, EColor16MAP); + } + if (!rastererr) + { + rasterizedIcon->BeginDataAccess(); + TUint8* dataPtr = (TUint8*)rasterizedIcon->DataAddress(); + vgGetImageSubData(image, dataPtr, CFbsBitmap::ScanLineLength(aDestSize.iWidth, EColor16MAP), VG_sARGB_8888_PRE, 0, 0, aDestSize.iWidth, aDestSize.iHeight); + rasterizedIcon->EndDataAccess(); + // store for future use.... + TRasterizedBitmap rbmp(aSerialNumber, rasterizedIcon); + rastererr = CHuiStatic::Env().AppIconCache().Insert(rbmp); + } + // either the bitmap creation failed, or cache insert failed + // delete the bitmap so that we don't leak memory + if (rastererr) + { + delete rasterizedIcon; + } + } } // restore the old surface before restoring original modes diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -69,7 +69,7 @@ /** Constant to define target how much memory UI textures should use, this is not a hard limit but effects how long unused textures are cached */ -const TInt KHuiMaxRecommendedTextureAmountInKBytes = 4096; +const TInt KHuiMaxRecommendedTextureAmountInKBytes = 6114; /** Constant to define target how much memory UI render buffers should use, this is not a hard limit but effects how long unused render buffers are cached */ @@ -2940,7 +2940,11 @@ // Always delete bitmaps from unused entries, we can again duplicate pointers from handles when needed. // Pointers are kept only for perfromance reasons. CHuiCanvasGraphicImage* entry = aIndexEntries[i]; - + TBool is16bit = EFalse; + if (entry->iBitmap && !entry->iMask && entry->iBitmap->ExtendedBitmapType() == KNullUid && entry->iBitmap->DisplayMode() == EColor64K) + { + is16bit = ETrue; + } delete entry->iBitmap; entry->iBitmap = NULL; @@ -2957,7 +2961,7 @@ } TSize textureSize = entry->iTexture->Size(); - TInt textureEstimatedSizeInBytes = textureSize.iWidth * textureSize.iHeight * KHuiCanvasImageEstimatedBpp/8.f; + TInt textureEstimatedSizeInBytes = textureSize.iWidth * textureSize.iHeight * (is16bit ? KHuiCanvasImageEstimatedBpp/16.f : KHuiCanvasImageEstimatedBpp/8.f); if (totalUnusedTextureBytes + textureEstimatedSizeInBytes < iUnusedCanvasImageTextureCacheSizeInKBytes*1024) { @@ -3156,8 +3160,14 @@ for(TInt i=imageEntries.Count() - 1; i >= 0; i--) { + TBool is16bit = EFalse; + if (imageEntries[i]->iBitmap && !imageEntries[i]->iMask && imageEntries[i]->iBitmap->ExtendedBitmapType() == KNullUid &&imageEntries[i]->iBitmap->DisplayMode() == EColor64K) + { + is16bit = ETrue; + } + TSize textureSize = imageEntries[i]->iTexture->Size(); - totalUnusedTextureBytes += textureSize.iWidth * textureSize.iHeight * KHuiCanvasImageEstimatedBpp/8.f; + totalUnusedTextureBytes += textureSize.iWidth * textureSize.iHeight * (is16bit ? KHuiCanvasImageEstimatedBpp/16.f : KHuiCanvasImageEstimatedBpp/8.f); } imageEntries.Close(); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -872,7 +872,8 @@ iCanvasVisualData->iCanvasPainter->SetTrackCommandSet( aFileName, aTrack || iTrackVisual ); } #else -EXPORT_C void CHuiCanvasVisual::SetTrackCommandSet( TFileName&, TBool){ +EXPORT_C void CHuiCanvasVisual::SetTrackCommandSet( TFileName&, TBool) + { } #endif diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -191,6 +191,8 @@ // full display refresh in many cases -> better performance. iGc->EnableTransformedClippingRects(iUseTransformedDirtyRegions); + iDisplaySizeChangePending = EFalse; + HUI_DEBUG1(_L("CHuiDisplay::ConstructL - Free memory when exiting ConstructL: %i"), HuiUtil::FreeMemory()); } @@ -1610,6 +1612,18 @@ return iDisplayContainsChangedAlfContent; } +EXPORT_C void CHuiDisplay::SetSkinSizeChangePending() + { + iDisplaySizeChangePending = ETrue; + } + +TBool CHuiDisplay::QueryAndResetSkinSizeChangePendingStatus() + { + TBool ret = iDisplaySizeChangePending; + iDisplaySizeChangePending = EFalse; + return ret; + } + void CHuiDisplay::ClipDirtyRect(TRect& aRect, TRect aClippingRect) { if (aRect.Intersects(aClippingRect)) diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -46,6 +46,7 @@ #include "uiacceltk/HuiThemeManager.h" #include "huicanvastexturecache.h" #include "HuiFxEngine.h" +#include "appiconcache.h" #include "huisynchronizationobserver.h" @@ -326,6 +327,7 @@ //iThemeManager = CHuiThemeManager::NewL(); iCanvasTextureCache = CHuiCanvasTextureCache::NewL(); + iAppIconCache = CAppIconCache::NewL(128); #ifndef SYMBIAN_BUILD_GCE #ifndef __WINSCW__ @@ -372,6 +374,7 @@ iDisplays.Reset(); iOverlaidDisplays.Reset(); + delete iAppIconCache; delete iCanvasTextureCache; delete iSharedRoster; @@ -1717,6 +1720,11 @@ { return *iCanvasTextureCache; } + +EXPORT_C CAppIconCache& CHuiEnv::AppIconCache() const + { + return *iAppIconCache; + } EXPORT_C CHuiFxEngine* CHuiEnv::EffectsEngine() const { diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -21,6 +21,7 @@ #include "HuiRosterImpl.h" // Class definition #include "HuiRosterEntry.h" #include "uiacceltk/HuiEnv.h" +#include "uiacceltk/HuiSkin.h" #include "uiacceltk/HuiControlGroup.h" #include "uiacceltk/HuiControl.h" #include "uiacceltk/HuiDisplay.h" @@ -801,6 +802,12 @@ if(!clearDone) { + // also check if display size change is pending or not + if(display->QueryAndResetSkinSizeChangePendingStatus()) + { + display->Env().Skin().NotifyDisplaySizeChangedL(); + } + // only do clear if we really draw some alf native content display->DoBackgroundClear(); clearDone = ETrue; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -196,12 +196,8 @@ { if (aReason == EAknsSkinStatusConfigurationDeployed) { - FreeAllBackgroundTextureResources(); - Env().NotifySkinChangedL(); - Env().TextStyleManager().NotifyDisplaySizeChangedL(); - ReloadBgTexturesL(); + Env().Display(0).SetSkinSizeChangePending(); } - } EXPORT_C void CHuiS60Skin::SkinPackageChanged( @@ -256,9 +252,11 @@ EXPORT_C void CHuiS60Skin::NotifyDisplaySizeChangedL() { - // The background is now different. - SkinConfigurationChanged(EAknsSkinStatusConfigurationDeployed); - + // Reload all the skin bitmaps + FreeAllBackgroundTextureResources(); + Env().NotifySkinChangedL(); + Env().TextStyleManager().NotifyDisplaySizeChangedL(); + ReloadBgTexturesL(); } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -33,7 +33,10 @@ #include #include "alfappfwproxyops.h" - +#ifdef HUI_DEBUG_TRACK_DRAWING +#include "alfloggingconfiguration.h" +#include "alfcommanddebug.h" +#endif // Global writeable data, used in HW instead of TLS which relatively slow #ifndef __WINSCW__ @@ -388,6 +391,11 @@ //Register for environment change ( here system time change ) event notification iChangeNotifier = CEnvironmentChangeNotifier::NewL(0, TCallBack(CHuiStatic::SettingChangedCallBack, this)); iChangeNotifier->Start(); + +#ifdef HUI_DEBUG_TRACK_DRAWING + iData->iCommandDebugger = CAlfCommandDebug::NewL(); +#endif + #ifndef __WINSCW__ globalWriteableData = *iData; #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF @@ -412,6 +420,11 @@ CHuiStatic::~CHuiStatic() { +#ifdef HUI_DEBUG_TRACK_DRAWING + delete iData->iCommandDebugger; + iData->iCommandDebugger = NULL; +#endif + if(iData) { if(iData->iFakeProbe) diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/appiconcache.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/coretoolkit/src/appiconcache.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -0,0 +1,89 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + + +#include "appiconcache.h" + +CAppIconCache::~CAppIconCache() + { + Clear(); + } + +CAppIconCache::CAppIconCache(TInt aCacheLimit) : iCache(32), iCacheLimit(aCacheLimit) + { + } + +CAppIconCache* CAppIconCache::NewL(TInt aCacheLimit) + { + CAppIconCache* self = new (ELeave) CAppIconCache(aCacheLimit); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(); + return self; + } + + +void CAppIconCache::ConstructL() + { + } + +EXPORT_C CFbsBitmap* CAppIconCache::Find(TInt64 aSerialNumber, TSize aSize) + { + TRasterizedBitmap rb; + for (TInt index = 0; index < iCache.Count(); index++) + { + if (iCache[index].iBitmapSerial == aSerialNumber && iCache[index].iBitmap->SizeInPixels() == aSize) + { + // if we found a match, move the entry to the beginning of + // the cache + rb = iCache[index]; + iCache.Remove(index); + iCache.Insert(rb, 0); + return rb.iBitmap; + } + } + return NULL; + } + +EXPORT_C TInt CAppIconCache::Insert(TRasterizedBitmap& aBitmap) + { + TSize bitmapsize = aBitmap.iBitmap->SizeInPixels(); + // assume 32bpp for the icon + TInt bitmapBytes = bitmapsize.iWidth*bitmapsize.iHeight*4; + if (bitmapBytes > 128*128*4) + { + return KErrTooBig; + } + + if (iCache.Count() > iCacheLimit) + { + // cache limit exceeded, remove + // the least recently used entry + delete iCache[iCache.Count()-1].iBitmap; + iCache.Remove(iCache.Count()-1); + } + return iCache.Insert(aBitmap, 0); + } + +EXPORT_C void CAppIconCache::Clear() + { + for (TInt index = 0; index < iCache.Count(); index++) + { + delete iCache[index].iBitmap; + } + iCache.Reset(); + } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/huicanvasdebugwsgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvasdebugwsgc.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvasdebugwsgc.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -588,6 +588,11 @@ return iCanvasWsGc->EnableRenderbuffer(aEnable); } +void CHuiCanvasDebugWsGc::ClearCapturingBufferArea(const TRect& aRect) + { + iCanvasWsGc->ClearCapturingBufferArea(aRect); + } + THuiCanvasWsGcType CHuiCanvasDebugWsGc::Type() const { return iCanvasWsGc->Type(); @@ -616,6 +621,11 @@ } +void CHuiCanvasDebugWsGc::SetInternalGc(CHuiCanvasWsGc* aHuiCanvasGc) + { + iCanvasWsGc = aHuiCanvasGc; + } + void CHuiCanvasDebugWsGc::SetPositionDelta(TPoint& aPoint) { iCanvasWsGc->SetPositionDelta(aPoint); @@ -623,7 +633,6 @@ CHuiCanvasDebugWsGc::~CHuiCanvasDebugWsGc() { - delete iCanvasWsGc; } void CHuiCanvasDebugWsGc::EnableUpdateRegion(const TRegion& aUpdateRegion, TBool aClear) diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -254,10 +254,22 @@ { if (iCommandBuffers[cb]->iOrientation == aOrientation) { - // should this be original display rect or update region - tempRegion.AddRect(iCommandBuffers[cb]->iOriginalDisplayRect); + // add update region of command buffer to region + TRect rect(iCommandBuffers[cb]->iOriginalUpdateRegion.BoundingRect()); + rect.Move(-iCommandBuffers[cb]->iOriginalDisplayRect.Round().iTl); + + tempRegion.AddRect(rect); + tempRegion.Tidy(); } } + + if (iCanvasVisual) + { + TRect displayRect(iCanvasVisual->DisplayRect()); + tempRegion.ClipRect(TRect(displayRect.Size())); + tempRegion.Offset(displayRect.iTl); + } + TRect result = tempRegion.BoundingRect(); tempRegion.Close(); return result; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -44,6 +44,7 @@ #ifdef HUI_DEBUG_TRACK_DRAWING #include "alfloggingconfiguration.h" #include "alfcommanddebug.h" +#include "huistatictlsdata.h" #endif #include #include @@ -126,13 +127,16 @@ // Never happens, right. } - iWsCommandBufferReader = new (ELeave) CHuiCanvasCmdBufferReader(); -#ifdef HUI_DEBUG_TRACK_DRAWING - iCommandDebugger = CAlfCommandDebug::NewL(); - CHuiCanvasWsGc* realGc = iCanvasWsGc; - iCanvasWsGc = CHuiCanvasDebugWsGc::NewL( realGc, *iCommandDebugger ); + iWsCommandBufferReader = new (ELeave) CHuiCanvasCmdBufferReader(); -#endif + #ifdef HUI_DEBUG_TRACK_DRAWING + if (!iCanvasDebugWsGc) + { + iCanvasDebugWsGc = CHuiCanvasDebugWsGc::NewL( iCanvasWsGc, *TTlsData::CommandDebugger() ); + iCanvasWsGc = iCanvasDebugWsGc; + } + + #endif } @@ -157,7 +161,7 @@ iTempCurrentSubRegion.Close(); iTempIntersectingRegion.Close(); #ifdef HUI_DEBUG_TRACK_DRAWING - delete iCommandDebugger; + delete iCanvasDebugWsGc; #endif iFullUpdateRegion.Close(); iShapeRegion.Close(); @@ -767,7 +771,7 @@ } } - iCommandDebugger->StartFrame(); + TTlsData::CommandDebugger()->StartFrame(); if ( commandBuffer->iProcessName ) { // UNCOMMENT THIS IF YOU WANT TO PRINT EVERYTHING @@ -803,7 +807,7 @@ { command = readerStream.ReadUint8L(); #ifdef HUI_DEBUG_TRACK_DRAWING - iCommandDebugger->SetDescription( command ); + TTlsData::CommandDebugger()->SetDescription( command ); #endif // Command cases are ordered approximately in the order so that most common ones are at first @@ -1292,7 +1296,7 @@ } while( offset < bufLength ); #ifdef HUI_DEBUG_TRACK_DRAWING - iCommandDebugger->EndFrame(); + TTlsData::CommandDebugger()->EndFrame(); #endif } @@ -2146,7 +2150,7 @@ if (aIndex==-1) return; //TP // Update region is modified when new buffers are added after this buffer, // so store the region only at first read. - if (iCommandBuffers[aIndex]->iChanged && iCommandBuffers[aIndex]->iUpdateRegion.Count() == 0) + if (iCommandBuffers[aIndex]->iChanged && iCommandBuffers[aIndex]->iOriginalUpdateRegion.Count() == 0) { // Check first that the coordiates are not insane (sometimes thay are) TInt count = iTempRegion.Count(); @@ -2758,8 +2762,16 @@ } #ifdef HUI_DEBUG_TRACK_DRAWING - CHuiCanvasWsGc* realGc = iCanvasWsGc; - iCanvasWsGc = CHuiCanvasDebugWsGc::NewL( realGc, *iCommandDebugger ); + if (!iCanvasDebugWsGc) + { + iCanvasDebugWsGc = CHuiCanvasDebugWsGc::NewL( iCanvasWsGc, *TTlsData::CommandDebugger() ); + } + else if(iCanvasWsGc!=iCanvasDebugWsGc) + { + iCanvasDebugWsGc->SetInternalGc(iCanvasWsGc); + } + + iCanvasWsGc = iCanvasDebugWsGc; #endif AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC(); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h --- a/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h Mon Jun 21 16:41:52 2010 +0300 @@ -267,6 +267,7 @@ TBool iUseSwRendering; TBool iTryOptional; // we did everything we could but still missing some bits, try again with different app targets TBool iOptionalTried; // no need to overperform though + TUint iAppIndex; }; #include "goomactionlist.inl" diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/inc/goomactionref.h --- a/uiacceltk/hitchcock/goommonitor/inc/goomactionref.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionref.h Mon Jun 21 16:41:52 2010 +0300 @@ -23,6 +23,7 @@ #include "goomactionconfig.h" class CGOomRunPlugin; +class CGOomAction; /** * Encapsulates a reference to an action. @@ -61,6 +62,7 @@ CGOomRunPlugin& RunPlugin(); TInt CloseTimeout() const; TInt WaitAfterClose() const; + TBool IsRunning(); private: //data @@ -73,6 +75,8 @@ CGOomRunPlugin* iRunPlugin; //For Plugins. Not owned TInt iCloseTimeout; //For AppClose TInt iWaitAfterClose; //For AppClose +public: + CGOomAction* iAppPlugin; // because of stupid desing, not owned }; #endif /*GOOMACTIONREF_H_*/ diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/inc/goomcloseapp.h --- a/uiacceltk/hitchcock/goommonitor/inc/goomcloseapp.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/inc/goomcloseapp.h Mon Jun 21 16:41:52 2010 +0300 @@ -71,6 +71,10 @@ inline TUint WgId() const; + + /** Ask nice */ + void ConditionalClose(); + /** When the gentle push is not enough (i.e. force is required) **/ void KillTask(); @@ -100,6 +104,8 @@ * Own */ CGOomAppCloseWatcher* iAppCloseWatcher; + + TBool iAlreadyGaveUp; }; #include "goomcloseapp.inl" diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h --- a/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitor.h Mon Jun 21 16:41:52 2010 +0300 @@ -91,9 +91,10 @@ void SessionInCriticalAllocation(TBool aPostponeMemGood, TUint aClientId) { FUNC_LOG; + TInt oldCount = iClientsRequestingMemory.Count(); + if (aPostponeMemGood) { - iPostponeMemGood++; if(iClientsRequestingMemory.Find(aClientId) == KErrNotFound) iClientsRequestingMemory.Append(aClientId); @@ -101,21 +102,15 @@ } else { - iPostponeMemGood--; TInt idx = iClientsRequestingMemory.Find(aClientId); if(idx != KErrNotFound) { iClientsRequestingMemory.Remove(idx); TRACES2("SessionInCriticalAllocation : ENDING Critical Allocations for Client %x, ClientsRequestingMemory Count %d", aClientId, iClientsRequestingMemory.Count()); } - - if(iPostponeMemGood<0) - { - iPostponeMemGood = 0; - } } TRACES1("SessionInCriticalAllocation : ClientsRequestingMemory Count %d", iClientsRequestingMemory.Count()); - if (iClientsRequestingMemory.Count() == 0) + if (oldCount && iClientsRequestingMemory.Count() == 0) { DoPostponedMemoryGood(); } @@ -126,7 +121,6 @@ TBool NeedToPostponeMemGood() { - //return (iPostponeMemGood != 0); return (iClientsRequestingMemory.Count() != 0); } @@ -201,7 +195,6 @@ CGoomThresholdCrossed* iMemAllocationsGoingDown; TInt iForegroundAppUid; - TInt iPostponeMemGood; RArray iClientsRequestingMemory; diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/inc/goommemorymonitorsession.h --- a/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitorsession.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/inc/goommemorymonitorsession.h Mon Jun 21 16:41:52 2010 +0300 @@ -42,6 +42,7 @@ TInt iFunction; TInt iMinimumMemoryRequested; TBool iUseAbsoluteTargets; + TUint iClientId; }; #endif /*GOOMMEMORYMONITORSESSION_H*/ diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h --- a/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h Mon Jun 21 16:41:52 2010 +0300 @@ -91,7 +91,7 @@ } } - + TInt FindParentIdL(TInt aWgId); private: @@ -99,7 +99,6 @@ void RemovePropertiesForClosedWindowsL(); - TInt FindParentIdL(TInt aWgId); private: diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -214,8 +214,9 @@ { FUNC_LOG; -// iActionRefs.Reset(); -// iCurrentActionIndex = 0; + // we can't reset action index here because plugins would miss memory good events + + iAppIndex = 0; aWindowGroupList.RefreshL(iTryOptional); @@ -303,6 +304,7 @@ TInt err = iActionRefs.InsertInOrder(ref, ComparePriorities); if ((err != KErrNone) && (err != KErrAlreadyExists)) { + TRACES3("BuildActionListL: Adding app to action list, Uid = %x, wgId = %d, err = %d", appId, wgId, err); User::Leave(err); } TRACES3("BuildActionListL: Adding app to action list, Uid = %x, wgId = %d, wgIndex = %d", appId, wgId, wgIndex); @@ -352,25 +354,70 @@ TActionRef ref = iActionRefs[iCurrentActionIndex]; CGOomAction* action = NULL; - if (ref.Type() == TActionRef::EAppClose) - { - action = iCloseAppActions[numberOfRunningActions]; + if (ref.Type() == TActionRef::EAppClose ) + { + iAppIndex%=iCloseAppActions.Count(); + TRACES2("Proceeding with app action from index %d, out of %d", iAppIndex, iCloseAppActions.Count() ); + action = iCloseAppActions[iAppIndex]; + iAppIndex++; static_cast(action)->Reconfigure(ref); + ref.iAppPlugin = action; + //Double checking again if this app is now in foreground, if yes then we dont kill CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(iWs, iWs.GetFocusWindowGroup()); TInt32 fgApp = wgName->AppUid().iUid; TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue); - - CleanupStack::PopAndDestroy(); + if(appId == fgApp) { TRACES1("Foreground App wgid %x, spared by GOOM", appId); iCurrentActionIndex++; + CleanupStack::PopAndDestroy(); continue; } + + //check if this is not parent of foreground app + TBool spared = EFalse; + TRACES1("CGOomActionList::FreeMemory - Going to kill Appid %x ",appId); + TInt prevWgId = 0; + while(prevWgId != KErrNotFound) + { + wgName->FindByAppUid(wgName->AppUid(), iWs, prevWgId); + + if(prevWgId == KErrNotFound) + break; + + TInt parentId = 0; + TRAPD(err, parentId = iMonitor.GetWindowGroupList()->FindParentIdL(prevWgId)); + TRACES2("CGOomActionList::FreeMemory - Foreground App wgid %d, parent wgid %d",prevWgId, parentId); + if( err == KErrNone && parentId != 0) + { + TInt32 parentAppId = iMonitor.GetWindowGroupList()->AppIdfromWgId(parentId, ETrue); + if(parentAppId == appId) + { + TRACES3("Parent App %x (wgId %d), of Foreground App %x, spared by GOOM", parentAppId, parentId, fgApp); + spared = ETrue; + break; + } + } + } + CleanupStack::PopAndDestroy(); + if(spared) + { + iCurrentActionIndex++; + if (iCurrentActionIndex >= iActionRefs.Count()) + { + StateChanged(); + return; + } + else + { + continue; + } + } } else { @@ -438,7 +485,6 @@ { iTryOptional = EFalse; iOptionalTried = EFalse; - TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found"); iServer.CloseAppsFinished(freeMemory, EFalse); iMonitor.WaitAndSynchroniseMemoryState(); @@ -579,9 +625,13 @@ FUNC_LOG; TInt index = iCloseAppActions.Count(); + TRACES1("CGOomCloseApp::AppNotExiting: count of actions %d",index); + while (index--) { CGOomCloseApp* action = iCloseAppActions[index]; + TRACES3("CGOomCloseApp::AppNotExiting: %d %d %d", aWgId, action->WgId(), action->IsRunning()); + if ( (action->WgId() == aWgId) && (action->IsRunning()) ) { TRACES1("CGOomCloseApp::AppNotExiting: App with window group id %d has not responded to the close event", aWgId); @@ -598,23 +648,12 @@ TBool allActionsComplete = ETrue; - // Note that the actions themselves are responsible for timing out if necessary. - TInt index = iCloseAppActions.Count(); - while ((index--) && (allActionsComplete)) + TInt index = iActionRefs.Count(); + while ((index--) && (allActionsComplete)) { - if (iCloseAppActions[index]->IsRunning()) + if (iActionRefs[index].IsRunning()) { - TRACES1("CGOomActionList::StateChanged. CloseAppAction %d STILL RUNNING. PROBLEM !!! YOU SHOULD NEVER SEE THIS", index); - allActionsComplete = EFalse; - } - } - - index = iRunPluginActions.Count(); - while ((index--) && (allActionsComplete)) - { - if (iRunPluginActions[index]->IsRunning()) - { - TRACES1("CGOomActionList::StateChanged. PluginAction %d STILL RUNNING. PROBLEM !!! YOU SHOULD NEVER SEE THIS", index); + TRACES1("CGOomActionList::StateChanged. Action %d STILL RUNNING.", index); allActionsComplete = EFalse; } } @@ -632,59 +671,44 @@ // If we are still below the good-memory-threshold then continue running actions { TRACES2("CGOomActionList::StateChanged: Finished Action %d out of %d",iCurrentActionIndex, iActionRefs.Count()); - - - if (iCurrentActionIndex >= iActionRefs.Count()) + + if (iCurrentActionIndex < iActionRefs.Count()-1) { - if(iRunningKillAppActions) - { - iRunningKillAppActions = EFalse; - // There are no more actions to try, so we give up - TRACES1("CGOomActionList::StateChanged: All current actions complete, below good threshold with no more actions available. freeMemory=%d", freeMemory); - - /* Do not call memory good immidiately after freeing memory for some app - if (freeMemory >= iCurrentTarget && !iMonitor.NeedToPostponeMemGood()) - { - MemoryGood(); - } - */ - if (!iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config - { - iTryOptional = ETrue; - iOptionalTried = EFalse; - iMonitor.RunCloseAppActions(iMaxPriority); - } - else - { - iTryOptional = EFalse; - iServer.CloseAppsFinished(freeMemory, EFalse); - iMonitor.WaitAndSynchroniseMemoryState(); - } + // launch more actions, potential recursion !! + iCurrentActionIndex++; + return FreeMemory(iMaxPriority); + } + + if(iRunningKillAppActions) + { + iRunningKillAppActions = EFalse; + // There are no more actions to try, so we give up + TRACES1("CGOomActionList::StateChanged: All current actions complete, below good threshold with no more actions available. freeMemory=%d", freeMemory); + + if (!iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config + { + iTryOptional = ETrue; + iOptionalTried = ETrue; + iMonitor.RunCloseAppActions(iMaxPriority); } else { - TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory); - iRunningKillAppActions = ETrue; - iMonitor.RunCloseAppActions(iMaxPriority); + iTryOptional = EFalse; + iServer.CloseAppsFinished(freeMemory, EFalse); + iMonitor.WaitAndSynchroniseMemoryState(); } - } else { - // There are still more actions to try, so we continue - TRACES1("CGOomActionList::StateChanged: All current actions complete, running more actions. freeMemory=%d", freeMemory); - FreeMemory(iMaxPriority); + TRACES1("CGOomActionList::StateChanged: All current Plugin actions complete, below good threshold, Time to kill bad guys. freeMemory=%d", freeMemory); + iRunningKillAppActions = ETrue; + iMonitor.RunCloseAppActions(iMaxPriority); } + } else { TRACES1("CGOomActionList::StateChanged: All current actions complete, memory good. freeMemory=%d", freeMemory); - /* Do not call memory good immidiately after freeing memory for some app - if(freeMemory > iMonitor.GetGoodThreshold() && !iMonitor.NeedToPostponeMemGood()) - { - MemoryGood(); - } - */ iRunningKillAppActions = EFalse; iServer.CloseAppsFinished(freeMemory, ETrue); iMonitor.WaitAndSynchroniseMemoryState(); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/src/goomactionref.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomactionref.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/src/goomactionref.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -17,14 +17,15 @@ #include "goomactionref.h" +#include "goomrunplugin.h" TActionRef::TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, CGOomRunPlugin& aRunPlugin, TUint aWgIndexOfTargetApp) - : iType(aType), iPriority(aPriority), iSyncMode(aSyncMode), iRamEstimate(aRamEstimate), iWgIndex(aWgIndexOfTargetApp), iRunPlugin(&aRunPlugin) + : iType(aType), iPriority(aPriority), iSyncMode(aSyncMode), iRamEstimate(aRamEstimate), iWgIndex(aWgIndexOfTargetApp), iRunPlugin(&aRunPlugin), iAppPlugin(0) { } TActionRef::TActionRef(TActionType aType, TInt aPriority, TGOomSyncMode aSyncMode, TInt aRamEstimate, TInt aWgId, TUint aWgIndex, TInt aCloseTimeout, TInt aWaitAfterClose) -: iType(aType), iPriority(aPriority), iSyncMode(aSyncMode), iRamEstimate(aRamEstimate), iWgId(aWgId), iWgIndex(aWgIndex), iRunPlugin(NULL), iCloseTimeout(aCloseTimeout), iWaitAfterClose(aWaitAfterClose) +: iType(aType), iPriority(aPriority), iSyncMode(aSyncMode), iRamEstimate(aRamEstimate), iWgId(aWgId), iWgIndex(aWgIndex), iRunPlugin(NULL), iCloseTimeout(aCloseTimeout), iWaitAfterClose(aWaitAfterClose), iAppPlugin(0) { } @@ -78,3 +79,16 @@ { return *iRunPlugin; } + +TBool TActionRef::IsRunning() + { + if (iRunPlugin) + { + return iRunPlugin->IsRunning(); + } + else if (iAppPlugin) + { + return iAppPlugin->IsRunning(); + } + return EFalse; + } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/src/goomcloseapp.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -18,6 +18,8 @@ #include +#include "goommemorymonitor.h" +#include "goomwindowgrouplist.h" #include "goomcloseapp.h" #include "goomtraces.h" #include "goomappclosetimer.h" @@ -42,18 +44,30 @@ { FUNC_LOG; + if ( iAlreadyGaveUp ) + { + if (iAppCloseTimer) + { + iAppCloseTimer->Cancel(); + } + + if (iAppCloseWatcher) + { + iAppCloseWatcher->Cancel(); + } + + RDebug::Printf("GOOM: I should not activate actions for app that already refused to exit !!!!"); + MemoryFreed(KErrNone); + return; + } + iAppCloserRunning = ETrue; // Set the TApaTask to the app iCurrentTask.SetWgId(iWgId); - - // Start a timer and the thread watcher - iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing); - iAppCloseTimer->After(iCloseTimeout * 1000); - iAppCloseWatcher->Start(iCurrentTask); - // Tell the app to close - TRACES2("CGOomCloseApp::FreeMemory: Closing app with window group id %d Timeout = %d",iWgId, iCloseTimeout); - iCurrentTask.EndTask(); + + // start the chain + ConditionalClose(); } CGOomCloseApp::~CGOomCloseApp() @@ -77,19 +91,19 @@ // The application has closed (or we have a timeout) iAppCloserRunning = EFalse; + iAlreadyGaveUp = ETrue; if (iAppCloseTimer) { - iAppCloseTimer->Cancel(); - iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled); - iAppCloseTimer->After(iWaitAfterClose * 1000); + iAppCloseTimer->Cancel(); + iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled); + iAppCloseTimer->After(iWaitAfterClose * 1000); } if (iAppCloseWatcher) + { iAppCloseWatcher->Cancel(); - - - //MemoryFreed(KErrNone); + } } void CGOomCloseApp::Reconfigure(const TActionRef& aRef) @@ -99,6 +113,7 @@ iWgId = aRef.WgId(); iCloseTimeout = aRef.CloseTimeout(); iWaitAfterClose = aRef.WaitAfterClose(); + iAlreadyGaveUp = EFalse; } void CGOomCloseApp::ConstructL() @@ -115,6 +130,38 @@ FUNC_LOG; } +TBool IsConsumingMemory(TInt aWgId) + { + FUNC_LOG; + // Something more efficient could be done here + CMemoryMonitor* globalMemoryMonitor = static_cast(Dll::Tls()); + globalMemoryMonitor->GetWindowGroupList()->Refresh(); + return (globalMemoryMonitor->GetWindowGroupList()->GetIndexFromWgId(aWgId) != KErrNotFound); + } + +void CGOomCloseApp::ConditionalClose() + { + FUNC_LOG; + // Start a timer and the thread watcher + iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppClosing); + iAppCloseTimer->After(iCloseTimeout * 1000); + // Tell the app to close + // We are not asking system applications to exit anyway, so we'll send legacy event only + // even we have powermgmt capability + TRACES2("CGOomCloseApp::FreeMemory: Closing app with window group id %d Timeout = %d",iWgId, iCloseTimeout); + TWsEvent event; + event.SetType(EEventUser); + TInt* eventData = (TInt*)(event.EventData()); + *eventData = EApaSystemEventShutdown; + eventData++; + *eventData = KGoomMemoryLowEvent; + + // should proxy the session.. + CMemoryMonitor* globalMemoryMonitor = static_cast(Dll::Tls()); + globalMemoryMonitor->iWs.SendEventToWindowGroup(iWgId, event); + } + + // ---------------------------------------------- // Callback from iAppCloseTimer // App refused to exit gracefully on given time @@ -127,12 +174,18 @@ { iAppCloseWatcher->Cancel(); } - - iCurrentTask.KillTask(); - iAppCloserRunning = EFalse; - - iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled); - iAppCloseTimer->After(iWaitAfterClose * 1000); + + if(IsConsumingMemory(iWgId)) + { + iCurrentTask.KillTask(); + iAppCloserRunning = EFalse; // not sure if intended (?) + iAppCloseTimer->SetState(CGOomAppCloseTimer::EGOomAppKilled); + iAppCloseTimer->After(iWaitAfterClose * 1000); + } + else + { // application has released its graphics resources -> we are no more interested about it + CloseAppEvent(); + } //MemoryFreed(KErrNone); } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -304,6 +304,8 @@ iGOomActionList->SetCurrentTarget(iCurrentTarget); iTrigger = aTrigger; + + iGOomActionList->SetUseSwRendering(ETrue); //Always use SW rendering in low mode .. (for now..) // Run the memory freeing actions iGOomActionList->FreeMemory(aMaxPriority); @@ -736,7 +738,6 @@ } } - TRACES1("Going to process new request %d",iPostponeMemGood); return ETrue; } @@ -776,15 +777,9 @@ TInt current = GetFreeMemory(); if(current >= iGoodThreshold) { - if(!NeedToPostponeMemGood()) - { - TRACES("SynchroniseMemoryState calling MemoryGOOD"); - iGOomActionList->MemoryGood(); - } - else - { - iMemAllocationsGoingDown->Continue(); - } + iClientsRequestingMemory.Reset(); + TRACES("SynchroniseMemoryState calling MemoryGOOD"); + iGOomActionList->MemoryGood(); } else if(current < iLowThreshold) { diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -35,12 +35,7 @@ CMemoryMonitorSession::~CMemoryMonitorSession() { FUNC_LOG; - /* TODO - need to add the right condition - if (iUseAbsoluteTargets) - { // se3ssion terminated while on critical allocation, release lock - Server().Monitor().SessionInCriticalAllocation(0); - } - */ + Server().Monitor().SessionInCriticalAllocation(0,iClientId); CloseAppsFinished(0, EFalse); } @@ -66,29 +61,29 @@ RThread t; aMessage.Client(t); - TUint clientId = t.SecureId(); + iClientId = t.SecureId(); t.Close(); - TRACES1("NEW REQUEST from client %x", clientId); + TRACES1("NEW REQUEST from client %x", iClientId); switch (aMessage.Function()) { case EGOomMonitorRequestFreeMemory: //Do not take any more requests from the same client if previous request being served - if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(clientId)) + if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(iClientId)) { - TRACES1("CANNOT PROCESS NEW REQUEST from %x", clientId); + TRACES1("CANNOT PROCESS NEW REQUEST from %x", iClientId); aMessage.Complete(KErrInUse); return; } - Server().Monitor().SetActiveClient(clientId); + Server().Monitor().SetActiveClient(iClientId); // message will be completed when CloseAppsFinished() is called. if (aMessage.Int1() == 0) { iRequestFreeRam = aMessage; - Server().Monitor().SessionInCriticalAllocation(1, clientId); + Server().Monitor().SessionInCriticalAllocation(1, iClientId); TRAPD(err, Monitor().RequestFreeMemoryL(aMessage.Int0())); if (err) @@ -108,8 +103,8 @@ break; case EGOomMonitorMemoryAllocationsComplete: - TRACES1("ServiceL : Memory Allocations complete from %x", clientId); - Server().Monitor().SessionInCriticalAllocation(0, clientId); + TRACES1("ServiceL : Memory Allocations complete from %x", iClientId); + Server().Monitor().SessionInCriticalAllocation(0, iClientId); aMessage.Complete(KErrNone); break; @@ -118,7 +113,7 @@ { iRequestFreeRam.Complete(KErrCancel); } - Server().Monitor().SessionInCriticalAllocation(0, clientId); + Server().Monitor().SessionInCriticalAllocation(0, iClientId); aMessage.Complete(KErrNone); break; @@ -128,11 +123,11 @@ break; case EGOomMonitorRequestOptionalRam: - if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(clientId)) + if (!iRequestFreeRam.IsNull() && !Server().Monitor().IsSafeToProcessNewRequest(iClientId)) { aMessage.Complete(KErrInUse); } - Server().Monitor().SetActiveClient(clientId); + Server().Monitor().SetActiveClient(iClientId); // message will be completed when CloseAppsFinished() is called. iRequestFreeRam = aMessage; iMinimumMemoryRequested = aMessage.Int1(); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/group/bld.inf --- a/uiacceltk/hitchcock/group/bld.inf Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/group/bld.inf Mon Jun 21 16:41:52 2010 +0300 @@ -40,6 +40,7 @@ // After effect system is complete and aknskins has taken over the correct 101f84b9.sel file // and manifest.mf file, we should no longer export these files. #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS +#ifndef ALF_USE_OPENWF_COMPOSITION ../coretoolkit/data/101f84b9.sel /epoc32/data/z/resource/skins/101f84b9/101f84b9.sel ../coretoolkit/data/101f84b9.sel /epoc32/release/winscw/udeb/z/resource/skins/101f84b9/101f84b9.sel ../coretoolkit/data/101f84b9.sel /epoc32/release/winscw/urel/z/resource/skins/101f84b9/101f84b9.sel @@ -59,7 +60,7 @@ // For easier testing you can also copy the effect files onto a memory card into // /resource/effects/ directory. // These files can be changed any time and reregistered by changing the skin - +#endif // #ifndef ALF_USE_OPENWF_COMPOSITION #endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS // backround animation shaders diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -799,90 +799,109 @@ TSecureId result(aAppUid); if ( aAppUid == TUid::Null() ) { + iCachedUidMapping.iWindowGroupId = -1; return result; } - - TBool found = EFalse; + + __ALFFXLOGSTRING1("CGfxTransAdapterTfx::SecureIdFromAppUid Searching SID&WGID for aAppUid: 0x%x", aAppUid.iUid ); // first check the cache if ( iCachedUidMapping.iAppUid == aAppUid.iUid && iCachedUidMapping.iSecureId != 0 ) { - result = iCachedUidMapping.iSecureId; - found = ETrue; - } + __ALFFXLOGSTRING2( "CGfxTransAdapterTfx::SecureIdFromAppUid using cached SID 0x%x and WGID: %d", + iCachedUidMapping.iSecureId, + iCachedUidMapping.iWindowGroupId ); + return TSecureId(iCachedUidMapping.iSecureId); + } + + TInt windowGroupId = -1; + RProcess thisProcess; + TUidType uidType = thisProcess.Type(); - if ( !found ) + if ( uidType.IsValid() ) { - // do the hard work - // first check this process - this is quick - // also, if this is the start-up effect on an application, the TApaTask is not yet updated with the - // window group created by this application (yet). - TInt windowGroupId = -1; - RProcess thisProcess; - TUidType uidType = thisProcess.Type(); - if ( uidType.IsValid() ) + bool thisApplication = false; + if ( uidType[2] == aAppUid ) // 0 = UID1, 1 = UID2, 2 = UID3 + { + // this application + result = thisProcess.SecureId(); + thisApplication = ETrue; + __ALFFXLOGSTRING2("CGfxTransAdapterTfx::SecureIdFromAppUid Own SID 0x%x in thread %S", + result.iId, + &RThread().Name() ); + } + + CCoeEnv* env = CCoeEnv::Static(); + RWsSession localSession; + RWsSession* usedWsSession = NULL; + if ( env ) { - if ( uidType[2] == aAppUid ) // 0 = UID1, 1 = UID2, 2 = UID3 - { - result = thisProcess.SecureId(); - // take the window gruop ID as well if available - CCoeEnv* env = CCoeEnv::Static(); - if ( env ) - { - windowGroupId = env->RootWin().Identifier(); - } - found = ETrue; + usedWsSession = &env->WsSession(); + } + else + { + if ( localSession.Connect() == KErrNone ) + { + usedWsSession = &localSession; } } - thisProcess.Close(); - - // If not this application, find UID using the TApaTask - if ( !found ) + + // check if the AppArcServer has already information about this Application + if ( usedWsSession ) { - TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); + TApaTaskList taskList( *usedWsSession ); const TApaTask task = taskList.FindApp( aAppUid ); - const TThreadId threadId = task.ThreadId(); - RThread otherThread; - if ( otherThread.Open( threadId ) == KErrNone ) // ignore error + const TThreadId otherThreadId = task.ThreadId(); + + if ( thisApplication ) { - result = otherThread.SecureId(); - windowGroupId = task.WgId(); // take it for free at this point. - found = ETrue; - } - otherThread.Close(); - } - - if ( found ) - { - // update cache - if ( iCachedUidMapping.iAppUid == aAppUid.iUid ) - { - // found the missing secure ID - iCachedUidMapping.iSecureId = result.iId; - - if ( windowGroupId > 0 ) + // if security ID of the other thread matched, we take the WG ID from AppArcServer + RThread otherThread; + if ( otherThread.Open( otherThreadId ) == KErrNone ) { - // if we got the window group ID, update that as well to the cache - iCachedUidMapping.iWindowGroupId = windowGroupId; + __ALFFXLOGSTRING1("CGfxTransAdapterTfx::SecureIdFromAppUid Exising TApaTask found using thread %S", &otherThread.Name() ); + if ( otherThread.SecureId() == result ) + { + windowGroupId = task.WgId(); + __ALFFXLOGSTRING1("CGfxTransAdapterTfx::SecureIdFromAppUid SID match -> WGID : &d found from TApaTask", windowGroupId ); + } + else + { + __ALFFXLOGSTRING2("CGfxTransAdapterTfx::SecureIdFromAppUid otherSID 0x%x otherWGID : &d not matching in TApaTask", otherThread.SecureId().iId , task.WgId() ); + } + } + otherThread.Close(); + + if ( windowGroupId == -1 && env ) + { + // take the root WG ID + windowGroupId = env->RootWin().Identifier(); + __ALFFXLOGSTRING1("CGfxTransAdapterTfx::SecureIdFromAppUid root WGID %d used", windowGroupId ); } } - else + else { - iCachedUidMapping.iAppUid = aAppUid.iUid; - iCachedUidMapping.iSecureId = result.iId; - // wgid might not be updated at this point. - iCachedUidMapping.iWindowGroupId = Max(windowGroupId,0); // might be -1 -> treat 0 and -1 is just 0 + RThread otherThread; + if ( otherThread.Open( otherThreadId ) == KErrNone ) + { + result = otherThread.SecureId(); + windowGroupId = task.WgId(); + __ALFFXLOGSTRING3("CGfxTransAdapterTfx::SecureIdFromAppUid Taking SID 0x%x WGID %d from thread %S via TApaTask", result.iId, windowGroupId, &otherThread.Name() ); + } + otherThread.Close(); } } + + localSession.Close(); } + thisProcess.Close(); - if ( !found ) + if ( windowGroupId != -1 ) { - __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::SecureIdFromAppUid AppUid 0x%x not found (yet)", aAppUid.iUid ); - } - else if ( aAppUid.iUid != result.iId ) - { - __ALFFXLOGSTRING2( "CGfxTransAdapterTfx::SecureIdFromAppUid SecureID 0x%x differs form AppUid 0x%x", result.iId, aAppUid.iUid ); + // update cache + iCachedUidMapping.iAppUid = aAppUid.iUid; + iCachedUidMapping.iSecureId = result; + iCachedUidMapping.iWindowGroupId = windowGroupId; } return result; @@ -894,55 +913,13 @@ // TInt32 CGfxTransAdapterTfx::WindowGroupIdFromAppUid( TUid aAppUid ) { - if ( aAppUid == TUid::Null() ) - { - return 0; - } - - TInt result = 0; - TBool found = EFalse; - - // check the cache. most likely this is already up-to-date due the previous execution of SecureIdFromAppUid - if ( iCachedUidMapping.iAppUid == aAppUid.iUid ) - { - if ( iCachedUidMapping.iWindowGroupId > 0 ) - { - result = iCachedUidMapping.iWindowGroupId; - iCachedUidMapping.iSecureId = 0; - found = true; - } - } - - if ( !found ) + TInt32 result = 0; + if ( iCachedUidMapping.iAppUid == aAppUid.iUid ) { - // do the hard work - TApaTaskList taskList( CCoeEnv::Static()->WsSession() ); - const TApaTask task = taskList.FindApp( aAppUid ); - result = TInt32(task.WgId()); - - if ( result > 0 ) - { - // update cache - found = ETrue; - if ( iCachedUidMapping.iAppUid != aAppUid.iUid ) - { - iCachedUidMapping.iAppUid = aAppUid.iUid; - iCachedUidMapping.iSecureId = 0; - } - iCachedUidMapping.iWindowGroupId = result; - } - else - { - result = 0; // might be -1 -> treat 0 and -1 is just 0 - } + result = iCachedUidMapping.iWindowGroupId; } - - if ( !found ) - { - __ALFFXLOGSTRING1( "CGfxTransAdapterTfx::WindowGroupIdFromAppUid AppUid 0x%x not found (yet)", aAppUid.iUid ); - } - - return TInt32(result); + iCachedUidMapping.iSecureId = 0; + return result; } diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h Mon Jun 21 16:41:52 2010 +0300 @@ -26,6 +26,7 @@ #include "alftfxplugincommon.hrh" #include "../../../../ServerCore/Inc/alfwindowfxplugin.h" #include "wsserverdrawercontroller.h" +#include "alfloggingconfiguration.h" // CONSTANTS const TUid KAlfGfxImplUid = { KAlfGfxImplUidValue }; @@ -117,7 +118,7 @@ * C++ contructor */ CAlfGfxEffects(); -#ifdef _DEBUG +#ifdef _ALF_FXLOGGING void PrintRequestInfo(TInt aOperation, TInt aAction ); #endif diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h Mon Jun 21 16:41:52 2010 +0300 @@ -102,6 +102,11 @@ TInt SendBeginFullscreen(TInt aHandle, TUint aAction, const TUid& aUid, const TUid& aPreviousUid, const TRect& aEffectRect); + /** + * SendEndFullscreen + * + * @return 1, If longer app start effect was triggered. Otherwise returns 0. + */ TInt SendEndFullscreen(TBool aTimeout = EFalse); TInt SendAbortFullscreen(); TInt SendAbortControlTransition(); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -223,7 +223,7 @@ else { action = inStream.ReadUint32L(); -#ifdef _DEBUG +#ifdef _ALF_FXLOGGING PrintRequestInfo( op, action); #endif TRect effectRect( inStream.ReadInt32L(), @@ -247,13 +247,13 @@ } break; case MAlfGfxEffectPlugin::EEndFullscreen: -#ifdef _DEBUG +#ifdef _ALF_FXLOGGING PrintRequestInfo( op, action); #endif iEngine->EndFullscreen(EFalse); // not timeout, but official endfullscreen break; case MAlfGfxEffectPlugin::EAbortFullscreen: -#ifdef _DEBUG +#ifdef _ALF_FXLOGGING PrintRequestInfo( op, action); #endif @@ -272,7 +272,7 @@ // we have enough information. { action = inStream.ReadUint32L(); -#ifdef _DEBUG +#ifdef _ALF_FXLOGGING PrintRequestInfo( op, action); #endif @@ -298,7 +298,7 @@ case MAlfGfxEffectPlugin::ETfxServerOpAddFullscreenKMLEx: { action = inStream.ReadUint32L(); -#ifdef _DEBUG +#ifdef _ALF_FXLOGGING PrintRequestInfo( op, action); #endif @@ -873,7 +873,8 @@ __ALFFXLOGSTRING("CAlfGfxEffects::VerifyResourceLocation - return KErrNotSupported <<"); return KErrNotSupported; } -#ifdef _DEBUG + +#ifdef _ALF_FXLOGGING void CAlfGfxEffects::PrintRequestInfo(TInt aOperation, TInt aAction ) { HBufC16* buffer = HBufC16::NewL(256); diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -944,9 +944,10 @@ iFullScreenFinished = EFalse; iFullScreenTimeout->iIsStartEffect = EFalse; + if (triggerStartEffectTimeout) { - return KErrNone; + //return KErrNone; // even long app start effects need some hardcore timeout } if ( iAction == AknTransEffect::EApplicationExit /*|| iAction == 1001*/ ) @@ -958,7 +959,7 @@ { iFinishFullScreen->Start( KAlfLongEffectTimeout, TCallBack( FinishFullScreenTimeout, this ) ); } - return KErrNone; + return triggerStartEffectTimeout; } // --------------------------------------------------------------------------- diff -r 3a60ebea00d0 -r cd0ae4656946 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp Wed Jun 09 10:41:25 2010 +0300 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp Mon Jun 21 16:41:52 2010 +0300 @@ -173,8 +173,16 @@ } return CRestingState::NewL(iEngine,iHandler); case EEndFullscreen: - iEngine.SendEndFullscreen(); - return CPhase2State::NewL(iEngine,iHandler); + TInt triggeredLongStartEffect = iEngine.SendEndFullscreen(); + __ALFFXLOGSTRING1("CPhase1State::SignalL - Was long app start triggered? Stay in Phase1", triggeredLongStartEffect); + if (triggeredLongStartEffect) + { + return CPhase1State::NewL(iEngine,iHandler); + } + else + { + return CPhase2State::NewL(iEngine,iHandler); + } case EBeginFullscreen: if(!IsBlocked(iEngine.FromUid(),iEngine.ToUid())) {