4644 aMessage.ReadL(1, packagedStruct); |
4644 aMessage.ReadL(1, packagedStruct); |
4645 if ( params.appUid < 1 ) |
4645 if ( params.appUid < 1 ) |
4646 { |
4646 { |
4647 User::Leave( KErrArgument ); |
4647 User::Leave( KErrArgument ); |
4648 } |
4648 } |
4649 // Enable modification of owned configurations only |
4649 if( params.restore != EhspsRestoreAll |
|
4650 && params.restore != EhspsRestoreRom |
|
4651 && params.restore != EhspsRestoreViews ) |
|
4652 { |
|
4653 User::Leave( KErrArgument ); |
|
4654 } |
|
4655 |
|
4656 // Enable modification of plug-in configurations which the client owns |
4650 if( messagePtr.SecureId().iId != params.appUid ) |
4657 if( messagePtr.SecureId().iId != params.appUid ) |
4651 { |
4658 { |
4652 User::Leave( KErrAccessDenied ); |
4659 User::Leave( KErrAccessDenied ); |
4653 } |
4660 } |
4654 |
4661 |
4655 TInt err = KErrNone; |
4662 TInt err = KErrNone; |
|
4663 |
|
4664 // Lock the Plugin Repository (a.k.a. Def.rep) |
4656 if( iDefinitionRepository.Locked() ) |
4665 if( iDefinitionRepository.Locked() ) |
4657 { |
4666 { |
4658 // Repository locked |
4667 // Repository locked |
4659 err = KErrAccessDenied; |
4668 User::Leave( KErrAccessDenied ); |
4660 } |
4669 } |
4661 |
4670 iDefinitionRepository.Lock(); |
|
4671 CleanupStack::PushL( TCleanupItem( UnlockRepository, &iDefinitionRepository ) ); |
|
4672 |
|
4673 if( params.restore == EhspsRestoreAll |
|
4674 || params.restore == EhspsRestoreRom ) |
|
4675 { |
|
4676 TBool installUdaEmmc = ETrue; |
|
4677 if( params.restore == EhspsRestoreRom ) |
|
4678 { |
|
4679 installUdaEmmc = EFalse; |
|
4680 } |
|
4681 TRAP( err, HandleReinstallationL( installUdaEmmc ) ); |
|
4682 iThemeServer.SetResourceFileCopyRequired( params.appUid ); |
|
4683 } |
|
4684 |
|
4685 // Get active root configuration for the client application |
|
4686 ChspsODT* appODT = ChspsODT::NewL(); |
|
4687 CleanupStack::PushL( appODT ); |
|
4688 |
|
4689 iThemeServer.GetActivateAppConfigurationL( |
|
4690 params.appUid, |
|
4691 *appODT ); |
|
4692 |
|
4693 // As a backup if the re-installations failed or client panics due to |
|
4694 // an updated data plug-in then remove all but one view and empty it |
|
4695 if ( err || params.restore == EhspsRestoreViews ) |
|
4696 { |
|
4697 // Remove all views but the 1st locked one and reset active view, |
|
4698 // if none were found then leave the first view only |
|
4699 RemoveUnlockedViewsL( *appODT ); |
|
4700 |
|
4701 // Remove all widgets from the active view |
|
4702 err = RestoreActiveViewL( *appODT ); |
|
4703 } |
|
4704 |
4662 if( !err ) |
4705 if( !err ) |
4663 { |
4706 { |
4664 // Lock the Plugin Repository (a.k.a. Def.rep) |
|
4665 iDefinitionRepository.Lock(); |
|
4666 CleanupStack::PushL( TCleanupItem( UnlockRepository, &iDefinitionRepository ) ); |
|
4667 |
|
4668 // Get active root configuration for the client application |
|
4669 ChspsODT* appODT = ChspsODT::NewL(); |
|
4670 CleanupStack::PushL( appODT ); |
|
4671 |
|
4672 #ifdef HSPS_LOG_ACTIVE |
|
4673 if( iLogBus ) |
|
4674 { |
|
4675 iLogBus->LogText( |
|
4676 _L( "ChspsMaintenanceHandler::ServiceRestoreConfigurationsL(): - Dump before the changes:" ) |
|
4677 ); |
|
4678 ChspsOdtDump::Dump( *appODT, *iLogBus ); |
|
4679 } |
|
4680 #endif |
|
4681 |
|
4682 TInt err = KErrNone; |
|
4683 if ( !params.restoreAll ) |
|
4684 { |
|
4685 // reinstall all widgets |
|
4686 TRAP( err, iThemeServer.InstallWidgetsL(); |
|
4687 iThemeServer.InstallUDAWidgetsL() ); |
|
4688 |
|
4689 // Force updating of the header cache |
|
4690 iThemeServer.UpdateHeaderListCacheL(); |
|
4691 } |
|
4692 |
|
4693 iThemeServer.GetActivateAppConfigurationL( |
|
4694 params.appUid, |
|
4695 *appODT ); |
|
4696 |
|
4697 // As a backup, if restoration of the active view fails, |
|
4698 // or if all views but the locked view should be removedc |
|
4699 if ( err || params.restoreAll ) |
|
4700 { |
|
4701 // Remove all views but the locked one and reset active view |
|
4702 RemoveUnlockedViewsL( *appODT ); |
|
4703 |
|
4704 // Remove all widgets from the active view |
|
4705 err = RestoreActiveViewL( *appODT ); |
|
4706 } |
|
4707 |
|
4708 #ifdef HSPS_LOG_ACTIVE |
4707 #ifdef HSPS_LOG_ACTIVE |
4709 if( iLogBus ) |
4708 if( iLogBus ) |
4710 { |
4709 { |
4711 iLogBus->LogText( |
4710 iLogBus->LogText( |
4712 _L( "ChspsMaintenanceHandler::ServiceRestoreConfigurationsL(): - Dump after the changes:" ) |
4711 _L( "ChspsMaintenanceHandler::ServiceRestoreConfigurationsL(): - Dump after the changes:" ) |
4713 ); |
4712 ); |
4714 ChspsOdtDump::Dump( *appODT, *iLogBus ); |
4713 ChspsOdtDump::Dump( *appODT, *iLogBus ); |
4715 } |
4714 } |
4716 #endif |
4715 #endif |
4717 if( !err ) |
4716 // Stores the new application configuration into the repository |
4718 { |
4717 err = iDefinitionRepository.SetOdtL( *appODT ); |
4719 // Stores the new application configuration into the repository |
4718 ret = EhspsRestoreConfigurationsSuccess; |
4720 err = iDefinitionRepository.SetOdtL( *appODT ); |
4719 } |
4721 ret = EhspsRestoreConfigurationsSuccess; |
4720 |
4722 } |
4721 CleanupStack::PopAndDestroy( appODT ); |
4723 |
4722 |
4724 CleanupStack::PopAndDestroy( appODT ); |
4723 // Unlock after the changes have been done |
4725 |
4724 iDefinitionRepository.Unlock(); |
4726 // Unlock after the changes have been done |
4725 CleanupStack::Pop(&iDefinitionRepository); |
4727 iDefinitionRepository.Unlock(); |
|
4728 CleanupStack::Pop(&iDefinitionRepository); |
|
4729 } |
|
4730 |
4726 |
4731 // Error handling |
4727 // Error handling |
4732 iResult->iXuikonError = err; |
4728 iResult->iXuikonError = err; |
4733 |
4729 |
4734 // complete the message |
4730 // complete the message |
4735 CompleteRequest( ret, messagePtr ); |
4731 CompleteRequest( ret, messagePtr ); |
4736 } |
4732 } |
4737 |
4733 |
|
4734 // ----------------------------------------------------------------------------- |
|
4735 // ChspsMaintenanceHandler::HandleReinstallationL |
|
4736 // ----------------------------------------------------------------------------- |
|
4737 // |
|
4738 void ChspsMaintenanceHandler::HandleReinstallationL( |
|
4739 const TBool aInstallUdaEmmc ) |
|
4740 { |
|
4741 // Install plug-in configurations from the "install" directories |
|
4742 iThemeServer.InstallWidgetsL( aInstallUdaEmmc ); |
|
4743 if( aInstallUdaEmmc ) |
|
4744 { |
|
4745 // Install plug-in configurations from the "import" directories in C and E |
|
4746 iThemeServer.InstallUDAWidgetsL( KImportDirectoryC ); |
|
4747 iThemeServer.InstallUDAWidgetsL( KImportDirectoryE ); |
|
4748 } |
|
4749 |
|
4750 // Force updating of the header cache |
|
4751 iThemeServer.UpdateHeaderListCacheL(); |
|
4752 } |
|
4753 |
4738 // ----------------------------------------------------------------------------- |
4754 // ----------------------------------------------------------------------------- |
4739 // ChspsMaintenanceHandler::RestoreActiveViewL |
4755 // ChspsMaintenanceHandler::RestoreActiveViewL |
4740 // ----------------------------------------------------------------------------- |
4756 // ----------------------------------------------------------------------------- |
4741 // |
4757 // |
4742 TInt ChspsMaintenanceHandler::RestoreActiveViewL( |
4758 TInt ChspsMaintenanceHandler::RestoreActiveViewL( |