61 _LIT8( KTemplateViewUID, "0x20026f50" ); |
61 _LIT8( KTemplateViewUID, "0x20026f50" ); |
62 |
62 |
63 const TInt KPSCategoryUid( 0x200286E3 ); |
63 const TInt KPSCategoryUid( 0x200286E3 ); |
64 const TInt KPSCrashCountKey( 1 ); |
64 const TInt KPSCrashCountKey( 1 ); |
65 const TInt KStabilityInterval( 60000000 ); // 1 minute |
65 const TInt KStabilityInterval( 60000000 ); // 1 minute |
66 const TInt KCrashRestoreThreshold( 3 ); |
66 const TInt KCrashRestoreDefaultThreshold( 3 ); |
|
67 const TInt KCrashRestoreAllTreshold( 4 ); |
67 |
68 |
68 // ============================ LOCAL FUNCTIONS =============================== |
69 // ============================ LOCAL FUNCTIONS =============================== |
69 // ----------------------------------------------------------------------------- |
70 // ----------------------------------------------------------------------------- |
70 // BuildTriggerL |
71 // BuildTriggerL |
71 // Builds a trigger node |
72 // Builds a trigger node |
351 |
352 |
352 iHspsWrapper = &iEditor->HspsWrapper(); |
353 iHspsWrapper = &iEditor->HspsWrapper(); |
353 |
354 |
354 iComposer = CXnComposer::NewL( *iHspsWrapper ); |
355 iComposer = CXnComposer::NewL( *iHspsWrapper ); |
355 |
356 |
356 // Robustness checks. |
357 DoRobustnessCheckL(); |
357 TInt crashCount = 0; |
|
358 RProperty::Get( TUid::Uid( KPSCategoryUid ), |
|
359 KPSCrashCountKey, |
|
360 crashCount ); |
|
361 |
|
362 if( crashCount >= KCrashRestoreThreshold ) |
|
363 { |
|
364 iHspsWrapper->RestoreRootL(); |
|
365 ResetCrashCount(); |
|
366 ShowErrorNoteL( R_QTN_HS_ERROR_WIDGETS_REMOVED ); |
|
367 } |
|
368 else if( crashCount > 0 ) |
|
369 { |
|
370 // Start stability timer to ensure that |
|
371 // if system is stabile at least KStabilityInterval |
|
372 // then crash count is reset to 0. |
|
373 iStabilityTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
374 iStabilityTimer->Start( KStabilityInterval, |
|
375 KStabilityInterval, |
|
376 TCallBack( SystemStabileTimerCallback, this ) ); |
|
377 } |
|
378 } |
358 } |
379 |
359 |
380 // ----------------------------------------------------------------------------- |
360 // ----------------------------------------------------------------------------- |
381 // CXnViewManager::LoadUiL() |
361 // CXnViewManager::LoadUiL() |
382 // Loads the application UI and initial view |
362 // Loads the application UI and initial view |
1232 iAppUiAdapter.ViewAdapter().BgManager().DeleteWallpaper( *view ); |
1212 iAppUiAdapter.ViewAdapter().BgManager().DeleteWallpaper( *view ); |
1233 |
1213 |
1234 retval = iHspsWrapper->RemovePluginL( view->PluginId() ); |
1214 retval = iHspsWrapper->RemovePluginL( view->PluginId() ); |
1235 |
1215 |
1236 // Notify observers of view list change |
1216 // Notify observers of view list change |
1237 NotifyViewRemovalL( *view ); |
1217 TRAPD( err, NotifyViewRemovalL( *view ) ); |
|
1218 if ( err != KErrNone ) |
|
1219 { |
|
1220 // ignored |
|
1221 } |
1238 |
1222 |
1239 iRootData->DestroyViewData( view ); |
1223 iRootData->DestroyViewData( view ); |
1240 |
1224 |
1241 // Need to update after view is removed |
1225 // Need to update after view is removed |
1242 UpdatePageManagementInformationL(); |
1226 UpdatePageManagementInformationL(); |
1305 |
1289 |
1306 // Remove plugin from HSPS |
1290 // Remove plugin from HSPS |
1307 iHspsWrapper->RemovePluginL( view->PluginId() ); |
1291 iHspsWrapper->RemovePluginL( view->PluginId() ); |
1308 |
1292 |
1309 // Notify observers of view list change |
1293 // Notify observers of view list change |
1310 NotifyViewRemovalL( *view ); |
1294 TRAPD( err, NotifyViewRemovalL( *view ) ); |
|
1295 if ( err != KErrNone ) |
|
1296 { |
|
1297 // ignored |
|
1298 } |
1311 |
1299 |
1312 iRootData->DestroyViewData( view ); |
1300 iRootData->DestroyViewData( view ); |
1313 |
1301 |
1314 // Need to update after view is removed |
1302 // Need to update after view is removed |
1315 UpdatePageManagementInformationL(); |
1303 UpdatePageManagementInformationL(); |
1771 } |
1759 } |
1772 |
1760 |
1773 // ----------------------------------------------------------------------------- |
1761 // ----------------------------------------------------------------------------- |
1774 // CXnViewManager::ShowErrorNoteL |
1762 // CXnViewManager::ShowErrorNoteL |
1775 // ----------------------------------------------------------------------------- |
1763 // ----------------------------------------------------------------------------- |
1776 void CXnViewManager::ShowErrorNoteL( const TInt aResourceId ) |
1764 void CXnViewManager::ShowErrorNoteL() |
1777 { |
1765 { |
1778 HBufC* msg( StringLoader::LoadLC( aResourceId ) ); |
1766 CAknQueryDialog* query = CAknQueryDialog::NewL(); |
1779 |
1767 query->PrepareLC( R_HS_CONTENT_REMOVED_VIEW ); |
1780 CAknErrorNote* note = new ( ELeave ) CAknErrorNote; |
1768 |
1781 CleanupStack::PushL( note ); |
1769 HBufC* queryText( StringLoader::LoadLC( R_HS_ERROR_CONTENT_REMOVED ) ); |
1782 |
1770 query->SetPromptL( queryText->Des() ); |
1783 note->ExecuteLD( *msg ); |
1771 CleanupStack::PopAndDestroy( queryText ); |
1784 |
1772 |
1785 CleanupStack::Pop( note ); |
1773 query->RunLD(); |
1786 CleanupStack::PopAndDestroy( msg ); |
1774 } |
|
1775 |
|
1776 // ----------------------------------------------------------------------------- |
|
1777 // CXnViewManager::DoRobustnessCheckL |
|
1778 // ----------------------------------------------------------------------------- |
|
1779 void CXnViewManager::DoRobustnessCheckL() |
|
1780 { |
|
1781 TInt crashCount = 0; |
|
1782 RProperty::Get( TUid::Uid( KPSCategoryUid ), |
|
1783 KPSCrashCountKey, |
|
1784 crashCount ); |
|
1785 |
|
1786 if( crashCount == KCrashRestoreDefaultThreshold ) |
|
1787 { |
|
1788 TInt err = iHspsWrapper->RestoreDefaultConfL(); |
|
1789 ShowErrorNoteL(); |
|
1790 } |
|
1791 else if( crashCount >= KCrashRestoreAllTreshold ) |
|
1792 { |
|
1793 TInt err = iHspsWrapper->RestoreRootL(); |
|
1794 ResetCrashCount(); |
|
1795 return; |
|
1796 } |
|
1797 |
|
1798 if( crashCount > 0 ) |
|
1799 { |
|
1800 // Start stability timer to ensure that |
|
1801 // if system is stabile at least KStabilityInterval |
|
1802 // then crash count is reset to 0. |
|
1803 iStabilityTimer = CPeriodic::NewL( CActive::EPriorityStandard ); |
|
1804 iStabilityTimer->Start( KStabilityInterval, |
|
1805 KStabilityInterval, |
|
1806 TCallBack( SystemStabileTimerCallback, this ) ); |
|
1807 } |
1787 } |
1808 } |
1788 |
1809 |
1789 // End of file |
1810 // End of file |