appinstaller/AppinstUi/sisxsifplugin/src/sisxsifpluginactiveimpl.cpp
changeset 80 9dcba1ee99f7
parent 69 b18a4bf55ddb
equal deleted inserted replaced
77:d1838696558c 80:9dcba1ee99f7
    36 #include <featmgr.h>                        // FeatureManager
    36 #include <featmgr.h>                        // FeatureManager
    37 #include <syslangutil.h>                    // GetInstalledLanguages
    37 #include <syslangutil.h>                    // GetInstalledLanguages
    38 
    38 
    39 // TODO: replace with proper logging
    39 // TODO: replace with proper logging
    40 #ifdef _DEBUG
    40 #ifdef _DEBUG
    41 #define FLOG(x)         RDebug::Print(x);
    41 #define FLOG(x)         RDebug::Print(x)
    42 #define FLOG_1(x,y)     RDebug::Print(x, y);
    42 #define FLOG_1(x,y)     RDebug::Print((x),(y))
    43 #define FLOG_2(x,y,z)   RDebug::Print(x, y, z);
    43 #define FLOG_2(x,y,z)   RDebug::Print((x),(y),(z))
    44 #define FLOG_3(x,y,z,v) RDebug::Print(x, y, z, v);
    44 #define FLOG_3(x,y,z,v) RDebug::Print((x),(y),(z),(v))
    45 #else
    45 #else
    46 #define FLOG(x)
    46 #define FLOG(x)
    47 #define FLOG_1(x,y)
    47 #define FLOG_1(x,y)
    48 #define FLOG_2(x,y,z)
    48 #define FLOG_2(x,y,z)
    49 #define FLOG_3(x,y,z,v)
    49 #define FLOG_3(x,y,z,v)
   631 void CSisxSifPluginActiveImpl::DoUninstallL( TComponentId aComponentId,
   631 void CSisxSifPluginActiveImpl::DoUninstallL( TComponentId aComponentId,
   632 		const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams,
   632 		const COpaqueNamedParams& aInputParams, COpaqueNamedParams& aOutputParams,
   633 		TRequestStatus& aStatus )
   633 		TRequestStatus& aStatus )
   634     {
   634     {
   635     CommonRequestPreambleL( aInputParams, aOutputParams, aStatus );
   635     CommonRequestPreambleL( aInputParams, aOutputParams, aStatus );
       
   636     FLOG_1( _L("CSisxSifPluginActiveImpl::DoUninstallL, IsSilentMode=%d"), IsSilentMode() );
   636 
   637 
   637     TUid uid;
   638     TUid uid;
   638     CComponentEntry *entry = CComponentEntry::NewLC();
   639     CComponentEntry *entry = CComponentEntry::NewLC();
   639     GetComponentAndUidL( aComponentId, *entry, uid );
   640     GetComponentAndUidL( aComponentId, *entry, uid );
   640     iUiHandler->PublishStartL( *entry, EUninstalling );
   641     iUiHandler->PublishStartL( *entry, EUninstalling );
   653 //
   654 //
   654 void CSisxSifPluginActiveImpl::DoActivateL( TComponentId aComponentId,
   655 void CSisxSifPluginActiveImpl::DoActivateL( TComponentId aComponentId,
   655         TRequestStatus& aStatus )
   656         TRequestStatus& aStatus )
   656     {
   657     {
   657     CommonRequestPreambleL( aStatus );
   658     CommonRequestPreambleL( aStatus );
       
   659     FLOG( _L("CSisxSifPluginActiveImpl::DoActivateL()") );
   658 
   660 
   659     Swi::RSisRegistryWritableSession sisRegSession;
   661     Swi::RSisRegistryWritableSession sisRegSession;
   660     User::LeaveIfError( sisRegSession.Connect() );
   662     User::LeaveIfError( sisRegSession.Connect() );
   661     CleanupClosePushL( sisRegSession );
   663     CleanupClosePushL( sisRegSession );
   662     sisRegSession.ActivateComponentL( aComponentId );
   664     sisRegSession.ActivateComponentL( aComponentId );
   675 //
   677 //
   676 void CSisxSifPluginActiveImpl::DoDeactivateL( TComponentId aComponentId,
   678 void CSisxSifPluginActiveImpl::DoDeactivateL( TComponentId aComponentId,
   677         TRequestStatus& aStatus )
   679         TRequestStatus& aStatus )
   678     {
   680     {
   679     CommonRequestPreambleL( aStatus );
   681     CommonRequestPreambleL( aStatus );
       
   682     FLOG( _L("CSisxSifPluginActiveImpl::DoDeactivateL()") );
   680 
   683 
   681     Swi::RSisRegistryWritableSession sisRegSession;
   684     Swi::RSisRegistryWritableSession sisRegSession;
   682     User::LeaveIfError( sisRegSession.Connect() );
   685     User::LeaveIfError( sisRegSession.Connect() );
   683     CleanupClosePushL( sisRegSession );
   686     CleanupClosePushL( sisRegSession );
   684     sisRegSession.DeactivateComponentL( aComponentId );
   687     sisRegSession.DeactivateComponentL( aComponentId );
   745 // CSisxSifPluginActiveImpl::GetLastInstalledComponentIdL()
   748 // CSisxSifPluginActiveImpl::GetLastInstalledComponentIdL()
   746 // ---------------------------------------------------------------------------
   749 // ---------------------------------------------------------------------------
   747 //
   750 //
   748 TComponentId CSisxSifPluginActiveImpl::GetLastInstalledComponentIdL()
   751 TComponentId CSisxSifPluginActiveImpl::GetLastInstalledComponentIdL()
   749     {
   752     {
       
   753     FLOG( _L("CSisxSifPluginActiveImpl::GetLastInstalledComponentIdL, begin") );
   750     __ASSERT_DEBUG( iOperation == EInstall, Panic( ESisxSifInternalError ) );
   754     __ASSERT_DEBUG( iOperation == EInstall, Panic( ESisxSifInternalError ) );
   751 
   755 
   752     // Find the id of the last installed component and return it
   756     // Find the id of the last installed component and return it
   753     TInt uid;
   757     TInt uid;
   754     User::LeaveIfError( RProperty::Get( KUidSystemCategory, KUidSwiLatestInstallation, uid ) );
   758     User::LeaveIfError( RProperty::Get( KUidSystemCategory, KUidSwiLatestInstallation, uid ) );
   759 
   763 
   760     TUid tuid( TUid::Uid( uid ) );
   764     TUid tuid( TUid::Uid( uid ) );
   761     TComponentId componentId = sisRegistrySession.GetComponentIdForUidL( tuid );
   765     TComponentId componentId = sisRegistrySession.GetComponentIdForUidL( tuid );
   762     CleanupStack::PopAndDestroy( &sisRegistrySession );
   766     CleanupStack::PopAndDestroy( &sisRegistrySession );
   763 
   767 
       
   768     FLOG_1( _L("CSisxSifPluginActiveImpl::GetLastInstalledComponentIdL, ret 0x%08x"), componentId );
   764     return componentId;
   769     return componentId;
   765     }
   770     }
   766 
   771 
   767 // ---------------------------------------------------------------------------
   772 // ---------------------------------------------------------------------------
   768 // CSisxSifPluginActiveImpl::GetComponentAndUidL()
   773 // CSisxSifPluginActiveImpl::GetComponentAndUidL()
   829 // CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL()
   834 // CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL()
   830 // ---------------------------------------------------------------------------
   835 // ---------------------------------------------------------------------------
   831 //
   836 //
   832 void CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL( const TDesC& aUri )
   837 void CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL( const TDesC& aUri )
   833     {
   838     {
       
   839     FLOG_1( _L("CSisxSifPluginActiveImpl::SetInstallPrefsRevocationServerUriL '%S'"), &aUri );
       
   840     
   834     if( aUri.Length() )
   841     if( aUri.Length() )
   835         {
   842         {
   836         HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() );
   843         HBufC8* uriBuf = HBufC8::NewLC( aUri.Length() );
   837         TPtr8 uri( uriBuf->Des() );
   844         TPtr8 uri( uriBuf->Des() );
   838         uri.Copy( aUri );
   845         uri.Copy( aUri );
   849 // CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL()
   856 // CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL()
   850 // ---------------------------------------------------------------------------
   857 // ---------------------------------------------------------------------------
   851 //
   858 //
   852 void CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL()
   859 void CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL()
   853     {
   860     {
   854     if( IsSilentMode() )
   861     FLOG( _L("CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL") );
   855         {
   862 
   856         TBool performOcsp( iInstallParams->PerformOCSP() != ENotAllowed );
   863     TBool performOcsp = EFalse;
   857         iInstallPrefs->SetPerformRevocationCheck( performOcsp );
   864     /*
   858 
   865      * performOcsp decision table:
   859         if( performOcsp )
   866      *
       
   867      * KSWInstallerOcspProcedure settings:
       
   868      *                 |  Must    |  On      |  Off     |  Undefined  |
       
   869      * ----------------+----------+----------+----------+-------------+
       
   870      * Normal install: |  ETrue   |  ETrue   |  EFalse  |  EFalse     |
       
   871      * ----------------+----------+----------+----------+-------------+
       
   872      * Silent install having KSifInParam_PerformOCSP value:           |
       
   873      * - EAllowed      |  ETrue   |  ETrue   |  EFalse  |  EFalse     |
       
   874      * - ENotAllowed   |  ETrue   |  EFalse  |  EFalse  |  EFalse     |
       
   875      * - EUserConfirm  |  ETrue   |  ETrue   |  EFalse  |  EFalse     |
       
   876      * - undefined     |  ETrue   |  ETrue   |  EFalse  |  EFalse     |
       
   877      * ----------------+----------+----------+----------+-------------+
       
   878      */
       
   879 
       
   880     CRepository* cenRep = CRepository::NewLC( KCRUidSWInstallerSettings );
       
   881     TInt ocspProcedure = ESWInstallerOcspProcedureOff;
       
   882     cenRep->Get( KSWInstallerOcspProcedure, ocspProcedure );    // return value ignored
       
   883     FLOG_1( _L("CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL, ocspProcedure=%d"),
       
   884             ocspProcedure );
       
   885     switch( ocspProcedure )
       
   886         {
       
   887         case ESWInstallerOcspProcedureMust:
       
   888             performOcsp = ETrue;
       
   889             break;
       
   890         case ESWInstallerOcspProcedureOn:
       
   891             if( IsSilentMode() )
       
   892                 {
       
   893                 performOcsp = ( iInstallParams->PerformOCSP() != ENotAllowed );
       
   894                 }
       
   895             else
       
   896                 {
       
   897                 performOcsp = ETrue;
       
   898                 }
       
   899             break;
       
   900         case ESWInstallerOcspProcedureOff:
       
   901         default:
       
   902             // already EFalse
       
   903             break;
       
   904         }
       
   905     FLOG_1( _L("CSisxSifPluginActiveImpl::UpdateInstallPrefsForPerformingOcspL, performOcsp=%d"),
       
   906         performOcsp );
       
   907 
       
   908     if( performOcsp )
       
   909         {
       
   910         if( IsSilentMode() && iInstallParams->OCSPUrl().Length() )
   860             {
   911             {
   861             SetInstallPrefsRevocationServerUriL( iInstallParams->OCSPUrl() );
   912             SetInstallPrefsRevocationServerUriL( iInstallParams->OCSPUrl() );
   862             }
   913             }
   863         }
   914         else
   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             {
   915             {
   875             HBufC* ocspUrlBuf = HBufC::NewLC(
   916             HBufC* ocspUrlBuf = HBufC::NewLC(
   876                     NCentralRepositoryConstants::KMaxUnicodeStringLength );
   917                     NCentralRepositoryConstants::KMaxUnicodeStringLength );
   877             TPtr ocspUrl( ocspUrlBuf->Des() );
   918             TPtr ocspUrl( ocspUrlBuf->Des() );
   878             (void)cenRep->Get( KSWInstallerOcspDefaultURL, ocspUrl );
   919             cenRep->Get( KSWInstallerOcspDefaultURL, ocspUrl );     // return value ignored
   879             SetInstallPrefsRevocationServerUriL( ocspUrl );
   920             SetInstallPrefsRevocationServerUriL( ocspUrl );
   880             CleanupStack::PopAndDestroy( ocspUrlBuf );
   921             CleanupStack::PopAndDestroy( ocspUrlBuf );
   881             }
   922             }
   882 
   923         }
   883         CleanupStack::PopAndDestroy( cenRep );
   924 
   884         }
   925     CleanupStack::PopAndDestroy( cenRep );
   885     }
   926     }
   886 
   927 
   887 // ---------------------------------------------------------------------------
   928 // ---------------------------------------------------------------------------
   888 // CSisxSifPluginActiveImpl::StartInstallingL()
   929 // CSisxSifPluginActiveImpl::StartInstallingL()
   889 // ---------------------------------------------------------------------------
   930 // ---------------------------------------------------------------------------
   890 //
   931 //
   891 void CSisxSifPluginActiveImpl::StartInstallingL()
   932 void CSisxSifPluginActiveImpl::StartInstallingL()
   892     {
   933     {
       
   934     FLOG( _L("CSisxSifPluginActiveImpl::StartInstallingL, begin") );
       
   935 
   893 	const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() );
   936 	const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() );
   894 	TBool driveSelection = rootNode.DriveSeletionRequired();
   937 	TBool driveSelection = rootNode.DriveSeletionRequired();
   895 	iUiHandler->SetDriveSelectionRequired( driveSelection );
   938 	iUiHandler->SetDriveSelectionRequired( driveSelection );
   896 	TInt maxInstalledSize = rootNode.MaxInstalledSize();
   939 	TInt maxInstalledSize = rootNode.MaxInstalledSize();
   897 	iUiHandler->SetMaxInstalledSize( maxInstalledSize );
   940 	iUiHandler->SetMaxInstalledSize( maxInstalledSize );
   916         Panic( ESisxSifInternalError );
   959         Panic( ESisxSifInternalError );
   917         }
   960         }
   918 
   961 
   919     iPhase = ERunningOperation;
   962     iPhase = ERunningOperation;
   920     SetActive();
   963     SetActive();
       
   964 
       
   965     FLOG( _L("CSisxSifPluginActiveImpl::StartInstallingL, end") );
   921     }
   966     }
   922 
   967 
   923 // ---------------------------------------------------------------------------
   968 // ---------------------------------------------------------------------------
   924 // CSisxSifPluginActiveImpl::StartSilentInstallingL()
   969 // CSisxSifPluginActiveImpl::StartSilentInstallingL()
   925 // ---------------------------------------------------------------------------
   970 // ---------------------------------------------------------------------------
   926 //
   971 //
   927 void CSisxSifPluginActiveImpl::StartSilentInstallingL()
   972 void CSisxSifPluginActiveImpl::StartSilentInstallingL()
   928     {
   973     {
       
   974     FLOG( _L("CSisxSifPluginActiveImpl::StartSilentInstallingL, begin") );
       
   975 
   929     // TODO: fix this, removed temporarily to allow installations
   976     // TODO: fix this, removed temporarily to allow installations
   930 #ifdef _NOT_DEFINED_
   977 #ifdef _NOT_DEFINED_
   931     const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() );
   978     const CComponentInfo::CNode& rootNode( iComponentInfo->RootNodeL() );
   932     TBool isAuthenticated = ( rootNode.Authenticity() == EAuthenticated );
   979     TBool isAuthenticated = ( rootNode.Authenticity() == EAuthenticated );
   933 
   980 
   956     else
  1003     else
   957 #endif
  1004 #endif
   958         {
  1005         {
   959         StartInstallingL();
  1006         StartInstallingL();
   960         }
  1007         }
       
  1008 
       
  1009     FLOG( _L("CSisxSifPluginActiveImpl::StartSilentInstallingL, end") );
   961     }
  1010     }
   962 
  1011 
   963 // ---------------------------------------------------------------------------
  1012 // ---------------------------------------------------------------------------
   964 // CSisxSifPluginActiveImpl::FinalizeInstallationL()
  1013 // CSisxSifPluginActiveImpl::FinalizeInstallationL()
   965 // ---------------------------------------------------------------------------
  1014 // ---------------------------------------------------------------------------
   966 //
  1015 //
   967 void CSisxSifPluginActiveImpl::FinalizeInstallationL()
  1016 void CSisxSifPluginActiveImpl::FinalizeInstallationL()
   968     {
  1017     {
       
  1018     FLOG( _L("CSisxSifPluginActiveImpl::FinalizeInstallationL, begin") );
       
  1019 
   969     UpdateStartupListL();
  1020     UpdateStartupListL();
   970 
  1021 
   971     if( iOutputParams )
  1022     if( iOutputParams )
   972         {
  1023         {
   973         TComponentId componentId = GetLastInstalledComponentIdL();
  1024         TComponentId componentId = GetLastInstalledComponentIdL();
   974         iOutputParams->AddIntL( KSifOutParam_ComponentId, componentId );
  1025         iOutputParams->AddIntL( KSifOutParam_ComponentId, componentId );
   975         }
  1026         }
   976 
  1027 
   977     iUiHandler->PublishCompletionL();
  1028     iUiHandler->PublishCompletionL();
   978 	iUiHandler->DisplayCompleteL();
  1029 	iUiHandler->DisplayCompleteL();
       
  1030 
       
  1031 	FLOG( _L("CSisxSifPluginActiveImpl::FinalizeInstallationL, end") );
   979     }
  1032     }
   980 
  1033 
   981 // ---------------------------------------------------------------------------
  1034 // ---------------------------------------------------------------------------
   982 // CSisxSifPluginActiveImpl::UpdateStartupListL()
  1035 // CSisxSifPluginActiveImpl::UpdateStartupListL()
   983 // ---------------------------------------------------------------------------
  1036 // ---------------------------------------------------------------------------
   984 //
  1037 //
   985 void CSisxSifPluginActiveImpl::UpdateStartupListL()
  1038 void CSisxSifPluginActiveImpl::UpdateStartupListL()
   986     {
  1039     {
       
  1040     FLOG( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, begin") );
       
  1041 
   987     if( FeatureManager::FeatureSupported( KFeatureIdExtendedStartup ) )
  1042     if( FeatureManager::FeatureSupported( KFeatureIdExtendedStartup ) )
   988         {
  1043         {
       
  1044         FLOG( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, KFeatureIdExtendedStartup") );
       
  1045 
   989         TFullName name( KStartupListUpdaterName );
  1046         TFullName name( KStartupListUpdaterName );
   990         name.Append( '*' );
  1047         name.Append( '*' );
   991         TFindProcess findProcess( name );
  1048         TFindProcess findProcess( name );
   992         if( findProcess.Next( name ) == KErrNone )
  1049         if( findProcess.Next( name ) == KErrNone )
   993             {
  1050             {
   994             // already running, no need to do anything
  1051             // already running, no need to do anything
       
  1052             FLOG( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, startuplistupdater running") );
   995             return;
  1053             return;
   996             }
  1054             }
   997 
  1055 
   998         RProcess process;
  1056         RProcess process;
   999         CleanupClosePushL( process );
  1057         CleanupClosePushL( process );
  1000 
  1058 
  1001         TInt result = process.Create( KStartupListUpdaterExecutable, KNullDesC );
  1059         TInt result = process.Create( KStartupListUpdaterExecutable, KNullDesC );
       
  1060         FLOG_1( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, create result=%d"), result );
  1002         if( result == KErrNone )
  1061         if( result == KErrNone )
  1003             {
  1062             {
  1004             TRequestStatus rendezvousStatus;
  1063             TRequestStatus rendezvousStatus;
  1005             process.Rendezvous( rendezvousStatus );
  1064             process.Rendezvous( rendezvousStatus );
  1006 
  1065 
  1007             // start process and wait until it is started
  1066             // start process and wait until it is started
  1008             process.Resume();
  1067             process.Resume();
       
  1068             FLOG( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, waiting for rendezvous") );
  1009             User::WaitForRequest( rendezvousStatus );
  1069             User::WaitForRequest( rendezvousStatus );
  1010 
  1070 
  1011             // ignore possible errors
  1071             // ignore possible errors
  1012             result = rendezvousStatus.Int();
  1072             result = rendezvousStatus.Int();
       
  1073             FLOG_1( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, result=%d"), result );
  1013             }
  1074             }
  1014 
  1075 
  1015         CleanupStack::PopAndDestroy( &process );
  1076         CleanupStack::PopAndDestroy( &process );
  1016         }
  1077         }
       
  1078 
       
  1079     FLOG( _L("CSisxSifPluginActiveImpl::UpdateStartupListL, end") );
  1017     }
  1080     }
  1018 
  1081 
  1019 // ---------------------------------------------------------------------------
  1082 // ---------------------------------------------------------------------------
  1020 // CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL()
  1083 // CSisxSifPluginActiveImpl::FillDeviceSupportedLanguagesL()
  1021 // ---------------------------------------------------------------------------
  1084 // ---------------------------------------------------------------------------