--- a/appinstaller/AppinstUi/Daemon/Src/daemoninstaller.cpp Tue Aug 31 15:21:33 2010 +0300
+++ b/appinstaller/AppinstUi/Daemon/Src/daemoninstaller.cpp Wed Sep 01 12:22:02 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -15,6 +15,7 @@
*
*/
+
#include "daemoninstaller.h"
#include "DialogWrapper.h"
#include "swispubsubdefs.h"
@@ -42,15 +43,12 @@
const static TInt KInstallRetryWaitTime = 10000000; // 10 secs
// For uninstaller
-const static TInt KWaitUninstallerTime = 1000000; // 1 secs
+const static TInt KWaitUninstallerTime = 1000000; // 1 secs
_LIT(KMCSisInstaller,"Daemon-Installer"); // Minor-Component name
+// Two phased construction
-// -----------------------------------------------------------------------
-// Two phased construction
-// -----------------------------------------------------------------------
-//
CSisInstaller* CSisInstaller::NewL(
MDaemonInstallBehaviour* aDaemonBehaviour,
CProgramStatus& aMainStatus)
@@ -62,10 +60,8 @@
return self;
}
-// -----------------------------------------------------------------------
// Install Request constructor
-// -----------------------------------------------------------------------
-//
+
CSisInstaller::CSisInstaller( MDaemonInstallBehaviour* aDaemonBehaviour )
: CActive(CActive::EPriorityStandard),
iDaemonBehaviour( aDaemonBehaviour ),
@@ -73,40 +69,31 @@
iFileIndex(0),
iInstallErr( KErrNone )
{
- CActiveScheduler::Add(this);
- iInstallerState = EDSisInstallerStateIdle;
+ CActiveScheduler::Add(this);
+#ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = EDSisInstallerStateIdle;
+#endif
}
-// -----------------------------------------------------------------------
-// Destructor
-// -----------------------------------------------------------------------
-//
+// Install Request destructor
+
CSisInstaller::~CSisInstaller()
{
- FLOG( _L("Daemon: CSisInstaller::~CSisInstaller") );
Cancel();
iTimer.Close();
iFilesToInstall.ResetAndDestroy();
- iFilesToInstall.Close();
+ iFilesToInstall.Close();
delete iInstallLauncher;
- delete iDialogs;
+ delete iDialogs;
+ iFs.Close();
+ iApaSession.Close();
delete iPreviouslyInstalledAppsCache;
delete iInstallationFailedAppsCache;
- delete iShutdownWatcher;
-
- if ( iFileOpen )
- {
- iSisFileHandle.Close();
- }
-
- iFs.Close();
- iApaSession.Close();
+ delete iShutdownWatcher;
}
-// -----------------------------------------------------------------------
// 2nd phase construction
-// -----------------------------------------------------------------------
-//
+
void CSisInstaller::ConstructL( CProgramStatus& aMainStatus )
{
User::LeaveIfError( iTimer.CreateLocal() );
@@ -117,23 +104,16 @@
iPreviouslyInstalledAppsCache = CPreviouslyInstalledAppsCache::NewL();
iInstallationFailedAppsCache = CInstallationFailedAppsCache::NewL();
iShutdownWatcher = CShutdownWatcher::NewL( *this );
- iShutdownWatcher->Start();
- iPercentValue = 0;
-
+ iShutdownWatcher->Start();
// For uninstaller
// SisInstaller do not own this so do not delete.
iProgramStatus = &aMainStatus;
- iUpdateCache = ETrue;
- iFileOpen = EFalse;
- iInstallLauncher = NULL;
+ iUpdateCache = ETrue;
}
-// -----------------------------------------------------------------------
-// CSisInstaller::AddFileToInstallL
// Set the location of all sis files and the list of them
// also take ownership of the pointers to memory
-// -----------------------------------------------------------------------
-//
+
void CSisInstaller::AddFileToInstallL(const TDesC& aFileName)
{
HBufC* fileName = aFileName.AllocLC();
@@ -141,17 +121,13 @@
CleanupStack::Pop( fileName );
}
+// Start the request to process the Sisx file
-// -----------------------------------------------------------------------
-// CSisInstaller::StartInstallingL
-// Start the request to process the Sisx file
-// -----------------------------------------------------------------------
-//
void CSisInstaller::StartInstallingL()
{
FLOG( _L("Daemon: StartInstallingL") );
- if( !iFilesToInstall.Count() )
+ if(!iFilesToInstall.Count())
{
// For uninstaller
// Check state, if installing change it to idle.
@@ -160,7 +136,7 @@
FLOG( _L("Daemon: StartInstallingL: Set EStateIdle") );
iProgramStatus->SetProgramStatusToIdle();
}
- FLOG( _L("Daemon: StartInstallingL: User::Leave(KErrAbort)") );
+
User::Leave(KErrAbort);
}
@@ -171,37 +147,26 @@
{
FLOG( _L("Daemon: StartInstallingL: Set EStateInstalling") );
iProgramStatus->SetProgramStatus( EStateInstalling );
- }
-
- FLOG_1( _L("Daemon: iGeneralProcessStatus: %d"), iGeneralProcessStatus );
- FLOG_1( _L("Daemon: iInstallLauncher: 0x%x"),iInstallLauncher );
+ }
+ FLOG_1( _L("[CSisInstaller] ConstructL iGeneralProcessStatus = %d"),
+ iGeneralProcessStatus );
- if ( iInstallLauncher == NULL )
+ if ( !iInstallLauncher )
{
- FLOG( _L("Daemon: Create iInstallLauncher") );
- iInstallLauncher = CSilentLauncher::NewL( iFs );
-
- // Update cache so we do not try to start install for
- // components which are installed. This is done always
- // when new install session is started (e.g. after mmc insert).
- FLOG( _L("Daemon: StartInstallingL: Update installed cache") );
- TRAP_IGNORE( iPreviouslyInstalledAppsCache->UpdateAllL() );
- TRAP_IGNORE( iPreviouslyInstalledAppsCache->FlushToDiskL() );
+ iInstallLauncher = CSilentLauncher::NewL( iFs );
}
if ( iState == EDSisInstallerStateIdle )
- {
+ {
// Reset the error
- iInstallErr = KErrNone;
+ iInstallErr = KErrNone;
CompleteSelf();
}
}
-// -----------------------------------------------------------------------
-// CSisInstaller::IsInstalling
+#ifdef RD_MULTIPLE_DRIVE
// Returns state of Installer.
-// -----------------------------------------------------------------------
-//
+
TBool CSisInstaller::IsInstalling()
{
if ( iInstallerState == EDSisInstallerStateCompleted )
@@ -213,33 +178,24 @@
return ETrue;
}
}
-
-// -----------------------------------------------------------------------
-// CSisInstaller::CompleteSelf
+#endif //RD_MULTIPLE_DRIVE
+
// Complete the request manually
-// -----------------------------------------------------------------------
-//
+
void CSisInstaller::CompleteSelf()
{
- FLOG( _L("Daemon: CSisInstaller::CompleteSelf") );
if ( !IsActive() )
{
TRequestStatus* status = &iStatus;
- FLOG( _L("Daemon: CompleteSelf: RequestComplete") );
- User::RequestComplete( status, KErrNone );
- FLOG( _L("Daemon: CompleteSelf: SetActive") );
+ User::RequestComplete(status,KErrNone);
SetActive();
}
}
-// -----------------------------------------------------------------------
-// CSisInstaller::DoCancel
// Cancel the active request
-// -----------------------------------------------------------------------
-//
+
void CSisInstaller::DoCancel()
{
- FLOG( _L("Daemon: CSisInstaller::DoCancel") );
iTimer.Cancel();
iFileIndex = 0;
@@ -263,16 +219,12 @@
}
}
-// -----------------------------------------------------------------------
-// CSisInstaller::RunL
-// When the software installer has changed state attemp to install a
-// sisx file
-// -----------------------------------------------------------------------
-//
+// When the software installer has changed state
+// attemp to install a sisx file
+
void CSisInstaller::RunL()
- {
- FLOG_1( _L("Daemon: Installer RunL status:%d"), iStatus.Int() );
- FLOG_1( _L("Daemon: Installer RunL state:%d"), iState );
+ {
+ FLOG_2( _L("Daemon: Installer RunL status:%d, state:%d"), iStatus.Int(), iState );
// For uninstaller
// Check that uninstaller is not running.
@@ -283,8 +235,10 @@
TTimeIntervalMicroSeconds32 time( KWaitUninstallerTime );
iTimer.After(iStatus,time);
// Set to idle, installer has not yet started.
- iState = EDSisInstallerStateIdle;
- iInstallerState = iState;
+ iState = EDSisInstallerStateIdle;
+ #ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = iState;
+ #endif
SetActive();
}
else
@@ -298,41 +252,28 @@
// Reached when installation is completed
case EDSisInstallerStateInstalling:
FLOG( _L("Daemon: RunL: EDSisInstallerStateInstalling") );
- FLOG_1( _L("Daemon: Installation completed with %d"),
- iStatus.Int() );
+ FLOG_1( _L("Daemon: Installation completed with %d"), iStatus.Int() );
+ // Installation is completed, check result
- // Installation is completed, check result
if ( iStatus.Int() == SwiUI::KSWInstErrBusy )
{
FLOG( _L("Daemon: RunL: iStatus: KSWInstErrBusy") );
// User might be installing something, wait before retrying
TTimeIntervalMicroSeconds32 time( KInstallRetryWaitTime );
iTimer.After(iStatus,time);
- iState = EDSisInstallerStateInstallerBusy;
- iInstallerState = iState;
+ iState = EDSisInstallerStateInstallerBusy;
+ #ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = iState;
+ #endif
SetActive();
break;
}
- else if ( (iStatus.Int() == SwiUI::KSWInstErrSecurityFailure &&
- iInstallErr == KErrNone) ||
- (iStatus.Int() != KErrNone &&
- iStatus.Int() != SwiUI::KSWInstErrSecurityFailure) )
+ else if ( (iStatus.Int() == SwiUI::KSWInstErrSecurityFailure && iInstallErr == KErrNone) ||
+ (iStatus.Int() != KErrNone && iStatus.Int() != SwiUI::KSWInstErrSecurityFailure) )
{
- FLOG( _L("Daemon: RunL: iStatus: error of sec. failure") );
+ FLOG( _L("Daemon: RunL: iStatus: KSWInstErrSecurityFailure or error") );
iInstallErr = iStatus.Int();
}
-
- // Close current sisx except if installer engine is busy.
- // If installer is busy we will try again later.
- if ( iStatus.Int() != SwiUI::KSWInstErrBusy )
- {
- if ( iFileOpen )
- {
- FLOG_1( _L("Daemon: RunL: Close File: %S"), &iSisFile );
- iSisFileHandle.Close();
- iFileOpen = EFalse;
- }
- }
// Catch all installation error from SwiUI and update cache.
if ( iStatus.Int() != KErrNone )
@@ -341,11 +282,10 @@
if ( iCurrentPackageId != TUid::Uid( NULL ) )
{
FLOG( _L("Daemon: RunL: Add UID to cache.") );
- iInstallationFailedAppsCache->AddPackageUID(
- iCurrentPackageId );
+ iInstallationFailedAppsCache->AddPackageUID( iCurrentPackageId );
// Clear current UID
iCurrentPackageId = TUid::Null();
- }
+ }
}
else
{
@@ -353,8 +293,7 @@
if ( iCurrentPackageId != TUid::Uid( NULL ) )
{
FLOG( _L("Daemon: RunL: Add UID to cache.") );
- iPreviouslyInstalledAppsCache->UpdateAddL(
- iCurrentPackageId );
+ iPreviouslyInstalledAppsCache->UpdateAddL( iCurrentPackageId );
// Clear current UID
iCurrentPackageId = TUid::Null();
}
@@ -364,8 +303,11 @@
if ( iFileIndex < iFilesToInstall.Count() )
{
// Kick of the next installation
- iState = EDSisInstallerStateIdle;
- iInstallerState = iState;
+ iState = EDSisInstallerStateIdle;
+ #ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = iState;
+ #endif
+
CompleteSelf();
}
else
@@ -380,17 +322,7 @@
// Install a file
case EDSisInstallerStateIdle:
{
- FLOG( _L("Daemon: RunL: EDSisInstallerStateIdle") );
-
- // Make sure that current file is closed before we
- // open new file handle.
- if ( iFileOpen )
- {
- FLOG( _L("Daemon: RunL: StateIdle: CLOSE CURRENT FILE") );
- FLOG_1( _L("Daemon: RunL: Close File: %S"), &iSisFile );
- iSisFileHandle.Close();
- iFileOpen = EFalse;
- }
+ FLOG( _L("Daemon: RunL: EDSisInstallerStateIdle") );
// Let's update installed apps cache so we do not give
// installed pacakges several time to plug-in.
@@ -404,36 +336,14 @@
}
if ( iFileIndex < iFilesToInstall.Count() )
- {
- // Let's calc. values before index is updated.
- CalcPercentValue();
-
- // Get next sisx package from array.
+ {
iSisFile.Copy( *iFilesToInstall[iFileIndex] );
- ++iFileIndex;
-
- FLOG_1( _L("Daemon: RunL: Open File: %S"), &iSisFile );
- TInt err = KErrNone;
- // Let's open the file in here bacause IsValidPackageL
- // needs to open the file anyway.
- err = iSisFileHandle.Open(
- iFs,
- iSisFile,
- EFileRead | EFileShareReadersOnly );
-
- if ( err )
- {
- FLOG_1( _L("Daemon: File open ERROR = %d"), err );
- iFileOpen = EFalse;
- }
- else
- {
- iFileOpen = ETrue;
- }
-
- if ( iFileOpen && IsValidPackageL() &&
- NeedsInstallingL( iSisFile ) )
- {
+ ++iFileIndex;
+
+ // No need to install if the package has been installed
+ // some time in the past
+ if ( IsValidPackageL( iSisFile ) && NeedsInstallingL( iSisFile ) )
+ {
// If there is plugin for SWI Daemon then let's us it.
// Daemon will give all files to plug-in which will
// handle installation. There is not feedback so SWI
@@ -442,48 +352,42 @@
{
// Notify plug-in if not yet done.
iDaemonBehaviour->NotifyPlugin();
- FLOG_1( _L("Daemon: Use plugin to install: %S"),
- &iSisFile );
- TRAP_IGNORE( iDaemonBehaviour->RequestPluginInstall(
- iSisFile ) );
+ FLOG_1( _L("Daemon: Use plugin to install: %S"), &iSisFile );
+ TRAP_IGNORE( iDaemonBehaviour->RequestPluginInstall( iSisFile ) );
// Let's continue to give all packages to plug-in.
- // Note that we do not have iStatus as this is not
- // async. call so we can not use
- // EDSisInstallerStateInstalling state.
- iState = EDSisInstallerStateIdle;
+ // Note that we do not have iStatus as this is not async. call
+ // so we can not use EDSisInstallerStateInstalling state.
+ iState = EDSisInstallerStateIdle;
+ #ifdef RD_MULTIPLE_DRIVE
iInstallerState = iState;
-
+ #endif
// Plugin interface is not asyncronous. We need to
// complete self to get all packages to plugin.
CompleteSelf();
}
else
- {
- // Start also the universal indicator.
- TRAP_IGNORE( iDialogs->ActivateIndicatorL( iPercentValue ) );
- // Start to show progress dialog. Dialog is shown
- // only 3 sec.
- TRAP_IGNORE( iDialogs->ShowWaitingNoteL() );
-
- FLOG_1( _L("Daemon: Start install for %S"), &iSisFile );
-
- iInstallLauncher->InstallL( iSisFileHandle,
- iSisFile,
- iStatus );
-
- iState = EDSisInstallerStateInstalling;
- iInstallerState = iState;
- SetActive();
+ {
+ FLOG_1( _L("Daemon: Kick off the install for %S"), &iSisFile );
+ iInstallLauncher->InstallL( iSisFile, iStatus );
+ iDialogs->ShowWaitingNoteL();
+ iState = EDSisInstallerStateInstalling;
+ #ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = iState;
+ #endif
+ SetActive();
}
}
else
{
- FLOG_1( _L("Daemon: NOT INSTALLING: %S"), &iSisFile );
- iState = EDSisInstallerStateIdle;
- iInstallerState = iState;
+ FLOG_1( _L("Daemon: No need to install %S"), &iSisFile );
+ iState = EDSisInstallerStateIdle;
+ #ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = iState;
+ #endif
// Clear current pkg UID
- iCurrentPackageId = TUid::Null();
+ iCurrentPackageId = TUid::Null();
+
CompleteSelf();
}
}
@@ -498,55 +402,16 @@
break;
case EDSisInstallerStateInstallerBusy:
- {
// Try to install the file again
- FLOG( _L("Daemon: RunL: EDSisInstallerStateInstallerBusy") );
-
- // If file is not open, try to open it.
- if ( !iFileOpen )
- {
- FLOG( _L("Daemon: RunL: Error file not open !") );
- FLOG_1( _L("Daemon: Open File: %S"), &iSisFile );
+ FLOG( _L("Daemon: RunL: EDSisInstallerStateInstallerBusy") );
+ FLOG_1( _L("Daemon: Kick off the install for %S"), &iSisFile );
+ iInstallLauncher->InstallL( iSisFile, iStatus );
+ iState = EDSisInstallerStateInstalling;
+ #ifdef RD_MULTIPLE_DRIVE
+ iInstallerState = iState;
+ #endif
- TInt err = iSisFileHandle.Open(
- iFs,
- iSisFile,
- EFileRead | EFileShareReadersOnly );
-
- if ( err )
- {
- FLOG_1( _L("Daemon: File open ERROR = %d"), err );
- iFileOpen = EFalse;
- }
- else
- {
- FLOG( _L("Daemon: RunL: File open") );
- iFileOpen = ETrue;
- }
- }
-
- if ( iFileOpen )
- {
- FLOG_1( _L("Daemon: Try install again for: %S"), &iSisFile );
- iInstallLauncher->InstallL( iSisFileHandle,
- iSisFile,
- iStatus );
-
- iState = EDSisInstallerStateInstalling;
- iInstallerState = iState;
- SetActive();
- }
- else
- {
- // If we cannot open the sis file let's continue
- // and install rest of the packages.
- // We can try to install this next time in boot
- // or when media is mounted.
- iState = EDSisInstallerStateIdle;
- iInstallerState = iState;
- CompleteSelf();
- }
- }
+ SetActive();
break;
// Active object in unknown state
@@ -555,26 +420,18 @@
break;
}
} // else for uninstaller
- FLOG( _L("Daemon: RunL END") );
}
-// -----------------------------------------------------------------------
-// CSisInstaller::RunError
// If RunL leaves then ignore errors
-// -----------------------------------------------------------------------
-//
+
TInt CSisInstaller::RunError(TInt aError)
{
- FLOG_1( _L("Daemon: Installer Run error %d"), aError );
+ FLOG_1( _L("Daemon: Installer RunL error %d"), aError );
TInt err( KErrNone );
InstallationCompleted( aError );
return err;
}
-
-// -----------------------------------------------------------------------
-// CSisInstaller::NotifyShuttingDown
-// -----------------------------------------------------------------------
-//
+
void CSisInstaller::NotifyShuttingDown()
{
// System is closing down, we need to stop installations and save
@@ -582,47 +439,29 @@
// Application server receives EApaSystemEventShutdown event that
// closes it down.
Cancel();
- }
+ }
-// -----------------------------------------------------------------------
-// CSisInstaller::InstallationCompleted
-// -----------------------------------------------------------------------
-//
void CSisInstaller::InstallationCompleted( TInt aResult )
{
- // Let's update universal indicator ones more.
- iDialogs->ActivateIndicatorL( 100 );
-
FLOG_1( _L("Daemon: InstallationCompleted with result = %d"), aResult );
iState = EDSisInstallerStateIdle;
- iInstallErr = KErrNone;
- FLOG( _L("Daemon: InstallationCompleted: Delete iInstallLauncher") );
+ iInstallErr = KErrNone;
delete iInstallLauncher;
iInstallLauncher = NULL;
// We need to update cache again in RunL if plug-in is loaded.
// It may be that plug-in does install packages after cache is updated.
iUpdateCache = ETrue;
+#ifdef RD_MULTIPLE_DRIVE
// If all files are installed set status to completed.
if ( iFileIndex >= iFilesToInstall.Count() )
{
iInstallerState = EDSisInstallerStateCompleted;
}
+#endif
+
+ TRAP_IGNORE( iDialogs->CancelWaitingNoteL() );
- // Make sure that current file is closed before exit.
- // File may be open if this is called from RunError/DoCancel etc.
- if ( iFileOpen )
- {
- FLOG( _L("Daemon: InstallationCompleted: File open - Close it !!!") );
- iSisFileHandle.Close();
- iFileOpen = EFalse;
- }
-
- // Make sure that progress note is closed.
- TRAP_IGNORE( iDialogs->CancelWaitingNote() );
- // Close the universal indicator.
- iDialogs->CancelIndicatorL();
-
if ( aResult != KErrNone &&
iSisFile.Length() > 0 &&
IsMediaPresent( TChar( iSisFile[0] ) ) )
@@ -637,6 +476,12 @@
}
}
+ FLOG( _L("Daemon: InstallationCompleted: Update installed cache") );
+ // Update cache so we do not start to install those packages
+ // which are installed by the user manyally.
+ // NOTE! plugin will install stuff after this call.
+ TRAP_IGNORE(iPreviouslyInstalledAppsCache->UpdateAllL());
+
TRAP_IGNORE(iPreviouslyInstalledAppsCache->FlushToDiskL(););
TRAP_IGNORE(iInstallationFailedAppsCache->FlushToDiskL());
@@ -654,16 +499,12 @@
}
}
-// -----------------------------------------------------------------------
-// CSisInstaller::NeedsInstallingL
// Indicates if this package is installed or not.
-// -----------------------------------------------------------------------
-//
+
TBool CSisInstaller::NeedsInstallingL( const TDesC& aPackageName )
{
- FLOG( _L("Daemon: CSisInstaller::NeedsInstallingL") );
- //TBool result( ETrue );
- TBool needsInstalling( ETrue );
+ FLOG( _L("Daemon: NeedsInstallingL") );
+ TBool result( ETrue );
// Read the controller data from the package
CFileSisDataProvider* fileProvider = CFileSisDataProvider::NewLC( iFs, aPackageName );
@@ -676,6 +517,7 @@
CleanupStack::PushL( controller );
// Code to read UID
+
CDesDataProvider* controllerProvider= CDesDataProvider::NewLC(*controller);
CController* controllerObject = NULL;
controllerObject = CController::NewL(*controllerProvider);
@@ -683,30 +525,15 @@
TUid packageId = controllerObject->Info().Uid().Uid();
- CleanupStack::PopAndDestroy( controllerObject );
- CleanupStack::PopAndDestroy( controllerProvider );
+ CleanupStack::PopAndDestroy(controllerObject);
+ CleanupStack::PopAndDestroy(controllerProvider);
- // Check if sw is installed previously.
- // Note if UID is found sw will not be installed even if user
- // has uninstall it bacause cache is not updated from SCR.
- FLOG_1( _L("Daemon: Is UID installed = 0x%x"), packageId.iUid );
- needsInstalling = !iPreviouslyInstalledAppsCache->
- HasBeenPreviouslyInstalled(packageId);
- FLOG_1( _L("Daemon: Has been installed (cache) = %d"), !needsInstalling );
+ FLOG_1( _L("Daemon: NeedsInstallingL: Is UID installed = 0x%x"), packageId.iUid );
+ result = !iPreviouslyInstalledAppsCache->HasBeenPreviouslyInstalled(packageId);
+ FLOG_1( _L("Daemon: NeedsInstallingL: Has been installed (cache) = %d"), !result );
- // No need to check rom stubs in here anymore.
- // Note 1: SWI Daemon policy has been that RU packages are not installed
- // from removable media.
- // Note 2: UpdateAllL will add all pkg uids in cache (PreviouslyInstalled),
- // so rom upgrades are not installed since uid is found from the cache.
- // Note 3: Install params do not allow RU to be installed. So SWI will
- // reject RU (rom upgrade) package anyway.
-
- /*
- // Note! this code has been wrong. No need to check stubs since
- // policy do not allow RU updates and SWI will reject the install.
- if ( !needsInstalling )
- {
+ if (result)
+ {
RSisRegistrySession registry;
User::LeaveIfError( registry.Connect() );
CleanupClosePushL( registry );
@@ -721,40 +548,32 @@
User::LeaveIfError( entry.Open( registry, packageId ) );
CleanupClosePushL( entry );
- needsInstalling = entry.IsInRomL();
+ result = entry.IsInRomL();
- FLOG_1( _L("Daemon: NeedsInstallingL: Is in ROM = %d"), needsInstalling );
+ FLOG_1( _L("Daemon: NeedsInstallingL: Is in ROM = %d"), result );
CleanupStack::PopAndDestroy( &entry );
}
CleanupStack::PopAndDestroy( ®istry );
- }
- */
-
+ }
+
// Check that previous install attempt did not fail.
- if ( needsInstalling )
+ if (result)
{
- needsInstalling = !iInstallationFailedAppsCache->
- HasPreviousInstallationFailed( packageId );
- FLOG_1( _L("Daemon: Has failed (cache) = %d"), !needsInstalling );
+ result = !iInstallationFailedAppsCache->HasPreviousInstallationFailed( packageId );
+ FLOG_1( _L("Daemon: NeedsInstallingL: Has failed (cache) = %d"), !result );
}
// Update pkg ID. ID is added to cache after installation.
- if ( needsInstalling )
+ if (result)
{
iCurrentPackageId = packageId;
}
- // fileProvider, content, controller
CleanupStack::PopAndDestroy( 3 );
-
- FLOG_1( _L("Daemon: NeedsInstallingL = %d"), needsInstalling );
- return needsInstalling;
+
+ return result;
}
-// -----------------------------------------------------------------------
-// CSisInstaller::IsMediaPresent
-// -----------------------------------------------------------------------
-//
TBool CSisInstaller::IsMediaPresent( TChar aDrive )
{
TInt drive( 0 );
@@ -776,71 +595,25 @@
}
}
-// -----------------------------------------------------------------------
-// CSisInstaller::IsValidPackageL
-// -----------------------------------------------------------------------
-//
-TBool CSisInstaller::IsValidPackageL()
+TBool CSisInstaller::IsValidPackageL( const TDesC& aPackageName )
{
- TBool result( EFalse );
-
- if ( !iFileOpen )
- {
- FLOG( _L("Daemon: IsValidPackageL: ERROR FILE NOT OPEN") );
- return result;
- }
-
+ TBool result( EFalse );
+
+ RFile file;
TUid appUid;
TDataType dataType;
-
- iApaSession.AppForDocument( iSisFileHandle, appUid, dataType );
+ User::LeaveIfError( file.Open( iFs, aPackageName, EFileRead ) );
+ iApaSession.AppForDocument( file, appUid, dataType );
+ file.Close();
if ( dataType.Des8() == SwiUI::KSisxMimeType )
{
result = ETrue;
- }
-
- FLOG_1( _L("Daemon: IsValidPackageL = %d"), result );
+ }
+
return result;
}
-
-// -----------------------------------------------------------------------
-// CSisInstaller::CalcPrecentValue
-// -----------------------------------------------------------------------
-//
-void CSisInstaller::CalcPercentValue()
- {
- FLOG( _L("Daemon: CSisInstaller::CalcPercentValue") );
- FLOG_1( _L("Daemon: iFileIndex = %d"), iFileIndex );
- // Let's calculate indicator value for UI now.
- TInt sisxFileCount = iFilesToInstall.Count();
- FLOG_1( _L("Daemon: iFilesToInstall.Count = %d"), sisxFileCount );
- iPercentValue = 0;
-
- // Note! if iFileIndex is zero, no package is installed bacause
- // installation process starts after this function.
- if ( iFileIndex && sisxFileCount )
- {
- // Let's calculate new precent value after some
- // package is installed.
- if ( iFileIndex <= sisxFileCount )
- {
- TReal32 realFileIndex = iFileIndex;
- TReal32 realFileCount = sisxFileCount;
- iPercentValue = (realFileIndex/realFileCount)*100;
- }
- else
- {
- // Most probably all is installed if index is bigger then
- // filen count. Let's not show over 100% to user.
- // This may happend after last package is processed since
- // index counter is updated before install starts.
- iPercentValue = 100;
- }
- }
- FLOG_1( _L("Daemon: CalcPercentValue value = %d"), (TInt)iPercentValue );
- }
-
+
//EOF