diff options
author | agaliuzov <agaliuzov@luxoft.com> | 2016-03-24 17:32:44 +0200 |
---|---|---|
committer | agaliuzov <agaliuzov@luxoft.com> | 2016-03-24 17:32:44 +0200 |
commit | d1fcbfbd5c56f2f9b206932224f89ff03d608591 (patch) | |
tree | 5e3ec2ace08baf87a765f4d9e458a0529324ca8d /src | |
parent | e84d3b5048e653c466f9daef301cb77578651d13 (diff) | |
parent | ea2eaa6a2ac6b4ce59aa3f8e89086aaff1db08b0 (diff) | |
download | sdl_core-d1fcbfbd5c56f2f9b206932224f89ff03d608591.tar.gz |
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'src')
8 files changed, 145 insertions, 105 deletions
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h index fc80cc2a89..561a8d4f6e 100644 --- a/src/components/application_manager/include/application_manager/application_manager_impl.h +++ b/src/components/application_manager/include/application_manager/application_manager_impl.h @@ -1258,6 +1258,8 @@ class ApplicationManagerImpl } } + void ClearTTSGlobalPropertiesList(); + void OnApplicationListUpdateTimer(); /** diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc index 189eff3c8a..66e462a96d 100644 --- a/src/components/application_manager/src/application_manager_impl.cc +++ b/src/components/application_manager/src/application_manager_impl.cc @@ -1369,7 +1369,7 @@ void ApplicationManagerImpl::SendMessageToMobile( mobile_so_factory().attachSchema(*message, false); LOG4CXX_INFO(logger_, "Attached schema to message, result if valid: " << message->isValid()); - + // Messages to mobile are not yet prioritized so use default priority value utils::SharedPtr<Message> message_to_send( new Message(protocol_handler::MessagePriority::kDefault)); @@ -2437,6 +2437,8 @@ void ApplicationManagerImpl::UnregisterAllApplications() { bool is_unexpected_disconnect = Compare<eType, NEQ, ALL>( unregister_reason_, IGNITION_OFF, MASTER_RESET, FACTORY_DEFAULTS); + ClearTTSGlobalPropertiesList(); + { // A local scope to limit accessor's lifetime and release app list lock. ApplicationListAccessor accessor; ApplicationSetConstIt it = accessor.begin(); @@ -3439,6 +3441,12 @@ bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path, return true; } +void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() { + LOG4CXX_AUTO_TRACE(logger_); + sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_); + tts_global_properties_app_list_.clear(); +} + ApplicationManagerImpl::ApplicationListAccessor::~ApplicationListAccessor() {} } // namespace application_manager diff --git a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc index 69cfbe49c5..bb04636aba 100644 --- a/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc +++ b/src/components/application_manager/src/commands/hmi/button_get_capabilities_response.cc @@ -47,6 +47,14 @@ ButtonGetCapabilitiesResponse::~ButtonGetCapabilitiesResponse() { void ButtonGetCapabilitiesResponse::Run() { LOG4CXX_AUTO_TRACE(logger_); + const hmi_apis::Common_Result::eType code = + static_cast<hmi_apis::Common_Result::eType>( + (*message_)[strings::params][hmi_response::code].asInt()); + + if (hmi_apis::Common_Result::SUCCESS != code) { + LOG4CXX_ERROR(logger_, "Error is returned. Capabilities won't be updated."); + return; + } HMICapabilities& hmi_capabilities = ApplicationManagerImpl::instance()->hmi_capabilities(); diff --git a/src/components/application_manager/src/commands/mobile/slider_request.cc b/src/components/application_manager/src/commands/mobile/slider_request.cc index 5402ea92f5..80eb6336ce 100644 --- a/src/components/application_manager/src/commands/mobile/slider_request.cc +++ b/src/components/application_manager/src/commands/mobile/slider_request.cc @@ -36,6 +36,7 @@ #include "application_manager/application_impl.h" #include "application_manager/message_helper.h" #include "utils/helpers.h" +#include "config_profile/profile.h" namespace application_manager { @@ -54,7 +55,7 @@ bool SliderRequest::Init() { /* Timeout in milliseconds. If omitted a standard value of 10000 milliseconds is used.*/ if ((*message_)[strings::msg_params].keyExists(strings::timeout)) { - default_timeout_ = + default_timeout_ = profile::Profile::instance()->default_timeout() + (*message_)[strings::msg_params][strings::timeout].asUInt(); } diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h index 71d51e48b1..b6b13b57c1 100644 --- a/src/components/connection_handler/include/connection_handler/connection_handler_impl.h +++ b/src/components/connection_handler/include/connection_handler/connection_handler_impl.h @@ -451,7 +451,7 @@ class ConnectionHandlerImpl : public ConnectionHandler, * \brief Lock for applications list */ mutable sync_primitives::RWLock connection_list_lock_; - mutable sync_primitives::Lock connection_handler_observer_lock_; + mutable sync_primitives::RWLock connection_handler_observer_lock_; /** * \brief Cleans connection list on destruction diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc index 261a8d232c..e962da7b19 100644 --- a/src/components/connection_handler/src/connection_handler_impl.cc +++ b/src/components/connection_handler/src/connection_handler_impl.cc @@ -67,7 +67,8 @@ ConnectionHandlerImpl::ConnectionHandlerImpl( , connection_handler_observer_(NULL) , transport_manager_(tm) , protocol_handler_(NULL) - , connection_handler_observer_lock_(true) + , connection_list_lock_() + , connection_handler_observer_lock_() , connection_list_deleter_(&connection_list_) { } @@ -88,7 +89,7 @@ void ConnectionHandlerImpl::set_connection_handler_observer( ConnectionHandlerObserver *observer) { LOG4CXX_DEBUG(logger_, "ConnectionHandlerImpl::set_connection_handler_observer() " << observer); - sync_primitives::AutoLock lock(connection_handler_observer_lock_); + sync_primitives::AutoWriteLock write_lock(connection_handler_observer_lock_); if (!observer) { LOG4CXX_WARN(logger_, "Set Null pointer to observer."); } @@ -108,14 +109,14 @@ void ConnectionHandlerImpl::set_protocol_handler( void ConnectionHandlerImpl::OnDeviceListUpdated( const std::vector<transport_manager::DeviceInfo>&) { LOG4CXX_AUTO_TRACE(logger_); - sync_primitives::AutoLock lock(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->OnDeviceListUpdated(device_list_); } } void ConnectionHandlerImpl::OnFindNewApplicationsRequest() { - sync_primitives::AutoLock lock(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->OnFindNewApplicationsRequest(); } @@ -134,6 +135,10 @@ void ConnectionHandlerImpl::OnDeviceAdded( device_info.device_handle(), Device(device_info.device_handle(), device_info.name(), device_info.mac_address(), device_info.connection_type()))); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); + if (connection_handler_observer_) { + connection_handler_observer_->OnDeviceListUpdated(device_list_); + } } void ConnectionHandlerImpl::OnDeviceRemoved( @@ -162,7 +167,7 @@ void ConnectionHandlerImpl::OnDeviceRemoved( } device_list_.erase(device_info.device_handle()); - sync_primitives::AutoLock lock(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->RemoveDevice(device_info.device_handle()); } @@ -314,7 +319,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback( *hash_id = protocol_handler::HASH_ID_NOT_SUPPORTED; } } - sync_primitives::AutoLock lock2(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { const uint32_t session_key = KeyFromPair(connection_handle, new_session_id); const bool success = connection_handler_observer_->OnServiceStartedCallback( @@ -408,7 +413,7 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback( } } - sync_primitives::AutoLock lock2(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->OnServiceEndedCallback( session_key, service_type, CloseSessionReason::kCommon); @@ -645,7 +650,7 @@ void ConnectionHandlerImpl::StartDevicesDiscovery() { LOG4CXX_AUTO_TRACE(logger_); transport_manager_.SearchDevices(); - sync_primitives::AutoLock lock(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_) { connection_handler_observer_->OnDeviceListUpdated(device_list_); } @@ -763,26 +768,32 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle, } } - if (connection_handler_observer_) { - SessionMap::const_iterator session_map_itr = session_map.find(session_id); - if (session_map_itr != session_map.end()) { - const uint32_t session_key = KeyFromPair(connection_id, session_id); - const Session &session = session_map_itr->second; - const ServiceList &service_list = session.service_list; - - ServiceList::const_reverse_iterator service_list_itr = service_list.rbegin(); - for (;service_list_itr != service_list.rend(); ++service_list_itr) { - const protocol_handler::ServiceType service_type = - service_list_itr->service_type; - connection_handler_observer_->OnServiceEndedCallback(session_key, - service_type, - close_reason); - } - } else { - LOG4CXX_ERROR(logger_, "Session with id: " << session_id << " not found"); - return; + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); + if (!connection_handler_observer_) { + LOG4CXX_ERROR(logger_, "Connection handler observer not found"); + return; + } + + + SessionMap::const_iterator session_map_itr = session_map.find(session_id); + if (session_map_itr != session_map.end()) { + const uint32_t session_key = KeyFromPair(connection_id, session_id); + const Session &session = session_map_itr->second; + const ServiceList &service_list = session.service_list; + + ServiceList::const_reverse_iterator service_list_itr = service_list.rbegin(); + for (;service_list_itr != service_list.rend(); ++service_list_itr) { + const protocol_handler::ServiceType service_type = + service_list_itr->service_type; + connection_handler_observer_->OnServiceEndedCallback(session_key, + service_type, + close_reason); } + } else { + LOG4CXX_ERROR(logger_, "Session with id: " << session_id << " not found"); + return; } + LOG4CXX_DEBUG(logger_, "Session with id: " << session_id << " has been closed successfully"); } @@ -896,7 +907,7 @@ void ConnectionHandlerImpl::OnConnectionEnded( connection_list_.erase(itr); connection_list_lock_.Release(); - sync_primitives::AutoLock lock2(connection_handler_observer_lock_); + sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_); if (connection_handler_observer_ && connection.get() != NULL) { const SessionMap session_map = connection->session_map(); diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml index bc5f55fed3..1892df6da1 100644 --- a/src/components/interfaces/MOBILE_API.xml +++ b/src/components/interfaces/MOBILE_API.xml @@ -7,118 +7,119 @@ <element name="SUCCESS">
<description>The request succeeded</description>
</element>
- <element name="INVALID_DATA">
- <description>
- The data sent is invalid. For example:
- Invalid Json syntax
- Parameters out of bounds (number or enum range)
- Mandatory parameters not provided
- Parameter provided with wrong type
- Invalid characters
- Empty string
- </description>
- </element>
<element name="UNSUPPORTED_REQUEST">
<description>The request is not supported by Sync</description>
</element>
- <element name="OUT_OF_MEMORY">
- <description>The system could not process the request because the necessary memory couldn't be allocated</description>
- </element>
- <element name="TOO_MANY_PENDING_REQUESTS">
- <description>There are too many requests pending (means, that the response has not been delivered, yet).</description>
- <designdescription>There may be a maximum of 1000 pending requests at a time.</designdescription>
- </element>
- <element name="INVALID_ID">
+ <element name="UNSUPPORTED_RESOURCE">
<description>
- One of the provided IDs is not valid. For example
- This applies to CorrelationID, SubscriptionID, CommandID, MenuID, etc.
+ A button that was requested for subscription is not supported under the current system.
+ NOTE: could become a more generic UNSUPPORTED_RESOURCE by merging with VEHICLE_DATA_NOT_AVAILABLE.
</description>
</element>
- <element name="DUPLICATE_NAME">
- <description>There was a conflict with an registered name (application or menu item) or vr command</description>
- </element>
- <element name="TOO_MANY_APPLICATIONS">
- <description>There are already too many registered applications</description>
+ <element name="DISALLOWED">
+ <description>RPC is not authorized in local policy table.</description>
</element>
- <element name="APPLICATION_REGISTERED_ALREADY">
- <description>RegisterApplication has been called again, after a RegisterApplication was successful before.</description>
+ <element name="REJECTED">
+ <description>
+ The requested command was rejected, e.g. because mobile app is in background and cannot perform any HMI commands.
+ Or an HMI command (e.g. Speak) is rejected because a higher priority HMI command (e.g. Alert) is playing.
+ </description>
</element>
- <element name="UNSUPPORTED_VERSION">
- <description>Sync doesn't support the protocol that is requested by the mobile application</description>
+ <element name="ABORTED">
+ <description>
+ A command was aborted, for example due to user interaction (e.g. user pressed button).
+ Or an HMI command (e.g. Speak) is aborted because a higher priority HMI command (e.g. Alert) was requested.
+ </description>
</element>
- <element name="WRONG_LANGUAGE">
+ <element name="IGNORED">
<description>
- The requested language is currently not supported.
- Might be because of a mismatch of the currently active language on Sync and the requested language
+ A command was ignored, because the intended result is already in effect.
+ For example, SetMediaClockTimer was used to pause the media clock although the clock is paused already.
+ NOTE: potentially replaces SUBSCRIBED_ALREADY
</description>
</element>
- <element name="APPLICATION_NOT_REGISTERED">
- <description>An command can not be executed because no application has been registered with RegisterApplication.</description>
+ <element name="RETRY">
+ <description>The user interrupted the RPC (e.g. PerformAudioPassThru) and indicated to start over. Note, the app must issue the new RPC.</description>
</element>
<element name="IN_USE">
<description>
- The data may not be changed, because it is currently in use.
- For example when trying to delete a command set that is currently involved in an interaction.
+ The data may not be changed, because it is currently in use.
+ For example when trying to delete a command set that is currently involved in an interaction.
</description>
</element>
- <element name="VEHICLE_DATA_NOT_ALLOWED">
- <description>The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.</description>
- </element>
<element name="VEHICLE_DATA_NOT_AVAILABLE">
<description>The requested vehicle data is not available on this vehicle or is not published.</description>
</element>
- <element name="REJECTED">
+ <element name="TIMED_OUT">
+ <description>Overlay reached the maximum timeout and closed.</description>
+ </element>
+ <element name="INVALID_DATA">
<description>
- The requested command was rejected, e.g. because mobile app is in background and cannot perform any HMI commands.
- Or an HMI command (e.g. Speak) is rejected because a higher priority HMI command (e.g. Alert) is playing.
+ The data sent is invalid. For example:
+ Invalid Json syntax
+ Parameters out of bounds (number or enum range)
+ Mandatory parameters not provided
+ Parameter provided with wrong type
+ Invalid characters
+ Empty string
</description>
</element>
- <element name="ABORTED">
+ <element name="CHAR_LIMIT_EXCEEDED"></element>
+ <element name="INVALID_ID">
<description>
- A command was aborted, for example due to user interaction (e.g. user pressed button).
- Or an HMI command (e.g. Speak) is aborted because a higher priority HMI command (e.g. Alert) was requested.
+ One of the provided IDs is not valid. For example
+ This applies to CorrelationID, SubscriptionID, CommandID, MenuID, etc.
</description>
</element>
- <element name="IGNORED">
- <description>
- A command was ignored, because the intended result is already in effect.
- For example, SetMediaClockTimer was used to pause the media clock although the clock is paused already.
- NOTE: potentially replaces SUBSCRIBED_ALREADY
- </description>
+ <element name="DUPLICATE_NAME">
+ <description>There was a conflict with an registered name (application or menu item) or vr command</description>
</element>
- <element name="UNSUPPORTED_RESOURCE">
+ <element name="APPLICATION_NOT_REGISTERED">
+ <description>An command can not be executed because no application has been registered with RegisterApplication.</description>
+ </element>
+ <element name="WRONG_LANGUAGE">
<description>
- A button that was requested for subscription is not supported under the current system.
- NOTE: could become a more generic UNSUPPORTED_RESOURCE by merging with VEHICLE_DATA_NOT_AVAILABLE.
+ The requested language is currently not supported.
+ Might be because of a mismatch of the currently active language on Sync and the requested language
</description>
+ </element>
+ <element name="OUT_OF_MEMORY">
+ <description>The system could not process the request because the necessary memory couldn't be allocated</description>
</element>
- <element name="FILE_NOT_FOUND">
- <description>A specified file could not be found on Sync.</description>
+ <element name="TOO_MANY_PENDING_REQUESTS">
+ <description>There are too many requests pending (means, that the response has not been delivered, yet).</description>
+ <designdescription>There may be a maximum of 1000 pending requests at a time.</designdescription>
+ </element>
+ <element name="TOO_MANY_APPLICATIONS">
+ <description>There are already too many registered applications</description>
+ </element>
+ <element name="APPLICATION_REGISTERED_ALREADY">
+ <description>RegisterApplication has been called again, after a RegisterApplication was successful before.</description>
+ </element>
+ <element name="WARNINGS">
+ <description>The RPC (e.g. SubscribeVehicleData) executed successfully but one or more items have a warning or failure.</description>
</element>
<element name="GENERIC_ERROR">
<description>Provided data is valid but something went wrong in the lower layers.</description>
</element>
- <element name="DISALLOWED">
- <description>RPC is not authorized in local policy table.</description>
- </element>
<element name="USER_DISALLOWED">
<description>RPC is included in a functional group explicitly blocked by the user.</description>
</element>
- <element name="TIMED_OUT">
- <description>Overlay reached the maximum timeout and closed.</description>
+ <element name="TRUNCATED_DATA">
+ <description>The RPC (e.g. ReadDID) executed successfully but the data exceeded the platform maximum threshold and thus, only part of the data is available.</description>
+ </element>
+ <element name="UNSUPPORTED_VERSION">
+ <description>Sync doesn't support the protocol that is requested by the mobile application</description>
+ </element>
+ <element name="VEHICLE_DATA_NOT_ALLOWED">
+ <description>The user has turned off access to vehicle data, and it is globally unavailable to mobile applications.</description>
+ </element>
+ <element name="FILE_NOT_FOUND">
+ <description>A specified file could not be found on Sync.</description>
</element>
<element name="CANCEL_ROUTE">
<description>User selected to Cancel Route.</description>
- </element>
- <element name="TRUNCATED_DATA">
- <description>The RPC (e.g. ReadDID) executed successfully but the data exceeded the platform maximum threshold and thus, only part of the data is available.</description>
</element>
- <element name="RETRY">
- <description>The user interrupted the RPC (e.g. PerformAudioPassThru) and indicated to start over. Note, the app must issue the new RPC.</description>
- </element>
- <element name="WARNINGS">
- <description>The RPC (e.g. SubscribeVehicleData) executed successfully but one or more items have a warning or failure.</description>
- </element>
<element name="SAVED">
<description>The RPC (e.g. Slider) executed successfully and the user elected to save the current position / value.</description>
</element>
@@ -131,7 +132,6 @@ <element name="RESUME_FAILED">
<description>The provided hash ID does not match the hash of the current set of registered data or the core could not resume the previous data.</description>
</element>
- <element name="CHAR_LIMIT_EXCEEDED"></element>
</enum>
<enum name="ButtonPressMode">
diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc index 4ec6c912af..3cba7d857e 100644 --- a/src/components/policy/src/policy/src/cache_manager.cc +++ b/src/components/policy/src/policy/src/cache_manager.cc @@ -1201,11 +1201,21 @@ bool CacheManager::Init(const std::string& file_name) { } break; case InitResult::SUCCESS: { LOG4CXX_INFO(logger_, "Policy Table was inited successfully"); + result = LoadFromFile(file_name, *pt_); - backup_->UpdateDBVersion(); - if (result) { - Backup(); + + utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot(); + result &= snapshot->is_valid(); + LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: " + << std::boolalpha << result); + if(!result) { + rpc::ValidationReport report("policy_table"); + snapshot->ReportErrors(&report); + return result; } + + backup_->UpdateDBVersion(); + Backup(); } break; default: { result = false; |