summaryrefslogtreecommitdiff
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/application_manager/include/application_manager/application.h3
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h4
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/command.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h2
-rw-r--r--src/components/application_manager/include/application_manager/help_prompt_manager.h18
-rw-r--r--src/components/application_manager/include/application_manager/help_prompt_manager_impl.h28
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h37
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h3
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h2
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h4
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h2
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h3
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h7
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc44
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc22
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc41
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc35
-rw-r--r--src/components/application_manager/src/application_impl.cc29
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc62
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc4
-rw-r--r--src/components/application_manager/src/commands/request_from_mobile_impl.cc13
-rw-r--r--src/components/application_manager/src/help_prompt_manager_impl.cc54
-rw-r--r--src/components/application_manager/src/hmi_state.cc2
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc69
-rw-r--r--src/components/application_manager/src/request_controller_impl.cc49
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc2
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc3
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc12
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc10
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_processor_impl.cc20
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc2
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc34
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h5
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h6
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_request.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resumption_data.h2
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h2
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc5
-rw-r--r--src/components/application_manager/test/request_controller/request_controller_test.cc81
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc76
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc6
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_json_test.cc6
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc4
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc6
-rw-r--r--src/components/include/application_manager/application_manager.h1
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h3
-rw-r--r--src/components/policy/policy_external/include/policy/policy_manager_impl.h5
-rw-r--r--src/components/policy/policy_external/src/policy_manager_impl.cc3
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_manager_impl.h5
-rw-r--r--src/components/policy/policy_regular/src/policy_manager_impl.cc3
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc1
-rw-r--r--src/components/transport_manager/test/test_certs/ca-cert.pem48
-rw-r--r--src/components/transport_manager/test/test_certs/client-cert.pem45
-rw-r--r--src/components/transport_manager/test/test_certs/client-key.pem76
-rw-r--r--src/components/transport_manager/test/test_certs/server-cert.pem45
-rw-r--r--src/components/transport_manager/test/test_certs/server-key.pem76
-rw-r--r--src/components/utils/include/utils/atomic_object.h109
-rw-r--r--src/components/utils/include/utils/logger/boostlogger.h19
-rw-r--r--src/components/utils/src/logger/boostlogger.cc71
-rw-r--r--src/components/utils/test/atomic_object_test.cc80
69 files changed, 1011 insertions, 462 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index e018c28c54..d37a211044 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -1181,7 +1181,8 @@ class Application : public virtual InitialApplicationData,
* @brief Get list of available application extensions
* @return application extensions
*/
- virtual const std::list<AppExtensionPtr>& Extensions() const = 0;
+ virtual const DataAccessor<std::list<AppExtensionPtr> > Extensions()
+ const = 0;
/**
* @brief Get cloud app endpoint for websocket connection
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index 49f44acacb..1746893be3 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -555,7 +555,7 @@ class ApplicationImpl : public virtual Application,
*/
bool RemoveExtension(AppExtensionUID uid) OVERRIDE;
- const std::list<AppExtensionPtr>& Extensions() const OVERRIDE;
+ const DataAccessor<std::list<AppExtensionPtr> > Extensions() const OVERRIDE;
std::string hash_val_;
uint32_t grammar_id_;
@@ -617,6 +617,7 @@ class ApplicationImpl : public virtual Application,
Timer audio_stream_suspend_timer_;
std::list<AppExtensionPtr> extensions_;
+ mutable std::shared_ptr<sync_primitives::RecursiveLock> extensions_lock_;
// Cloud app properties
std::string endpoint_;
@@ -644,7 +645,6 @@ class ApplicationImpl : public virtual Application,
CommandSoftButtonID cmd_softbuttonid_;
// Lock for command soft button id
sync_primitives::Lock cmd_softbuttonid_lock_;
- mutable std::shared_ptr<sync_primitives::Lock> vi_lock_ptr_;
mutable std::shared_ptr<sync_primitives::Lock> button_lock_ptr_;
std::string folder_name_;
ApplicationManager& application_manager_;
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 d72508bd63..0770cba4b1 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
@@ -1023,8 +1023,6 @@ class ApplicationManagerImpl
rpc_service_ = std::move(rpc_service);
}
- bool is_stopping() const OVERRIDE;
-
bool is_audio_pass_thru_active() const OVERRIDE;
/*
* @brief Function Should be called when Low Voltage is occured
diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h
index f8bc66df2a..1283db0edc 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -137,6 +137,8 @@ class Command {
*/
virtual void SetAllowedToTerminate(const bool allowed) = 0;
+ virtual const ApplicationManager& GetApplicationManager() const = 0;
+
enum CommandSource {
SOURCE_SDL,
SOURCE_MOBILE,
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h
index 534f07aa37..0438ffe682 100644
--- a/src/components/application_manager/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_impl.h
@@ -182,6 +182,8 @@ class CommandImpl : public Command {
*/
void SetAllowedToTerminate(const bool allowed) OVERRIDE;
+ const ApplicationManager& GetApplicationManager() const OVERRIDE;
+
void OnUpdateTimeOut() OVERRIDE;
/**
diff --git a/src/components/application_manager/include/application_manager/help_prompt_manager.h b/src/components/application_manager/include/application_manager/help_prompt_manager.h
index eb45705d9f..d5820169c0 100644
--- a/src/components/application_manager/include/application_manager/help_prompt_manager.h
+++ b/src/components/application_manager/include/application_manager/help_prompt_manager.h
@@ -80,6 +80,14 @@ class HelpPromptManager {
const smart_objects::SmartObject& msg, const bool is_response) = 0;
/**
+ * @brief Triggered when ResetGlobalProperties request is received from an
+ * application. Reset sending_type_ based on which global properties are reset
+ * @param msg containing GlobalProperties
+ */
+ virtual void OnResetGlobalPropertiesReceived(
+ const smart_objects::SmartObject& msg) = 0;
+
+ /**
* @brief Requests sending type behavior
*/
enum class SendingType { kNoneSend, kSendHelpPrompt, kSendVRHelp, kSendBoth };
@@ -89,6 +97,16 @@ class HelpPromptManager {
* @return current sending type
*/
virtual SendingType GetSendingType() const = 0;
+
+ /**
+ * @brief Construct the helpPrompt parameter
+ */
+ virtual void CreatePromptMsg(smart_objects::SmartObject& out_msg_params) = 0;
+
+ /**
+ * @brief Construct the vrHelp parameter
+ */
+ virtual void CreateVRMsg(smart_objects::SmartObject& out_msg_params) = 0;
};
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h b/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h
index 3cd22a6afc..9094524c7d 100644
--- a/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/help_prompt_manager_impl.h
@@ -104,11 +104,29 @@ class HelpPromptManagerImpl : public HelpPromptManager {
const bool is_response) OVERRIDE;
/**
+ * @brief Triggered when ResetGlobalProperties request is received from an
+ * application. Reset sending_type_ based on which global properties are reset
+ * @param msg containing GlobalProperties
+ */
+ void OnResetGlobalPropertiesReceived(
+ const smart_objects::SmartObject& msg) OVERRIDE;
+
+ /**
* @brief Get current sending type
* @return current sending type
*/
SendingType GetSendingType() const OVERRIDE;
+ /**
+ * @brief Construct the helpPrompt parameter
+ */
+ void CreatePromptMsg(smart_objects::SmartObject& out_msg_params);
+
+ /**
+ * @brief Construct the vrHelp parameter
+ */
+ void CreateVRMsg(smart_objects::SmartObject& out_msg_params);
+
private:
DISALLOW_COPY_AND_ASSIGN(HelpPromptManagerImpl);
@@ -150,16 +168,6 @@ class HelpPromptManagerImpl : public HelpPromptManager {
void SendRequests();
/**
- * @brief Construct the helpPrompt parameter
- */
- void CreatePromptMsg(smart_objects::SmartObject& out_msg_params);
-
- /**
- * @brief Construct the vrHelp parameter
- */
- void CreateVRMsg(smart_objects::SmartObject& out_msg_params);
-
- /**
* @brief Setting request type to send HMI
* @param msg containing request or response for the
* SetGlobalPropertiesRequest
diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h
index 8271edcbd8..745c135bde 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -37,6 +37,7 @@
#include <list>
#include <memory>
#include "interfaces/MOBILE_API.h"
+#include "utils/atomic_object.h"
#include "utils/macro.h"
namespace application_manager {
@@ -116,13 +117,13 @@ class HmiState {
* @return return hmi level member
*/
virtual mobile_apis::HMILevel::eType hmi_level() const {
- if (parent_) {
+ if (parent()) {
if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level_) {
- return parent_->hmi_level();
+ return parent()->hmi_level();
}
// Higher values correlate to lower states
// (FULL = 0, LIMITED = 1, etc.)
- return std::max(parent_->max_hmi_level(), hmi_level_);
+ return std::max(parent()->max_hmi_level(), hmi_level_);
}
return hmi_level_;
}
@@ -132,8 +133,8 @@ class HmiState {
* @return return maximum hmi level for app
*/
virtual mobile_apis::HMILevel::eType max_hmi_level() const {
- if (parent_) {
- return parent_->max_hmi_level();
+ if (parent()) {
+ return parent()->max_hmi_level();
}
return mobile_apis::HMILevel::HMI_FULL;
}
@@ -152,14 +153,14 @@ class HmiState {
*/
virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
const {
- if (parent_) {
+ if (parent()) {
if (mobile_apis::AudioStreamingState::INVALID_ENUM ==
audio_streaming_state_) {
- return parent_->audio_streaming_state();
+ return parent()->audio_streaming_state();
}
// Higher values correlate to lower states
// (AUDIBLE = 0, ATTENUATED = 1, etc.)
- return std::max(parent_->max_audio_streaming_state(),
+ return std::max(parent()->max_audio_streaming_state(),
audio_streaming_state_);
}
return audio_streaming_state_;
@@ -171,8 +172,8 @@ class HmiState {
*/
virtual mobile_apis::AudioStreamingState::eType max_audio_streaming_state()
const {
- if (parent_) {
- return parent_->max_audio_streaming_state();
+ if (parent()) {
+ return parent()->max_audio_streaming_state();
}
return mobile_apis::AudioStreamingState::AUDIBLE;
}
@@ -183,14 +184,14 @@ class HmiState {
*/
virtual mobile_apis::VideoStreamingState::eType video_streaming_state()
const {
- if (parent_) {
+ if (parent()) {
if (mobile_apis::VideoStreamingState::INVALID_ENUM ==
video_streaming_state_) {
- return parent_->video_streaming_state();
+ return parent()->video_streaming_state();
}
// Higher values correlate to lower states
// (STREAMABLE = 0, NOT_STREAMABLE = 1)
- return std::max(parent_->max_video_streaming_state(),
+ return std::max(parent()->max_video_streaming_state(),
video_streaming_state_);
}
return video_streaming_state_;
@@ -202,8 +203,8 @@ class HmiState {
*/
virtual mobile_apis::VideoStreamingState::eType max_video_streaming_state()
const {
- if (parent_) {
- return parent_->max_video_streaming_state();
+ if (parent()) {
+ return parent()->max_video_streaming_state();
}
return mobile_apis::VideoStreamingState::STREAMABLE;
}
@@ -232,9 +233,9 @@ class HmiState {
*/
virtual mobile_apis::SystemContext::eType system_context() const {
// Parent's context should be used if not available for current state
- if (parent_ &&
+ if (parent() &&
system_context_ == mobile_apis::SystemContext::INVALID_ENUM) {
- return parent_->system_context();
+ return parent()->system_context();
}
return system_context_;
}
@@ -280,7 +281,7 @@ class HmiState {
uint32_t hmi_app_id_;
StateID state_id_;
const ApplicationManager& app_mngr_;
- HmiStatePtr parent_;
+ sync_primitives::Atomic<HmiStatePtr> parent_;
mobile_apis::WindowType::eType window_type_;
mobile_apis::HMILevel::eType hmi_level_;
mobile_apis::AudioStreamingState::eType audio_streaming_state_;
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 9cfb504b00..dc7e0b6b1f 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -321,9 +321,6 @@ class MessageHelper {
static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
- static smart_objects::SmartObjectSPtr CreateAppVrHelp(
- ApplicationConstSharedPtr app);
-
static smart_objects::SmartObjectList CreateShowRequestToHMI(
ApplicationConstSharedPtr app, const uint32_t correlation_id);
static void SendShowRequestToHMI(ApplicationConstSharedPtr app,
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index ee9972b98c..39b751bb4b 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -157,7 +157,7 @@ class ResumptionData {
* @brief Get the last ignition off time from LastState
* @return the last ignition off time from LastState
*/
- virtual uint32_t GetIgnOffTime() const = 0;
+ virtual int64_t GetIgnOffTime() const = 0;
/**
* @brief Checks if saved data have application
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
index a4614d4f2c..768d34094b 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -167,7 +167,7 @@ class ResumptionDataDB : public ResumptionData {
* @brief Get the last ignition off time from LastState
* @return the last ignition off time from LastState
*/
- virtual uint32_t GetIgnOffTime() const;
+ virtual int64_t GetIgnOffTime() const;
/**
* @brief Checks if saved data have application
@@ -289,7 +289,7 @@ class ResumptionDataDB : public ResumptionData {
* @brief Select Ign off time
* @return Ign off time from saved data
*/
- uint32_t SelectIgnOffTime() const;
+ int64_t SelectIgnOffTime() const;
/**
* @brief Checks existence application in DB
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
index f33ef83a9b..a4f83fff44 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -131,7 +131,7 @@ class ResumptionDataJson : public ResumptionData {
* @brief Get the last ignition off time from LastState
* @return the last ignition off time from LastState
*/
- virtual uint32_t GetIgnOffTime() const;
+ virtual int64_t GetIgnOffTime() const;
void IncrementGlobalIgnOnCounter() OVERRIDE;
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
index 312302d157..ffb9359f9c 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_processor_impl.h
@@ -129,8 +129,9 @@ class ResumptionDataProcessorImpl
* requests
* @param app_id ID of application, related to event
* @param found_request reference to found request
+ * @return true, if request is found and erased
*/
- void EraseProcessedRequest(const uint32_t app_id,
+ bool EraseProcessedRequest(const uint32_t app_id,
const ResumptionRequest& found_request);
/**
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
index 6845851f97..e0200f55af 100644
--- a/src/components/application_manager/include/application_manager/state_controller_impl.h
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -136,9 +136,10 @@ class StateControllerImpl : public event_engine::EventObserver,
PostponedActivationController& GetPostponedActivationController() OVERRIDE;
private:
- int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority);
+ void RequestHMIStateChange(ApplicationConstSharedPtr app,
+ HmiStatePtr resolved_state,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority);
/**
* @brief The HmiLevelConflictResolver struct
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
index 75ccd46e4d..875455f545 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_capabilities_manager_impl.cc
@@ -371,23 +371,24 @@ bool RCCapabilitiesManagerImpl::CheckButtonName(
SDL_LOG_AUTO_TRACE();
auto rc_capabilities = hmi_capabilities_.rc_capability();
if (!rc_capabilities) {
- SDL_LOG_ERROR("No remote controll capabilities available");
+ SDL_LOG_ERROR("No remote control capabilities available");
return false;
}
- if (enums_value::kRadio == module_type) {
- if (!helpers::in_range(RCHelpers::buttons_radio(), button_name)) {
- SDL_LOG_WARN("Trying to acceess climate button with module type radio");
- return false;
- }
- }
+ auto module_type_mismatch = [&button_name, &module_type](
+ const std::string& type,
+ const std::vector<std::string>&& buttons) {
+ return (helpers::in_range(buttons, button_name) && type != module_type);
+ };
- if (enums_value::kClimate == module_type) {
- if (!helpers::in_range(RCHelpers::buttons_climate(), button_name)) {
- SDL_LOG_WARN("Trying to acceess radio button with module type climate");
- return false;
- }
+ if (module_type_mismatch(enums_value::kRadio, RCHelpers::buttons_radio()) ||
+ module_type_mismatch(enums_value::kClimate,
+ RCHelpers::buttons_climate())) {
+ SDL_LOG_WARN("Trying to access incompatible button: "
+ << button_name << " with module type: " << module_type);
+ return false;
}
+
return true;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
index 82967b717b..edbeaf1b9e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h
@@ -97,8 +97,10 @@ class CreateInteractionChoiceSetRequest
* @brief Calls after all responses from HMI were received.
* Terminates request and sends successful response to mobile
* if all responses were SUCCESS or calls DeleteChoices in other case.
+ * @param vr_result the result code from hmi.
*/
- void OnAllHMIResponsesReceived();
+ void OnAllHMIResponsesReceived(
+ const hmi_apis::Common_Result::eType vr_result);
/**
* @brief The VRCommand struct
@@ -201,8 +203,9 @@ class CreateInteractionChoiceSetRequest
* @brief CountReceivedVRResponses counts received HMI responses. Updated
* request timeout if not all responses received
* Send response to mobile if all responses received.
+ * @param vr_result the result code from hmi.
*/
- void CountReceivedVRResponses();
+ void CountReceivedVRResponses(const hmi_apis::Common_Result::eType vr_result);
DISALLOW_COPY_AND_ASSIGN(CreateInteractionChoiceSetRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
index ddd2c9db35..eaad84dafd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_command_request.cc
@@ -444,12 +444,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
result_code = ui_result_ == hmi_apis::Common_Result::REJECTED
? mobile_apis::Result::REJECTED
: mobile_apis::Result::GENERIC_ERROR;
-
- msg_params[strings::grammar_id] = application->get_grammar_id();
- msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
-
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
- application->RemoveCommand(cmd_id);
result = false;
SDL_LOG_DEBUG("Result " << result);
}
@@ -461,10 +455,6 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
result_code = vr_result_ == hmi_apis::Common_Result::REJECTED
? mobile_apis::Result::REJECTED
: mobile_apis::Result::GENERIC_ERROR;
-
- SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
-
- application->RemoveCommand(cmd_id);
result = false;
SDL_LOG_DEBUG("Result " << result);
}
@@ -588,12 +578,28 @@ const std::string AddCommandRequest::GenerateMobileResponseInfo() {
void AddCommandRequest::RemoveCommand() {
SDL_LOG_AUTO_TRACE();
+ using namespace helpers;
+
ApplicationSharedPtr app = application_manager_.application(connection_key());
if (app.use_count() == 0) {
SDL_LOG_ERROR("No application associated with session key");
return;
}
+ const bool is_ui_result_ok_or_missing =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_vr_result_ok_or_missing =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
const uint32_t cmd_id =
(*message_)[strings::msg_params][strings::cmd_id].asUInt();
smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
@@ -602,21 +608,15 @@ void AddCommandRequest::RemoveCommand() {
app->RemoveCommand(cmd_id);
- if (BothSend() && (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR) &&
- IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI))) {
- // in case we have send bth UI and VR and no one respond
- // we have nothing to remove from HMI so no DeleteCommand expected
- return;
- }
-
- if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_VR)) {
+ if (ui_is_sent_ && is_ui_result_ok_or_missing) {
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
}
- if (BothSend() && IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) {
- msg_params[strings::grammar_id] = app->get_grammar_id();
- msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
+ if (vr_is_sent_ && is_vr_result_ok_or_missing) {
+ smart_objects::SmartObject vr_msg_params = msg_params;
+ vr_msg_params[strings::grammar_id] = app->get_grammar_id();
+ vr_msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
+ SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &vr_msg_params);
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
index 70f462c05d..f221742523 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_interaction_choice_set_request.cc
@@ -368,7 +368,8 @@ bool CreateInteractionChoiceSetRequest::ProcessSuccesfulHMIResponse(
return true;
}
-void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() {
+void CreateInteractionChoiceSetRequest::CountReceivedVRResponses(
+ const hmi_apis::Common_Result::eType vr_result) {
++received_chs_count_;
SDL_LOG_DEBUG("Got VR.AddCommand response, there are "
<< expected_chs_count_ - received_chs_count_
@@ -378,7 +379,7 @@ void CreateInteractionChoiceSetRequest::CountReceivedVRResponses() {
connection_key(), correlation_id(), default_timeout());
SDL_LOG_DEBUG("Timeout for request was updated");
} else {
- OnAllHMIResponsesReceived();
+ OnAllHMIResponsesReceived(vr_result);
}
}
@@ -392,7 +393,15 @@ void CreateInteractionChoiceSetRequest::on_event(
const Common_Result::eType result = static_cast<Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
const bool is_no_error = Compare<Common_Result::eType, EQ, ONE>(
- result, Common_Result::SUCCESS, Common_Result::WARNINGS);
+ result,
+ Common_Result::SUCCESS,
+ Common_Result::WARNINGS,
+ Common_Result::WRONG_LANGUAGE,
+ Common_Result::RETRY,
+ Common_Result::SAVED,
+ Common_Result::TRUNCATED_DATA,
+ Common_Result::UNSUPPORTED_RESOURCE);
+
uint32_t corr_id = static_cast<uint32_t>(
message[strings::params][strings::correlation_id].asUInt());
if (event.id() == hmi_apis::FunctionID::VR_AddCommand) {
@@ -407,7 +416,7 @@ void CreateInteractionChoiceSetRequest::on_event(
ProcessHmiError(result);
}
}
- CountReceivedVRResponses();
+ CountReceivedVRResponses(result);
}
}
@@ -464,7 +473,8 @@ void CreateInteractionChoiceSetRequest::DeleteChoices() {
sent_commands_map_.clear();
}
-void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
+void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived(
+ const hmi_apis::Common_Result::eType vr_result) {
SDL_LOG_AUTO_TRACE();
ApplicationSharedPtr application =
@@ -478,7 +488,7 @@ void CreateInteractionChoiceSetRequest::OnAllHMIResponsesReceived() {
if (!error_from_hmi_ && should_send_warnings_) {
SendResponse(true, mobile_apis::Result::WARNINGS, kInvalidImageWarningInfo);
} else if (!error_from_hmi_) {
- SendResponse(true, mobile_apis::Result::SUCCESS);
+ SendResponse(true, MessageHelper::HMIToMobileResult(vr_result));
} else {
DeleteChoices();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
index dccf2e9fdd..9caf7e4c7a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -89,7 +89,13 @@ void DeleteInteractionChoiceSetRequest::Run() {
SendResponse(false, mobile_apis::Result::IN_USE);
return;
}
- SendVrDeleteCommand(app);
+ if (choice_set.keyExists(strings::grammar_id) &&
+ choice_set[strings::grammar_id].asInt() != -1) {
+ SendVrDeleteCommand(app);
+ } else {
+ response_result_codes_.push_back(hmi_apis::Common_Result::SUCCESS);
+ SendDeleteInteractionChoiceSetResponse();
+ }
}
bool DeleteInteractionChoiceSetRequest::Init() {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index af0a5a6539..0537043cd4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -225,8 +225,13 @@ size_t OnSystemRequestNotification::ParsePTString(
size_t result_length = length;
result.reserve(length * 2);
for (size_t i = 0; i < length; ++i) {
- if (pt_string[i] == '\"' || pt_string[i] == '\\') {
+ if (pt_string[i] == '\"') {
result += '\\';
+ } else if (pt_string[i] == '\\') {
+ result += '\\';
+ --result_length; // contentLength is adjusted for the additional escape
+ // character added before special characters (like the
+ // newline string)
} else if (pt_string[i] == '\n') {
--result_length; // contentLength is adjusted when this character is
// not copied to result.
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index 92c5d19a05..a9abb5dc6d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -123,6 +123,9 @@ void ResetGlobalPropertiesRequest::Run() {
SendHMIRequest(
hmi_apis::FunctionID::RC_SetGlobalProperties, msg_params.get(), true);
}
+ auto& help_prompt_manager = app->help_prompt_manager();
+ help_prompt_manager.OnResetGlobalPropertiesReceived(
+ (*message_)[strings::msg_params]);
}
void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
index b4795dae21..d273ce8905 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/add_command_request_test.cc
@@ -167,8 +167,7 @@ class AddCommandRequestTest
}
void CheckOnTimeOutCommandDeletion(
- const hmi_apis::FunctionID::eType incoming_cmd,
- const hmi_apis::FunctionID::eType cmd_to_delete) {
+ const hmi_apis::FunctionID::eType incoming_cmd) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& msg_params = (*msg_)[strings::msg_params];
@@ -209,9 +208,15 @@ class AddCommandRequestTest
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
EXPECT_CALL(mock_rpc_service_,
- ManageHMICommand(HMIResultCodeIs(cmd_to_delete), _))
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
+
SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
@@ -598,13 +603,11 @@ TEST_F(AddCommandRequestTest, OnEvent_VR_SUCCESS) {
}
TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_VR_DeleteCommand) {
- CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::VR_AddCommand,
- hmi_apis::FunctionID::VR_DeleteCommand);
+ CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::VR_AddCommand);
}
TEST_F(AddCommandRequestTest, OnTimeOut_EXPECT_UI_DeleteCommand) {
- CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::UI_AddCommand,
- hmi_apis::FunctionID::UI_DeleteCommand);
+ CheckOnTimeOutCommandDeletion(hmi_apis::FunctionID::UI_AddCommand);
}
TEST_F(AddCommandRequestTest, OnEvent_BothSend_SUCCESS) {
@@ -744,7 +747,7 @@ TEST_F(AddCommandRequestTest,
TEST_F(
AddCommandRequestTest,
- OnEvent_UI_HmiResponseCodeIsGenericError_VR_HmiResponseCodeIsUnsupportedResourse_ExpectCommandRemoved) {
+ OnEvent_UI_HmiResponseCodeIsGenericError_VR_HmiResponseCodeIsUnsupportedResource_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -788,7 +791,7 @@ TEST_F(
TEST_F(
AddCommandRequestTest,
- OnEvent_VR_HmiResponseCodeIsGenericError_UI_HmiResponseCodeIsUnsupportedResourse_ExpectCommandRemoved) {
+ OnEvent_VR_HmiResponseCodeIsGenericError_UI_HmiResponseCodeIsUnsupportedResource_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -833,7 +836,7 @@ TEST_F(
TEST_F(
AddCommandRequestTest,
- OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResourse_UI_NotAvailableInterfaceState_ExpectCommandRemoved) {
+ OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResource_UI_NotAvailableInterfaceState_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -883,7 +886,7 @@ TEST_F(
TEST_F(
AddCommandRequestTest,
- OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResourse_VR_NotAvailableInterfaceState_ExpectCommandRemoved) {
+ OnEvent_UI_VR_HmiResponseCodeIsUnsupportedResource_VR_NotAvailableInterfaceState_ExpectCommandRemoved) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -1006,7 +1009,7 @@ TEST_F(
}
TEST_F(AddCommandRequestTest,
- OnEvent_UI_EventWithNotSuccesResponseCode_ExpectVRCommandDelete) {
+ OnEvent_UI_EventWithNotSuccessResponseCode_ExpectVRCommandDelete) {
CreateBasicParamsVRRequest();
CreateBasicParamsUIRequest();
SmartObject& params = (*msg_)[strings::params];
@@ -1048,7 +1051,7 @@ TEST_F(AddCommandRequestTest,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
+ EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
request_ptr->on_event(event_ui);
request_ptr->on_event(event_vr);
}
@@ -1091,7 +1094,7 @@ TEST_F(AddCommandRequestTest,
ManageHMICommand(
HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
.WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId)).Times(2);
+ EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
Event event_vr(hmi_apis::FunctionID::VR_AddCommand);
MessageSharedPtr msg_vr = CreateMessage(SmartType_Map);
(*msg_vr)[strings::params][hmi_response::code] =
@@ -1157,6 +1160,15 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
CreateCommand<AddCommandRequest>(msg_);
request_ptr->Run();
EXPECT_CALL(*mock_app_, RemoveCommand(kCmdId));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteCommand), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_DeleteCommand), _))
+ .WillOnce(Return(true));
+
SmartObjectSPtr response = std::make_shared<SmartObject>(SmartType_Map);
(*response)[strings::msg_params][strings::info] = "info";
EXPECT_CALL(
@@ -1166,6 +1178,7 @@ TEST_F(AddCommandRequestTest, OnTimeOut_AppRemoveCommandCalled) {
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
response, am::commands::Command::CommandSource::SOURCE_SDL));
+
std::shared_ptr<RequestFromMobileImpl> base_class_request =
static_cast<std::shared_ptr<RequestFromMobileImpl> >(request_ptr);
base_class_request->OnTimeOut();
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
index 951a206dff..8939ff9633 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_interaction_choice_set_test.cc
@@ -252,7 +252,7 @@ TEST_F(CreateInteractionChoiceSetRequestTest, OnEvent_VR_UNSUPPORTED_RESOURCE) {
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::success].asBool(),
- false);
+ true);
EXPECT_EQ(
(*vr_command_result)[strings::msg_params][strings::result_code].asInt(),
static_cast<int32_t>(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
index bd4c5c1ec6..aded581faf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_interaction_choice_set_test.cc
@@ -205,10 +205,6 @@ TEST_F(DeleteInteractionChoiceSetRequestTest,
.WillOnce(Return(choice_set_id));
EXPECT_CALL(*app_, is_perform_interaction_active()).WillOnce(Return(false));
EXPECT_CALL(*app_, performinteraction_choice_set_map()).Times(0);
-
- EXPECT_CALL(*app_, FindChoiceSet(kChoiceSetId))
- .WillOnce(Return(invalid_choice_set_id));
-
EXPECT_CALL(*app_, app_id()).Times(0);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
index f1bb7b64ca..7031363fe0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/reset_global_properties_test.cc
@@ -81,7 +81,11 @@ class ResetGlobalPropertiesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
protected:
ResetGlobalPropertiesRequestTest()
- : msg_(CreateMessage()), mock_app_(CreateMockApp()) {}
+ : msg_(CreateMessage()), mock_app_(CreateMockApp()) {
+ mock_help_prompt_manager_ =
+ std::shared_ptr<application_manager_test::MockHelpPromptManager>(
+ new application_manager_test::MockHelpPromptManager());
+ }
void SetUp() OVERRIDE {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
@@ -99,6 +103,8 @@ class ResetGlobalPropertiesRequestTest
MessageSharedPtr msg_;
MockAppPtr mock_app_;
ResetGlobalPropertiesRequestPtr command_;
+ std::shared_ptr<application_manager_test::MockHelpPromptManager>
+ mock_help_prompt_manager_;
};
class ResetGlobalPropertiesResponseTest
@@ -142,6 +148,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_InvalidVrHelp_UNSUCCESS) {
.WillByDefault(Return(std::make_shared<smart_objects::SmartObject>(
smart_objects::SmartType_Map)));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(1);
command_->Run();
@@ -169,6 +178,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, Run_SUCCESS) {
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -208,6 +220,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -253,6 +268,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
MessageSharedPtr ui_msg = CreateMessage();
(*ui_msg)[am::strings::params][am::strings::correlation_id] = kCorrelationId;
@@ -295,6 +313,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
EXPECT_CALL(mock_message_helper_, CreateRCResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -349,6 +370,9 @@ TEST_F(ResetGlobalPropertiesRequestTest, OnEvent_InvalidApp_NoHashUpdate) {
.Times(0);
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -400,6 +424,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(
mock_rpc_service_,
@@ -467,6 +494,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
@@ -535,6 +565,9 @@ TEST_F(ResetGlobalPropertiesRequestTest,
.WillOnce(Return(msg_params));
EXPECT_CALL(mock_message_helper_, CreateUIResetGlobalPropertiesRequest(_, _))
.WillOnce(Return(msg_params));
+ EXPECT_CALL(*mock_app_, help_prompt_manager())
+ .WillRepeatedly(ReturnRef(*mock_help_prompt_manager_.get()));
+ EXPECT_CALL(*mock_help_prompt_manager_, OnResetGlobalPropertiesReceived(_));
EXPECT_CALL(*mock_app_, set_reset_global_properties_active(true));
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index e4a5304a1b..96a5128691 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -148,8 +148,8 @@ ApplicationImpl::ApplicationImpl(
"AudioStreamSuspend",
new ::timer::TimerTaskImpl<ApplicationImpl>(
this, &ApplicationImpl::OnAudioStreamSuspend))
+ , extensions_lock_(std::make_shared<sync_primitives::RecursiveLock>())
, hybrid_app_preference_(mobile_api::HybridAppPreference::INVALID_ENUM)
- , vi_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, button_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, application_manager_(application_manager) {
cmd_number_to_time_limits_[mobile_apis::FunctionID::ReadDIDID] = {
@@ -178,12 +178,28 @@ ApplicationImpl::~ApplicationImpl() {
active_message_ = NULL;
}
+ button_lock_ptr_->Acquire();
subscribed_buttons_.clear();
+ button_lock_ptr_->Release();
+ {
+ sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
+ cmd_softbuttonid_.clear();
+ }
+ cmd_number_to_time_limits_.clear();
+
if (is_perform_interaction_active()) {
set_perform_interaction_active(0);
set_perform_interaction_mode(-1);
}
CleanupFiles();
+ {
+ sync_primitives::AutoLock lock(mobile_message_lock_);
+ mobile_message_queue_.clear();
+ }
+ {
+ sync_primitives::AutoLock lock(extensions_lock_);
+ extensions_.clear();
+ }
}
void ApplicationImpl::CloseActiveMessage() {
@@ -1301,6 +1317,7 @@ void ApplicationImpl::set_hmi_level(
}
AppExtensionPtr ApplicationImpl::QueryInterface(AppExtensionUID uid) {
+ sync_primitives::AutoLock auto_lock_list(extensions_lock_);
std::list<AppExtensionPtr>::const_iterator it = extensions_.begin();
for (; it != extensions_.end(); ++it) {
if ((*it)->uid() == uid) {
@@ -1315,7 +1332,9 @@ bool ApplicationImpl::AddExtension(AppExtensionPtr extension) {
if (!QueryInterface(extension->uid())) {
SDL_LOG_TRACE("Add extenstion to add id" << app_id() << " with uid "
<< extension->uid());
+ extensions_lock_->Acquire();
extensions_.push_back(extension);
+ extensions_lock_->Release();
return true;
}
return false;
@@ -1323,6 +1342,7 @@ bool ApplicationImpl::AddExtension(AppExtensionPtr extension) {
bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) {
SDL_LOG_AUTO_TRACE();
+ sync_primitives::AutoLock auto_lock_list(extensions_lock_);
auto it = std::find_if(
extensions_.begin(), extensions_.end(), [uid](AppExtensionPtr extension) {
return extension->uid() == uid;
@@ -1336,8 +1356,11 @@ bool ApplicationImpl::RemoveExtension(AppExtensionUID uid) {
return false;
}
-const std::list<AppExtensionPtr>& ApplicationImpl::Extensions() const {
- return extensions_;
+const DataAccessor<std::list<AppExtensionPtr> > ApplicationImpl::Extensions()
+ const {
+ DataAccessor<std::list<AppExtensionPtr> > accessor(extensions_,
+ extensions_lock_);
+ return accessor;
}
const std::string& ApplicationImpl::cloud_app_endpoint() const {
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index ec37e3b51f..6b14388b65 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -256,8 +256,35 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
streaming_timer_pool_.clear();
}
+ {
+ sync_primitives::AutoLock lock(navi_service_status_lock_);
+ navi_service_status_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock lock(tts_global_properties_app_list_lock_);
+ tts_global_properties_app_list_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock lock(apps_to_register_list_lock_ptr_);
+ apps_to_register_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock lock(reregister_wait_list_lock_ptr_);
+ reregister_wait_list_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock lock(query_apps_devices_lock_);
+ query_apps_devices_.clear();
+ }
clear_pool_timer_.Stop();
secondary_transport_devices_cache_.clear();
+ applications_list_lock_ptr_->Acquire();
+ applications_.clear();
+ applications_list_lock_ptr_->Release();
}
DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const {
@@ -984,7 +1011,7 @@ void ApplicationManagerImpl::RefreshCloudAppInformation() {
return;
#else
SDL_LOG_AUTO_TRACE();
- if (is_stopping()) {
+ if (IsStopping()) {
return;
}
std::vector<std::string> enabled_apps;
@@ -2567,7 +2594,7 @@ void ApplicationManagerImpl::RemoveHMIFakeParameters(
application_manager::commands::MessageSharedPtr& message,
const hmi_apis::FunctionID::eType& function_id) {
SDL_LOG_AUTO_TRACE();
- hmi_apis::HMI_API factory;
+
if (!(*message)[jhs::S_PARAMS].keyExists(jhs::S_FUNCTION_ID)) {
SDL_LOG_ERROR("RemoveHMIFakeParameters message missing function id");
return;
@@ -2576,7 +2603,7 @@ void ApplicationManagerImpl::RemoveHMIFakeParameters(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
(*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = function_id;
- factory.attachSchema(*message, true);
+ hmi_so_factory().attachSchema(*message, true);
(*message)[jhs::S_PARAMS][jhs::S_FUNCTION_ID] = mobile_function_id;
}
@@ -3504,10 +3531,6 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
return mobile_api::Result::SUCCESS;
}
-bool ApplicationManagerImpl::is_stopping() const {
- return is_stopping_;
-}
-
bool ApplicationManagerImpl::is_audio_pass_thru_active() const {
return audio_pass_thru_active_;
}
@@ -3984,11 +4007,23 @@ bool ApplicationManagerImpl::ResetVrHelpTitleItems(
const std::string& vr_help_title = get_settings().vr_help_title();
smart_objects::SmartObject so_vr_help_title(vr_help_title);
-
app->reset_vr_help_title();
- app->reset_vr_help();
app->set_vr_help_title(so_vr_help_title);
+ app->reset_vr_help();
+ auto& help_prompt_manager = app->help_prompt_manager();
+
+ smart_objects::SmartObject so_vr_help(smart_objects::SmartType_Map);
+ help_prompt_manager.CreateVRMsg(so_vr_help);
+
+ if (!so_vr_help.keyExists(strings::vr_help)) {
+ SDL_LOG_WARN("Failed to create vr_help items. Resetting to empty array");
+ so_vr_help[strings::vr_help] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ }
+
+ app->set_vr_help(so_vr_help[strings::vr_help]);
+
return true;
}
@@ -4542,11 +4577,10 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
const mobile_apis::HMILevel::eType app_hmi_level =
(*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
- if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) {
- MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
- } else if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) ||
- (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) {
- MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
+
+ MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
+ if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) ||
+ (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) {
state_controller().SetRegularState(
*it,
mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 34c2a6d6bc..7907cea2ab 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -174,6 +174,10 @@ void CommandImpl::SetAllowedToTerminate(const bool allowed) {
allowed_to_terminate_ = allowed;
}
+const ApplicationManager& CommandImpl::GetApplicationManager() const {
+ return application_manager_;
+}
+
bool CommandImpl::CheckAllowedParameters(const Command::CommandSource source) {
SDL_LOG_AUTO_TRACE();
diff --git a/src/components/application_manager/src/commands/request_from_mobile_impl.cc b/src/components/application_manager/src/commands/request_from_mobile_impl.cc
index 42df13f034..2e81ae5aea 100644
--- a/src/components/application_manager/src/commands/request_from_mobile_impl.cc
+++ b/src/components/application_manager/src/commands/request_from_mobile_impl.cc
@@ -660,9 +660,16 @@ bool RequestFromMobileImpl::PrepareResultForMobileResponse(
ResponseInfo& out_second,
ResponseInfo& out_third) const {
SDL_LOG_AUTO_TRACE();
- bool result = (PrepareResultForMobileResponse(out_first, out_second) ||
- PrepareResultForMobileResponse(out_second, out_third)) &&
- PrepareResultForMobileResponse(out_first, out_third);
+ bool result_first_second =
+ PrepareResultForMobileResponse(out_first, out_second);
+ bool result_second_third =
+ PrepareResultForMobileResponse(out_second, out_third);
+ bool result_first_third =
+ PrepareResultForMobileResponse(out_first, out_third);
+
+ bool result = (result_first_second && result_first_third) ||
+ (result_second_third && result_first_second) ||
+ (result_second_third && result_first_third);
return result;
}
diff --git a/src/components/application_manager/src/help_prompt_manager_impl.cc b/src/components/application_manager/src/help_prompt_manager_impl.cc
index 30a1139deb..99a919366e 100644
--- a/src/components/application_manager/src/help_prompt_manager_impl.cc
+++ b/src/components/application_manager/src/help_prompt_manager_impl.cc
@@ -183,6 +183,40 @@ void HelpPromptManagerImpl::OnSetGlobalPropertiesReceived(
SetSendingType(msg);
}
+void HelpPromptManagerImpl::OnResetGlobalPropertiesReceived(
+ const smart_objects::SmartObject& msg) {
+ SDL_LOG_AUTO_TRACE();
+ auto& global_properties_ids = msg[strings::properties];
+
+ for (size_t i = 0; i < global_properties_ids.length(); ++i) {
+ mobile_apis::GlobalProperty::eType global_property =
+ static_cast<mobile_apis::GlobalProperty::eType>(
+ global_properties_ids[i].asInt());
+ switch (global_property) {
+ case mobile_apis::GlobalProperty::HELPPROMPT: {
+ sending_type_ = (SendingType::kNoneSend == sending_type_ ||
+ SendingType::kSendHelpPrompt == sending_type_)
+ ? SendingType::kSendHelpPrompt
+ : SendingType::kSendBoth;
+ break;
+ }
+ case mobile_apis::GlobalProperty::VRHELPTITLE:
+ case mobile_apis::GlobalProperty::VRHELPITEMS: {
+ sending_type_ = (SendingType::kNoneSend == sending_type_ ||
+ SendingType::kSendVRHelp == sending_type_)
+ ? SendingType::kSendVRHelp
+ : SendingType::kSendBoth;
+ break;
+ }
+ default: {
+ return;
+ }
+ }
+ }
+
+ SDL_LOG_DEBUG("Sending type set to:" << static_cast<uint32_t>(sending_type_));
+}
+
HelpPromptManagerImpl::SendingType HelpPromptManagerImpl::GetSendingType()
const {
return sending_type_;
@@ -330,12 +364,22 @@ void HelpPromptManagerImpl::CreateVRMsg(
GenerateVrItems(out_msg_params, strings::vr_help);
if (out_msg_params[strings::vr_help].empty()) {
- out_msg_params.erase(strings::vr_help);
- app_.reset_vr_help();
- } else {
- app_.set_vr_help(out_msg_params[strings::vr_help]);
+ int32_t index = 0;
+
+ smart_objects::SmartObject so_default_vr_help(smart_objects::SmartType_Map);
+ so_default_vr_help[strings::position] = index + 1;
+ so_default_vr_help[strings::text] = app_.name();
+ out_msg_params[strings::vr_help][index++] = so_default_vr_help;
+
+ if (app_.vr_synonyms()) {
+ smart_objects::SmartObject item(smart_objects::SmartType_Map);
+ item[strings::text] = (*(app_.vr_synonyms())).getElement(0);
+ item[strings::position] = index + 1;
+ out_msg_params[strings::vr_help][index++] = item;
+ }
}
-}
+ app_.set_vr_help(out_msg_params[strings::vr_help]);
+} // namespace application_manager
void HelpPromptManagerImpl::SetSendingType(
const smart_objects::SmartObject& msg) {
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 07200af6cd..6dc3264ac0 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -50,6 +50,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
: hmi_app_id_(app->hmi_app_id())
, state_id_(state_id)
, app_mngr_(app_mngr)
+ , parent_(HmiStatePtr())
, window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
@@ -63,6 +64,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
: hmi_app_id_(app->hmi_app_id())
, state_id_(STATE_ID_REGULAR)
, app_mngr_(app_mngr)
+ , parent_(HmiStatePtr())
, window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 2e60bb2c66..d5d87a6a2f 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -383,13 +383,10 @@ MessageHelper::CreateUIResetGlobalPropertiesRequest(
smart_objects::SmartType_Map);
if (reset_result.vr_help_title_items) {
- smart_objects::SmartObjectSPtr vr_help = CreateAppVrHelp(application);
- if (!vr_help.get()) {
- SDL_LOG_WARN("Failed to create vr_help");
- return smart_objects::SmartObjectSPtr();
- } else {
- ui_reset_global_prop_request = vr_help;
- }
+ (*ui_reset_global_prop_request)[strings::vr_help_title] =
+ *(application->vr_help_title());
+ (*ui_reset_global_prop_request)[strings::vr_help] =
+ *(application->vr_help());
}
if (reset_result.menu_name) {
(*ui_reset_global_prop_request)[hmi_request::menu_title] = "";
@@ -740,11 +737,16 @@ void MessageHelper::SendDeleteChoiceSetRequest(smart_objects::SmartObject* cmd,
DCHECK_OR_RETURN_VOID(cmd);
using namespace smart_objects;
- SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
+ if (!cmd->keyExists(strings::grammar_id) ||
+ (*cmd)[strings::grammar_id].asInt() == -1) {
+ return;
+ }
+ SmartObject msg_params = SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = application->app_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
msg_params[strings::grammar_id] = (*cmd)[strings::grammar_id];
+
cmd = &((*cmd)[strings::choice_set]);
for (uint32_t i = 0; i < (*cmd).length(); ++i) {
msg_params[strings::cmd_id] = (*cmd)[i][strings::choice_id];
@@ -769,7 +771,10 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
using namespace smart_objects;
{
- SmartObject msg_params = *MessageHelper::CreateAppVrHelp(application);
+ auto& help_prompt_manager = application->help_prompt_manager();
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ help_prompt_manager.CreateVRMsg(msg_params);
+
msg_params[hmi_request::menu_title] = "";
smart_objects::SmartObject keyboard_properties =
@@ -1410,46 +1415,6 @@ void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app,
}
}
-smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
- ApplicationConstSharedPtr app) {
- smart_objects::SmartObjectSPtr result =
- std::make_shared<smart_objects::SmartObject>(
- smart_objects::SmartType_Map);
-
- smart_objects::SmartObject& vr_help = *result;
- const smart_objects::SmartObjectSPtr vr_help_title = app->vr_help_title();
- if (vr_help_title) {
- vr_help[strings::vr_help_title] = vr_help_title->asString();
- }
-
- int32_t index = 0;
-
- smart_objects::SmartObject so_vr_help(smart_objects::SmartType_Map);
- so_vr_help[strings::position] = index + 1;
- so_vr_help[strings::text] = app->name();
- vr_help[strings::vr_help][index++] = so_vr_help;
-
- if (app->vr_synonyms()) {
- smart_objects::SmartObject item(smart_objects::SmartType_Map);
- item[strings::text] = (*(app->vr_synonyms())).getElement(0);
- item[strings::position] = index + 1;
- vr_help[strings::vr_help][index++] = item;
- }
-
- // copy all app VR commands
- const DataAccessor<CommandsMap> cmd_accessor = app->commands_map();
- const CommandsMap& commands = cmd_accessor.GetData();
- CommandsMap::const_iterator it = commands.begin();
-
- for (; commands.end() != it; ++it) {
- smart_objects::SmartObject item(smart_objects::SmartType_Map);
- item[strings::text] = (*it->second)[strings::vr_commands][0].asString();
- item[strings::position] = index + 1;
- vr_help[strings::vr_help][index++] = item;
- }
- return result;
-}
-
smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
ApplicationConstSharedPtr app, const uint32_t correlation_id) {
smart_objects::SmartObjectList requests;
@@ -1567,6 +1532,7 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
smart_objects::SmartObjectList
MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ SDL_LOG_AUTO_TRACE();
smart_objects::SmartObjectList requests;
if (!app) {
SDL_LOG_ERROR("Invalid application");
@@ -1581,6 +1547,11 @@ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
(*(it->second))[strings::grammar_id].asUInt();
const size_t size = (*(it->second))[strings::choice_set].length();
for (size_t j = 0; j < size; ++j) {
+ if (!(*(it->second))[strings::choice_set][j].keyExists(
+ strings::vr_commands)) {
+ continue;
+ }
+
smart_objects::SmartObjectSPtr vr_command = CreateMessageForHMI(
hmi_apis::messageType::request, app_mngr.GetNextHMICorrelationID());
if (!vr_command) {
diff --git a/src/components/application_manager/src/request_controller_impl.cc b/src/components/application_manager/src/request_controller_impl.cc
index 79458566dc..e331ea89e9 100644
--- a/src/components/application_manager/src/request_controller_impl.cc
+++ b/src/components/application_manager/src/request_controller_impl.cc
@@ -72,6 +72,24 @@ RequestControllerImpl::RequestControllerImpl(
RequestControllerImpl::~RequestControllerImpl() {
SDL_LOG_AUTO_TRACE();
Stop();
+
+ retained_mobile_requests_.clear();
+
+ {
+ sync_primitives::AutoLock auto_lock_list(notification_list_lock_);
+ notification_list_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock auto_lock_list(duplicate_message_count_lock_);
+ duplicate_message_count_.clear();
+ }
+
+ {
+ sync_primitives::AutoLock auto_lock_list(mobile_request_list_lock_);
+ mobile_request_list_.clear();
+ waiting_for_response_.RemoveMobileRequests();
+ }
}
void RequestControllerImpl::Stop() {
@@ -111,7 +129,6 @@ void RequestControllerImpl::InitializeThreadpool() {
void RequestControllerImpl::DestroyThreadpool() {
SDL_LOG_AUTO_TRACE();
{
- AutoLock auto_lock(mobile_request_list_lock_);
pool_state_ = TPoolState::STOPPED;
SDL_LOG_DEBUG("Broadcasting STOP signal to all threads...");
cond_var_.Broadcast(); // notify all threads we are shutting down
@@ -159,7 +176,9 @@ bool RequestControllerImpl::CheckPendingRequestsAmount(
SDL_LOG_AUTO_TRACE();
if (pending_requests_amount > 0) {
+ mobile_request_list_lock_.Acquire();
const size_t pending_requests_size = mobile_request_list_.size();
+ mobile_request_list_lock_.Release();
const bool available_to_add =
pending_requests_amount > pending_requests_size;
if (!available_to_add) {
@@ -181,11 +200,12 @@ RequestController::TResult RequestControllerImpl::AddMobileRequest(
cond_var_.NotifyOne();
return TResult::INVALID_DATA;
}
+
SDL_LOG_DEBUG("correlation_id : " << request->correlation_id()
<< "connection_key : "
<< request->connection_key());
RequestController::TResult result = CheckPosibilitytoAdd(request, hmi_level);
- if (TResult::SUCCESS == result) {
+ if (TResult::SUCCESS == result && TPoolState::STOPPED != pool_state_) {
AutoLock auto_lock_list(mobile_request_list_lock_);
mobile_request_list_.push_back(request);
SDL_LOG_DEBUG("Waiting for execution: " << mobile_request_list_.size());
@@ -431,11 +451,13 @@ void RequestControllerImpl::TerminateWaitingForResponseAppRequests(
void RequestControllerImpl::TerminateAppRequests(const uint32_t app_id) {
SDL_LOG_AUTO_TRACE();
+ mobile_request_list_lock_.Acquire();
SDL_LOG_DEBUG("app_id : " << app_id
<< "Requests waiting for execution count : "
<< mobile_request_list_.size()
<< "Requests waiting for response count : "
<< waiting_for_response_.Size());
+ mobile_request_list_lock_.Release();
TerminateWaitingForExecutionAppRequests(app_id);
TerminateWaitingForResponseAppRequests(app_id);
@@ -452,8 +474,9 @@ void RequestControllerImpl::TerminateAllMobileRequests() {
waiting_for_response_.RemoveMobileRequests();
SDL_LOG_DEBUG("Mobile Requests waiting for response cleared");
- AutoLock waiting_execution_auto_lock(mobile_request_list_lock_);
+ mobile_request_list_lock_.Acquire();
mobile_request_list_.clear();
+ mobile_request_list_lock_.Release();
SDL_LOG_DEBUG("Mobile Requests waiting for execution cleared");
NotifyTimer();
}
@@ -590,27 +613,32 @@ RequestControllerImpl::Worker::~Worker() {}
void RequestControllerImpl::Worker::threadMain() {
SDL_LOG_AUTO_TRACE();
- AutoLock auto_lock(thread_lock_);
+ AutoLock auto_thread_lock_(thread_lock_);
while (!stop_flag_) {
// Try to pick a request
- AutoLock auto_lock(request_controller_->mobile_request_list_lock_);
+ request_controller_->mobile_request_list_lock_.Acquire();
while ((request_controller_->pool_state_ != TPoolState::STOPPED) &&
(request_controller_->mobile_request_list_.empty())) {
// Wait until there is a task in the queue
// Unlock mutex while wait, then lock it back when signaled
SDL_LOG_INFO("Unlocking and waiting");
- request_controller_->cond_var_.Wait(auto_lock);
+ request_controller_->cond_var_.Wait(
+ request_controller_->mobile_request_list_lock_);
SDL_LOG_INFO("Signaled and locking");
}
// If the thread was shutdown, return from here
if (request_controller_->pool_state_ == TPoolState::STOPPED) {
+ SDL_LOG_WARN("TPoolState::STOPPED");
+ request_controller_->mobile_request_list_.clear();
+ request_controller_->mobile_request_list_lock_.Release();
break;
}
if (request_controller_->mobile_request_list_.empty()) {
SDL_LOG_WARN("Mobile request list is empty");
+ request_controller_->mobile_request_list_lock_.Release();
break;
}
@@ -640,6 +668,7 @@ void RequestControllerImpl::Worker::threadMain() {
cmd_request->SendResponse(
false, mobile_apis::Result::INVALID_ID, "Duplicate correlation_id");
}
+ request_controller_->mobile_request_list_lock_.Release();
continue;
}
SDL_LOG_DEBUG("timeout_in_mseconds " << timeout_in_mseconds);
@@ -653,7 +682,7 @@ void RequestControllerImpl::Worker::threadMain() {
"of this request.");
}
- AutoUnlock unlock(auto_lock);
+ request_controller_->mobile_request_list_lock_.Release();
// execute
if ((false == request_controller_->IsLowVoltage()) &&
@@ -663,6 +692,12 @@ void RequestControllerImpl::Worker::threadMain() {
<< " with timeout: " << timeout_in_mseconds);
request_ptr->Run();
}
+ if (request_ptr->GetApplicationManager().IsStopping()) {
+ request_controller_->mobile_request_list_lock_.Acquire();
+ request_controller_->mobile_request_list_.clear();
+ request_controller_->waiting_for_response_.RemoveMobileRequests();
+ request_controller_->mobile_request_list_lock_.Release();
+ }
}
}
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index 96870c12c1..c74ccaf4a1 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -734,7 +734,7 @@ bool ResumeCtrlImpl::CheckDelayBeforeIgnOff(
return true;
}
- const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
+ const uint64_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
SDL_LOG_DEBUG(
"ign_off_time "
<< ign_off_time << "; app_disconnect_time " << time_stamp
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index 50b95dba42..0663237c43 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -163,7 +163,8 @@ smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions(
subscriptions);
}
- for (auto extension : application->Extensions()) {
+ auto extensions = application->Extensions();
+ for (auto& extension : extensions.GetData()) {
extension->SaveResumptionData(subscriptions);
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index eedfc48b73..ce68609ee9 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -356,7 +356,7 @@ bool ResumptionDataDB::RemoveApplicationFromSaved(
return result;
}
-uint32_t ResumptionDataDB::GetIgnOffTime() const {
+int64_t ResumptionDataDB::GetIgnOffTime() const {
SDL_LOG_AUTO_TRACE();
return SelectIgnOffTime();
}
@@ -533,14 +533,14 @@ bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id,
return false;
}
-uint32_t ResumptionDataDB::SelectIgnOffTime() const {
+int64_t ResumptionDataDB::SelectIgnOffTime() const {
SDL_LOG_AUTO_TRACE();
- uint32_t ignOffTime = 0;
+ int64_t ignOffTime = 0;
utils::dbms::SQLQuery query(db());
if (query.Prepare(kSelectIgnOffTime)) {
if (query.Exec()) {
- ignOffTime = query.GetUInteger(0);
+ ignOffTime = query.GetLongInt(0);
SDL_LOG_INFO("Last ign off time = " << ignOffTime);
return ignOffTime;
}
@@ -612,7 +612,7 @@ void ResumptionDataDB::SelectDataForLoadResumeData(
SmartObject so_obj(SmartType_Map);
so_obj[strings::hmi_level] = select_data.GetInteger(0);
so_obj[strings::ign_off_count] = select_data.GetInteger(1);
- so_obj[strings::time_stamp] = select_data.GetUInteger(2);
+ so_obj[strings::time_stamp] = select_data.GetLongInt(2);
so_obj[strings::app_id] = select_data.GetString(3);
so_obj[strings::device_id] = select_data.GetString(4);
so_array_data[i++] = so_obj;
@@ -1470,7 +1470,7 @@ bool ResumptionDataDB::SelectDataFromAppTable(
saved_app[strings::hmi_app_id] = query.GetUInteger(4);
saved_app[strings::hmi_level] = query.GetInteger(5);
saved_app[strings::ign_off_count] = query.GetInteger(6);
- saved_app[strings::time_stamp] = query.GetUInteger(7);
+ saved_app[strings::time_stamp] = query.GetLongInt(7);
saved_app[strings::device_id] = query.GetString(8);
saved_app[strings::is_media_application] = query.GetBoolean(9);
saved_app[strings::subscribed_for_way_points] = query.GetBoolean(10);
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index 5d6d008911..a2b99b4ac1 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -62,7 +62,7 @@ void ResumptionDataJson::SaveApplication(
<< " policy_app_id : " << policy_app_id);
const std::string hash = application->curHash();
const uint32_t grammar_id = application->get_grammar_id();
- const uint32_t time_stamp = (uint32_t)time(NULL);
+ const int64_t time_stamp = (int64_t)time(NULL);
const std::string device_mac = application->mac_address();
const mobile_apis::HMILevel::eType hmi_level =
application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
@@ -288,7 +288,7 @@ bool ResumptionDataJson::RemoveApplicationFromSaved(
return result;
}
-uint32_t ResumptionDataJson::GetIgnOffTime() const {
+int64_t ResumptionDataJson::GetIgnOffTime() const {
using namespace app_mngr;
SDL_LOG_AUTO_TRACE();
@@ -300,7 +300,7 @@ uint32_t ResumptionDataJson::GetIgnOffTime() const {
accessor.GetMutableData().set_dictionary(dictionary);
SDL_LOG_WARN("last_save_time section is missed");
}
- return resumption[strings::last_ign_off_time].asUInt();
+ return resumption[strings::last_ign_off_time].asInt64();
}
uint32_t ResumptionDataJson::GetGlobalIgnOnCounter() const {
@@ -399,7 +399,7 @@ void ResumptionDataJson::GetDataForLoadResumeData(
smart_objects::SmartObject so(smart_objects::SmartType_Map);
so[strings::hmi_level] = saved_app[strings::hmi_level].asInt();
so[strings::ign_off_count] = saved_app[strings::ign_off_count].asInt();
- so[strings::time_stamp] = saved_app[strings::time_stamp].asUInt();
+ so[strings::time_stamp] = saved_app[strings::time_stamp].asInt64();
so[strings::app_id] = saved_app[strings::app_id].asString();
so[strings::device_id] = saved_app[strings::device_id].asString();
so_array_data[i++] = so;
@@ -532,7 +532,7 @@ void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time,
SDL_LOG_WARN("ign_off_time = " << ign_off_time);
Json::Value& resumption = GetResumptionData(dictionary);
- resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time);
+ resumption[strings::last_ign_off_time] = static_cast<int64_t>(ign_off_time);
}
bool ResumptionDataJson::Init() {
diff --git a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
index b8462a533a..996b4f3026 100644
--- a/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_processor_impl.cc
@@ -178,7 +178,7 @@ void ResumptionDataProcessorImpl::ProcessResumptionStatus(
}
}
-void ResumptionDataProcessorImpl::EraseProcessedRequest(
+bool ResumptionDataProcessorImpl::EraseProcessedRequest(
const uint32_t app_id, const ResumptionRequest& found_request) {
SDL_LOG_AUTO_TRACE();
@@ -194,7 +194,11 @@ void ResumptionDataProcessorImpl::EraseProcessedRequest(
request.request_id.function_id ==
found_request.request_id.function_id;
});
- list_of_sent_requests.erase(request_iter);
+ if (request_iter != list_of_sent_requests.end()) {
+ list_of_sent_requests.erase(request_iter);
+ return true;
+ }
+ return false;
}
bool ResumptionDataProcessorImpl::IsResumptionFinished(
@@ -285,6 +289,7 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI(
SDL_LOG_DEBUG("app_id is: " << app_id);
auto found_request = GetRequest(app_id, function_id, corr_id);
+
if (!found_request) {
SDL_LOG_ERROR("Request with function id " << function_id << " and corr id "
<< corr_id << " not found");
@@ -293,7 +298,11 @@ void ResumptionDataProcessorImpl::ProcessResponseFromHMI(
auto request = *found_request;
ProcessResumptionStatus(app_id, response, request);
- EraseProcessedRequest(app_id, request);
+
+ if (!EraseProcessedRequest(app_id, request)) {
+ SDL_LOG_DEBUG("Request has already been processed");
+ return;
+ }
if (!IsResumptionFinished(app_id)) {
SDL_LOG_DEBUG("Resumption app "
@@ -890,7 +899,8 @@ void ResumptionDataProcessorImpl::AddPluginsSubscriptions(
const smart_objects::SmartObject& saved_app) {
SDL_LOG_AUTO_TRACE();
- for (auto& extension : application->Extensions()) {
+ auto extensions = application->Extensions();
+ for (auto& extension : extensions.GetData()) {
extension->ProcessResumption(saved_app);
}
}
@@ -995,7 +1005,7 @@ void ResumptionDataProcessorImpl::DeletePluginsSubscriptions(
resumption_status_lock_.Release();
auto extensions = application->Extensions();
- for (auto& extension : extensions) {
+ for (auto& extension : extensions.GetData()) {
extension->RevertResumption(resumption_data_to_revert);
}
}
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index b6b9f2e16b..3e0a600d72 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -212,7 +212,7 @@ void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
SDL_LOG_ERROR("Null-pointer message received.");
return;
}
- if (app_manager_.is_stopping()) {
+ if (app_manager_.IsStopping()) {
SDL_LOG_INFO("Application manager is stopping");
return;
}
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index 28146a1adc..9880edb4a1 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -112,20 +112,7 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
resolved_state->hmi_level());
if (request_hmi_state_change) {
- const int64_t result = RequestHMIStateChange(app, hmi_level, true);
- if (-1 != result) {
- const uint32_t corr_id = static_cast<uint32_t>(result);
-
- subscribe_on_event(
- hmi_apis::FunctionID::BasicCommunication_CloseApplication, corr_id);
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- corr_id);
-
- waiting_for_response_[app->app_id()] = resolved_state;
- app_mngr_.set_application_id(corr_id, app->hmi_app_id());
- return;
- }
- SDL_LOG_ERROR("Unable to send BC.ActivateApp");
+ RequestHMIStateChange(app, resolved_state, hmi_level, true);
return;
}
ApplyRegularState(app, window_id, resolved_state);
@@ -1104,8 +1091,9 @@ void StateControllerImpl::OnAppWindowAdded(
OnStateChanged(app, window_id, initial_state, new_state);
}
-int64_t StateControllerImpl::RequestHMIStateChange(
+void StateControllerImpl::RequestHMIStateChange(
ApplicationConstSharedPtr app,
+ HmiStatePtr resolved_state,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority) {
SDL_LOG_AUTO_TRACE();
@@ -1122,15 +1110,21 @@ int64_t StateControllerImpl::RequestHMIStateChange(
}
if (!request) {
SDL_LOG_ERROR("Unable to create request");
- return -1;
+ return;
}
+
+ const uint32_t corr_id =
+ (*request)[strings::params][strings::correlation_id].asUInt();
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_CloseApplication,
+ corr_id);
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
+ corr_id);
+ waiting_for_response_[app->app_id()] = resolved_state;
+ app_mngr_.set_application_id(corr_id, app->hmi_app_id());
+
if (!app_mngr_.GetRPCService().ManageHMICommand(request)) {
SDL_LOG_ERROR("Unable to send request");
- return -1;
}
- const uint32_t corr_id =
- (*request)[strings::params][strings::correlation_id].asUInt();
- return static_cast<int64_t>(corr_id);
}
void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index e94ffa5961..5568db4dd1 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -404,8 +404,9 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(AddExtension,
bool(application_manager::AppExtensionPtr extention));
MOCK_METHOD1(RemoveExtension, bool(application_manager::AppExtensionUID uid));
- MOCK_CONST_METHOD0(Extensions,
- const std::list<application_manager::AppExtensionPtr>&());
+ MOCK_CONST_METHOD0(
+ Extensions,
+ const DataAccessor<std::list<application_manager::AppExtensionPtr> >());
MOCK_CONST_METHOD0(is_remote_control_supported, bool());
MOCK_METHOD1(set_remote_control_supported, void(const bool allow));
MOCK_CONST_METHOD0(cloud_app_endpoint, const std::string&());
diff --git a/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h b/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h
index b44345deff..74f40c7613 100644
--- a/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h
+++ b/src/components/application_manager/test/include/application_manager/mock_help_prompt_manager.h
@@ -51,7 +51,13 @@ class MockHelpPromptManager : public ::application_manager::HelpPromptManager {
void(uint32_t cmd_id, const bool should_send_requests));
MOCK_METHOD2(OnSetGlobalPropertiesReceived,
void(const smart_objects::SmartObject& msg, bool is_response));
+ MOCK_METHOD1(OnResetGlobalPropertiesReceived,
+ void(const smart_objects::SmartObject& msg));
+
MOCK_CONST_METHOD0(GetSendingType, SendingType());
+ MOCK_METHOD1(CreatePromptMsg,
+ void(smart_objects::SmartObject& out_msg_params));
+ MOCK_METHOD1(CreateVRMsg, void(smart_objects::SmartObject& out_msg_params));
};
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index 67d992d4af..0892a47f8c 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -312,8 +312,6 @@ class MockMessageHelper {
MOCK_METHOD2(SendQueryApps,
void(const uint32_t connection_key,
ApplicationManager& app_man));
- MOCK_METHOD1(CreateAppVrHelp,
- smart_objects::SmartObjectSPtr(ApplicationConstSharedPtr app));
MOCK_METHOD3(VerifyImageVrHelpItems,
mobile_apis::Result::eType(smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h
index 4348e39020..098002f15d 100644
--- a/src/components/application_manager/test/include/application_manager/mock_request.h
+++ b/src/components/application_manager/test/include/application_manager/mock_request.h
@@ -63,6 +63,8 @@ class MockRequest : public application_manager::commands::Command {
MOCK_METHOD0(AllowedToTerminate, bool());
MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed));
+ MOCK_CONST_METHOD0(GetApplicationManager,
+ application_manager::ApplicationManager&());
MOCK_CONST_METHOD0(connection_key, uint32_t());
MOCK_CONST_METHOD0(correlation_id, uint32_t());
};
diff --git a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
index 7cabc12086..b99ce11619 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resumption_data.h
@@ -78,7 +78,7 @@ class MockResumptionData : public ::resumption::ResumptionData {
MOCK_METHOD2(RemoveApplicationFromSaved,
bool(const std::string& policy_app_id,
const std::string& device_id));
- MOCK_CONST_METHOD0(GetIgnOffTime, uint32_t());
+ MOCK_CONST_METHOD0(GetIgnOffTime, int64_t());
MOCK_CONST_METHOD2(IsApplicationSaved,
ssize_t(const std::string& policy_app_id,
const std::string& device_id));
diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index bea920e44e..93fa6bcae9 100644
--- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
@@ -75,6 +75,7 @@ class ResumptionDataTest : public ::testing::Test {
, setlock_ptr_(std::make_shared<sync_primitives::Lock>())
, btnlock_ptr_(std::make_shared<sync_primitives::Lock>())
, ivilock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , extensions_lock_(std::make_shared<sync_primitives::RecursiveLock>())
, window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {
}
virtual ~ResumptionDataTest();
@@ -162,6 +163,7 @@ class ResumptionDataTest : public ::testing::Test {
std::shared_ptr<sync_primitives::Lock> setlock_ptr_;
std::shared_ptr<sync_primitives::Lock> btnlock_ptr_;
std::shared_ptr<sync_primitives::Lock> ivilock_ptr_;
+ std::shared_ptr<sync_primitives::RecursiveLock> extensions_lock_;
std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 9212b0feab..16e696a3bd 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -479,11 +479,6 @@ void MessageHelper::SendQueryApps(const uint32_t connection_key,
app_man);
}
-smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
- ApplicationConstSharedPtr app) {
- return MockMessageHelper::message_helper_mock()->CreateAppVrHelp(app);
-}
-
mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
smart_objects::SmartObject& message,
ApplicationConstSharedPtr app,
diff --git a/src/components/application_manager/test/request_controller/request_controller_test.cc b/src/components/application_manager/test/request_controller/request_controller_test.cc
index 2de2a69cf7..796df0810f 100644
--- a/src/components/application_manager/test/request_controller/request_controller_test.cc
+++ b/src/components/application_manager/test/request_controller/request_controller_test.cc
@@ -45,7 +45,6 @@
#include "application_manager/event_engine/event_dispatcher.h"
#include "application_manager/mock_application_manager.h"
-#include "application_manager/mock_application_manager.h"
#include "application_manager/mock_request_controller_settings.h"
#include "application_manager/mock_request_timeout_handler.h"
#include "application_manager/policies/policy_handler.h"
@@ -62,10 +61,12 @@ namespace request_controller_test {
using ::application_manager::request_controller::RequestController;
using ::application_manager::request_controller::RequestControllerImpl;
using ::application_manager::request_controller::RequestInfo;
+using ::test::components::application_manager_test::MockApplicationManager;
using test::components::application_manager_test::MockRequestTimeoutHandler;
using ::test::components::event_engine_test::MockEventDispatcher;
using ::testing::_;
+using ::testing::DoAll;
using ::testing::NiceMock;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -168,6 +169,7 @@ class RequestControllerTestClass : public ::testing::Test {
RequestControllerSPtr request_ctrl_;
RequestPtr empty_mock_request_;
const TestSettings default_settings_;
+ NiceMock<MockApplicationManager> app_mngr_;
};
TEST_F(RequestControllerTestClass,
@@ -179,13 +181,20 @@ TEST_F(RequestControllerTestClass,
EXPECT_CALL(*request_valid, Run())
.Times(1)
.WillRepeatedly(NotifyTestAsyncWaiter(waiter_valid));
+ EXPECT_CALL(*request_valid, GetApplicationManager())
+ .Times(1)
+ .WillRepeatedly(ReturnRef(app_mngr_));
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .Times(1)
+ .WillRepeatedly(
+ DoAll(NotifyTestAsyncWaiter(waiter_valid), Return(false)));
EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
request_valid,
RequestInfo::RequestType::MobileRequest,
mobile_apis::HMILevel::HMI_NONE));
- EXPECT_TRUE(waiter_valid->WaitFor(1, 1000));
+ EXPECT_TRUE(waiter_valid->WaitFor(2, 1000));
// The command should not be run if another command with the same
// correlation_id is waiting for a response
@@ -206,43 +215,25 @@ TEST_F(RequestControllerTestClass,
TEST_F(RequestControllerTestClass,
CheckPosibilitytoAdd_ZeroValueLimiters_SUCCESS) {
+ auto waiter_valid = TestAsyncWaiter::createInstance();
// Test case than pending_requests_amount,
// app_time_scale_max_requests_ and
// app_hmi_level_none_time_scale_max_requests_ equals 0
// (in the default settings they setted to 0)
for (size_t i = 0; i < kMaxRequestAmount; ++i) {
+ RequestPtr request_valid = GetMockRequest(i);
+ EXPECT_CALL(*request_valid, GetApplicationManager())
+ .WillRepeatedly(ReturnRef(app_mngr_));
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .WillRepeatedly(
+ DoAll(NotifyTestAsyncWaiter(waiter_valid), Return(false)));
EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
- GetMockRequest(i),
- RequestInfo::RequestType::MobileRequest,
- mobile_apis::HMILevel::HMI_FULL));
- }
-}
-
-TEST_F(
- RequestControllerTestClass,
- CheckPosibilitytoAdd_ExcessPendingRequestsAmount_TooManyPendingRequests) {
- TestSettings settings;
- settings.pending_requests_amount_ = kNumberOfRequests;
-
- request_ctrl_->DestroyThreadpool();
-
- // Adding requests to fit in pending_requests_amount_
- for (size_t i = 0; i < kNumberOfRequests; ++i) {
- EXPECT_EQ(RequestController::TResult::SUCCESS,
- AddRequest(settings,
- GetMockRequest(),
+ request_valid,
RequestInfo::RequestType::MobileRequest,
mobile_apis::HMILevel::HMI_FULL));
}
-
- // Trying to add one more extra request
- // Expect overflow and TOO_MANY_PENDING_REQUESTS result
- EXPECT_EQ(RequestController::TResult::TOO_MANY_PENDING_REQUESTS,
- AddRequest(settings,
- GetMockRequest(),
- RequestInfo::RequestType::MobileRequest,
- mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_TRUE(waiter_valid->WaitFor(kMaxRequestAmount, 1000));
}
TEST_F(RequestControllerTestClass, IsLowVoltage_SetOnLowVoltage_TRUE) {
@@ -258,11 +249,26 @@ TEST_F(RequestControllerTestClass, IsLowVoltage_SetOnWakeUp_FALSE) {
}
TEST_F(RequestControllerTestClass, AddMobileRequest_SetValidData_SUCCESS) {
+ RequestPtr request_valid = GetMockRequest();
+ auto waiter_valid = TestAsyncWaiter::createInstance();
+ ON_CALL(*request_valid, default_timeout()).WillByDefault(Return(0));
+ EXPECT_CALL(*request_valid, Init()).WillOnce(Return(true));
+ EXPECT_CALL(*request_valid, Run())
+ .Times(1)
+ .WillRepeatedly(NotifyTestAsyncWaiter(waiter_valid));
+ EXPECT_CALL(*request_valid, GetApplicationManager())
+ .Times(1)
+ .WillRepeatedly(ReturnRef(app_mngr_));
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .Times(1)
+ .WillRepeatedly(
+ DoAll(NotifyTestAsyncWaiter(waiter_valid), Return(false)));
EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
- GetMockRequest(),
+ request_valid,
RequestInfo::RequestType::MobileRequest,
mobile_apis::HMILevel::HMI_FULL));
+ EXPECT_TRUE(waiter_valid->WaitFor(2, 1000));
}
TEST_F(RequestControllerTestClass,
@@ -292,18 +298,23 @@ TEST_F(RequestControllerTestClass, OnTimer_SUCCESS) {
const uint32_t request_timeout = 1u;
RequestPtr mock_request = GetMockRequest(
kDefaultCorrelationID, kDefaultConnectionKey, request_timeout);
-
auto waiter = TestAsyncWaiter::createInstance();
+ EXPECT_CALL(*mock_request, GetApplicationManager())
+ .Times(1)
+ .WillRepeatedly(ReturnRef(app_mngr_));
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .Times(1)
+ .WillRepeatedly(DoAll(NotifyTestAsyncWaiter(waiter), Return(false)));
+ EXPECT_CALL(*mock_request, HandleTimeOut())
+ .WillOnce(NotifyTestAsyncWaiter(waiter));
+
EXPECT_EQ(RequestController::TResult::SUCCESS,
AddRequest(default_settings_,
mock_request,
RequestInfo::RequestType::MobileRequest));
- EXPECT_CALL(*mock_request, HandleTimeOut())
- .WillOnce(NotifyTestAsyncWaiter(waiter));
-
// Waiting for call of `onTimeOut` for `kTimeScale` seconds
- EXPECT_TRUE(waiter->WaitFor(1, kTimeScale));
+ EXPECT_TRUE(waiter->WaitFor(2, kTimeScale));
}
} // namespace request_controller_test
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index 1ff04c332c..058be224a7 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -98,7 +98,8 @@ class ResumeCtrlTest : public ::testing::Test {
, kDefaultDeferredTestLevel_(eType::INVALID_ENUM)
, kNaviLowbandwidthLevel_("LIMITED")
, kProjectionLowbandwidthLevel_("NONE")
- , kMediaLowbandwidthLevel_("NONE") {
+ , kMediaLowbandwidthLevel_("NONE")
+ , extensions_lock_(std::make_shared<sync_primitives::RecursiveLock>()) {
profile::Profile profile_;
profile_.set_config_file_name("smartDeviceLink.ini");
resumption_delay_before_ign_ = profile_.resumption_delay_before_ign();
@@ -245,6 +246,7 @@ class ResumeCtrlTest : public ::testing::Test {
const std::string kMediaLowbandwidthLevel_;
NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
resumption::ResumeCtrl::ResumptionCallBack callback_;
+ std::shared_ptr<sync_primitives::RecursiveLock> extensions_lock_;
};
/**
@@ -327,7 +329,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
.WillRepeatedly(Return(requests));
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app_, set_grammar_id(kTestGrammarId_));
for (uint32_t i = 0; i < count_of_files; ++i) {
EXPECT_CALL(*mock_app_,
@@ -387,7 +391,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) {
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
@@ -461,7 +467,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
.WillRepeatedly(Return(requests));
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
@@ -521,7 +529,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
@@ -560,9 +570,12 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) {
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
CreateAddCommandRequestToHMI(_, _))
.WillRepeatedly(Return(requests));
+
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
EXPECT_TRUE(res);
}
@@ -613,8 +626,9 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
std::list<application_manager::AppExtensionPtr> extensions;
extensions.insert(extensions.begin(), mock_app_extension_);
-
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app_extension_, ProcessResumption(saved_app));
EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
@@ -660,10 +674,11 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
smart_objects::SmartObjectList requests;
std::list<application_manager::AppExtensionPtr> extensions;
-
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions, extensions_lock_);
+ EXPECT_CALL(*mock_app_, Extensions()).WillOnce(Return(accessor));
EXPECT_CALL(*mock_app_extension_, ProcessResumption(saved_app));
const bool res = res_ctrl_->StartResumption(mock_app_, kHash_, callback_);
@@ -693,7 +708,6 @@ TEST_F(ResumeCtrlTest,
std::list<application_manager::AppExtensionPtr> extensions;
// It will work only for WayPointsAppExtension, need to rework this test
extensions.insert(extensions.begin(), mock_app_extension_);
- EXPECT_CALL(*mock_app_, Extensions()).WillOnce(ReturnRef(extensions));
EXPECT_CALL(mock_app_mngr_,
SubscribeAppForWayPoints(
@@ -752,8 +766,8 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInFull) {
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
uint32_t ign_off_count = 0;
smart_objects::SmartObject saved_app;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -808,8 +822,8 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppHasDeferredResumption) {
mobile_apis::HMILevel::eType deferred_level = eType::HMI_FULL;
uint32_t ign_off_count = 0;
smart_objects::SmartObject saved_app;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -848,8 +862,8 @@ TEST_F(ResumeCtrlTest,
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
uint32_t ign_off_count = 0;
smart_objects::SmartObject saved_app;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -894,8 +908,8 @@ TEST_F(
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_LIMITED;
uint32_t ign_off_count = 0;
smart_objects::SmartObject saved_app;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -1041,8 +1055,8 @@ TEST_F(ResumeCtrlTest, ApplicationResumptionTimer_AppInFull) {
mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
const uint32_t ign_off_count = 0u;
smart_objects::SmartObject saved_app;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
saved_app[application_manager::strings::ign_off_count] = ign_off_count;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -1387,8 +1401,8 @@ TEST_F(
ResumeCtrlTest,
ResumptionLowVoltage_AppInFullUnregisteredWithinTimeFrame_HMILevelRestored) {
const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -1434,8 +1448,8 @@ TEST_F(
ResumeCtrlTest,
ResumptionLowVoltage_AppInFullUnregisteredBeyondTimeFrame_HMILevelNotRestored) {
const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_FULL;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ - time_offset;
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -1473,8 +1487,8 @@ TEST_F(
TEST_F(ResumeCtrlTest, ResumptionLowVoltage_AppInBackground_NotRestored) {
const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_BACKGROUND;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ - time_offset;
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -1501,8 +1515,8 @@ TEST_F(
ResumeCtrlTest,
ResumptionLowVoltage_AppInLimitedlUnregisteredWithinTimeFrame_HMILevelRestored) {
const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_LIMITED;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ + time_offset;
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
@@ -1548,8 +1562,8 @@ TEST_F(
ResumeCtrlTest,
ResumptionLowVoltage_AppInLimitedlUnregisteredBeyondTimeFrame_HMILevelNotRestored) {
const mobile_apis::HMILevel::eType restored_test_type = eType::HMI_LIMITED;
- const uint32_t time_offset = 5;
- const uint32_t time_stamp =
+ const int64_t time_offset = 5;
+ const int64_t time_stamp =
time(nullptr) - resumption_delay_before_ign_ - time_offset;
smart_objects::SmartObject saved_app;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
diff --git a/src/components/application_manager/test/resumption/resumption_data_db_test.cc b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
index ec390e4be0..9f7058bec2 100644
--- a/src/components/application_manager/test/resumption/resumption_data_db_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_db_test.cc
@@ -846,7 +846,7 @@ TEST_F(ResumptionDataDBTest, GetIgnOffTime_AfterSuspendAndAwake) {
PrepareData();
EXPECT_TRUE(res_db()->Init());
SetZeroIgnOffTime();
- uint32_t last_ign_off_time;
+ int64_t last_ign_off_time;
EXPECT_CALL(*mock_app_extension_, SaveResumptionData(_));
res_db()->SaveApplication(app_mock);
@@ -856,11 +856,11 @@ TEST_F(ResumptionDataDBTest, GetIgnOffTime_AfterSuspendAndAwake) {
res_db()->IncrementIgnOffCount();
- uint32_t after_suspend;
+ int64_t after_suspend;
after_suspend = res_db()->GetIgnOffTime();
EXPECT_LE(last_ign_off_time, after_suspend);
- uint32_t after_awake;
+ int64_t after_awake;
res_db()->DecrementIgnOffCount();
after_awake = res_db()->GetIgnOffTime();
diff --git a/src/components/application_manager/test/resumption/resumption_data_json_test.cc b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
index 9d348ecbb7..24904dbce0 100644
--- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_json_test.cc
@@ -360,7 +360,7 @@ TEST_F(ResumptionDataJsonTest, GetHashId) {
}
TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) {
- uint32_t last_ign_off_time;
+ int64_t last_ign_off_time;
PrepareData();
SetZeroIgnOff();
EXPECT_CALL(*mock_app_extension_, SaveResumptionData(_));
@@ -371,11 +371,11 @@ TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) {
res_json.IncrementIgnOffCount();
- uint32_t after_suspend;
+ int64_t after_suspend;
after_suspend = res_json.GetIgnOffTime();
EXPECT_LE(last_ign_off_time, after_suspend);
- uint32_t after_awake;
+ int64_t after_awake;
res_json.DecrementIgnOffCount();
after_awake = res_json.GetIgnOffTime();
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc
index cb5a4d9a56..603af4ca47 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -383,7 +383,9 @@ void ResumptionDataTest::PrepareData() {
mock_app_extension_ =
std::make_shared<NiceMock<application_manager_test::MockAppExtension> >();
extensions_.insert(extensions_.begin(), mock_app_extension_);
- ON_CALL(*app_mock, Extensions()).WillByDefault(ReturnRef(extensions_));
+ DataAccessor<std::list<application_manager::AppExtensionPtr> > accessor(
+ extensions_, extensions_lock_);
+ ON_CALL(*app_mock, Extensions()).WillByDefault(Return(accessor));
SetGlobalProporties();
SetCommands();
SetSubmenues();
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index b6ec4fc8ef..f255223136 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -3654,7 +3654,11 @@ TEST_F(StateControllerImplTest,
static_cast<hmi_apis::Common_HMILevel::eType>(new_state->hmi_level()),
kCorrID);
- smart_objects::SmartObjectSPtr bc_activate_app_request;
+ smart_objects::SmartObjectSPtr bc_activate_app_request =
+ std::make_shared<smart_objects::SmartObject>();
+ (*bc_activate_app_request)[am::strings::params][am::strings::correlation_id] =
+ kCorrID;
+
EXPECT_CALL(message_helper_mock_, GetBCActivateAppRequestToHMI(_, _, _, _, _))
.WillOnce(Return(bc_activate_app_request));
EXPECT_CALL(*simple_app_ptr_, SetRegularState(_, _)).Times(0);
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index a0092b93df..9c19059863 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -512,7 +512,6 @@ class ApplicationManager {
get_request_timeout_handler() const = 0;
virtual request_controller::RequestController& get_request_controller()
const = 0;
- virtual bool is_stopping() const = 0;
virtual bool is_audio_pass_thru_active() const = 0;
virtual uint32_t GetNextMobileCorrelationID() = 0;
diff --git a/src/components/include/test/application_manager/mock_application_manager.h b/src/components/include/test/application_manager/mock_application_manager.h
index dfc9cbab5a..1161009feb 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -197,7 +197,7 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(
get_request_controller,
application_manager::request_controller::RequestController&());
- MOCK_CONST_METHOD0(is_stopping, bool());
+ MOCK_CONST_METHOD0(IsStopping, bool());
MOCK_CONST_METHOD0(is_audio_pass_thru_active, bool());
MOCK_METHOD0(GetNextHMICorrelationID, uint32_t());
MOCK_METHOD0(GetNextMobileCorrelationID, uint32_t());
@@ -236,7 +236,6 @@ class MockApplicationManager : public application_manager::ApplicationManager {
bool is_greyed_out));
MOCK_CONST_METHOD1(IsAppsQueriedFrom,
bool(const connection_handler::DeviceHandle handle));
- MOCK_CONST_METHOD0(IsStopping, bool());
MOCK_METHOD0(WaitForHmiIsReady, bool());
MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList,
void(const uint32_t app_id));
diff --git a/src/components/policy/policy_external/include/policy/policy_manager_impl.h b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
index 7822cc26f6..720f2e590f 100644
--- a/src/components/policy/policy_external/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_external/include/policy/policy_manager_impl.h
@@ -1271,6 +1271,11 @@ class PolicyManagerImpl : public PolicyManager {
sync_primitives::Lock policy_table_lock_;
/**
+ * @brief lock guard for protecting policy table exchange
+ */
+ sync_primitives::Lock policy_table_exchange_lock_;
+
+ /**
* @brief lock guard for protecting application permissions access
*/
sync_primitives::Lock app_permissions_diff_lock_;
diff --git a/src/components/policy/policy_external/src/policy_manager_impl.cc b/src/components/policy/policy_external/src/policy_manager_impl.cc
index 60ab5a389e..1cf556946c 100644
--- a/src/components/policy/policy_external/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_external/src/policy_manager_impl.cc
@@ -747,6 +747,9 @@ void PolicyManagerImpl::StartPTExchange() {
return;
}
+ sync_primitives::AutoLock policy_table_exchange_lock(
+ policy_table_exchange_lock_);
+
if (update_status_manager_.IsUpdatePending()) {
if (trigger_ptu_) {
update_status_manager_.ScheduleUpdate();
diff --git a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
index 16ab9417bb..ac57738ca0 100644
--- a/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
+++ b/src/components/policy/policy_regular/include/policy/policy_manager_impl.h
@@ -1108,6 +1108,11 @@ class PolicyManagerImpl : public PolicyManager {
sync_primitives::Lock policy_table_lock_;
/**
+ * @brief lock guard for protecting policy table exchange
+ */
+ sync_primitives::Lock policy_table_exchange_lock_;
+
+ /**
* @brief lock guard for protecting application permissions access
*/
sync_primitives::Lock app_permissions_diff_lock_;
diff --git a/src/components/policy/policy_regular/src/policy_manager_impl.cc b/src/components/policy/policy_regular/src/policy_manager_impl.cc
index ccc3454708..b80367b647 100644
--- a/src/components/policy/policy_regular/src/policy_manager_impl.cc
+++ b/src/components/policy/policy_regular/src/policy_manager_impl.cc
@@ -629,6 +629,9 @@ void PolicyManagerImpl::StartPTExchange() {
return;
}
+ sync_primitives::AutoLock policy_table_exchange_lock(
+ policy_table_exchange_lock_);
+
if (update_status_manager_.IsUpdatePending() && update_required) {
if (trigger_ptu_)
update_status_manager_.ScheduleUpdate();
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
index c6412fe141..d335987a52 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
@@ -137,6 +137,7 @@ void TransportAdapterImpl::Terminate() {
connections_lock_.AcquireForWriting();
std::swap(connections, connections_);
connections_lock_.Release();
+
for (const auto& connection : connections) {
auto& info = connection.second;
if (info.connection) {
diff --git a/src/components/transport_manager/test/test_certs/ca-cert.pem b/src/components/transport_manager/test/test_certs/ca-cert.pem
index e28684043c..2ec5d01454 100644
--- a/src/components/transport_manager/test/test_certs/ca-cert.pem
+++ b/src/components/transport_manager/test/test_certs/ca-cert.pem
@@ -1,23 +1,29 @@
-----BEGIN CERTIFICATE-----
-MIIDyzCCArOgAwIBAgIJAM6Tk4KJmUgsMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNV
-BAYTAlVBMQ8wDQYDVQQIDAZPZGVzc2ExDzANBgNVBAcMBk9kZXNzYTEPMA0GA1UE
-CgwGTHV4b2Z0MQ0wCwYDVQQLDARGVENOMQ8wDQYDVQQDDAZMdXgtQ0ExGjAYBgkq
-hkiG9w0BCQEWC2NhQGZ0Y24uY29tMB4XDTIwMDExMDE0MzA1OFoXDTIyMTAwNjE0
-MzA1OFowfDELMAkGA1UEBhMCVUExDzANBgNVBAgMBk9kZXNzYTEPMA0GA1UEBwwG
-T2Rlc3NhMQ8wDQYDVQQKDAZMdXhvZnQxDTALBgNVBAsMBEZUQ04xDzANBgNVBAMM
-Bkx1eC1DQTEaMBgGCSqGSIb3DQEJARYLY2FAZnRjbi5jb20wggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQDWEz7yGIAEs6w/7CdMjkZ5J0O9IghL0f9wZVFO
-ficeREJglClInPrD7BwG7MG1tydPULbrf1rXgxi1NdDY+lsJLFmkxrGVlgJUJl55
-cGpWGliTUepfPz/6CgIabRw2fEMx/eIUlcE+WjY+f4uowVyRYjmNj7IydlQ5UjcL
-wWhjg1QMcjgmDzh8Jdx8I+JHYuOP9CtEEfFZy5DjVPFDSlTYhhnNclfw+4NkOYcs
-hp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WFpSloQEjUQ6z+UE2VZkKEAQr2iychbDd7swTGccq3ZbUWRwcK
+9o7D6oKdM73ULl3JcNU2PM+fjlPT41qA4mpOlDmSZ83q0ZQi4dhoQXfHczFRjEZa
+VUz5eu3R7AvdgdgfNjtJPMQPNRX5XHuIO+RU3LqX6GYt5NMdcpCVPB5WyDmxzL85
+UuBaPBVk0gqgxEIbAfMNSN+rOWIrD/4gtKX9GRdavQWxb3Q=
-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/client-cert.pem b/src/components/transport_manager/test/test_certs/client-cert.pem
index 47e85876c8..20cad042b5 100644
--- a/src/components/transport_manager/test/test_certs/client-cert.pem
+++ b/src/components/transport_manager/test/test_certs/client-cert.pem
@@ -1,21 +1,28 @@
-----BEGIN CERTIFICATE-----
-MIIDeDCCAmACAQIwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVUExDzANBgNV
-BAgMBk9kZXNzYTEPMA0GA1UEBwwGT2Rlc3NhMQ8wDQYDVQQKDAZMdXhvZnQxDTAL
-BgNVBAsMBEZUQ04xDzANBgNVBAMMBkx1eC1DQTEaMBgGCSqGSIb3DQEJARYLY2FA
-ZnRjbi5jb20wHhcNMjAwMTEwMTQzODQxWhcNMjIxMDA2MTQzODQxWjCBhzELMAkG
-A1UEBhMCVUExDTALBgNVBAgMBEt5aXYxDTALBgNVBAcMBEt5aXYxDzANBgNVBAoM
-Bkx1eG9mdDEVMBMGA1UECwwMQXBwc0VueXdoZXJlMRIwEAYDVQQDDAlsb2NhbGhv
-c3QxHjAcBgkqhkiG9w0BCQEWD2NsaWVudEBmdGNuLmNvbTCCASIwDQYJKoZIhvcN
-AQEBBQADggEPADCCAQoCggEBALV4qI/gRvVip3u5JtT+n+7j7gUsUVW5DtwHruIy
-drzNvQbG1Ukd3EXvU69HTG4BtoDRubqlSe/sjvO5Ypmg/UvpzV36IbjrA46s98uR
-T6fKpJU/Zl2zwAHH++iWpFo3mqIDmu7i0KVBieKaGpz+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rANrd2wN2FdlxOne8+QVTG00IjbVt
+LX0smirf7u/n9Xt7g3e4nXWDHFH0YUVeBK6hhup+d1cX95PRXkBKUcUMAeC2Iooi
+m84eng==
-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/client-key.pem b/src/components/transport_manager/test/test_certs/client-key.pem
index b286854bd5..dab1425b31 100644
--- a/src/components/transport_manager/test/test_certs/client-key.pem
+++ b/src/components/transport_manager/test/test_certs/client-key.pem
@@ -1,28 +1,52 @@
-----BEGIN PRIVATE KEY-----
-MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC1eKiP4Eb1Yqd7
-uSbU/p/u4+4FLFFVuQ7cB67iMna8zb0GxtVJHdxF71OvR0xuAbaA0bm6pUnv7I7z
-uWKZoP1L6c1d+iG46wOOrPfLkU+nyqSVP2Zds8ABx/volqRaN5qiA5ru4tClQYni
-mhqc/hbdM4e8BwM7Uu2+jI57OEMp6YwzvomiyGh6gY3NYS5/HSAVzaJTrS7vBfAi
-+0S0aVj9iNhZNpNPkOWCmo24pYKbQOd1LuecAgVS0zn1GM02qxsEtNPu7cS2NOoN
-sdtBRw/FEMXwiu5EgHmcEjZG7UlIV3PTllL09boIG9v8ARyTd38I+8uqb81Ccu6d
-PdtdocO1AgMBAAECggEALiPCf+pfQE7YFJ4L4IXo9h1fzFLrTydhPtJ5RavdAr4w
-vINbgV6lPebO2TcAmMu4smIgnfMerHDyG8fb6QHExUNp4uYRIuomGmWiD1Ef9qKQ
-XB4lkdd9Dzbgts9udD3FBEJ0Zx6mPA5A16uk7puwBofukAEccj3wks08ANpaQVJh
-LoYQdVY9Q2QHUucED9uO2hOv66bDM5aunk0x4Q/b0gIOAnJyqk0xXnmnU76FbkgI
-bU3YQ73ZEJKTFLF8B2JaE9REASmHyLQChYqGA9SPdObVhgxJ8gz5AWp5yHgMmYjf
-Dp66tCsyGnmfgTlG4Wi13HInxLpRWDWT2JWIy9cUlQKBgQDshRq/rTj4tuV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8qvtTzWaS1HADt1A1euEVheymT7MflpBO/QnGs8lGHA
+ykQTl54hqd3JYalWeRkdVmxZEaS2BRHc9E9vy24tMGyqg2LZ4csr4MYIYxKvkg/Q
+BjRPzIfp2vZyv/vqD3m1OJX7ZayhhlN3N1NgY17uo9lBonPifmqYcwf6gXlb8IFt
+H6S117XwQFCBCFUvKhzgUJNdvCG2f7KOBbMDLGWJgQKCAQBWBj4hvkYYVvNgQH4k
+lCTnH9mJZFDY62QV8XSTFu0T6K6MkWYcEavsj7PwruecN1bbfjNQAdrExwdAX7bV
+uDO8hom+gaYQKZFd0cM3RgQcOi0JTxgroVa75+7xJWn00JVC0dcPI3ElIRAsRLcO
+H02xHmHIdKMgMTB0EGLYPf+PMdOGXyBam8pN0KkKWSCbXI8q0QDCONEBGt/POcmu
+RYWvDOR/7gq/kcKURR3rWST9ILfHSIaYmxNDpyAIQW+jmCNk03j0qmk4Qw21lH3O
+L2Qak1l6ksuNmd+Zx2rwFzPTePZ/jH+wlmz2nUHJvwGqqpqHoj4RzdlKFtEexvTK
+0f9ZAoIBAQC+4m4BM9AKapiNzIwFOwstC6cAV0FLAKbQQSih71RV3Lbwr3DU0ShT
+eWH9pcOTKJoKWBi4xkzJXo0Xw7dX4FkNSWDuiJe3EG78qIulKAq8mgUiPneRfj0f
+x3hdA4ATgq9PJ7rDwjesmgjGffS1VbvjQ9yxfX4/J78/aSB6Emk53EAUXp/RNaJk
+shPtEtY9v/9Ypw0a608N8Q6zB+OjxwtGCtbvZhpZFMNTydEbBbXtIGriiyILBh/F
+ugUXvwwuTkg9a+o2SR0Hi1dNSgAIb4oMvkQLa22gy6cjB/9rFjaxuiS1bes7Mb88
+cMhuS3AMYv4QJO090SYCGsY6yrtJ6udW
-----END PRIVATE KEY-----
diff --git a/src/components/transport_manager/test/test_certs/server-cert.pem b/src/components/transport_manager/test/test_certs/server-cert.pem
index d2b1cf0ec8..89959f5456 100644
--- a/src/components/transport_manager/test/test_certs/server-cert.pem
+++ b/src/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HmHIDLmJYEn0ywMR6bkx
+81jbfmCur36Oyi1ua3FA6y4jBVF0BhO3hQ3m0m6rsz49SD1vfMzWqwIDAQABMA0G
+CSqGSIb3DQEBDQUAA4ICAQAxGDopQuNSwnQrK/eRWIJixK19S00bzEkR8i2p1Z46
+75cemCmd9eaAlMihy6Am9PmNKNfne2UYcoybUJG7yPr6qORyzzTk8n3kORn02/Uh
+fLB7cAQTx3IQSevT7qglKU4Nw9oNZ4JH8sWUAYsk8sNfnf2ZeAbISgp5sLCHDx9Y
+LoE6AlmCA6zhf3fpguLcAf5ShedgbaWd6lXCw7MW34HENQ4p8nfwJJiRtVP7WaR4
+/GYn3XccNtqUA3uWiN14rg3cGdNr4RQt9RW2mtuuDnKbFFhVYsZJ6abdJRVDz5tL
+c4hIyYWX2o9zIz/RY49j2R6ycVbJgCuk/WeYXAr2GnoSk6nbCUC0BICeNBeBSic/
+veIQWMUFQSvAPnaLcLRLNI5V+pne4GQ/5cFw7mVLFPM3GCnQRU5BtZwEDNSHo2Y3
+MMLbG6znF+Y4q6ezUMz8HqOndm1p0UYMwGC8fz4pI2IENfgaXavaurZbqS1oqSlV
+QsO1xkZ3RHn1bj69u3sNT9QouKdFpSX6GH5gWEVP5eQ6p/bW5JBxuwqFjRMxVCOU
+PAMjr53yOloH/w0vMHg5hV1J+nwzWYtHIUro9UT6qx5+6icY+d5JaAqVl0U6YWgM
+vL4L61tHY/jhq3bz4pLfsu9Fs4uHehBttrKN5cmH7JaKRHyuRqHumGPct9JzpqN3
+Xg==
-----END CERTIFICATE-----
diff --git a/src/components/transport_manager/test/test_certs/server-key.pem b/src/components/transport_manager/test/test_certs/server-key.pem
index 6ff13eaf28..9f0c3cafd6 100644
--- a/src/components/transport_manager/test/test_certs/server-key.pem
+++ b/src/components/transport_manager/test/test_certs/server-key.pem
@@ -1,28 +1,52 @@
-----BEGIN PRIVATE KEY-----
-MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCmdbfP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qMAEpJNr7YO3cGwKZ2Azoq+tlDbixTyeev
+qJHmrF1af1mPOvvGERuPYcFP8OJ+zRXKSSstOD7ZK+FLPiGhaa/AbJDuVa43z4fb
+VfplzTpC4dx9Anw9xP9K7NU9mKP/A0+pMGi8oivlay/6Wl+OfBKLAEEP7+49hY44
+EZpbJCdNplplGRzoKB9LrQHA78W7QRa7kmtI7U0EfNG9rtffViW9iInLFAPVLbdk
+IQKCAQEAunMwt2/FsHhbi4Ph2Kw1duBW0Vqd2F3wzuepBdzNiaVl93gBQ9cN+w8P
+UN6naq/HsuDtkE02mv02+o9caQh1PHH4l49bDn70FedezxEYwsHEp8ml/xwneF3L
+cDUKLprWLnJKWL+LxE9QkRwVKxyGvJzt+EujrCzDvAyERLMPoPN8aJs4im70lVDV
+G9kszh8vbV++yc7OzHF2lHUTkFzUGvRU0NkwDblcIFCYp1mYL6pWed/hpl6Nttb9
+Zlj4j4IGsotyuqzTA4ZMsLQpG6xXhoaXIz+L+0llpM5rr3sUZ6JDyhwOPHHtt/rz
+2cNU3aiBn7qxgwkv3YUh4vi+mLXOXQ==
-----END PRIVATE KEY-----
diff --git a/src/components/utils/include/utils/atomic_object.h b/src/components/utils/include/utils/atomic_object.h
new file mode 100644
index 0000000000..d1cad4b3bd
--- /dev/null
+++ b/src/components/utils/include/utils/atomic_object.h
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2022, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "utils/conditional_variable.h"
+#include "utils/macro.h"
+#include "utils/rwlock.h"
+
+namespace sync_primitives {
+
+/**
+ * @brief Allows to safely change stored value from different threads.
+ *
+ * The usage example:
+ *
+ * threads::Atomic<int> i;
+ *
+ * i = 5; // here SDL is able to guarantee that this value will be safely
+ * // assigned even in multi threaded environment.
+ */
+template <typename T>
+class Atomic {
+ public:
+ /**
+ * @brief Atomic allows to construct atomic object.
+ * The operation is not atomic.
+ *
+ * @param value the value to initialize object with.
+ */
+ Atomic(const T& value) : value_(value) {} // NOLINT(runtime/explicit)
+
+ /**
+ * @brief operator = thread safe setter for stored value.
+ *
+ * @param val value to assign.
+ *
+ * @return mofified value.
+ */
+ T& operator=(const T& val) {
+ sync_primitives::AutoWriteLock lock(rw_lock_);
+ value_ = val;
+ return value_;
+ }
+
+ /**
+ * @brief operator T thread safe getter
+ *
+ * return stored value.
+ */
+ operator T() const {
+ sync_primitives::AutoReadLock lock(rw_lock_);
+ return value_;
+ }
+
+ /**
+ * @brief operator T thread safe getter
+ *
+ * return stored value.
+ */
+ template <typename U>
+ operator U() const {
+ sync_primitives::AutoReadLock lock(rw_lock_);
+ return static_cast<U>(value_);
+ }
+
+ private:
+ T value_;
+ mutable sync_primitives::RWLock rw_lock_;
+};
+
+typedef Atomic<int> atomic_int;
+typedef Atomic<int32_t> atomic_int32;
+typedef Atomic<uint32_t> atomic_uint32;
+typedef Atomic<int64_t> atomic_int64;
+typedef Atomic<uint64_t> atomic_uint64;
+typedef Atomic<size_t> atomic_size_t;
+typedef Atomic<bool> atomic_bool;
+
+} // namespace sync_primitives
diff --git a/src/components/utils/include/utils/logger/boostlogger.h b/src/components/utils/include/utils/logger/boostlogger.h
index b7eeb7ab61..06bb13049a 100644
--- a/src/components/utils/include/utils/logger/boostlogger.h
+++ b/src/components/utils/include/utils/logger/boostlogger.h
@@ -32,11 +32,19 @@
#pragma once
#define BOOST_LOG_DYN_LINK 1
+
#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <boost/log/sources/severity_channel_logger.hpp>
+#include <boost/log/sources/severity_logger.hpp>
+#include <boost/log/trivial.hpp>
#include "utils/ilogger.h"
namespace logger {
+namespace logging = boost::log;
+namespace src = boost::log::sources;
+namespace attrs = boost::log::attributes;
+
class BoostLogger : public ThirdPartyLoggerInterface {
public:
BoostLogger(const std::string& filename);
@@ -47,6 +55,15 @@ class BoostLogger : public ThirdPartyLoggerInterface {
void PushLog(const LogMessage& log_message) override;
private:
+ struct LogAttributes {
+ attrs::mutable_constant<boost::posix_time::ptime> timestamp_;
+ attrs::mutable_constant<std::thread::id> thread_id_;
+ attrs::mutable_constant<std::string> component_;
+ attrs::mutable_constant<std::string> file_name_;
+ attrs::mutable_constant<int> line_num_;
+ attrs::mutable_constant<std::string> trace_;
+ };
+
boost::posix_time::ptime GetLocalPosixTime(
const logger::TimePoint& timestamp);
@@ -54,6 +71,8 @@ class BoostLogger : public ThirdPartyLoggerInterface {
const std::string& full_function_signature);
std::string filename_;
+ src::severity_logger<logging::trivial::severity_level> slg_;
+ LogAttributes lg_attr_;
};
} // namespace logger
diff --git a/src/components/utils/src/logger/boostlogger.cc b/src/components/utils/src/logger/boostlogger.cc
index ea85186aae..d0ef44f6fc 100644
--- a/src/components/utils/src/logger/boostlogger.cc
+++ b/src/components/utils/src/logger/boostlogger.cc
@@ -32,6 +32,8 @@
#include "utils/logger/boostlogger.h"
+#include <boost/date_time/c_local_time_adjustor.hpp>
+#include <boost/date_time/local_time_adjustor.hpp>
#include <boost/format.hpp>
#include <boost/log/core.hpp>
#include <boost/log/expressions.hpp>
@@ -40,31 +42,31 @@
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/log/sources/logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
-#include <boost/log/sources/severity_channel_logger.hpp>
-#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/support/date_time.hpp>
-#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/from_settings.hpp>
#include <boost/log/utility/setup/settings_parser.hpp>
-#include <fstream>
-
-#include <boost/date_time/c_local_time_adjustor.hpp>
-#include <boost/date_time/local_time_adjustor.hpp>
-
#include <boost/regex.hpp>
+#include <fstream>
namespace logger {
-namespace logging = boost::log;
-namespace src = boost::log::sources;
namespace sinks = boost::log::sinks;
namespace keywords = boost::log::keywords;
namespace expr = boost::log::expressions;
-namespace attrs = boost::log::attributes;
-BoostLogger::BoostLogger(const std::string& filename) : filename_(filename) {}
+BoostLogger::BoostLogger(const std::string& filename)
+ : filename_(filename)
+ , slg_()
+ , lg_attr_({.timestamp_ = attrs::mutable_constant<boost::posix_time::ptime>(
+ boost::posix_time::not_a_date_time),
+ .thread_id_ = attrs::mutable_constant<std::thread::id>(
+ std::this_thread::get_id()),
+ .component_ = attrs::mutable_constant<std::string>(""),
+ .file_name_ = attrs::mutable_constant<std::string>(""),
+ .line_num_ = attrs::mutable_constant<int>(0),
+ .trace_ = attrs::mutable_constant<std::string>("")}) {}
void BoostLogger::Init() {
// Add formatting parameters to INI file
@@ -92,6 +94,13 @@ void BoostLogger::Init() {
std::ifstream file(filename_);
boost::log::settings settings = boost::log::parse_settings(file);
+ slg_.add_attribute("TimeStamp", lg_attr_.timestamp_);
+ slg_.add_attribute("ThreadId", lg_attr_.thread_id_);
+ slg_.add_attribute("Component", lg_attr_.component_);
+ slg_.add_attribute("FileName", lg_attr_.file_name_);
+ slg_.add_attribute("LineNum", lg_attr_.line_num_);
+ slg_.add_attribute("Trace", lg_attr_.trace_);
+
// Custom Settings
if (settings.has_section("Sinks")) {
@@ -161,17 +170,14 @@ boost::posix_time::ptime BoostLogger::GetLocalPosixTime(
std::string BoostLogger::GetFilteredFunctionTrace(
const std::string& full_function_signature) {
- boost::regex function_pattern("([^\\s]*)\\((.*)\\)");
- boost::smatch results;
+ auto start_pos = full_function_signature.find(' ');
+ auto end_pos = full_function_signature.find('(', start_pos);
- if (!boost::regex_search(
- full_function_signature, results, function_pattern)) {
- // Invalid pattern
- return std::string(full_function_signature);
+ if (start_pos == std::string::npos || end_pos == std::string::npos ||
+ start_pos + 1 == full_function_signature.length()) {
+ return full_function_signature;
}
-
- // Get the function name(including namespaces) from the function signature
- return std::string(results[1]);
+ return full_function_signature.substr(start_pos + 1, end_pos - start_pos - 1);
}
bool BoostLogger::IsEnabledFor(const std::string& component,
@@ -188,21 +194,14 @@ void BoostLogger::PushLog(const LogMessage& log_message) {
std::string func_name =
GetFilteredFunctionTrace(log_message.location_.function_name);
- src::severity_logger<logging::trivial::severity_level> slg;
- slg.add_attribute("TimeStamp",
- attrs::constant<boost::posix_time::ptime>(local_time));
- slg.add_attribute("ThreadId",
- attrs::constant<std::thread::id>(log_message.thread_id_));
- slg.add_attribute("Component",
- attrs::constant<std::string>(log_message.component_));
- slg.add_attribute(
- "FileName",
- attrs::constant<std::string>(log_message.location_.file_name));
- slg.add_attribute("LineNum",
- attrs::constant<int>(log_message.location_.line_number));
- slg.add_attribute("Trace", attrs::constant<std::string>(func_name));
-
- BOOST_LOG_SEV(slg, getBoostLogLevel(log_message.log_level_))
+ lg_attr_.timestamp_.set(local_time);
+ lg_attr_.thread_id_.set(log_message.thread_id_);
+ lg_attr_.component_.set(log_message.component_);
+ lg_attr_.file_name_.set(log_message.location_.file_name);
+ lg_attr_.line_num_.set(log_message.location_.line_number);
+ lg_attr_.trace_.set(func_name);
+
+ BOOST_LOG_SEV(slg_, getBoostLogLevel(log_message.log_level_))
<< log_message.log_event_;
}
diff --git a/src/components/utils/test/atomic_object_test.cc b/src/components/utils/test/atomic_object_test.cc
new file mode 100644
index 0000000000..96cc4033b1
--- /dev/null
+++ b/src/components/utils/test/atomic_object_test.cc
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2022, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/atomic_object.h"
+
+#include <string>
+
+#include "gtest/gtest.h"
+
+namespace test {
+namespace utils {
+
+class AtomicString {
+ public:
+ AtomicString(const std::string& str) : atomic_str_(str) {}
+
+ void SetValue(const std::string& str) {
+ atomic_str_ = str;
+ }
+ std::string GetValue() const {
+ return atomic_str_;
+ }
+
+ private:
+ sync_primitives::Atomic<std::string> atomic_str_;
+};
+
+TEST(AtomicObjectTest, Construct) {
+ sync_primitives::atomic_int var(5);
+ EXPECT_EQ(5, static_cast<int>(var));
+
+ var = 8;
+ EXPECT_EQ(8, static_cast<int>(var));
+
+ sync_primitives::atomic_bool flag = true;
+
+ EXPECT_EQ(true, static_cast<bool>(flag));
+
+ flag = false;
+ EXPECT_EQ(false, static_cast<bool>(flag));
+
+ AtomicString atomic_str("string");
+
+ EXPECT_EQ("string", atomic_str.GetValue());
+
+ atomic_str.SetValue("string2");
+ EXPECT_EQ("string2", atomic_str.GetValue());
+}
+
+} // namespace utils
+} // namespace test