13 * |
13 * |
14 * Description: |
14 * Description: |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
|
18 #include <usif/scr/scr.h> |
|
19 #include <usif/scr/scrcommon.h> |
|
20 #include <usif/scr/screntries.h> |
|
21 #include <apgcli.h> //RApaSession |
|
22 //TODO enable apparc support |
|
23 //#include <appinfo.h> //TAppInfo |
|
24 |
18 #include "daemonbehaviour.h" |
25 #include "daemonbehaviour.h" |
19 #include "swispubsubdefs.h" |
26 #include "swispubsubdefs.h" |
20 #include "recsisx.h" |
27 #include "recsisx.h" |
21 #include "sisregistrywritablesession.h" |
28 #include "sisregistrywritablesession.h" |
22 #include "SWInstDebug.h" |
29 #include "SWInstDebug.h" |
23 #include "sisregistryentry.h" |
30 #include "sisregistryentry.h" |
24 |
31 |
25 |
32 using namespace Swi; |
26 namespace Swi |
33 |
27 { |
34 |
|
35 // ----------------------------------------------------------------------- |
|
36 // CDaemonBehaviour::NewL |
|
37 // ----------------------------------------------------------------------- |
|
38 // |
|
39 CDaemonBehaviour* CDaemonBehaviour::NewL( CProgramStatus& aMainStatus ) |
|
40 { |
|
41 CDaemonBehaviour* self = NewLC( aMainStatus ); |
|
42 CleanupStack::Pop(self); |
|
43 return self; |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------- |
|
47 // CDaemonBehaviour::NewLC |
|
48 // ----------------------------------------------------------------------- |
|
49 // |
|
50 CDaemonBehaviour* CDaemonBehaviour::NewLC( CProgramStatus& aMainStatus ) |
|
51 { |
|
52 CDaemonBehaviour* self = new (ELeave) CDaemonBehaviour; |
|
53 CleanupStack::PushL(self); |
|
54 self->ConstructL( aMainStatus ); |
|
55 return self; |
|
56 } |
|
57 |
|
58 // ----------------------------------------------------------------------- |
|
59 // CDaemonBehaviour::ConstructL |
|
60 // ----------------------------------------------------------------------- |
|
61 // |
|
62 void CDaemonBehaviour::ConstructL( CProgramStatus& aMainStatus ) |
|
63 { |
|
64 User::LeaveIfError(iFs.Connect()); |
|
65 User::LeaveIfError(iFs.ShareProtected()); |
|
66 |
28 // For uninstaller |
67 // For uninstaller |
29 CDaemonBehaviour* CDaemonBehaviour::NewL( CProgramStatus& aMainStatus ) |
68 iSisInstaller = CSisInstaller::NewL( this, aMainStatus ); |
30 { |
69 // Create plugin |
31 CDaemonBehaviour* self = NewLC( aMainStatus ); |
70 TRAP_IGNORE( iSwiDaemonPlugin = CSwiDaemonPlugin::NewL() ); |
32 CleanupStack::Pop(self); |
71 } |
33 return self; |
72 |
|
73 // ----------------------------------------------------------------------- |
|
74 // CDaemonBehaviour::~CDaemonBehaviour |
|
75 // ----------------------------------------------------------------------- |
|
76 // |
|
77 CDaemonBehaviour::~CDaemonBehaviour() |
|
78 { |
|
79 if ( iSwiDaemonPlugin ) |
|
80 { |
|
81 delete iSwiDaemonPlugin; |
|
82 REComSession::FinalClose(); |
|
83 } |
|
84 delete iSisInstaller; |
|
85 iSisInstaller = NULL; |
|
86 iFs.Close(); |
|
87 |
|
88 #ifdef RD_MULTIPLE_DRIVE |
|
89 iDriveArray.Close(); |
|
90 #endif |
|
91 } |
|
92 |
|
93 // ----------------------------------------------------------------------- |
|
94 // CDaemonBehaviour::StartupL |
|
95 // ----------------------------------------------------------------------- |
|
96 // |
|
97 TBool CDaemonBehaviour::StartupL() |
|
98 { |
|
99 // Return state of Startup |
|
100 return ETrue; |
|
101 } |
|
102 |
|
103 // ----------------------------------------------------------------------- |
|
104 // CDaemonBehaviour::MediaChangeL |
|
105 // ----------------------------------------------------------------------- |
|
106 // |
|
107 void CDaemonBehaviour::MediaChangeL(TInt aDrive, TChangeType aChangeType) |
|
108 { |
|
109 FLOG_1( _L("Daemon: Media change %d"), aDrive ); |
|
110 RSisRegistryWritableSession registrySession; |
|
111 |
|
112 User::LeaveIfError( registrySession.Connect() ); |
|
113 CleanupClosePushL( registrySession ); |
|
114 |
|
115 |
|
116 if ( aChangeType==EMediaInserted ) |
|
117 { |
|
118 FLOG( _L("Daemon: Media inserted") ); |
|
119 |
|
120 // Notify SCR and AppArc for media change. |
|
121 UpdateComponentStatusL( aChangeType, aDrive ); |
|
122 |
|
123 // We need call sis registry since this call will |
|
124 // activate sis registry to clean uninstalled components |
|
125 // from inserted media. |
|
126 registrySession.AddDriveL(aDrive); |
|
127 |
|
128 // Scan directory on the card and run pre-installed through SWIS |
|
129 FLOG( _L("Daemon: Media change: Process preinstalled files") ); |
|
130 ProcessPreinstalledFilesL(aDrive); |
|
131 |
|
132 // Add inserted media drive to drive array. |
|
133 if ( iDriveArray.Find(aDrive) == KErrNotFound ) |
|
134 { |
|
135 iDriveArray.AppendL(aDrive); |
|
136 } |
34 } |
137 } |
35 |
138 else if (aChangeType==EMediaRemoved) |
36 CDaemonBehaviour* CDaemonBehaviour::NewLC( CProgramStatus& aMainStatus ) |
139 { |
37 { |
140 FLOG( _L("Daemon: Media removed") ); |
38 CDaemonBehaviour* self = new (ELeave) CDaemonBehaviour; |
141 |
39 CleanupStack::PushL(self); |
142 // Notify SCR and AppArc for media change. |
40 self->ConstructL( aMainStatus ); |
143 UpdateComponentStatusL( aChangeType, aDrive ); |
41 return self; |
144 |
|
145 // Get Installer state. |
|
146 TBool installerRunning = iSisInstaller->IsInstalling(); |
|
147 |
|
148 // Cancel all requests for install |
|
149 iSisInstaller->Cancel(); |
|
150 |
|
151 // Notify plugin |
|
152 if(iSwiDaemonPlugin) |
|
153 { |
|
154 TInt index = iDriveArray.Find(aDrive); |
|
155 iSwiDaemonPlugin->MediaRemoved(index); |
|
156 } |
|
157 |
|
158 // Get index of removed drive from array |
|
159 TInt index = iDriveArray.Find(aDrive); |
|
160 |
|
161 if ( index > KErrNotFound ) |
|
162 { |
|
163 iDriveArray.Remove(index); |
|
164 iDriveArray.Compress(); |
|
165 } |
|
166 |
|
167 // Continue installing from other drives if needed. |
|
168 if ( installerRunning ) |
|
169 { |
|
170 // Get count of inserted drives. |
|
171 TInt count = iDriveArray.Count(); |
|
172 |
|
173 if ( count ) |
|
174 { |
|
175 for(index = 0; index < count; index++ ) |
|
176 { |
|
177 ProcessPreinstalledFilesL(iDriveArray[index]); |
|
178 iSisInstaller->StartInstallingL(); |
|
179 } |
|
180 } |
|
181 } |
42 } |
182 } |
43 |
183 |
44 void CDaemonBehaviour::ConstructL( CProgramStatus& aMainStatus ) |
184 CleanupStack::PopAndDestroy(®istrySession); |
45 { |
185 } |
46 User::LeaveIfError(iFs.Connect()); |
186 |
47 User::LeaveIfError(iFs.ShareProtected()); |
187 // ----------------------------------------------------------------------- |
|
188 // CDaemonBehaviour::ProcessPreinstalledFilesL |
|
189 // ----------------------------------------------------------------------- |
|
190 // |
|
191 void CDaemonBehaviour::ProcessPreinstalledFilesL(TInt aDrive) |
|
192 { |
|
193 // _LIT( KDaemonPrivatePath,":\\private\\10202dce\\" ); |
|
194 |
|
195 // NOTE this is only for testing since we can not use |
|
196 // Daemon's private folder. Sifserver do not have allfiles |
|
197 // capability currently. |
|
198 _LIT( KDaemonPrivatePath,":\\installs\\swidaemon\\" ); |
|
199 |
|
200 #ifndef RD_MULTIPLE_DRIVE |
|
201 iSisInstaller->Cancel(); |
|
202 #endif |
|
203 // For uninstaller |
|
204 // Set on installing mode. |
|
205 iGeneralProcessStatus = EStateInstalling; |
|
206 FLOG_1( _L("[CDaemonBehaviour] iGeneralProcessStatus = %d"), |
|
207 iGeneralProcessStatus ); |
|
208 |
|
209 ProcessPreinstalledFilesL(aDrive, KDaemonPrivatePath); |
|
210 iStartNotified = EFalse; |
|
211 iDrive = aDrive; |
|
212 iSisInstaller->StartInstallingL(); |
|
213 } |
|
214 |
|
215 // ----------------------------------------------------------------------- |
|
216 // CDaemonBehaviour::ProcessPreinstalledFilesL |
|
217 // ----------------------------------------------------------------------- |
|
218 // |
|
219 void CDaemonBehaviour::ProcessPreinstalledFilesL(TInt aDrive, const TDesC& aDirectory) |
|
220 { |
|
221 FLOG( _L("Daemon: ProcessPreInstalledFilesL") ); |
|
222 TPath preInstalledPath; |
|
223 TChar drive; |
|
224 RFs::DriveToChar(aDrive, drive); |
|
225 preInstalledPath.Append(drive); |
|
226 preInstalledPath.Append(aDirectory); |
|
227 |
|
228 FLOG_1( _L("Daemon: ProcessPreInstalledFilesL Getting dir %S"), &preInstalledPath ); |
|
229 CDir* dir = NULL; |
|
230 TInt err = iFs.GetDir(preInstalledPath, KEntryAttNormal, ESortNone, dir); |
|
231 if (err != KErrNone && err != KErrPathNotFound) |
|
232 { |
|
233 FLOG_1( _L("Daemon: ProcessPreInstalledFilesL GetDir with error %d"), err ); |
|
234 User::Leave(err); |
|
235 } |
|
236 if(dir) |
|
237 { |
|
238 // dir will only exist if GetDir succeeded |
|
239 CleanupStack::PushL(dir); |
|
240 for(TInt i = 0; i < dir->Count(); i++) |
|
241 { |
|
242 const TEntry &entry = (*dir)[i]; |
|
243 if(!entry.IsDir()) |
|
244 { |
|
245 TFileName fileName(preInstalledPath); |
|
246 fileName.Append(entry.iName); |
|
247 iSisInstaller->AddFileToInstallL(fileName); |
|
248 } |
|
249 } |
|
250 CleanupStack::PopAndDestroy(dir); |
|
251 } |
|
252 } |
|
253 |
|
254 // ----------------------------------------------------------------------- |
|
255 // CDaemonBehaviour::GetProcessStatus |
|
256 // ----------------------------------------------------------------------- |
|
257 // |
|
258 TInt& CDaemonBehaviour::GetProcessStatus() |
|
259 { |
|
260 return iGeneralProcessStatus; |
|
261 } |
|
262 |
|
263 // ----------------------------------------------------------------------- |
|
264 // CDaemonBehaviour::SetProcessStatus |
|
265 // ----------------------------------------------------------------------- |
|
266 // |
|
267 void CDaemonBehaviour::SetProcessStatus( TInt aStatus ) |
|
268 { |
|
269 iGeneralProcessStatus = aStatus; |
|
270 } |
|
271 |
|
272 // ----------------------------------------------------------------------- |
|
273 // CDaemonBehaviour::DoNotifyMediaProcessingComplete |
|
274 // ----------------------------------------------------------------------- |
|
275 // |
|
276 void CDaemonBehaviour::DoNotifyMediaProcessingComplete() |
|
277 { |
|
278 if ( iSwiDaemonPlugin && iStartNotified ) |
|
279 { |
|
280 iSwiDaemonPlugin->MediaProcessingComplete(); |
|
281 } |
|
282 } |
|
283 |
|
284 // ----------------------------------------------------------------------- |
|
285 // CDaemonBehaviour::IsPlugin |
|
286 // ----------------------------------------------------------------------- |
|
287 // |
|
288 // For plugin support |
|
289 TBool CDaemonBehaviour::IsPlugin() |
|
290 { |
|
291 if ( iSwiDaemonPlugin ) |
|
292 { |
|
293 return ETrue; |
|
294 } |
|
295 return EFalse; |
|
296 } |
|
297 |
|
298 // ----------------------------------------------------------------------- |
|
299 // CDaemonBehaviour::NotifyPlugin |
|
300 // ----------------------------------------------------------------------- |
|
301 // |
|
302 // For plugin support |
|
303 void CDaemonBehaviour::NotifyPlugin() |
|
304 { |
|
305 FLOG( _L("Daemon: NotifyPlugin")); |
|
306 if ( !iStartNotified ) |
|
307 { |
|
308 FLOG_1( _L("Daemon: MediaProcessingStart for drive = %d"), iDrive ); |
|
309 iSwiDaemonPlugin->MediaProcessingStart( iDrive ); |
|
310 iStartNotified = ETrue; |
|
311 } |
|
312 } |
|
313 |
|
314 // ----------------------------------------------------------------------- |
|
315 // CDaemonBehaviour::RequestPluginInstall |
|
316 // ----------------------------------------------------------------------- |
|
317 // |
|
318 void CDaemonBehaviour::RequestPluginInstall( TDesC& aSisFile ) |
|
319 { |
|
320 // Note We will open file in here but that is only because |
|
321 // plug-in interface has been designed this way. Original |
|
322 // Symbian SWI daemon did use RApaLsSession for installing |
|
323 // and thus RFile was open already. |
|
324 // Since current SWI Daemon does use SWI API it doesn't |
|
325 // open files and thus we need to open the file in here. |
|
326 FLOG( _L("Daemon: RequestPluginInstall ")); |
|
327 |
|
328 RFile file; |
|
329 User::LeaveIfError( file.Open( |
|
330 iFs, aSisFile, EFileRead | EFileShareReadersOnly ) ); |
|
331 CleanupClosePushL( file ); |
|
332 |
|
333 iSwiDaemonPlugin->RequestInstall( file ); |
|
334 |
|
335 // close file, original SWI Daemon do not leave file open. |
|
336 CleanupStack::PopAndDestroy( &file ); |
|
337 } |
|
338 |
|
339 // ----------------------------------------------------------------------- |
|
340 // CDaemonBehaviour::UpdateComponentStatusL |
|
341 // ----------------------------------------------------------------------- |
|
342 // |
|
343 void CDaemonBehaviour::UpdateComponentStatusL( |
|
344 TChangeType aChangeType, |
|
345 TInt aDrive ) |
|
346 { |
|
347 FLOG( _L("Daemon: UpdateComponentStatus") ); |
|
348 |
|
349 Usif::RSoftwareComponentRegistry scrServer; |
|
350 User::LeaveIfError( scrServer.Connect() ); |
|
351 CleanupClosePushL( scrServer ); |
|
352 |
|
353 // Filter all other component types except sisx. |
|
354 Usif::CComponentFilter* filter = Usif::CComponentFilter::NewLC(); |
|
355 filter->SetSoftwareTypeL( Usif::KSoftwareTypeNative ); |
48 |
356 |
49 // For uninstaller |
357 RArray<Usif::TComponentId> componentIdList; |
50 iSisInstaller = CSisInstaller::NewL( this, aMainStatus ); |
358 CleanupClosePushL( componentIdList ); |
51 // Create plugin |
359 |
52 TRAP_IGNORE( iSwiDaemonPlugin = CSwiDaemonPlugin::NewL() ); |
360 // Get list of all native (sisx) installed packages. |
53 } |
361 scrServer.GetComponentIdsL( componentIdList, filter ); |
54 |
362 FLOG_1( _L("Daemon: componentIdList count: %d"),componentIdList.Count() ); |
55 CDaemonBehaviour::~CDaemonBehaviour() |
363 |
56 { |
364 if ( componentIdList.Count() ) |
57 if ( iSwiDaemonPlugin ) |
365 { |
58 { |
366 // TODO Enabloi AppArcin päivitys. |
59 delete iSwiDaemonPlugin; |
367 // TODO Hae TAppInfon headeri includeen. |
60 REComSession::FinalClose(); |
368 // RArray<TAppInfo> appinfoArray; |
61 } |
369 // CleanupClosePushL( appinfoArray ); |
62 delete iSisInstaller; |
370 |
63 iSisInstaller = NULL; |
371 // Convert the given target drive number to drive letter. |
64 iFs.Close(); |
372 TChar targetDrive; |
|
373 iFs.DriveToChar( aDrive, targetDrive ); |
|
374 FLOG_1( _L("Daemon: targetDrive: 0x%x"), TUint( targetDrive ) ); |
|
375 |
|
376 FLOG( _L("Daemon: Check all SCR native components") ); |
|
377 // Check all components in SCR. If media is removed/inserted |
|
378 // change status flag in SCR and in AppArc. |
|
379 for ( TInt index=0; index < componentIdList.Count(); index++ ) |
|
380 { |
|
381 Usif::CComponentEntry* entry = Usif::CComponentEntry::NewL(); |
|
382 CleanupStack::PushL( entry ); |
|
383 |
|
384 Usif::TComponentId componentId( componentIdList[index] ); |
|
385 FLOG_1( _L("Daemon: componentId: %d"), componentId ); |
|
386 |
|
387 scrServer.GetComponentL( componentId, |
|
388 *entry, |
|
389 Usif::KUnspecifiedLocale ); |
|
390 |
|
391 // TODO poista ei tarvetta jos filter toimii. |
|
392 //if ( entry->SoftwareType() == Usif::KSoftwareTypeNative ) |
|
393 |
|
394 // Get all component drives. |
|
395 TDriveList driveList; |
|
396 driveList = entry->InstalledDrives(); |
|
397 |
|
398 TBool isInTargetDrive = EFalse; |
|
399 |
|
400 FLOG( _L("Daemon: Check all drives for this component") ); |
|
401 // Go through all drives which have files for |
|
402 // this component. |
|
403 for ( TInt i = 0; i < KMaxDrives; i++ ) |
|
404 { |
|
405 if ( driveList[i] != 0 ) |
|
406 { |
|
407 TChar installDrive = |
|
408 static_cast<TChar>( driveList[i] ); |
65 |
409 |
66 #ifdef RD_MULTIPLE_DRIVE |
410 FLOG_1( _L("Daemon: driveList index: %d"), i ); |
67 iDriveArray.Close(); |
411 FLOG_1( _L("Daemon: installDrive: 0x%x"), TUint( installDrive ) ); |
68 #endif |
412 |
69 } |
413 if ( targetDrive == installDrive ) |
70 |
414 { |
71 // from MDaemonBehaviour |
415 // Ok we have files in this target drive. |
72 TBool CDaemonBehaviour::StartupL() |
416 isInTargetDrive = ETrue; |
73 { |
417 FLOG( _L("Daemon: SW in target drive.") ); |
74 // Return state of Startup |
|
75 return ETrue; |
|
76 } |
|
77 |
|
78 void CDaemonBehaviour::MediaChangeL(TInt aDrive, TChangeType aChangeType) |
|
79 { |
|
80 FLOG_1( _L("Daemon: Media change %d"), aDrive ); |
|
81 RSisRegistryWritableSession registrySession; |
|
82 |
|
83 User::LeaveIfError(registrySession.Connect()); |
|
84 CleanupClosePushL(registrySession); |
|
85 |
|
86 if (aChangeType==EMediaInserted) |
|
87 { |
|
88 FLOG( _L("Daemon: Media inserted") ); |
|
89 FLOG( _L("Daemon: Media change: Update sis registry") ); |
|
90 // notify IAR |
|
91 // Error ou1cimx1#212652 |
|
92 // Note SWI Daemon needs to notify sis registry from |
|
93 // media change. Otherwice registry is not updated |
|
94 // and e.g. IsPresentL function will give false results. |
|
95 // Note also that this function should be called before |
|
96 // ProcessPreinstalledFilesL in SWI Daemon. |
|
97 registrySession.AddDriveL(aDrive); |
|
98 |
|
99 // Scan directory on the card and run pre-installed through SWIS |
|
100 FLOG( _L("Daemon: Media change: Process preinstalled files") ); |
|
101 ProcessPreinstalledFilesL(aDrive); |
|
102 |
|
103 #ifdef RD_MULTIPLE_DRIVE |
|
104 // Add inserted media drive to drive array. |
|
105 if ( iDriveArray.Find(aDrive) == KErrNotFound ) |
|
106 { |
|
107 iDriveArray.AppendL(aDrive); |
|
108 } |
|
109 #endif |
|
110 } |
|
111 else if (aChangeType==EMediaRemoved) |
|
112 { |
|
113 FLOG( _L("Daemon: Media removed") ); |
|
114 |
|
115 #ifdef RD_MULTIPLE_DRIVE |
|
116 // Get Installer state. |
|
117 TBool installerRunning = iSisInstaller->IsInstalling(); |
|
118 #endif |
|
119 |
|
120 #ifndef SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
121 // notify IAR |
|
122 // Note SWI Daemon need to notify sis registry from |
|
123 // media change. |
|
124 registrySession.RemoveDriveL(aDrive); |
|
125 #endif //SYMBIAN_UNIVERSAL_INSTALL_FRAMEWORK |
|
126 |
|
127 // Cancel all requests for install |
|
128 iSisInstaller->Cancel(); |
|
129 |
|
130 #ifdef RD_MULTIPLE_DRIVE |
|
131 // Notify plugin |
|
132 if(iSwiDaemonPlugin) |
|
133 { |
|
134 TInt index = iDriveArray.Find(aDrive); |
|
135 iSwiDaemonPlugin->MediaRemoved(index); |
|
136 } |
|
137 #else |
|
138 // Notify plugin |
|
139 if(iSwiDaemonPlugin) |
|
140 { |
|
141 iSwiDaemonPlugin->MediaRemoved(aDrive); |
|
142 } |
|
143 #endif //RD_MULTIPLE_DRIVE |
|
144 |
|
145 #ifdef RD_MULTIPLE_DRIVE |
|
146 // Get index of removed drive from array |
|
147 TInt index = iDriveArray.Find(aDrive); |
|
148 |
|
149 if ( index > KErrNotFound ) |
|
150 { |
|
151 iDriveArray.Remove(index); |
|
152 iDriveArray.Compress(); |
|
153 } |
|
154 |
|
155 // Continue installing from other drives if needed. |
|
156 if ( installerRunning ) |
|
157 { |
|
158 // Get count of inserted drives. |
|
159 TInt count = iDriveArray.Count(); |
|
160 |
|
161 if ( count ) |
|
162 { |
|
163 for(index = 0; index < count; index++ ) |
|
164 { |
|
165 ProcessPreinstalledFilesL(iDriveArray[index]); |
|
166 iSisInstaller->StartInstallingL(); |
|
167 } |
418 } |
168 } |
|
169 } |
|
170 #endif |
|
171 } |
|
172 |
|
173 CleanupStack::PopAndDestroy(®istrySession); |
|
174 } |
|
175 |
|
176 void CDaemonBehaviour::ProcessPreinstalledFilesL(TInt aDrive) |
|
177 { |
|
178 _LIT(KDaemonPrivatePath,":\\private\\10202dce\\"); |
|
179 |
|
180 #ifndef RD_MULTIPLE_DRIVE |
|
181 iSisInstaller->Cancel(); |
|
182 #endif |
|
183 // For uninstaller |
|
184 // Set on installing mode. |
|
185 iGeneralProcessStatus = EStateInstalling; |
|
186 FLOG_1( _L("[CDaemonBehaviour] iGeneralProcessStatus = %d"), |
|
187 iGeneralProcessStatus ); |
|
188 |
|
189 ProcessPreinstalledFilesL(aDrive, KDaemonPrivatePath); |
|
190 iStartNotified = EFalse; |
|
191 iDrive = aDrive; |
|
192 iSisInstaller->StartInstallingL(); |
|
193 } |
|
194 |
|
195 void CDaemonBehaviour::ProcessPreinstalledFilesL(TInt aDrive, const TDesC& aDirectory) |
|
196 { |
|
197 FLOG( _L("Daemon: ProcessPreInstalledFilesL") ); |
|
198 TPath preInstalledPath; |
|
199 TChar drive; |
|
200 RFs::DriveToChar(aDrive, drive); |
|
201 preInstalledPath.Append(drive); |
|
202 preInstalledPath.Append(aDirectory); |
|
203 |
|
204 FLOG_1( _L("Daemon: ProcessPreInstalledFilesL Getting dir %S"), &preInstalledPath ); |
|
205 CDir* dir = NULL; |
|
206 TInt err = iFs.GetDir(preInstalledPath, KEntryAttNormal, ESortNone, dir); |
|
207 if (err != KErrNone && err != KErrPathNotFound) |
|
208 { |
|
209 FLOG_1( _L("Daemon: ProcessPreInstalledFilesL GetDir with error %d"), err ); |
|
210 User::Leave(err); |
|
211 } |
|
212 if(dir) |
|
213 { |
|
214 // dir will only exist if GetDir succeeded |
|
215 CleanupStack::PushL(dir); |
|
216 for(TInt i = 0; i < dir->Count(); i++) |
|
217 { |
|
218 const TEntry &entry = (*dir)[i]; |
|
219 if(!entry.IsDir()) |
|
220 { |
|
221 TFileName fileName(preInstalledPath); |
|
222 fileName.Append(entry.iName); |
|
223 iSisInstaller->AddFileToInstallL(fileName); |
|
224 } |
419 } |
225 } |
420 } |
226 CleanupStack::PopAndDestroy(dir); |
421 |
227 } |
422 // Check if component or part of it is in the media. |
228 } |
423 if ( isInTargetDrive ) |
229 |
424 { |
230 // For uninstaller |
425 FLOG( _L("Daemon: Set component status to SCR") ); |
231 TInt& CDaemonBehaviour::GetProcessStatus() |
426 // TAppInfo appInfo; |
232 { |
427 // appInfo.iAppUid = componentId; |
233 return iGeneralProcessStatus; |
428 |
234 } |
429 if ( aChangeType == EMediaInserted ) |
235 |
430 { |
236 // For uninstaller |
431 // Update component flag to SCR. |
237 void CDaemonBehaviour::SetProcessStatus( TInt aStatus ) |
432 scrServer.SetIsComponentPresentL( componentId, |
238 { |
433 ETrue ); |
239 iGeneralProcessStatus = aStatus; |
434 FLOG( _L("Daemon: Set component present = TRUE") ); |
240 } |
435 // Set app status for AppArc. AppArc sees this |
241 |
436 // as new component. |
242 // For plugin support |
437 // appInfo.iAppUid = TAppInfo::ENewApp; |
243 void CDaemonBehaviour::DoNotifyMediaProcessingComplete() |
438 } |
244 { |
439 else if ( aChangeType==EMediaRemoved ) |
245 if ( iSwiDaemonPlugin && iStartNotified ) |
440 { |
246 { |
441 // Update component flag to SCR. |
247 iSwiDaemonPlugin->MediaProcessingComplete(); |
442 scrServer.SetIsComponentPresentL( componentId, |
248 } |
443 EFalse ); |
249 } |
444 FLOG( _L("Daemon: Set component present = FALSE") ); |
250 |
445 // Set app status for AppArc. AppArc sees this |
251 // For plugin support |
446 // component as removed. |
252 TBool CDaemonBehaviour::IsPlugin() |
447 // appInfo.iAppUid = TAppInfo::ERemoveApp; |
253 { |
448 } |
254 if ( iSwiDaemonPlugin ) |
|
255 { |
|
256 return ETrue; |
|
257 } |
|
258 return EFalse; |
|
259 } |
|
260 |
|
261 // For plugin support |
|
262 void CDaemonBehaviour::NotifyPlugin() |
|
263 { |
|
264 FLOG( _L("Daemon: NotifyPlugin")); |
|
265 if ( !iStartNotified ) |
|
266 { |
|
267 FLOG_1( _L("Daemon: MediaProcessingStart for drive = %d"), iDrive ); |
|
268 iSwiDaemonPlugin->MediaProcessingStart( iDrive ); |
|
269 iStartNotified = ETrue; |
|
270 } |
|
271 } |
|
272 |
|
273 // For plugin support |
|
274 void CDaemonBehaviour::RequestPluginInstall( TDesC& aSisFile ) |
|
275 { |
|
276 // Note We will open file in here but that is only because |
|
277 // plug-in interface has been designed this way. Original |
|
278 // Symbian SWI daemon did use RApaLsSession for installing |
|
279 // and thus RFile was open already. |
|
280 // Since current SWI Daemon does use SWI API it doesn't |
|
281 // open files and thus we need to open the file in here. |
|
282 FLOG( _L("Daemon: RequestPluginInstall ")); |
|
283 |
449 |
284 RFile file; |
450 // Add component info to array. |
285 User::LeaveIfError( file.Open( |
451 // appinfoArray.Append( appInfo ); |
286 iFs, aSisFile, EFileRead | EFileShareReadersOnly ) ); |
452 } |
287 CleanupClosePushL( file ); |
453 |
|
454 CleanupStack::PopAndDestroy( entry ); |
|
455 entry = NULL; |
|
456 } // for |
|
457 //TODO enable AppArc support when TAppInfo is available. |
|
458 /* |
|
459 FLOG( _L("Daemon: Set component status to AppArc") ); |
|
460 // Update AppArc list after we have all components in array. |
|
461 RApaLsSession appArcSession; |
|
462 TInt err = appArcSession.Connect(); |
|
463 if ( !err ) |
|
464 { |
|
465 CleanupClosePushL(appArcSession); |
|
466 appArcSession.UpdateAppListL( appinfoArray ); |
|
467 CleanupStack::PopAndDestroy(); |
|
468 } |
288 |
469 |
289 iSwiDaemonPlugin->RequestInstall( file ); |
470 CleanupStack::PopAndDestroy( &appinfoArray ); |
290 |
471 */ |
291 // close file, original SWI Daemon do not leave file open. |
472 } // if componentList.Count() |
292 CleanupStack::PopAndDestroy( &file ); |
473 |
293 } |
474 CleanupStack::PopAndDestroy( &componentIdList ); //componentIDList.Close(); |
294 |
475 CleanupStack::PopAndDestroy( filter ); |
295 } // namespace Swi |
476 CleanupStack::PopAndDestroy( &scrServer ); |
|
477 FLOG( _L("Daemon: UpdateComponentStatus END") ); |
|
478 } |
|
479 |
296 //EOF |
480 //EOF |