--- a/appinstaller/AppinstUi/Daemon/Src/daemoninstaller.cpp Thu Aug 19 10:02:49 2010 +0300
+++ b/appinstaller/AppinstUi/Daemon/Src/daemoninstaller.cpp Tue Aug 31 15:21:33 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2004-2010 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,7 +15,6 @@
*
*/
-
#include "daemoninstaller.h"
#include "DialogWrapper.h"
#include "swispubsubdefs.h"
@@ -43,12 +42,15 @@
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
-
+// -----------------------------------------------------------------------
+//
CSisInstaller* CSisInstaller::NewL(
MDaemonInstallBehaviour* aDaemonBehaviour,
CProgramStatus& aMainStatus)
@@ -60,8 +62,10 @@
return self;
}
+// -----------------------------------------------------------------------
// Install Request constructor
-
+// -----------------------------------------------------------------------
+//
CSisInstaller::CSisInstaller( MDaemonInstallBehaviour* aDaemonBehaviour )
: CActive(CActive::EPriorityStandard),
iDaemonBehaviour( aDaemonBehaviour ),
@@ -69,31 +73,40 @@
iFileIndex(0),
iInstallErr( KErrNone )
{
- CActiveScheduler::Add(this);
-#ifdef RD_MULTIPLE_DRIVE
- iInstallerState = EDSisInstallerStateIdle;
-#endif
+ CActiveScheduler::Add(this);
+ iInstallerState = EDSisInstallerStateIdle;
}
-// Install Request destructor
-
+// -----------------------------------------------------------------------
+// Destructor
+// -----------------------------------------------------------------------
+//
CSisInstaller::~CSisInstaller()
{
+ FLOG( _L("Daemon: CSisInstaller::~CSisInstaller") );
Cancel();
iTimer.Close();
iFilesToInstall.ResetAndDestroy();
- iFilesToInstall.Close();
+ iFilesToInstall.Close();
delete iInstallLauncher;
- delete iDialogs;
- iFs.Close();
- iApaSession.Close();
+ delete iDialogs;
delete iPreviouslyInstalledAppsCache;
delete iInstallationFailedAppsCache;
- delete iShutdownWatcher;
+ delete iShutdownWatcher;
+
+ if ( iFileOpen )
+ {
+ iSisFileHandle.Close();
+ }
+
+ iFs.Close();
+ iApaSession.Close();
}
+// -----------------------------------------------------------------------
// 2nd phase construction
-
+// -----------------------------------------------------------------------
+//
void CSisInstaller::ConstructL( CProgramStatus& aMainStatus )
{
User::LeaveIfError( iTimer.CreateLocal() );
@@ -104,16 +117,23 @@
iPreviouslyInstalledAppsCache = CPreviouslyInstalledAppsCache::NewL();
iInstallationFailedAppsCache = CInstallationFailedAppsCache::NewL();
iShutdownWatcher = CShutdownWatcher::NewL( *this );
- iShutdownWatcher->Start();
+ iShutdownWatcher->Start();
+ iPercentValue = 0;
+
// For uninstaller
// SisInstaller do not own this so do not delete.
iProgramStatus = &aMainStatus;
- iUpdateCache = ETrue;
+ iUpdateCache = ETrue;
+ iFileOpen = EFalse;
+ iInstallLauncher = NULL;
}
+// -----------------------------------------------------------------------
+// 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();
@@ -121,13 +141,17 @@
CleanupStack::Pop( fileName );
}
+
+// -----------------------------------------------------------------------
+// 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.
@@ -136,7 +160,7 @@
FLOG( _L("Daemon: StartInstallingL: Set EStateIdle") );
iProgramStatus->SetProgramStatusToIdle();
}
-
+ FLOG( _L("Daemon: StartInstallingL: User::Leave(KErrAbort)") );
User::Leave(KErrAbort);
}
@@ -147,26 +171,37 @@
{
FLOG( _L("Daemon: StartInstallingL: Set EStateInstalling") );
iProgramStatus->SetProgramStatus( EStateInstalling );
- }
- FLOG_1( _L("[CSisInstaller] ConstructL iGeneralProcessStatus = %d"),
- iGeneralProcessStatus );
+ }
+
+ FLOG_1( _L("Daemon: iGeneralProcessStatus: %d"), iGeneralProcessStatus );
+ FLOG_1( _L("Daemon: iInstallLauncher: 0x%x"),iInstallLauncher );
- if ( !iInstallLauncher )
+ if ( iInstallLauncher == NULL )
{
- iInstallLauncher = CSilentLauncher::NewL( iFs );
+ 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() );
}
if ( iState == EDSisInstallerStateIdle )
- {
+ {
// Reset the error
- iInstallErr = KErrNone;
+ iInstallErr = KErrNone;
CompleteSelf();
}
}
-#ifdef RD_MULTIPLE_DRIVE
+// -----------------------------------------------------------------------
+// CSisInstaller::IsInstalling
// Returns state of Installer.
-
+// -----------------------------------------------------------------------
+//
TBool CSisInstaller::IsInstalling()
{
if ( iInstallerState == EDSisInstallerStateCompleted )
@@ -178,24 +213,33 @@
return ETrue;
}
}
-#endif //RD_MULTIPLE_DRIVE
-
+
+// -----------------------------------------------------------------------
+// CSisInstaller::CompleteSelf
// Complete the request manually
-
+// -----------------------------------------------------------------------
+//
void CSisInstaller::CompleteSelf()
{
+ FLOG( _L("Daemon: CSisInstaller::CompleteSelf") );
if ( !IsActive() )
{
TRequestStatus* status = &iStatus;
- User::RequestComplete(status,KErrNone);
+ FLOG( _L("Daemon: CompleteSelf: RequestComplete") );
+ User::RequestComplete( status, KErrNone );
+ FLOG( _L("Daemon: CompleteSelf: SetActive") );
SetActive();
}
}
+// -----------------------------------------------------------------------
+// CSisInstaller::DoCancel
// Cancel the active request
-
+// -----------------------------------------------------------------------
+//
void CSisInstaller::DoCancel()
{
+ FLOG( _L("Daemon: CSisInstaller::DoCancel") );
iTimer.Cancel();
iFileIndex = 0;
@@ -219,12 +263,16 @@
}
}
-// When the software installer has changed state
-// attemp to install a sisx file
-
+// -----------------------------------------------------------------------
+// CSisInstaller::RunL
+// When the software installer has changed state attemp to install a
+// sisx file
+// -----------------------------------------------------------------------
+//
void CSisInstaller::RunL()
- {
- FLOG_2( _L("Daemon: Installer RunL status:%d, state:%d"), iStatus.Int(), iState );
+ {
+ FLOG_1( _L("Daemon: Installer RunL status:%d"), iStatus.Int() );
+ FLOG_1( _L("Daemon: Installer RunL state:%d"), iState );
// For uninstaller
// Check that uninstaller is not running.
@@ -235,10 +283,8 @@
TTimeIntervalMicroSeconds32 time( KWaitUninstallerTime );
iTimer.After(iStatus,time);
// Set to idle, installer has not yet started.
- iState = EDSisInstallerStateIdle;
- #ifdef RD_MULTIPLE_DRIVE
- iInstallerState = iState;
- #endif
+ iState = EDSisInstallerStateIdle;
+ iInstallerState = iState;
SetActive();
}
else
@@ -252,28 +298,41 @@
// Reached when installation is completed
case EDSisInstallerStateInstalling:
FLOG( _L("Daemon: RunL: EDSisInstallerStateInstalling") );
- FLOG_1( _L("Daemon: Installation completed with %d"), iStatus.Int() );
- // Installation is completed, check result
+ FLOG_1( _L("Daemon: Installation completed with %d"),
+ iStatus.Int() );
+ // 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;
- #ifdef RD_MULTIPLE_DRIVE
- iInstallerState = iState;
- #endif
+ iState = EDSisInstallerStateInstallerBusy;
+ iInstallerState = iState;
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: KSWInstErrSecurityFailure or error") );
+ FLOG( _L("Daemon: RunL: iStatus: error of sec. failure") );
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 )
@@ -282,10 +341,11 @@
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
{
@@ -293,7 +353,8 @@
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();
}
@@ -303,11 +364,8 @@
if ( iFileIndex < iFilesToInstall.Count() )
{
// Kick of the next installation
- iState = EDSisInstallerStateIdle;
- #ifdef RD_MULTIPLE_DRIVE
- iInstallerState = iState;
- #endif
-
+ iState = EDSisInstallerStateIdle;
+ iInstallerState = iState;
CompleteSelf();
}
else
@@ -322,7 +380,17 @@
// Install a file
case EDSisInstallerStateIdle:
{
- FLOG( _L("Daemon: RunL: 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;
+ }
// Let's update installed apps cache so we do not give
// installed pacakges several time to plug-in.
@@ -336,14 +404,36 @@
}
if ( iFileIndex < iFilesToInstall.Count() )
- {
+ {
+ // Let's calc. values before index is updated.
+ CalcPercentValue();
+
+ // Get next sisx package from array.
iSisFile.Copy( *iFilesToInstall[iFileIndex] );
- ++iFileIndex;
-
- // No need to install if the package has been installed
- // some time in the past
- if ( IsValidPackageL( iSisFile ) && NeedsInstallingL( iSisFile ) )
- {
+ ++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 ) )
+ {
// 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
@@ -352,42 +442,48 @@
{
// 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;
- #ifdef RD_MULTIPLE_DRIVE
+ // Note that we do not have iStatus as this is not
+ // async. call so we can not use
+ // EDSisInstallerStateInstalling state.
+ iState = EDSisInstallerStateIdle;
iInstallerState = iState;
- #endif
+
// Plugin interface is not asyncronous. We need to
// complete self to get all packages to plugin.
CompleteSelf();
}
else
- {
- 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();
+ {
+ // 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();
}
}
else
{
- FLOG_1( _L("Daemon: No need to install %S"), &iSisFile );
- iState = EDSisInstallerStateIdle;
- #ifdef RD_MULTIPLE_DRIVE
- iInstallerState = iState;
- #endif
+ FLOG_1( _L("Daemon: NOT INSTALLING: %S"), &iSisFile );
+ iState = EDSisInstallerStateIdle;
+ iInstallerState = iState;
// Clear current pkg UID
- iCurrentPackageId = TUid::Null();
-
+ iCurrentPackageId = TUid::Null();
CompleteSelf();
}
}
@@ -402,16 +498,55 @@
break;
case EDSisInstallerStateInstallerBusy:
+ {
// Try to install the file again
- 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
+ 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 );
- SetActive();
+ 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();
+ }
+ }
break;
// Active object in unknown state
@@ -420,18 +555,26 @@
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 RunL error %d"), aError );
+ FLOG_1( _L("Daemon: Installer Run 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
@@ -439,29 +582,47 @@
// 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;
+ iInstallErr = KErrNone;
+ FLOG( _L("Daemon: InstallationCompleted: Delete iInstallLauncher") );
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] ) ) )
@@ -476,12 +637,6 @@
}
}
- 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());
@@ -499,12 +654,16 @@
}
}
+// -----------------------------------------------------------------------
+// CSisInstaller::NeedsInstallingL
// Indicates if this package is installed or not.
-
+// -----------------------------------------------------------------------
+//
TBool CSisInstaller::NeedsInstallingL( const TDesC& aPackageName )
{
- FLOG( _L("Daemon: NeedsInstallingL") );
- TBool result( ETrue );
+ FLOG( _L("Daemon: CSisInstaller::NeedsInstallingL") );
+ //TBool result( ETrue );
+ TBool needsInstalling( ETrue );
// Read the controller data from the package
CFileSisDataProvider* fileProvider = CFileSisDataProvider::NewLC( iFs, aPackageName );
@@ -517,7 +676,6 @@
CleanupStack::PushL( controller );
// Code to read UID
-
CDesDataProvider* controllerProvider= CDesDataProvider::NewLC(*controller);
CController* controllerObject = NULL;
controllerObject = CController::NewL(*controllerProvider);
@@ -525,15 +683,30 @@
TUid packageId = controllerObject->Info().Uid().Uid();
- CleanupStack::PopAndDestroy(controllerObject);
- CleanupStack::PopAndDestroy(controllerProvider);
+ CleanupStack::PopAndDestroy( controllerObject );
+ CleanupStack::PopAndDestroy( controllerProvider );
- 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 );
+ // 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 );
- if (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 )
+ {
RSisRegistrySession registry;
User::LeaveIfError( registry.Connect() );
CleanupClosePushL( registry );
@@ -548,32 +721,40 @@
User::LeaveIfError( entry.Open( registry, packageId ) );
CleanupClosePushL( entry );
- result = entry.IsInRomL();
+ needsInstalling = entry.IsInRomL();
- FLOG_1( _L("Daemon: NeedsInstallingL: Is in ROM = %d"), result );
+ FLOG_1( _L("Daemon: NeedsInstallingL: Is in ROM = %d"), needsInstalling );
CleanupStack::PopAndDestroy( &entry );
}
CleanupStack::PopAndDestroy( ®istry );
- }
-
+ }
+ */
+
// Check that previous install attempt did not fail.
- if (result)
+ if ( needsInstalling )
{
- result = !iInstallationFailedAppsCache->HasPreviousInstallationFailed( packageId );
- FLOG_1( _L("Daemon: NeedsInstallingL: Has failed (cache) = %d"), !result );
+ needsInstalling = !iInstallationFailedAppsCache->
+ HasPreviousInstallationFailed( packageId );
+ FLOG_1( _L("Daemon: Has failed (cache) = %d"), !needsInstalling );
}
// Update pkg ID. ID is added to cache after installation.
- if (result)
+ if ( needsInstalling )
{
iCurrentPackageId = packageId;
}
+ // fileProvider, content, controller
CleanupStack::PopAndDestroy( 3 );
-
- return result;
+
+ FLOG_1( _L("Daemon: NeedsInstallingL = %d"), needsInstalling );
+ return needsInstalling;
}
+// -----------------------------------------------------------------------
+// CSisInstaller::IsMediaPresent
+// -----------------------------------------------------------------------
+//
TBool CSisInstaller::IsMediaPresent( TChar aDrive )
{
TInt drive( 0 );
@@ -595,25 +776,71 @@
}
}
-TBool CSisInstaller::IsValidPackageL( const TDesC& aPackageName )
+// -----------------------------------------------------------------------
+// CSisInstaller::IsValidPackageL
+// -----------------------------------------------------------------------
+//
+TBool CSisInstaller::IsValidPackageL()
{
- TBool result( EFalse );
-
- RFile file;
+ TBool result( EFalse );
+
+ if ( !iFileOpen )
+ {
+ FLOG( _L("Daemon: IsValidPackageL: ERROR FILE NOT OPEN") );
+ return result;
+ }
+
TUid appUid;
TDataType dataType;
- User::LeaveIfError( file.Open( iFs, aPackageName, EFileRead ) );
- iApaSession.AppForDocument( file, appUid, dataType );
- file.Close();
+
+ iApaSession.AppForDocument( iSisFileHandle, appUid, dataType );
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