|
1 /* |
|
2 * Copyright (c) 2007-2007 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: For CSC needed AIW handling for service plug-ins |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <eikenv.h> |
|
20 #include <bautils.h> |
|
21 #include <pathinfo.h> |
|
22 #include <ecom/ecom.h> |
|
23 #include <SWInstApi.h> |
|
24 #include <SWInstDefs.h> |
|
25 #include <AiwCommon.hrh> |
|
26 #include <cscengine.rsg> |
|
27 #include <AiwServiceHandler.h> |
|
28 #include <mspnotifychangeobserver.h> |
|
29 #include <data_caging_path_literals.hrh> |
|
30 |
|
31 #include "cscenglogger.h" |
|
32 #include "cscengecommonitor.h" |
|
33 #include "cscengservicehandler.h" |
|
34 #include "cscengservicepluginhandler.h" |
|
35 #include "mcscengprovisioningobserver.h" |
|
36 |
|
37 // Resource file location. |
|
38 _LIT( KCSCEngineResourceFile, "cscengine.rsc" ); // file |
|
39 |
|
40 const TInt KMandatoryParamCount = 3; |
|
41 |
|
42 |
|
43 // ======== MEMBER FUNCTIONS ======== |
|
44 |
|
45 |
|
46 // --------------------------------------------------------------------------- |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 CCSCEngServicePluginHandler::CCSCEngServicePluginHandler( |
|
50 CEikonEnv& aEikEnv, |
|
51 MCSCEngProvisioningObserver& aObserver, |
|
52 CCSCEngServiceHandler& aServiceHandler ) : |
|
53 iEikEnv( aEikEnv ), |
|
54 iObserver( aObserver ), |
|
55 iServiceHandler( aServiceHandler ) |
|
56 { |
|
57 } |
|
58 |
|
59 |
|
60 // --------------------------------------------------------------------------- |
|
61 // --------------------------------------------------------------------------- |
|
62 // |
|
63 void CCSCEngServicePluginHandler::ConstructL() |
|
64 { |
|
65 CSCENGDEBUG( "CCSCEngServicePluginHandler::ConstructL - begin" ); |
|
66 |
|
67 // Attach to AIW Framework. |
|
68 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
69 |
|
70 // Load resource file to the memory. |
|
71 TFileName resourceFile = TParsePtrC( PathInfo::RomRootPath() ).Drive(); |
|
72 resourceFile.Append( KDC_RESOURCE_FILES_DIR ); |
|
73 resourceFile.Append( KCSCEngineResourceFile ); |
|
74 BaflUtils::NearestLanguageFile( iEikEnv.FsSession(), resourceFile ); |
|
75 iResourceOffset = iEikEnv.AddResourceFileL( resourceFile ); |
|
76 |
|
77 CSCENGDEBUG( "CCSCEngServicePluginHandler::ConstructL - end" ); |
|
78 } |
|
79 |
|
80 |
|
81 // --------------------------------------------------------------------------- |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 EXPORT_C CCSCEngServicePluginHandler* CCSCEngServicePluginHandler::NewL( |
|
85 CEikonEnv& aEikEnv, |
|
86 MCSCEngProvisioningObserver& aObserver, |
|
87 CCSCEngServiceHandler& aServiceHandler ) |
|
88 { |
|
89 CCSCEngServicePluginHandler* self = |
|
90 CCSCEngServicePluginHandler::NewLC( |
|
91 aEikEnv, aObserver, aServiceHandler ); |
|
92 CleanupStack::Pop( self ); |
|
93 return self; |
|
94 } |
|
95 |
|
96 |
|
97 // --------------------------------------------------------------------------- |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 EXPORT_C CCSCEngServicePluginHandler* CCSCEngServicePluginHandler::NewLC( |
|
101 CEikonEnv& aEikEnv, |
|
102 MCSCEngProvisioningObserver& aObserver, |
|
103 CCSCEngServiceHandler& aServiceHandler ) |
|
104 { |
|
105 CCSCEngServicePluginHandler* self = |
|
106 new ( ELeave ) CCSCEngServicePluginHandler( |
|
107 aEikEnv, aObserver, aServiceHandler ); |
|
108 CleanupStack::PushL( self ); |
|
109 self->ConstructL(); |
|
110 return self; |
|
111 } |
|
112 |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 CCSCEngServicePluginHandler::~CCSCEngServicePluginHandler() |
|
118 { |
|
119 CSCENGDEBUG( |
|
120 "CCSCEngServicePluginHandler::~CCSCEngServicePluginHandler - begin" ); |
|
121 |
|
122 iEikEnv.DeleteResourceFile( iResourceOffset ); |
|
123 iServicePluginInfoArray.Reset(); |
|
124 iServicePluginInfoArray.Close(); |
|
125 delete iEcomMonitor; |
|
126 delete iAiwServiceHandler; |
|
127 |
|
128 CSCENGDEBUG( |
|
129 "CCSCEngServicePluginHandler::~CCSCEngServicePluginHandler - end" ); |
|
130 } |
|
131 |
|
132 |
|
133 // --------------------------------------------------------------------------- |
|
134 // Initializes CSC supported plugins. |
|
135 // --------------------------------------------------------------------------- |
|
136 // |
|
137 EXPORT_C void CCSCEngServicePluginHandler::InitializePluginsL() |
|
138 { |
|
139 CSCENGDEBUG( "CCSCEngServicePluginHandler::InitializePluginsL - begin" ); |
|
140 |
|
141 // Reset service plugin info array. |
|
142 iServicePluginInfoArray.Reset(); |
|
143 |
|
144 // Attach to CSC supported plugins and execute initalization. |
|
145 iAiwServiceHandler->AttachL( R_CSCENG_INTEREST_SERVICE_PLUGIN ); |
|
146 iAiwServiceHandler->ExecuteServiceCmdL( |
|
147 KAiwCmdCSCServicePlugins, |
|
148 iAiwServiceHandler->InParamListL(), |
|
149 iAiwServiceHandler->OutParamListL(), |
|
150 EPluginInitialize, |
|
151 this ); |
|
152 |
|
153 // Start monitoring service setup plugins. |
|
154 if ( !iEcomMonitor ) |
|
155 { |
|
156 iEcomMonitor = CCSCEngEcomMonitor::NewL( *this ); |
|
157 } |
|
158 |
|
159 CSCENGDEBUG( "CCSCEngServicePluginHandler::InitializePluginsL - end" ); |
|
160 } |
|
161 |
|
162 // --------------------------------------------------------------------------- |
|
163 // Informs plugin of provisioning |
|
164 // --------------------------------------------------------------------------- |
|
165 // |
|
166 EXPORT_C void CCSCEngServicePluginHandler::DoProvisioningL( |
|
167 const TUid& aPluginUid, const TUid& aViewUid ) |
|
168 { |
|
169 CSCENGDEBUG( "CCSCEngServicePluginHandler::DoProvisioningL - begin" ); |
|
170 |
|
171 // Set plugins Uid to generic param data. |
|
172 CAiwGenericParamList& paramList = iAiwServiceHandler->OutParamListL(); |
|
173 TAiwVariant variant( aPluginUid ); |
|
174 TAiwGenericParam genericParamUid( EGenericParamError, variant ); |
|
175 paramList.AppendL( genericParamUid ); |
|
176 |
|
177 // Set view id to be returned to generic param data. |
|
178 variant.Reset(); |
|
179 variant.Set( aViewUid ); |
|
180 TAiwGenericParam genericParamViewId( EGenericParamError, variant ); |
|
181 paramList.AppendL( genericParamViewId ); |
|
182 |
|
183 // Set bogus iap id to maintain backwards compatibility with older service |
|
184 // plugins |
|
185 TUint32 bogusIap( KErrNone ); |
|
186 |
|
187 variant.Reset(); |
|
188 variant.Set( bogusIap ); |
|
189 TAiwGenericParam genericParamIap( EGenericParamError, variant ); |
|
190 paramList.AppendL( genericParamIap ); |
|
191 |
|
192 // Execute service handler command. |
|
193 iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCServicePlugins, |
|
194 iAiwServiceHandler->InParamListL(), |
|
195 paramList, |
|
196 EPluginProvisioning, |
|
197 this ); |
|
198 |
|
199 CSCENGDEBUG( "CCSCEngServicePluginHandler::DoProvisioningL - end" ); |
|
200 } |
|
201 |
|
202 |
|
203 // --------------------------------------------------------------------------- |
|
204 // Launches plugin provided setting view. |
|
205 // --------------------------------------------------------------------------- |
|
206 // |
|
207 EXPORT_C void CCSCEngServicePluginHandler::LaunchPluginViewL( |
|
208 const TUid& aPluginUid, const TUid& aViewUid ) |
|
209 { |
|
210 CSCENGDEBUG( "CCSCEngServicePluginHandler::LaunchPluginViewL - begin" ); |
|
211 |
|
212 // Set plugins Uid to generic param data. |
|
213 CAiwGenericParamList& paramList = iAiwServiceHandler->OutParamListL(); |
|
214 TAiwVariant variant( aPluginUid ); |
|
215 TAiwGenericParam genericParamUid( EGenericParamError, variant ); |
|
216 paramList.AppendL( genericParamUid ); |
|
217 |
|
218 // Set view id to be returned to generic param data. |
|
219 variant.Reset(); |
|
220 variant.Set( aViewUid ); |
|
221 TAiwGenericParam genericParamViewId( EGenericParamError, variant ); |
|
222 paramList.AppendL( genericParamViewId ); |
|
223 |
|
224 // Execute service handler command. |
|
225 iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCServicePlugins, |
|
226 iAiwServiceHandler->InParamListL(), |
|
227 paramList, |
|
228 EPluginModifySettings, |
|
229 this ); |
|
230 |
|
231 CSCENGDEBUG( "CCSCEngServicePluginHandler::LaunchPluginViewL - end" ); |
|
232 } |
|
233 |
|
234 |
|
235 // --------------------------------------------------------------------------- |
|
236 // Informs plugin from removation. |
|
237 // --------------------------------------------------------------------------- |
|
238 // |
|
239 EXPORT_C void CCSCEngServicePluginHandler::DoRemovationL( |
|
240 const TUid& aPluginUid, TBool aDeleteSisPckg ) |
|
241 { |
|
242 CSCENGDEBUG( "CCSCEngServicePluginHandler::DoRemovationL - begin" ); |
|
243 |
|
244 // Set flag for application installer launching. |
|
245 iRunSwinst = aDeleteSisPckg; |
|
246 |
|
247 // Set plugins Uid to generic param data. |
|
248 CAiwGenericParamList& paramList = iAiwServiceHandler->OutParamListL(); |
|
249 TAiwVariant variant( aPluginUid ); |
|
250 TAiwGenericParam genericParamUid( EGenericParamError, variant ); |
|
251 paramList.AppendL( genericParamUid ); |
|
252 |
|
253 // Execute service handler command. |
|
254 iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdCSCServicePlugins, |
|
255 iAiwServiceHandler->InParamListL(), |
|
256 paramList, |
|
257 EPluginRemovation, |
|
258 this ); |
|
259 |
|
260 CSCENGDEBUG( "CCSCEngServicePluginHandler::DoRemovationL - end" ); |
|
261 } |
|
262 |
|
263 |
|
264 // --------------------------------------------------------------------------- |
|
265 // Returns plugin counts from PluginsInfoArray. |
|
266 // --------------------------------------------------------------------------- |
|
267 // |
|
268 EXPORT_C TInt CCSCEngServicePluginHandler::PluginCount( |
|
269 const TPluginCount aType ) const |
|
270 { |
|
271 TInt count( 0 ); |
|
272 |
|
273 for ( TInt i = 0; i < iServicePluginInfoArray.Count(); i++ ) |
|
274 { |
|
275 switch ( aType ) |
|
276 { |
|
277 // CSC supported and initialized plugin count. |
|
278 case EInitialized: |
|
279 count++; |
|
280 break; |
|
281 // CSC supported and unprovisioned plugin count. |
|
282 case EUnprovisioned: |
|
283 if ( !iServicePluginInfoArray[ i ].iProvisioned ) |
|
284 { |
|
285 count++; |
|
286 } |
|
287 break; |
|
288 default: |
|
289 break; |
|
290 } |
|
291 } |
|
292 |
|
293 CSCENGDEBUG2( "CCSCEngServicePluginHandler::PluginCount: %d", count ); |
|
294 |
|
295 return count; |
|
296 } |
|
297 |
|
298 |
|
299 // --------------------------------------------------------------------------- |
|
300 // Return item from serviceplugininfoarray. |
|
301 // --------------------------------------------------------------------------- |
|
302 // |
|
303 EXPORT_C TServicePluginInfo |
|
304 CCSCEngServicePluginHandler::ItemFromPluginInfoArray( TInt aIndex ) |
|
305 { |
|
306 return iServicePluginInfoArray[ aIndex ]; |
|
307 } |
|
308 |
|
309 |
|
310 // --------------------------------------------------------------------------- |
|
311 // From class MAiwNotifyCallBack |
|
312 // Handles received callbacks from AIW plugin. |
|
313 // --------------------------------------------------------------------------- |
|
314 // |
|
315 TInt CCSCEngServicePluginHandler::HandleNotifyL( |
|
316 TInt /*aCmdId*/, |
|
317 TInt aEventId, |
|
318 CAiwGenericParamList& /*aEventParamList*/, |
|
319 const CAiwGenericParamList& aInParamList ) |
|
320 { |
|
321 CSCENGDEBUG( "CCSCEngServicePluginHandler::HandleNotifyL - begin"); |
|
322 |
|
323 TInt err( KErrNone ); |
|
324 |
|
325 switch ( aEventId ) |
|
326 { |
|
327 // =================================================================== |
|
328 // Every supported CSC plugin sends callback event when it has |
|
329 // been initialized. Generic parameter include 3 different values. |
|
330 // Initialization parameters are described in CSC Service Plugin |
|
331 // interface description document: |
|
332 // "Example Operator" <- Name shown to user |
|
333 // "00" <- First value 0 or 1 provides information |
|
334 // whether Plugin has modifiable UI or not. This |
|
335 // information is needed when provisioning |
|
336 // control is given to Plugin. |
|
337 // <- Second value presents information whether |
|
338 // Plugin requires Active IAP in order to |
|
339 // process provisioning. |
|
340 // =================================================================== |
|
341 case KAiwEventStarted: |
|
342 { |
|
343 CSCENGDEBUG( |
|
344 "CCSCEngServicePluginHandler::HandleNotifyL - KAiwEventStarted" ); |
|
345 |
|
346 // Parse initialization data and append data to the infoarray. |
|
347 SetPluginInitInfoL( aInParamList ); |
|
348 |
|
349 TInt index( 0 ); |
|
350 TUid pluginUid( KNullUid ); |
|
351 |
|
352 GetPluginIndexAndUid( aInParamList, index, pluginUid ); |
|
353 |
|
354 iObserver.NotifyServicePluginResponse( |
|
355 EPluginInitialized, index, pluginUid ); |
|
356 break; |
|
357 } |
|
358 |
|
359 // =================================================================== |
|
360 // Target plugins sends callback note when provisioning is finished. |
|
361 // Generic parameter include 1 value. |
|
362 // Initialization parameters are described in CSC Service Plugin |
|
363 // interface description document: |
|
364 // "TUid" <- Plugins uid value [TUid] |
|
365 // =================================================================== |
|
366 case KAiwEventCompleted: |
|
367 { |
|
368 TInt index( 0 ); |
|
369 TUid pluginUid( KNullUid ); |
|
370 |
|
371 GetPluginIndexAndUid( aInParamList, index, pluginUid ); |
|
372 |
|
373 if ( index < iServicePluginInfoArray.Count() ) |
|
374 { |
|
375 iServicePluginInfoArray[ index ].iProvisioned = ETrue; |
|
376 |
|
377 iObserver.NotifyServicePluginResponse( |
|
378 EPluginProvisioned, index, pluginUid ); |
|
379 } |
|
380 |
|
381 CSCENGDEBUG( |
|
382 "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventCompleted" ); |
|
383 break; |
|
384 } |
|
385 |
|
386 // =================================================================== |
|
387 // Target plugins sends callback note when plugins modified ui is |
|
388 // ready. Generic parameter include 1 value. |
|
389 // Initialization parameters are described in CSC Service Plugin |
|
390 // interface description document: |
|
391 // "TUid" <- Plugins uid value [TUid] |
|
392 // =================================================================== |
|
393 case KAiwEventStopped: |
|
394 { |
|
395 TInt index( 0 ); |
|
396 TUid pluginUid( KNullUid ); |
|
397 |
|
398 GetPluginIndexAndUid( aInParamList, index, pluginUid ); |
|
399 |
|
400 iObserver.NotifyServicePluginResponse( |
|
401 EPluginModified, index, pluginUid ); |
|
402 |
|
403 CSCENGDEBUG( |
|
404 "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventStopped" ); |
|
405 break; |
|
406 } |
|
407 |
|
408 // =================================================================== |
|
409 // Target plugins sends callback note when plugins setting removation |
|
410 // process is ready. Generic parameter include 1 value. |
|
411 // Initialization parameters are described in CSC Service Plugin |
|
412 // interface description document: |
|
413 // "TUid" <- Plugins uid value [TUid] |
|
414 // =================================================================== |
|
415 case KAiwEventQueryExit: |
|
416 { |
|
417 TInt index( 0 ); |
|
418 TUid pluginUid( KNullUid ); |
|
419 |
|
420 GetPluginIndexAndUid( aInParamList, index, pluginUid ); |
|
421 GetPluginViewId( aInParamList ); |
|
422 |
|
423 if ( iRunSwinst ) |
|
424 { |
|
425 // Try to remove .sis file from the device. |
|
426 TRAP_IGNORE( RemovePluginSisL( pluginUid ) ); |
|
427 } |
|
428 |
|
429 iObserver.NotifyServicePluginResponse( |
|
430 EPluginRemoved, index, pluginUid ); |
|
431 |
|
432 CSCENGDEBUG( |
|
433 "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventQueryExit" ); |
|
434 break; |
|
435 } |
|
436 |
|
437 // =================================================================== |
|
438 // Target plugins sends callback note if plugins provisioning failed. |
|
439 // Generic parameter include 1 value. |
|
440 // Initialization parameters are described in CSC Service Plugin |
|
441 // interface description document: |
|
442 // "TUid" <- Plugins uid value [TUid] |
|
443 // =================================================================== |
|
444 case KAiwEventError: |
|
445 { |
|
446 TInt index( 0 ); |
|
447 TUid pluginUid( KNullUid ); |
|
448 |
|
449 GetPluginIndexAndUid( aInParamList, index, pluginUid ); |
|
450 |
|
451 iObserver.NotifyServicePluginResponse( |
|
452 EPluginError, index, pluginUid ); |
|
453 |
|
454 CSCENGDEBUG( |
|
455 "CCSCEngServicePluginHandler::HandleNotifyL KAiwEventError" ); |
|
456 break; |
|
457 } |
|
458 default: |
|
459 CSCENGDEBUG( |
|
460 "CCSCEngServicePluginHandler::HandleNotifyL: !!DEFAULT!!" ); |
|
461 break; |
|
462 } |
|
463 |
|
464 CSCENGDEBUG( "CCSCEngServicePluginHandler::HandleNotifyL - end" ); |
|
465 |
|
466 return err; |
|
467 } |
|
468 |
|
469 |
|
470 // --------------------------------------------------------------------------- |
|
471 // From class MCSCEngEcomObserver |
|
472 // Observer interface for notifying ecom events. |
|
473 // --------------------------------------------------------------------------- |
|
474 // |
|
475 void CCSCEngServicePluginHandler::NotifyEcomEvent() |
|
476 { |
|
477 // Re-initialize service setup plugins. |
|
478 TRAP_IGNORE( InitializePluginsL() ); |
|
479 } |
|
480 |
|
481 |
|
482 // --------------------------------------------------------------------------- |
|
483 // For Getting plug-ins index in plug-in info array and plug-ins uid. |
|
484 // --------------------------------------------------------------------------- |
|
485 // |
|
486 void CCSCEngServicePluginHandler::GetPluginIndexAndUid( |
|
487 const CAiwGenericParamList& aInParamList, |
|
488 TInt& aIndex, |
|
489 TUid& aPluginUid ) |
|
490 { |
|
491 const TAiwGenericParam* genericParam = NULL; |
|
492 |
|
493 genericParam = aInParamList.FindFirst( aIndex, |
|
494 EGenericParamError, |
|
495 EVariantTypeTUid ); |
|
496 |
|
497 aPluginUid = genericParam->Value().AsTUid(); |
|
498 |
|
499 for ( TInt i = 0; i < iServicePluginInfoArray.Count(); i++ ) |
|
500 { |
|
501 if ( aPluginUid == iServicePluginInfoArray[ i ].iPluginsUid ) |
|
502 { |
|
503 aIndex = i; |
|
504 break; |
|
505 } |
|
506 } |
|
507 } |
|
508 |
|
509 // --------------------------------------------------------------------------- |
|
510 // For Getting and setting plug-ins view id. |
|
511 // --------------------------------------------------------------------------- |
|
512 // |
|
513 void CCSCEngServicePluginHandler::GetPluginViewId( |
|
514 const CAiwGenericParamList& aInParamList ) |
|
515 { |
|
516 const TAiwGenericParam* genericParam = NULL; |
|
517 TUid pluginUid( KNullUid ); |
|
518 TUid viewId( KNullUid ); |
|
519 TInt index( 0 ); |
|
520 |
|
521 // First is plug-in uid, not needed now |
|
522 genericParam = aInParamList.FindFirst( index, |
|
523 EGenericParamError, |
|
524 EVariantTypeTUid ); |
|
525 |
|
526 pluginUid = genericParam->Value().AsTUid(); |
|
527 |
|
528 // Find next which is view id |
|
529 genericParam = aInParamList.FindNext( index, |
|
530 EGenericParamError, |
|
531 EVariantTypeTUid ); |
|
532 |
|
533 viewId = genericParam->Value().AsTUid(); |
|
534 |
|
535 for ( TInt i = 0; i < iServicePluginInfoArray.Count(); i++ ) |
|
536 { |
|
537 if ( pluginUid == iServicePluginInfoArray[ i ].iPluginsUid ) |
|
538 { |
|
539 iServicePluginInfoArray[ i ].iViewId = viewId; |
|
540 break; |
|
541 } |
|
542 } |
|
543 } |
|
544 |
|
545 // --------------------------------------------------------------------------- |
|
546 // For parsing and settings plug-in initialization info |
|
547 // --------------------------------------------------------------------------- |
|
548 // |
|
549 void CCSCEngServicePluginHandler::SetPluginInitInfoL( |
|
550 const CAiwGenericParamList& aInParamList ) |
|
551 { |
|
552 CSCENGDEBUG( "CCSCEngServicePluginHandler::SetPluginInitInfoL - begin" ); |
|
553 |
|
554 if ( KMandatoryParamCount <= aInParamList.Count() ) |
|
555 { |
|
556 TServicePluginInfo pluginInfo; |
|
557 TInt index = 0; |
|
558 |
|
559 const TAiwGenericParam* genericParam = NULL; |
|
560 |
|
561 // First generic value is plugin Uid. |
|
562 genericParam = aInParamList.FindFirst( index, |
|
563 EGenericParamError, |
|
564 EVariantTypeTUid ); |
|
565 |
|
566 pluginInfo.iPluginsUid = genericParam->Value().AsTUid(); |
|
567 |
|
568 // Second generic value is plugin name. |
|
569 genericParam = aInParamList.FindNext( index, |
|
570 EGenericParamError, |
|
571 EVariantTypeDesC ); |
|
572 |
|
573 pluginInfo.iProviderName.Copy( genericParam->Value().AsDes() ); |
|
574 |
|
575 CSCENGDEBUG2( |
|
576 "CCSCEngServicePluginHandler::SetPluginInitInfoL: PROVIDER NAME: %S", |
|
577 &pluginInfo.iProviderName ); |
|
578 |
|
579 // Third generic value is modified Ui and needed Iap. |
|
580 genericParam = aInParamList.FindNext( index, |
|
581 EGenericParamError, |
|
582 EVariantTypeDesC8 ); |
|
583 |
|
584 TPtrC8 data = genericParam->Value().AsData(); |
|
585 |
|
586 TInt hasUi = 0; |
|
587 TLex8 lexerUi( data.Left( 1 ) ); |
|
588 lexerUi.Val( hasUi ); |
|
589 |
|
590 pluginInfo.iModifiedUi = hasUi; |
|
591 |
|
592 CSCENGDEBUG2( |
|
593 "CCSCEngServicePluginHandler::SetPluginInitInfoL Ui: %d", hasUi ); |
|
594 |
|
595 TInt reqIap = 0; |
|
596 TLex8 lexerIap( data.Right( 1 ) ); |
|
597 lexerIap.Val( reqIap ); |
|
598 |
|
599 pluginInfo.iRequiredIap = reqIap; |
|
600 |
|
601 CSCENGDEBUG2( |
|
602 "CCSCEngServicePluginHandler::SetPluginInitInfoL Iap: %d", reqIap ); |
|
603 |
|
604 |
|
605 // Check if plug-in is already provisioned |
|
606 pluginInfo.iProvisioned = EFalse; |
|
607 RArray<TUint> serviceIds; |
|
608 CleanupClosePushL( serviceIds ); |
|
609 |
|
610 TRAPD( err, iServiceHandler.GetAllServiceIdsL( serviceIds ) ); |
|
611 |
|
612 for ( TInt i( 0 ) ; i < serviceIds.Count() && !err ; i++ ) |
|
613 { |
|
614 TInt32 pluginUid( 0 ); |
|
615 TInt err2( KErrNone ); |
|
616 |
|
617 TRAP( err2, pluginUid = |
|
618 iServiceHandler.ServiceSetupPluginIdL( serviceIds[ i ] ) ); |
|
619 |
|
620 |
|
621 CSCENGDEBUG2( |
|
622 "CCSCEngServicePluginHandler::SetPluginInitInfoL ERR=%d", err2 ); |
|
623 |
|
624 |
|
625 if ( !err2 && ( pluginInfo.iPluginsUid.iUid == pluginUid ) ) |
|
626 { |
|
627 pluginInfo.iProvisioned = ETrue; |
|
628 } |
|
629 } |
|
630 |
|
631 CleanupStack::PopAndDestroy( &serviceIds ); |
|
632 |
|
633 // Check if the plugin is already in array before appending. |
|
634 TBool found( EFalse ); |
|
635 for ( TInt counter( 0 ); |
|
636 counter < iServicePluginInfoArray.Count(); |
|
637 counter++ ) |
|
638 { |
|
639 if ( iServicePluginInfoArray[counter].iPluginsUid == |
|
640 pluginInfo.iPluginsUid ) |
|
641 { |
|
642 found = ETrue; |
|
643 } |
|
644 } |
|
645 if ( !found ) |
|
646 { |
|
647 iServicePluginInfoArray.Append( pluginInfo ); |
|
648 } |
|
649 } |
|
650 |
|
651 CSCENGDEBUG( "CCSCEngServicePluginHandler::SetPluginInitInfoL - end" ); |
|
652 } |
|
653 |
|
654 |
|
655 // --------------------------------------------------------------------------- |
|
656 // Invokes application installer to remove .sis from device. |
|
657 // --------------------------------------------------------------------------- |
|
658 // |
|
659 void CCSCEngServicePluginHandler::RemovePluginSisL( |
|
660 const TUid& aPluginUid ) const |
|
661 { |
|
662 CSCENGDEBUG( "CCSCEngServicePluginHandler::RemovePluginSisL - begin" ); |
|
663 |
|
664 // Create & connect to the software installation server. |
|
665 SwiUI::RSWInstSilentLauncher swInstaller; |
|
666 CleanupClosePushL( swInstaller ); |
|
667 User::LeaveIfError( swInstaller.Connect() ); |
|
668 |
|
669 // Make silent uninstall via sowtware installation server. |
|
670 SwiUI::TInstallOptionsPckg uninstallOptions; |
|
671 User::LeaveIfError( |
|
672 swInstaller.SilentUninstall( |
|
673 aPluginUid , |
|
674 uninstallOptions, |
|
675 SwiUI::KSisxMimeType ) ); |
|
676 |
|
677 // Close & destroy server after uninstallation. |
|
678 CleanupStack::PopAndDestroy( &swInstaller ); |
|
679 |
|
680 CSCENGDEBUG( "CCSCEngServicePluginHandler::RemovePluginSisL - end" ); |
|
681 } |