128 iSwiProp.Close(); |
130 iSwiProp.Close(); |
129 |
131 |
130 delete iUpdateStarter; |
132 delete iUpdateStarter; |
131 delete iPreviewProvider; |
133 delete iPreviewProvider; |
132 |
134 |
133 // delete the bitmaps as the hash map cannot do that |
|
134 THashMapIter<TInt, CFbsBitmap*> iter( iScreenshots ); |
|
135 while ( const TInt* key = iter.NextKey() ) |
|
136 { |
|
137 CFbsBitmap** value = iter.CurrentValue(); |
|
138 delete *value; |
|
139 } |
|
140 iScreenshots.Close(); |
|
141 delete iAppIcons; |
|
142 |
|
143 iData.ResetAndDestroy(); |
|
144 iWgIds.Close(); |
135 iWgIds.Close(); |
145 |
136 |
146 delete iHiddenAppList; |
|
147 delete iAlwaysShownAppList; |
|
148 delete iWidgetList; |
|
149 iAppArcSession.Close(); |
137 iAppArcSession.Close(); |
150 iWsSession.Close(); |
138 iWsSession.Close(); |
151 |
139 |
152 for ( TInt i = 0; i < iRotaTasks.Count(); i++ ) |
140 for ( TInt i = 0; i < iRotaTasks.Count(); i++ ) |
153 { |
141 { |
154 iRotaTasks[i]->Cancel(); |
142 iRotaTasks[i]->Cancel(); |
155 delete iRotaTasks[i]; |
143 delete iRotaTasks[i]; |
156 } |
144 } |
157 iRotaTasks.Close(); |
145 iRotaTasks.Close(); |
158 // delete iContextUtility; |
146 delete iDataList; |
|
147 delete iCpsWidgetPublisher; |
159 } |
148 } |
160 |
149 |
161 // -------------------------------------------------------------------------- |
150 // -------------------------------------------------------------------------- |
162 // CTsFswEngine::FswDataL |
151 // CTsFswEngine::FswDataL |
163 // -------------------------------------------------------------------------- |
152 // -------------------------------------------------------------------------- |
164 // |
153 // |
165 EXPORT_C const RTsFswArray& CTsFswEngine::FswDataL() |
154 EXPORT_C const RTsFswArray& CTsFswEngine::FswDataL() |
166 { |
155 { |
167 TSLOG_CONTEXT( FswDataL, TSLOG_LOCAL ); |
156 TSLOG_CONTEXT( FswDataL, TSLOG_LOCAL ); |
168 TSLOG1_IN( "dirty flag = %d", iTaskListDirty ); |
157 TSLOG_OUT(); |
169 |
158 return iDataList->FswDataL(); |
170 // check the dirty flag and refresh if needed |
|
171 if ( iTaskListDirty ) |
|
172 { |
|
173 CollectTasksL(); |
|
174 // dirty flag is cleared in the above call |
|
175 } |
|
176 |
|
177 // Get app icon for entries without screenshot, |
|
178 // do this only here as the app icon is not needed in case a screenshot |
|
179 // is already available. |
|
180 for ( TInt i = 0, ie = iData.Count(); i != ie; ++i ) |
|
181 { |
|
182 if ( !iData[i]->ScreenshotHandle() ) |
|
183 { |
|
184 CFbsBitmap* bmp; |
|
185 CFbsBitmap* mask; |
|
186 TUid appUid = iData[i]->AppUid(); |
|
187 // this will leave with -46 in case of widgets if we do not have AllFiles cap |
|
188 TRAPD( err, iAppIcons->GetIconL( appUid, bmp, mask ) ); |
|
189 if ( err == KErrNone && bmp ) |
|
190 { |
|
191 iData[i]->SetAppIconHandles( bmp->Handle(), |
|
192 mask ? mask->Handle() : 0 ); |
|
193 } |
|
194 else |
|
195 { |
|
196 iAppIcons->DefaultIcon( bmp, mask ); |
|
197 iData[i]->SetAppIconHandles( bmp->Handle(), |
|
198 mask ? mask->Handle() : 0 ); |
|
199 } |
|
200 } |
|
201 } |
|
202 |
|
203 TSLOG_OUT(); |
|
204 return iData; |
|
205 } |
159 } |
206 |
160 |
207 // -------------------------------------------------------------------------- |
161 // -------------------------------------------------------------------------- |
208 // CTsFswEngine::CloseAppL |
162 // CTsFswEngine::CloseAppL |
209 // -------------------------------------------------------------------------- |
163 // -------------------------------------------------------------------------- |
288 void CTsFswEngine::UpdateTaskList() |
239 void CTsFswEngine::UpdateTaskList() |
289 { |
240 { |
290 TSLOG_CONTEXT( UpdateTaskList, TSLOG_LOCAL ); |
241 TSLOG_CONTEXT( UpdateTaskList, TSLOG_LOCAL ); |
291 TSLOG_IN(); |
242 TSLOG_IN(); |
292 |
243 |
293 // If no clients are subscribed for fsw content change notifications |
244 // There can be many calls in a row, use a timer to prevent degrading |
294 // then there is no need to waste time with rebuilding the task list, |
245 // device performance. |
295 // just set the dirty flag. |
246 if ( !iUpdateStarter->IsActive() ) |
296 TInt listenerCount = iObserver.FswDataListenerCount(); |
247 { |
297 TSLOG1( TSLOG_INFO, "listener count = %d", listenerCount ); |
248 iUpdateStarter->Start( KContentRefreshDelay, 0, |
298 if ( listenerCount > 0 ) |
|
299 { |
|
300 // There can be many calls in a row, use a timer to prevent degrading |
|
301 // device performance. |
|
302 if ( !iUpdateStarter->IsActive() ) |
|
303 { |
|
304 iUpdateStarter->Start( KContentRefreshDelay, 0, |
|
305 TCallBack( UpdateStarterCallback, this ) ); |
249 TCallBack( UpdateStarterCallback, this ) ); |
306 } |
250 } |
307 } |
251 iDataList->SetDirty(); |
308 else |
|
309 { |
|
310 iTaskListDirty = ETrue; |
|
311 } |
|
312 |
252 |
313 // screenshot taking support - call Register and Unregister when needed |
253 // screenshot taking support - call Register and Unregister when needed |
314 UpdatePreviewContent(); |
254 UpdatePreviewContent(); |
315 |
255 |
316 // 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 |
408 // -------------------------------------------------------------------------- |
348 // -------------------------------------------------------------------------- |
409 // |
349 // |
410 TBool CTsFswEngine::CollectTasksL() |
350 TBool CTsFswEngine::CollectTasksL() |
411 { |
351 { |
412 TSLOG_CONTEXT( CollectTasksL, TSLOG_LOCAL ); |
352 TSLOG_CONTEXT( CollectTasksL, TSLOG_LOCAL ); |
413 TSLOG_IN(); |
353 TBool changed = iDataList->CollectTasksL(); |
414 |
|
415 // clear dirty flag |
|
416 iTaskListDirty = EFalse; |
|
417 |
|
418 TBool changed = EFalse; |
|
419 RTsFswArray newList; |
|
420 CleanupResetAndDestroyPushL( newList ); |
|
421 |
|
422 // update app data if needed |
|
423 // (usually on startup and when new apps might have been installed) |
|
424 if ( iAppDataRefreshNeeded ) |
|
425 { |
|
426 TSLOG0( TSLOG_INFO, "refreshing app data" ); |
|
427 iAppArcSession.GetAllApps(); |
|
428 iAlwaysShownAppList->InitializeAlwaysShownListL(); |
|
429 iAppDataRefreshNeeded = EFalse; |
|
430 } |
|
431 |
|
432 // get all window groups |
|
433 RArray<RWsSession::TWindowGroupChainInfo> allWgIds; |
|
434 CleanupClosePushL( allWgIds ); |
|
435 User::LeaveIfError( iWsSession.WindowGroupList( 0, &allWgIds ) ); |
|
436 TInt count = allWgIds.Count(); |
|
437 |
|
438 for ( TInt i = 0; i < count; ++i ) |
|
439 { |
|
440 // ignore uninteresting entries (e.g. embedded apps) |
|
441 if ( allWgIds[i].iParentId > 0 ) |
|
442 { |
|
443 continue; |
|
444 } |
|
445 |
|
446 // get window group name |
|
447 TInt wgId = allWgIds[i].iId; |
|
448 CApaWindowGroupName* windowName = |
|
449 CApaWindowGroupName::NewLC( iWsSession, wgId ); |
|
450 TUid appUid = windowName->AppUid(); |
|
451 |
|
452 // ignore entries with null uid |
|
453 if ( !appUid.iUid ) |
|
454 { |
|
455 CleanupStack::PopAndDestroy( windowName ); |
|
456 continue; |
|
457 } |
|
458 |
|
459 // will append the task to our own list only if it is not hidden |
|
460 TBool onHiddenList = iHiddenAppList->IsHiddenL( |
|
461 appUid, iWsSession, wgId ); |
|
462 |
|
463 // get screen number (-1=console, 0=main screen, 1=cover ui) |
|
464 TInt appScreen = 0; |
|
465 TInt scrNumErr = iAppArcSession.GetDefaultScreenNumber( appScreen, appUid ); |
|
466 |
|
467 // check if it is on always-shown list |
|
468 TBool mustShow = iAlwaysShownAppList->IsAlwaysShownApp( appUid ); |
|
469 |
|
470 #ifdef _DEBUG |
|
471 const TDesC& captionDbg( windowName->Caption() ); |
|
472 TSLOG4( TSLOG_INFO, "[%d] wgid=%d appuid=%x (%S)", i, wgId, |
|
473 appUid.iUid, &captionDbg ); |
|
474 TSLOG4( TSLOG_INFO, "hidden=%d onhiddenlist=%d mustshow=%d scrno=%d", |
|
475 windowName->Hidden(), onHiddenList, mustShow, appScreen ); |
|
476 #endif |
|
477 |
|
478 // if this is the widget app then save wgid for later use |
|
479 // and ignore it, but include running widgets instead |
|
480 if ( iWidgetsSupported && appUid.iUid == KWidgetAppUidValue ) |
|
481 { |
|
482 changed = ETrue; |
|
483 } |
|
484 // add item to task list if it is always-shown OR it is not hidden |
|
485 // and it is not on cover ui |
|
486 else if ( mustShow |
|
487 || ( !onHiddenList |
|
488 && !windowName->Hidden() |
|
489 && ( appScreen == 0 || appScreen == -1 ) |
|
490 && scrNumErr == KErrNone ) ) |
|
491 { |
|
492 if ( AddEntryL( wgId, appUid, windowName, newList, EFalse ) ) |
|
493 { |
|
494 changed = ETrue; |
|
495 } |
|
496 } |
|
497 CleanupStack::PopAndDestroy( windowName ); |
|
498 } |
|
499 CleanupStack::PopAndDestroy( &allWgIds ); |
|
500 CheckWidgetsL(newList); |
|
501 |
|
502 // if counts for old and new lists do not match then there is a change for sure, |
|
503 // probably an app has been closed |
|
504 if ( iData.Count() != newList.Count() ) |
|
505 { |
|
506 changed = ETrue; |
|
507 } |
|
508 |
|
509 // move pointers from the temporary list into the real one |
|
510 iData.ResetAndDestroy(); |
|
511 TInt newListCount = newList.Count(); |
|
512 TSLOG1( TSLOG_INFO, "new list count = %d", newListCount ); |
|
513 for ( TInt i = 0; i < newListCount; ++i ) |
|
514 { |
|
515 TSLOG3( TSLOG_INFO, "[%d] %S wgid=%d", |
|
516 i, &newList[i]->AppName(), newList[i]->WgId() ); |
|
517 iData.AppendL( newList[i] ); |
|
518 newList[i] = 0; |
|
519 } |
|
520 CleanupStack::PopAndDestroy( &newList ); |
|
521 |
|
522 TSLOG1_OUT( "change flag = %d", changed ); |
354 TSLOG1_OUT( "change flag = %d", changed ); |
523 return changed; |
355 return changed; |
524 } |
356 } |
525 |
357 |
526 // -------------------------------------------------------------------------- |
358 |
527 // CTsFswEngine::AddEntryL |
|
528 // -------------------------------------------------------------------------- |
|
529 // |
|
530 TBool CTsFswEngine::AddEntryL( TInt aWgId, const TUid& aAppUid, |
|
531 CApaWindowGroupName* aWgName, RTsFswArray& aNewList, |
|
532 TBool aIsWidget ) |
|
533 { |
|
534 TBool changed = EFalse; |
|
535 CTsFswEntry* entry = CTsFswEntry::NewLC(); |
|
536 entry->SetWgId( aWgId ); |
|
537 entry->SetAppUid( aAppUid ); |
|
538 entry->SetWidget( aIsWidget ); |
|
539 |
|
540 // check if present in old list and if yes then take some of the old data |
|
541 TBool found = CheckIfExistsL( *entry, aAppUid, changed, aNewList ); |
|
542 |
|
543 // if not present previously then find out app name |
|
544 // and check if screenshot is already available |
|
545 if ( !found ) |
|
546 { |
|
547 // when adding a new entry to the list it is changed for sure |
|
548 changed = ETrue; |
|
549 HBufC* name = FindAppNameLC( aWgName, aAppUid, aWgId ); |
|
550 if ( name ) |
|
551 { |
|
552 entry->SetAppNameL( *name ); |
|
553 } |
|
554 CleanupStack::PopAndDestroy( name ); |
|
555 TInt h = LookupScreenshotHandle( aWgId ); |
|
556 if ( h ) |
|
557 { |
|
558 entry->SetScreenshotHandle( h ); |
|
559 } |
|
560 entry->SetAlwaysShown( iAlwaysShownAppList->IsAlwaysShownApp( aAppUid ) ); |
|
561 if ( aWgName ) |
|
562 { |
|
563 entry->SetSystemApp( aWgName->IsSystem() ); |
|
564 } |
|
565 } |
|
566 |
|
567 // add to new list, ownership is transferred |
|
568 aNewList.AppendL( entry ); |
|
569 CleanupStack::Pop( entry ); |
|
570 return changed; |
|
571 } |
|
572 |
|
573 // -------------------------------------------------------------------------- |
|
574 // CTsFswEngine::CheckIfExistsL |
|
575 // -------------------------------------------------------------------------- |
|
576 // |
|
577 TBool CTsFswEngine::CheckIfExistsL( CTsFswEntry& aEntry, |
|
578 const TUid& aAppUid, |
|
579 TBool& aChanged, |
|
580 RTsFswArray& aNewList ) |
|
581 { |
|
582 for ( TInt entryIdx = 0, oldCount = iData.Count(); |
|
583 entryIdx < oldCount; ++entryIdx ) |
|
584 { |
|
585 // Enough to check appuid, no need to bother with wgid as the |
|
586 // screenshot handle is up-to-date or will be updated later anyway. |
|
587 if ( iData[entryIdx]->AppUid() == aAppUid ) |
|
588 { |
|
589 // if positions do not match then the list is different than before |
|
590 if ( entryIdx != aNewList.Count() ) |
|
591 { |
|
592 aChanged = ETrue; |
|
593 } |
|
594 CTsFswEntry* oldEntry = iData[entryIdx]; |
|
595 aEntry.SetAppNameL( oldEntry->AppName() ); |
|
596 aEntry.SetScreenshotHandle( oldEntry->ScreenshotHandle() ); |
|
597 aEntry.SetAlwaysShown( oldEntry->AlwaysShown() ); |
|
598 aEntry.SetSystemApp( oldEntry->SystemApp() ); |
|
599 return ETrue; |
|
600 } |
|
601 } |
|
602 return EFalse; |
|
603 } |
|
604 |
|
605 // -------------------------------------------------------------------------- |
|
606 // CTsFswEngine::CheckWidgetsL |
|
607 // -------------------------------------------------------------------------- |
|
608 // |
|
609 void CTsFswEngine::CheckWidgetsL( RTsFswArray& aNewList ) |
|
610 { |
|
611 if( iWidgetsSupported ) |
|
612 { |
|
613 iWidgetList->InitializeWidgetListL(); |
|
614 const RWidgetInfoArray& arr( iWidgetList->RunningWidgets() ); |
|
615 for ( TInt i = 0, ie = arr.Count(); i != ie; ++i ) |
|
616 { |
|
617 //verify if widget is working in full screen mode |
|
618 if( arr[i]->iFileSize ) |
|
619 { |
|
620 // wgid will be a special negative value |
|
621 // windowgroupname is not needed here so pass NULL |
|
622 AddEntryL( -(i+1), arr[i]->iUid, 0, aNewList, ETrue ); |
|
623 } |
|
624 } |
|
625 } |
|
626 } |
|
627 |
|
628 // -------------------------------------------------------------------------- |
|
629 // CTsFswEngine::HiddenAppListUpdated |
359 // CTsFswEngine::HiddenAppListUpdated |
630 // Callback from the hidden app list watcher |
360 // Callback from the hidden app list watcher |
631 // -------------------------------------------------------------------------- |
361 // -------------------------------------------------------------------------- |
632 // |
362 // |
633 void CTsFswEngine::HiddenAppListUpdated() |
363 void CTsFswEngine::HiddenAppListUpdated() |
644 CApaWindowGroupName* windowName = |
374 CApaWindowGroupName* windowName = |
645 CApaWindowGroupName::NewLC( iWsSession, aWgId ); |
375 CApaWindowGroupName::NewLC( iWsSession, aWgId ); |
646 TUid appUid = windowName->AppUid(); |
376 TUid appUid = windowName->AppUid(); |
647 CleanupStack::PopAndDestroy( windowName ); |
377 CleanupStack::PopAndDestroy( windowName ); |
648 return appUid; |
378 return appUid; |
649 } |
379 |
650 |
|
651 // -------------------------------------------------------------------------- |
|
652 // CTsFswEngine::FindParentWgId |
|
653 // -------------------------------------------------------------------------- |
|
654 // |
|
655 TInt CTsFswEngine::FindParentWgId( TInt aWgId ) |
|
656 { |
|
657 TInt parent( KErrNotFound ); |
|
658 RArray<RWsSession::TWindowGroupChainInfo> allWgIds; |
|
659 // Ask for window group list from RWsSession |
|
660 TInt error = iWsSession.WindowGroupList( 0, &allWgIds ); |
|
661 if ( !error ) |
|
662 { |
|
663 TInt count( allWgIds.Count() ); |
|
664 for ( TInt i( 0 ); i < count; i++ ) |
|
665 { |
|
666 RWsSession::TWindowGroupChainInfo info = allWgIds[i]; |
|
667 if ( info.iId == aWgId && info.iParentId > 0) |
|
668 { |
|
669 parent = info.iParentId; |
|
670 break; |
|
671 } |
|
672 } |
|
673 } |
|
674 allWgIds.Close(); |
|
675 return parent; |
|
676 } |
|
677 |
|
678 // -------------------------------------------------------------------------- |
|
679 // CTsFswEngine::FindMostTopParentWgId |
|
680 // -------------------------------------------------------------------------- |
|
681 // |
|
682 TInt CTsFswEngine::FindMostTopParentWgId( TInt aWgId ) |
|
683 { |
|
684 TInt parent( KErrNotFound ); |
|
685 parent = FindParentWgId( aWgId ); |
|
686 if( parent != KErrNotFound) |
|
687 { |
|
688 TInt topParent = FindMostTopParentWgId(parent); |
|
689 if( topParent != KErrNotFound ) |
|
690 { |
|
691 parent = topParent; |
|
692 } |
|
693 } |
|
694 return parent; |
|
695 } |
380 } |
696 |
381 |
697 // -------------------------------------------------------------------------- |
382 // -------------------------------------------------------------------------- |
698 // CTsFswEngine::FindAppNameLC |
383 // CTsFswEngine::FindAppNameLC |
699 // -------------------------------------------------------------------------- |
384 // -------------------------------------------------------------------------- |
966 iRotaTasks.Remove(idx); |
646 iRotaTasks.Remove(idx); |
967 } |
647 } |
968 |
648 |
969 if ( aError == KErrNone ) |
649 if ( aError == KErrNone ) |
970 { |
650 { |
971 if ( iScreenshots.Insert( aWgId, aBitmap ) != KErrNone ) |
651 StoreScreenshot(aWgId, aBitmap); |
972 { |
|
973 delete aBitmap; |
|
974 iScreenshots.Remove( aWgId ); |
|
975 AssignScreenshotHandle( aWgId, 0 ); |
|
976 } |
|
977 else |
|
978 { |
|
979 AssignScreenshotHandle( aWgId, aBitmap->Handle() ); |
|
980 } |
|
981 } |
652 } |
982 else |
653 else |
983 { |
654 { |
984 // Rotation failed, cleanup bitmap |
655 // Rotation failed, cleanup bitmap |
985 delete aBitmap; |
656 delete aBitmap; |
986 } |
657 } |
987 |
658 |
988 TSLOG_OUT(); |
659 TSLOG_OUT(); |
989 } |
|
990 |
|
991 |
|
992 // -------------------------------------------------------------------------- |
|
993 // CTsFswEngine::AssignScreenshotHandle |
|
994 // Called when a screenshot arrives to check if there is a corresponding |
|
995 // application in the task list. Firstly try to match screenshot into parental |
|
996 // application then into standalone one. |
|
997 // -------------------------------------------------------------------------- |
|
998 // |
|
999 void CTsFswEngine::AssignScreenshotHandle( TInt aWgIdForScreenshot, |
|
1000 TInt aBitmapHandle ) |
|
1001 { |
|
1002 TBool changed = EFalse; |
|
1003 TInt parentWgId = FindMostTopParentWgId( aWgIdForScreenshot ); |
|
1004 // now parentWgId is a valid wgid or KErrNotFound (-1) |
|
1005 if (parentWgId != KErrNotFound) |
|
1006 { |
|
1007 AssignScreenshotHandle( parentWgId, aBitmapHandle, changed ); |
|
1008 } |
|
1009 if (!changed) |
|
1010 { |
|
1011 AssignScreenshotHandle( aWgIdForScreenshot, aBitmapHandle, changed ); |
|
1012 } |
|
1013 if ( changed ) |
|
1014 { |
|
1015 iObserver.FswDataChanged(); |
|
1016 } |
|
1017 } |
|
1018 |
|
1019 // -------------------------------------------------------------------------- |
|
1020 // CTsFswEngine::AssignScreenshotHandle |
|
1021 // Called when a screenshot arrives to check if there is a corresponding |
|
1022 // application in the task list. It might be tried to be match into parental |
|
1023 // or standalone application. |
|
1024 // -------------------------------------------------------------------------- |
|
1025 // |
|
1026 void CTsFswEngine::AssignScreenshotHandle(TInt aWgIdForScreenshot, |
|
1027 TInt aBitmapHandle, TBool& aAsigned) |
|
1028 { |
|
1029 aAsigned = EFalse; |
|
1030 for (TInt i = 0, ie = iData.Count(); i != ie; ++i) |
|
1031 { |
|
1032 if (iData[i]->Widget()) |
|
1033 { |
|
1034 // Do not do anything for now => no screenshot for widgets. |
|
1035 continue; |
|
1036 } |
|
1037 TInt appWgId = iData[i]->WgId(); |
|
1038 if (appWgId == aWgIdForScreenshot) |
|
1039 { |
|
1040 iData[i]->SetScreenshotHandle(aBitmapHandle); |
|
1041 aAsigned = ETrue; |
|
1042 break; |
|
1043 } |
|
1044 } |
|
1045 } |
|
1046 |
|
1047 // -------------------------------------------------------------------------- |
|
1048 // CTsFswEngine::LookupScreenshotHandle |
|
1049 // Called to check if there is a screenshot already stored for the given |
|
1050 // app. (or a screenshot with a wgid for which aWgIdForApp is the parent) |
|
1051 // -------------------------------------------------------------------------- |
|
1052 // |
|
1053 TInt CTsFswEngine::LookupScreenshotHandle( TInt aWgIdForApp ) |
|
1054 { |
|
1055 CFbsBitmap** bmp = iScreenshots.Find( aWgIdForApp ); |
|
1056 if ( bmp ) |
|
1057 { |
|
1058 // there is a screenshot stored for this wgid |
|
1059 return (*bmp)->Handle(); |
|
1060 } |
|
1061 else if ( aWgIdForApp > 0 ) |
|
1062 { |
|
1063 // must check if there is a screenshot for which aWgIdForApp is the parent |
|
1064 THashMapIter<TInt, CFbsBitmap*> iter( iScreenshots ); |
|
1065 while ( const TInt* wgid = iter.NextKey() ) |
|
1066 { |
|
1067 if ( FindParentWgId( *wgid ) == aWgIdForApp ) |
|
1068 { |
|
1069 CFbsBitmap** bmp = iter.CurrentValue(); |
|
1070 return (*bmp)->Handle(); |
|
1071 } |
|
1072 } |
|
1073 } |
|
1074 else if ( aWgIdForApp < 0 ) |
|
1075 { |
|
1076 // Must be a widget, wgid is useless in this case. |
|
1077 // Do not do anything for now => no screenshot for widgets. |
|
1078 } |
|
1079 return 0; |
|
1080 } |
660 } |
1081 |
661 |
1082 // -------------------------------------------------------------------------- |
662 // -------------------------------------------------------------------------- |
1083 // CTsFswEngine::RunL |
663 // CTsFswEngine::RunL |
1084 // -------------------------------------------------------------------------- |
664 // -------------------------------------------------------------------------- |
1183 stream.WriteInt32L ( KCloseWidgetCmd ); |
760 stream.WriteInt32L ( KCloseWidgetCmd ); |
1184 CleanupStack::PopAndDestroy( &stream ); |
761 CleanupStack::PopAndDestroy( &stream ); |
1185 cmdLine->SetCommandL( EApaCommandBackgroundAndWithoutViews ); |
762 cmdLine->SetCommandL( EApaCommandBackgroundAndWithoutViews ); |
1186 cmdLine->SetOpaqueDataL( *opaque ); |
763 cmdLine->SetOpaqueDataL( *opaque ); |
1187 CleanupStack::PopAndDestroy( opaque ); |
764 CleanupStack::PopAndDestroy( opaque ); |
1188 cmdLine->SetExecutableNameL( KWidgetAppName ); |
765 |
1189 ls.StartApp( *cmdLine ); |
766 if (iDataList->Widgets()->IsCWRTWidget(widgetInfo->iUid)) |
|
767 { |
|
768 cmdLine->SetExecutableNameL( KWidgetAppNameWgt); |
|
769 } |
|
770 else |
|
771 { |
|
772 cmdLine->SetExecutableNameL( KWidgetAppName ); |
|
773 } |
|
774 |
|
775 iAppArcSession.StartApp( *cmdLine ); |
1190 CleanupStack::PopAndDestroy( cmdLine ); |
776 CleanupStack::PopAndDestroy( cmdLine ); |
1191 CleanupStack::PopAndDestroy( &ls ); |
777 TSLOG_OUT(); |
1192 TSLOG_OUT(); |
778 } |
1193 } |
779 |
1194 |
780 // -------------------------------------------------------------------------- |
1195 |
781 // CTsFswEngine::StoreScreenshot |
|
782 // -------------------------------------------------------------------------- |
|
783 // |
|
784 TBool CTsFswEngine::StoreScreenshot(TInt aWgId, CFbsBitmap* aBmp) |
|
785 { |
|
786 TSLOG_CONTEXT( StoreScreenshot, TSLOG_LOCAL ); |
|
787 //iDataList would take ownership |
|
788 TBool change = EFalse; |
|
789 change = iDataList->StoreScreenshot(aWgId, aBmp); |
|
790 if(change) |
|
791 { |
|
792 iObserver.FswDataChanged(); |
|
793 } |
|
794 TSLOG1_OUT( "Screenshot for = %d", aWgId ); |
|
795 return change; |
|
796 } |
|
797 |
|
798 // -------------------------------------------------------------------------- |
|
799 // CTsFswEngine::RemoveScreenshot() |
|
800 // -------------------------------------------------------------------------- |
|
801 // |
|
802 void CTsFswEngine::RemoveScreenshot(TInt aWgId) |
|
803 { |
|
804 TBool change = EFalse; |
|
805 change = iDataList->RemoveScreenshot(aWgId); |
|
806 if( change ) |
|
807 { |
|
808 iObserver.FswDataChanged(); |
|
809 } |
|
810 } |
|
811 |
|
812 // -------------------------------------------------------------------------- |
|
813 // CTsFswEngine::HandleWidgetUpdateL() |
|
814 // -------------------------------------------------------------------------- |
|
815 // |
|
816 void CTsFswEngine::HandleWidgetUpdateL(TInt aWidgetId, TInt aBitmapHandle) |
|
817 { |
|
818 TSLOG_CONTEXT( HandleWidgetUpdateL, TSLOG_LOCAL ); |
|
819 CFbsBitmap* bmp = 0; |
|
820 TBool contentChanged(EFalse); |
|
821 if( aBitmapHandle ) |
|
822 { |
|
823 TRAPD( err, bmp = CopyBitmapL( aBitmapHandle, EFalse ) ); |
|
824 if ( err == KErrNone ) |
|
825 { |
|
826 contentChanged = StoreScreenshot(aWidgetId, bmp); |
|
827 } |
|
828 } |
|
829 if(!contentChanged) |
|
830 { |
|
831 iObserver.FswDataChanged(); |
|
832 } |
|
833 |
|
834 iDataList->MoveEntryAtStart(aWidgetId, ETrue); |
|
835 TSLOG_OUT(); |
|
836 } |
1196 |
837 |
1197 // -------------------------------------------------------------------------- |
838 // -------------------------------------------------------------------------- |
1198 // CTsRotationListener::CTsRotationListener |
839 // CTsRotationListener::CTsRotationListener |
1199 // -------------------------------------------------------------------------- |
840 // -------------------------------------------------------------------------- |
1200 // |
841 // |