# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1270059336 -10800 # Node ID 4eb398b07b07e94ad0f81a38be6dc4a3ee8c2432 # Parent 4699373c9af882474af1b61df446fd533b4222b9 Revision: 201011 Kit: 201013 diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/conf/nsmldmsync.confml Binary file omadm/omadmappui/conf/nsmldmsync.confml has changed diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/conf/nsmldmsync_101F6DE5.crml Binary file omadm/omadmappui/conf/nsmldmsync_101F6DE5.crml has changed diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/data/NSmlDMSync.rss --- a/omadm/omadmappui/data/NSmlDMSync.rss Mon Mar 15 12:39:36 2010 +0200 +++ b/omadm/omadmappui/data/NSmlDMSync.rss Wed Mar 31 21:15:36 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -1270,6 +1270,6 @@ RESOURCE TBUF r_qtn_browser_version { buf = "\t"qtn_dm_list_browser_version"\t%U\t"; } RESOURCE TBUF r_qtn_java_version { buf = "\t"qtn_dm_list_java_version"\t%U\t"; } RESOURCE TBUF r_qtn_flash_version { buf = "\t"qtn_dm_list_flash_version"\t%U\t"; } - +RESOURCE TBUF r_qtn_fota_note_time_restriction { buf = qtn_fota_note_time_restriction; } // End of File diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/inc/NSmlDMSyncAppUi.h --- a/omadm/omadmappui/inc/NSmlDMSyncAppUi.h Mon Mar 15 12:39:36 2010 +0200 +++ b/omadm/omadmappui/inc/NSmlDMSyncAppUi.h Wed Mar 31 21:15:36 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -301,6 +301,15 @@ */ void HandleCommandEraseProfileL(); + /** + * Determines whether Fota update is allowed. + * @param Server profile to check + * @return ETrue if allowed + * EFalse if not not allowed + */ + TBool IsUpdateAllowedL( CNSmlDMSyncProfile& aProfile ); + + private: //Data CNSmlDMProfilesView* iProfilesView; diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/inc/NSmlDMSyncPrivateCRKeys.h --- a/omadm/omadmappui/inc/NSmlDMSyncPrivateCRKeys.h Mon Mar 15 12:39:36 2010 +0200 +++ b/omadm/omadmappui/inc/NSmlDMSyncPrivateCRKeys.h Wed Mar 31 21:15:36 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -77,6 +77,13 @@ // or not.Default value is 0 which makes it off const TUint32 KNsmlDmRuntimeVerSupport = 0x00000008; +// CenRep key that limits how often users may initiate a FOTA check. +// The value is specified in hours and should be bigger than 0. +// The default value is 24 hours. This key only has an effect when +// FF_FOTA_CHECK_LIMITATION is configured ON in the product's +// configuration. +const TUint32 KNsmlDmFotaCheckLimitation = 0x00000009; + #endif // NSMLDMSYNCAPP_PRIVATE_CR_KEYS_H // End of File diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/loc/NSmlDMSyncFota.loc --- a/omadm/omadmappui/loc/NSmlDMSyncFota.loc Mon Mar 15 12:39:36 2010 +0200 +++ b/omadm/omadmappui/loc/NSmlDMSyncFota.loc Wed Mar 31 21:15:36 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -241,5 +241,12 @@ // #define qtn_fota_list_release "Release" +//d: Message text shown when the user attempts to initiate a FOTA session but is restricted because not enough time has elapsed. +//d: %0N is replaced with the number of hours which the user is restricted to attempt a FOTA session. +//d: %1N is replaced with the number of hours remaining until the next allowed FOTA session. +//d: %2N is replaced with the number of minutes remaining until the next allowed FOTA session. +//l: popup_note_window +//r: 5.2 +#define qtn_fota_note_time_restriction "Sorry. %0N hours has not elapsed since you made your last request for a software update. Time before you can make a new request: %1N hr %2N min" // End of File diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp --- a/omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp Mon Mar 15 12:39:36 2010 +0200 +++ b/omadm/omadmappui/src/NSmlDMSyncAppUi_fota.cpp Wed Mar 31 21:15:36 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -44,6 +44,13 @@ #include #include +#include // For CAknMessageQueryDialog + +// For KCalenHoursInDay = 24 and other time-related constants. +#include + +// Array granuality for displaying R_QTN_FOTA_NOTE_TIME_RESTRICTION note. +const TInt KNSmlDMFotaNoteArrayGranuality = 3; // ============================ MEMBER FUNCTIONS ============================== // @@ -416,6 +423,18 @@ } } + // If Fota check limitation feature is enabled, users are allowed to check + // updates only once within the limitation set in the CenRep + // (24 hours by default). + if ( FeatureManager::FeatureSupported( KFeatureIdFfFotaCheckLimitation ) + && !IsUpdateAllowedL( *profile ) ) + { + FLOG( "[OMADM] CNSmlDMSyncAppUi::StartSyncL Checking update is limited.\ + Can not proceed sync." ); + iSyncAppEngine->CloseProfile(); + return; + } + iSyncAppEngine->CloseProfile(); TRAPD( error, iSyncAppEngine->SynchronizeL( serverName, iConfedProfileId, @@ -876,4 +895,134 @@ } } + +TBool CNSmlDMSyncAppUi::IsUpdateAllowedL( CNSmlDMSyncProfile& aProfile ) + { + FLOG( "CNSmlDMSyncAppUi::IsUpdateAllowedL : Start" ); + + // Get the last successful sync time. It's a UTC time. + // Note: LastSuccessSync() returns the time when the last successful check + // for Fota update. + TTime utcLastSuccessSync = aProfile.LastSuccessSync(); + + // If utcLastSuccessSync is 0, there is no log available. Continue + // sync. + // Note: CNSmlDMSyncProfile::LastSuccessSync() returns 0 not Time::NullTTime(). + if ( utcLastSuccessSync.Int64() == 0 ) + { + FLOG( "[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() LastSuccessSync is 0." ); + return ETrue; + } + +#ifdef _DEBUG + TDateTime dt = utcLastSuccessSync.DateTime(); + FTRACE( FPrint( + _L("[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() utcLastSuccessSync \ + %04d-%02d-%02d %02d:%02d:%02d"), + dt.Year(), dt.Month(), dt.Day(), dt.Hour(), dt.Minute(), dt.Second() ) ); +#endif + + // Read Fota check limitation value in hours from CenRep. + // If failed to get the value, the default value is 24 hours. + TInt fotaCheckLimitation( KCalenHoursInDay ); + CRepository* cenrep = CRepository::NewL( KCRUidNSmlDMSyncApp ); + cenrep->Get( KNsmlDmFotaCheckLimitation, fotaCheckLimitation ); + delete cenrep; + FTRACE( FPrint( + _L("[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() Fota check limitation = %d"), + fotaCheckLimitation ) ); + + // Check the get value. + if ( fotaCheckLimitation <= 0 ) + { + // Something wrong with the value. Set it to the default value. + fotaCheckLimitation = KCalenHoursInDay; + } + + // Read the current time for comparison. Also universal time. + TTime utcCurrentTime; + utcCurrentTime.UniversalTime(); + +#ifdef _DEBUG + dt = utcCurrentTime.DateTime(); + FTRACE( FPrint( + _L("[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() utcCurrentTime \ + %04d-%02d-%02d %02d:%02d:%02d"), + dt.Year(), dt.Month(), dt.Day(), dt.Hour(), dt.Minute(), dt.Second() ) ); +#endif + + // Calculate the remainig time for the next available update check. + TTimeIntervalMinutes passedMinutes; + utcCurrentTime.MinutesFrom( utcLastSuccessSync, passedMinutes ); + FTRACE( FPrint( + _L("[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() passedMinutes.Int() = %d"), + passedMinutes.Int() ) ); + + // If Fota check limit is passed or passedMinutes is invalid, return EFalse + // to proceed sync process. + if ( passedMinutes.Int() > fotaCheckLimitation * KCalenMinutesInHour + || passedMinutes.Int() < 0 ) + { + FLOG( "[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() Proceed sync process." ); + return ETrue; + } + + // Calculate the next available update check time. + TInt remainingMinutes ( ( fotaCheckLimitation * KCalenMinutesInHour ) + - passedMinutes.Int() ); + TInt remainingHours( remainingMinutes / KCalenMinutesInHour ); + remainingMinutes -= remainingHours * KCalenMinutesInHour; + FTRACE( FPrint( + _L("[OMADM] CNSmlDMSyncAppUi::IsUpdateAllowedL() \ + remainingHours = %d, remainingMinutes = %d"), + remainingHours, remainingMinutes ) ); + __ASSERT_DEBUG( ( remainingHours >= 0 ) && ( remainingMinutes >= 0 ), + _L("CNSmlDMSyncAppUi::IsUpdateAllowedL - Problem with Remaining \ + time calculation.") ); + + // If calculated remaining time is valid, show the sorry note with + // remaining time until next available time for checking update then + // return ETrue to stop sync process. + if ( remainingHours > 0 || remainingMinutes > 0 ) + { + CArrayFix< TInt >* timeArray = + new( ELeave ) CArrayFixFlat< TInt >( KNSmlDMFotaNoteArrayGranuality ); + CleanupStack::PushL( timeArray ); + + timeArray->AppendL( fotaCheckLimitation ); + timeArray->AppendL( remainingHours ); + timeArray->AppendL( remainingMinutes ); + + HBufC* stringHolder = + StringLoader::LoadLC( R_QTN_FOTA_NOTE_TIME_RESTRICTION, + *timeArray, iEikonEnv ); + + CAknMessageQueryDialog* infoDialog = + CAknMessageQueryDialog::NewL( *stringHolder ); + + // infoDialog is added to the cleanup stack in PrepareLC(). + // And the dialog is popped and destroyed in RunLD(). + infoDialog->PrepareLC( R_AVKON_MESSAGE_QUERY_DIALOG ); + + // Only OK button should be shown since this is just a note. + infoDialog->ButtonGroupContainer().MakeCommandVisible( + EAknSoftkeyCancel, EFalse ); + + // Return value of RunLD() is ignored. + infoDialog->RunLD(); + + CleanupStack::PopAndDestroy( stringHolder ); + CleanupStack::PopAndDestroy( timeArray ); + + // Return EFalse to stop sync process. + FLOG( "CNSmlDMSyncAppUi::IsUpdateAllowedL : End - EFalse" ); + return EFalse; + } + + // No remaining time left (or invalid calculation). + // Proceed checking update process. + FLOG( "CNSmlDMSyncAppUi::IsUpdateAllowedL : End - ETrue" ); + return ETrue; + } + // End of File diff -r 4699373c9af8 -r 4eb398b07b07 omadm/omadmappui/src/NSmlDMSyncAppUi_nofota.cpp --- a/omadm/omadmappui/src/NSmlDMSyncAppUi_nofota.cpp Mon Mar 15 12:39:36 2010 +0200 +++ b/omadm/omadmappui/src/NSmlDMSyncAppUi_nofota.cpp Wed Mar 31 21:15:36 2010 +0300 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2005-2006 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -722,4 +722,11 @@ } } + +TBool CNSmlDMSyncAppUi::IsUpdateAllowedL( CNSmlDMSyncProfile& aProfile ) + { + //Dummy Should not be used if fota disabled + return ETrue; + } + // End of File diff -r 4699373c9af8 -r 4eb398b07b07 package_definition.xml --- a/package_definition.xml Mon Mar 15 12:39:36 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -