appinstaller/AppinstUi/Daemon/Src/daemoninstaller.cpp
changeset 29 26b6f0522fd8
parent 25 98b66e4fb0be
child 37 6e7b00453237
equal deleted inserted replaced
25:98b66e4fb0be 29:26b6f0522fd8
    89     Cancel();
    89     Cancel();
    90     iTimer.Close();
    90     iTimer.Close();
    91     iFilesToInstall.ResetAndDestroy();
    91     iFilesToInstall.ResetAndDestroy();
    92     iFilesToInstall.Close();
    92     iFilesToInstall.Close();
    93     delete iInstallLauncher;
    93     delete iInstallLauncher;
    94     delete iDialogs;  
    94     delete iDialogs;      
    95     iFs.Close();
       
    96     iApaSession.Close();    
       
    97     delete iPreviouslyInstalledAppsCache;
    95     delete iPreviouslyInstalledAppsCache;
    98     delete iInstallationFailedAppsCache;  
    96     delete iInstallationFailedAppsCache;  
    99     delete iShutdownWatcher;  
    97     delete iShutdownWatcher;
       
    98     
       
    99     if ( iFileOpen )
       
   100         {
       
   101         iSisFileHandle.Close();   
       
   102         }    
       
   103     
       
   104     iFs.Close();
       
   105     iApaSession.Close();        
   100     }
   106     }
   101 	
   107 	
   102 // -----------------------------------------------------------------------
   108 // -----------------------------------------------------------------------
   103 // 2nd phase construction
   109 // 2nd phase construction
   104 // -----------------------------------------------------------------------
   110 // -----------------------------------------------------------------------
   115     iShutdownWatcher = CShutdownWatcher::NewL( *this );
   121     iShutdownWatcher = CShutdownWatcher::NewL( *this );
   116     iShutdownWatcher->Start();
   122     iShutdownWatcher->Start();
   117     // For uninstaller
   123     // For uninstaller
   118     // SisInstaller do not own this so do not delete.     
   124     // SisInstaller do not own this so do not delete.     
   119     iProgramStatus = &aMainStatus;  
   125     iProgramStatus = &aMainStatus;  
   120     iUpdateCache = ETrue;       
   126     iUpdateCache = ETrue;    
       
   127     iFileOpen = EFalse;    
   121     }
   128     }
   122 		
   129 		
   123 // -----------------------------------------------------------------------
   130 // -----------------------------------------------------------------------
   124 // CSisInstaller::AddFileToInstallL
   131 // CSisInstaller::AddFileToInstallL
   125 // Set the location of all sis files and the list of them
   132 // Set the location of all sis files and the list of them
   167     FLOG_1( _L("[CSisInstaller] ConstructL iGeneralProcessStatus = %d"),
   174     FLOG_1( _L("[CSisInstaller] ConstructL iGeneralProcessStatus = %d"),
   168             iGeneralProcessStatus );  
   175             iGeneralProcessStatus );  
   169         
   176         
   170     if ( !iInstallLauncher )
   177     if ( !iInstallLauncher )
   171         {
   178         {
   172         iInstallLauncher = CSilentLauncher::NewL( iFs );
   179         iInstallLauncher = CSilentLauncher::NewL( iFs );   
       
   180         
       
   181         // Update cache so we do not try to start install for
       
   182         // components which are installed. This is done always
       
   183         // when new install session is started (e.g. after mmc insert).
       
   184         FLOG( _L("Daemon: StartInstallingL: Update installed cache") );
       
   185         TRAP_IGNORE( iPreviouslyInstalledAppsCache->UpdateAllL() );
       
   186         TRAP_IGNORE( iPreviouslyInstalledAppsCache->FlushToDiskL() );         
   173         }   
   187         }   
   174 
   188 
   175     if ( iState == EDSisInstallerStateIdle )
   189     if ( iState == EDSisInstallerStateIdle )
   176         {
   190         {                
   177         // Reset the error
   191         // Reset the error
   178         iInstallErr = KErrNone; 
   192         iInstallErr = KErrNone; 
   179         // Update cache so we do not try to start install for
   193           
   180         // components which are installed.
       
   181         FLOG( _L("Daemon: StartInstallingL: Update installed cache") );
       
   182         TRAP_IGNORE( iPreviouslyInstalledAppsCache->UpdateAllL() );
       
   183         TRAP_IGNORE( iPreviouslyInstalledAppsCache->FlushToDiskL() );    
       
   184         
       
   185         CompleteSelf();
   194         CompleteSelf();
   186         }
   195         }
   187     }
   196     }
   188     
   197     
   189 // -----------------------------------------------------------------------
   198 // -----------------------------------------------------------------------
   256 // sisx file
   265 // sisx file
   257 // -----------------------------------------------------------------------
   266 // -----------------------------------------------------------------------
   258 //
   267 //
   259 void CSisInstaller::RunL()
   268 void CSisInstaller::RunL()
   260     {
   269     {
   261     FLOG_2( _L("Daemon: Installer RunL status:%d, state:%d"), iStatus.Int(), iState );                
   270     FLOG_1( _L("Daemon: Installer RunL status:%d"), iStatus.Int() );  
       
   271     FLOG_1( _L("Daemon: Installer RunL state:%d"), iState );                
   262     
   272     
   263     // For uninstaller
   273     // For uninstaller
   264     // Check that uninstaller is not running.
   274     // Check that uninstaller is not running.
   265     if ( EStateUninstalling == iProgramStatus->GetProgramStatus() )
   275     if ( EStateUninstalling == iProgramStatus->GetProgramStatus() )
   266         {
   276         {
   282         switch (iState)
   292         switch (iState)
   283             {      
   293             {      
   284             // Reached when installation is completed
   294             // Reached when installation is completed
   285             case EDSisInstallerStateInstalling:
   295             case EDSisInstallerStateInstalling:
   286                 FLOG( _L("Daemon: RunL: EDSisInstallerStateInstalling") );
   296                 FLOG( _L("Daemon: RunL: EDSisInstallerStateInstalling") );
   287                 FLOG_1( _L("Daemon: Installation completed with %d"), iStatus.Int() );                    
   297                 FLOG_1( _L("Daemon: Installation completed with %d"), 
   288                 // Installation is completed, check result
   298                         iStatus.Int() );                  
   289                 
   299                 
       
   300                 // Installation is completed, check result                
   290                 if ( iStatus.Int() == SwiUI::KSWInstErrBusy )
   301                 if ( iStatus.Int() == SwiUI::KSWInstErrBusy )
   291                     {
   302                     {
   292                     FLOG( _L("Daemon: RunL: iStatus: KSWInstErrBusy") );
   303                     FLOG( _L("Daemon: RunL: iStatus: KSWInstErrBusy") );
   293                     // User might be installing something, wait before retrying 
   304                     // User might be installing something, wait before retrying 
   294                     TTimeIntervalMicroSeconds32 time( KInstallRetryWaitTime );                        
   305                     TTimeIntervalMicroSeconds32 time( KInstallRetryWaitTime );                        
   296                     iState = EDSisInstallerStateInstallerBusy;               
   307                     iState = EDSisInstallerStateInstallerBusy;               
   297                     iInstallerState = iState;                                  
   308                     iInstallerState = iState;                                  
   298                     SetActive();                        
   309                     SetActive();                        
   299                     break;                        
   310                     break;                        
   300                     }                
   311                     }                
   301                 else if ( (iStatus.Int() == SwiUI::KSWInstErrSecurityFailure && iInstallErr == KErrNone) ||
   312                 else if ( (iStatus.Int() == SwiUI::KSWInstErrSecurityFailure && 
   302                           (iStatus.Int() != KErrNone && iStatus.Int() != SwiUI::KSWInstErrSecurityFailure) )
   313                            iInstallErr == KErrNone) ||
   303                     {
   314                           (iStatus.Int() != KErrNone && 
   304                     FLOG( _L("Daemon: RunL: iStatus: KSWInstErrSecurityFailure or error") );
   315                            iStatus.Int() != SwiUI::KSWInstErrSecurityFailure) )
       
   316                     {
       
   317                     FLOG( _L("Daemon: RunL: iStatus: error of sec. failure") );
   305                     iInstallErr = iStatus.Int();                        
   318                     iInstallErr = iStatus.Int();                        
       
   319                     }
       
   320                 
       
   321                 // Close current sisx except if installer engine is busy.
       
   322                 // If installer is busy we will try again later.
       
   323                 if ( iStatus.Int() != SwiUI::KSWInstErrBusy )
       
   324                     {
       
   325                     if ( iFileOpen )
       
   326                          {
       
   327                          FLOG_1( _L("Daemon: RunL: Close File: %S"), &iSisFile );
       
   328                          iSisFileHandle.Close();
       
   329                          iFileOpen = EFalse;
       
   330                          }    
   306                     }
   331                     }
   307                     
   332                     
   308                 // Catch all installation error from SwiUI and update cache.              
   333                 // Catch all installation error from SwiUI and update cache.              
   309                 if ( iStatus.Int() != KErrNone )
   334                 if ( iStatus.Int() != KErrNone )
   310                     {                                
   335                     {                                
   311                     FLOG( _L("Daemon: RunL: Installation error.") );
   336                     FLOG( _L("Daemon: RunL: Installation error.") );
   312                     if ( iCurrentPackageId != TUid::Uid( NULL ) )
   337                     if ( iCurrentPackageId != TUid::Uid( NULL ) )
   313                         {
   338                         {
   314                         FLOG( _L("Daemon: RunL: Add UID to cache.") );                    
   339                         FLOG( _L("Daemon: RunL: Add UID to cache.") );                    
   315                         iInstallationFailedAppsCache->AddPackageUID( iCurrentPackageId ); 
   340                         iInstallationFailedAppsCache->AddPackageUID( 
       
   341                                 iCurrentPackageId ); 
   316                         // Clear current UID                    
   342                         // Clear current UID                    
   317                         iCurrentPackageId = TUid::Null();                     
   343                         iCurrentPackageId = TUid::Null();                     
   318                         }
   344                         }                                                         
   319                     }  
   345                     }  
   320                  else
   346                  else
   321                     {
   347                     {
   322                     FLOG( _L("Daemon: RunL: Installation OK.") );
   348                     FLOG( _L("Daemon: RunL: Installation OK.") );
   323                     if ( iCurrentPackageId != TUid::Uid( NULL ) )
   349                     if ( iCurrentPackageId != TUid::Uid( NULL ) )
   324                         {                
   350                         {                
   325                         FLOG( _L("Daemon: RunL: Add UID to cache.") );
   351                         FLOG( _L("Daemon: RunL: Add UID to cache.") );
   326                         iPreviouslyInstalledAppsCache->UpdateAddL( iCurrentPackageId );                        
   352                         iPreviouslyInstalledAppsCache->UpdateAddL( 
       
   353                                 iCurrentPackageId );                        
   327                         // Clear current UID                    
   354                         // Clear current UID                    
   328                         iCurrentPackageId = TUid::Null(); 
   355                         iCurrentPackageId = TUid::Null(); 
   329                         }
   356                         }
   330                     }                                                               
   357                     }                                                               
   331     
   358     
   347                 break;
   374                 break;
   348     			
   375     			
   349                 // Install a file
   376                 // Install a file
   350             case EDSisInstallerStateIdle:
   377             case EDSisInstallerStateIdle:
   351                 {  
   378                 {  
   352                 FLOG( _L("Daemon: RunL: EDSisInstallerStateIdle") );    
   379                 FLOG( _L("Daemon: RunL: EDSisInstallerStateIdle") );  
       
   380                 
       
   381                 // Make sure that current file is closed before we
       
   382                 // open new file handle.
       
   383                 if ( iFileOpen )
       
   384                     {
       
   385                     FLOG( _L("Daemon: RunL: StateIdle: CLOSE CURRENT FILE") );
       
   386                     FLOG_1( _L("Daemon: RunL: Close File: %S"), &iSisFile );
       
   387                     iSisFileHandle.Close();
       
   388                     iFileOpen = EFalse;
       
   389                     }    
   353                 
   390                 
   354                 // Let's update installed apps cache so we do not give
   391                 // Let's update installed apps cache so we do not give
   355                 // installed pacakges several time to plug-in. 
   392                 // installed pacakges several time to plug-in. 
   356                 if ( iUpdateCache && iDaemonBehaviour->IsPlugin() )
   393                 if ( iUpdateCache && iDaemonBehaviour->IsPlugin() )
   357                     {
   394                     {
   361                     // InstallationCompleted will set this ETrue again.
   398                     // InstallationCompleted will set this ETrue again.
   362                     iUpdateCache = EFalse;
   399                     iUpdateCache = EFalse;
   363                     }
   400                     }
   364                 
   401                 
   365                 if ( iFileIndex < iFilesToInstall.Count() )
   402                 if ( iFileIndex < iFilesToInstall.Count() )
   366                     {             
   403                     { 
       
   404                     // Get next sisx package from array.                 
   367                     iSisFile.Copy( *iFilesToInstall[iFileIndex] );
   405                     iSisFile.Copy( *iFilesToInstall[iFileIndex] );
   368                     ++iFileIndex;
   406                     ++iFileIndex;    
   369                                
   407                     
   370                     // No need to install if the package has been installed 
   408                     FLOG_1( _L("Daemon: RunL: Open File: %S"), &iSisFile );
   371                     // some time in the past
   409                     TInt err = KErrNone;
   372                     if ( IsValidPackageL( iSisFile ) && NeedsInstallingL( iSisFile ) )
   410                     // Let's open the file in here bacause IsValidPackageL
   373                         { 
   411                     // needs to open the file anyway.
       
   412                     err = iSisFileHandle.Open( 
       
   413                                        iFs, 
       
   414                                        iSisFile, 
       
   415                                        EFileRead | EFileShareReadersOnly );                    
       
   416                     
       
   417                     if ( err )
       
   418                         {
       
   419                         FLOG_1( _L("Daemon: File open ERROR = %d"), err );
       
   420                         iFileOpen = EFalse;                        
       
   421                         } 
       
   422                     else
       
   423                         {
       
   424                         iFileOpen = ETrue;                    
       
   425                         }
       
   426                     
       
   427                     if ( iFileOpen && IsValidPackageL() && 
       
   428                             NeedsInstallingL( iSisFile ) )
       
   429                         {                                           
   374                         // If there is plugin for SWI Daemon then let's us it.
   430                         // If there is plugin for SWI Daemon then let's us it.
   375                         // Daemon will give all files to plug-in which will 
   431                         // Daemon will give all files to plug-in which will 
   376                         // handle installation. There is not feedback so SWI 
   432                         // handle installation. There is not feedback so SWI 
   377                         // Daemon will not wait plug-in.
   433                         // Daemon will not wait plug-in.
   378                         if ( iDaemonBehaviour->IsPlugin() )
   434                         if ( iDaemonBehaviour->IsPlugin() )
   379                             {
   435                             {
   380                             // Notify plug-in if not yet done.                                                                 
   436                             // Notify plug-in if not yet done.                                                                 
   381                             iDaemonBehaviour->NotifyPlugin();
   437                             iDaemonBehaviour->NotifyPlugin();
   382                             FLOG_1( _L("Daemon: Use plugin to install: %S"), &iSisFile );                             
   438                             FLOG_1( _L("Daemon: Use plugin to install: %S"), 
   383                             TRAP_IGNORE( iDaemonBehaviour->RequestPluginInstall( iSisFile ) );                                                                                  
   439                                     &iSisFile );                             
       
   440                             TRAP_IGNORE( iDaemonBehaviour->RequestPluginInstall( 
       
   441                                     iSisFile ) );                                                                                  
   384                             
   442                             
   385                             // Let's continue to give all packages to plug-in. 
   443                             // Let's continue to give all packages to plug-in. 
   386                             // Note that we do not have iStatus as this is not async. call 
   444                             // Note that we do not have iStatus as this is not async. call 
   387                             // so we can not use EDSisInstallerStateInstalling state.                             
   445                             // so we can not use EDSisInstallerStateInstalling state.                             
   388                             iState = EDSisInstallerStateIdle;                                                 
   446                             iState = EDSisInstallerStateIdle;                                                 
   392                             // complete self to get all packages to plugin.                            
   450                             // complete self to get all packages to plugin.                            
   393                             CompleteSelf(); 
   451                             CompleteSelf(); 
   394                             }                            
   452                             }                            
   395                         else
   453                         else
   396                             {                                                
   454                             {                                                
   397                             FLOG_1( _L("Daemon: Kick off the install for %S"), &iSisFile );
   455                             FLOG_1( _L("Daemon: Start install for %S"), &iSisFile );
   398                             iInstallLauncher->InstallL( iSisFile, iStatus );
   456                                                                                                                                                                                                                                                    
       
   457                             iInstallLauncher->InstallL( iSisFileHandle, 
       
   458                                                         iSisFile, 
       
   459                                                         iStatus );
       
   460                             
   399                             iDialogs->ShowWaitingNoteL(); 
   461                             iDialogs->ShowWaitingNoteL(); 
   400                             iState = EDSisInstallerStateInstalling;                       
   462                             iState = EDSisInstallerStateInstalling;                       
   401                             iInstallerState = iState;                                                   
   463                             iInstallerState = iState;                                                   
   402                             SetActive();
   464                             SetActive();                               
   403                             }
   465                             }
   404                         }               
   466                         }               
   405                     else
   467                     else
   406                         {                  
   468                         {                  
   407                         FLOG_1( _L("Daemon: No need to install %S"), &iSisFile );                                
   469                         FLOG_1( _L("Daemon: NOT INSTALLING: %S"), &iSisFile );                                                 
   408                         iState = EDSisInstallerStateIdle;                
   470                         iState = EDSisInstallerStateIdle;                
   409                         iInstallerState = iState;                   
   471                         iInstallerState = iState;                   
   410                         // Clear current pkg UID                    
   472                         // Clear current pkg UID                    
   411                         iCurrentPackageId = TUid::Null();                                   
   473                         iCurrentPackageId = TUid::Null();                                                           
   412                         
       
   413                         CompleteSelf();                    
   474                         CompleteSelf();                    
   414                         }                        
   475                         }                        
   415                     }
   476                     }
   416                 else
   477                 else
   417                     {
   478                     {
   422                     }                        
   483                     }                        
   423                 }                        
   484                 }                        
   424                 break;
   485                 break;
   425                 
   486                 
   426             case EDSisInstallerStateInstallerBusy:
   487             case EDSisInstallerStateInstallerBusy:
       
   488                 {
   427                 // Try to install the file again
   489                 // Try to install the file again
   428                 FLOG( _L("Daemon: RunL: EDSisInstallerStateInstallerBusy") );  
   490                 FLOG( _L("Daemon: RunL: EDSisInstallerStateInstallerBusy") ); 
   429                 FLOG_1( _L("Daemon: Kick off the install for %S"), &iSisFile );
   491                                 
   430                 iInstallLauncher->InstallL( iSisFile, iStatus );
   492                 // If file is not open, try to open it.
   431                 iState = EDSisInstallerStateInstalling;                   
   493                 if ( !iFileOpen )
   432                 iInstallerState = iState;                                   
   494                     {
   433                 SetActive(); 
   495                     FLOG( _L("Daemon: RunL: Error file not open !") ); 
       
   496                     FLOG_1( _L("Daemon: Open File: %S"), &iSisFile );
       
   497                 
       
   498                     TInt err = iSisFileHandle.Open( 
       
   499                                     iFs, 
       
   500                                     iSisFile, 
       
   501                                     EFileRead | EFileShareReadersOnly
       
   502                                     /*EFileShareReadersOrWriters|EFileRead*/ ); 
       
   503                                                            
       
   504                     if ( err )
       
   505                          {
       
   506                          FLOG_1( _L("Daemon: File open ERROR = %d"), err );
       
   507                          iFileOpen = EFalse;
       
   508                          }
       
   509                     else
       
   510                         {
       
   511                         FLOG( _L("Daemon: RunL: File open") );                     
       
   512                         iFileOpen = ETrue;                    
       
   513                         }
       
   514                     }
       
   515                 
       
   516                 if ( iFileOpen )
       
   517                     {
       
   518                     FLOG_1( _L("Daemon: Try install again for: %S"), &iSisFile );
       
   519                     iInstallLauncher->InstallL( iSisFileHandle,
       
   520                                                 iSisFile, 
       
   521                                                 iStatus );                
       
   522                 
       
   523                     iState = EDSisInstallerStateInstalling;                   
       
   524                     iInstallerState = iState;                                   
       
   525                     SetActive(); 
       
   526                     }
       
   527                 else
       
   528                     {
       
   529                     // If we cannot open the sis file let's continue
       
   530                     // and install rest of the packages.
       
   531                     // We can try to install this next time in boot 
       
   532                     // or when media is mounted.
       
   533                     iState = EDSisInstallerStateIdle;                                                 
       
   534                     iInstallerState = iState;  
       
   535                     CompleteSelf(); 
       
   536                     } 
       
   537                 }
   434                 break;                       
   538                 break;                       
   435                 
   539                 
   436                 // Active object in unknown state
   540                 // Active object in unknown state
   437             default:
   541             default:
   438                 User::Panic(KMCSisInstaller,KErrNotSupported);
   542                 User::Panic(KMCSisInstaller,KErrNotSupported);
   474 //
   578 //
   475 void CSisInstaller::InstallationCompleted( TInt aResult )
   579 void CSisInstaller::InstallationCompleted( TInt aResult )
   476     {
   580     {
   477     FLOG_1( _L("Daemon: InstallationCompleted with result = %d"), aResult );  
   581     FLOG_1( _L("Daemon: InstallationCompleted with result = %d"), aResult );  
   478     iState = EDSisInstallerStateIdle;    
   582     iState = EDSisInstallerStateIdle;    
   479     iInstallErr = KErrNone;    
   583     iInstallErr = KErrNone;     
       
   584     FLOG( _L("Daemon: InstallationCompleted: Delete iInstallLauncher") );
   480     delete iInstallLauncher;
   585     delete iInstallLauncher;
   481     iInstallLauncher = NULL;
   586     iInstallLauncher = NULL;
   482     // We need to update cache again in RunL if plug-in is loaded.
   587     // We need to update cache again in RunL if plug-in is loaded.
   483     // It may be that plug-in does install packages after cache is updated.
   588     // It may be that plug-in does install packages after cache is updated.
   484     iUpdateCache = ETrue;
   589     iUpdateCache = ETrue;
   486     // If all files are installed set status to completed.
   591     // If all files are installed set status to completed.
   487     if ( iFileIndex >= iFilesToInstall.Count() )
   592     if ( iFileIndex >= iFilesToInstall.Count() )
   488         {                
   593         {                
   489         iInstallerState = EDSisInstallerStateCompleted; 
   594         iInstallerState = EDSisInstallerStateCompleted; 
   490         }
   595         }
       
   596     
       
   597     // Make sure that current file is closed before exit.
       
   598     // File may be open if this is called from RunError/DoCancel etc.
       
   599     if ( iFileOpen )
       
   600         {
       
   601         FLOG( _L("Daemon: InstallationCompleted: File open - Close it !!!") );
       
   602         iSisFileHandle.Close();
       
   603         iFileOpen = EFalse;
       
   604         }    
   491                             
   605                             
   492     TRAP_IGNORE( iDialogs->CancelWaitingNoteL() );
   606     TRAP_IGNORE( iDialogs->CancelWaitingNoteL() );
   493     
   607         
   494     if ( aResult != KErrNone && 
   608     if ( aResult != KErrNone && 
   495          iSisFile.Length() > 0 && 
   609          iSisFile.Length() > 0 && 
   496          IsMediaPresent( TChar( iSisFile[0] ) ) )
   610          IsMediaPresent( TChar( iSisFile[0] ) ) )
   497         {        
   611         {        
   498         if ( aResult == SwiUI::KSWInstErrSecurityFailure )
   612         if ( aResult == SwiUI::KSWInstErrSecurityFailure )
   502         else 
   616         else 
   503             {
   617             {
   504             TRAP_IGNORE( iDialogs->ShowErrorResultL() );
   618             TRAP_IGNORE( iDialogs->ShowErrorResultL() );
   505             }    
   619             }    
   506         }
   620         }
   507 
       
   508 //TODO: remove this update. This is done in start installing !!!!     
       
   509     //FLOG( _L("Daemon: InstallationCompleted: Update installed cache") );
       
   510     // Update cache so we do not start to install those packages 
       
   511     // which are installed by the user manyally. 
       
   512     // NOTE! plugin will install stuff after this call.
       
   513     //TRAP_IGNORE(iPreviouslyInstalledAppsCache->UpdateAllL());
       
   514     
   621     
   515     TRAP_IGNORE(iPreviouslyInstalledAppsCache->FlushToDiskL(););    
   622     TRAP_IGNORE(iPreviouslyInstalledAppsCache->FlushToDiskL(););    
   516     TRAP_IGNORE(iInstallationFailedAppsCache->FlushToDiskL());   
   623     TRAP_IGNORE(iInstallationFailedAppsCache->FlushToDiskL());   
   517     
   624     
   518     // Notify plugin that daemon has complete installation.
   625     // Notify plugin that daemon has complete installation.
   648 
   755 
   649 // -----------------------------------------------------------------------
   756 // -----------------------------------------------------------------------
   650 // CSisInstaller::IsValidPackageL
   757 // CSisInstaller::IsValidPackageL
   651 // -----------------------------------------------------------------------
   758 // -----------------------------------------------------------------------
   652 //
   759 //
   653 TBool CSisInstaller::IsValidPackageL( const TDesC& aPackageName )
   760 TBool CSisInstaller::IsValidPackageL()
   654     {
   761     {
   655     TBool result( EFalse );
   762     TBool result( EFalse ); 
   656   
   763     
   657     RFile file;
   764     if ( !iFileOpen )
       
   765         {
       
   766         FLOG( _L("Daemon: IsValidPackageL: ERROR FILE NOT OPEN") );
       
   767         return result;
       
   768         }
       
   769     
   658     TUid appUid;
   770     TUid appUid;
   659     TDataType dataType;
   771     TDataType dataType;
   660     User::LeaveIfError( file.Open( iFs, aPackageName, EFileRead ) );        
   772         
   661     iApaSession.AppForDocument( file, appUid, dataType );
   773     iApaSession.AppForDocument( iSisFileHandle, appUid, dataType );
   662     file.Close();
       
   663     
   774     
   664     if ( dataType.Des8() == SwiUI::KSisxMimeType )
   775     if ( dataType.Des8() == SwiUI::KSisxMimeType )
   665         {
   776         {
   666         result = ETrue;
   777         result = ETrue;
   667         }
   778         }           
   668 
   779            
   669     FLOG_1( _L("Daemon: IsValidPackageL = %d"), result );  
   780     FLOG_1( _L("Daemon: IsValidPackageL = %d"), result );  
   670     return result;    
   781     return result;    
   671     }
   782     }
   672     
   783     
   673 //EOF
   784 //EOF