summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/message_helper.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/message_helper.cc')
-rw-r--r--src/components/application_manager/src/message_helper.cc33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper.cc
index b211361a32..5b6dd4fa19 100644
--- a/src/components/application_manager/src/message_helper.cc
+++ b/src/components/application_manager/src/message_helper.cc
@@ -251,11 +251,15 @@ std::string MessageHelper::CommonLanguageToString(
}
uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) {
+ policy::PolicyManager* policy_manager =
+ policy::PolicyHandler::instance()->policy_manager();
+ if(!policy_manager) {
+ LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
+ return 0;
+ }
std::string priority;
- policy::PolicyHandler::instance()->policy_manager()->GetPriority(
- policy_app_id, &priority);
- return policy::PolicyHandler::instance()->policy_manager()->
- GetNotificationsNumber(priority);
+ policy_manager->GetPriority(policy_app_id, &priority);
+ return policy_manager-> GetNotificationsNumber(priority);
}
void MessageHelper::SendHMIStatusNotification(
@@ -570,18 +574,27 @@ smart_objects::SmartObject* MessageHelper::CreateDeviceListSO(
(*device_list_so)[strings::device_list] = smart_objects::SmartObject(
smart_objects::SmartType_Array);
smart_objects::SmartObject& list_so = (*device_list_so)[strings::device_list];
+ policy::PolicyManager* policy_manager =
+ policy::PolicyHandler::instance()->policy_manager();
+ if(!policy_manager) {
+ LOG4CXX_WARN(logger_, "The shared library of policy is not loaded");
+ }
int32_t index = 0;
for (connection_handler::DeviceMap::const_iterator it = devices.begin();
devices.end() != it; ++it) {
const connection_handler::Device& d =
static_cast<connection_handler::Device>(it->second);
- list_so[index][strings::name] = d.user_friendly_name();
+ list_so[index][strings::name] = d.user_friendly_name();
list_so[index][strings::id] = it->second.device_handle();
- policy::DeviceConsent device_consent =
- policy::PolicyHandler::instance()->policy_manager()->
- GetUserConsentForDevice(it->second.mac_address());
- list_so[index][strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent ? true : false;
+
+ if(policy_manager) {
+ const policy::DeviceConsent device_consent =
+ policy_manager->GetUserConsentForDevice(it->second.mac_address());
+ list_so[index][strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
+ } else {
+ list_so[index][strings::isSDLAllowed] = true;
+ }
++index;
}
return device_list_so;