28 #include <usif/scr/scr.h> // RSoftwareComponentRegistry |
28 #include <usif/scr/scr.h> // RSoftwareComponentRegistry |
29 #include <swi/asynclauncher.h> // Swi::CAsyncLauncher |
29 #include <swi/asynclauncher.h> // Swi::CAsyncLauncher |
30 #include <swi/sisregistrysession.h> // RSisRegistrySession |
30 #include <swi/sisregistrysession.h> // RSisRegistrySession |
31 #include "sisregistrywritablesession.h" // RSisRegistryWritableSession |
31 #include "sisregistrywritablesession.h" // RSisRegistryWritableSession |
32 #include <e32property.h> // RProperty |
32 #include <e32property.h> // RProperty |
|
33 #include <centralrepository.h> // CRepository |
33 #include <sacls.h> // KUidSwiLatestInstallation |
34 #include <sacls.h> // KUidSwiLatestInstallation |
|
35 #include <SWInstallerInternalCRKeys.h> // KCRUidSWInstallerSettings |
34 #include <featmgr.h> // FeatureManager |
36 #include <featmgr.h> // FeatureManager |
|
37 #include <syslangutil.h> // GetInstalledLanguages |
35 |
38 |
36 // TODO: replace with proper logging |
39 // TODO: replace with proper logging |
37 #ifdef _DEBUG |
40 #ifdef _DEBUG |
38 #define FLOG(x) RDebug::Print(x); |
41 #define FLOG(x) RDebug::Print(x); |
39 #define FLOG_1(x,y) RDebug::Print(x, y); |
42 #define FLOG_1(x,y) RDebug::Print(x, y); |
78 FLOG( _L("Destructing CSisxSifPluginActiveImpl") ); |
81 FLOG( _L("Destructing CSisxSifPluginActiveImpl") ); |
79 Cancel(); |
82 Cancel(); |
80 delete iAsyncLauncher; |
83 delete iAsyncLauncher; |
81 delete iUiHandler; |
84 delete iUiHandler; |
82 delete iInstallPrefs; |
85 delete iInstallPrefs; |
|
86 iDeviceSupportedLanguages.Reset(); |
83 iInputParams = NULL; // not owned |
87 iInputParams = NULL; // not owned |
84 iOutputParams = NULL; // not owned |
88 iOutputParams = NULL; // not owned |
85 delete iInstallParams; |
89 delete iInstallParams; |
86 delete iComponentInfo; |
90 delete iComponentInfo; |
87 delete iFileName; |
91 delete iFileName; |
344 |
349 |
345 // Uninstall is always silent. TrustedUI capability is required. |
350 // Uninstall is always silent. TrustedUI capability is required. |
346 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
351 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
347 { |
352 { |
348 FLOG( _L( "CSisxSifPluginActiveImpl::Uninstall, missing ECapabilityTrustedUI") ); |
353 FLOG( _L( "CSisxSifPluginActiveImpl::Uninstall, missing ECapabilityTrustedUI") ); |
349 iErrorHandler->SetExtendedErrorCode( ETrustedUICapabilityRequired ); |
354 iErrorHandler->SetExtendedErrorCode( ESifUiTrustedUICapabilityRequired ); |
350 CompleteClientRequest( KErrPermissionDenied ); |
355 CompleteClientRequest( KErrPermissionDenied ); |
351 return; |
356 return; |
352 } |
357 } |
353 |
358 |
354 TRAPD( error, DoUninstallL( aComponentId, aInputParams, aOutputParams, aStatus ) ); |
359 TRAPD( error, DoUninstallL( aComponentId, aInputParams, aOutputParams, aStatus ) ); |
587 if( IsSilentMode() ) |
592 if( IsSilentMode() ) |
588 { |
593 { |
589 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
594 if( !aSecurityContext.HasCapability( ECapabilityTrustedUI ) ) |
590 { |
595 { |
591 FLOG( _L("CSisxSifPluginActiveImpl::Install, missing ECapabilityTrustedUI") ); |
596 FLOG( _L("CSisxSifPluginActiveImpl::Install, missing ECapabilityTrustedUI") ); |
592 iErrorHandler->SetExtendedErrorCode( ETrustedUICapabilityRequired ); |
597 iErrorHandler->SetExtendedErrorCode( ESifUiTrustedUICapabilityRequired ); |
593 CompleteClientRequest( KErrPermissionDenied ); |
598 CompleteClientRequest( KErrPermissionDenied ); |
594 return; |
599 return; |
595 } |
600 } |
596 } |
601 } |
597 |
602 |
627 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
632 const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams, |
628 TRequestStatus& aStatus ) |
633 TRequestStatus& aStatus ) |
629 { |
634 { |
630 CommonRequestPreambleL( aInputParams, aOutputParams, aStatus ); |
635 CommonRequestPreambleL( aInputParams, aOutputParams, aStatus ); |
631 |
636 |
632 RSoftwareComponentRegistry scrSession; |
637 TUid uid; |
633 User::LeaveIfError( scrSession.Connect() ); |
638 CComponentEntry *entry = CComponentEntry::NewLC(); |
634 CleanupClosePushL( scrSession ); |
639 GetComponentAndUidL( aComponentId, *entry, uid ); |
635 |
640 iUiHandler->PublishStartL( *entry ); |
636 CPropertyEntry* propertyEntry = scrSession.GetComponentPropertyL( aComponentId, KCompUid ); |
641 CleanupStack::PopAndDestroy( entry ); |
637 CleanupStack::PushL( propertyEntry ); |
642 |
638 CIntPropertyEntry* intPropertyEntry = dynamic_cast< CIntPropertyEntry* >( propertyEntry ); |
643 iAsyncLauncher->UninstallL( *iUiHandler, uid, iStatus ); |
639 FLOG_2( _L("CSisxSifPluginActiveImpl::DoUninstallL, component %d, property 0x%08x"), |
|
640 aComponentId, intPropertyEntry ); |
|
641 if( !intPropertyEntry ) |
|
642 { |
|
643 FLOG( _L("CSisxSifPluginActiveImpl: UID property not found ERROR") ); |
|
644 User::Leave( KErrNotFound ); |
|
645 } |
|
646 |
|
647 TUid objectId = TUid::Uid( intPropertyEntry->IntValue() ); |
|
648 CleanupStack::PopAndDestroy( 2, &scrSession ); // propertyEntry, scrSession |
|
649 |
|
650 iAsyncLauncher->UninstallL( *iUiHandler, objectId, iStatus ); |
|
651 |
644 |
652 iOperation = EUninstall; |
645 iOperation = EUninstall; |
653 iPhase = ERunningOperation; |
646 iPhase = ERunningOperation; |
654 SetActive(); |
647 SetActive(); |
655 } |
648 } |
709 iErrorHandler->SetErrorCode( aError ); |
702 iErrorHandler->SetErrorCode( aError ); |
710 if( iOutputParams ) |
703 if( iOutputParams ) |
711 { |
704 { |
712 iErrorHandler->FillOutputParamsL( *iOutputParams ); |
705 iErrorHandler->FillOutputParamsL( *iOutputParams ); |
713 } |
706 } |
|
707 iUiHandler->PublishCompletionL(); |
714 |
708 |
715 if( aError != KErrNone && aError != KErrCancel ) |
709 if( aError != KErrNone && aError != KErrCancel ) |
716 { |
710 { |
717 iUiHandler->DisplayFailedL( *iErrorHandler ); |
711 iUiHandler->DisplayFailedL( *iErrorHandler ); |
718 } |
712 } |
719 |
|
720 iUiHandler->PublishCompletionL( *iErrorHandler ); |
|
721 } |
713 } |
722 |
714 |
723 // --------------------------------------------------------------------------- |
715 // --------------------------------------------------------------------------- |
724 // CSisxSifPluginActiveImpl::SetFileL() |
716 // CSisxSifPluginActiveImpl::SetFileL() |
725 // --------------------------------------------------------------------------- |
717 // --------------------------------------------------------------------------- |
768 TUid tuid( TUid::Uid( uid ) ); |
760 TUid tuid( TUid::Uid( uid ) ); |
769 TComponentId componentId = sisRegistrySession.GetComponentIdForUidL( tuid ); |
761 TComponentId componentId = sisRegistrySession.GetComponentIdForUidL( tuid ); |
770 CleanupStack::PopAndDestroy( &sisRegistrySession ); |
762 CleanupStack::PopAndDestroy( &sisRegistrySession ); |
771 |
763 |
772 return componentId; |
764 return componentId; |
|
765 } |
|
766 |
|
767 // --------------------------------------------------------------------------- |
|
768 // CSisxSifPluginActiveImpl::GetComponentAndUidL() |
|
769 // --------------------------------------------------------------------------- |
|
770 // |
|
771 void CSisxSifPluginActiveImpl::GetComponentAndUidL( TComponentId aComponentId, |
|
772 CComponentEntry& aEntry, TUid& aUid ) const |
|
773 { |
|
774 FLOG_1( _L("CSisxSifPluginActiveImpl::GetComponentAndUidL, component %d"), aComponentId ); |
|
775 |
|
776 RSoftwareComponentRegistry scrSession; |
|
777 User::LeaveIfError( scrSession.Connect() ); |
|
778 CleanupClosePushL( scrSession ); |
|
779 |
|
780 if( scrSession.GetComponentL( aComponentId, aEntry ) ) |
|
781 { |
|
782 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentAndUidL, entry found") ); |
|
783 |
|
784 CPropertyEntry* propertyEntry = scrSession.GetComponentPropertyL( aComponentId, KCompUid ); |
|
785 CleanupStack::PushL( propertyEntry ); |
|
786 |
|
787 CIntPropertyEntry* intPropertyEntry = dynamic_cast< CIntPropertyEntry* >( propertyEntry ); |
|
788 if( !intPropertyEntry ) |
|
789 { |
|
790 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentUidL, UID property not found") ); |
|
791 User::Leave( KErrNotFound ); |
|
792 } |
|
793 aUid = TUid::Uid( intPropertyEntry->IntValue() ); |
|
794 |
|
795 CleanupStack::PopAndDestroy( propertyEntry ); |
|
796 } |
|
797 else |
|
798 { |
|
799 FLOG( _L("CSisxSifPluginActiveImpl::GetComponentAndUidL, entry not found") ); |
|
800 User::Leave( KErrNotFound ); |
|
801 } |
|
802 |
|
803 CleanupStack::PopAndDestroy( &scrSession ); |
773 } |
804 } |
774 |
805 |
775 // --------------------------------------------------------------------------- |
806 // --------------------------------------------------------------------------- |
776 // CSisxSifPluginActiveImpl::RequiresUserCapabilityL() |
807 // CSisxSifPluginActiveImpl::RequiresUserCapabilityL() |
777 // --------------------------------------------------------------------------- |
808 // --------------------------------------------------------------------------- |
793 } |
824 } |
794 return EFalse; |
825 return EFalse; |
795 } |
826 } |
796 |
827 |
797 // --------------------------------------------------------------------------- |
828 // --------------------------------------------------------------------------- |
|
829 // CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL() |
|
830 // --------------------------------------------------------------------------- |
|
831 // |
|
832 void CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL( const TDesC& aUri ) |
|
833 { |
|
834 if( aUri.Length() ) |
|
835 { |
|
836 HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() ); |
|
837 TPtr8 uri( uriBuf->Des() ); |
|
838 uri.Copy( aUri ); |
|
839 iInstallPrefs->SetRevocationServerUriL( uri ); |
|
840 CleanupStack::PopAndDestroy( uriBuf ); |
|
841 } |
|
842 else |
|
843 { |
|
844 iInstallPrefs->SetRevocationServerUriL( KNullDesC8 ); |
|
845 } |
|
846 } |
|
847 |
|
848 // --------------------------------------------------------------------------- |
|
849 // CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL() |
|
850 // --------------------------------------------------------------------------- |
|
851 // |
|
852 void CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL() |
|
853 { |
|
854 if( IsSilentMode() ) |
|
855 { |
|
856 TBool performOcsp( iInstallParams->PerformOCSP() != ENotAllowed ); |
|
857 iInstallPrefs->SetPerformRevocationCheck( performOcsp ); |
|
858 |
|
859 if( performOcsp ) |
|
860 { |
|
861 SetInstallPrefsRevocationServerUriL( iInstallParams->OCSPUrl() ); |
|
862 } |
|
863 } |
|
864 else |
|
865 { |
|
866 CRepository* cenRep = CRepository::NewLC( KCRUidSWInstallerSettings ); |
|
867 |
|
868 TInt ocspProcedure = ESWInstallerOcspProcedureOff; |
|
869 (void)cenRep->Get( KSWInstallerOcspProcedure, ocspProcedure ); |
|
870 TBool performOcsp( ocspProcedure != ESWInstallerOcspProcedureOff ); |
|
871 iInstallPrefs->SetPerformRevocationCheck( performOcsp ); |
|
872 |
|
873 if( performOcsp ) |
|
874 { |
|
875 HBufC* ocspUrlBuf = HBufC::NewLC( |
|
876 NCentralRepositoryConstants::KMaxUnicodeStringLength ); |
|
877 TPtr ocspUrl( ocspUrlBuf->Des() ); |
|
878 (void)cenRep->Get( KSWInstallerOcspDefaultURL, ocspUrl ); |
|
879 SetInstallPrefsRevocationServerUriL( ocspUrl ); |
|
880 CleanupStack::PopAndDestroy( ocspUrlBuf ); |
|
881 } |
|
882 |
|
883 CleanupStack::PopAndDestroy( cenRep ); |
|
884 } |
|
885 } |
|
886 |
|
887 // --------------------------------------------------------------------------- |
798 // CSisxSifPluginActiveImpl::StartInstallingL() |
888 // CSisxSifPluginActiveImpl::StartInstallingL() |
799 // --------------------------------------------------------------------------- |
889 // --------------------------------------------------------------------------- |
800 // |
890 // |
801 void CSisxSifPluginActiveImpl::StartInstallingL() |
891 void CSisxSifPluginActiveImpl::StartInstallingL() |
802 { |
892 { |
806 TInt maxInstalledSize = rootNode.MaxInstalledSize(); |
896 TInt maxInstalledSize = rootNode.MaxInstalledSize(); |
807 iUiHandler->SetMaxInstalledSize( maxInstalledSize ); |
897 iUiHandler->SetMaxInstalledSize( maxInstalledSize ); |
808 |
898 |
809 iUiHandler->PublishStartL( rootNode ); |
899 iUiHandler->PublishStartL( rootNode ); |
810 |
900 |
|
901 UpdateInstallPrefsForPerformingOcspL(); |
|
902 FillDeviceSupportedLanguagesL(); |
|
903 |
811 if( iFileHandle ) |
904 if( iFileHandle ) |
812 { |
905 { |
813 iAsyncLauncher->InstallL( *iUiHandler, *iFileHandle, *iInstallPrefs, iStatus ); |
906 iAsyncLauncher->InstallL( *iUiHandler, *iFileHandle, *iInstallPrefs, |
|
907 iDeviceSupportedLanguages, iStatus ); |
814 } |
908 } |
815 else if( iFileName ) |
909 else if( iFileName ) |
816 { |
910 { |
817 iAsyncLauncher->InstallL( *iUiHandler, *iFileName, *iInstallPrefs, iStatus ); |
911 iAsyncLauncher->InstallL( *iUiHandler, *iFileName, *iInstallPrefs, |
|
912 iDeviceSupportedLanguages, iStatus ); |
818 } |
913 } |
819 else |
914 else |
820 { |
915 { |
821 Panic( ESisxSifInternalError ); |
916 Panic( ESisxSifInternalError ); |
822 } |
917 } |
877 { |
972 { |
878 TComponentId componentId = GetLastInstalledComponentIdL(); |
973 TComponentId componentId = GetLastInstalledComponentIdL(); |
879 iOutputParams->AddIntL( KSifOutParam_ComponentId, componentId ); |
974 iOutputParams->AddIntL( KSifOutParam_ComponentId, componentId ); |
880 } |
975 } |
881 |
976 |
|
977 iUiHandler->PublishCompletionL(); |
882 iUiHandler->DisplayCompleteL(); |
978 iUiHandler->DisplayCompleteL(); |
883 iUiHandler->PublishCompletionL( *iErrorHandler ); |
|
884 } |
979 } |
885 |
980 |
886 // --------------------------------------------------------------------------- |
981 // --------------------------------------------------------------------------- |
887 // CSisxSifPluginActiveImpl::UpdateStartupListL() |
982 // CSisxSifPluginActiveImpl::UpdateStartupListL() |
888 // --------------------------------------------------------------------------- |
983 // --------------------------------------------------------------------------- |
919 |
1014 |
920 CleanupStack::PopAndDestroy( &process ); |
1015 CleanupStack::PopAndDestroy( &process ); |
921 } |
1016 } |
922 } |
1017 } |
923 |
1018 |
|
1019 // --------------------------------------------------------------------------- |
|
1020 // CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL() |
|
1021 // --------------------------------------------------------------------------- |
|
1022 // |
|
1023 void CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL() |
|
1024 { |
|
1025 FLOG( _L("CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL, begin") ); |
|
1026 |
|
1027 CArrayFixFlat<TInt>* installedLanguages = NULL; |
|
1028 TInt err = SysLangUtil::GetInstalledLanguages( installedLanguages, &iFs ); |
|
1029 CleanupStack::PushL( installedLanguages ); |
|
1030 User::LeaveIfError( err ); |
|
1031 if( installedLanguages ) |
|
1032 { |
|
1033 iDeviceSupportedLanguages.Reset(); |
|
1034 for( TInt index = 0; index < installedLanguages->Count(); index++ ) |
|
1035 { |
|
1036 TInt language = (*installedLanguages)[ index ]; |
|
1037 FLOG_1( _L("CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL: %d"), language ); |
|
1038 iDeviceSupportedLanguages.AppendL( language ); |
|
1039 } |
|
1040 } |
|
1041 CleanupStack::PopAndDestroy( installedLanguages ); |
|
1042 |
|
1043 FLOG( _L("CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL, end") ); |
|
1044 } |
|
1045 |