iaupdate/IAD/updater/src/iaupdaterinstaller.cpp
changeset 72 a0dc14075813
parent 0 ba25891c3a9e
child 77 d1838696558c
equal deleted inserted replaced
67:3a625661d1ce 72:a0dc14075813
    14 * Description:   Installs self update. 
    14 * Description:   Installs self update. 
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
       
    20 #include "iaupdaterinstaller.h"
    19 #include "iaupdaterinstaller.h"
    21 #include "iaupdatermngr.h"
    20 #include "iaupdatermngr.h"
    22 #include "iaupdatersilentlauncher.h"
    21 #include "iaupdatersilentlauncher.h"
    23 #include "iaupdaterdefs.h"
    22 #include "iaupdaterdefs.h"
    24 #include "iaupdatedebug.h"
    23 #include "iaupdatedebug.h"
       
    24 
       
    25 #include <usif/usiferror.h>
    25 
    26 
    26 
    27 
    27 // ======== LOCAL FUNCTIONS =========
    28 // ======== LOCAL FUNCTIONS =========
    28 
    29 
    29 // ======== MEMBER FUNCTIONS ========
    30 // ======== MEMBER FUNCTIONS ========
    79     
    80     
    80     iTimer.Close();
    81     iTimer.Close();
    81             
    82             
    82     iFilesToInstall.ResetAndDestroy();
    83     iFilesToInstall.ResetAndDestroy();
    83     delete iInstallLauncher;
    84     delete iInstallLauncher;
       
    85     
       
    86     delete iResults;
    84 
    87 
    85     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterInstaller::~CIAUpdaterInstaller end");
    88     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterInstaller::~CIAUpdaterInstaller end");
    86     }
    89     }
    87 	
    90 	
    88 
    91 
    93 //
    96 //
    94 void CIAUpdaterInstaller::ConstructL()
    97 void CIAUpdaterInstaller::ConstructL()
    95     {
    98     {
    96     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterInstaller::ConstructL begin");       
    99     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterInstaller::ConstructL begin");       
    97     User::LeaveIfError( iTimer.CreateLocal() );
   100     User::LeaveIfError( iTimer.CreateLocal() );
       
   101     iResults = Usif::COpaqueNamedParams::NewL();
    98     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterInstaller::ConstructL end");
   102     IAUPDATE_TRACE("[IAUpdater] CIAUpdaterInstaller::ConstructL end");
    99     }
   103     }
   100 
   104 
   101 
   105 
   102 // -----------------------------------------------------------------------------
   106 // -----------------------------------------------------------------------------
   245         {      
   249         {      
   246         // Reached when installation is completed. Check result.
   250         // Reached when installation is completed. Check result.
   247         case EDSisInstallerStateInstalling:
   251         case EDSisInstallerStateInstalling:
   248             { 
   252             { 
   249             IAUPDATE_TRACE("[IAUpdater] RunL() Sis Inst. state INSTALLING");                    
   253             IAUPDATE_TRACE("[IAUpdater] RunL() Sis Inst. state INSTALLING");                    
   250                                                                                      
   254             
   251             if ( iStatus.Int() == SwiUI::KSWInstErrBusy )
   255             // Get error category
       
   256             TInt errCategory = iResults->GetIntByNameL
       
   257                     (Usif::KSifOutParam_ErrCategory, errCategory);
       
   258             
       
   259             if ( errCategory == Usif::EInstallerBusy )
   252                 {
   260                 {
   253                 IAUPDATE_TRACE("[IAUpdater] RunL() SWInstaller Busy"); 
   261                 IAUPDATE_TRACE("[IAUpdater] RunL() SWInstaller Busy"); 
   254                 
   262                 
   255                 // User might be installing something, wait before retrying 
   263                 // User might be installing something, wait before retrying 
   256                 TTimeIntervalMicroSeconds32 time( 
   264                 TTimeIntervalMicroSeconds32 time( 
   258                 iTimer.After( iStatus, time );                
   266                 iTimer.After( iStatus, time );                
   259                 iState = EDSisInstallerStateInstallerBusy;
   267                 iState = EDSisInstallerStateInstallerBusy;
   260                 SetActive();                        
   268                 SetActive();                        
   261                 break;                        
   269                 break;                        
   262                 }                
   270                 }                
   263             else if ( (iStatus.Int() == SwiUI::KSWInstErrSecurityFailure && 
   271             else if ( (errCategory == Usif::ESecurityError && 
   264                 iInstallErr == KErrNone) ||
   272                 iInstallErr == KErrNone) ||
   265                 (iStatus.Int() != KErrNone && 
   273                 (iStatus.Int() != KErrNone && 
   266                 iStatus.Int() != SwiUI::KSWInstErrSecurityFailure) )
   274                  iStatus.Int() != errCategory == Usif::ESecurityError) )
   267                 {
   275                 {
   268                 IAUPDATE_TRACE("[IAUpdater] RunL() Ins. err or sec. failure"); 
   276                 IAUPDATE_TRACE("[IAUpdater] RunL() Ins. err or sec. failure"); 
   269                 
   277                 
   270                 iInstallErr = iStatus.Int();                                      
   278                 iInstallErr = iStatus.Int();                                      
   271                 }
   279                 }
   294                 {                               
   302                 {                               
   295                 iSisFile.Copy( *iFilesToInstall[iFileIndex] );
   303                 iSisFile.Copy( *iFilesToInstall[iFileIndex] );
   296                 ++iFileIndex;
   304                 ++iFileIndex;
   297 
   305 
   298                 IAUPDATE_TRACE_1("[IAUpdater] RunL() Start install %S", &iSisFile ); 
   306                 IAUPDATE_TRACE_1("[IAUpdater] RunL() Start install %S", &iSisFile ); 
   299                 iInstallLauncher->InstallL( iSisFile, iStatus );                
   307                 iInstallLauncher->InstallL( iSisFile, iStatus, iResults );                
   300                 iState = EDSisInstallerStateInstalling;                    
   308                 iState = EDSisInstallerStateInstalling;                    
   301                 SetActive();
   309                 SetActive();
   302                 }
   310                 }
   303             else
   311             else
   304                 {
   312                 {
   310         case EDSisInstallerStateInstallerBusy:
   318         case EDSisInstallerStateInstallerBusy:
   311             {
   319             {
   312             IAUPDATE_TRACE("[IAUpdater] RunL() Sis Inst. state INSTALLER BUSY");  
   320             IAUPDATE_TRACE("[IAUpdater] RunL() Sis Inst. state INSTALLER BUSY");  
   313             IAUPDATE_TRACE_1("[IAUpdater] RunL() Start install for %S", &iSisFile ); 
   321             IAUPDATE_TRACE_1("[IAUpdater] RunL() Start install for %S", &iSisFile ); 
   314                         
   322                         
   315             iInstallLauncher->InstallL( iSisFile, iStatus );
   323             iInstallLauncher->InstallL( iSisFile, iStatus, iResults );
   316             iState = EDSisInstallerStateInstalling;
   324             iState = EDSisInstallerStateInstalling;
   317 
   325 
   318             SetActive();                 
   326             SetActive();                 
   319             }
   327             }
   320             break;                       
   328             break;