26 #include "featmgrdebug.h" |
26 #include "featmgrdebug.h" |
27 #include "featmgrsecuritypolicy.h" |
27 #include "featmgrsecuritypolicy.h" |
28 #include <f32file.h> |
28 #include <f32file.h> |
29 #include <s32file.h> |
29 #include <s32file.h> |
30 |
30 |
31 // LOCAL CONSTANTS AND MACROS |
31 _LIT(KPanicCategory, "FeatMgrServer"); |
32 #ifdef EXTENDED_FEATURE_MANAGER_TEST |
|
33 _LIT( KPanicCategory, "EnhancedFeatMgrServer" ); |
|
34 #else |
|
35 _LIT( KPanicCategory, "FeatMgrServer" ); |
|
36 #endif // EXTENDED_FEATURE_MANAGER_TEST |
|
37 |
32 |
38 // ============================ MEMBER FUNCTIONS =============================== |
33 // ============================ MEMBER FUNCTIONS =============================== |
39 |
34 |
40 // ----------------------------------------------------------------------------- |
35 // ----------------------------------------------------------------------------- |
41 // CFeatMgrServer::CFeatMgrServer |
36 // CFeatMgrServer::CFeatMgrServer |
340 implInfoArray); |
335 implInfoArray); |
341 TIMESTAMP( "CFeatMgrServer::LoadPluginsL - ListImplementationsL end: " ) |
336 TIMESTAMP( "CFeatMgrServer::LoadPluginsL - ListImplementationsL end: " ) |
342 |
337 |
343 // Check if any plugin was found. |
338 // Check if any plugin was found. |
344 TInt count = implInfoArray.Count(); |
339 TInt count = implInfoArray.Count(); |
345 |
340 if(count == 0) |
346 if ( count > 0 ) |
341 { |
347 { |
342 iPluginsReady = ETrue; // Plugins not found. |
348 |
343 INFO_LOG1("CFeatMgrServer::LoadPluginsL - interfaceUid.iUid == 0x%x, return plugins not found", KFeatureInfoPluginInterfaceUid); |
349 for(TInt i = 0; i < count; i ++) |
344 ret = EFalse; |
|
345 } |
|
346 else |
|
347 { |
|
348 for(TInt i=0;i<count;++i) |
350 { |
349 { |
351 CFeatMgrPluginHandler* pluginHandler = NULL; |
350 CFeatMgrPluginHandler* pluginHandler = NULL; |
352 TInt err( KErrNone ); |
351 TRAPD(err, pluginHandler = CFeatMgrPluginHandler::NewL(implInfoArray[i]->ImplementationUid(), *this)); |
353 |
352 if(err == KErrNone) |
354 // Create handler |
|
355 TRAP( err, pluginHandler = CFeatMgrPluginHandler::NewL( |
|
356 implInfoArray[i]->ImplementationUid(), *this) ); |
|
357 |
|
358 LOG_IF_ERROR1( err, "CFeatMgrServer::LoadPluginsL() - pluginHandler creation err %d", err ); |
|
359 |
|
360 // Apply first request for plugin to process |
|
361 if ( err == KErrNone ) |
|
362 { |
353 { |
363 TRAP( err, pluginHandler->SendCommandL( |
354 CleanupStack::PushL(pluginHandler); |
364 FeatureInfoCommand::ELoadFeatureInfoCmdId ) ); |
355 TRAP(err, pluginHandler->SendCommandL(FeatureInfoCommand::ELoadFeatureInfoCmdId)); |
365 } |
356 if(err == KErrNotSupported) |
366 |
|
367 // Panic if error sth else than not supported |
|
368 if ( err != KErrNone && err != KErrNotSupported ) |
|
369 { |
|
370 ERROR_LOG2( "CFeatMgrServer::LoadPluginsL() - implementationUid: 0x%x, error: %d - going to panic", |
|
371 implInfoArray[i]->ImplementationUid(), err ); |
|
372 User::Panic( KPanicCategory, EPanicLoadPluginError ); |
|
373 } |
|
374 // If simple features are not supported by the plugin search for enhanced ones |
|
375 else if ( err == KErrNotSupported ) |
|
376 { |
|
377 // Reset error code |
|
378 err = KErrNone; |
|
379 TRAP( err, pluginHandler->SendCommandL( |
|
380 FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId ) ); |
|
381 |
|
382 // Panic if error since in this case the plugin does not support any feature |
|
383 if ( err != KErrNone ) |
|
384 { |
|
385 ERROR_LOG2( "CFeatMgrServer::LoadPluginsL() - implementationUid: 0x%x, error: %d - going to panic", |
|
386 implInfoArray[i]->ImplementationUid(), err ); |
|
387 User::Panic( KPanicCategory, EPanicLoadPluginError ); |
|
388 } |
|
389 } |
|
390 // If a simple or enhanced feature is supported by the plugin then append the plugin to the list |
|
391 if ( err == KErrNone ) |
|
392 { |
|
393 INFO_LOG1( "CFeatMgrServer::LoadPluginsL() - Add info of implementationUid: 0x%x", |
|
394 implInfoArray[i]->ImplementationUid() ); |
|
395 |
|
396 // Add information of the plugin to the plugin list |
|
397 SFeatMgrPluginInfo plugin; |
|
398 plugin.iPluginHandler = pluginHandler; |
|
399 // Set all plugins as not ready initially |
|
400 plugin.iPluginReady = EFalse; |
|
401 |
|
402 TInt err = iPluginList.Append(plugin); |
|
403 |
|
404 if ( err != KErrNone ) |
|
405 { |
357 { |
406 ERROR_LOG2( "CFeatMgrServer::LoadPluginsL() - Saving plugin info of implementationUid: 0x%x, err %d", |
358 TRAP(err, pluginHandler->SendCommandL(FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId)); |
407 implInfoArray[i]->ImplementationUid(), err ); |
|
408 User::Leave( err ); |
|
409 } |
359 } |
410 } |
360 } |
411 } |
361 if(err == KErrNoMemory) |
412 INFO_LOG1( "CFeatMgrServer::LoadPluginsL - interfaceUid.iUid == 0x%x, return plugins found", |
362 { |
413 KFeatureInfoPluginInterfaceUid ); |
363 User::Leave(err); |
|
364 } |
|
365 else if(err != KErrNone) |
|
366 { |
|
367 ERROR_LOG2("CFeatMgrServer::LoadPluginsL() - implementationUid: 0x%x, error: %d - going to panic", implInfoArray[i]->ImplementationUid(), err); |
|
368 ::FmgrFatalErrorL(err, KPanicCategory, EPanicLoadPluginError); |
|
369 } |
|
370 // Add information of the plugin to the plugin list. Set all plugins as not ready initially. |
|
371 SFeatMgrPluginInfo plugin; |
|
372 plugin.iPluginHandler = pluginHandler; |
|
373 plugin.iPluginReady = EFalse; |
|
374 User::LeaveIfError(iPluginList.Append(plugin)); |
|
375 CleanupStack::Pop(pluginHandler); |
|
376 } |
|
377 INFO_LOG1("CFeatMgrServer::LoadPluginsL - interfaceUid.iUid == 0x%x, return plugins found", KFeatureInfoPluginInterfaceUid); |
414 ret = ETrue; |
378 ret = ETrue; |
415 } |
|
416 |
|
417 else |
|
418 { |
|
419 iPluginsReady = ETrue; // Plugins not found. |
|
420 INFO_LOG1( "CFeatMgrServer::LoadPluginsL - interfaceUid.iUid == 0x%x, return plugins not found", |
|
421 KFeatureInfoPluginInterfaceUid ); |
|
422 ret = EFalse; |
|
423 } |
379 } |
424 |
380 |
425 CleanupStack::PopAndDestroy(&implInfoArray); |
381 CleanupStack::PopAndDestroy(&implInfoArray); |
426 |
382 |
427 return ret; |
383 return ret; |
534 FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId ) ); |
490 FeatureInfoCommand::ELoadEnhancedFeatureInfoCmdId ) ); |
535 // Panic if error sth else than not supported |
491 // Panic if error sth else than not supported |
536 if ( err != KErrNone && err != KErrNotSupported ) |
492 if ( err != KErrNone && err != KErrNotSupported ) |
537 { |
493 { |
538 ERROR_LOG1( "CFeatMgrServer::FeatureInfoL() - panicing due error %d", err ); |
494 ERROR_LOG1( "CFeatMgrServer::FeatureInfoL() - panicing due error %d", err ); |
539 User::Panic( KPanicCategory, EPanicLoadPluginError ); |
495 ::FmgrFatalErrorL(err, KPanicCategory, EPanicLoadPluginError); |
540 } |
496 } |
541 // At this point we have simple feature supported by the plugin. |
497 // At this point we have simple feature supported by the plugin. |
542 // If no enhanced feature is supported, but a simple one is, then |
498 // If no enhanced feature is supported, but a simple one is, then |
543 // the plugin is ready to be used. Otherwise continue to add the |
499 // the plugin is ready to be used. Otherwise continue to add the |
544 // enhanced features. |
500 // enhanced features. |