|
1 /* |
|
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "daemoninstaller.h" |
|
20 #include "DialogWrapper.h" |
|
21 #include "swispubsubdefs.h" |
|
22 |
|
23 #include "SWInstDebug.h" |
|
24 #include "SilentLauncher.h" |
|
25 #include "SWInstDefs.h" |
|
26 |
|
27 #include "sisregistrysession.h" |
|
28 #include "siscontents.h" |
|
29 #include "sisparser.h" |
|
30 #include "filesisdataprovider.h" |
|
31 |
|
32 #include "previouslyInstalledAppsCache.h" |
|
33 #include "dessisdataprovider.h" |
|
34 #include "siscontroller.h" |
|
35 #include "sisinfo.h" |
|
36 #include "sisuid.h" |
|
37 #include "installationFailedAppsCache.h" |
|
38 #include "sisregistryentry.h" |
|
39 // For uninstaller |
|
40 #include "programstatus.h" |
|
41 |
|
42 using namespace Swi; |
|
43 |
|
44 const static TInt KInstallRetryWaitTime = 10000000; // 10 secs |
|
45 // For uninstaller |
|
46 const static TInt KWaitUninstallerTime = 1000000; // 1 secs |
|
47 |
|
48 _LIT(KMCSisInstaller,"Daemon-Installer"); // Minor-Component name |
|
49 |
|
50 // Two phased construction |
|
51 |
|
52 CSisInstaller* CSisInstaller::NewL( |
|
53 MDaemonInstallBehaviour* aDaemonBehaviour, |
|
54 CProgramStatus& aMainStatus) |
|
55 { |
|
56 CSisInstaller* self = new (ELeave) CSisInstaller( aDaemonBehaviour ); |
|
57 CleanupStack::PushL(self); |
|
58 self->ConstructL( aMainStatus ); // For uninstaller |
|
59 CleanupStack::Pop(self); |
|
60 return self; |
|
61 } |
|
62 |
|
63 // Install Request constructor |
|
64 |
|
65 CSisInstaller::CSisInstaller( MDaemonInstallBehaviour* aDaemonBehaviour ) |
|
66 : CActive(CActive::EPriorityStandard), |
|
67 iDaemonBehaviour( aDaemonBehaviour ), |
|
68 iState(EDSisInstallerStateIdle), |
|
69 iFileIndex(0), |
|
70 iInstallErr( KErrNone ) |
|
71 { |
|
72 CActiveScheduler::Add(this); |
|
73 #ifdef RD_MULTIPLE_DRIVE |
|
74 iInstallerState = EDSisInstallerStateIdle; |
|
75 #endif |
|
76 } |
|
77 |
|
78 // Install Request destructor |
|
79 |
|
80 CSisInstaller::~CSisInstaller() |
|
81 { |
|
82 Cancel(); |
|
83 iTimer.Close(); |
|
84 iFilesToInstall.ResetAndDestroy(); |
|
85 iFilesToInstall.Close(); |
|
86 delete iInstallLauncher; |
|
87 delete iDialogs; |
|
88 iFs.Close(); |
|
89 iApaSession.Close(); |
|
90 delete iPreviouslyInstalledAppsCache; |
|
91 delete iInstallationFailedAppsCache; |
|
92 delete iShutdownWatcher; |
|
93 } |
|
94 |
|
95 // 2nd phase construction |
|
96 |
|
97 void CSisInstaller::ConstructL( CProgramStatus& aMainStatus ) |
|
98 { |
|
99 User::LeaveIfError( iTimer.CreateLocal() ); |
|
100 User::LeaveIfError( iFs.Connect() ); |
|
101 User::LeaveIfError( iApaSession.Connect() ); |
|
102 iFs.ShareProtected(); |
|
103 iDialogs = CDialogWrapper::NewL( iFs ); |
|
104 iPreviouslyInstalledAppsCache = CPreviouslyInstalledAppsCache::NewL(); |
|
105 iInstallationFailedAppsCache = CInstallationFailedAppsCache::NewL(); |
|
106 iShutdownWatcher = CShutdownWatcher::NewL( *this ); |
|
107 iShutdownWatcher->Start(); |
|
108 // For uninstaller |
|
109 // SisInstaller do not own this so do not delete. |
|
110 iProgramStatus = &aMainStatus; |
|
111 iUpdateCache = ETrue; |
|
112 } |
|
113 |
|
114 // Set the location of all sis files and the list of them |
|
115 // also take ownership of the pointers to memory |
|
116 |
|
117 void CSisInstaller::AddFileToInstallL(const TDesC& aFileName) |
|
118 { |
|
119 HBufC* fileName = aFileName.AllocLC(); |
|
120 iFilesToInstall.AppendL( fileName ); |
|
121 CleanupStack::Pop( fileName ); |
|
122 } |
|
123 |
|
124 // Start the request to process the Sisx file |
|
125 |
|
126 void CSisInstaller::StartInstallingL() |
|
127 { |
|
128 FLOG( _L("Daemon: StartInstallingL") ); |
|
129 |
|
130 if(!iFilesToInstall.Count()) |
|
131 { |
|
132 // For uninstaller |
|
133 // Check state, if installing change it to idle. |
|
134 if ( EStateInstalling == iProgramStatus->GetProgramStatus() ) |
|
135 { |
|
136 FLOG( _L("Daemon: StartInstallingL: Set EStateIdle") ); |
|
137 iProgramStatus->SetProgramStatusToIdle(); |
|
138 } |
|
139 |
|
140 User::Leave(KErrAbort); |
|
141 } |
|
142 |
|
143 // For uninstaller |
|
144 // Check state. If idle chage it to installing, but if installing |
|
145 // or uninstalling do nothing. |
|
146 if ( EStateIdle == iProgramStatus->GetProgramStatus() ) |
|
147 { |
|
148 FLOG( _L("Daemon: StartInstallingL: Set EStateInstalling") ); |
|
149 iProgramStatus->SetProgramStatus( EStateInstalling ); |
|
150 } |
|
151 FLOG_1( _L("[CSisInstaller] ConstructL iGeneralProcessStatus = %d"), |
|
152 iGeneralProcessStatus ); |
|
153 |
|
154 if ( !iInstallLauncher ) |
|
155 { |
|
156 iInstallLauncher = CSilentLauncher::NewL( iFs ); |
|
157 } |
|
158 |
|
159 if ( iState == EDSisInstallerStateIdle ) |
|
160 { |
|
161 // Reset the error |
|
162 iInstallErr = KErrNone; |
|
163 CompleteSelf(); |
|
164 } |
|
165 } |
|
166 |
|
167 #ifdef RD_MULTIPLE_DRIVE |
|
168 // Returns state of Installer. |
|
169 |
|
170 TBool CSisInstaller::IsInstalling() |
|
171 { |
|
172 if ( iInstallerState == EDSisInstallerStateCompleted ) |
|
173 { |
|
174 return EFalse; |
|
175 } |
|
176 else |
|
177 { |
|
178 return ETrue; |
|
179 } |
|
180 } |
|
181 #endif //RD_MULTIPLE_DRIVE |
|
182 |
|
183 // Complete the request manually |
|
184 |
|
185 void CSisInstaller::CompleteSelf() |
|
186 { |
|
187 if ( !IsActive() ) |
|
188 { |
|
189 TRequestStatus* status = &iStatus; |
|
190 User::RequestComplete(status,KErrNone); |
|
191 SetActive(); |
|
192 } |
|
193 } |
|
194 |
|
195 // Cancel the active request |
|
196 |
|
197 void CSisInstaller::DoCancel() |
|
198 { |
|
199 iTimer.Cancel(); |
|
200 |
|
201 iFileIndex = 0; |
|
202 iFilesToInstall.ResetAndDestroy(); |
|
203 if ( iState == EDSisInstallerStateInstalling ) |
|
204 { |
|
205 iInstallLauncher->Cancel(); |
|
206 } |
|
207 |
|
208 // Note that this will also signal plugin that |
|
209 // Daemon part is completed. However uninstaller |
|
210 // may run since program status is set to idle. |
|
211 InstallationCompleted( KErrNone ); |
|
212 |
|
213 // For uninstaller |
|
214 // Set Installer to idle |
|
215 if ( EStateInstalling == iProgramStatus->GetProgramStatus() ) |
|
216 { |
|
217 FLOG( _L("Daemon: DoCancel: Set EStateIdle") ); |
|
218 iProgramStatus->SetProgramStatusToIdle(); |
|
219 } |
|
220 } |
|
221 |
|
222 // When the software installer has changed state |
|
223 // attemp to install a sisx file |
|
224 |
|
225 void CSisInstaller::RunL() |
|
226 { |
|
227 FLOG_2( _L("Daemon: Installer RunL status:%d, state:%d"), iStatus.Int(), iState ); |
|
228 |
|
229 // For uninstaller |
|
230 // Check that uninstaller is not running. |
|
231 if ( EStateUninstalling == iProgramStatus->GetProgramStatus() ) |
|
232 { |
|
233 // If uninstaller is running already let's wait. |
|
234 FLOG( _L("Daemon: RunL: EStateUninstalling -> wait") ); |
|
235 TTimeIntervalMicroSeconds32 time( KWaitUninstallerTime ); |
|
236 iTimer.After(iStatus,time); |
|
237 // Set to idle, installer has not yet started. |
|
238 iState = EDSisInstallerStateIdle; |
|
239 #ifdef RD_MULTIPLE_DRIVE |
|
240 iInstallerState = iState; |
|
241 #endif |
|
242 SetActive(); |
|
243 } |
|
244 else |
|
245 { |
|
246 // Ok uninstaller is in idle, run installing. |
|
247 iProgramStatus->SetProgramStatus( EStateInstalling ); |
|
248 FLOG( _L("Daemon: RunL: Set EStateInstalling") ); |
|
249 |
|
250 switch (iState) |
|
251 { |
|
252 // Reached when installation is completed |
|
253 case EDSisInstallerStateInstalling: |
|
254 FLOG( _L("Daemon: RunL: EDSisInstallerStateInstalling") ); |
|
255 FLOG_1( _L("Daemon: Installation completed with %d"), iStatus.Int() ); |
|
256 // Installation is completed, check result |
|
257 |
|
258 if ( iStatus.Int() == SwiUI::KSWInstErrBusy ) |
|
259 { |
|
260 FLOG( _L("Daemon: RunL: iStatus: KSWInstErrBusy") ); |
|
261 // User might be installing something, wait before retrying |
|
262 TTimeIntervalMicroSeconds32 time( KInstallRetryWaitTime ); |
|
263 iTimer.After(iStatus,time); |
|
264 iState = EDSisInstallerStateInstallerBusy; |
|
265 #ifdef RD_MULTIPLE_DRIVE |
|
266 iInstallerState = iState; |
|
267 #endif |
|
268 SetActive(); |
|
269 break; |
|
270 } |
|
271 else if ( (iStatus.Int() == SwiUI::KSWInstErrSecurityFailure && iInstallErr == KErrNone) || |
|
272 (iStatus.Int() != KErrNone && iStatus.Int() != SwiUI::KSWInstErrSecurityFailure) ) |
|
273 { |
|
274 FLOG( _L("Daemon: RunL: iStatus: KSWInstErrSecurityFailure or error") ); |
|
275 iInstallErr = iStatus.Int(); |
|
276 } |
|
277 |
|
278 // Catch all installation error from SwiUI and update cache. |
|
279 if ( iStatus.Int() != KErrNone ) |
|
280 { |
|
281 FLOG( _L("Daemon: RunL: Installation error.") ); |
|
282 if ( iCurrentPackageId != TUid::Uid( NULL ) ) |
|
283 { |
|
284 FLOG( _L("Daemon: RunL: Add UID to cache.") ); |
|
285 iInstallationFailedAppsCache->AddPackageUID( iCurrentPackageId ); |
|
286 // Clear current UID |
|
287 iCurrentPackageId = TUid::Null(); |
|
288 } |
|
289 } |
|
290 else |
|
291 { |
|
292 FLOG( _L("Daemon: RunL: Installation OK.") ); |
|
293 if ( iCurrentPackageId != TUid::Uid( NULL ) ) |
|
294 { |
|
295 FLOG( _L("Daemon: RunL: Add UID to cache.") ); |
|
296 iPreviouslyInstalledAppsCache->UpdateAddL( iCurrentPackageId ); |
|
297 // Clear current UID |
|
298 iCurrentPackageId = TUid::Null(); |
|
299 } |
|
300 } |
|
301 |
|
302 // Check if we have more to install |
|
303 if ( iFileIndex < iFilesToInstall.Count() ) |
|
304 { |
|
305 // Kick of the next installation |
|
306 iState = EDSisInstallerStateIdle; |
|
307 #ifdef RD_MULTIPLE_DRIVE |
|
308 iInstallerState = iState; |
|
309 #endif |
|
310 |
|
311 CompleteSelf(); |
|
312 } |
|
313 else |
|
314 { |
|
315 // Note that this will also signal plugin that |
|
316 // Daemon part is completed. However uninstaller |
|
317 // may run since program status is set to idle. |
|
318 InstallationCompleted( iInstallErr ); |
|
319 } |
|
320 break; |
|
321 |
|
322 // Install a file |
|
323 case EDSisInstallerStateIdle: |
|
324 { |
|
325 FLOG( _L("Daemon: RunL: EDSisInstallerStateIdle") ); |
|
326 |
|
327 // Let's update installed apps cache so we do not give |
|
328 // installed pacakges several time to plug-in. |
|
329 if ( iUpdateCache && iDaemonBehaviour->IsPlugin() ) |
|
330 { |
|
331 FLOG( _L("Daemon: RunL: Update installed cache") ); |
|
332 TRAP_IGNORE( iPreviouslyInstalledAppsCache->UpdateAllL() ); |
|
333 // This is needed only once in session. |
|
334 // InstallationCompleted will set this ETrue again. |
|
335 iUpdateCache = EFalse; |
|
336 } |
|
337 |
|
338 if ( iFileIndex < iFilesToInstall.Count() ) |
|
339 { |
|
340 iSisFile.Copy( *iFilesToInstall[iFileIndex] ); |
|
341 ++iFileIndex; |
|
342 |
|
343 // No need to install if the package has been installed |
|
344 // some time in the past |
|
345 if ( IsValidPackageL( iSisFile ) && NeedsInstallingL( iSisFile ) ) |
|
346 { |
|
347 // If there is plugin for SWI Daemon then let's us it. |
|
348 // Daemon will give all files to plug-in which will |
|
349 // handle installation. There is not feedback so SWI |
|
350 // Daemon will not wait plug-in. |
|
351 if ( iDaemonBehaviour->IsPlugin() ) |
|
352 { |
|
353 // Notify plug-in if not yet done. |
|
354 iDaemonBehaviour->NotifyPlugin(); |
|
355 FLOG_1( _L("Daemon: Use plugin to install: %S"), &iSisFile ); |
|
356 TRAP_IGNORE( iDaemonBehaviour->RequestPluginInstall( iSisFile ) ); |
|
357 |
|
358 // Let's continue to give all packages to plug-in. |
|
359 // Note that we do not have iStatus as this is not async. call |
|
360 // so we can not use EDSisInstallerStateInstalling state. |
|
361 iState = EDSisInstallerStateIdle; |
|
362 #ifdef RD_MULTIPLE_DRIVE |
|
363 iInstallerState = iState; |
|
364 #endif |
|
365 // Plugin interface is not asyncronous. We need to |
|
366 // complete self to get all packages to plugin. |
|
367 CompleteSelf(); |
|
368 } |
|
369 else |
|
370 { |
|
371 FLOG_1( _L("Daemon: Kick off the install for %S"), &iSisFile ); |
|
372 iInstallLauncher->InstallL( iSisFile, iStatus ); |
|
373 iDialogs->ShowWaitingNoteL(); |
|
374 iState = EDSisInstallerStateInstalling; |
|
375 #ifdef RD_MULTIPLE_DRIVE |
|
376 iInstallerState = iState; |
|
377 #endif |
|
378 SetActive(); |
|
379 } |
|
380 } |
|
381 else |
|
382 { |
|
383 FLOG_1( _L("Daemon: No need to install %S"), &iSisFile ); |
|
384 iState = EDSisInstallerStateIdle; |
|
385 #ifdef RD_MULTIPLE_DRIVE |
|
386 iInstallerState = iState; |
|
387 #endif |
|
388 // Clear current pkg UID |
|
389 iCurrentPackageId = TUid::Null(); |
|
390 |
|
391 CompleteSelf(); |
|
392 } |
|
393 } |
|
394 else |
|
395 { |
|
396 // Note that this will also signal plugin that |
|
397 // Daemon part is completed. However uninstaller |
|
398 // may run since program status is set to idle. |
|
399 InstallationCompleted( iInstallErr ); |
|
400 } |
|
401 } |
|
402 break; |
|
403 |
|
404 case EDSisInstallerStateInstallerBusy: |
|
405 // Try to install the file again |
|
406 FLOG( _L("Daemon: RunL: EDSisInstallerStateInstallerBusy") ); |
|
407 FLOG_1( _L("Daemon: Kick off the install for %S"), &iSisFile ); |
|
408 iInstallLauncher->InstallL( iSisFile, iStatus ); |
|
409 iState = EDSisInstallerStateInstalling; |
|
410 #ifdef RD_MULTIPLE_DRIVE |
|
411 iInstallerState = iState; |
|
412 #endif |
|
413 |
|
414 SetActive(); |
|
415 break; |
|
416 |
|
417 // Active object in unknown state |
|
418 default: |
|
419 User::Panic(KMCSisInstaller,KErrNotSupported); |
|
420 break; |
|
421 } |
|
422 } // else for uninstaller |
|
423 } |
|
424 |
|
425 // If RunL leaves then ignore errors |
|
426 |
|
427 TInt CSisInstaller::RunError(TInt aError) |
|
428 { |
|
429 FLOG_1( _L("Daemon: Installer RunL error %d"), aError ); |
|
430 TInt err( KErrNone ); |
|
431 InstallationCompleted( aError ); |
|
432 return err; |
|
433 } |
|
434 |
|
435 void CSisInstaller::NotifyShuttingDown() |
|
436 { |
|
437 // System is closing down, we need to stop installations and save |
|
438 // the lists of previously installed apps and failed installations. |
|
439 // Application server receives EApaSystemEventShutdown event that |
|
440 // closes it down. |
|
441 Cancel(); |
|
442 } |
|
443 |
|
444 void CSisInstaller::InstallationCompleted( TInt aResult ) |
|
445 { |
|
446 FLOG_1( _L("Daemon: InstallationCompleted with result = %d"), aResult ); |
|
447 iState = EDSisInstallerStateIdle; |
|
448 iInstallErr = KErrNone; |
|
449 delete iInstallLauncher; |
|
450 iInstallLauncher = NULL; |
|
451 // We need to update cache again in RunL if plug-in is loaded. |
|
452 // It may be that plug-in does install packages after cache is updated. |
|
453 iUpdateCache = ETrue; |
|
454 |
|
455 #ifdef RD_MULTIPLE_DRIVE |
|
456 // If all files are installed set status to completed. |
|
457 if ( iFileIndex >= iFilesToInstall.Count() ) |
|
458 { |
|
459 iInstallerState = EDSisInstallerStateCompleted; |
|
460 } |
|
461 #endif |
|
462 |
|
463 TRAP_IGNORE( iDialogs->CancelWaitingNoteL() ); |
|
464 |
|
465 if ( aResult != KErrNone && |
|
466 iSisFile.Length() > 0 && |
|
467 IsMediaPresent( TChar( iSisFile[0] ) ) ) |
|
468 { |
|
469 if ( aResult == SwiUI::KSWInstErrSecurityFailure ) |
|
470 { |
|
471 TRAP_IGNORE( iDialogs->ShowUntrustedResultL() ); |
|
472 } |
|
473 else |
|
474 { |
|
475 TRAP_IGNORE( iDialogs->ShowErrorResultL() ); |
|
476 } |
|
477 } |
|
478 |
|
479 FLOG( _L("Daemon: InstallationCompleted: Update installed cache") ); |
|
480 // Update cache so we do not start to install those packages |
|
481 // which are installed by the user manyally. |
|
482 // NOTE! plugin will install stuff after this call. |
|
483 TRAP_IGNORE(iPreviouslyInstalledAppsCache->UpdateAllL()); |
|
484 |
|
485 TRAP_IGNORE(iPreviouslyInstalledAppsCache->FlushToDiskL();); |
|
486 TRAP_IGNORE(iInstallationFailedAppsCache->FlushToDiskL()); |
|
487 |
|
488 // Notify plugin that daemon has complete installation. |
|
489 // Note that program status is set to idle for uninstaller. |
|
490 // Plugin needs to wait uninstaller if it starts before. |
|
491 iDaemonBehaviour->DoNotifyMediaProcessingComplete(); |
|
492 |
|
493 // For uninstaller |
|
494 // Set Installer to idle, if state is installing |
|
495 if ( EStateInstalling == iProgramStatus->GetProgramStatus() ) |
|
496 { |
|
497 FLOG( _L("Daemon: InstallationCompleted: Set EStateIdle") ); |
|
498 iProgramStatus->SetProgramStatusToIdle(); |
|
499 } |
|
500 } |
|
501 |
|
502 // Indicates if this package is installed or not. |
|
503 |
|
504 TBool CSisInstaller::NeedsInstallingL( const TDesC& aPackageName ) |
|
505 { |
|
506 FLOG( _L("Daemon: NeedsInstallingL") ); |
|
507 TBool result( ETrue ); |
|
508 |
|
509 // Read the controller data from the package |
|
510 CFileSisDataProvider* fileProvider = CFileSisDataProvider::NewLC( iFs, aPackageName ); |
|
511 TInt64 pos( 0 ); |
|
512 fileProvider->Seek( ESeekStart, pos ); |
|
513 Swi::Sis::CContents* content = Swi::Sis::Parser::ContentsL( *fileProvider ); |
|
514 CleanupStack::PushL( content ); |
|
515 |
|
516 HBufC8* controller = content->ReadControllerL(); |
|
517 CleanupStack::PushL( controller ); |
|
518 |
|
519 // Code to read UID |
|
520 |
|
521 CDesDataProvider* controllerProvider= CDesDataProvider::NewLC(*controller); |
|
522 CController* controllerObject = NULL; |
|
523 controllerObject = CController::NewL(*controllerProvider); |
|
524 CleanupStack::PushL(controllerObject); |
|
525 |
|
526 TUid packageId = controllerObject->Info().Uid().Uid(); |
|
527 |
|
528 CleanupStack::PopAndDestroy(controllerObject); |
|
529 CleanupStack::PopAndDestroy(controllerProvider); |
|
530 |
|
531 FLOG_1( _L("Daemon: NeedsInstallingL: Is UID installed = 0x%x"), packageId.iUid ); |
|
532 result = !iPreviouslyInstalledAppsCache->HasBeenPreviouslyInstalled(packageId); |
|
533 FLOG_1( _L("Daemon: NeedsInstallingL: Has been installed (cache) = %d"), !result ); |
|
534 |
|
535 if (result) |
|
536 { |
|
537 RSisRegistrySession registry; |
|
538 User::LeaveIfError( registry.Connect() ); |
|
539 CleanupClosePushL( registry ); |
|
540 result = !registry.IsInstalledL( packageId ); |
|
541 |
|
542 FLOG_1( _L("Daemon: NeedsInstallingL: Is installed = %d"), !result ); |
|
543 // Check if binary is installed in ROM. If pkg is in ROM, it is stub sis. |
|
544 // Continue installation. |
|
545 if ( !result ) |
|
546 { |
|
547 RSisRegistryEntry entry; |
|
548 User::LeaveIfError( entry.Open( registry, packageId ) ); |
|
549 CleanupClosePushL( entry ); |
|
550 |
|
551 result = entry.IsInRomL(); |
|
552 |
|
553 FLOG_1( _L("Daemon: NeedsInstallingL: Is in ROM = %d"), result ); |
|
554 CleanupStack::PopAndDestroy( &entry ); |
|
555 } |
|
556 CleanupStack::PopAndDestroy( ®istry ); |
|
557 } |
|
558 |
|
559 // Check that previous install attempt did not fail. |
|
560 if (result) |
|
561 { |
|
562 result = !iInstallationFailedAppsCache->HasPreviousInstallationFailed( packageId ); |
|
563 FLOG_1( _L("Daemon: NeedsInstallingL: Has failed (cache) = %d"), !result ); |
|
564 } |
|
565 |
|
566 // Update pkg ID. ID is added to cache after installation. |
|
567 if (result) |
|
568 { |
|
569 iCurrentPackageId = packageId; |
|
570 } |
|
571 |
|
572 CleanupStack::PopAndDestroy( 3 ); |
|
573 |
|
574 return result; |
|
575 } |
|
576 |
|
577 TBool CSisInstaller::IsMediaPresent( TChar aDrive ) |
|
578 { |
|
579 TInt drive( 0 ); |
|
580 TInt err = iFs.CharToDrive( aDrive, drive ); |
|
581 if ( err == KErrNone ) |
|
582 { |
|
583 TVolumeInfo volumeInfo; |
|
584 err = iFs.Volume( volumeInfo, drive ); |
|
585 } |
|
586 |
|
587 if ( err == KErrNone ) |
|
588 { |
|
589 return ETrue; |
|
590 } |
|
591 else |
|
592 { |
|
593 FLOG( _L("Daemon: Drive no present") ); |
|
594 return EFalse; |
|
595 } |
|
596 } |
|
597 |
|
598 TBool CSisInstaller::IsValidPackageL( const TDesC& aPackageName ) |
|
599 { |
|
600 TBool result( EFalse ); |
|
601 |
|
602 RFile file; |
|
603 TUid appUid; |
|
604 TDataType dataType; |
|
605 User::LeaveIfError( file.Open( iFs, aPackageName, EFileRead ) ); |
|
606 iApaSession.AppForDocument( file, appUid, dataType ); |
|
607 file.Close(); |
|
608 |
|
609 if ( dataType.Des8() == SwiUI::KSisxMimeType ) |
|
610 { |
|
611 result = ETrue; |
|
612 } |
|
613 |
|
614 return result; |
|
615 } |
|
616 |
|
617 //EOF |
|
618 |
|
619 |
|
620 |
|
621 |
|
622 |
|
623 |