25 #include <aknnotewrappers.h> |
25 #include <aknnotewrappers.h> |
26 #include <AknsConstants.h> |
26 #include <AknsConstants.h> |
27 #include <aifwdefs.h> |
27 #include <aifwdefs.h> |
28 #include <gfxtranseffect/gfxtranseffect.h> |
28 #include <gfxtranseffect/gfxtranseffect.h> |
29 #include <akntransitionutils.h> |
29 #include <akntransitionutils.h> |
|
30 #include <xnuiengine.rsg> |
30 |
31 |
31 // User includes |
32 // User includes |
32 #include "xnapplication.h" |
33 #include "xnapplication.h" |
33 #include "xnuiengine.h" |
34 #include "xnuiengine.h" |
34 #include "xnproperty.h" |
35 #include "xnproperty.h" |
63 |
64 |
64 const TInt KPSCategoryUid( 0x200286E3 ); |
65 const TInt KPSCategoryUid( 0x200286E3 ); |
65 const TInt KPSCrashCountKey( 1 ); |
66 const TInt KPSCrashCountKey( 1 ); |
66 const TInt KStabilityInterval( 60000000 ); // 1 minute |
67 const TInt KStabilityInterval( 60000000 ); // 1 minute |
67 const TInt KActivationCompleteInterval( 2000000 ); // 2s |
68 const TInt KActivationCompleteInterval( 2000000 ); // 2s |
68 const TInt KCrashRestoreDefaultThreshold( 3 ); |
69 const TInt KCrashRestoreDefaultTreshold( 3 ); |
69 const TInt KCrashRestoreRomTreshold( 4 ); |
70 const TInt KCrashRestoreAllTreshold( 4 ); |
70 const TInt KCrashRestoreViewsTreshold( 5 ); |
71 const TInt KCrashRestoreRomTreshold( 5 ); |
|
72 const TInt KCrashRestoreViewsTreshold( 6 ); |
71 |
73 |
72 // ============================ LOCAL FUNCTIONS =============================== |
74 // ============================ LOCAL FUNCTIONS =============================== |
73 // ----------------------------------------------------------------------------- |
75 // ----------------------------------------------------------------------------- |
74 // BuildTriggerL |
76 // BuildTriggerL |
75 // Builds a trigger node |
77 // Builds a trigger node |
346 |
348 |
347 // Load application root configuration |
349 // Load application root configuration |
348 iRootData = CXnRootData::NewL( *this, iApplicationUid ); |
350 iRootData = CXnRootData::NewL( *this, iApplicationUid ); |
349 |
351 |
350 // Load root configuration and initial view. |
352 // Load root configuration and initial view. |
351 iRootData->Load(); |
353 TInt err = iRootData->Load(); |
352 |
354 |
|
355 if( err == EXnInvalidConfiguration ) |
|
356 { |
|
357 // Configuration loading failed totally |
|
358 Panic( EXnInvalidConfiguration ); |
|
359 } |
|
360 |
|
361 // Show the error note only once, if there are more views |
|
362 // the note should be shown from CXnRootData::RunLoadL() |
|
363 if( iRootData->PluginData().Count() == 1 ) |
|
364 { |
|
365 HandleErrorNotes( err ); |
|
366 } |
|
367 |
353 CleanupStack::PopAndDestroy(); // DisableRenderUiLC(); |
368 CleanupStack::PopAndDestroy(); // DisableRenderUiLC(); |
354 |
369 |
355 // Load initial view publishers |
370 // Load initial view publishers |
356 ActiveViewData().SetActive( ETrue ); |
371 ActiveViewData().SetActive( ETrue ); |
357 } |
372 } |
480 NotifyWidgetAdditionL( aPluginData ); |
495 NotifyWidgetAdditionL( aPluginData ); |
481 |
496 |
482 // Report widget amount in the view |
497 // Report widget amount in the view |
483 ReportWidgetAmountL( viewData ); |
498 ReportWidgetAmountL( viewData ); |
484 } |
499 } |
485 else if ( retval == KErrNoMemory ) |
500 |
486 { |
501 // Handle the errors |
487 TRAP_IGNORE( ShowErrorL( R_QTN_HS_HS_MEMORY_FULL ) ); |
502 HandleErrorNotes( retval ); |
488 } |
|
489 else if ( retval == KXnErrPluginFailure ) |
|
490 { |
|
491 TRAP_IGNORE( ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED ) ); |
|
492 } |
|
493 |
503 |
494 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
504 CleanupStack::PopAndDestroy(); // DisableRenderUiLC |
495 } |
505 } |
496 |
506 |
497 return retval; |
507 return retval; |
987 |
976 |
988 newView->SetOwner( iRootData->Node() ); |
977 newView->SetOwner( iRootData->Node() ); |
989 |
978 |
990 retval = newView->Load(); |
979 retval = newView->Load(); |
991 |
980 |
992 if ( retval == KErrNoMemory ) |
981 HandleErrorNotes( retval ); |
993 { |
|
994 TRAP_IGNORE( ShowErrorL( R_QTN_HS_HS_MEMORY_FULL ) ); |
|
995 } |
|
996 else if ( retval == KXnErrPluginFailure ) |
|
997 { |
|
998 TRAP_IGNORE( ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED ) ); |
|
999 } |
|
1000 |
982 |
1001 if ( newView->Occupied() ) |
983 if ( newView->Occupied() ) |
1002 { |
984 { |
1003 // Load succeed, add the new view behind the current view |
985 // Load succeed, add the new view behind the current view |
1004 RPointerArray< CXnPluginData >& views( iRootData->PluginData() ); |
986 RPointerArray< CXnPluginData >& views( iRootData->PluginData() ); |
1070 |
1052 |
1071 newView->SetOwner( iRootData->Node() ); |
1053 newView->SetOwner( iRootData->Node() ); |
1072 |
1054 |
1073 status = newView->Load(); |
1055 status = newView->Load(); |
1074 |
1056 |
1075 if ( status == KErrNoMemory ) |
1057 HandleErrorNotes( status ); |
1076 { |
|
1077 TRAP_IGNORE( ShowErrorL( R_QTN_HS_HS_MEMORY_FULL ) ); |
|
1078 } |
|
1079 else if ( status == KXnErrPluginFailure ) |
|
1080 { |
|
1081 TRAP_IGNORE( ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED ) ); |
|
1082 } |
|
1083 |
1058 |
1084 if ( newView->Occupied() ) |
1059 if ( newView->Occupied() ) |
1085 { |
1060 { |
1086 // Start transition effect |
1061 // Start transition effect |
1087 if( aEffectId ) |
1062 if( aEffectId ) |
1115 CleanupStack::PopAndDestroy( newView ); |
1090 CleanupStack::PopAndDestroy( newView ); |
1116 } |
1091 } |
1117 } |
1092 } |
1118 |
1093 |
1119 CleanupStack::PopAndDestroy( result ); |
1094 CleanupStack::PopAndDestroy( result ); |
|
1095 } |
|
1096 |
|
1097 // ----------------------------------------------------------------------------- |
|
1098 // CXnViewManager::RemoveFaultyView() |
|
1099 // Removes a view which has failed to load |
|
1100 // ----------------------------------------------------------------------------- |
|
1101 // |
|
1102 TInt CXnViewManager::RemoveFaultyView( CXnViewData* aViewData ) |
|
1103 { |
|
1104 TInt retval( KErrGeneral ); |
|
1105 |
|
1106 if( aViewData ) |
|
1107 { |
|
1108 RPointerArray< CXnPluginData >& views( iRootData->PluginData() ); |
|
1109 |
|
1110 TInt index( views.Find( aViewData ) ); |
|
1111 |
|
1112 if ( index != KErrNotFound ) |
|
1113 { |
|
1114 // Remove instance from the views array |
|
1115 views.Remove( index ); |
|
1116 |
|
1117 // Remove the faulty view configuration from the root configuration in HSPS |
|
1118 TRAP_IGNORE( iHspsWrapper->RemovePluginL( aViewData->PluginId() ) ); |
|
1119 |
|
1120 // Update MSK from the remaining views |
|
1121 TRAP_IGNORE( UpdatePageManagementInformationL() ); |
|
1122 |
|
1123 TRAP_IGNORE( iUiEngine->RenderUIL() ); |
|
1124 |
|
1125 retval = KErrNone; |
|
1126 } |
|
1127 } |
|
1128 |
|
1129 return retval; |
1120 } |
1130 } |
1121 |
1131 |
1122 // ----------------------------------------------------------------------------- |
1132 // ----------------------------------------------------------------------------- |
1123 // CXnViewManager::RemoveViewL() |
1133 // CXnViewManager::RemoveViewL() |
1124 // Removes view based info |
1134 // Removes view based info |
1402 |
1412 |
1403 // Schedule remaining views loading |
1413 // Schedule remaining views loading |
1404 iRootData->LoadRemainingViews(); |
1414 iRootData->LoadRemainingViews(); |
1405 } |
1415 } |
1406 |
1416 |
1407 if ( err == KErrNoMemory ) |
1417 HandleErrorNotes( err ); |
1408 { |
|
1409 TRAP_IGNORE( ShowErrorL( R_QTN_HS_HS_MEMORY_FULL ) ); |
|
1410 } |
|
1411 else if ( err == KXnErrPluginFailure ) |
|
1412 { |
|
1413 TRAP_IGNORE( ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED ) ); |
|
1414 } |
|
1415 |
1418 |
1416 NotifyViewActivatedL( aViewToActivate ); |
1419 NotifyViewActivatedL( aViewToActivate ); |
1417 } |
1420 } |
1418 |
1421 |
1419 // ----------------------------------------------------------------------------- |
1422 // ----------------------------------------------------------------------------- |
1704 CAknErrorNote* note = new ( ELeave ) CAknErrorNote; |
1707 CAknErrorNote* note = new ( ELeave ) CAknErrorNote; |
1705 note->ExecuteLD( *msg ); |
1708 note->ExecuteLD( *msg ); |
1706 |
1709 |
1707 CleanupStack::PopAndDestroy( msg ); |
1710 CleanupStack::PopAndDestroy( msg ); |
1708 } |
1711 } |
|
1712 } |
|
1713 |
|
1714 // ----------------------------------------------------------------------------- |
|
1715 // CXnViewManager::HandleErrorNotes |
|
1716 // |
|
1717 // ----------------------------------------------------------------------------- |
|
1718 // |
|
1719 void CXnViewManager::HandleErrorNotes( const TInt aError ) const |
|
1720 { |
|
1721 switch( aError ) |
|
1722 { |
|
1723 case KErrNoMemory: |
|
1724 TRAP_IGNORE( ShowErrorL( R_QTN_HS_HS_MEMORY_FULL ) ); |
|
1725 break; |
|
1726 |
|
1727 case KXnErrViewPluginFailure: |
|
1728 case KXnErrWidgetPluginFailure: |
|
1729 TRAP_IGNORE( ShowErrorL( R_QTN_HS_ERROR_WIDGETS_REMOVED ) ); |
|
1730 break; |
|
1731 |
|
1732 default: |
|
1733 break; |
|
1734 } |
1709 } |
1735 } |
1710 |
1736 |
1711 // ----------------------------------------------------------------------------- |
1737 // ----------------------------------------------------------------------------- |
1712 // CXnViewManager::OOMSysHandler |
1738 // CXnViewManager::OOMSysHandler |
1713 // |
1739 // |
1816 TInt crashCount = 0; |
1842 TInt crashCount = 0; |
1817 |
1843 |
1818 RProperty::Get( TUid::Uid( KPSCategoryUid ), |
1844 RProperty::Get( TUid::Uid( KPSCategoryUid ), |
1819 KPSCrashCountKey, |
1845 KPSCrashCountKey, |
1820 crashCount ); |
1846 crashCount ); |
1821 |
1847 if( crashCount == KCrashRestoreDefaultTreshold ) |
1822 if( crashCount == KCrashRestoreDefaultThreshold ) |
1848 { |
1823 { |
1849 // Try to activate another root configuration with a licensee default status |
1824 iHspsWrapper->RestoreDefaultConfL(); |
1850 iHspsWrapper->RestoreDefaultConfL(); |
1825 |
1851 |
1826 CAknQueryDialog* query = CAknQueryDialog::NewL(); |
1852 CAknQueryDialog* query = CAknQueryDialog::NewL(); |
1827 query->PrepareLC( R_HS_CONTENT_REMOVED_VIEW ); |
1853 query->PrepareLC( R_HS_CONTENT_REMOVED_VIEW ); |
1828 |
1854 |
1829 HBufC* queryText( StringLoader::LoadLC( R_HS_ERROR_CONTENT_REMOVED ) ); |
1855 HBufC* queryText( StringLoader::LoadLC( R_HS_ERROR_CONTENT_REMOVED ) ); |
1830 query->SetPromptL( queryText->Des() ); |
1856 query->SetPromptL( queryText->Des() ); |
1831 CleanupStack::PopAndDestroy( queryText ); |
1857 CleanupStack::PopAndDestroy( queryText ); |
1832 |
1858 |
1833 query->RunLD(); |
1859 query->RunLD(); |
|
1860 } |
|
1861 else if( crashCount == KCrashRestoreAllTreshold ) |
|
1862 { |
|
1863 // Reinstall all plugins from the ROM, UDA and eMMC drives |
|
1864 iHspsWrapper->RestoreAllConfL(); |
1834 } |
1865 } |
1835 else if( crashCount == KCrashRestoreRomTreshold ) |
1866 else if( crashCount == KCrashRestoreRomTreshold ) |
1836 { |
1867 { |
|
1868 // Reinstall from the ROM drive only |
1837 iHspsWrapper->RestoreRomConfL(); |
1869 iHspsWrapper->RestoreRomConfL(); |
1838 } |
1870 } |
1839 else if( crashCount >= KCrashRestoreViewsTreshold ) |
1871 else if( crashCount >= KCrashRestoreViewsTreshold ) |
1840 { |
1872 { |
|
1873 // Remove all the Homescreen pages and widgets |
1841 iHspsWrapper->RestoreViewsL(); |
1874 iHspsWrapper->RestoreViewsL(); |
1842 |
1875 |
1843 ResetCrashCount(); |
1876 ResetCrashCount(); |
1844 return; |
1877 return; |
1845 } |
1878 } |