taskswitcher/contextengine/tsfswserver/engine/src/tsfswengine.cpp
branchRCL_3
changeset 19 79311d856354
parent 18 d05a55b217df
child 23 7be2816dbabd
equal deleted inserted replaced
18:d05a55b217df 19:79311d856354
   170     if( iWidgetsSupported && 0 > aWgId )
   170     if( iWidgetsSupported && 0 > aWgId )
   171         {
   171         {
   172         // convert aWgId to an index in the list of running widgets and close widget
   172         // convert aWgId to an index in the list of running widgets and close widget
   173         CloseWidgetL( -aWgId -1 );
   173         CloseWidgetL( -aWgId -1 );
   174         }
   174         }
   175     else if( !iDataList->AlwaysShownApps()->IsAlwaysShownApp( AppUidForWgIdL( aWgId ) ) )
   175     else if( !iDataList->IsAlwaysShownAppL( aWgId ) )
   176         {
   176         {
   177         // send window group event to kill the app
   177         // send window group event to kill the app
   178         TWsEvent event;
   178         TWsEvent event;
   179         event.SetTimeNow();
   179         event.SetTimeNow();
   180         event.SetType( KAknShutOrHideApp );
   180         event.SetType( KAknShutOrHideApp );
   241     TSLOG_CONTEXT( UpdateTaskList, TSLOG_LOCAL );
   241     TSLOG_CONTEXT( UpdateTaskList, TSLOG_LOCAL );
   242     TSLOG_IN();
   242     TSLOG_IN();
   243 
   243 
   244     // There can be many calls in a row, use a timer to prevent degrading
   244     // There can be many calls in a row, use a timer to prevent degrading
   245     // device performance.
   245     // device performance.
       
   246     iDataList->SetDirty();
   246     if ( !iUpdateStarter->IsActive() )
   247     if ( !iUpdateStarter->IsActive() )
   247         {
   248         {
   248         iUpdateStarter->Start( KContentRefreshDelay, 0,
   249         iUpdateStarter->Start( KContentRefreshDelay, 0,
   249                 TCallBack( UpdateStarterCallback, this ) );
   250                 TCallBack( UpdateStarterCallback, this ) );
   250         }
   251         }
   251     iDataList->SetDirty();
       
   252 
   252 
   253     // screenshot taking support - call Register and Unregister when needed
   253     // screenshot taking support - call Register and Unregister when needed
   254     UpdatePreviewContent();
   254     UpdatePreviewContent();
   255 
   255 
   256     // get the foreground app uid and publish it to CFW if different than before
   256     // get the foreground app uid and publish it to CFW if different than before
   361 // --------------------------------------------------------------------------
   361 // --------------------------------------------------------------------------
   362 //
   362 //
   363 void CTsFswEngine::HiddenAppListUpdated()
   363 void CTsFswEngine::HiddenAppListUpdated()
   364     {
   364     {
   365     UpdateTaskList();
   365     UpdateTaskList();
   366     }
       
   367 
       
   368 // --------------------------------------------------------------------------
       
   369 // CTsFswEngine::AppUidForWgIdL
       
   370 // --------------------------------------------------------------------------
       
   371 //
       
   372 TUid CTsFswEngine::AppUidForWgIdL( TInt aWgId )
       
   373     {
       
   374     CApaWindowGroupName* windowName =
       
   375         CApaWindowGroupName::NewLC( iWsSession, aWgId );
       
   376     TUid appUid = windowName->AppUid();
       
   377     CleanupStack::PopAndDestroy( windowName );
       
   378     return appUid;
       
   379 
       
   380     }
   366     }
   381 
   367 
   382 // --------------------------------------------------------------------------
   368 // --------------------------------------------------------------------------
   383 // CTsFswEngine::CopyBitmapL
   369 // CTsFswEngine::CopyBitmapL
   384 // --------------------------------------------------------------------------
   370 // --------------------------------------------------------------------------
   494     {
   480     {
   495     TSLOG_CONTEXT( HandleFswPpApplicationChange, TSLOG_LOCAL );
   481     TSLOG_CONTEXT( HandleFswPpApplicationChange, TSLOG_LOCAL );
   496     TSLOG2_IN( "aWgId = %d aFbsHandle = %d", aWgId, aFbsHandle );
   482     TSLOG2_IN( "aWgId = %d aFbsHandle = %d", aWgId, aFbsHandle );
   497 
   483 
   498     TUid appUid;
   484     TUid appUid;
   499     TRAPD( err, appUid = AppUidForWgIdL( aWgId ) );
   485     TInt err = iDataList->AppUidForWgId( aWgId, appUid );
   500     if ( err || appUid == KTsCameraUid )
   486     if ( err || appUid == KTsCameraUid )
   501         {
   487         {
   502         // Dont't assign screenshot to camera app
   488         // Dont't assign screenshot to camera app
   503         TSLOG0( TSLOG_LOCAL, "Screenshot for camera - ignore" );
   489         TSLOG0( TSLOG_LOCAL, "Screenshot for camera - ignore" );
   504         iPreviewProvider->AckPreview(aFbsHandle);
   490         iPreviewProvider->AckPreview(aFbsHandle);
   509     CFbsBitmap* bmp = 0;
   495     CFbsBitmap* bmp = 0;
   510     TRAP( err, bmp = CopyBitmapL( aFbsHandle, EFalse ) );
   496     TRAP( err, bmp = CopyBitmapL( aFbsHandle, EFalse ) );
   511     iPreviewProvider->AckPreview(aFbsHandle);
   497     iPreviewProvider->AckPreview(aFbsHandle);
   512     if ( err == KErrNone )
   498     if ( err == KErrNone )
   513         {
   499         {
       
   500 		iDataList->MoveEntryAtStart(appUid.iUid, EFalse);
   514         StoreScreenshot(aWgId, bmp);
   501         StoreScreenshot(aWgId, bmp);
   515 		iDataList->MoveEntryAtStart(appUid.iUid, EFalse);
       
   516         }
   502         }
   517 
   503 
   518     TSLOG_OUT();
   504     TSLOG_OUT();
   519     }
   505     }
   520 
   506 
   765 // --------------------------------------------------------------------------
   751 // --------------------------------------------------------------------------
   766 //
   752 //
   767 void CTsFswEngine::HandleWidgetUpdateL(TInt aWidgetId, TInt aBitmapHandle)
   753 void CTsFswEngine::HandleWidgetUpdateL(TInt aWidgetId, TInt aBitmapHandle)
   768     {
   754     {
   769 	TSLOG_CONTEXT( HandleWidgetUpdateL, TSLOG_LOCAL );
   755 	TSLOG_CONTEXT( HandleWidgetUpdateL, TSLOG_LOCAL );
   770     CFbsBitmap* bmp = 0;
   756     
       
   757 	iDataList->MoveEntryAtStart(aWidgetId, ETrue);
       
   758     
       
   759 	CFbsBitmap* bmp = 0;
   771     TBool contentChanged(EFalse); 
   760     TBool contentChanged(EFalse); 
   772     if( aBitmapHandle )
   761     if( aBitmapHandle )
   773     	{
   762     	{
   774 		TRAPD( err, bmp = CopyBitmapL( aBitmapHandle, EFalse ) );
   763 		TRAPD( err, bmp = CopyBitmapL( aBitmapHandle, EFalse ) );
   775 		if ( err == KErrNone )
   764 		if ( err == KErrNone )
   780 	if(!contentChanged)
   769 	if(!contentChanged)
   781 		{
   770 		{
   782 		iObserver.FswDataChanged();
   771 		iObserver.FswDataChanged();
   783 		}
   772 		}
   784  
   773  
   785     iDataList->MoveEntryAtStart(aWidgetId, ETrue);
       
   786     TSLOG_OUT();
   774     TSLOG_OUT();
   787     }
   775     }
   788 
   776 
   789 // --------------------------------------------------------------------------
   777 // --------------------------------------------------------------------------
   790 // CTsRotationListener::CTsRotationListener
   778 // CTsRotationListener::CTsRotationListener