345 #ifdef HSPS_LOG_ACTIVE |
345 #ifdef HSPS_LOG_ACTIVE |
346 iSecurityEnforcer->SetLogBus( iLogBus ); |
346 iSecurityEnforcer->SetLogBus( iLogBus ); |
347 #endif |
347 #endif |
348 |
348 |
349 // Find header files from the Plug-in Repository |
349 // Find header files from the Plug-in Repository |
350 UpdateHeaderListCacheL(); |
350 TRAP_IGNORE( UpdateHeaderListCacheL() ); |
351 |
351 |
352 // Initialize remove index |
352 // Initialize remove index |
353 iThemeIndexToRemove = KErrNotFound; |
353 iThemeIndexToRemove = KErrNotFound; |
354 |
354 |
355 // Listen to changes in any key |
355 // Listen to changes in any key |
356 iCenRepListener->SetupAll(); |
356 iCenRepListener->SetupAll(); |
357 |
357 |
358 // Start observing the notifications |
358 // Start observing the notifications |
359 iDefinitionRepository->RegisterObserverL( *this ); |
359 iDefinitionRepository->RegisterObserverL( *this ); |
360 |
360 |
361 |
|
362 #if defined(WINSCW) || defined(__WINS__) |
361 #if defined(WINSCW) || defined(__WINS__) |
363 // Resolution & orientation change listener |
362 // Resolution & orientation change listener |
364 iFamily = ChspsFamilyListener::NewL( *this ); |
363 iFamily = ChspsFamilyListener::NewL( *this ); |
365 #else |
364 #else |
366 iFamily = ChspsFamily::NewL(); |
365 iFamily = ChspsFamily::NewL(); |
367 #endif //defined(WINSCW) || defined(__WINS__) |
366 #endif //defined(WINSCW) || defined(__WINS__) |
368 |
367 |
369 // Auto-localize ODTs in the Definition Repository when the device language has changed |
368 // These might leave if configurations are invalid |
370 HandleLanguageChangeL(); |
369 TRAP_IGNORE( InitializeHeadersL() ); |
371 |
370 |
372 // Installs manifest files from the ROM drive when server is starting for the first time |
|
373 HandleRomInstallationsL(); |
|
374 |
|
375 #ifndef __DISABLE_SISX_INSTALLATION_ |
|
376 // Start observing of import folder to enable autoinstallations |
|
377 EnableAutoInstallationL(); |
|
378 #endif //__DISABLE_SISX_INSTALLATION_ |
|
379 |
|
380 // Update configurations |
371 // Update configurations |
381 // When server is started all configurations with "WaitForConfirmation" state are updated |
372 // When server is started all configurations with "WaitForConfirmation" state are updated |
382 // to "NotConfirmed" state to allow client to validate configurations |
373 // to "NotConfirmed" state to allow client to validate configurations |
383 User::LeaveIfError( iCentralRepository->Set( KCenrepKeyCheckConf, 0 ) ); |
374 User::LeaveIfError( iCentralRepository->Set( KCenrepKeyCheckConf, 0 ) ); |
384 CheckConfigurationL( KAppIdAny ); |
375 CheckConfigurationL( KAppIdAny ); |
403 |
394 |
404 #ifdef HSPS_LOG_ACTIVE |
395 #ifdef HSPS_LOG_ACTIVE |
405 iLogBus->LogText( _L( "hspsThemeServer: server fully constructed" ) ); |
396 iLogBus->LogText( _L( "hspsThemeServer: server fully constructed" ) ); |
406 iLogBus->LogText( _L( "--------------------------------------------------------" ) ); |
397 iLogBus->LogText( _L( "--------------------------------------------------------" ) ); |
407 #endif |
398 #endif |
|
399 } |
|
400 |
|
401 void ChspsThemeServer::InitializeHeadersL() |
|
402 { |
|
403 // Auto-localize ODTs in the Definition Repository when the device language has changed |
|
404 HandleLanguageChangeL(); |
|
405 |
|
406 // Reinstall plug-ins/handle FOTA updates |
|
407 HandleRomInstallationsL(); |
|
408 |
|
409 #ifndef __DISABLE_SISX_INSTALLATION_ |
|
410 // Start observing of import folder to enable autoinstallations |
|
411 EnableAutoInstallationL(); |
|
412 #endif //__DISABLE_SISX_INSTALLATION_ |
408 } |
413 } |
409 |
414 |
410 // Destructor |
415 // Destructor |
411 ChspsThemeServer::~ChspsThemeServer() |
416 ChspsThemeServer::~ChspsThemeServer() |
412 { |
417 { |
2172 |
2177 |
2173 iCentralRepository->FindL( KCenrepKeyLang, fullMask, res ); |
2178 iCentralRepository->FindL( KCenrepKeyLang, fullMask, res ); |
2174 if ( res.Count() == 0 ) |
2179 if ( res.Count() == 0 ) |
2175 { |
2180 { |
2176 #ifdef HSPS_LOG_ACTIVE |
2181 #ifdef HSPS_LOG_ACTIVE |
2177 iLogBus->LogText( _L( "ChspsThemeServer::HandleLanguageChangeL(): - Couldn't find %d key from the HSPS cenrep!" ), KCenrepLangKey ); |
2182 iLogBus->LogText( |
|
2183 _L( "ChspsThemeServer::HandleLanguageChangeL(): - Couldn't find %d key from the HSPS cenrep!" ), |
|
2184 KCenrepKeyLang ); |
2178 #endif |
2185 #endif |
2179 |
2186 |
2180 User::Leave( KErrNotFound ); |
2187 User::Leave( KErrNotFound ); |
2181 } |
2188 } |
2182 |
2189 |
2750 TBuf<KSysUtilVersionTextLength> fwVersion; |
2757 TBuf<KSysUtilVersionTextLength> fwVersion; |
2751 TInt errorCode = iCentralRepository->Get( key, fwVersion ); |
2758 TInt errorCode = iCentralRepository->Get( key, fwVersion ); |
2752 if( ( errorCode == KErrNone ) && |
2759 if( ( errorCode == KErrNone ) && |
2753 ( fwVersion.Length() == 0 ) ) |
2760 ( fwVersion.Length() == 0 ) ) |
2754 { |
2761 { |
2755 // Install widgets from \private\200159C0\install\ directories (ROM and UDA image) |
2762 // Install widgets from install and import directories (eMMC, UDA ROM) |
2756 InstallWidgetsL(); |
2763 InstallWidgetsL( ETrue ); |
2757 |
|
2758 // Install widgets from \private\200159C0\imports\ directory |
|
2759 //from c (UDA image) and from emmc |
|
2760 InstallUDAWidgetsL( KImportDirectoryC ); |
|
2761 |
2764 |
2762 TInt drive = hspsServerUtil::GetEmmcDrivePath( iFsSession ); |
|
2763 if ( drive != KErrNotFound ) |
|
2764 { |
|
2765 TDriveUnit unit(drive); |
|
2766 HBufC* importDirectoryE = HBufC::NewLC( |
|
2767 KImportDirectory().Length() + unit.Name().Length() ); |
|
2768 |
|
2769 importDirectoryE->Des().Append( unit.Name() ); |
|
2770 importDirectoryE->Des().Append( KImportDirectory ); |
|
2771 |
|
2772 InstallUDAWidgetsL( *importDirectoryE ); |
|
2773 CleanupStack::PopAndDestroy( importDirectoryE ); |
|
2774 } |
|
2775 |
|
2776 // Post RFS installations have been done, prevent re-installations at next startup |
2765 // Post RFS installations have been done, prevent re-installations at next startup |
2777 // by reading firmware version and saving it to cenrep. |
2766 // by reading firmware version and saving it to cenrep. |
2778 GetFWVersion( fwVersion ); |
2767 GetFWVersion( fwVersion ); |
2779 |
2768 |
2780 errorCode = iCentralRepository->Set( key, fwVersion ); |
2769 errorCode = iCentralRepository->Set( key, fwVersion ); |
2803 GetFWVersion( currentFWVersion ); |
2792 GetFWVersion( currentFWVersion ); |
2804 if ( fwVersion != currentFWVersion ) |
2793 if ( fwVersion != currentFWVersion ) |
2805 { |
2794 { |
2806 // Phone software has been updated. |
2795 // Phone software has been updated. |
2807 CreateBackupDataL(); |
2796 CreateBackupDataL(); |
2808 InstallWidgetsL(); |
2797 InstallWidgetsL( EFalse ); |
|
2798 // Restore the personalization |
2809 RestoreApplicationConfigurationsL(); |
2799 RestoreApplicationConfigurationsL(); |
2810 // Save new firmware version to cenrep |
2800 // Save new firmware version to cenrep |
2811 if ( errorCode == KErrNone ) |
2801 if ( errorCode == KErrNone ) |
2812 { |
2802 { |
2813 errorCode = iCentralRepository->Set( key, currentFWVersion ); |
2803 errorCode = iCentralRepository->Set( key, currentFWVersion ); |
2853 // |
2843 // |
2854 void ChspsThemeServer::InstallWidgetsL( |
2844 void ChspsThemeServer::InstallWidgetsL( |
2855 const TBool aInstallUdaEmmc ) |
2845 const TBool aInstallUdaEmmc ) |
2856 { |
2846 { |
2857 __ASSERT_DEBUG( !iRomInstaller, User::Leave( KErrGeneral) ); |
2847 __ASSERT_DEBUG( !iRomInstaller, User::Leave( KErrGeneral) ); |
2858 iRomInstaller = ChspsRomInstaller::NewL( *this, iFsSession, aInstallUdaEmmc ); |
2848 iRomInstaller = ChspsRomInstaller::NewL( |
|
2849 *this, |
|
2850 iFsSession, |
|
2851 aInstallUdaEmmc ); |
2859 #ifdef HSPS_LOG_ACTIVE |
2852 #ifdef HSPS_LOG_ACTIVE |
2860 iRomInstaller->SetLogBus( iLogBus ); |
2853 iRomInstaller->SetLogBus( iLogBus ); |
2861 #endif |
2854 #endif |
2862 |
2855 |
2863 iRomInstaller->InstallL(); |
2856 iRomInstaller->InstallL(); |
2877 ChspsODT& aSearchMask, |
2870 ChspsODT& aSearchMask, |
2878 ChspsODT*& aConfHeader, |
2871 ChspsODT*& aConfHeader, |
2879 TInt& aPos ) |
2872 TInt& aPos ) |
2880 { |
2873 { |
2881 ChspsODT* header( NULL ); |
2874 ChspsODT* header( NULL ); |
2882 TBool rootUidMatch( ETrue ); |
|
2883 TBool themeUidMatch( ETrue ); |
|
2884 TBool flagsMatch( ETrue ); |
|
2885 TBool typeMatch( ETrue ); |
|
2886 aConfHeader = NULL; |
2875 aConfHeader = NULL; |
2887 for ( TInt i = aPos; i < iHeaderListCache->Count() && aConfHeader == NULL; i++ ) |
2876 for ( TInt i = aPos; i < iHeaderListCache->Count() && aConfHeader == NULL; i++ ) |
2888 { |
2877 { |
|
2878 TBool rootUidMatch( ETrue ); |
|
2879 TBool themeUidMatch( ETrue ); |
|
2880 TBool flagsMatch( ETrue ); |
|
2881 TBool typeMatch( ETrue ); |
|
2882 TBool familyMatch( ETrue ); |
|
2883 |
2889 header = iHeaderListCache->At(i); |
2884 header = iHeaderListCache->At(i); |
|
2885 |
2890 if ( aSearchMask.RootUid() && |
2886 if ( aSearchMask.RootUid() && |
2891 aSearchMask.RootUid() != header->RootUid() ) |
2887 aSearchMask.RootUid() != header->RootUid() ) |
2892 { |
2888 { |
2893 // Root UID defined in search criteria and Root UID does not match |
2889 // Root UID defined in search criteria and Root UID does not match |
2894 rootUidMatch = EFalse; |
2890 rootUidMatch = EFalse; |
2911 if ( aSearchMask.ConfigurationType() && |
2907 if ( aSearchMask.ConfigurationType() && |
2912 aSearchMask.ConfigurationType() != header->ConfigurationType() ) |
2908 aSearchMask.ConfigurationType() != header->ConfigurationType() ) |
2913 { |
2909 { |
2914 typeMatch = EFalse; |
2910 typeMatch = EFalse; |
2915 } |
2911 } |
|
2912 if ( aSearchMask.Family() && |
|
2913 !( aSearchMask.Family() & header->Family() ) ) |
|
2914 { |
|
2915 // Family does not match |
|
2916 familyMatch = EFalse; |
|
2917 } |
2916 // else configuration type ignored |
2918 // else configuration type ignored |
2917 if ( rootUidMatch && themeUidMatch && flagsMatch && typeMatch ) |
2919 if ( rootUidMatch && themeUidMatch && flagsMatch && typeMatch && familyMatch ) |
2918 { |
2920 { |
2919 aConfHeader = header; |
2921 aConfHeader = header; |
2920 aPos = i; |
2922 aPos = i; |
2921 } |
|
2922 else |
|
2923 { |
|
2924 rootUidMatch = ETrue; |
|
2925 themeUidMatch = ETrue; |
|
2926 flagsMatch = ETrue; |
|
2927 typeMatch = ETrue; |
|
2928 } |
2923 } |
2929 } |
2924 } |
2930 } |
2925 } |
2931 |
2926 |
2932 // ----------------------------------------------------------------------------- |
2927 // ----------------------------------------------------------------------------- |
3043 { |
3038 { |
3044 // Disable auto installations |
3039 // Disable auto installations |
3045 DisableAutoInstallation(); |
3040 DisableAutoInstallation(); |
3046 // Restore imported configurations from backup/import folder |
3041 // Restore imported configurations from backup/import folder |
3047 RestoreImportedConfigurationsL(); |
3042 RestoreImportedConfigurationsL(); |
|
3043 // Update cache |
|
3044 UpdateHeaderListCacheL(); |
3048 // Restore application configurations from backup/themes folder |
3045 // Restore application configurations from backup/themes folder |
3049 RestoreApplicationConfigurationsL(); |
3046 RestoreApplicationConfigurationsL(); |
3050 // Restore completed |
3047 // Restore completed |
3051 DeleteBRHandler(); |
3048 DeleteBRHandler(); |
3052 iBRState = EhspsBRNormal; |
3049 iBRState = EhspsBRNormal; |
3210 files ); |
3207 files ); |
3211 |
3208 |
3212 // Install found configurations |
3209 // Install found configurations |
3213 TInt err( KErrNone ); |
3210 TInt err( KErrNone ); |
3214 CHSPSInstaller* installer = CHSPSInstaller::NewL( *this ); |
3211 CHSPSInstaller* installer = CHSPSInstaller::NewL( *this ); |
|
3212 installer->InstallationHandler().DisableNotifications(); |
3215 CleanupStack::PushL( installer ); |
3213 CleanupStack::PushL( installer ); |
3216 for ( TInt i = 0; i < files.Count(); i++ ) |
3214 for ( TInt i = 0; i < files.Count(); i++ ) |
3217 { |
3215 { |
3218 #ifdef HSPS_LOG_ACTIVE |
3216 #ifdef HSPS_LOG_ACTIVE |
3219 iLogBus->LogText( _L( "ChspsThemeServer::InstallRestoredConfigurationsL(): - Install configuration: %S" ), &files[ i ] ); |
3217 iLogBus->LogText( _L( "ChspsThemeServer::InstallRestoredConfigurationsL(): - Install configuration: %S" ), &files[ i ] ); |
3406 KConfigurationAttrState, |
3404 KConfigurationAttrState, |
3407 state ); |
3405 state ); |
3408 |
3406 |
3409 if ( err != KErrNone ) |
3407 if ( err != KErrNone ) |
3410 { |
3408 { |
3411 // Invalid configuration |
3409 // Set plugin configuration to "error" state |
3412 state.Set( KConfStateError ); |
3410 state.Set( KConfStateError ); |
3413 // Delete related resource files |
3411 |
3414 const TInt count = aOdt.ResourceCount(); |
3412 // Remove missing plugins, thus there will be no error note later on |
3415 for( TInt j( 0 ); j < count; j++ ) |
3413 hspsServerUtil::RemovePluginResourcesL( aOdt, uids[ i ] ); |
3416 { |
3414 |
3417 ChspsResource& resource = aOdt.ResourceL( j ); |
|
3418 if( resource.ConfigurationUid() == uids[ i ] ) |
|
3419 { |
|
3420 aOdt.DeleteResourceL( j ); |
|
3421 } |
|
3422 } |
|
3423 } |
3415 } |
3424 else if ( state.CompareF( KConfStateError ) != 0 ) |
3416 else if ( state.CompareF( KConfStateError ) != 0 ) |
3425 { |
3417 { |
3426 state.Set( KConfStateNotConfirmed ); |
3418 state.Set( KConfStateNotConfirmed ); |
3427 } |
3419 } |
3619 if ( header->Family() & aNewFamily ) |
3611 if ( header->Family() & aNewFamily ) |
3620 { |
3612 { |
3621 |
3613 |
3622 // Skip family change if it's already up to date |
3614 // Skip family change if it's already up to date |
3623 TInt activeConfigurationUid = -1; |
3615 TInt activeConfigurationUid = -1; |
3624 User::LeaveIfError( |
3616 const TInt err = iCentralRepository->Get( header->RootUid(), activeConfigurationUid ); |
3625 iCentralRepository->Get( |
3617 if( err ) |
3626 header->RootUid(), |
3618 { |
3627 activeConfigurationUid ) |
3619 continue; |
3628 ); |
3620 } |
3629 |
3621 |
3630 // Notify each client only once |
3622 // Notify each client only once |
3631 TBool alreadyIncluded = EFalse; |
3623 TBool alreadyIncluded = EFalse; |
3632 for( TInt targetIndex=0; targetIndex < notificationTargets.Count(); targetIndex++ ) |
3624 for( TInt targetIndex=0; targetIndex < notificationTargets.Count(); targetIndex++ ) |
3633 { |
3625 { |
3639 } |
3631 } |
3640 } |
3632 } |
3641 if ( !alreadyIncluded ) |
3633 if ( !alreadyIncluded ) |
3642 { |
3634 { |
3643 notificationTargets.Append( header ); |
3635 notificationTargets.Append( header ); |
3644 |
3636 |
3645 TBool updateRequired = ( activeConfigurationUid != header->ThemeUid() ); |
3637 // Check if active configuration supports the current family |
3646 if ( updateRequired ) |
3638 TBool updateRequired = ETrue; |
|
3639 for( TInt i=0; i < iHeaderListCache->Count(); i++ ) |
|
3640 { |
|
3641 ChspsODT* h = iHeaderListCache->At( i ); |
|
3642 if( h->ThemeUid() == activeConfigurationUid ) |
|
3643 { |
|
3644 if( (ThspsFamily)h->Family() & aNewFamily ) |
|
3645 { |
|
3646 // No need to change the active root configuration |
|
3647 updateRequired = EFalse; |
|
3648 break; |
|
3649 } |
|
3650 } |
|
3651 } |
|
3652 if( updateRequired && activeConfigurationUid != header->ThemeUid() ) |
3647 { |
3653 { |
3648 // Activate the resolution specific theme |
3654 // Activate the resolution specific theme |
3649 ChspsODT* newOdt = ChspsODT::NewL(); |
3655 ChspsODT* newOdt = ChspsODT::NewL(); |
3650 CleanupStack::PushL( newOdt ); |
3656 CleanupStack::PushL( newOdt ); |
3651 ActivateThemeL( *header, *newOdt ); |
3657 ActivateThemeL( *header, *newOdt ); |