diff options
Diffstat (limited to 'src/components/application_manager/src/policies/policy_handler.cc')
-rw-r--r-- | src/components/application_manager/src/policies/policy_handler.cc | 117 |
1 files changed, 58 insertions, 59 deletions
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc index bd2656f652..6a5438ebc5 100644 --- a/src/components/application_manager/src/policies/policy_handler.cc +++ b/src/components/application_manager/src/policies/policy_handler.cc @@ -107,29 +107,29 @@ const policy::DeviceParams GetDeviceParams( &device_params.device_mac_address, &device_params.device_connection_type)) { LOGGER_ERROR(logger_, - "Failed to extract information for device " << device_handle); + "Failed to extract information for device " << device_handle); } device_params.device_handle = device_handle; return device_params; } } -#define POLICY_LIB_CHECK(return_value) \ - { \ - sync_primitives::AutoReadLock lock(policy_manager_lock_); \ - if (!policy_manager_) { \ +#define POLICY_LIB_CHECK(return_value) \ + { \ + sync_primitives::AutoReadLock lock(policy_manager_lock_); \ + if (!policy_manager_) { \ LOGGER_DEBUG(logger_, "The shared library of policy is not loaded"); \ - return return_value; \ - } \ + return return_value; \ + } \ } -#define POLICY_LIB_CHECK_VOID() \ - { \ - sync_primitives::AutoReadLock lock(policy_manager_lock_); \ - if (!policy_manager_) { \ +#define POLICY_LIB_CHECK_VOID() \ + { \ + sync_primitives::AutoReadLock lock(policy_manager_lock_); \ + if (!policy_manager_) { \ LOGGER_DEBUG(logger_, "The shared library of policy is not loaded"); \ - return; \ - } \ + return; \ + } \ } static const std::string kCerficateFileName = "certificate"; @@ -222,8 +222,8 @@ struct LinkAppToDevice { void operator()(const ApplicationSharedPtr& app) { if (!app.valid()) { LOGGER_WARN(logger_, - "Invalid pointer to application was passed." - "Skip current application."); + "Invalid pointer to application was passed." + "Skip current application."); return; } DeviceParams device_params = GetDeviceParams( @@ -232,7 +232,7 @@ struct LinkAppToDevice { const std::string app_id = app->policy_app_id(); if (device_params.device_mac_address.empty()) { LOGGER_WARN(logger_, - "Couldn't find device, which hosts application " << app_id); + "Couldn't find device, which hosts application " << app_id); return; } app_to_device_link_[app_id] = device_params.device_mac_address; @@ -301,8 +301,8 @@ bool PolicyHandler::LoadPolicyLibrary() { sync_primitives::AutoWriteLock lock(policy_manager_lock_); if (!PolicyEnabled()) { LOGGER_WARN(logger_, - "System is configured to work without policy " - "functionality."); + "System is configured to work without policy " + "functionality."); policy_manager_.reset(); return NULL; } @@ -450,8 +450,8 @@ void PolicyHandler::SendOnAppPermissionsChanged( const AppPermissions& permissions, const std::string& policy_app_id) const { LOGGER_AUTO_TRACE(logger_); LOGGER_DEBUG(logger_, - "PolicyHandler::SendOnAppPermissionsChanged for " - << policy_app_id); + "PolicyHandler::SendOnAppPermissionsChanged for " + << policy_app_id); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { @@ -525,8 +525,8 @@ void PolicyHandler::OnAppPermissionConsentInternal( sync_primitives::AutoLock lock(app_to_device_link_lock_); if (!app_to_device_link_.size()) { LOGGER_WARN(logger_, - "There are no applications previously stored for " - "setting common permissions."); + "There are no applications previously stored for " + "setting common permissions."); return; } @@ -542,8 +542,8 @@ void PolicyHandler::OnAppPermissionConsentInternal( // permissions should be set only for coincident to registered apps if (!app.valid()) { LOGGER_WARN(logger_, - "Invalid pointer to application was passed." - "Permissions setting skipped."); + "Invalid pointer to application was passed." + "Permissions setting skipped."); continue; } @@ -553,8 +553,8 @@ void PolicyHandler::OnAppPermissionConsentInternal( if (device_params.device_mac_address != it->second) { LOGGER_WARN(logger_, - "Device_id of application is changed." - "Permissions setting skipped."); + "Device_id of application is changed." + "Permissions setting skipped."); continue; } @@ -632,10 +632,10 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key, if (!app.valid()) { LOGGER_WARN(logger_, - "Connection key '" - << connection_key - << "' " - "not found within registered applications."); + "Connection key '" + << connection_key + << "' " + "not found within registered applications."); return; } @@ -680,10 +680,10 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired( if (!app.valid()) { LOGGER_WARN(logger_, - "Application with id '" - << policy_app_id - << "' " - "not found within registered applications."); + "Application with id '" + << policy_app_id + << "' " + "not found within registered applications."); return ""; } DeviceParams device_params = GetDeviceParams( @@ -733,14 +733,14 @@ void PolicyHandler::OnVehicleDataUpdated( void PolicyHandler::OnPendingPermissionChange( const std::string& policy_app_id) { LOGGER_DEBUG(logger_, - "PolicyHandler::OnPendingPermissionChange for " - << policy_app_id); + "PolicyHandler::OnPendingPermissionChange for " + << policy_app_id); POLICY_LIB_CHECK_VOID(); ApplicationSharedPtr app = application_manager_.application_by_policy_id(policy_app_id); if (!app.valid()) { LOGGER_WARN(logger_, - "No app found for " << policy_app_id << " policy app id."); + "No app found for " << policy_app_id << " policy app id."); return; } @@ -828,24 +828,24 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string, if (!app.valid()) { LOGGER_WARN(logger_, - "There is no registered application with " - "connection key '" - << app_id << "'"); + "There is no registered application with " + "connection key '" + << app_id << "'"); return false; } const std::string& mobile_app_id = app->policy_app_id(); if (mobile_app_id.empty()) { LOGGER_WARN(logger_, - "Application with connection key '" - << app_id << "'" - " has no application id."); + "Application with connection key '" + << app_id << "'" + " has no application id."); return false; } LOGGER_DEBUG(logger_, - "Update url is " << url << " for application " - "with connection key " << app_id); + "Update url is " << url << " for application " + "with connection key " << app_id); MessageHelper::SendPolicySnapshotNotification( app_id, pt_string, url, application_manager_); @@ -931,7 +931,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( uint32_t device_handle = 0; if (!connection_handler.GetDeviceID(device_mac, &device_handle)) { LOGGER_WARN(logger_, - "Device hadle with mac " << device_mac << " wasn't found."); + "Device hadle with mac " << device_mac << " wasn't found."); } } @@ -940,7 +940,7 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification( uint32_t device_handle = 0; if (!connection_handler.GetDeviceID(device_mac, &device_handle)) { LOGGER_WARN(logger_, - "Device hadle with mac " << device_mac << " wasn't found."); + "Device hadle with mac " << device_mac << " wasn't found."); } DeviceHandles::iterator it = std::find(pending_device_handles_.begin(), pending_device_handles_.end(), @@ -1002,7 +1002,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key, void PolicyHandler::KmsChanged(int kilometers) { LOGGER_DEBUG(logger_, - "PolicyHandler::KmsChanged " << kilometers << " kilometers"); + "PolicyHandler::KmsChanged " << kilometers << " kilometers"); POLICY_LIB_CHECK_VOID(); policy_manager_->KmsChanged(kilometers); } @@ -1038,8 +1038,8 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) { LOGGER_WARN(logger_, - "Couldn't convert default hmi level " << default_hmi - << " to enum."); + "Couldn't convert default hmi level " << default_hmi + << " to enum."); return; } if (current_hmi_level == hmi_level) { @@ -1049,9 +1049,9 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, switch (current_hmi_level) { case mobile_apis::HMILevel::HMI_NONE: { LOGGER_INFO(logger_, - "Changing hmi level of application " - << policy_app_id << " to default hmi level " - << default_hmi); + "Changing hmi level of application " + << policy_app_id << " to default hmi level " + << default_hmi); if (hmi_level == mobile_apis::HMILevel::HMI_FULL) { application_manager_.state_controller().SetRegularState( @@ -1064,9 +1064,9 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, } default: LOGGER_WARN(logger_, - "Application " << policy_app_id - << " is running." - "HMI level won't be changed."); + "Application " << policy_app_id + << " is running." + "HMI level won't be changed."); break; } } @@ -1087,9 +1087,8 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id, app->app_id(), permissions, application_manager_); LOGGER_DEBUG(logger_, - "Notification sent for application_id:" - << policy_app_id << " and connection_key " - << app->app_id()); + "Notification sent for application_id:" + << policy_app_id << " and connection_key " << app->app_id()); } bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string, |