equal
deleted
inserted
replaced
14 * Description: View Manager |
14 * Description: View Manager |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 // System includes |
18 // System includes |
|
19 #include <startupdomainpskeys.h> |
19 #include <AknUtils.h> |
20 #include <AknUtils.h> |
20 #include <AknsWallpaperUtils.h> |
21 #include <AknsWallpaperUtils.h> |
21 #include <AknSkinsInternalCRKeys.h> |
22 #include <AknSkinsInternalCRKeys.h> |
22 #include <StringLoader.h> |
23 #include <StringLoader.h> |
23 #include <xnuiengine.rsg> |
24 #include <xnuiengine.rsg> |
24 #include <aknnotewrappers.h> |
25 #include <aknnotewrappers.h> |
25 #include <AknsConstants.h> |
26 #include <AknsConstants.h> |
|
27 #include <aifwdefs.h> |
26 |
28 |
27 // User includes |
29 // User includes |
28 #include "xnapplication.h" |
30 #include "xnapplication.h" |
29 #include "xnuiengine.h" |
31 #include "xnuiengine.h" |
30 #include "xnproperty.h" |
32 #include "xnproperty.h" |
58 |
60 |
59 const TInt KPSCategoryUid = 0x200286E3; |
61 const TInt KPSCategoryUid = 0x200286E3; |
60 const TInt KPSCrashCountKey = 1; |
62 const TInt KPSCrashCountKey = 1; |
61 const TInt KStabilityInterval = 60000000; // 1 minute |
63 const TInt KStabilityInterval = 60000000; // 1 minute |
62 const TInt KCrashRestoreThreshold = 3; |
64 const TInt KCrashRestoreThreshold = 3; |
|
65 |
63 // ============================ LOCAL FUNCTIONS =============================== |
66 // ============================ LOCAL FUNCTIONS =============================== |
64 // ----------------------------------------------------------------------------- |
67 // ----------------------------------------------------------------------------- |
65 // BuildTriggerL |
68 // BuildTriggerL |
66 // Builds a trigger node |
69 // Builds a trigger node |
67 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
270 // C++ default destructor. |
273 // C++ default destructor. |
271 // ----------------------------------------------------------------------------- |
274 // ----------------------------------------------------------------------------- |
272 // |
275 // |
273 CXnViewManager::~CXnViewManager() |
276 CXnViewManager::~CXnViewManager() |
274 { |
277 { |
|
278 delete iUiStartupPhase; |
|
279 |
275 if( iStabilityTimer ) |
280 if( iStabilityTimer ) |
276 { |
281 { |
277 iStabilityTimer->Cancel(); |
282 iStabilityTimer->Cancel(); |
278 delete iStabilityTimer; |
283 delete iStabilityTimer; |
279 iStabilityTimer = NULL; |
284 iStabilityTimer = NULL; |
299 delete iEditor; |
304 delete iEditor; |
300 delete iOomSysHandler; |
305 delete iOomSysHandler; |
301 } |
306 } |
302 |
307 |
303 // ----------------------------------------------------------------------------- |
308 // ----------------------------------------------------------------------------- |
|
309 // CXnViewManager::PropertyChangedL() |
|
310 // |
|
311 // ----------------------------------------------------------------------------- |
|
312 // |
|
313 void CXnViewManager::PropertyChangedL( const TUint32 aKey, const TInt aValue ) |
|
314 { |
|
315 if ( aKey == KPSStartupUiPhase && aValue == EStartupUiPhaseAllDone ) |
|
316 { |
|
317 if ( iRootData ) |
|
318 { |
|
319 iRootData->LoadRemainingViews(); |
|
320 } |
|
321 } |
|
322 } |
|
323 |
|
324 // ----------------------------------------------------------------------------- |
304 // CXnViewManager::ConstructL() |
325 // CXnViewManager::ConstructL() |
305 // 2nd phase constructor |
326 // 2nd phase constructor |
306 // ----------------------------------------------------------------------------- |
327 // ----------------------------------------------------------------------------- |
307 // |
328 // |
308 void CXnViewManager::ConstructL() |
329 void CXnViewManager::ConstructL() |
309 { |
330 { |
310 iOomSysHandler = CXnOomSysHandler::NewL(); |
331 iOomSysHandler = CXnOomSysHandler::NewL(); |
311 |
332 |
312 // Create resource list |
333 // Create resource list |
313 iResources = new ( ELeave ) CArrayPtrSeg< CXnResource > ( 16 ); |
334 iResources = new ( ELeave ) CArrayPtrSeg< CXnResource > ( 16 ); |
314 |
335 |
362 |
383 |
363 // Load root configuration and initial view. |
384 // Load root configuration and initial view. |
364 iRootData->Load(); |
385 iRootData->Load(); |
365 |
386 |
366 CleanupStack::PopAndDestroy(); // DisableRenderUiLC(); |
387 CleanupStack::PopAndDestroy(); // DisableRenderUiLC(); |
|
388 |
|
389 // Determine UI startup phase |
|
390 delete iUiStartupPhase; |
|
391 iUiStartupPhase = NULL; |
|
392 |
|
393 iUiStartupPhase = CXnPropertySubscriber::NewL( |
|
394 KPSUidStartup, KPSStartupUiPhase, *this ); |
367 } |
395 } |
368 |
396 |
369 // ----------------------------------------------------------------------------- |
397 // ----------------------------------------------------------------------------- |
370 // CXnViewManager::ReloadUiL() |
398 // CXnViewManager::ReloadUiL() |
371 // Reloads the application UI and initial ivew |
399 // Reloads the application UI and initial ivew |
402 |
430 |
403 // ----------------------------------------------------------------------------- |
431 // ----------------------------------------------------------------------------- |
404 // CXnViewManager::LoadWidgetToPluginL() |
432 // CXnViewManager::LoadWidgetToPluginL() |
405 // ----------------------------------------------------------------------------- |
433 // ----------------------------------------------------------------------------- |
406 // |
434 // |
407 TInt CXnViewManager::LoadWidgetToPluginL( CHsContentInfo& aContentInfo, |
435 TInt CXnViewManager::LoadWidgetToPluginL( const CHsContentInfo& aContentInfo, |
408 CXnPluginData& aPluginData ) |
436 CXnPluginData& aPluginData ) |
409 { |
437 { |
410 // Plugin must not have widget when about to add |
438 // Plugin must not have widget when about to add |
411 if ( aPluginData.Occupied() ) |
439 if ( aPluginData.Occupied() ) |
412 { |
440 { |
492 // ----------------------------------------------------------------------------- |
520 // ----------------------------------------------------------------------------- |
493 // |
521 // |
494 TInt CXnViewManager::UnloadWidgetFromPluginL( CXnPluginData& aPluginData, |
522 TInt CXnViewManager::UnloadWidgetFromPluginL( CXnPluginData& aPluginData, |
495 TBool aForce ) |
523 TBool aForce ) |
496 { |
524 { |
497 if ( !aForce && !aPluginData.Occupied() ) |
525 if ( !aForce ) |
498 { |
526 { |
499 // Plugin must have widget when about to remove |
527 if( !aPluginData.Occupied() ) |
500 return KErrNotFound; |
528 { |
|
529 // Plugin must have widget when about to remove |
|
530 return KErrNotFound; |
|
531 } |
|
532 if ( !aPluginData.Removable() ) |
|
533 { |
|
534 // Not allowed to remove locked |
|
535 return KErrArgument; |
|
536 } |
501 } |
537 } |
502 |
538 |
503 CXnViewData& viewData( |
539 CXnViewData& viewData( |
504 static_cast< CXnViewData& >( *aPluginData.Parent() ) ); |
540 static_cast< CXnViewData& >( *aPluginData.Parent() ) ); |
505 |
541 |
564 |
600 |
565 // ----------------------------------------------------------------------------- |
601 // ----------------------------------------------------------------------------- |
566 // CXnViewManager::ReplaceWidgetToPluginL |
602 // CXnViewManager::ReplaceWidgetToPluginL |
567 // ----------------------------------------------------------------------------- |
603 // ----------------------------------------------------------------------------- |
568 // |
604 // |
569 TInt CXnViewManager::ReplaceWidgetToPluginL( CHsContentInfo& aContentInfo, |
605 TInt CXnViewManager::ReplaceWidgetToPluginL( const CHsContentInfo& aContentInfo, |
570 CXnPluginData& aPluginData, TBool aUseHsps ) |
606 CXnPluginData& aPluginData ) |
571 { |
607 { |
572 TInt retval( KErrNone ); |
608 TInt retval( KErrNone ); |
573 |
609 |
574 // if aUseHsps is false, the plugin was already replaced by |
610 retval = iHspsWrapper->ReplacePluginL( aPluginData.PluginId(), |
575 // another process |
|
576 if( aUseHsps ) |
|
577 { |
|
578 retval = iHspsWrapper->ReplacePluginL( aPluginData.PluginId(), |
|
579 aContentInfo.Uid() ); |
611 aContentInfo.Uid() ); |
580 } |
|
581 |
612 |
582 if ( retval == KErrNone ) |
613 if ( retval == KErrNone ) |
583 { |
614 { |
584 iUiEngine->DisableRenderUiLC(); |
615 iUiEngine->DisableRenderUiLC(); |
585 |
616 |
743 } |
774 } |
744 } |
775 } |
745 } |
776 } |
746 |
777 |
747 // ----------------------------------------------------------------------------- |
778 // ----------------------------------------------------------------------------- |
|
779 // CXnViewManager::PluginDataL() |
|
780 // Returns list of plugins from all views or from the defined view |
|
781 // ----------------------------------------------------------------------------- |
|
782 // |
|
783 TInt CXnViewManager::PluginDataL( const TDesC8& aViewId, |
|
784 RPointerArray< CXnPluginData >& aList ) const |
|
785 { |
|
786 TInt err( KErrNone ); |
|
787 TBool found( EFalse ); |
|
788 |
|
789 RPointerArray< CXnPluginData >& views( iRootData->PluginData() ); |
|
790 |
|
791 for ( TInt i = 0; i < views.Count(); i++ ) |
|
792 { |
|
793 if ( !aViewId.Length() || views[i]->PluginId().Compare( aViewId ) == 0 ) |
|
794 { |
|
795 found = ETrue; |
|
796 RPointerArray< CXnPluginData >& plugins( views[i]->PluginData() ); |
|
797 |
|
798 for ( TInt j = 0; j < plugins.Count(); j++ ) |
|
799 { |
|
800 aList.AppendL( plugins[ j ] ); |
|
801 } |
|
802 } |
|
803 } |
|
804 if ( !found ) |
|
805 { |
|
806 // View not found |
|
807 err = KErrArgument; |
|
808 } |
|
809 |
|
810 return err; |
|
811 } |
|
812 |
|
813 // ----------------------------------------------------------------------------- |
748 // CXnViewManager::Resources() |
814 // CXnViewManager::Resources() |
749 // Finds the resources from the active view data |
815 // Finds the resources from the active view data |
750 // ----------------------------------------------------------------------------- |
816 // ----------------------------------------------------------------------------- |
751 // |
817 // |
752 CArrayPtrSeg< CXnResource >& CXnViewManager::Resources() const |
818 CArrayPtrSeg< CXnResource >& CXnViewManager::Resources() const |
892 // ----------------------------------------------------------------------------- |
958 // ----------------------------------------------------------------------------- |
893 // CXnViewManager::AddViewL() |
959 // CXnViewManager::AddViewL() |
894 // Adds a new view based on info |
960 // Adds a new view based on info |
895 // ----------------------------------------------------------------------------- |
961 // ----------------------------------------------------------------------------- |
896 // |
962 // |
897 TInt CXnViewManager::AddViewL( CHsContentInfo& aInfo ) |
963 TInt CXnViewManager::AddViewL( const CHsContentInfo& aInfo ) |
898 { |
964 { |
899 if ( iRootData->PluginData().Count() >= iRootData->MaxPages() ) |
965 if ( iRootData->PluginData().Count() >= iRootData->MaxPages() ) |
900 { |
966 { |
901 return KErrGeneral; |
967 return KErrGeneral; |
902 } |
968 } |
1078 |
1144 |
1079 if ( view->PluginId() == aInfo.PluginId() ) |
1145 if ( view->PluginId() == aInfo.PluginId() ) |
1080 { |
1146 { |
1081 if ( !view->Removable() ) |
1147 if ( !view->Removable() ) |
1082 { |
1148 { |
1083 return retval; |
1149 return KErrArgument; |
1084 } |
1150 } |
1085 |
1151 |
1086 if ( view->Active() ) |
1152 if ( view->Active() ) |
1087 { |
1153 { |
|
1154 // Destroy publishers here, must be plugin shutdown |
|
1155 view->DestroyPublishers( EAiFwPluginShutdown ); |
|
1156 |
1088 // Activate the next view, or first if in the last view |
1157 // Activate the next view, or first if in the last view |
1089 CXnViewData& next( NextViewData() ); |
1158 CXnViewData& next( NextViewData() ); |
1090 iAppUiAdapter.ViewAdapter().ActivateContainerL( next ); |
1159 iAppUiAdapter.ViewAdapter().ActivateContainerL( next ); |
1091 } |
1160 } |
1092 |
1161 |
1153 if ( !next.Occupied() ) |
1222 if ( !next.Occupied() ) |
1154 { |
1223 { |
1155 next.Load(); |
1224 next.Load(); |
1156 } |
1225 } |
1157 |
1226 |
|
1227 CXnViewData* view( static_cast< CXnViewData* >( views[ index ] ) ); |
|
1228 |
|
1229 // Destroy publishers here, must be plugin shutdown |
|
1230 view->DestroyPublishers( EAiFwPluginShutdown ); |
|
1231 |
1158 iAppUiAdapter.ViewAdapter().ActivateContainerL( next ); |
1232 iAppUiAdapter.ViewAdapter().ActivateContainerL( next ); |
1159 |
1233 |
1160 CXnViewData* view( static_cast< CXnViewData* >( views[ index ] ) ); |
|
1161 |
|
1162 // Remove wallpaper from cache |
1234 // Remove wallpaper from cache |
1163 iAppUiAdapter.ViewAdapter().BgManager().DeleteWallpaper( *view ); |
1235 iAppUiAdapter.ViewAdapter().BgManager().DeleteWallpaper( *view ); |
1164 |
1236 |
1165 // Remove plugin from HSPS |
1237 // Remove plugin from HSPS |
1166 iHspsWrapper->RemovePluginL( view->PluginId() ); |
1238 iHspsWrapper->RemovePluginL( view->PluginId() ); |
1212 if ( aPluginUid == KNullDesC8 ) |
1284 if ( aPluginUid == KNullDesC8 ) |
1213 { |
1285 { |
1214 return KErrArgument; |
1286 return KErrArgument; |
1215 } |
1287 } |
1216 |
1288 |
1217 if ( iRootData->PluginUid().Compare( aPluginUid ) == 0 ) |
1289 if ( iRootData->PluginUid().CompareF( aPluginUid ) == 0 ) |
1218 { |
1290 { |
1219 // Nothing to do |
1291 // Nothing to do |
1220 return KErrNone; |
1292 return KErrNone; |
1221 } |
1293 } |
1222 |
1294 |
1325 // Activate first view |
1397 // Activate first view |
1326 aViewToActivate.SetActive( ETrue ); |
1398 aViewToActivate.SetActive( ETrue ); |
1327 |
1399 |
1328 // Cache update is needed after view activation |
1400 // Cache update is needed after view activation |
1329 UpdateCachesL(); |
1401 UpdateCachesL(); |
1330 |
|
1331 // Schedule remainngs views load |
|
1332 iRootData->LoadRemainingViews(); |
|
1333 } |
1402 } |
1334 |
1403 |
1335 NotifyViewActivatedL( aViewToActivate ); |
1404 NotifyViewActivatedL( aViewToActivate ); |
1336 UpdatePageManagementInformationL(); |
1405 UpdatePageManagementInformationL(); |
1337 |
1406 |