summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJackLivio <jack@livio.io>2019-08-26 16:45:19 -0400
committerGitHub <noreply@github.com>2019-08-26 16:45:19 -0400
commitc42cbc9cf60754baac573193f7f8ca8222157c2e (patch)
treea4c3e581b4d9c8c2a6cbdc029323a68b50a0829f
parent8db0c2601921fdd368bf86133780746b532c40f5 (diff)
parent55c67ea33906799127c45ddfad165571b2d98103 (diff)
downloadsdl_core-c42cbc9cf60754baac573193f7f8ca8222157c2e.tar.gz
Merge pull request #2980 from smartdevicelink/feature/widget_support
Feature/widget support
-rw-r--r--src/appMain/sdl_preloaded_pt.json25
-rw-r--r--src/components/application_manager/include/application_manager/application.h235
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h50
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h60
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h16
-rw-r--r--src/components/application_manager/include/application_manager/application_state.h86
-rw-r--r--src/components/application_manager/include/application_manager/commands/command.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h5
-rw-r--r--src/components/application_manager/include/application_manager/display_capabilities_builder.h96
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities_impl.h20
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h14
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h68
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h1
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h22
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h34
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h27
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h15
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h232
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h97
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h66
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h117
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h67
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h91
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h67
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc131
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc28
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc370
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc162
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc53
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc40
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc45
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc177
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc24
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc36
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc159
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc118
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc27
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc457
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc278
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc124
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc8
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc236
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc447
-rw-r--r--src/components/application_manager/src/application_data_impl.cc324
-rw-r--r--src/components/application_manager/src/application_impl.cc155
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc120
-rw-r--r--src/components/application_manager/src/application_state.cc253
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc11
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc17
-rw-r--r--src/components/application_manager/src/display_capabilities_builder.cc128
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc11
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc2
-rw-r--r--src/components/application_manager/src/hmi_state.cc44
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc148
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc64
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc177
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc46
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc6
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc6
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc5
-rw-r--r--src/components/application_manager/src/rpc_passing_handler.cc4
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc9
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc13
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc352
-rw-r--r--src/components/application_manager/test/application_impl_test.cc52
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc26
-rw-r--r--src/components/application_manager/test/application_state_test.cc86
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc32
-rw-r--r--src/components/application_manager/test/help_prompt_manager_test.cc6
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h110
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h5
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h24
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_request.h1
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h12
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h11
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc21
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc35
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc50
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc312
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc66
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc841
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc2
-rw-r--r--src/components/include/application_manager/application_manager.h24
-rw-r--r--src/components/include/application_manager/hmi_capabilities.h18
-rw-r--r--src/components/include/application_manager/policies/policy_handler_interface.h1
-rw-r--r--src/components/include/application_manager/state_controller.h128
-rw-r--r--src/components/include/test/application_manager/mock_application_manager.h6
-rw-r--r--src/components/include/test/application_manager/mock_state_controller.h41
-rw-r--r--src/components/include/test/application_manager/policies/mock_policy_handler_interface.h3
-rw-r--r--src/components/interfaces/HMI_API.xml296
-rw-r--r--src/components/interfaces/MOBILE_API.xml308
-rw-r--r--src/components/policy/policy_external/include/policy/policy_table/enums.h10
-rw-r--r--src/components/policy/policy_external/src/policy_table/enums.cc10
-rw-r--r--src/components/policy/policy_regular/include/policy/policy_table/enums.h10
-rw-r--r--src/components/policy/policy_regular/src/policy_table/enums.cc18
-rw-r--r--src/components/policy/policy_regular/test/policy_manager_impl_test.cc163
-rwxr-xr-xtools/InterfaceGenerator/generator/parsers/RPCBase.py2
139 files changed, 8885 insertions, 1155 deletions
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index c36150b230..ade41f209f 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -1201,6 +1201,31 @@
"hmi_levels": ["FULL"]
}
}
+ },
+ "WidgetSupport": {
+ "rpcs": {
+ "CreateWindow": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteWindow": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnSystemCapabilityUpdated": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
}
},
"consumer_friendly_messages": {
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 72122ff3ec..de4319acb7 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -62,13 +62,17 @@ typedef int32_t ErrorCode;
class UsageStatistics;
+class DisplayCapabilitiesBuilder;
+
enum APIVersion {
kUnknownAPI = -1,
kAPIV0 = 0,
kAPIV1 = 1,
kAPIV2 = 2,
kAPIV3 = 3,
- kAPIV4 = 4
+ kAPIV4 = 4,
+ kAPIV5 = 5,
+ kAPIV6 = 6
};
enum TLimitSource { POLICY_TABLE = 0, CONFIG_FILE };
@@ -146,6 +150,12 @@ typedef std::map<uint32_t, smart_objects::SmartObject*> SubMenuMap;
typedef std::map<uint32_t, smart_objects::SmartObject*> ChoiceSetMap;
/*
+ * @brief Typedef for map of window ids to data used as parameters
+ * to CreateWindow request.
+ */
+typedef std::map<WindowID, smart_objects::SmartObjectSPtr> WindowParamsMap;
+
+/*
* @brief Typedef for perform interaction choice
* @param choice id
* @param SmartObject choice
@@ -162,7 +172,7 @@ typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap;
/**
* @brief Defines id of SoftButton
*/
-typedef std::set<uint32_t> SoftButtonID;
+typedef std::set<std::pair<uint32_t, WindowID> > SoftButtonID;
/**
* @brief Defines set of buttons subscription
@@ -188,9 +198,25 @@ class DynamicApplicationData {
virtual const smart_objects::SmartObject* keyboard_props() const = 0;
virtual const smart_objects::SmartObject* menu_title() const = 0;
virtual const smart_objects::SmartObject* menu_icon() const = 0;
- virtual const smart_objects::SmartObject* day_color_scheme() const = 0;
- virtual const smart_objects::SmartObject* night_color_scheme() const = 0;
- virtual const std::string& display_layout() const = 0;
+ virtual smart_objects::SmartObject day_color_scheme() const = 0;
+ virtual smart_objects::SmartObject night_color_scheme() const = 0;
+ virtual std::string display_layout() const = 0;
+
+ /**
+ * @brief Specific display capabilities of application
+ * @return display capabilities of application or NULL-initialized pointer if
+ * not specified
+ */
+ virtual smart_objects::SmartObjectSPtr display_capabilities() const = 0;
+
+ /**
+ * @brief Specific display capabilities of application
+ * @param window id - id of an affected widget
+ * @return display capabilities of application or NULL-initialized pointer if
+ * not specified
+ */
+ virtual smart_objects::SmartObjectSPtr display_capabilities(
+ const WindowID window_id) const = 0;
virtual void load_global_properties(const smart_objects::SmartObject& so) = 0;
virtual void set_help_prompt(
@@ -222,12 +248,77 @@ class DynamicApplicationData {
virtual void set_video_stream_retry_number(
const uint32_t& video_stream_retry_number) = 0;
+ virtual void set_display_layout(const std::string& layout) = 0;
virtual void set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) = 0;
virtual void set_night_color_scheme(
const smart_objects::SmartObject& color_scheme) = 0;
- virtual void set_display_layout(const std::string& layout) = 0;
+ /**
+ * @brief Set specific application display capabilities
+ * @param display_capabilities new display capabilities of application
+ */
+ virtual void set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) = 0;
+
+ /**
+ * @brief deletes stored window capability for given window id
+ * @param window id of capability to remove
+ */
+ virtual void remove_window_capability(const WindowID window_id) = 0;
+
+ /**
+ * @brief Sets layout for application's specific window
+ * @param window_id window id for which layout should be set
+ * @param layout - layout to be set
+ */
+ virtual void set_window_layout(const WindowID window_id,
+ const std::string& layout) = 0;
+
+ /**
+ * @brief Sets day color scheme for application's specific window
+ * @param window_id window id for which day color scheme should be set
+ * @param color_scheme - color scheme to be set
+ */
+ virtual void set_day_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) = 0;
+
+ /**
+ * @brief Sets night color scheme for application's specific window
+ * @param window_id window id for which night color scheme should be set
+ * @param color_scheme - color scheme to be set
+ */
+ virtual void set_night_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) = 0;
+
+ /**
+ * @brief Gets window layout for application's specific window_id
+ * @param window_id window id for which display layout should be returned
+ * @return string containing set display layout,
+ * if no display layout is set - empty string is returned
+ */
+ virtual std::string window_layout(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Gets day color scheme for application's specific window_id
+ * @param window_id window id for which color scheme should be returned
+ * @return day color scheme which is set for specified app window,
+ * if no day color scheme is set - Smart object with NullType is returned
+ */
+ virtual smart_objects::SmartObject day_color_scheme(
+ const WindowID window_id) const = 0;
+
+ /**
+ * @brief Gets night color scheme for application's specific window_id
+ * @param window_id window id for which color scheme should be returned
+ * @return night color scheme which is set for specified app window
+ * if no night color scheme is set - Smart object with NullType is returned
+ */
+ virtual smart_objects::SmartObject night_color_scheme(
+ const WindowID window_id) const = 0;
+
/**
* @brief Checks if application is media, voice communication or navigation
* @return true if application is media, voice communication or navigation,
@@ -290,6 +381,20 @@ class DynamicApplicationData {
virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0;
/*
+ * @brief Adds window info
+ * @param window_id unique id of a window
+ * @param window_info SmartObject that represent window info
+ */
+ virtual void SetWindowInfo(const WindowID window_id,
+ const smart_objects::SmartObject& window_info) = 0;
+
+ /*
+ * @brief Removes window info
+ * @param window_id unique id of a window
+ */
+ virtual void RemoveWindowInfo(const WindowID window_id) = 0;
+
+ /*
* @brief Finds choice set with the specified choice_set_id id
*
* @param choice_set_id Unique ID of the interaction choice set
@@ -324,6 +429,16 @@ class DynamicApplicationData {
const = 0;
/*
+ * @brief Retrieves window info map
+ */
+ virtual DataAccessor<WindowParamsMap> window_optional_params_map() const = 0;
+
+ /*
+ * @brief Retrieves display capabilities builder
+ */
+ virtual DisplayCapabilitiesBuilder& display_capabilities_builder() = 0;
+
+ /*
* @brief Retrieve application commands
*/
virtual DataAccessor<CommandsMap> commands_map() const = 0;
@@ -449,6 +564,20 @@ class Application : public virtual InitialApplicationData,
*/
virtual void set_is_application_data_changed(bool state_application_data) = 0;
+ /**
+ * @brief Checks if application data is allowed to be resumed
+ * @return TRUE if data of application is allowed to be resumed, otherwise
+ * return FALSE
+ */
+ virtual bool is_app_data_resumption_allowed() const = 0;
+
+ /**
+ * @brief Sets resumption allowance for application data
+ * @param allowed - true if app data allowed to be resumed,
+ * false value means that app data is disallowed for resumption
+ */
+ virtual void set_app_data_resumption_allowance(const bool allowed) = 0;
+
virtual void CloseActiveMessage() = 0;
virtual bool IsFullscreen() const = 0;
virtual void ChangeSupportingAppHMIType() = 0;
@@ -545,11 +674,26 @@ class Application : public virtual InitialApplicationData,
virtual bool is_media_application() const = 0;
virtual bool is_foreground() const = 0;
virtual void set_foreground(const bool is_foreground) = 0;
- virtual const mobile_api::HMILevel::eType hmi_level() const = 0;
+
+ /**
+ * @brief hmi_level current HMI level of application's window
+ * @param window_id id of application's window to get
+ * @return HMI level of application's window
+ */
+ virtual const mobile_api::HMILevel::eType hmi_level(
+ const WindowID window_id) const = 0;
+
virtual const uint32_t put_file_in_none_count() const = 0;
virtual const uint32_t delete_file_in_none_count() const = 0;
virtual const uint32_t list_files_in_none_count() const = 0;
- virtual const mobile_api::SystemContext::eType system_context() const = 0;
+
+ /**
+ * @brief system_context current system context of application's window
+ * @param window_id id of application's window to get
+ * @return system context of application's window
+ */
+ virtual const mobile_api::SystemContext::eType system_context(
+ const WindowID window_id) const = 0;
virtual const mobile_api::AudioStreamingState::eType audio_streaming_state()
const = 0;
virtual const mobile_api::VideoStreamingState::eType video_streaming_state()
@@ -694,58 +838,91 @@ class Application : public virtual InitialApplicationData,
/**
* @brief SetInitialState sets initial HMI state for application on
* registration
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Hmi state value
*/
- virtual void SetInitialState(HmiStatePtr state) = 0;
+ virtual void SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) = 0;
/**
* @brief SetRegularState set permanent state of application
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetRegularState(HmiStatePtr state) = 0;
+ virtual void SetRegularState(const WindowID window_id, HmiStatePtr state) = 0;
/**
* @brief SetPostponedState sets postponed state to application.
* This state could be set as regular later
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetPostponedState(HmiStatePtr state) = 0;
+ virtual void SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) = 0;
- virtual void RemovePostponedState() = 0;
+ /**
+ * @brief RemovePostponedState removes postponed state for application
+ * After removal, this state will not be set as regular later
+ * @param window_id window id for HMI state
+ */
+ virtual void RemovePostponedState(const WindowID window_id) = 0;
/**
* @brief AddHMIState the function that will change application's
* hmi state.
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state new hmi state for certain application.
*/
- virtual void AddHMIState(HmiStatePtr state) = 0;
+ virtual void AddHMIState(const WindowID window_id, HmiStatePtr state) = 0;
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
* of some event
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state_id that should be removed
*/
- virtual void RemoveHMIState(HmiState::StateID state_id) = 0;
+ virtual void RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) = 0;
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @param window_id window id for HMI state
* @return Active HmiState of application
*/
- virtual const HmiStatePtr CurrentHmiState() const = 0;
+ virtual const HmiStatePtr CurrentHmiState(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Getter for a list of available application windows including the
+ * main
+ * @return list of available window IDs created by application
+ */
+ virtual WindowIds GetWindowIds() const = 0;
+
+ /**
+ * @brief Getter for a list of all existing window names
+ * @return list of available window names created by application
+ */
+ virtual WindowNames GetWindowNames() const = 0;
+
+ /**
+ * @brief Check if application has specified window
+ * @param window_id - id of window to check
+ * @return true if app has specified window , otherwise false
+ */
+ virtual bool WindowIdExists(const WindowID window_id) const = 0;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @param window_id window id for HMI state
* @return HmiState of application
*/
- virtual const HmiStatePtr RegularHmiState() const = 0;
+ virtual const HmiStatePtr RegularHmiState(const WindowID window_id) const = 0;
/**
* @brief Checks if app is allowed to change audio source
@@ -756,10 +933,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief PostponedHmiState returns postponed hmi state of application
* if it's present
- *
+ * @param window_id window id for HMI state
* @return Postponed hmi state of application
*/
- virtual const HmiStatePtr PostponedHmiState() const = 0;
+ virtual const HmiStatePtr PostponedHmiState(
+ const WindowID window_id) const = 0;
/**
* @brief Keeps id of softbuttons which is created in commands:
@@ -772,6 +950,13 @@ class Application : public virtual InitialApplicationData,
const SoftButtonID& softbuttons_id) = 0;
/**
+ * @brief Retreives window id on which given button is created
+ * @param button_id identifier of a button
+ * @param window id of a widget containing button
+ */
+ virtual WindowID GetSoftButtonWindowID(const uint32_t button_id) = 0;
+
+ /**
* @brief Determine the existence of softbutton
* @param Softbutton_id contains id of softbutton
* @return Returns true if application contains softbutton id otherwise
@@ -901,9 +1086,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief set_system_context Set system context for application
+ * @param window_id window id for HMI state
* @param system_context Current context
*/
virtual void set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) = 0;
/**
@@ -915,9 +1102,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief set_hmi_level Set HMI level for application
+ * @param window_id window id for HMI state
* @param hmi_level Current HMI level
*/
- virtual void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) = 0;
+ virtual void set_hmi_level(const WindowID window_id,
+ const mobile_api::HMILevel::eType& hmi_level) = 0;
/**
* @brief Return pointer to extension by uid
diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h
index 7852d6805b..dd093c9890 100644
--- a/src/components/application_manager/include/application_manager/application_data_impl.h
+++ b/src/components/application_manager/include/application_manager/application_data_impl.h
@@ -35,6 +35,7 @@
#include <string>
#include "application_manager/application.h"
+#include "application_manager/display_capabilities_builder.h"
#include "interfaces/MOBILE_API.h"
#include "smart_objects/smart_object.h"
#include "utils/lock.h"
@@ -88,6 +89,7 @@ class InitialApplicationDataImpl : public virtual Application {
class DynamicApplicationDataImpl : public virtual Application {
public:
+ typedef std::map<WindowID, smart_objects::SmartObject> AppWindowsTemplates;
DynamicApplicationDataImpl();
~DynamicApplicationDataImpl();
const smart_objects::SmartObject* help_prompt() const;
@@ -100,9 +102,31 @@ class DynamicApplicationDataImpl : public virtual Application {
const smart_objects::SmartObject* keyboard_props() const;
const smart_objects::SmartObject* menu_title() const;
const smart_objects::SmartObject* menu_icon() const;
- const smart_objects::SmartObject* day_color_scheme() const;
- const smart_objects::SmartObject* night_color_scheme() const;
- const std::string& display_layout() const;
+
+ smart_objects::SmartObject day_color_scheme() const OVERRIDE;
+ smart_objects::SmartObject night_color_scheme() const OVERRIDE;
+ std::string display_layout() const OVERRIDE;
+ smart_objects::SmartObjectSPtr display_capabilities() const OVERRIDE;
+ smart_objects::SmartObjectSPtr display_capabilities(
+ const WindowID window_id) const OVERRIDE;
+
+ void set_window_layout(const WindowID window_id,
+ const std::string& layout) OVERRIDE;
+
+ void set_day_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) OVERRIDE;
+ void set_night_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) OVERRIDE;
+
+ std::string window_layout(const WindowID window_id) const OVERRIDE;
+
+ smart_objects::SmartObject day_color_scheme(
+ const WindowID window_id) const OVERRIDE;
+
+ smart_objects::SmartObject night_color_scheme(
+ const WindowID window_id) const OVERRIDE;
void load_global_properties(const smart_objects::SmartObject& properties_so);
void set_help_prompt(const smart_objects::SmartObject& help_prompt);
@@ -120,6 +144,9 @@ class DynamicApplicationDataImpl : public virtual Application {
void set_day_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_night_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_display_layout(const std::string& layout);
+ void set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) OVERRIDE;
+ void remove_window_capability(const WindowID window_id) OVERRIDE;
/*
* @brief Adds a command to the in application menu
*/
@@ -156,6 +183,11 @@ class DynamicApplicationDataImpl : public virtual Application {
*/
bool IsSubMenuNameAlreadyExist(const std::string& name);
+ void SetWindowInfo(const WindowID window_id,
+ const smart_objects::SmartObject& window_info) OVERRIDE;
+
+ void RemoveWindowInfo(const WindowID window_id) OVERRIDE;
+
/*
* @brief Adds a interaction choice set to the application
*
@@ -221,6 +253,10 @@ class DynamicApplicationDataImpl : public virtual Application {
*/
inline DataAccessor<ChoiceSetMap> choice_set_map() const;
+ DataAccessor<WindowParamsMap> window_optional_params_map() const;
+
+ DisplayCapabilitiesBuilder& display_capabilities_builder();
+
/*
* @brief Sets perform interaction state
*
@@ -274,9 +310,8 @@ class DynamicApplicationDataImpl : public virtual Application {
smart_objects::SmartObject* menu_title_;
smart_objects::SmartObject* menu_icon_;
smart_objects::SmartObject* tbt_show_command_;
- smart_objects::SmartObject* day_color_scheme_;
- smart_objects::SmartObject* night_color_scheme_;
- std::string display_layout_;
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ AppWindowsTemplates window_templates_;
CommandsMap commands_;
mutable std::shared_ptr<sync_primitives::RecursiveLock> commands_lock_ptr_;
@@ -287,9 +322,12 @@ class DynamicApplicationDataImpl : public virtual Application {
PerformChoiceSetMap performinteraction_choice_set_map_;
mutable std::shared_ptr<sync_primitives::RecursiveLock>
performinteraction_choice_set_lock_ptr_;
+ WindowParamsMap window_params_map_;
+ mutable std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
uint32_t is_perform_interaction_active_;
bool is_reset_global_properties_active_;
int32_t perform_interaction_mode_;
+ DisplayCapabilitiesBuilder display_capabilities_builder_;
private:
void SetGlobalProperties(
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 fd9b77eb0f..40bb58c009 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -158,11 +158,13 @@ class ApplicationImpl : public virtual Application,
bool is_media_application() const;
bool is_foreground() const OVERRIDE;
void set_foreground(const bool is_foreground) OVERRIDE;
- const mobile_apis::HMILevel::eType hmi_level() const;
+ const mobile_apis::HMILevel::eType hmi_level(
+ const WindowID window_id) const OVERRIDE;
const uint32_t put_file_in_none_count() const;
const uint32_t delete_file_in_none_count() const;
const uint32_t list_files_in_none_count() const;
- const mobile_api::SystemContext::eType system_context() const;
+ const mobile_api::SystemContext::eType system_context(
+ const WindowID window_id) const OVERRIDE;
inline const mobile_apis::AudioStreamingState::eType audio_streaming_state()
const;
inline const mobile_apis::VideoStreamingState::eType video_streaming_state()
@@ -229,6 +231,8 @@ class ApplicationImpl : public virtual Application,
bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name);
bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name);
+ WindowID GetSoftButtonWindowID(const uint32_t button_id) OVERRIDE;
+
inline bool IsRegistered() const OVERRIDE;
/**
@@ -279,6 +283,9 @@ class ApplicationImpl : public virtual Application,
virtual bool is_application_data_changed() const;
+ bool is_app_data_resumption_allowed() const OVERRIDE;
+ void set_app_data_resumption_allowance(const bool allowed) OVERRIDE;
+
virtual void set_is_application_data_changed(bool state_application_data);
/**
@@ -299,26 +306,35 @@ class ApplicationImpl : public virtual Application,
/**
* @brief SetInitialState sets initial HMI state for application on
* registration
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Hmi state value
*/
- void SetInitialState(HmiStatePtr state) FINAL;
+ void SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) FINAL;
/**
* @brief SetRegularState set permanent state of application
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetRegularState(HmiStatePtr state);
+ void SetRegularState(const WindowID window_id, HmiStatePtr state) FINAL;
/**
* @brief SetPostponedState sets postponed state to application.
* This state could be set as regular later
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetPostponedState(HmiStatePtr state);
+ void SetPostponedState(const WindowID window_id, HmiStatePtr state) FINAL;
- virtual void RemovePostponedState();
+ /**
+ * @brief RemovePostponedState removes postponed state for application
+ * After removal, this state will not be set as regular later
+ * @param window_id window id for HMI state
+ */
+ void RemovePostponedState(const WindowID window_id) FINAL;
/**
* @brief AddHMIState the function that will change application's
@@ -328,7 +344,7 @@ class ApplicationImpl : public virtual Application,
*
* @param state new hmi state for certain application.
*/
- virtual void AddHMIState(HmiStatePtr state);
+ void AddHMIState(const WindowID window_id, HmiStatePtr state) FINAL;
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
@@ -338,13 +354,20 @@ class ApplicationImpl : public virtual Application,
*
* @param state_id that should be removed
*/
- virtual void RemoveHMIState(HmiState::StateID state_id);
+ void RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) FINAL;
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
* @return Active HmiState of application
*/
- virtual const HmiStatePtr CurrentHmiState() const;
+ const HmiStatePtr CurrentHmiState(const WindowID window_i) const FINAL;
+
+ WindowNames GetWindowNames() const FINAL;
+
+ WindowIds GetWindowIds() const FINAL;
+
+ bool WindowIdExists(const WindowID window_id) const FINAL;
/**
* @brief Checks if app is allowed to change audio source
@@ -356,7 +379,7 @@ class ApplicationImpl : public virtual Application,
* @brief RegularHmiState of application without active events VR, TTS etc ...
* @return HmiState of application
*/
- virtual const HmiStatePtr RegularHmiState() const;
+ const HmiStatePtr RegularHmiState(const WindowID window_id) const FINAL;
/**
* @brief PostponedHmiState returns postponed hmi state of application
@@ -364,7 +387,7 @@ class ApplicationImpl : public virtual Application,
*
* @return Postponed hmi state of application
*/
- virtual const HmiStatePtr PostponedHmiState() const;
+ const HmiStatePtr PostponedHmiState(const WindowID window_id) const FINAL;
uint32_t audio_stream_retry_number() const;
@@ -391,6 +414,7 @@ class ApplicationImpl : public virtual Application,
* @param system_context new system context
*/
void set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) OVERRIDE;
/**
* @brief Sets current audio streaming state
@@ -402,7 +426,8 @@ class ApplicationImpl : public virtual Application,
* @brief Sets current HMI level
* @param hmi_level new HMI level
*/
- void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) OVERRIDE;
+ void set_hmi_level(const WindowID window_id,
+ const mobile_api::HMILevel::eType& hmi_level) OVERRIDE;
void PushMobileMessage(
smart_objects::SmartObjectSPtr mobile_message) OVERRIDE;
@@ -546,6 +571,7 @@ class ApplicationImpl : public virtual Application,
sync_primitives::Lock streaming_stop_lock_;
bool is_app_allowed_;
+ bool is_app_data_resumption_allowed_;
bool has_been_activated_;
bool tts_properties_in_none_;
bool tts_properties_in_full_;
@@ -632,7 +658,8 @@ uint32_t ApplicationImpl::app_id() const {
const mobile_api::AudioStreamingState::eType
ApplicationImpl::audio_streaming_state() const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state =
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
return hmi_state ? hmi_state->audio_streaming_state()
: AudioStreamingState::INVALID_ENUM;
}
@@ -640,7 +667,8 @@ ApplicationImpl::audio_streaming_state() const {
const mobile_api::VideoStreamingState::eType
ApplicationImpl::video_streaming_state() const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state =
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
return hmi_state ? hmi_state->video_streaming_state()
: VideoStreamingState::INVALID_ENUM;
}
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 936497cd15..a224d51a33 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
@@ -203,9 +203,6 @@ class ApplicationManagerImpl
mobile_apis::HMILevel::eType from,
mobile_apis::HMILevel::eType to) OVERRIDE;
- void SendHMIStatusNotification(
- const std::shared_ptr<Application> app) OVERRIDE;
-
void SendDriverDistractionState(ApplicationSharedPtr application);
void SendGetIconUrlNotifications(const uint32_t connection_key,
@@ -476,6 +473,7 @@ class ApplicationManagerImpl
/**
* @brief CreateRegularState create regular HMI state for application
* @param app Application
+ * @param window_type type of window
* @param hmi_level of returned state
* @param audio_state of returned state
* @param system_context of returned state
@@ -483,16 +481,17 @@ class ApplicationManagerImpl
*/
HmiStatePtr CreateRegularState(
std::shared_ptr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const OVERRIDE;
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const OVERRIDE;
/**
* @brief Checks, if given RPC is allowed at current HMI level for specific
* application in policy table
* @param app Application
- * @param hmi_level Current HMI level of application
+ * @param window_id id of application's window
* @param function_id FunctionID of RPC
* @param params_permissions Permissions for RPC parameters (e.g.
* SubscribeVehicleData) defined in policy table
@@ -500,6 +499,7 @@ class ApplicationManagerImpl
*/
mobile_apis::Result::eType CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions = NULL) OVERRIDE;
diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h
index d708a6188d..8c4d2d49d6 100644
--- a/src/components/application_manager/include/application_manager/application_state.h
+++ b/src/components/application_manager/include/application_manager/application_state.h
@@ -32,14 +32,21 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
+
+#include <map>
#include <vector>
+
#include "application_manager/hmi_state.h"
#include "utils/lock.h"
#include "utils/macro.h"
namespace application_manager {
+typedef std::vector<WindowID> WindowIds;
typedef std::vector<HmiStatePtr> HmiStates;
+typedef std::map<WindowID, HmiStates> HmiStatesMap;
+typedef std::vector<std::string> WindowNames;
+typedef std::map<WindowID, std::string> WindowNamesMap;
/*
* Class represents application state, i.e. current HMI level, audio streaming
@@ -63,94 +70,137 @@ class ApplicationState {
/**
* @brief Init state
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Initial state
*/
- void InitState(HmiStatePtr state);
+ void InitState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state);
/**
* @brief Adds state to states storage
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void AddState(HmiStatePtr state);
+ void AddState(const WindowID window_id, HmiStatePtr state);
/**
* @brief Removes state from states storage
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void RemoveState(HmiState::StateID state);
+ void RemoveState(const WindowID window_id, HmiState::StateID state);
/**
* @brief Gets state by state id
+ * @param window_id window id for HMI state
* @param state_id State id
* @return Pointer to application state
*/
- HmiStatePtr GetState(HmiState::StateID state_id) const;
+ HmiStatePtr GetState(const WindowID window_id,
+ HmiState::StateID state_id) const;
+
+ /**
+ * @brief Gets the list of all states matches provided state id
+ * @param state_id state id to get
+ * @return list of all states matches provided state id
+ */
+ HmiStates GetStates(const HmiState::StateID state_id) const;
+
+ /**
+ * @brief Getter for a list of available application windows including the
+ * main
+ * @return list of available window ids
+ */
+ WindowIds GetWindowIds() const;
+
+ /**
+ * @brief Getter f0r a list of all existing window names
+ * @return list of available window names
+ */
+ WindowNames GetWindowNames() const;
private:
/**
* @brief AddHMIState the function that will change application's
* hmi state.
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state new hmi state for certain application.
*/
- void AddHMIState(HmiStatePtr state);
+ void AddHMIState(const WindowID window_id, HmiStatePtr state);
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
* of some event
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state.
*
* @param state_id that should be removed
*/
- void RemoveHMIState(HmiState::StateID state_id);
+ void RemoveHMIState(const WindowID window_id, HmiState::StateID state_id);
+
+ /**
+ * @brief RemoveWindowHMIStates removes all HMI states related to specified
+ * window
+ * @param window_id window ID to remove
+ */
+ void RemoveWindowHMIStates(const WindowID window_id);
/**
* @brief Removes postponed state
+ * @param window_id window id for HMI state
*/
- void RemovePostponedState();
+ void RemovePostponedState(const WindowID window_id);
/**
* @brief Sets regular state of application
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void SetRegularState(HmiStatePtr state);
+ void SetRegularState(const WindowID window_id, HmiStatePtr state);
/**
* @brief Sets postponed state of application.
* This state could be set as regular later on
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- void SetPostponedState(HmiStatePtr state);
+ void SetPostponedState(const WindowID window_id, HmiStatePtr state);
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @param window_id window id for HMI state
* @return Active HmiState of application
*/
- HmiStatePtr CurrentHmiState() const;
+ HmiStatePtr CurrentHmiState(const WindowID window_id) const;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @param window_id window id for HMI state
* @return HmiState of application
*/
- HmiStatePtr RegularHmiState() const;
+ HmiStatePtr RegularHmiState(const WindowID window_id) const;
/**
* @brief PostponedHmiState returns postponed hmi state of application
* if it's present
- *
+ * @param window_id window id for HMI state
* @return Postponed hmi state of application
*/
- HmiStatePtr PostponedHmiState() const;
+ HmiStatePtr PostponedHmiState(const WindowID window_id) const;
/**
* @brief Active states of application
*/
- HmiStates hmi_states_;
- mutable sync_primitives::Lock hmi_states_lock_;
+ HmiStatesMap hmi_states_map_;
+
+ /**
+ * @brief hmi_states_map_lock_
+ */
+ mutable sync_primitives::Lock hmi_states_map_lock_;
DISALLOW_COPY_AND_ASSIGN(ApplicationState);
};
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 0693f9868d..0536c7aee1 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#include <stdint.h>
+#include "application_manager/hmi_state.h"
#include "smart_objects/smart_object.h"
namespace application_manager {
@@ -93,6 +94,11 @@ class Command {
virtual int32_t function_id() const = 0;
/*
+ * @brief Retrieves Window ID
+ */
+ virtual WindowID window_id() const = 0;
+
+ /*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
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 4e52ac23ce..a526fede6e 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
@@ -118,6 +118,11 @@ class CommandImpl : public Command {
int32_t function_id() const OVERRIDE;
/*
+ * @brief Retrieves Window ID
+ */
+ WindowID window_id() const OVERRIDE;
+
+ /*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
diff --git a/src/components/application_manager/include/application_manager/display_capabilities_builder.h b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
new file mode 100644
index 0000000000..529c9a32c1
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DISPLAY_CAPABILITIES_BUILDER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DISPLAY_CAPABILITIES_BUILDER_H_
+#include "application_manager/application.h"
+
+namespace application_manager {
+/**
+ * @brief DisplayCapabilitiesBuilder utility class used for building cached
+ * notification, which is sent to mobile on resumption finish
+ */
+class DisplayCapabilitiesBuilder {
+ typedef std::function<void(Application&, const smart_objects::SmartObject)>
+ ResumeCallback;
+
+ public:
+ /**
+ * @brief DisplayCapabilitiesBuilder class constructor
+ * @param Application reference to application owner
+ */
+ DisplayCapabilitiesBuilder(Application& application);
+
+ /**
+ * @brief InitBuilder initialize builder with callback and windows to be
+ * restored
+ * @param resume_callback callback to be called when notifications for all
+ * windows have been received
+ * @param windows_info SO containing data of windows to be restored
+ */
+ void InitBuilder(ResumeCallback resume_callback,
+ const smart_objects::SmartObject& windows_info);
+
+ /**
+ * @brief UpdateDisplayCapabilities update cached notification
+ * @param display_capabilities to update cached notification with
+ */
+ void UpdateDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ /**
+ * @brief ResetDisplayCapabilities resets stored notification
+ */
+ void ResetDisplayCapabilities();
+
+ /**
+ * @brief StopWaitingForWindow stop waiting for window resumption by removing
+ * window_id from windows pending resumption
+ * @param window_id window id to be removed
+ */
+ void StopWaitingForWindow(const WindowID window_id);
+
+ /**
+ * @brief retreives stored notification data
+ */
+ const smart_objects::SmartObjectSPtr display_capabilities() const;
+
+ private:
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ typedef std::set<WindowID> WindowIDsToResume;
+ WindowIDsToResume window_ids_to_resume_;
+ Application& owner_;
+ ResumeCallback resume_callback_;
+ sync_primitives::Lock display_capabilities_lock_;
+};
+} // namespace application_manager
+#endif
diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
index 2ca1706214..c75306345b 100644
--- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
+++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
@@ -230,6 +230,20 @@ class HMICapabilitiesImpl : public HMICapabilities {
const smart_objects::SmartObject& display_capabilities) OVERRIDE;
/*
+ * @brief Retrieves information about the display capability
+ * @return Currently supported display capability
+ */
+ const smart_objects::SmartObjectSPtr system_display_capabilities()
+ const OVERRIDE;
+
+ /*
+ * @brief Sets supported display capability
+ * @param display_capabilities supported display capability
+ */
+ void set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ /*
* @brief Retrieves information about the HMI zone capabilities
*
* @return Currently supported HMI zone capabilities
@@ -578,7 +592,13 @@ class HMICapabilitiesImpl : public HMICapabilities {
smart_objects::SmartObject* ui_supported_languages_;
smart_objects::SmartObject* tts_supported_languages_;
smart_objects::SmartObject* vr_supported_languages_;
+ /*
+ * display_capabilities_ is deprecated and replaced by
+ * system_display_capabilities_. For backward compatibility
+ * display_capabilities_ is not removed.
+ */
smart_objects::SmartObject* display_capabilities_;
+ smart_objects::SmartObjectSPtr system_display_capabilities_;
smart_objects::SmartObject* hmi_zone_capabilities_;
smart_objects::SmartObject* soft_buttons_capabilities_;
smart_objects::SmartObject* button_capabilities_;
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 b6a4c180e6..e8c2f8b914 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -46,6 +46,7 @@ class ApplicationManager;
class Application;
typedef std::shared_ptr<HmiState> HmiStatePtr;
+typedef int32_t WindowID;
/**
* @brief The HmiState class
@@ -206,11 +207,24 @@ class HmiState {
state_id_ = state_id;
}
+ /**
+ * @brief window_type getter for a window type for this type
+ * @return current state window type
+ */
+ mobile_apis::WindowType::eType window_type() const;
+
+ /**
+ * @brief set_window_type sets current state window type
+ * @param window_type new window type
+ */
+ void set_window_type(const mobile_apis::WindowType::eType window_type);
+
protected:
uint32_t hmi_app_id_;
StateID state_id_;
const ApplicationManager& app_mngr_;
HmiStatePtr parent_;
+ mobile_apis::WindowType::eType window_type_;
mobile_apis::HMILevel::eType hmi_level_;
mobile_apis::AudioStreamingState::eType audio_streaming_state_;
mobile_apis::VideoStreamingState::eType video_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 98992a20d5..44046be523 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -42,6 +42,7 @@
#include <application_manager/smart_object_keys.h>
#include "application_manager/application.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "connection_handler/device.h"
#include "interfaces/HMI_API.h"
@@ -302,6 +303,30 @@ class MessageHelper {
const uint32_t app_id,
ApplicationManager& app_mngr);
+ /**
+ * @brief Creates UI.CreateWindow request
+ * @param application application instance
+ * @param app_mngr reference to application manager
+ * @param windows_info smart object containing saved windows info
+ * @return smart object with UI.CreateWindow request
+ */
+ static smart_objects::SmartObjectSPtr CreateUICreateWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& window_info);
+
+ /**
+ * @brief Creates UI.CreateWindow requests
+ * @param application application instance
+ * @param app_mngr reference to application manager
+ * @param windows_info smart object containing saved windows info
+ * @return list of smart objects with UI.CreateWindow requests
+ */
+ static smart_objects::SmartObjectList CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info);
+
/*
* @brief Create Common.DeviceInfo struct from device handle
* @param device_handle device handle of the app
@@ -695,6 +720,23 @@ class MessageHelper {
* @param app current application
*
* @param function_id Unique command id from mobile API
+ *
+ * @param window_id window id containing soft buttons
+ */
+ static void SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id,
+ const WindowID window_id);
+
+ /*
+ * @brief subscribe application to softbutton
+ *
+ * @param message_params contains data of request
+ *
+ * @param app current application
+ *
+ * @param function_id Unique command id from mobile API
*/
static void SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
@@ -711,6 +753,15 @@ class MessageHelper {
*/
static bool PrintSmartObject(const smart_objects::SmartObject& object);
+ /**
+ * @brief Extract window unique ID from message, this id is used for identify
+ * the window
+ * @param s_map contains application's window id
+ * @return window id from current message
+ */
+ static WindowID ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map);
+
template <typename From, typename To>
static To ConvertEnumAPINoCheck(const From& input) {
return static_cast<To>(input);
@@ -864,10 +915,13 @@ class MessageHelper {
/**
* @brief Sends HMI status notification to mobile
- * @param application_impl application with changed HMI status
+ * @param application application with changed HMI status
+ * @param window_id id of affected window
+ * @param application_manager reference to application manager
**/
static void SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager);
/**
@@ -901,6 +955,16 @@ class MessageHelper {
static void BroadcastCapabilityUpdate(smart_objects::SmartObject& msg_params,
ApplicationManager& app_mngr);
+ /**
+ * @brief CreateDisplayCapabilityUpdateToMobile creates notification with
+ * updated display capabilities acccoring to message type
+ * @param system_capabilities SO containing notification data
+ * @param app reference to application
+ * @return shared ptr to notification SO
+ */
+ static smart_objects::SmartObjectSPtr CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& system_capabilities, Application& app);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index 3422a2a2d2..ccbd466cdd 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -108,6 +108,7 @@ class PolicyHandler : public PolicyHandlerInterface,
std::string* priority) const OVERRIDE;
virtual void CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) OVERRIDE;
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index 0b744eec7f..11b1bcf926 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -81,6 +81,13 @@ class ResumeCtrl {
application_manager::ApplicationSharedPtr application) = 0;
/**
+ * @brief Restore widgets HMI level on the resumption response from HMI
+ * @param response_message smart_object with HMI message
+ */
+ virtual void RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) = 0;
+
+ /**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
* @return true if success, otherwise return false
@@ -103,6 +110,16 @@ class ResumeCtrl {
bool check_policy = true) = 0;
/**
+ * @brief RestoreAppWidgets add widgets for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ * @return true if widgets resumed successfully otherwise - false
+ */
+ virtual void RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) = 0;
+
+ /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -233,7 +250,7 @@ class ResumeCtrl {
* @param application - application to restore hmi level
* and audio streaming state
*/
- virtual void StartAppHmiStateResumption(
+ virtual bool StartAppHmiStateResumption(
application_manager::ApplicationSharedPtr application) = 0;
/**
@@ -282,6 +299,9 @@ class ResumeCtrl {
virtual int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const = 0;
+ virtual void StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) = 0;
+
virtual time_t LaunchTime() const = 0;
#ifdef BUILD_TESTS
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index a70e2453de..5e6fb58671 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -95,6 +95,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
bool RestoreAppHMIState(app_mngr::ApplicationSharedPtr application) OVERRIDE;
+ void RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) OVERRIDE;
+
/**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
@@ -117,6 +120,14 @@ class ResumeCtrlImpl : public ResumeCtrl,
bool check_policy = true) OVERRIDE;
/**
+ * @brief RestoreAppWidgets add widgets for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void RestoreAppWidgets(application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -250,8 +261,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Resume HMI Level and audio streaming state if needed
* @param application - application to restore hmi level
* and audio streaming state
+ * @return true if success otherwise false
*/
- void StartAppHmiStateResumption(
+ bool StartAppHmiStateResumption(
app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
@@ -296,6 +308,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const OVERRIDE;
+ void StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
+
/**
* @brief geter for launch_time_
* @return value of launch_time_
@@ -592,6 +607,16 @@ class ResumeCtrlImpl : public ResumeCtrl,
app_mngr::ApplicationConstSharedPtr application) const;
/**
+ * @brief Constructs and sends system capability mobile notification
+ *
+ * @param app to send display capabilities updated
+ * @param display_capabilities SO containing notification data
+ */
+ void ProcessSystemCapabilityUpdated(
+ app_mngr::Application& app,
+ const smart_objects::SmartObject& display_capabilities);
+
+ /**
*@brief Mapping applications to time_stamps
* wait for timer to resume HMI Level
*
@@ -609,6 +634,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
time_t wake_up_time_;
std::shared_ptr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
+ /**
+ *@brief Mapping correlation id to request
+ *wait for on event response from HMI to resume HMI Level
+ */
+ typedef std::map<int32_t, smart_objects::SmartObjectSPtr>
+ WaitingResponseToRequest;
+ WaitingResponseToRequest requests_msg_;
};
} // namespace resumption
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 7db7a09cb4..d1dada345c 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
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
+/*
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -256,6 +256,14 @@ class ResumptionData {
app_mngr::ApplicationConstSharedPtr application) const;
/**
+ * @brief Retrieves of windows info from list of available window
+ * @param application contains list of available windows
+ * @return windows info from list of available window
+ */
+ smart_objects::SmartObject GetApplicationWidgetsInfo(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
* @brief checks pointer that it is not equal NULL
* @param ptr - contains pointer which need to check
* @return smartObject from pointer
@@ -264,6 +272,21 @@ class ResumptionData {
const smart_objects::SmartObject* ptr) const;
/**
+ * @brief creates smart object containing window info
+ * @param window_id window id
+ * @param window_type window type
+ * @param window_name window name
+ * @param window_optional_params_map collection containing optional params for
+ * creating window
+ * @return smart object with window data
+ */
+ smart_objects::SmartObject CreateWindowInfoSO(
+ const application_manager::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const application_manager::WindowParamsMap& window_optional_params_map)
+ const;
+
+ /**
* @brief Creates smart array from received data
* @param first - iterator points to beginning of the data
* @param last - iterator points to ending of the data
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index 9bffc37bf6..1831d8cb4d 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -53,6 +53,7 @@ extern const char* info;
extern const char* app_id;
extern const char* full_app_id;
extern const char* bundle_id;
+extern const char* window_id;
extern const char* app_info;
extern const char* app_launch;
extern const char* app_launch_list;
@@ -172,6 +173,13 @@ extern const char* activate_app_hmi_level;
extern const char* audio_streaming_state;
extern const char* video_streaming_state;
extern const char* system_context;
+extern const char* window_name;
+extern const char* window_type;
+extern const char* window_type_supported;
+extern const char* maximum_number_of_windows;
+extern const char* window_capabilities;
+extern const char* associated_service_type;
+extern const char* duplicate_updates_from_window_id;
extern const char* speech_capabilities;
extern const char* vr_capabilities;
extern const char* audio_pass_thru_capabilities;
@@ -196,6 +204,8 @@ extern const char* red;
extern const char* green;
extern const char* blue;
extern const char* display_layout;
+extern const char* template_configuration;
+extern const char* template_layout;
extern const char* icon_resumed;
extern const char* nicknames;
extern const char* enabled;
@@ -205,6 +215,7 @@ extern const char* hybrid_app_preference;
extern const char* is_cloud_application;
extern const char* cloud_connection_status;
extern const char* endpoint;
+extern const char* display_capabilities;
// PutFile
extern const char* sync_file_name;
@@ -377,6 +388,8 @@ extern const char* ign_off_count;
extern const char* global_ign_on_counter;
+extern const char* suspend_count;
+
extern const char* connection_info;
extern const char* is_download_complete;
@@ -413,6 +426,8 @@ extern const char* delivery_mode;
extern const char* audio_streaming_indicator;
+extern const char* windows_info;
+
// keys for default parameters loaded from hmi_capabilities.json:
extern const char* const keyboard_properties_default;
extern const char* const language_default;
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 77da28cc91..000569e450 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
@@ -52,138 +52,79 @@ class StateControllerImpl : public event_engine::EventObserver,
public:
explicit StateControllerImpl(ApplicationManager& app_mngr);
- /**
- * @brief SetRegularState setup regular hmi state, that will appear if
- * no specific events are active
- * @param app appication to setup regular State
- * @param state state of new regular state
- */
-
- virtual void SetRegularState(ApplicationSharedPtr app,
- HmiStatePtr state,
- const bool SendActivateApp);
-
- /**
- * @brief SetRegularState Change regular hmi level and audio state
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @paran video_state of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state,
+ const bool SendActivateApp) OVERRIDE;
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp);
-
- /**
- * @brief SetRegularState Change regular hmi level
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
- */
- virtual void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp);
+ const bool SendActivateApp) OVERRIDE;
- /**
- * @brief SetRegularState Change regular hmi level, audio state and system
- * context
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param video_state of new regular state
- * @param system_context of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const bool SendActivateApp) OVERRIDE;
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp);
+ const bool SendActivateApp) OVERRIDE;
- /**
- * @brief SetRegularState Sets regular state with new hmi level
- * to application
- * @param app appication to setup regular state
- * @param hmi_level new hmi level for application
- */
- virtual void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level);
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level) OVERRIDE;
- /**
- * @brief SetRegularState Change regular audio state
- * @param app appication to setup regular State
- * @param audio_state of new regular state
- * @param video_state of new regular state
- */
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
- const mobile_apis::VideoStreamingState::eType video_state);
+ const mobile_apis::VideoStreamingState::eType video_state) OVERRIDE;
- /**
- * @brief SetRegularState Change regular system context
- * @param app appication to setup regular State
- * @param system_context of new regular state
- */
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
- const mobile_apis::SystemContext::eType system_context);
+ const WindowID window_id,
+ const mobile_apis::SystemContext::eType system_context) OVERRIDE;
- /**
- * @brief SetRegularState Sets new regular state to application
- * @param app appication to setup regular state
- * @param state new hmi state for application
- */
- virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state) OVERRIDE;
- // EventObserver interface
- void on_event(const event_engine::Event& event);
- void on_event(const event_engine::MobileEvent& event);
+ void OnApplicationRegistered(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType default_level) OVERRIDE;
- /**
- * @brief Sets default application state and apply currently active HMI states
- * on application registration
- * @param app application to apply states
- * @param default_level default HMI level
- */
- virtual void OnApplicationRegistered(
+ void OnAppWindowAdded(
ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType default_level);
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) OVERRIDE;
- /**
- * @brief OnVideoStreamingStarted process video streaming started
- * @param app projection or navigation application starting streaming
- */
- virtual void OnVideoStreamingStarted(ApplicationConstSharedPtr app);
+ void OnVideoStreamingStarted(ApplicationConstSharedPtr app) OVERRIDE;
- /**
- * @brief OnVideoStreamingStopped process video streaming stopped
- * @param app projection or navigation application stopping streaming
- */
- virtual void OnVideoStreamingStopped(ApplicationConstSharedPtr app);
+ void OnVideoStreamingStopped(ApplicationConstSharedPtr app) OVERRIDE;
- /**
- * @brief OnStateChanged send HMIStatusNotification if needed
- * @param app application
- * @param old_state state before change
- * @param new_state state after change
- */
- virtual void OnStateChanged(ApplicationSharedPtr app,
- HmiStatePtr old_state,
- HmiStatePtr new_state);
+ void OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr old_state,
+ HmiStatePtr new_state) OVERRIDE;
- /**
- * @brief Checks activity of Deactivate HMI state.
- * @return Returns TRUE if deactivate HMI state is active, otherwise returns
- * FALSE.
- */
- virtual bool IsStateActive(HmiState::StateID state_id) const;
+ bool IsStateActive(HmiState::StateID state_id) const OVERRIDE;
+
+ // EventObserver interface
+ void on_event(const event_engine::Event& event) OVERRIDE;
+ void on_event(const event_engine::MobileEvent& event) OVERRIDE;
+
+ void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
+ void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
private:
int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
@@ -195,12 +136,17 @@ class StateControllerImpl : public event_engine::EventObserver,
*/
struct HmiLevelConflictResolver {
const ApplicationSharedPtr applied_;
+ const WindowID window_id_;
const HmiStatePtr state_;
StateControllerImpl* state_ctrl_;
HmiLevelConflictResolver(const ApplicationSharedPtr app,
+ const WindowID window_id,
const HmiStatePtr state,
StateControllerImpl* state_ctrl)
- : applied_(app), state_(state), state_ctrl_(state_ctrl) {}
+ : applied_(app)
+ , window_id_(window_id)
+ , state_(state)
+ , state_ctrl_(state_ctrl) {}
void operator()(ApplicationSharedPtr to_resolve);
};
@@ -298,14 +244,19 @@ class StateControllerImpl : public event_engine::EventObserver,
template <HmiState::StateID ID>
void HMIStateStarted(ApplicationSharedPtr app) {
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
- HmiStatePtr new_hmi_state = CreateHmiState(app, ID);
- DCHECK_OR_RETURN_VOID(new_hmi_state);
- DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
- HmiState::STATE_ID_REGULAR);
- new_hmi_state->set_parent(old_hmi_state);
- app->AddHMIState(new_hmi_state);
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (auto window_id : window_ids) {
+ HmiStatePtr old_hmi_state = app->CurrentHmiState(window_id);
+ HmiStatePtr new_hmi_state = CreateHmiState(app, ID);
+ DCHECK_OR_RETURN_VOID(new_hmi_state);
+ DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
+ HmiState::STATE_ID_REGULAR);
+ new_hmi_state->set_parent(old_hmi_state);
+ new_hmi_state->set_window_type(old_hmi_state->window_type());
+ app->AddHMIState(window_id, new_hmi_state);
+ OnStateChanged(app, window_id, old_hmi_state, new_hmi_state);
+ }
}
/**
@@ -326,7 +277,7 @@ class StateControllerImpl : public event_engine::EventObserver,
* depends on application type
* @param app Application to deactivate
*/
- void DeactivateApp(ApplicationSharedPtr app);
+ void DeactivateApp(ApplicationSharedPtr app, const WindowID window_id);
/**
* Function to remove temporary HmiState for application
@@ -334,45 +285,68 @@ class StateControllerImpl : public event_engine::EventObserver,
template <HmiState::StateID ID>
void HMIStateStopped(ApplicationSharedPtr app) {
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr cur = app->CurrentHmiState();
- HmiStatePtr old_hmi_state =
- CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(old_hmi_state);
- old_hmi_state->set_hmi_level(cur->hmi_level());
- old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
- old_hmi_state->set_video_streaming_state(cur->video_streaming_state());
- old_hmi_state->set_system_context(cur->system_context());
- app->RemoveHMIState(ID);
- HmiStatePtr new_hmi_state = app->CurrentHmiState();
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (auto window_id : window_ids) {
+ HmiStatePtr cur = app->CurrentHmiState(window_id);
+ HmiStatePtr old_hmi_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(old_hmi_state);
+ old_hmi_state->set_hmi_level(cur->hmi_level());
+ old_hmi_state->set_window_type(cur->window_type());
+ old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
+ old_hmi_state->set_video_streaming_state(cur->video_streaming_state());
+ old_hmi_state->set_system_context(cur->system_context());
+ app->RemoveHMIState(window_id, ID);
+ HmiStatePtr new_hmi_state = app->CurrentHmiState(window_id);
+ OnStateChanged(app, window_id, old_hmi_state, new_hmi_state);
+ }
}
/**
* @brief ApplyRegularState setup regular hmi state, that will appear if no
* specific events are active, without sending ActivateApp
* @param app appication to setup default State
+ * @param window_id id of applicaion's window to apply HMI state
* @param state state of new defailt state
*/
- void ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+ void ApplyRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state);
+
+ /**
+ * @brief UpdateAppWindowsStreamingState updates all application windows
+ * audio/video streaming state according to a new HMI state of the main window
+ * @param app pointer to affected application
+ * @param state pointer to state with the new streaming state of the main
+ * window
+ */
+ void UpdateAppWindowsStreamingState(ApplicationSharedPtr app,
+ HmiStatePtr state);
/**
* @brief SetupRegularHmiState set regular HMI State without
* resolving conflicts and ActivateApp request
* @param app application
+ * @param window_id id of applicaion's window to apply HMI state
* @param state hmi_state to setup
*/
- void SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state);
+ void SetupRegularHmiState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state);
/**
* @brief SetupRegularHmiState set regular HMI State without
* resolving conflicts and ActivateApp request
* @param app application
+ * @param window_id id of applicaion's window to apply HMI state
* @param hmi_level of new regular state
* @param audio_state of new regular state
* @param video_state of new regular state
*/
void SetupRegularHmiState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
index cf1df2cb68..0a512b2839 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
@@ -94,7 +94,7 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
}
const mobile_apis::HMILevel::eType acquiring_app_hmi_level =
- acquiring_app->hmi_level();
+ acquiring_app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) {
LOG4CXX_DEBUG(logger_,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
index a72b89b9de..bbf9032c96 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
@@ -72,6 +72,8 @@ const uint32_t kHMIAppId1 = 1u;
const uint32_t kAppId2 = 22u;
const std::string policy_app_id_1_ = "policy_id_1";
const uint32_t kSizeOfModules = 6u;
+const application_manager::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
namespace rc_rpc_plugin_test {
@@ -134,7 +136,8 @@ void RAManagerTest::CheckResultWithHMILevelAndAccessMode(
ra_manager.AcquireResource(kModuleType1, kAppId1));
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level()).WillOnce(Return(app_level));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(app_level));
// Second app tries to get already acquired resource by 1st app
EXPECT_EQ(expected_result, ra_manager.AcquireResource(kModuleType1, kAppId2));
}
@@ -306,7 +309,7 @@ TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
ra_manager.AcquireResource(kModuleType1, kAppId2));
@@ -360,7 +363,7 @@ TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
ra_manager.AcquireResource(kModuleType1, kAppId2));
@@ -400,7 +403,7 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
ra_manager.AcquireResource(kModuleType1, kAppId2));
@@ -461,7 +464,7 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
ra_manager.AcquireResource(kModuleType1, kAppId2));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
new file mode 100644
index 0000000000..39b5c3aee3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_FROM_HMI_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_FROM_HMI_H_
+
+#include "application_manager/commands/notification_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief OnBCSystemCapabilityUpdatedNotificationFromHMI command class
+ **/
+class OnBCSystemCapabilityUpdatedNotificationFromHMI
+ : public app_mngr::commands::NotificationFromHMI {
+ public:
+ /**
+ * @brief OnBCSystemCapabilityUpdatedNotificationFromHMI class constructor
+ * @param message Incoming SmartObject message from HMI
+ * @note all parameters described below required for base class
+ * @param application_manager Application manager instance to interact with
+ * related application
+ * @param rpc_service - service to handle appropriate RPC
+ * @param hmi_capabilities - HMI capabilities
+ * @param policy_handle - instance which allows interaction between
+ * application manager and application policies
+ **/
+ OnBCSystemCapabilityUpdatedNotificationFromHMI(
+ const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ /**
+ * @brief OnBCSystemCapabilityUpdatedNotificationFromHMI class destructor
+ **/
+ ~OnBCSystemCapabilityUpdatedNotificationFromHMI() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ enum ProcessSystemDisplayCapabilitiesResult {
+ SUCCESS,
+ FAIL,
+ CAPABILITIES_CACHED
+ };
+ /**
+ * @brief ProcessSystemDisplayCapabilities processes provided display
+ * capabilities according to its structure
+ * @param display_capabilities display capabilities to process
+ * @return true if display capabilities have been processed properly,
+ * otherwise returns false
+ */
+ ProcessSystemDisplayCapabilitiesResult ProcessSystemDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ DISALLOW_COPY_AND_ASSIGN(OnBCSystemCapabilityUpdatedNotificationFromHMI);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_ON_BC_SYSTEM_CAPABILITY_UPDATED_NOTIFICATION_FROM_HMI_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
new file mode 100644
index 0000000000..6fe8e182c4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_request.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.CreateWindow request command class
+ **/
+class UICreateWindowRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ UICreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UICreateWindowRequest() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UICreateWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h
new file mode 100644
index 0000000000..b9452fce1f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_create_window_response.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.CreateWindow response command class
+ **/
+class UICreateWindowResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ UICreateWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UICreateWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UICreateWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CREATE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h
new file mode 100644
index 0000000000..58b2c3989f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.DeleteWindow request command class
+ **/
+class UIDeleteWindowRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ UIDeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UIDeleteWindowRequest() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIDeleteWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h
new file mode 100644
index 0000000000..1500a3f9b2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UI.DeleteWindow response command class
+ **/
+class UIDeleteWindowResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ UIDeleteWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle);
+
+ ~UIDeleteWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIDeleteWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_DELETE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
new file mode 100644
index 0000000000..cfbfc460b7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_request.h
@@ -0,0 +1,117 @@
+/*
+ Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/hmi_state.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CreateWindow request command class
+ **/
+class CreateWindowRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ CreateWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~CreateWindowRequest() FINAL;
+
+ app_mngr::WindowID window_id() const FINAL;
+
+ void Run() FINAL;
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ /**
+ * @brief Init sets hash update mode for request
+ */
+ bool Init() FINAL;
+
+ private:
+ /**
+ * @brief CheckWindowName checks if provided window_name exists and allowed to
+ * be created
+ * @param app pointer to application owns affected window
+ * @param window_name window name to check
+ * @return true if window_name is valid, otherwise returns false
+ */
+ bool CheckWindowName(app_mngr::ApplicationSharedPtr app,
+ const app_mngr::WindowID window_id,
+ const std::string& window_name) const;
+
+ /**
+ * @brief ValidateWindowCreation checks whether window can be created
+ * @return true if window can be created, otherwise returns false
+ */
+ bool ValidateWindowCreation(app_mngr::ApplicationSharedPtr app,
+ const app_mngr::WindowID window_id);
+
+ /**
+ * @brief IsWindowForAssociatedServiceCreated check whether a window with
+ * current associated type has already been created
+ * @return true if window has been created, otherwise returns false
+ */
+ bool IsWindowForAssociatedServiceCreated(
+ app_mngr::ApplicationSharedPtr app) const;
+
+ /**
+ * @brief DoesExceedMaxAllowedWindows check wheter max allowed amount of
+ * windows is exceeded
+ * @return true if amount us exceeded, otherwise returns false
+ */
+ bool DoesExceedMaxAllowedWindows(app_mngr::ApplicationSharedPtr app) const;
+
+ /**
+ * @brief ApplyWindowInitialState apply changes related to window HMI state
+ * initialization
+ * @param app pointer to application owns affected window
+ */
+ void ApplyWindowInitialState(app_mngr::ApplicationSharedPtr app) const;
+
+ DISALLOW_COPY_AND_ASSIGN(CreateWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h
new file mode 100644
index 0000000000..5163293a7c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/create_window_response.h
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CreateWindow response command class
+ **/
+class CreateWindowResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ CreateWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~CreateWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CreateWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CREATE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
new file mode 100644
index 0000000000..b837724d7b
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_request.h
@@ -0,0 +1,91 @@
+/*
+ Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/hmi_state.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CreateWindow request command class
+ **/
+class DeleteWindowRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ DeleteWindowRequest(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~DeleteWindowRequest() FINAL;
+
+ void Run() FINAL;
+
+ void on_event(const app_mngr::event_engine::Event& event) FINAL;
+
+ app_mngr::WindowID window_id() const FINAL;
+
+ /**
+ * @brief Init sets hash update mode for request
+ */
+ bool Init() FINAL;
+
+ private:
+ /**
+ * @brief CheckWindowId checks if provided window_id exists and allowed to be
+ * deleted
+ * @param app pointer to application owns affected window
+ * @return true if window_id is valid, otherwise returns false
+ */
+ bool CheckWindowId(app_mngr::ApplicationSharedPtr app) const;
+
+ /**
+ * @brief DeleteWindow deletes data related to a request window id
+ * @param app pointer to applications owns affected window
+ */
+ void DeleteWindow(app_mngr::ApplicationSharedPtr app) const;
+
+ DISALLOW_COPY_AND_ASSIGN(DeleteWindowRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h
new file mode 100644
index 0000000000..279541724a
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/delete_window_response.h
@@ -0,0 +1,67 @@
+/*
+ Copyright (c) 2019, 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.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief DeleteWindow response command class
+ **/
+class DeleteWindowResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ DeleteWindowResponse(const app_mngr::commands::MessageSharedPtr& message,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ ~DeleteWindowResponse() FINAL;
+
+ void Run() FINAL;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DeleteWindowResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_DELETE_WINDOW_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
index c894b355d6..c55dcb65fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h
@@ -126,7 +126,7 @@ class RegisterAppInterfaceRequest
*
* @param app application with changed HMI status
* @param resumption If true, resumption-related parameters will be sent to
- *the HMI
+ * the HMI
* @param need_restore_vr If resumption is true, whether or not VR commands
*should be resumed
**/
@@ -207,8 +207,8 @@ class RegisterAppInterfaceRequest
void SendSubscribeCustomButtonNotification();
/**
- * @brief IsApplicationSwitched checks whether application is switched from
- * another transport. If application id is found, but not in reconnection
+ * @brief IsApplicationSwitched checks whether application is switched
+ * from another transport. If application id is found, but not in reconnection
* list, returns 'already registered' code. Otherwise - proceed with
* switching.
* @return True if application is detected as switched, otherwise false.
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
index 586004b783..26612609a4 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_request.h
@@ -90,8 +90,33 @@ class ShowRequest : public app_mngr::commands::CommandRequestImpl {
int32_t field_index,
smart_objects::SmartObject& msg_params);
+ /**
+ * @brief Handle the template configuration information from the
+ * incoming mobile json message format for specified application
+ * @param app - application for which configuration should be checked
+ * @return True if template config can be successfully applied otherwise -
+ * false
+ */
+ bool CheckTemplateConfigurationForApp(application_manager::Application& app);
+
+ /**
+ * @brief Applies the template configuration which was set up beforehand
+ * @param result - result code on which template application is dependent
+ * @param app - application for which configuration should be applied
+ */
+ void ApplyTemplateConfigurationForApp(mobile_apis::Result::eType result,
+ application_manager::Application& app);
+
mobile_apis::Result::eType core_result_code_;
std::string core_response_info_;
+ app_mngr::WindowID current_window_id_;
+ smart_objects::SmartObject template_config_;
+ bool layout_change_required_;
+
+ // dcs - abbreviation of Day Color Scheme
+ bool dcs_change_required_;
+ // ncd - abbreviation of Night Color Scheme
+ bool ncs_change_required_;
DISALLOW_COPY_AND_ASSIGN(ShowRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
index 37dca47793..1a104c0fa1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification.cc
@@ -161,6 +161,15 @@ void OnBCSystemCapabilityUpdatedNotification::Run() {
[strings::app_services_capabilities] = app_service_caps;
break;
}
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ if (!hmi_capabilities_.system_display_capabilities()) {
+ LOG4CXX_INFO(logger_, "system_display_capabilities are not available");
+ return;
+ }
+ msg_params[strings::system_capability][strings::display_capabilities] =
+ *hmi_capabilities_.system_display_capabilities();
+ break;
+ }
default:
return;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
new file mode 100644
index 0000000000..6077425c07
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.cc
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h"
+
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/HMI_API.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ OnBCSystemCapabilityUpdatedNotificationFromHMI(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : NotificationFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ~OnBCSystemCapabilityUpdatedNotificationFromHMI() {}
+
+OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ProcessSystemDisplayCapabilitiesResult
+ OnBCSystemCapabilityUpdatedNotificationFromHMI::
+ ProcessSystemDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!(*message_)[strings::msg_params].keyExists(strings::app_id)) {
+ LOG4CXX_DEBUG(logger_, "Updating general display capabilities");
+ hmi_capabilities_.set_system_display_capabilities(display_capabilities);
+ return ProcessSystemDisplayCapabilitiesResult::SUCCESS;
+ }
+
+ const auto app_id =
+ (*message_)[strings::msg_params][strings::app_id].asUInt();
+ auto app = application_manager_.application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with app_id " << app_id << " is not registered");
+ return ProcessSystemDisplayCapabilitiesResult::FAIL;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Updating display capabilities for app " << app_id);
+ app->set_display_capabilities(display_capabilities);
+
+ // Remove app_id from notification to mobile
+ (*message_)[strings::params][strings::connection_key] =
+ (*message_)[strings::msg_params][strings::app_id];
+ (*message_)[strings::msg_params].erase(strings::app_id);
+ if (app->is_resuming() && app->is_app_data_resumption_allowed()) {
+ LOG4CXX_DEBUG(logger_, "Application is resuming");
+ app->display_capabilities_builder().UpdateDisplayCapabilities(
+ display_capabilities);
+ return ProcessSystemDisplayCapabilitiesResult::CAPABILITIES_CACHED;
+ }
+
+ return ProcessSystemDisplayCapabilitiesResult::SUCCESS;
+}
+
+void OnBCSystemCapabilityUpdatedNotificationFromHMI::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // Prepare SmartObject for mobile factory
+ (*message_)[strings::params][strings::function_id] = static_cast<int32_t>(
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID);
+
+ const auto& system_capability =
+ (*message_)[strings::msg_params][strings::system_capability];
+ if (mobile_apis::SystemCapabilityType::DISPLAYS ==
+ system_capability[strings::system_capability_type].asInt() &&
+ system_capability.keyExists(strings::display_capabilities)) {
+ const auto result = ProcessSystemDisplayCapabilities(
+ system_capability[strings::display_capabilities]);
+ if (ProcessSystemDisplayCapabilitiesResult::FAIL == result) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to process display capabilities. Notification will "
+ "be ignored");
+ return;
+ } else if (ProcessSystemDisplayCapabilitiesResult::CAPABILITIES_CACHED ==
+ result) {
+ LOG4CXX_TRACE(logger_, "Capabilities are being cached for resuming app");
+ return;
+ }
+ }
+
+ SendNotificationToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
index 4229369acc..a29b9721e9 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_driver_distraction_notification.cc
@@ -65,7 +65,11 @@ struct OnDriverDistractionProcessor {
const RPCParams params;
policy::CheckPermissionResult result;
application_manager_.GetPolicyHandler().CheckPermissions(
- application, stringified_function_id_, params, result);
+ application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ stringified_function_id_,
+ params,
+ result);
auto& msg_params = message[strings::msg_params];
const bool is_lock_screen_dismissal_exists = msg_params.keyExists(
mobile_notification::lock_screen_dismissal_enabled);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
index 11647e2140..3eec6c5d1a 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_exit_application_notification.cc
@@ -119,12 +119,7 @@ void OnExitApplicationNotification::Run() {
}
}
- application_manager_.state_controller().SetRegularState(
- app_impl,
- HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- VideoStreamingState::NOT_STREAMABLE,
- false);
+ application_manager_.state_controller().ExitDefaultWindow(app_impl);
}
} // namespace commands
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
index 38b87f23d3..bf52492ae1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_system_context_notification.cc
@@ -62,13 +62,27 @@ void OnSystemContextNotification::Run() {
(*message_)[strings::msg_params][hmi_notification::system_context]
.asInt());
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+
ApplicationSharedPtr app;
- if ((mobile_api::SystemContext::SYSCTXT_VRSESSION == system_context) ||
- (mobile_api::SystemContext::SYSCTXT_MENU == system_context) ||
- (mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED == system_context)) {
+ if (helpers::
+ Compare<mobile_api::SystemContext::eType, helpers::EQ, helpers::ONE>(
+ system_context,
+ mobile_api::SystemContext::SYSCTXT_VRSESSION,
+ mobile_api::SystemContext::SYSCTXT_MENU,
+ mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED)) {
app = application_manager_.active_application();
- } else if ((mobile_api::SystemContext::SYSCTXT_ALERT == system_context) ||
- (mobile_api::SystemContext::SYSCTXT_MAIN == system_context)) {
+ }
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id ||
+ helpers::Compare<mobile_api::SystemContext::eType,
+ helpers::EQ,
+ helpers::ONE>(system_context,
+ mobile_api::SystemContext::SYSCTXT_ALERT,
+ mobile_api::SystemContext::SYSCTXT_MAIN)) {
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
app = application_manager_.application(
(*message_)[strings::msg_params][strings::app_id].asUInt());
@@ -76,8 +90,8 @@ void OnSystemContextNotification::Run() {
}
if (app && mobile_api::SystemContext::INVALID_ENUM != system_context) {
- application_manager_.state_controller().SetRegularState(app,
- system_context);
+ application_manager_.state_controller().SetRegularState(
+ app, window_id, system_context);
} else {
LOG4CXX_ERROR(logger_, "Application does not exist");
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
index 7680b74426..19b4047b1b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_command_notification.cc
@@ -72,7 +72,10 @@ void OnVRCommandNotification::Run() {
ApplicationSharedPtr app = application_manager_.application(app_id);
if (app) {
application_manager_.state_controller().SetRegularState(
- app, mobile_apis::HMILevel::HMI_FULL, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_FULL,
+ true);
} else {
LOG4CXX_ERROR(logger_, "Unable to find appication " << app_id);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
index 55c6eb8881..c308af9b92 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/on_vr_language_change_notification.cc
@@ -83,7 +83,10 @@ void OnVRLanguageChangeNotification::Run() {
if (static_cast<int32_t>(app->language()) !=
(*message_)[strings::msg_params][strings::language].asInt()) {
application_manager_.state_controller().SetRegularState(
- app, mobile_api::HMILevel::HMI_NONE, false);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_NONE,
+ false);
rpc_service_.ManageMobileCommand(
MessageHelper::GetOnAppInterfaceUnregisteredNotificationToMobile(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
new file mode 100644
index 0000000000..b354009e3f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_request.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/hmi/ui_create_window_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICreateWindowRequest::UICreateWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UICreateWindowRequest::~UICreateWindowRequest() {}
+
+void UICreateWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
new file mode 100644
index 0000000000..c3a323818d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_create_window_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/hmi/ui_create_window_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICreateWindowResponse::UICreateWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UICreateWindowResponse::~UICreateWindowResponse() {}
+
+void UICreateWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
new file mode 100644
index 0000000000..7933574d92
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_request.cc
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UIDeleteWindowRequest::UIDeleteWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIDeleteWindowRequest::~UIDeleteWindowRequest() {}
+
+void UIDeleteWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SendRequest();
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
new file mode 100644
index 0000000000..ba703e18ae
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_delete_window_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UIDeleteWindowResponse::UIDeleteWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handle)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIDeleteWindowResponse::~UIDeleteWindowResponse() {}
+
+void UIDeleteWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*message_);
+ event.raise(application_manager_.event_dispatcher());
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
index d2e15d7350..a3eb9244bd 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_get_capabilities_response.cc
@@ -121,6 +121,12 @@ void UIGetCapabilitiesResponse::Run() {
msg_params[strings::system_capabilities]
[strings::video_streaming_capability]);
}
+ if (msg_params[strings::system_capabilities].keyExists(
+ strings::display_capabilities)) {
+ hmi_capabilities.set_system_display_capabilities(
+ msg_params[strings::system_capabilities]
+ [strings::display_capabilities]);
+ }
}
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
index dc225df3be..7a0fd79b08 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc
@@ -251,7 +251,8 @@ bool AlertRequest::Validate(uint32_t app_id) {
return false;
}
- if (mobile_apis::HMILevel::HMI_BACKGROUND == app->hmi_level() &&
+ if (mobile_apis::HMILevel::HMI_BACKGROUND ==
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) &&
app->AreCommandLimitsExceeded(
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
index 736f0355dc..275f1d82a6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
@@ -101,6 +101,7 @@ void CloseApplicationRequest::on_event(const event_engine::Event& event) {
application_manager_.GetPluginManager().ForEachPlugin(on_app_exit);
application_manager_.state_controller().SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
new file mode 100644
index 0000000000..21b54b4e9f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_request.cc
@@ -0,0 +1,370 @@
+/*
+ Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/mobile/create_window_request.h"
+
+#include <algorithm>
+
+#include "application_manager/application_impl.h"
+#include "application_manager/application_state.h"
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+using app_mngr::ApplicationSharedPtr;
+
+namespace commands {
+
+CreateWindowRequest::CreateWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CreateWindowRequest::~CreateWindowRequest() {}
+
+bool CreateWindowRequest::CheckWindowName(
+ app_mngr::ApplicationSharedPtr app,
+ const app_mngr::WindowID window_id,
+ const std::string& window_name) const {
+ if (mobile_apis::PredefinedWindows::PRIMARY_WIDGET == window_id) {
+ LOG4CXX_DEBUG(logger_,
+ "Window name check is ignored for the primary widgets");
+ return true;
+ }
+
+ const bool names_are_equal = window_name == app->name().c_str();
+ if (names_are_equal &&
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_ERROR(logger_,
+ "Regular widget can't have the same name as application: "
+ << window_name);
+ return false;
+ }
+
+ const WindowNames window_names = app->GetWindowNames();
+ return !helpers::in_range(window_names, window_name);
+}
+
+void CreateWindowRequest::ApplyWindowInitialState(
+ ApplicationSharedPtr app) const {
+ const mobile_apis::WindowType::eType window_type =
+ static_cast<mobile_apis::WindowType::eType>(
+ (*message_)[strings::msg_params][strings::window_type].asInt());
+
+ // State should be initialized with INVALID_ENUM value to let state controller
+ // trigger OnHmiStatus notifiation sending
+ HmiStatePtr initial_state = application_manager_.CreateRegularState(
+ app,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_api::SystemContext::INVALID_ENUM);
+
+ const WindowID window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ const std::string window_name =
+ (*message_)[strings::msg_params][strings::window_name].asString();
+
+ smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::associated_service_type)) {
+ window_info[strings::associated_service_type] =
+ (*message_)[strings::msg_params][strings::associated_service_type];
+ }
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::duplicate_updates_from_window_id)) {
+ window_info[strings::duplicate_updates_from_window_id] =
+ (*message_)[strings::msg_params]
+ [strings::duplicate_updates_from_window_id];
+ }
+
+ window_info[strings::window_name] = window_name;
+
+ app->SetWindowInfo(window_id, window_info);
+
+ app->SetInitialState(window_id, window_name, initial_state);
+
+ // Default HMI level for all windows except the main one is always NONE
+ application_manager_.state_controller().OnAppWindowAdded(
+ app, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
+}
+
+app_mngr::WindowID CreateWindowRequest::window_id() const {
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
+void CreateWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto application = application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ const auto window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ if (application->WindowIdExists(window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << window_id << " does already exist");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+
+ const auto window_type =
+ (*message_)[strings::msg_params][strings::window_type].asInt();
+
+ if (mobile_apis::WindowType::eType::MAIN == window_type) {
+ LOG4CXX_ERROR(logger_, "MAIN application window already exists");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::duplicate_updates_from_window_id)) {
+ const auto duplicate_updates_from_window_id =
+ (*message_)[strings::msg_params]
+ [strings::duplicate_updates_from_window_id]
+ .asInt();
+ if (!application->WindowIdExists(duplicate_updates_from_window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << duplicate_updates_from_window_id
+ << " does not exist");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+ }
+
+ const std::string window_name =
+ (*message_)[strings::msg_params][strings::window_name].asString();
+ if (!CheckWindowName(application, window_id, window_name)) {
+ LOG4CXX_ERROR(logger_,
+ "Window name \"" << window_name
+ << "\" is disallowed for window #"
+ << window_id);
+ SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
+ return;
+ }
+
+ if (!ValidateWindowCreation(application, window_id)) {
+ return;
+ }
+
+ smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendHMIRequest(hmi_apis::FunctionID::UI_CreateWindow, &msg_params, true);
+}
+
+void CreateWindowRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::UI_CreateWindow != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+
+ auto application = application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ LOG4CXX_INFO(logger_, "Received CreateWindow event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
+ const smart_objects::SmartObject& response_message = event.smart_object();
+ const auto result_code = CommandRequestImpl::GetMobileResultCode(
+ static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt()));
+
+ const bool is_success = IsMobileResultSuccess(result_code);
+ std::string response_info;
+ GetInfo(response_message, response_info);
+
+ if (!is_success) {
+ LOG4CXX_ERROR(logger_, "CreateWindow request has failed on HMI side");
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+ return;
+ }
+
+ ApplyWindowInitialState(application);
+
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+}
+
+bool CreateWindowRequest::Init() {
+ hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
+ return true;
+}
+
+bool CreateWindowRequest::IsWindowForAssociatedServiceCreated(
+ app_mngr::ApplicationSharedPtr app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const auto window_optional_params_map =
+ app->window_optional_params_map().GetData();
+
+ if (!(*message_)[strings::msg_params].keyExists(
+ strings::associated_service_type)) {
+ return false;
+ }
+
+ const auto associated_service_type =
+ (*message_)[strings::msg_params][strings::associated_service_type]
+ .asString();
+
+ const auto find_res = std::find_if(
+ window_optional_params_map.begin(),
+ window_optional_params_map.end(),
+ [&associated_service_type](
+ const std::pair<WindowID, smart_objects::SmartObjectSPtr>& element) {
+ LOG4CXX_DEBUG(logger_,
+ "Searching for " << associated_service_type
+ << " in window info for id "
+ << element.first);
+ if (element.second->keyExists(strings::associated_service_type) &&
+ associated_service_type ==
+ (*element.second)[strings::associated_service_type]
+ .asString()) {
+ return true;
+ }
+
+ return false;
+ });
+
+ return find_res != window_optional_params_map.end();
+}
+
+bool CreateWindowRequest::DoesExceedMaxAllowedWindows(
+ app_mngr::ApplicationSharedPtr app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto get_current_number_of_windows =
+ [&app](const mobile_apis::WindowType::eType window_type) -> size_t {
+ switch (window_type) {
+ case mobile_apis::WindowType::MAIN: {
+ return 1u;
+ }
+ case mobile_apis::WindowType::WIDGET: {
+ return app->window_optional_params_map().GetData().size();
+ }
+
+ default: {
+ LOG4CXX_WARN(logger_, "Unknown window type");
+ return 0u;
+ }
+ }
+ };
+
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ (*message_)[strings::msg_params][strings::window_type].asInt());
+
+ const auto display_capabilities = app->display_capabilities();
+
+ if (!display_capabilities) {
+ LOG4CXX_WARN(logger_, "Application has no capabilities");
+ return false;
+ }
+
+ MessageHelper::PrintSmartObject(*display_capabilities);
+
+ const auto windowTypeSupported =
+ (*display_capabilities)[0][strings::window_type_supported].asArray();
+
+ DCHECK(windowTypeSupported);
+
+ const auto find_res = std::find_if(
+ windowTypeSupported->begin(),
+ windowTypeSupported->end(),
+ [&window_type](const smart_objects::SmartObject& element) {
+ if (window_type == static_cast<mobile_apis::WindowType::eType>(
+ element[strings::window_type].asInt())) {
+ return true;
+ }
+
+ return false;
+ });
+
+ DCHECK(find_res != windowTypeSupported->end());
+
+ if (get_current_number_of_windows(window_type) + 1 >
+ (*find_res)[strings::maximum_number_of_windows].asUInt()) {
+ return true;
+ }
+
+ return false;
+}
+
+bool CreateWindowRequest::ValidateWindowCreation(
+ app_mngr::ApplicationSharedPtr app, const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (DoesExceedMaxAllowedWindows(app)) {
+ std::string info("Maximum allowed amount of windows is exceeded");
+ LOG4CXX_WARN(logger_, info);
+ SendResponse(false, mobile_apis::Result::REJECTED, info.c_str());
+ return false;
+ }
+
+ if (IsWindowForAssociatedServiceCreated(app)) {
+ std::string info(
+ "Window for this associated service type is already created");
+ LOG4CXX_WARN(logger_, info);
+ SendResponse(false, mobile_apis::Result::REJECTED, info.c_str());
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
new file mode 100644
index 0000000000..0d9bbc2815
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/create_window_response.cc
@@ -0,0 +1,64 @@
+/*
+
+ Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/mobile/create_window_response.h"
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+CreateWindowResponse::CreateWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CreateWindowResponse::~CreateWindowResponse() {}
+
+void CreateWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
index b2c9a3377f..46af8353b7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_file_request.cc
@@ -68,7 +68,9 @@ void DeleteFileRequest::Run() {
return;
}
- if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) &&
+ if ((mobile_api::HMILevel::HMI_NONE ==
+ application->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) &&
(application_manager_.get_settings().delete_file_in_none() <=
application->delete_file_in_none_count())) {
// If application is in the HMI_NONE level the quantity of allowed
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
new file mode 100644
index 0000000000..7f253e25fd
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_request.cc
@@ -0,0 +1,162 @@
+/*
+ Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/mobile/delete_window_request.h"
+
+#include <algorithm>
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+DeleteWindowRequest::DeleteWindowRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+DeleteWindowRequest::~DeleteWindowRequest() {}
+
+bool DeleteWindowRequest::CheckWindowId(
+ app_mngr::ApplicationSharedPtr app) const {
+ const WindowID window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
+ LOG4CXX_ERROR(logger_, "Main application window can't be deleted");
+ return false;
+ }
+
+ if (!app->WindowIdExists(window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << window_id << " does not exist");
+ return false;
+ }
+
+ return true;
+}
+
+app_mngr::WindowID DeleteWindowRequest::window_id() const {
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
+void DeleteWindowRequest::DeleteWindow(
+ app_mngr::ApplicationSharedPtr app) const {
+ const WindowID window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ app->RemoveWindowInfo(window_id);
+ app->RemoveHMIState(window_id, HmiState::StateID::STATE_ID_REGULAR);
+ app->remove_window_capability(window_id);
+}
+
+void DeleteWindowRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ if (!CheckWindowId(application)) {
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params = (*message_)[strings::msg_params];
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendHMIRequest(hmi_apis::FunctionID::UI_DeleteWindow, &msg_params, true);
+}
+
+void DeleteWindowRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (hmi_apis::FunctionID::UI_DeleteWindow != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+
+ ApplicationSharedPtr application =
+ application_manager_.application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ LOG4CXX_INFO(logger_, "Received DeleteWindow event");
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+
+ const smart_objects::SmartObject& response_message = event.smart_object();
+ const auto result_code = CommandRequestImpl::GetMobileResultCode(
+ static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt()));
+
+ const bool is_success = IsMobileResultSuccess(result_code);
+ std::string response_info;
+ GetInfo(response_message, response_info);
+
+ if (!is_success) {
+ LOG4CXX_ERROR(logger_, "DeleteWindow request has failed on HMI side");
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+ return;
+ }
+
+ DeleteWindow(application);
+
+ SendResponse(is_success,
+ result_code,
+ response_info.empty() ? nullptr : response_info.c_str());
+}
+
+bool DeleteWindowRequest::Init() {
+ hash_update_mode_ = HashUpdateMode::kDoHashUpdate;
+ return true;
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
new file mode 100644
index 0000000000..f9ac9a46d6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/delete_window_response.cc
@@ -0,0 +1,64 @@
+/*
+
+ Copyright (c) 2019, 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 "sdl_rpc_plugin/commands/mobile/delete_window_response.h"
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+DeleteWindowResponse::DeleteWindowResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ rpc_service::RPCService& rpc_service,
+ HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+DeleteWindowResponse::~DeleteWindowResponse() {}
+
+void DeleteWindowResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
index 0655da27c0..dfc48ce2d5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/get_system_capability_request.cc
@@ -152,27 +152,54 @@ void GetSystemCapabilityRequest::Run() {
all_services);
break;
}
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ auto capabilities = hmi_capabilities.system_display_capabilities();
+ if (app->display_capabilities()) {
+ capabilities = app->display_capabilities();
+ }
+
+ if (!capabilities) {
+ SendResponse(false, mobile_apis::Result::DATA_NOT_AVAILABLE);
+ LOG4CXX_INFO(logger_, "system_display_capabilities are not available");
+ return;
+ }
+
+ response_params[strings::system_capability]
+ [strings::display_capabilities] = *capabilities;
+ break;
+ }
default: // Return unsupported resource
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
- if ((*message_)[app_mngr::strings::msg_params].keyExists(
- strings::subscribe)) {
- auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
- if ((*message_)[app_mngr::strings::msg_params][strings::subscribe]
- .asBool() == true) {
- LOG4CXX_DEBUG(logger_,
- "Subscribe to system capability: " << response_type);
- ext.SubscribeTo(response_type);
- } else {
- LOG4CXX_DEBUG(logger_,
- "Unsubscribe from system capability: " << response_type);
- ext.UnsubscribeFrom(response_type);
+ const char* info = nullptr;
+ // Ignore subscription/unsubscription for DISPLAYS type
+ if (mobile_apis::SystemCapabilityType::DISPLAYS != response_type) {
+ if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ strings::subscribe)) {
+ auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
+ if ((*message_)[app_mngr::strings::msg_params][strings::subscribe]
+ .asBool() == true) {
+ LOG4CXX_DEBUG(logger_,
+ "Subscribe to system capability: " << response_type);
+ ext.SubscribeTo(response_type);
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "Unsubscribe from system capability: " << response_type);
+ ext.UnsubscribeFrom(response_type);
+ }
+ }
+ } else {
+ if ((*message_)[app_mngr::strings::msg_params].keyExists(
+ strings::subscribe)) {
+ info =
+ "Subscribe parameter is ignored. Auto Subscription/Unsubscription is "
+ "used for DISPLAY capability type.";
}
}
- SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
+ SendResponse(true, mobile_apis::Result::SUCCESS, info, &response_params);
}
void GetSystemCapabilityRequest::on_event(const event_engine::Event& event) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
index 46a39513d5..b8714b4784 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/list_files_request.cc
@@ -70,7 +70,9 @@ void ListFilesRequest::Run() {
return;
}
- if ((mobile_api::HMILevel::HMI_NONE == application->hmi_level()) &&
+ if ((mobile_api::HMILevel::HMI_NONE ==
+ application->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) &&
(application_manager_.get_settings().list_files_in_none() <=
application->list_files_in_none_count())) {
// If application is in the HMI_NONE level the quantity of allowed
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
index f0368a742d..0bf9b40cb6 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc
@@ -102,8 +102,11 @@ void OnButtonEventNotification::Run() {
return;
}
- if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) {
+ const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
+ (*message_)[strings::msg_params][strings::window_id] = window_id;
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if ((mobile_api::HMILevel::HMI_FULL != window_hmi_level) &&
+ (mobile_api::HMILevel::HMI_LIMITED != window_hmi_level)) {
LOG4CXX_WARN(logger_,
"CUSTOM_BUTTON OnButtonEvent notification is allowed only "
<< "in FULL or LIMITED hmi level");
@@ -127,8 +130,11 @@ void OnButtonEventNotification::Run() {
}
// Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode
- if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ subscribed_app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
+ (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
LOG4CXX_WARN(logger_,
"OnButtonEvent notification is allowed only"
<< "in FULL or LIMITED hmi level");
@@ -179,6 +185,11 @@ void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::custom_button_id];
}
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ (*on_btn_event)[strings::msg_params][strings::window_id] =
+ (*message_)[strings::msg_params][strings::window_id];
+ }
+
message_ = on_btn_event;
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
index 7c77e29298..8c22844865 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc
@@ -104,8 +104,12 @@ void OnButtonPressNotification::Run() {
}
// Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
- if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) {
+ const auto window_id = app->GetSoftButtonWindowID(custom_btn_id);
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ (*message_)[strings::msg_params][strings::window_id] = window_id;
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if ((mobile_api::HMILevel::HMI_FULL != window_hmi_level) &&
+ (mobile_api::HMILevel::HMI_LIMITED != window_hmi_level)) {
LOG4CXX_WARN(logger_,
"CUSTOM_BUTTON OnButtonPress notification is allowed only "
<< "in FULL or LIMITED hmi level");
@@ -129,8 +133,11 @@ void OnButtonPressNotification::Run() {
}
// Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
- if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
- (mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ subscribed_app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if ((mobile_api::HMILevel::HMI_FULL != app_hmi_level) &&
+ (mobile_api::HMILevel::HMI_LIMITED != app_hmi_level)) {
LOG4CXX_WARN(logger_,
"OnButtonPress notification is allowed only"
<< "in FULL or LIMITED hmi level");
@@ -187,6 +194,11 @@ void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
(*message_)[strings::msg_params][strings::custom_button_id];
}
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ (*on_btn_press)[strings::msg_params][strings::window_id] =
+ (*message_)[strings::msg_params][strings::window_id];
+ }
+
message_ = on_btn_press;
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
index 8ec8a86554..1c0609e17d 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_keyboard_input_notification.cc
@@ -76,7 +76,8 @@ void OnKeyBoardInputNotification::Run() {
break;
}
- if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) {
+ if (mobile_apis::HMILevel::eType::HMI_FULL ==
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
LOG4CXX_INFO(logger_, "There is application in HMI_FULL level");
app_to_notify = app;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
index 515279c5f9..cc6ab7b65b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_capability_updated_notification.cc
@@ -2,6 +2,7 @@
#include "application_manager/app_service_manager.h"
#include "application_manager/application_manager.h"
+#include "application_manager/display_capabilities_builder.h"
#include "application_manager/helpers/application_helper.h"
#include "application_manager/message_helper.h"
#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
@@ -31,7 +32,7 @@ void OnSystemCapabilityUpdatedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
- mobile_apis::SystemCapabilityType::eType system_capability_type =
+ const auto system_capability_type =
static_cast<mobile_apis::SystemCapabilityType::eType>(
msg_params[strings::system_capability]
[strings::system_capability_type]
@@ -127,8 +128,21 @@ void OnSystemCapabilityUpdatedNotification::Run() {
[strings::app_services_capabilities] = app_service_caps;
break;
}
- default:
+
+ case mobile_apis::SystemCapabilityType::DISPLAYS: {
+ // Display capabilities content will be populated in the code after the
+ // switch so just breaking here
+ break;
+ }
+
+ default: {
+ LOG4CXX_ERROR(logger_,
+ "Unknown system capability type: "
+ << msg_params[strings::system_capability]
+ [strings::system_capability_type]
+ .asInt());
return;
+ }
}
const char* capability_type_string;
@@ -136,11 +150,34 @@ void OnSystemCapabilityUpdatedNotification::Run() {
mobile_apis::SystemCapabilityType::eType>::
EnumToCString(system_capability_type, &capability_type_string);
+ const auto initial_connection_key =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+
auto subscribed_to_capability_predicate =
- [&system_capability_type](const ApplicationSharedPtr app) {
+ [&system_capability_type,
+ &initial_connection_key](const ApplicationSharedPtr app) {
DCHECK_OR_RETURN(app, false);
auto& ext = SystemCapabilityAppExtension::ExtractExtension(*app);
- return ext.IsSubscribedTo(system_capability_type);
+ if (!ext.IsSubscribedTo(system_capability_type)) {
+ LOG4CXX_DEBUG(logger_,
+ "App " << app->app_id()
+ << " is not subscribed to this capability type");
+ return false;
+ }
+
+ if (mobile_apis::SystemCapabilityType::DISPLAYS ==
+ system_capability_type &&
+ initial_connection_key > 0) {
+ LOG4CXX_DEBUG(logger_,
+ "Display capabilities notification for app "
+ << initial_connection_key << " only");
+ return app->app_id() == initial_connection_key;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "App " << app->app_id()
+ << " is subscribed to specified capability type");
+ return true;
};
const std::vector<ApplicationSharedPtr>& applications = FindAllApps(
@@ -167,6 +204,40 @@ void OnSystemCapabilityUpdatedNotification::Run() {
ext.UnsubscribeFrom(system_capability_type);
continue;
}
+
+ if (mobile_apis::SystemCapabilityType::DISPLAYS == system_capability_type) {
+ LOG4CXX_DEBUG(logger_, "Using common display capabilities");
+ auto capabilities = hmi_capabilities_.system_display_capabilities();
+ if (app->is_resuming() && app->is_app_data_resumption_allowed()) {
+ LOG4CXX_DEBUG(logger_,
+ "Application "
+ << app->app_id()
+ << " is resuming. Providing cached capabilities");
+ auto display_caps =
+ app->display_capabilities_builder().display_capabilities();
+ capabilities = display_caps;
+ } else if (app->display_capabilities()) {
+ LOG4CXX_DEBUG(logger_,
+ "Application " << app->app_id()
+ << " has specific display capabilities");
+ const WindowID window_id =
+ msg_params[strings::system_capability]
+ [strings::display_capabilities][0]
+ [strings::window_capabilities][0][strings::window_id]
+ .asInt();
+ capabilities = app->display_capabilities(window_id);
+ }
+
+ if (!capabilities) {
+ LOG4CXX_WARN(logger_,
+ "No available display capabilities for sending. Skipping");
+ continue;
+ }
+
+ msg_params[strings::system_capability][strings::display_capabilities] =
+ *capabilities;
+ }
+
LOG4CXX_INFO(logger_,
"Sending OnSystemCapabilityUpdated " << capability_type_string
<< " application id "
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
index ccbdab15c9..0a8420b6a3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_tbt_client_state_notification.cc
@@ -67,7 +67,8 @@ void OnTBTClientStateNotification::Run() {
std::vector<ApplicationSharedPtr>::const_iterator it = applications.begin();
for (; applications.end() != it; ++it) {
ApplicationSharedPtr app = *it;
- if (mobile_apis::HMILevel::eType::HMI_NONE != app->hmi_level()) {
+ if (mobile_apis::HMILevel::eType::HMI_NONE !=
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotification();
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
index 8f8e4dbf6f..0481542565 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_audio_pass_thru_request.cc
@@ -87,7 +87,8 @@ void PerformAudioPassThruRequest::Run() {
return;
}
- if (mobile_api::HMILevel::HMI_NONE == app->hmi_level()) {
+ if (mobile_api::HMILevel::HMI_NONE ==
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)) {
LOG4CXX_ERROR(logger_, "application isn't activated");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
index f68596ce27..e25215fb48 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc
@@ -94,7 +94,9 @@ void PutFileRequest::Run() {
return;
}
- if (mobile_api::HMILevel::HMI_NONE == application->hmi_level() &&
+ if (mobile_api::HMILevel::HMI_NONE ==
+ application->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW) &&
application_manager_.get_settings().put_file_in_none() <=
application->put_file_in_none_count()) {
// If application is in the HMI_NONE level the quantity of allowed
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
index 26bfbf3399..b39e50b222 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc
@@ -158,13 +158,14 @@ class SmartArrayValueExtractor {
};
struct IsSameNickname {
- IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {}
+ IsSameNickname(const custom_str::CustomString app_name)
+ : app_name_(app_name) {}
bool operator()(const policy::StringArray::value_type& nickname) const {
- return app_id_.CompareIgnoreCase(nickname.c_str());
+ return app_name_.CompareIgnoreCase(nickname.c_str());
}
private:
- const custom_str::CustomString app_id_;
+ const custom_str::CustomString app_name_;
};
} // namespace
@@ -828,6 +829,16 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
application->mac_address());
}
+ // If app is in resuming state
+ // DisplayCapabilitiesBuilder has to collect all the information
+ // from incoming HMI notifications and send only one notification
+ // to mobile app, even if hash does not match, which means that app data
+ // will not be resumed, notification should be sent for default window as
+ // it will be resumed in any case
+ if (resumption) {
+ resumer.StartWaitingForDisplayCapabilitiesUpdate(application);
+ }
+
AppHmiTypes hmi_types;
if ((*message_)[strings::msg_params].keyExists(strings::app_hmi_type)) {
smart_objects::SmartArray* hmi_types_ptr =
@@ -866,11 +877,12 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
// and HMI level set-up
GetPolicyHandler().OnAppRegisteredOnMobile(application->mac_address(),
application->policy_app_id());
-
- if (result_code != mobile_apis::Result::RESUME_FAILED) {
- resumer.StartResumption(application, hash_id);
- } else {
- resumer.StartResumptionOnlyHMILevel(application);
+ if (resumption) {
+ if (result_code != mobile_apis::Result::RESUME_FAILED) {
+ resumer.StartResumption(application, hash_id);
+ } else {
+ resumer.StartResumptionOnlyHMILevel(application);
+ }
}
// By default app subscribed to CUSTOM_BUTTON
@@ -1346,13 +1358,12 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() {
using namespace smart_objects;
- using namespace hmi_apis;
-
SmartObject msg_params = SmartObject(SmartType_Map);
msg_params[strings::app_id] = connection_key();
- msg_params[strings::name] = Common_ButtonName::CUSTOM_BUTTON;
+ msg_params[strings::name] = hmi_apis::Common_ButtonName::CUSTOM_BUTTON;
msg_params[strings::is_suscribed] = true;
- CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
+ CreateHMINotification(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ msg_params);
}
bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
@@ -1397,7 +1408,10 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
application_manager_.ProcessReconnection(app, connection_key());
SendRegisterAppInterfaceResponseToMobile(app_type);
- application_manager_.SendHMIStatusNotification(app);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
application_manager_.OnApplicationSwitched(app);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
index 2a09a72af2..5ba1076084 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_display_layout_request.cc
@@ -75,8 +75,8 @@ void SetDisplayLayoutRequest::Run() {
new_layout = msg_params[strings::display_layout].asString();
}
- if (new_layout != old_layout &&
- !new_layout.empty()) { // Template switched, allow any color change
+ if (new_layout != old_layout && !new_layout.empty()) {
+ // Template switched, hence allow any color change
LOG4CXX_DEBUG(logger_,
"SetDisplayLayoutRequest New Layout: " << new_layout);
app->set_display_layout(new_layout);
@@ -85,22 +85,20 @@ void SetDisplayLayoutRequest::Run() {
// Template layout is the same as previous layout
// Reject message if colors are set
if (msg_params.keyExists(strings::day_color_scheme) &&
- app->day_color_scheme() != NULL &&
- !(msg_params[strings::day_color_scheme] ==
- *(app->day_color_scheme()))) {
- // Color scheme param exists and has been previously set, do not allow
- // color change
+ app->day_color_scheme().getType() != smart_objects::SmartType_Null &&
+ msg_params[strings::day_color_scheme] != app->day_color_scheme()) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
LOG4CXX_DEBUG(logger_, "Reject Day Color Scheme Change");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
if (msg_params.keyExists(strings::night_color_scheme) &&
- app->night_color_scheme() != NULL &&
- !(msg_params[strings::night_color_scheme] ==
- *(app->night_color_scheme()))) {
- // Color scheme param exists and has been previously set, do not allow
- // color change
+ app->night_color_scheme().getType() != smart_objects::SmartType_Null &&
+ msg_params[strings::night_color_scheme] != app->night_color_scheme()) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
LOG4CXX_DEBUG(logger_, "Reject Night Color Scheme Change");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
@@ -127,6 +125,14 @@ void SetDisplayLayoutRequest::Run() {
void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetDisplayLayout: {
@@ -143,7 +149,7 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
if (response_success) {
HMICapabilities& hmi_capabilities = hmi_capabilities_;
- // in case templates_available is empty copy from hmi capabilities
+ // In case templates_available is empty copy from hmi capabilities
if (msg_params.keyExists(hmi_response::display_capabilities)) {
if (0 == msg_params[hmi_response::display_capabilities]
[hmi_response::templates_available]
@@ -154,10 +160,21 @@ void SetDisplayLayoutRequest::on_event(const event_engine::Event& event) {
hmi_response::templates_available);
}
}
+ const Version& app_version = app->version();
+ if (app_version.max_supported_api_version >= APIVersion::kAPIV6) {
+ // In case of successful response warn user that this RPC is
+ // deprecated from 6.0 and higher API versions
+ result_code = hmi_apis::Common_Result::WARNINGS;
+ info =
+ "The RPC is deprecated and will be removed in a future version. "
+ "The requested display layout is set to the main window. Please "
+ "use `Show.templateConfiguration` instead.";
+ }
}
+
SendResponse(response_success,
MessageHelper::HMIToMobileResult(result_code),
- info.empty() ? NULL : info.c_str(),
+ info.empty() ? nullptr : info.c_str(),
&msg_params);
break;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
index 2a8dc6cb70..36278168dc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
@@ -68,11 +68,12 @@ void ShowAppMenuRequest::Run() {
return;
}
- if (mobile_apis::HMILevel::HMI_FULL != app->hmi_level() ||
+ if (mobile_apis::HMILevel::HMI_FULL !=
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ||
helpers::Compare<mobile_apis::SystemContext::eType,
helpers::NEQ,
helpers::ALL>(
- app->system_context(),
+ app->system_context(mobile_apis::PredefinedWindows::DEFAULT_WINDOW),
mobile_apis::SystemContext::SYSCTXT_MAIN,
mobile_apis::SystemContext::SYSCTXT_MENU)) {
LOG4CXX_ERROR(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
index bf26cc62af..84d11f8e09 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
@@ -55,7 +55,12 @@ ShowRequest::ShowRequest(
rpc_service,
hmi_capabilities,
policy_handler)
- , core_result_code_(mobile_apis::Result::INVALID_ENUM) {}
+ , core_result_code_(mobile_apis::Result::INVALID_ENUM)
+ , current_window_id_(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)
+ , template_config_(smart_objects::SmartType::SmartType_Null)
+ , layout_change_required_(false)
+ , dcs_change_required_(false)
+ , ncs_change_required_(false) {}
ShowRequest::~ShowRequest() {}
@@ -94,6 +99,137 @@ void ShowRequest::HandleMetadata(const char* field_id,
}
}
+bool ShowRequest::CheckTemplateConfigurationForApp(
+ application_manager::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ current_window_id_ =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto set_window_layout = [&app, this]() -> bool {
+ const auto new_template_layout =
+ template_config_[strings::template_layout].asString();
+ const auto old_template_layout = app.window_layout(current_window_id_);
+ LOG4CXX_DEBUG(logger_, "New layout: " << new_template_layout);
+ LOG4CXX_DEBUG(logger_, "Old layout: " << old_template_layout);
+
+ const bool layouts_equal = (new_template_layout == old_template_layout);
+
+ if (!new_template_layout.empty() && !layouts_equal) {
+ // Template switched, hence allow any color change
+ LOG4CXX_DEBUG(logger_,
+ "Show Request: Setting new Layout: " << new_template_layout
+ << " for window ID: "
+ << current_window_id_);
+ layout_change_required_ = true;
+ return true;
+ }
+ LOG4CXX_DEBUG(logger_, "Show Request: No Layout Change");
+ return false;
+ };
+
+ const auto set_day_color_scheme = [&app, this]() -> bool {
+ if (!template_config_.keyExists(strings::day_color_scheme)) {
+ return false;
+ }
+ if (app.day_color_scheme(current_window_id_).getType() !=
+ smart_objects::SmartType_Null &&
+ template_config_[strings::day_color_scheme] !=
+ app.day_color_scheme(current_window_id_)) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
+ LOG4CXX_DEBUG(logger_, "Day Color Scheme change is rejected");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Day Color Scheme change is allowed");
+ dcs_change_required_ = true;
+
+ return true;
+ };
+
+ const auto set_night_color_scheme = [&app, this]() -> bool {
+ if (!template_config_.keyExists(strings::night_color_scheme)) {
+ return false;
+ }
+ if (app.night_color_scheme(current_window_id_).getType() !=
+ smart_objects::SmartType_Null &&
+ template_config_[strings::night_color_scheme] !=
+ app.night_color_scheme(current_window_id_)) {
+ // Color scheme param exists and has been previously set,
+ // hence do not allow color change
+ LOG4CXX_DEBUG(logger_, "Night Color Scheme change is rejected");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_, "Night Color Scheme Change is allowed");
+ ncs_change_required_ = true;
+
+ return true;
+ };
+
+ const bool set_layout_result = set_window_layout();
+
+ if (set_layout_result) {
+ set_day_color_scheme();
+ set_night_color_scheme();
+ return true;
+ }
+
+ if (!template_config_.keyExists(strings::night_color_scheme) &&
+ !template_config_.keyExists(strings::day_color_scheme)) {
+ // In case current layout was not changed and day and night color
+ // schemes are absent in mobile message SDL has to forward message
+ // to HMI with the only layout even it was not changed
+ return true;
+ }
+
+ const bool set_schemes_result =
+ (set_day_color_scheme() && set_night_color_scheme());
+
+ return set_schemes_result;
+}
+
+void ShowRequest::ApplyTemplateConfigurationForApp(
+ mobile_apis::Result::eType result, application_manager::Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (helpers::Compare<mobile_apis::Result::eType, helpers::EQ, helpers::ONE>(
+ result,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS)) {
+ if (layout_change_required_) {
+ const std::string new_layout =
+ template_config_[strings::template_layout].asString();
+ LOG4CXX_DEBUG(logger_, "New layout : " << new_layout << " is applied");
+ app.set_window_layout(current_window_id_, new_layout);
+
+ if (template_config_.keyExists(strings::day_color_scheme)) {
+ app.set_day_color_scheme(current_window_id_,
+ template_config_[strings::day_color_scheme]);
+ }
+
+ if (template_config_.keyExists(strings::night_color_scheme)) {
+ app.set_night_color_scheme(
+ current_window_id_, template_config_[strings::night_color_scheme]);
+ }
+
+ return;
+ }
+
+ if (dcs_change_required_) {
+ LOG4CXX_DEBUG(logger_, "New day color scheme is applied");
+ app.set_day_color_scheme(current_window_id_,
+ template_config_[strings::day_color_scheme]);
+ }
+
+ if (ncs_change_required_) {
+ LOG4CXX_DEBUG(logger_, "New night color scheme is applied");
+ app.set_night_color_scheme(current_window_id_,
+ template_config_[strings::night_color_scheme]);
+ }
+ }
+}
+
void ShowRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -272,7 +408,7 @@ void ShowRequest::Run() {
app->UnsubscribeFromSoftButtons(function_id());
} else {
MessageHelper::SubscribeApplicationToSoftButton(
- (*message_)[strings::msg_params], app, function_id());
+ (*message_)[strings::msg_params], app, function_id(), window_id());
}
}
@@ -281,6 +417,33 @@ void ShowRequest::Run() {
(*message_)[strings::msg_params][strings::custom_presets];
}
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ const auto window_id =
+ (*message_)[strings::msg_params][strings::window_id].asInt();
+ if (!app->WindowIdExists(window_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Window with id #" << window_id << " does not exist");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+ msg_params[strings::window_id] = window_id;
+ }
+
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::template_configuration)) {
+ template_config_ =
+ (*message_)[strings::msg_params][strings::template_configuration];
+ const bool result = CheckTemplateConfigurationForApp(*app);
+ if (!result) {
+ const char* info(
+ "Color schemes can not be changed without a new template set");
+ SendResponse(false, mobile_apis::Result::REJECTED, info);
+ return;
+ }
+ msg_params[strings::template_configuration] =
+ (*message_)[strings::msg_params][strings::template_configuration];
+ }
+
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Show, &msg_params, true);
@@ -294,6 +457,13 @@ void ShowRequest::on_event(const event_engine::Event& event) {
using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
switch (event.id()) {
case hmi_apis::FunctionID::UI_Show: {
@@ -313,6 +483,9 @@ void ShowRequest::on_event(const event_engine::Event& event) {
}
mobile_apis::Result::eType converted_result_code =
MessageHelper::HMIToMobileResult(result_code);
+
+ ApplyTemplateConfigurationForApp(converted_result_code, *app);
+
if (mobile_apis::Result::SUCCESS == converted_result_code &&
mobile_apis::Result::INVALID_ENUM != core_result_code_) {
converted_result_code = core_result_code_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
index d76a053808..27768e8a31 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc
@@ -99,10 +99,14 @@
#include "sdl_rpc_plugin/commands/hmi/ui_alert_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_change_registration_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_change_registration_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_create_window_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_create_window_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_delete_command_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_delete_command_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_delete_submenu_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_delete_submenu_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_delete_window_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_end_audio_pass_thru_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_get_capabilities_request.h"
@@ -249,6 +253,7 @@
#include "sdl_rpc_plugin/commands/hmi/rc_is_ready_response.h"
#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/on_bc_system_capability_updated_notification_from_hmi.h"
namespace sdl_rpc_plugin {
using namespace application_manager;
@@ -423,6 +428,11 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIShowAppMenuRequest>()
: factory.GetCreator<commands::UIShowAppMenuResponse>();
}
+ case hmi_apis::FunctionID::UI_DeleteWindow: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UIDeleteWindowRequest>()
+ : factory.GetCreator<commands::UIDeleteWindowResponse>();
+ }
case hmi_apis::FunctionID::UI_SetMediaClockTimer: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::UISetMediaClockTimerRequest>()
@@ -471,6 +481,11 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIChangeRegistrationRequest>()
: factory.GetCreator<commands::UIChangeRegistratioResponse>();
}
+ case hmi_apis::FunctionID::UI_CreateWindow: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UICreateWindowRequest>()
+ : factory.GetCreator<commands::UICreateWindowResponse>();
+ }
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::UIPerformAudioPassThruRequest>()
@@ -875,8 +890,13 @@ CommandCreator& HMICommandFactory::get_creator_factory(
: factory.GetCreator<commands::BCGetFilePathResponse>();
}
case hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated: {
- return factory
- .GetCreator<commands::OnBCSystemCapabilityUpdatedNotification>();
+ return (application_manager::commands::Command::CommandSource::
+ SOURCE_HMI == source)
+ ? factory.GetCreator<
+ commands::
+ OnBCSystemCapabilityUpdatedNotificationFromHMI>()
+ : factory.GetCreator<
+ commands::OnBCSystemCapabilityUpdatedNotification>();
}
default: { return factory.GetCreator<InvalidCommand>(); }
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
index 7f5318751e..c6f4b64636 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc
@@ -48,6 +48,8 @@
#include "sdl_rpc_plugin/commands/mobile/close_application_response.h"
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_request.h"
#include "sdl_rpc_plugin/commands/mobile/create_interaction_choice_set_response.h"
+#include "sdl_rpc_plugin/commands/mobile/create_window_request.h"
+#include "sdl_rpc_plugin/commands/mobile/create_window_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_command_request.h"
#include "sdl_rpc_plugin/commands/mobile/delete_command_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_file_request.h"
@@ -56,6 +58,8 @@
#include "sdl_rpc_plugin/commands/mobile/delete_interaction_choice_set_response.h"
#include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_request.h"
#include "sdl_rpc_plugin/commands/mobile/delete_sub_menu_response.h"
+#include "sdl_rpc_plugin/commands/mobile/delete_window_request.h"
+#include "sdl_rpc_plugin/commands/mobile/delete_window_response.h"
#include "sdl_rpc_plugin/commands/mobile/dial_number_request.h"
#include "sdl_rpc_plugin/commands/mobile/dial_number_response.h"
#include "sdl_rpc_plugin/commands/mobile/end_audio_pass_thru_request.h"
@@ -176,6 +180,11 @@ CommandCreator& MobileCommandFactory::get_command_creator(
? factory.GetCreator<commands::AddCommandRequest>()
: factory.GetCreator<commands::AddCommandResponse>();
}
+ case mobile_apis::FunctionID::CreateWindowID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CreateWindowRequest>()
+ : factory.GetCreator<commands::CreateWindowResponse>();
+ }
case mobile_apis::FunctionID::DeleteCommandID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<commands::DeleteCommandRequest>()
@@ -196,6 +205,11 @@ CommandCreator& MobileCommandFactory::get_command_creator(
? factory.GetCreator<commands::ShowAppMenuRequest>()
: factory.GetCreator<commands::ShowAppMenuResponse>();
}
+ case mobile_apis::FunctionID::DeleteWindowID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::DeleteWindowRequest>()
+ : factory.GetCreator<commands::DeleteWindowResponse>();
+ }
case mobile_apis::FunctionID::DeleteInteractionChoiceSetID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
index 5522066f76..43462bfaf1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc
@@ -70,8 +70,14 @@ void SDLRPCPlugin::OnApplicationEvent(
plugins::ApplicationEvent event,
app_mngr::ApplicationSharedPtr application) {
if (plugins::ApplicationEvent::kApplicationRegistered == event) {
- application->AddExtension(
- std::make_shared<SystemCapabilityAppExtension>(*this, *application));
+ auto sys_cap_ext_ptr =
+ std::make_shared<SystemCapabilityAppExtension>(*this, *application);
+ application->AddExtension(sys_cap_ext_ptr);
+ // Processing automatic subscription to SystemCapabilities for DISPLAY type
+ const auto capability_type =
+ mobile_apis::SystemCapabilityType::eType::DISPLAYS;
+ LOG4CXX_DEBUG(logger_, "Subscription to DISPLAYS capability is enabled");
+ sys_cap_ext_ptr->SubscribeTo(capability_type);
} else if (plugins::ApplicationEvent::kDeleteApplicationData == event) {
ClearSubscriptions(application);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
index 2f8f5c2849..26f7a63872 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc
@@ -148,6 +148,11 @@ typedef NiceMock<
#define NAVI true
#define NOT_NAVI false
+namespace {
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
ACTION_P(GetEventId, event_id) {
*event_id = arg0.id();
}
@@ -155,8 +160,8 @@ ACTION_P(GetArg, arg) {
*arg = arg0;
}
-ACTION_P(GetArg3, result) {
- arg3 = *result;
+ACTION_P(GetArg4, result) {
+ arg4 = *result;
}
ACTION_P2(GetConnectIdPermissionConsent, connect_id, consent) {
@@ -1103,6 +1108,7 @@ TEST_F(HMICommandsNotificationsTest,
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
SetRegularState(app_,
+ kDefaultWindowId,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -1127,12 +1133,7 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, UnregisterApplication(_, _, _, _)).Times(0);
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_,
- SetRegularState(app_,
- mobile_apis::HMILevel::HMI_NONE,
- mobile_apis::AudioStreamingState::NOT_AUDIBLE,
- mobile_apis::VideoStreamingState::NOT_STREAMABLE,
- false));
+ EXPECT_CALL(mock_state_controller_, ExitDefaultWindow(app_));
command->Run();
}
@@ -1150,7 +1151,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
EXPECT_CALL(mock_state_controller_,
- SetRegularState(_, mobile_apis::HMILevel::HMI_FULL, true));
+ SetRegularState(
+ _, kDefaultWindowId, mobile_apis::HMILevel::HMI_FULL, true));
EXPECT_CALL(app_mngr_, get_settings())
.WillOnce(ReturnRef(app_mngr_settings_));
@@ -1351,8 +1353,10 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(*app_ptr_, language()).WillRepeatedly(ReturnRef(kLang));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_,
- SetRegularState(app_, mobile_apis::HMILevel::HMI_NONE, false));
+ EXPECT_CALL(
+ mock_state_controller_,
+ SetRegularState(
+ app_, kDefaultWindowId, mobile_apis::HMILevel::HMI_NONE, false));
EXPECT_CALL(mock_message_helper_,
GetOnAppInterfaceUnregisteredNotificationToMobile(
kAppId_,
@@ -1429,7 +1433,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, active_application()).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(app_, kDefaultWindowId, *it));
command->Run();
}
}
@@ -1478,7 +1483,8 @@ TEST_F(HMICommandsNotificationsTest,
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(app_));
EXPECT_CALL(app_mngr_, state_controller())
.WillOnce(ReturnRef(mock_state_controller_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(app_, *it));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(app_, kDefaultWindowId, *it));
command->Run();
}
}
@@ -1885,8 +1891,8 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) {
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(mock_policy_handler_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
new file mode 100644
index 0000000000..f3ed480180
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_from_hmi_test.cc
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2019, 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 "hmi/on_bc_system_capability_updated_notification_from_hmi.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_bc_system_capability_updated_notification_from_hmi {
+
+using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotificationFromHMI;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotificationFromHMI>
+ OnBCSystemCapabilityUpdatedNotificationFromHMIPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kAppId = 1u;
+} // namespace
+
+MATCHER(CheckMessageToMobile, "") {
+ const auto function_id = mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+
+ const bool is_function_id_matched =
+ function_id == static_cast<am::mobile_api::FunctionID::eType>(
+ (*arg)[strings::params][strings::function_id].asInt());
+ const bool app_id_exist =
+ (*arg)[strings::msg_params].keyExists(strings::app_id);
+ bool is_connection_key_correct = true;
+ if ((*arg)[strings::msg_params].keyExists(strings::connection_key)) {
+ is_connection_key_correct =
+ (*arg)[strings::params][strings::connection_key] == kAppId;
+ }
+ return is_function_id_matched && !app_id_exist && is_connection_key_correct;
+}
+
+MATCHER_P(CheckDisplayCapabilitiesNotChanged, display_capability, "") {
+ return display_capability == arg;
+}
+
+class OnBCSystemCapabilityUpdatedNotificationFromHMITest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest()
+ : message_(CreateMessage())
+ , display_capability_(
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [strings::display_capabilities]) {
+ command_ =
+ CreateCommand<OnBCSystemCapabilityUpdatedNotificationFromHMI>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnBCSystemCapabilityUpdatedNotificationFromHMIPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+ const SmartObject display_capability_;
+};
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppIdNotPresentedInMessage_SetSystemDisplayCapabilitiesToHMICapabilities_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_system_display_capabilities(
+ CheckDisplayCapabilitiesNotChanged(display_capability_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(),
+ ::application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppNotRegisteredWithPresentedAppIdInMessage_MessageNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+ ApplicationSharedPtr app; // Empty application shared pointer
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(app));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnBCSystemCapabilityUpdatedNotificationFromHMITest,
+ Run_AppRegisteredWithPresentedAppIdInMessage_SetDisplayCapabilitiesToApp_SendMessageToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ (*message_)[strings::msg_params][strings::app_id] = kAppId;
+
+ ON_CALL(app_mngr_, application(kAppId)).WillByDefault(Return(mock_app_));
+
+ EXPECT_CALL(*mock_app_,
+ set_display_capabilities(
+ CheckDisplayCapabilitiesNotChanged(display_capability_)));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(),
+ ::application_manager::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_bc_system_capability_updated_notification_from_hmi
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..cb8894749f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_bc_system_capability_updated_notification_test.cc
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2019, 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 "hmi/on_bc_system_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "gtest/gtest.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace hmi_commands_test {
+namespace on_bc_system_capability_updated_notification {
+
+using sdl_rpc_plugin::commands::OnBCSystemCapabilityUpdatedNotification;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnBCSystemCapabilityUpdatedNotification>
+ OnBCSystemCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+}
+
+MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
+ return display_capabilities ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::display_capabilities];
+}
+
+class OnBCSystemCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<OnBCSystemCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnBCSystemCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationTest,
+ SystemDisplayCapabilities_SUCCESS) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .Times(2)
+ .WillRepeatedly(Return(system_display_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToHMI(CheckDisplayCapabilities(*system_display_capabilities)));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(OnBCSystemCapabilityUpdatedNotificationTest,
+ SystemDisplayCapabilities_DATA_NOT_AVAILABLE) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ EXPECT_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillOnce(Return(nullptr));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToHMI(_)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_bc_system_capability_updated_notification
+} // namespace hmi_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
index 5e0083d395..fe6ba7c4e3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/on_driver_distraction_notification_test.cc
@@ -126,8 +126,8 @@ MATCHER_P2(CheckNotificationParams, function_id, state, "") {
return is_function_id_matched && is_state_matched;
}
-ACTION_P(GetArg3, result) {
- arg3 = *result;
+ACTION_P(GetArg4, result) {
+ arg4 = *result;
}
ACTION_P(SetMessage, lockScreenDismissalWarning) {
@@ -159,8 +159,8 @@ TEST_F(HMIOnDriverDistractionNotificationTest,
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
MessageSharedPtr message_to_mobile(
CreateMessage(smart_objects::SmartType_Map));
@@ -202,8 +202,9 @@ TEST_F(HMIOnDriverDistractionNotificationTest,
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcDisallowed;
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(3);
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map));
EXPECT_CALL(*mock_app_,
@@ -240,8 +241,8 @@ TEST_F(HMIOnDriverDistractionNotificationTest,
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillByDefault(GetArg3(&result));
+ ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillByDefault(GetArg4(&result));
MessageSharedPtr command_result;
EXPECT_CALL(mock_rpc_service_,
@@ -284,11 +285,11 @@ TEST_F(HMIOnDriverDistractionNotificationTest,
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
-
MessageSharedPtr message_to_mobile(
CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(app_mngr_, GetPolicyHandler()).Times(2);
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
EXPECT_CALL(mock_rpc_service_,
ManageMobileCommand(
CheckNotificationParams(
@@ -331,8 +332,8 @@ TEST_F(HMIOnDriverDistractionNotificationTest,
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _))
- .WillOnce(GetArg3(&result));
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
MessageSharedPtr message_to_mobile(
CreateMessage(smart_objects::SmartType_Map));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
index dc97a12ce4..4683fc62c7 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc
@@ -343,6 +343,25 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
command->Run();
}
+TEST_F(UIGetCapabilitiesResponseTest, SetSystemDisplayCapabilities_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+ (*command_msg)[strings::msg_params][strings::system_capabilities] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ const auto& display_capability_so =
+ (*command_msg)[strings::msg_params][strings::system_capabilities]
+ [strings::display_capabilities];
+
+ EXPECT_CALL(mock_hmi_capabilities_,
+ set_system_display_capabilities(display_capability_so));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
} // namespace ui_get_capabilities_response
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
index 113c6d32a0..dc7731bfc8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/alert_request_test.cc
@@ -73,6 +73,8 @@ const uint32_t kDefaultTimeout = 1000u;
const uint32_t kCorrelationId = 2u;
const mobile_apis::FunctionID::eType kFunctionId =
mobile_apis::FunctionID::AlertID;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
@@ -138,9 +140,9 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
*mock_app_,
AreCommandLimitsExceeded(kFunctionId, am::TLimitSource::POLICY_TABLE))
.WillByDefault(Return(false));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
}
@@ -155,7 +157,8 @@ class AlertRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
}
void ExpectCallHmiLevel(const mobile_apis::HMILevel::eType level) {
- EXPECT_CALL(*mock_app_, hmi_level()).WillRepeatedly(Return(level));
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(level));
}
void ExpectManageMobileCommandWithResultCode(
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc
new file mode 100644
index 0000000000..02a6591a2d
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/create_window_request_test.cc
@@ -0,0 +1,457 @@
+/*
+ * Copyright (c) 2019, 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 <stdint.h>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "mobile/create_window_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_state_controller.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace create_window_request {
+
+namespace am = application_manager;
+using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::CreateWindowRequest;
+using namespace mobile_apis::PredefinedWindows;
+using am::commands::Command;
+using application_manager::WindowID;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kAppId = 1u;
+const uint32_t kConnectionKey = 2u;
+const int32_t kFunctionID = mobile_apis::FunctionID::CreateWindowID;
+const WindowID kTestWindowId = 12;
+const WindowID kDuplicateWindowID = 13;
+const char* const kWindowName = "WindowName";
+const utils::custom_string::CustomString kAppName("TestApp");
+} // namespace
+
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
+class CreateWindowRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ CreateWindowRequestTest() {
+ mock_app_ = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ protected:
+ MessageSharedPtr CreateMsgParams() {
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::params][am::strings::function_id] = kFunctionID;
+ return msg;
+ }
+
+ void SetupHelperApplyWindowInitialState(const MockAppPtr& app,
+ const MessageSharedPtr& msg) {
+ am::HmiStatePtr state(new am::HmiState(app, app_mngr_));
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ (*msg)[am::strings::msg_params][am::strings::window_type].asInt());
+ const auto window_id = static_cast<mobile_apis::WindowType::eType>(
+ (*msg)[am::strings::msg_params][am::strings::window_id].asInt());
+ const auto window_name =
+ (*msg)[am::strings::msg_params][am::strings::window_name].asString();
+
+ state->set_window_type(window_type);
+ state->set_hmi_level(mobile_apis::HMILevel::INVALID_ENUM);
+ state->set_audio_streaming_state(
+ mobile_apis::AudioStreamingState::INVALID_ENUM);
+ state->set_video_streaming_state(
+ mobile_apis::VideoStreamingState::INVALID_ENUM);
+ state->set_system_context(mobile_apis::SystemContext::INVALID_ENUM);
+ ApplicationSharedPtr AppPtr = app;
+ ON_CALL(app_mngr_,
+ CreateRegularState(AppPtr,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM))
+ .WillByDefault(Return(state));
+ ON_CALL(*mock_app_, SetInitialState(kTestWindowId, window_name, state))
+ .WillByDefault(Return());
+ ON_CALL(app_mngr_, state_controller())
+ .WillByDefault(ReturnRef(mock_state_controller));
+ ON_CALL(
+ mock_state_controller,
+ OnAppWindowAdded(
+ AppPtr, window_id, window_type, mobile_apis::HMILevel::HMI_NONE))
+ .WillByDefault(Return());
+ }
+
+ void SetUp() OVERRIDE {
+ using namespace application_manager;
+ display_capabilities_ = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject window_type_supported(
+ smart_objects::SmartType_Array);
+
+ const uint32_t maximum_widgets_amount = 4;
+ smart_objects::SmartObject maximum_widgets(smart_objects::SmartType_Map);
+ maximum_widgets[strings::window_type] = mobile_apis::WindowType::WIDGET;
+ maximum_widgets[strings::maximum_number_of_windows] =
+ maximum_widgets_amount;
+
+ window_type_supported[window_type_supported.length()] = maximum_widgets;
+
+ (*display_capabilities_)[0][strings::window_type_supported] =
+ window_type_supported;
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(display_capabilities_));
+
+ window_params_map_lock_ptr_ = std::make_shared<sync_primitives::Lock>();
+
+ DataAccessor<am::WindowParamsMap> window_params_map(
+ test_window_params_map_, window_params_map_lock_ptr_);
+ ON_CALL(*mock_app_, window_optional_params_map())
+ .WillByDefault(Return(window_params_map));
+ }
+
+ MockAppPtr mock_app_;
+ NiceMock<MockStateController> mock_state_controller;
+ std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
+ application_manager::WindowParamsMap test_window_params_map_;
+ smart_objects::SmartObjectSPtr display_capabilities_;
+};
+
+TEST_F(CreateWindowRequestTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMsgParams();
+ const auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_WindowIDAlreadyExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_CreateWindowForMAINWindowType_ExpectInvalidDataResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_DATA;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::MAIN;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ Run_DuplicateUpdatesFromNotExistingWindowId_ExpectInvalidDataResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_DATA;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(false));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ Run_DuplicateUpdatesFromExistingWindowId_ExpectUICreateWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+ ON_CALL(*mock_app_, GetWindowNames())
+ .WillByDefault(Return(std::vector<std::string>()));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_WindowNameAppNameAreEqual_ExpectDuplicateNameResponseToMobile) {
+ const auto result_code = mobile_apis::Result::DUPLICATE_NAME;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kAppName;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ Run_AllParametersCorrect_ExpectUICreateWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ const std::vector<std::string> windowNames = {
+ "WindowName_1", "WindowName_2", "WindowName_3"};
+ ON_CALL(*mock_app_, GetWindowNames()).WillByDefault(Return(windowNames));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::associated_service_type] =
+ "MEDIA";
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(
+ CreateWindowRequestTest,
+ CheckWindowName_AllParametersCorrectCreateWindowForPrimaryWidget_SendMessageToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_CreateWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, WindowIdExists(kTestWindowId))
+ .WillByDefault(Return(false));
+ ON_CALL(*mock_app_, WindowIdExists(kDuplicateWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ mobile_apis::PredefinedWindows::PRIMARY_WIDGET;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params]
+ [am::strings::duplicate_updates_from_window_id] = kDuplicateWindowID;
+ (*msg)[am::strings::msg_params][am::strings::associated_service_type] =
+ "MEDIA";
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::WIDGET;
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_InvalidFunctionId_MessageNotSendToMobile) {
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_RequestFailedOnHMISide_SendGenericErrorResponseToMobile) {
+ const auto result_code = mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::WIDGET;
+
+ SetupHelperApplyWindowInitialState(mock_app_, msg);
+
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+TEST_F(CreateWindowRequestTest,
+ OnEvent_AllParametersCorrect_SendSuccessResponseToMobile) {
+ const auto result_code = mobile_apis::Result::SUCCESS;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, true),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(1);
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::strings::window_name] = kWindowName;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+ (*msg)[am::strings::msg_params][am::strings::window_type] =
+ mobile_apis::WindowType::eType::WIDGET;
+
+ SetupHelperApplyWindowInitialState(mock_app_, msg);
+
+ Event event(hmi_apis::FunctionID::UI_CreateWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<CreateWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+} // namespace create_window_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
index 4081583099..cce53bb480 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_file_test.cc
@@ -98,6 +98,8 @@ namespace {
const uint32_t kConnectionKey = 1u;
const uint32_t kCorrelationId = 10u;
const int32_t kMenuId = 5;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class DeleteFileRequestTest
@@ -134,7 +136,7 @@ TEST_F(DeleteFileRequestTest, Run_HMILevelNone_UNSUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE));
EXPECT_CALL(app_mngr_, get_settings())
@@ -161,7 +163,7 @@ TEST_F(DeleteFileRequestTest, Run_ValidFileName_SUCCESS) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_mngr_, get_settings())
@@ -191,7 +193,7 @@ TEST_F(DeleteFileRequestTest, Run_InvalidFile_UNSUCCESS) {
(*message_)[am::strings::msg_params][am::strings::sync_file_name] = file_name;
EXPECT_CALL(app_mngr_, application(_)).WillOnce(Return(mock_app_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_mngr_, get_settings())
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc
new file mode 100644
index 0000000000..f951d5c2a7
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/delete_window_request_test.cc
@@ -0,0 +1,278 @@
+/*
+ * Copyright (c) 2019, 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 <stdint.h>
+#include <memory>
+#include <set>
+#include <string>
+
+#include "mobile/delete_window_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "application_manager/event_engine/event.h"
+#include "application_manager/hmi_state.h"
+#include "application_manager/mock_application.h"
+#include "application_manager/mock_application_manager.h"
+#include "application_manager/mock_hmi_interface.h"
+#include "application_manager/mock_message_helper.h"
+#include "application_manager/mock_state_controller.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace delete_window_request {
+
+namespace am = application_manager;
+using am::MockMessageHelper;
+using am::commands::CommandImpl;
+using am::commands::MessageSharedPtr;
+using sdl_rpc_plugin::commands::DeleteWindowRequest;
+using namespace mobile_apis::PredefinedWindows;
+using am::commands::Command;
+using application_manager::WindowID;
+using test::components::application_manager_test::MockStateController;
+using test::components::policy_test::MockPolicyHandlerInterface;
+using ::testing::_;
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace {
+const uint32_t kConnectionKey = 2u;
+const int32_t kFunctionID = mobile_apis::FunctionID::DeleteWindowID;
+const WindowID kTestWindowId = 12;
+} // namespace
+
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
+class DeleteWindowRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ public:
+ DeleteWindowRequestTest() {
+ mock_app_ = CreateMockApp();
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ protected:
+ MessageSharedPtr CreateMsgParams() {
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ (*msg)[am::strings::params][am::strings::function_id] = kFunctionID;
+ return msg;
+ }
+
+ MockAppPtr mock_app_;
+ NiceMock<MockStateController> mock_state_controller;
+};
+
+TEST_F(DeleteWindowRequestTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMsgParams();
+ const auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_WindowIDForMainApplicationWindow_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_WindowIDNotExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ ON_CALL(*mock_app_, GetWindowIds()).WillByDefault(Return(am::WindowIds()));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AllParametersCorrect_ExpectUIDeleteWindowIsSentToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+
+ ON_CALL(*mock_app_, GetWindowIds())
+ .WillByDefault(Return(am::WindowIds(1, kTestWindowId)));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kTestWindowId)).WillOnce(Return(true));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ Run_AllParametersCorrectDeleteWindowForPrimaryWidget_SendMessageToHMI) {
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_DeleteWindow),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ const auto primary_widget_window_id =
+ mobile_apis::PredefinedWindows::PRIMARY_WIDGET;
+ ON_CALL(*mock_app_, GetWindowIds())
+ .WillByDefault(Return(am::WindowIds(1, primary_widget_window_id)));
+ EXPECT_CALL(*mock_app_, WindowIdExists(primary_widget_window_id))
+ .WillOnce(Return(true));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] =
+ primary_widget_window_id;
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_InvalidFunctionId_MessageNotSendToMobile) {
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::INVALID_ENUM);
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_RequestFailedOnHMISide_SendGenericErrorResponseToMobile) {
+ const auto result_code = mobile_apis::Result::GENERIC_ERROR;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::GENERIC_ERROR;
+
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+TEST_F(DeleteWindowRequestTest,
+ OnEvent_AllParametersCorrect_SendSuccessResponseToMobile) {
+ const auto result_code = mobile_apis::Result::SUCCESS;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, true),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, UpdateHash()).Times(1);
+ EXPECT_CALL(*mock_app_, RemoveHMIState(kTestWindowId, _)).Times(1);
+
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kTestWindowId;
+
+ Event event(hmi_apis::FunctionID::UI_DeleteWindow);
+ event.set_smart_object(*msg);
+
+ auto command = CreateCommand<DeleteWindowRequest>(msg);
+ EXPECT_TRUE(command->Init());
+ command->on_event(event);
+}
+
+} // namespace delete_window_request
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
new file mode 100644
index 0000000000..74c61410e8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/get_system_capability_request_test.cc
@@ -0,0 +1,124 @@
+/*
+ Copyright (c) 2019, 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 "mobile/get_system_capability_request.h"
+
+#include "application_manager/commands/command_request_test.h"
+#include "gtest/gtest.h"
+#include "interfaces/MOBILE_API.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace get_system_capability_request_test {
+
+using sdl_rpc_plugin::commands::GetSystemCapabilityRequest;
+using ::testing::_;
+using ::testing::Return;
+typedef std::shared_ptr<GetSystemCapabilityRequest>
+ GetSystemCapabilityRequestPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+}
+
+class GetSystemCapabilityRequestTest
+ : public CommandRequestTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<GetSystemCapabilityRequest>(message_);
+ mock_app_ = CreateMockApp();
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ }
+
+ GetSystemCapabilityRequestPtr command_;
+ MessageSharedPtr message_;
+ MockAppPtr mock_app_;
+};
+
+TEST_F(
+ GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_SendMessageToMobileWithSUCCESSResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities(
+ std::make_shared<smart_objects::SmartObject>());
+
+ ON_CALL(*mock_app_, display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_apis::Result::SUCCESS),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ GetSystemCapabilityRequestTest,
+ Run_GetSystemDisplayCapabilities_CapabilitiesNotExistSendMessageToMobileWithDATA_NOT_AVAILABLEResultCode) {
+ (*message_)[strings::msg_params][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ EXPECT_CALL(*mock_app_, display_capabilities()).WillOnce(Return(nullptr));
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(nullptr));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(mobile_apis::Result::DATA_NOT_AVAILABLE),
+ Command::CommandSource::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace get_system_capability_request_test
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
index 8b6f6696b7..06ecc1116e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/list_files_request_test.cc
@@ -60,6 +60,11 @@ namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::ListFilesRequest;
+namespace {
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
class ListFilesRequestTest
: public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
@@ -86,7 +91,7 @@ TEST_F(ListFilesRequestTest, Run_TooManyHmiNone_UNSUCCESS) {
std::shared_ptr<ListFilesRequest> command(CreateCommand<ListFilesRequest>());
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(*app, hmi_level())
+ ON_CALL(*app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_NONE));
const uint32_t kListFilesInNoneAllowed = 1u;
@@ -121,7 +126,7 @@ TEST_F(ListFilesRequestTest, Run_SUCCESS) {
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
- ON_CALL(*app, hmi_level())
+ ON_CALL(*app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*app, increment_list_files_in_none_count()).WillByDefault(Return());
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
index 1f514e09c5..c0305a15ca 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc
@@ -65,6 +65,8 @@ namespace {
const uint32_t kAppId = 5u;
const uint32_t kCustomButtonId = 3u;
const mobile_apis::ButtonName::eType kButtonName = mobile_apis::ButtonName::OK;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
template <class NotificationT,
@@ -217,7 +219,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
this->template CreateCommand<Notification>(notification_msg));
typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
- ON_CALL(*mock_app, hmi_level())
+ ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
@@ -264,7 +266,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_InvalidHmiLevel_UNSUCCESS) {
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
@@ -290,7 +292,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest,
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
@@ -316,7 +318,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
std::vector<ApplicationSharedPtr> subscribed_apps_list;
subscribed_apps_list.push_back(mock_app);
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
index 501b4d8631..b7b827bb4c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_keyboard_input_notification_test.cc
@@ -48,6 +48,8 @@ namespace strings = application_manager::strings;
namespace {
const uint32_t kConnectionKey = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
using application_manager::ApplicationSet;
@@ -102,7 +104,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionActive_SUCCESS) {
EXPECT_CALL(*mock_app, is_perform_interaction_active()).WillOnce(Return(1));
EXPECT_CALL(*mock_app, perform_interaction_layout())
.WillOnce(Return(mobile_apis::LayoutMode::KEYBOARD));
- EXPECT_CALL(*mock_app, hmi_level()).Times(0);
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId)).Times(0);
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
@@ -126,7 +128,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_ActionNotActive_SUCCESS) {
EXPECT_CALL(*mock_app, is_perform_interaction_active())
.WillRepeatedly(Return(0));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_FULL));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kConnectionKey));
@@ -151,7 +153,7 @@ TEST_F(OnKeyBoardInputNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(*mock_app, is_perform_interaction_active())
.WillRepeatedly(Return(0));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::eType::HMI_BACKGROUND));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
new file mode 100644
index 0000000000..349ada66a2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_capability_updated_notification_test.cc
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2019, 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 "mobile/on_system_capability_updated_notification.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "gtest/gtest.h"
+#include "sdl_rpc_plugin/extensions/system_capability_app_extension.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace on_system_capability_updated_notification {
+
+using sdl_rpc_plugin::commands::mobile::OnSystemCapabilityUpdatedNotification;
+using ::testing::_;
+using ::testing::Return;
+
+typedef std::shared_ptr<OnSystemCapabilityUpdatedNotification>
+ OnSystemCapabilityUpdatedNotificationPtr;
+
+namespace strings = application_manager::strings;
+namespace {
+const uint32_t kConnectionKey = 1u;
+const uint32_t kAppId = 2u;
+} // namespace
+
+MATCHER_P(CheckDisplayCapabilities, display_capabilities, "") {
+ return *display_capabilities ==
+ (*arg)[strings::msg_params][strings::system_capability]
+ [strings::display_capabilities];
+}
+
+class OnSystemCapabilityUpdatedNotificationTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {
+ protected:
+ void SetUp() OVERRIDE {
+ message_ = CreateMessage();
+ (*message_)[strings::params][strings::connection_key] = kConnectionKey;
+
+ command_ = CreateCommand<OnSystemCapabilityUpdatedNotification>(message_);
+ mock_app_ = CreateMockApp();
+ }
+
+ OnSystemCapabilityUpdatedNotificationPtr command_;
+ MockAppPtr mock_app_;
+ MessageSharedPtr message_;
+};
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistSubscribedToNotification_SystemDisplayCapabilitiesSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(
+ mobile_apis::SystemCapabilityType::DISPLAYS);
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+ application_manager::DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ EXPECT_CALL(
+ mock_rpc_service_,
+ SendMessageToMobile(CheckDisplayCapabilities(system_display_capabilities),
+ false));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistConnectionKeyNotEqualWithAppId_SystemDisplayCapabilitiesNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+ system_capability_app_extension->SubscribeTo(
+ mobile_apis::SystemCapabilityType::DISPLAYS);
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppExistNotSubscribedToNotification_SystemDisplayCapabilitiesNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+
+ smart_objects::SmartObjectSPtr system_display_capabilities =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Null);
+
+ ON_CALL(mock_hmi_capabilities_, system_display_capabilities())
+ .WillByDefault(Return(system_display_capabilities));
+
+ sdl_rpc_plugin::SDLRPCPlugin sdl_rpc_plugin;
+
+ std::shared_ptr<sdl_rpc_plugin::SystemCapabilityAppExtension>
+ system_capability_app_extension(
+ std::make_shared<sdl_rpc_plugin::SystemCapabilityAppExtension>(
+ sdl_rpc_plugin, *mock_app_));
+
+ application_manager::ApplicationSet apps({mock_app_});
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, display_capabilities()).WillByDefault(Return(nullptr));
+ ON_CALL(*mock_app_,
+ QueryInterface(sdl_rpc_plugin::SystemCapabilityAppExtension::
+ SystemCapabilityAppExtensionUID))
+ .WillByDefault(Return(system_capability_app_extension));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(
+ OnSystemCapabilityUpdatedNotificationTest,
+ Run_AppDataEmpty_SystemDisplayCapabilitiesUpdatedNotificationNotSendToMobile) {
+ (*message_)[am::strings::msg_params][strings::system_capability]
+ [am::strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::DISPLAYS;
+ application_manager::ApplicationSet apps;
+ std::shared_ptr<sync_primitives::Lock> apps_lock_(
+ std::make_shared<sync_primitives::Lock>());
+ DataAccessor<application_manager::ApplicationSet> apps_data(
+ DataAccessor<application_manager::ApplicationSet>(apps, apps_lock_));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(apps_data));
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(_, _)).Times(0);
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+} // namespace on_system_capability_updated_notification
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
index f1e1a291d3..c43dea76e1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_tbt_client_state_notification_test.cc
@@ -60,6 +60,8 @@ typedef std::shared_ptr<OnTBTClientStateNotification> NotificationPtr;
namespace {
const uint32_t kAppId = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class OnTBTClientStateNotificationTest
@@ -79,7 +81,7 @@ TEST_F(OnTBTClientStateNotificationTest, Run_HmiLevelNone_UNSUCCESS) {
EXPECT_CALL(app_mngr_, applications_with_navi())
.WillOnce(Return(applications_with_navi));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app, app_id()).Times(0);
@@ -122,7 +124,7 @@ TEST_F(OnTBTClientStateNotificationTest,
EXPECT_CALL(app_mngr_, applications_with_navi())
.WillOnce(Return(applications_with_navi));
- EXPECT_CALL(*mock_app, hmi_level())
+ EXPECT_CALL(*mock_app, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
index b0df0e57d3..2915418d43 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_audio_pass_thru_test.cc
@@ -72,6 +72,8 @@ const std::string kCorrectDisplayText1 = "CorrectDisplayText1";
const std::string kCorrectDisplayText2 = "CorrectDisplayText2";
const std::string kFunctionId = "FunctionId";
const uint32_t kTimeoutForTTSSpeak = 1u;
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class PerformAudioPassThruRequestTest
@@ -109,7 +111,7 @@ class PerformAudioPassThruRequestTest
msg_params_[field] = "prompt\\n";
}
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
CallRun caller(*command_sptr_);
@@ -206,7 +208,7 @@ TEST_F(PerformAudioPassThruRequestTest,
(*mobile_request)[am::strings::msg_params][am::strings::initial_prompt] =
initial_prompt;
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
std::shared_ptr<PerformAudioPassThruRequest> command =
CreateCommand<PerformAudioPassThruRequest>(mobile_request);
@@ -286,7 +288,7 @@ TEST_F(PerformAudioPassThruRequestTest,
}
TEST_F(PerformAudioPassThruRequestTest, Run_HmiLevelNone_Rejected) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_NONE));
CallRun caller(*command_sptr_);
@@ -319,7 +321,7 @@ TEST_F(PerformAudioPassThruRequestTest,
// First we need to call SendSpeakRequest()
// to enable the "is_active_tts_speak" key
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -407,7 +409,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteTrue) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -481,7 +483,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(PerformAudioPassThruRequestTest,
Run_InitPromptCorrect_SpeakAndPerformAPTRequestsSendMuteFalse) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
@@ -536,7 +538,7 @@ TEST_F(PerformAudioPassThruRequestTest,
TEST_F(
PerformAudioPassThruRequestTest,
Run_InitPromptEmpty_PerformAndRecordStartNotificationsAndStartRecording) {
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
MessageSharedPtr start_record_result_msg;
@@ -766,7 +768,7 @@ TEST_F(PerformAudioPassThruRequestTest,
EXPECT_CALL(app_mngr_, EndAudioPassThru(app_id)).WillOnce(Return(true));
EXPECT_CALL(app_mngr_, StopAudioPassThru(_));
- EXPECT_CALL(*application_sptr_, hmi_level())
+ EXPECT_CALL(*application_sptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(am::mobile_api::HMILevel::HMI_FULL));
msg_params_[am::strings::initial_prompt][0][am::strings::text] =
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
index e8e03484ed..8db533f446 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/put_file_test.cc
@@ -78,6 +78,8 @@ const int64_t kZeroOffset = 0u;
const std::string kStorageFolder = "./storage";
const std::string kFolder = "folder";
const std::string kAppFolder = "app_folder";
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
class PutFileRequestTest
@@ -99,7 +101,7 @@ class PutFileRequestTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
- ON_CALL(*mock_app_, hmi_level())
+ ON_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillByDefault(Return(mobile_apis::HMILevel::HMI_FULL));
}
@@ -179,7 +181,7 @@ TEST_F(PutFileRequestTest, Run_ApplicationIsNotRegistered_UNSUCCESS) {
}
TEST_F(PutFileRequestTest, Run_HmiLevelNone_UNSUCCESS) {
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
const uint32_t settings_put_file_in_none = 1u;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
index cc2f042eac..cde15a2318 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/set_display_layout_test.cc
@@ -160,6 +160,7 @@ TEST_F(SetDisplayLayoutRequestTest,
ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
.WillOnce(DoAll(SaveArg<0>(&ui_command_result), Return(true)));
+ command->Init();
command->on_event(event);
ResultCommandExpectations(ui_command_result, "UI is not supported by system");
@@ -178,6 +179,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_InvalidApp_UNSUCCESS) {
MobileResultCodeIs(mobile_result::APPLICATION_NOT_REGISTERED),
am::commands::Command::CommandSource::SOURCE_SDL));
+ command->Init();
command->Run();
}
@@ -188,7 +190,7 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
MockAppPtr mock_app(CreateMockApp());
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app));
- EXPECT_CALL(*mock_app, display_layout()).WillOnce(ReturnRef(kLayout));
+ EXPECT_CALL(*mock_app, display_layout()).WillOnce(Return(kLayout));
EXPECT_CALL(*mock_app, app_id()).WillOnce(Return(kAppId));
EXPECT_CALL(app_mngr_, GetNextHMICorrelationID())
@@ -204,20 +206,60 @@ TEST_F(SetDisplayLayoutRequestTest, Run_SUCCESS) {
ManageHMICommand(CheckMshCorrId(kCorrelationKey), _))
.WillOnce(Return(true));
+ command->Init();
command->Run();
}
TEST_F(SetDisplayLayoutRequestTest, OnEvent_InvalidEventId_UNSUCCESS) {
- CommandPtr command(CreateCommand<SetDisplayLayoutRequest>());
+ MessageSharedPtr msg(CreateMessage(smart_objects::SmartType_Map));
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+
am::event_engine::Event event(hmi_apis::FunctionID::INVALID_ENUM);
- SmartObject msg(smart_objects::SmartType_Map);
- event.set_smart_object(msg);
+ event.set_smart_object(*msg);
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ command->Init();
+ command->on_event(event);
+}
+
+TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v6_WARNING) {
+ am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
+ MessageSharedPtr msg = CreateMessage();
+
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::SUCCESS;
+ (*msg)[am::strings::msg_params][am::hmi_response::display_capabilities] = 0;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+ event.set_smart_object(*msg);
+
+ MessageSharedPtr dispaly_capabilities_msg = CreateMessage();
+ (*dispaly_capabilities_msg)[am::hmi_response::templates_available] =
+ "templates_available";
+
+ EXPECT_CALL(mock_hmi_capabilities_, display_capabilities())
+ .WillOnce(Return(dispaly_capabilities_msg.get()));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(MobileResultCodeIs(mobile_result::WARNINGS),
+ am::commands::Command::CommandSource::SOURCE_SDL));
+ CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ ::application_manager::Version app_version;
+ app_version.max_supported_api_version =
+ ::application_manager::APIVersion::kAPIV6;
+ EXPECT_CALL(*mock_app, version()).WillOnce(ReturnRef(app_version));
+
+ command->Init();
command->on_event(event);
}
-TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
+TEST_F(SetDisplayLayoutRequestTest, OnEvent_AppVersion_v5_SUCCESS) {
am::event_engine::Event event(hmi_apis::FunctionID::UI_SetDisplayLayout);
MessageSharedPtr msg = CreateMessage();
@@ -239,6 +281,15 @@ TEST_F(SetDisplayLayoutRequestTest, OnEvent_SUCCESS) {
am::commands::Command::CommandSource::SOURCE_SDL));
CommandPtr command(CreateCommand<SetDisplayLayoutRequest>(msg));
+ MockAppPtr mock_app(CreateMockApp());
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+ ::application_manager::Version app_version;
+ app_version.max_supported_api_version =
+ ::application_manager::APIVersion::kAPIV5;
+ EXPECT_CALL(*mock_app, version()).WillOnce(ReturnRef(app_version));
+
+ command->Init();
command->on_event(event);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
index ed0f52a521..b8cfdd4bfc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/show_test.cc
@@ -31,6 +31,7 @@
*/
#include <stdint.h>
+#include <array>
#include <memory>
#include <set>
#include <string>
@@ -68,8 +69,28 @@ const uint32_t kAppId = 1u;
const uint32_t kCmdId = 1u;
const uint32_t kConnectionKey = 2u;
const uint32_t kFunctionID = 3u;
+const std::string kCurrentTemplatelayout = "current_template_layout";
+const std::string kNewTemplateLayout = "new_template_layout";
+const app_mngr::WindowID kCurrentWindowID = 1;
+typedef std::array<int, 3> rgb_color_scheme;
+const rgb_color_scheme kCurrentDayColorRGB = {75, 75, 75};
+const rgb_color_scheme kCurrentNightColorRGB = {200, 200, 200};
+const rgb_color_scheme kNewDayColorRGB = {80, 80, 80};
+const rgb_color_scheme kNewNightColorRGB = {222, 222, 222};
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
+MATCHER_P2(CheckMessageToMobile, result_code, success, "") {
+ const bool is_success =
+ (*arg)[am::strings::msg_params][am::strings::success].asBool() == success;
+
+ const bool is_result_code_correct =
+ (*arg)[am::strings::msg_params][am::strings::result_code].asInt() ==
+ static_cast<int32_t>(result_code);
+ return is_success && is_result_code_correct;
+}
+
class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
public:
ShowRequestTest() {
@@ -104,6 +125,101 @@ class ShowRequestTest : public CommandRequestTest<CommandsTestMocks::kIsNice> {
return msg;
}
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillByDefault(Return(true));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+ }
+
+ smart_objects::SmartObject CreateColorScheme(
+ const rgb_color_scheme& rgb_color_scheme) {
+ using namespace application_manager;
+
+ smart_objects::SmartObject primary_color(smart_objects::SmartType_Map);
+ smart_objects::SmartObject secondary_color(smart_objects::SmartType_Map);
+ smart_objects::SmartObject background_color(smart_objects::SmartType_Map);
+
+ primary_color[strings::red] = rgb_color_scheme[0];
+ primary_color[strings::green] = rgb_color_scheme[1];
+ primary_color[strings::blue] = rgb_color_scheme[2];
+
+ secondary_color[strings::red] = rgb_color_scheme[0];
+ secondary_color[strings::green] = rgb_color_scheme[1];
+ secondary_color[strings::blue] = rgb_color_scheme[2];
+
+ background_color[strings::red] = rgb_color_scheme[0];
+ background_color[strings::green] = rgb_color_scheme[1];
+ background_color[strings::blue] = rgb_color_scheme[2];
+
+ smart_objects::SmartObject color_scheme(smart_objects::SmartType_Map);
+ color_scheme[strings::primary_color] = primary_color;
+ color_scheme[strings::secondary_color] = secondary_color;
+ color_scheme[strings::background_color] = background_color;
+
+ return color_scheme;
+ }
+
+ smart_objects::SmartObject CreateTemplateConfiguration(
+ const std::string& layout) {
+ using namespace application_manager;
+
+ smart_objects::SmartObject template_configuration(
+ smart_objects::SmartType_Map);
+
+ template_configuration[strings::template_layout] = layout;
+
+ template_configuration[strings::day_color_scheme] =
+ CreateColorScheme(kCurrentDayColorRGB);
+
+ template_configuration[strings::night_color_scheme] =
+ CreateColorScheme(kCurrentNightColorRGB);
+
+ return template_configuration;
+ }
+
+ MessageSharedPtr CreateMessageWithTemplateLayout(const std::string& layout) {
+ auto msg = CreateMsgParams();
+ (*msg)[app_mngr::strings::msg_params][app_mngr::strings::window_id] =
+ kCurrentWindowID;
+ (*msg)[am::strings::msg_params][am::strings::template_configuration] =
+ CreateTemplateConfiguration(layout);
+
+ return msg;
+ }
+
+ std::shared_ptr<ShowRequest> SetupHelperLayout(
+ const std::string& layout,
+ const rgb_color_scheme& day_colors,
+ const rgb_color_scheme& night_colors) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ const auto current_day_color_scheme = CreateColorScheme(day_colors);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme = CreateColorScheme(night_colors);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(layout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ return command;
+ }
+
void TestSetupHelper(MessageSharedPtr msg,
hmi_apis::Common_TextFieldName::eType field_name,
const char* field) {
@@ -269,9 +385,9 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_SUCCESS) {
msg_params[am::hmi_request::show_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- EXPECT_CALL(
- mock_message_helper_,
- SubscribeApplicationToSoftButton(creation_msg_params, _, kFunctionID));
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(
+ creation_msg_params, _, kFunctionID, kDefaultWindowId));
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _));
EXPECT_CALL(*mock_app_, set_show_command(msg_params));
@@ -319,7 +435,8 @@ TEST_F(ShowRequestTest, Run_SoftButtonExists_Canceled) {
EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_message_helper_, SubscribeApplicationToSoftButton(_, _, _))
+ EXPECT_CALL(mock_message_helper_,
+ SubscribeApplicationToSoftButton(_, _, _, kDefaultWindowId))
.Times(0);
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
@@ -729,10 +846,14 @@ TEST_F(ShowRequestTest, Run_MainField1_MetadataTagWithNoFieldData) {
hmi_apis::Common_Result::SUCCESS;
(*ev_msg)[am::strings::msg_params][am::strings::app_id] = kConnectionKey;
(*ev_msg)[am::strings::msg_params][am::strings::info] = "";
+ (*ev_msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
Event event(hmi_apis::FunctionID::UI_Show);
event.set_smart_object(*ev_msg);
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
MessageSharedPtr ui_command_result;
EXPECT_CALL(
mock_rpc_service_,
@@ -886,34 +1007,328 @@ TEST_F(ShowRequestTest, Run_CustomPresets_WrongSyntax) {
command->Run();
}
-TEST_F(ShowRequestTest, Run_InvalidApp_Canceled) {
+TEST_F(ShowRequestTest,
+ Run_AppDoesNotExist_ExpectAppNotRegisteredResponseToMobile) {
+ const auto result_code = mobile_apis::Result::APPLICATION_NOT_REGISTERED;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey)).WillOnce(Return(nullptr));
+
+ auto msg = CreateMsgParams();
+ auto command = CreateCommand<ShowRequest>(msg);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
MessageSharedPtr msg = CreateMsgParams();
std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(MockAppPtr()));
+ .WillOnce(Return(mock_app_));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
EXPECT_CALL(*mock_app_, app_id()).Times(0);
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
+ ASSERT_TRUE(command->Init());
command->Run();
}
-TEST_F(ShowRequestTest, Run_EmptyParams_Canceled) {
- MessageSharedPtr msg = CreateMsgParams();
+TEST_F(ShowRequestTest,
+ Run_WindowWithIDDoesNotExist_ExpectInvalidIDResponseToMobile) {
+ const auto result_code = mobile_apis::Result::INVALID_ID;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(CheckMessageToMobile(result_code, false),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ ON_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillByDefault(Return(false));
- std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
+ auto msg = CreateMsgParams();
+ (*msg)[am::strings::msg_params][am::strings::window_id] = kCurrentWindowID;
+
+ auto command = CreateCommand<ShowRequest>(msg);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeWithoutBothColorScheme_SendRequestToHMI_SUCCESS) {
+ auto msg = CreateMsgParams();
+ (*msg)[app_mngr::strings::msg_params][app_mngr::strings::window_id] =
+ kCurrentWindowID;
+ (*msg)[am::strings::msg_params][am::strings::template_configuration]
+ [am::strings::template_layout] = kCurrentTemplatelayout;
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ auto message_to_hmi = CreateMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_hmi), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const auto template_layout =
+ (*message_to_hmi)[am::strings::msg_params]
+ [am::strings::template_configuration]
+ [am::strings::template_layout]
+ .asString();
+ EXPECT_EQ(kCurrentTemplatelayout, template_layout);
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeDayColorSchemesNotEqual_Response_REJECTED) {
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ const auto current_day_color_scheme = CreateColorScheme(kNewDayColorRGB);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+
+ auto message_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const bool success =
+ (*message_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool();
+ EXPECT_FALSE(success);
+
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::REJECTED, result_code);
+}
+
+TEST_F(ShowRequestTest,
+ Run_NoLayoutChangeNightColorSchemesNotEqual_Response_REJECTED) {
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ const auto current_night_color_scheme = CreateColorScheme(kNewNightColorRGB);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+
+ auto message_to_mobile = CreateMessage();
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ const bool success =
+ (*message_to_mobile)[am::strings::msg_params][am::strings::success]
+ .asBool();
+ EXPECT_FALSE(success);
+ const auto result_code = static_cast<mobile_apis::Result::eType>(
+ (*message_to_mobile)[am::strings::msg_params][am::strings::result_code]
+ .asUInt());
+
+ EXPECT_EQ(mobile_apis::Result::REJECTED, result_code);
+}
+
+TEST_F(ShowRequestTest,
+ Run_LayoutNotChangeBothColorSchemeEqual_SendRequestToHMI_SUCCESS) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
- EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _));
- EXPECT_CALL(*mock_app_, app_id()).Times(0);
- EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
- EXPECT_CALL(*mock_app_, set_show_command(_)).Times(0);
+ const auto current_day_color_scheme = CreateColorScheme(kCurrentDayColorRGB);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme =
+ CreateColorScheme(kCurrentNightColorRGB);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(kCurrentTemplatelayout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest,
+ Run_LayoutChangeBothColorSchemeNotEqual_SendRequestToHMI_SUCCESS) {
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(HMIResultCodeIs(hmi_apis::FunctionID::UI_Show),
+ Command::CommandSource::SOURCE_SDL_TO_HMI))
+ .WillOnce(Return(true));
+ EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kConnectionKey));
+ EXPECT_CALL(*mock_app_, WindowIdExists(kCurrentWindowID))
+ .WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+ const auto current_day_color_scheme = CreateColorScheme(kNewDayColorRGB);
+ ON_CALL(*mock_app_, day_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_day_color_scheme));
+ const auto current_night_color_scheme = CreateColorScheme(kNewNightColorRGB);
+ ON_CALL(*mock_app_, night_color_scheme(kCurrentWindowID))
+ .WillByDefault(Return(current_night_color_scheme));
+ ON_CALL(*mock_app_, window_layout(kCurrentWindowID))
+ .WillByDefault(Return(kCurrentTemplatelayout));
+
+ auto msg = CreateMessageWithTemplateLayout(kNewTemplateLayout);
+
+ auto command(CreateCommand<ShowRequest>(msg));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+}
+
+TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_ExpectSetWindowLayoutOnly) {
+ // Precondition
+ auto command =
+ SetupHelperLayout(kNewTemplateLayout, kNewDayColorRGB, kNewNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_, set_day_color_scheme(_, _));
+ EXPECT_CALL(*mock_app_, set_night_color_scheme(_, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectSetWindowLayoutAndSetDayColorScheme) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kNewTemplateLayout, kCurrentDayColorRGB, kNewNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_, set_night_color_scheme(_, _));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectSetWindowLayoutAndBothColorScheme) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kNewTemplateLayout, kCurrentDayColorRGB, kCurrentNightColorRGB);
+ ASSERT_TRUE(command->Init());
+ command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_,
+ set_window_layout(kCurrentWindowID, kNewTemplateLayout));
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_,
+ set_night_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentNightColorRGB)));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+ command->on_event(event);
+}
+
+TEST_F(ShowRequestTest,
+ OnEvent_SuccessResultCode_ExpectBothColorSchemeWithoutSetWindowLayout) {
+ // Precondition
+ auto command = SetupHelperLayout(
+ kCurrentTemplatelayout, kCurrentDayColorRGB, kCurrentNightColorRGB);
+ ASSERT_TRUE(command->Init());
command->Run();
+ // Expectation
+ EXPECT_CALL(*mock_app_, set_window_layout(_, _)).Times(0);
+ EXPECT_CALL(*mock_app_,
+ set_day_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentDayColorRGB)));
+ EXPECT_CALL(*mock_app_,
+ set_night_color_scheme(kCurrentWindowID,
+ CreateColorScheme(kCurrentNightColorRGB)));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckMessageToMobile(mobile_apis::Result::SUCCESS, true),
+ Command::CommandSource::SOURCE_SDL));
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app_));
+
+ auto msg = CreateMessage();
+ (*msg)[am::strings::params][am::hmi_response::code] =
+ hmi_apis::Common_Result::eType::SUCCESS;
+ (*msg)[am::strings::msg_params] = SmartObject(smart_objects::SmartType_Map);
+
+ Event event(hmi_apis::FunctionID::UI_Show);
+ event.set_smart_object(*msg);
+
+ command->on_event(event);
}
TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
@@ -931,7 +1346,7 @@ TEST_F(ShowRequestTest, OnEvent_SuccessResultCode_SUCCESS) {
event.set_smart_object(*msg);
EXPECT_CALL(app_mngr_, application(_)).WillRepeatedly(Return(mock_app_));
-
+ ASSERT_TRUE(command->Init());
command->on_event(event);
}
@@ -957,6 +1372,10 @@ TEST_F(ShowRequestTest, OnEvent_WrongFunctionID_Canceled) {
MessageSharedPtr msg = CreateMessage();
(*msg)[am::strings::params][am::hmi_response::code] =
mobile_apis::Result::SUCCESS;
+ (*msg)[am::strings::params][am::strings::connection_key] = kConnectionKey;
+
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
std::shared_ptr<ShowRequest> command(CreateCommand<ShowRequest>(msg));
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index 0636748977..f6b87d3a7e 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -173,19 +173,16 @@ InitialApplicationDataImpl::perform_interaction_layout() const {
}
DynamicApplicationDataImpl::DynamicApplicationDataImpl()
- : help_prompt_(NULL)
- , timeout_prompt_(NULL)
- , vr_help_title_(NULL)
- , vr_help_(NULL)
+ : help_prompt_(nullptr)
+ , timeout_prompt_(nullptr)
+ , vr_help_title_(nullptr)
+ , vr_help_(nullptr)
, tbt_state_(mobile_api::TBTState::INVALID_ENUM)
- , show_command_(NULL)
- , keyboard_props_(NULL)
- , menu_title_(NULL)
- , menu_icon_(NULL)
- , tbt_show_command_(NULL)
- , day_color_scheme_(NULL)
- , night_color_scheme_(NULL)
- , display_layout_("")
+ , show_command_(nullptr)
+ , keyboard_props_(nullptr)
+ , menu_title_(nullptr)
+ , menu_icon_(nullptr)
+ , tbt_show_command_(nullptr)
, commands_()
, commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
, sub_menu_()
@@ -195,9 +192,12 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl()
, performinteraction_choice_set_map_()
, performinteraction_choice_set_lock_ptr_(
std::make_shared<sync_primitives::RecursiveLock>())
+ , window_params_map_()
+ , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, is_perform_interaction_active_(false)
, is_reset_global_properties_active_(false)
- , perform_interaction_mode_(-1) {}
+ , perform_interaction_mode_(-1)
+ , display_capabilities_builder_(*this) {}
DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
if (help_prompt_) {
@@ -230,16 +230,6 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
tbt_show_command_ = NULL;
}
- if (day_color_scheme_) {
- delete day_color_scheme_;
- day_color_scheme_ = NULL;
- }
-
- if (night_color_scheme_) {
- delete night_color_scheme_;
- night_color_scheme_ = NULL;
- }
-
for (CommandsMap::iterator command_it = commands_.begin();
commands_.end() != command_it;
++command_it) {
@@ -265,6 +255,8 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
performinteraction_choice_set_map_[it->first].clear();
}
performinteraction_choice_set_map_.clear();
+
+ window_params_map_.clear();
}
const smart_objects::SmartObject* DynamicApplicationDataImpl::help_prompt()
@@ -316,18 +308,93 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon()
return menu_icon_;
}
-const smart_objects::SmartObject* DynamicApplicationDataImpl::day_color_scheme()
+smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme()
const {
- return day_color_scheme_;
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ const smart_objects::SmartObject template_config =
+ default_window_it->second;
+ if (template_config.keyExists(strings::day_color_scheme)) {
+ return template_config[strings::day_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::night_color_scheme() const {
- return night_color_scheme_;
+smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme()
+ const {
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ const smart_objects::SmartObject template_config =
+ default_window_it->second;
+ if (template_config.keyExists(strings::night_color_scheme)) {
+ return template_config[strings::night_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
+}
+
+std::string DynamicApplicationDataImpl::display_layout() const {
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ smart_objects::SmartObject template_config = default_window_it->second;
+ if (template_config.keyExists(strings::template_layout)) {
+ return template_config[strings::template_layout].asString();
+ }
+ }
+
+ return std::string();
}
-const std::string& DynamicApplicationDataImpl::display_layout() const {
- return display_layout_;
+smart_objects::SmartObjectSPtr
+DynamicApplicationDataImpl::display_capabilities() const {
+ return display_capabilities_;
+}
+
+smart_objects::SmartObjectSPtr DynamicApplicationDataImpl::display_capabilities(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto result_display_caps = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+ const auto window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ if (!window_caps) {
+ LOG4CXX_WARN(logger_, "Current window capabilities are empty");
+ // SDL still needs to retreive display capabilities
+ return display_capabilities_;
+ }
+ auto find_res =
+ std::find_if(window_caps->begin(),
+ window_caps->end(),
+ [&window_id](const smart_objects::SmartObject& element) {
+ if (window_id == element[strings::window_id].asInt()) {
+ return true;
+ }
+
+ return false;
+ });
+
+ DCHECK(find_res != window_caps->end());
+ const auto disp_caps_keys = (*display_capabilities_)[0].enumerate();
+ for (const auto& key : disp_caps_keys) {
+ if (strings::window_capabilities == key) {
+ continue;
+ }
+ (*result_display_caps)[0][key] = (*display_capabilities_)[0][key];
+ }
+
+ (*result_display_caps)[0][strings::window_capabilities][0] = *find_res;
+
+ return result_display_caps;
}
void DynamicApplicationDataImpl::load_global_properties(
@@ -447,24 +514,176 @@ void DynamicApplicationDataImpl::set_menu_icon(
void DynamicApplicationDataImpl::set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) {
- if (day_color_scheme_) {
- delete day_color_scheme_;
+ using namespace mobile_apis::PredefinedWindows;
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[DEFAULT_WINDOW][strings::day_color_scheme] = color_scheme;
+}
+
+void DynamicApplicationDataImpl::set_night_color_scheme(
+ const smart_objects::SmartObject& color_scheme) {
+ using namespace mobile_apis::PredefinedWindows;
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[DEFAULT_WINDOW][strings::night_color_scheme] = color_scheme;
+}
+
+void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis::PredefinedWindows;
+ smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
+ template_config[strings::template_layout] = layout;
+ window_templates_[DEFAULT_WINDOW] = template_config;
+}
+
+void DynamicApplicationDataImpl::set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& incoming_window_capabilities =
+ display_capabilities[0][strings::window_capabilities];
+
+ smart_objects::SmartObject tmp_window_capabilities;
+ if (display_capabilities_) {
+ tmp_window_capabilities =
+ (*display_capabilities_)[0][strings::window_capabilities];
}
- day_color_scheme_ = new smart_objects::SmartObject(color_scheme);
+ display_capabilities_.reset(
+ new smart_objects::SmartObject(display_capabilities));
+
+ auto has_window_id = [&tmp_window_capabilities](const WindowID window_id) {
+ const auto tmp_window_capabilities_arr = tmp_window_capabilities.asArray();
+ if (!tmp_window_capabilities_arr) {
+ return false;
+ }
+
+ const auto find_res = std::find_if(
+ tmp_window_capabilities_arr->begin(),
+ tmp_window_capabilities_arr->end(),
+ [&window_id](const smart_objects::SmartObject& element) {
+ LOG4CXX_DEBUG(logger_,
+ "Searching for "
+ << window_id << " with element window id "
+ << element[strings::window_id].asInt());
+ if ((!element.keyExists(strings::window_id)) && 0 == window_id) {
+ return true;
+ }
+ const auto current_window_id = element[strings::window_id].asInt();
+ if (window_id == current_window_id) {
+ return true;
+ }
+ return false;
+ });
+
+ return find_res != tmp_window_capabilities_arr->end();
+ };
+ for (uint32_t i = 0; i < incoming_window_capabilities.length(); ++i) {
+ const auto window_id =
+ incoming_window_capabilities[i][strings::window_id].asInt();
+ if (!has_window_id(window_id)) {
+ tmp_window_capabilities[tmp_window_capabilities.length()] =
+ incoming_window_capabilities[i];
+ }
+ }
+
+ (*display_capabilities_)[0][strings::window_capabilities] =
+ tmp_window_capabilities;
+}
+
+void DynamicApplicationDataImpl::remove_window_capability(
+ const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto window_capabilities =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ DCHECK_OR_RETURN_VOID(window_capabilities);
+
+ for (auto it = window_capabilities->begin(); it != window_capabilities->end();
+ ++it) {
+ const auto cur_window_id = (*it).keyExists(strings::window_id)
+ ? (*it)[strings::window_id].asInt()
+ : 0;
+ if (window_id == cur_window_id) {
+ window_capabilities->erase(it);
+ return;
+ }
+ }
+
+ LOG4CXX_WARN(
+ logger_,
+ "No window id " << window_id << " found in display capabilities");
+}
+
+void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id,
+ const std::string& layout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
+
+ template_config[strings::template_layout] = layout;
+ window_templates_[window_id] = template_config;
+}
+
+void DynamicApplicationDataImpl::set_day_color_scheme(
+ const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[window_id][strings::day_color_scheme] = color_scheme;
}
void DynamicApplicationDataImpl::set_night_color_scheme(
- const smart_objects::SmartObject& color_scheme) {
- if (night_color_scheme_) {
- delete night_color_scheme_;
+ const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[window_id][strings::night_color_scheme] = color_scheme;
+}
+
+std::string DynamicApplicationDataImpl::window_layout(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::template_layout)) {
+ return template_config[strings::template_layout].asString();
+ }
}
- night_color_scheme_ = new smart_objects::SmartObject(color_scheme);
+ return std::string();
}
-void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
- display_layout_ = layout;
+smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::day_color_scheme)) {
+ return template_config[strings::day_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
+}
+
+smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::night_color_scheme)) {
+ return template_config[strings::night_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
}
void DynamicApplicationDataImpl::SetGlobalProperties(
@@ -555,6 +774,33 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
return false;
}
+DataAccessor<WindowParamsMap>
+DynamicApplicationDataImpl::window_optional_params_map() const {
+ return DataAccessor<WindowParamsMap>(window_params_map_,
+ window_params_map_lock_ptr_);
+}
+
+void DynamicApplicationDataImpl::SetWindowInfo(
+ const WindowID window_id, const smart_objects::SmartObject& window_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto it = window_params_map_.find(window_id);
+ if (window_params_map_.end() == it) {
+ window_params_map_[window_id] =
+ std::make_shared<smart_objects::SmartObject>(window_info);
+ }
+}
+
+DisplayCapabilitiesBuilder&
+DynamicApplicationDataImpl::display_capabilities_builder() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return display_capabilities_builder_;
+}
+
+void DynamicApplicationDataImpl::RemoveWindowInfo(const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ window_params_map_.erase(window_id);
+}
+
void DynamicApplicationDataImpl::AddChoiceSet(
uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) {
sync_primitives::AutoLock lock(choice_set_map_lock_ptr_);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 3b2f51f26c..bb505e2498 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -113,6 +113,7 @@ ApplicationImpl::ApplicationImpl(
, video_streaming_suspended_(true)
, audio_streaming_suspended_(true)
, is_app_allowed_(true)
+ , is_app_data_resumption_allowed_(false)
, has_been_activated_(false)
, tts_properties_in_none_(false)
, tts_properties_in_full_(false)
@@ -187,7 +188,8 @@ void ApplicationImpl::CloseActiveMessage() {
}
bool ApplicationImpl::IsFullscreen() const {
- return mobile_api::HMILevel::HMI_FULL == hmi_level();
+ return mobile_api::HMILevel::HMI_FULL ==
+ hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
}
bool ApplicationImpl::is_audio() const {
@@ -265,19 +267,21 @@ bool ApplicationImpl::IsVideoApplication() const {
return is_video_app;
}
-void ApplicationImpl::SetRegularState(HmiStatePtr state) {
+void ApplicationImpl::SetRegularState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
-void ApplicationImpl::RemovePostponedState() {
+void ApplicationImpl::RemovePostponedState(const WindowID window_id) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.RemoveState(HmiState::STATE_ID_POSTPONED);
+ state_.RemoveState(window_id, HmiState::STATE_ID_POSTPONED);
}
-void ApplicationImpl::SetPostponedState(HmiStatePtr state) {
+void ApplicationImpl::SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
void ApplicationImpl::set_mobile_projection_enabled(bool option) {
@@ -297,22 +301,56 @@ struct StateIDComparator {
}
};
-void ApplicationImpl::AddHMIState(HmiStatePtr state) {
+void ApplicationImpl::AddHMIState(const WindowID window_id, HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
-void ApplicationImpl::RemoveHMIState(HmiState::StateID state_id) {
+void ApplicationImpl::RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.RemoveState(state_id);
+ state_.RemoveState(window_id, state_id);
}
-const HmiStatePtr ApplicationImpl::CurrentHmiState() const {
- return state_.GetState(HmiState::STATE_ID_CURRENT);
+const HmiStatePtr ApplicationImpl::CurrentHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_CURRENT);
}
-const HmiStatePtr ApplicationImpl::RegularHmiState() const {
- return state_.GetState(HmiState::STATE_ID_REGULAR);
+const HmiStatePtr ApplicationImpl::RegularHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_REGULAR);
+}
+
+WindowNames ApplicationImpl::GetWindowNames() const {
+ LOG4CXX_DEBUG(logger_,
+ "Collecting window names for application " << app_id());
+
+ WindowNames window_names;
+ std::string stringified_window_names;
+
+ sync_primitives::AutoLock auto_lock(window_params_map_lock_ptr_);
+ for (const auto& window_info_item : window_params_map_) {
+ const auto window_name =
+ (*window_info_item.second)[strings::window_name].asString();
+ window_names.push_back(window_name);
+ stringified_window_names +=
+ (stringified_window_names.empty() ? "" : ",") + window_name;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Existing window names: [" + stringified_window_names + "]");
+ return window_names;
+}
+
+WindowIds ApplicationImpl::GetWindowIds() const {
+ LOG4CXX_DEBUG(logger_, "Collecting window IDs for application " << app_id());
+ return state_.GetWindowIds();
+}
+
+bool ApplicationImpl::WindowIdExists(const WindowID window_id) const {
+ const WindowIds window_ids = GetWindowIds();
+ return helpers::in_range(window_ids, window_id);
}
bool ApplicationImpl::IsAllowedToChangeAudioSource() const {
@@ -322,8 +360,9 @@ bool ApplicationImpl::IsAllowedToChangeAudioSource() const {
return false;
}
-const HmiStatePtr ApplicationImpl::PostponedHmiState() const {
- return state_.GetState(HmiState::STATE_ID_POSTPONED);
+const HmiStatePtr ApplicationImpl::PostponedHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_POSTPONED);
}
const smart_objects::SmartObject* ApplicationImpl::active_message() const {
@@ -354,9 +393,10 @@ bool ApplicationImpl::is_media_application() const {
return is_media_;
}
-const mobile_api::HMILevel::eType ApplicationImpl::hmi_level() const {
+const mobile_api::HMILevel::eType ApplicationImpl::hmi_level(
+ const WindowID window_id) const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state = CurrentHmiState(window_id);
return hmi_state ? hmi_state->hmi_level() : HMILevel::INVALID_ENUM;
}
@@ -380,9 +420,10 @@ const uint32_t ApplicationImpl::list_files_in_none_count() const {
return list_files_in_none_count_;
}
-const mobile_api::SystemContext::eType ApplicationImpl::system_context() const {
+const mobile_api::SystemContext::eType ApplicationImpl::system_context(
+ const WindowID window_id) const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state = CurrentHmiState(window_id);
return hmi_state ? hmi_state->system_context() : SystemContext::INVALID_ENUM;
;
}
@@ -680,6 +721,14 @@ void ApplicationImpl::set_app_allowed(const bool allowed) {
is_app_allowed_ = allowed;
}
+bool ApplicationImpl::is_app_data_resumption_allowed() const {
+ return is_app_data_resumption_allowed_;
+}
+
+void ApplicationImpl::set_app_data_resumption_allowance(const bool allowed) {
+ is_app_data_resumption_allowed_ = allowed;
+}
+
void ApplicationImpl::set_secondary_device(
connection_handler::DeviceHandle secondary_device) {
secondary_device_id_ = secondary_device;
@@ -930,8 +979,10 @@ bool ApplicationImpl::is_application_data_changed() const {
return is_application_data_changed_;
}
-void ApplicationImpl::SetInitialState(HmiStatePtr state) {
- state_.InitState(state);
+void ApplicationImpl::SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) {
+ state_.InitState(window_id, window_name, state);
}
void ApplicationImpl::set_is_application_data_changed(
@@ -1074,21 +1125,58 @@ void ApplicationImpl::SubscribeToSoftButtons(
cmd_softbuttonid_[cmd_id] = softbuttons_id;
}
} else {
- cmd_softbuttonid_[cmd_id] = softbuttons_id;
+ auto& soft_button_ids = cmd_softbuttonid_[cmd_id];
+ for (auto& softbutton_item : softbuttons_id) {
+ soft_button_ids.insert(softbutton_item);
+ }
}
}
+struct FindSoftButtonId {
+ uint32_t soft_button_id_;
+
+ FindSoftButtonId(const uint32_t soft_button_id)
+ : soft_button_id_(soft_button_id) {}
+
+ bool operator()(const std::pair<uint32_t, WindowID>& element) {
+ return soft_button_id_ == element.first;
+ }
+};
+
bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
for (; it != cmd_softbuttonid_.end(); ++it) {
- if ((it->second).find(softbutton_id) != (it->second).end()) {
+ const auto& soft_button_ids = (*it).second;
+ FindSoftButtonId finder(softbutton_id);
+ const auto find_res =
+ std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
+ if ((soft_button_ids.end() != find_res)) {
return true;
}
}
return false;
}
+WindowID ApplicationImpl::GetSoftButtonWindowID(const uint32_t softbutton_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
+ CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
+ for (; it != cmd_softbuttonid_.end(); ++it) {
+ const auto& soft_button_ids = (*it).second;
+ FindSoftButtonId finder(softbutton_id);
+ const auto find_res =
+ std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
+ if ((soft_button_ids.end() != find_res)) {
+ return find_res->second;
+ }
+ }
+
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
@@ -1098,8 +1186,9 @@ void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
}
void ApplicationImpl::set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) {
- const HmiStatePtr hmi_state = CurrentHmiState();
+ HmiStatePtr hmi_state = CurrentHmiState(window_id);
hmi_state->set_system_context(system_context);
}
@@ -1112,13 +1201,20 @@ void ApplicationImpl::set_audio_streaming_state(
" for non-media application to different from NOT_AUDIBLE");
return;
}
- CurrentHmiState()->set_audio_streaming_state(state);
+
+ // According to proposal SDL-0216 audio streaming state should
+ // be applied for all windows to keep consistency
+ HmiStates hmi_states = state_.GetStates(HmiState::STATE_ID_CURRENT);
+ for (const auto& hmi_state : hmi_states) {
+ hmi_state->set_audio_streaming_state(state);
+ }
}
void ApplicationImpl::set_hmi_level(
+ const WindowID window_id,
const mobile_api::HMILevel::eType& new_hmi_level) {
using namespace mobile_apis;
- const HMILevel::eType current_hmi_level = hmi_level();
+ const HMILevel::eType current_hmi_level = hmi_level(window_id);
if (HMILevel::HMI_NONE != current_hmi_level &&
HMILevel::HMI_NONE == new_hmi_level) {
put_file_in_none_count_ = 0;
@@ -1127,7 +1223,8 @@ void ApplicationImpl::set_hmi_level(
}
ApplicationSharedPtr app = application_manager_.application(app_id());
DCHECK_OR_RETURN_VOID(app)
- application_manager_.state_controller().SetRegularState(app, new_hmi_level);
+ application_manager_.state_controller().SetRegularState(
+ app, window_id, new_hmi_level);
LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level);
usage_report_.RecordHmiStateChanged(new_hmi_level);
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 04fcf2c53f..20a53b9780 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -304,7 +304,9 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
}
bool LimitedAppPredicate(const ApplicationSharedPtr app) {
- return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false;
+ return app ? app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED
+ : false;
}
ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
@@ -315,7 +317,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_navi() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -327,7 +330,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application()
bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_voice_communication_supported() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -349,7 +353,8 @@ ApplicationManagerImpl::applications_with_navi() {
bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) {
return app ? (app->mobile_projection_enabled() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -574,12 +579,16 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
HmiStatePtr initial_state =
CreateRegularState(std::shared_ptr<Application>(application),
+ mobile_apis::WindowType::MAIN,
mobile_apis::HMILevel::INVALID_ENUM,
mobile_apis::AudioStreamingState::INVALID_ENUM,
mobile_apis::VideoStreamingState::INVALID_ENUM,
mobile_api::SystemContext::SYSCTXT_MAIN);
- application->SetInitialState(initial_state);
+ application->SetInitialState(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ std::string(), // should not be tracked for main window
+ initial_state);
application->set_folder_name(policy_app_id + "_" +
application->mac_address());
@@ -735,18 +744,15 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
LOG4CXX_DEBUG(logger_, "Activating application with id:" << app->app_id());
- // remove from resumption if app was activated by user
+ // Remove from resumption if app was activated by user
resume_controller().OnAppActivated(app);
+
// Activate any app services published by the app
GetAppServiceManager().OnAppActivated(app);
- const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
- const AudioStreamingState::eType audio_state =
- app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
- : AudioStreamingState::NOT_AUDIBLE;
- const VideoStreamingState::eType video_state =
- app->IsVideoApplication() ? VideoStreamingState::STREAMABLE
- : VideoStreamingState::NOT_STREAMABLE;
- state_ctrl_.SetRegularState(app, hmi_level, audio_state, video_state, false);
+
+ // Activate main window in state controller
+ state_ctrl_.ActivateDefaultWindow(app);
+
return true;
}
@@ -1314,11 +1320,13 @@ void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) {
HmiStatePtr ApplicationManagerImpl::CreateRegularState(
std::shared_ptr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const {
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const {
HmiStatePtr state(new HmiState(app, *this));
+ state->set_window_type(window_type);
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_state);
state->set_video_streaming_state(video_state);
@@ -3043,6 +3051,7 @@ void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions) {
@@ -3055,7 +3064,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
DCHECK(app);
policy::CheckPermissionResult result;
- GetPolicyHandler().CheckPermissions(app, function_id, rpc_params, result);
+ GetPolicyHandler().CheckPermissions(
+ app, window_id, function_id, rpc_params, result);
if (NULL != params_permissions) {
params_permissions->allowed_params = result.list_of_allowed_params;
@@ -3063,7 +3073,9 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
params_permissions->undefined_params = result.list_of_undefined_params;
}
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE &&
+ // Record statistics for default window only
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE &&
function_id != MessageHelper::StringifiedFunctionID(
mobile_apis::FunctionID::UnregisterAppInterfaceID)) {
if (result.hmi_level_permitted != policy::kRpcAllowed) {
@@ -3074,7 +3086,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
#ifdef ENABLE_LOG
const std::string log_msg =
"Application: " + app->policy_app_id() + ", RPC: " + function_id +
- ", HMI status: " + MessageHelper::StringifiedHMILevel(app->hmi_level());
+ ", window_id: " + std::to_string(window_id) + ", HMI status: " +
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
#endif // ENABLE_LOG
if (result.hmi_level_permitted != policy::kRpcAllowed) {
LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg);
@@ -3147,7 +3160,10 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming(
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED);
+ return Compare<eType, EQ, ONE>(
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW),
+ HMI_FULL,
+ HMI_LIMITED);
}
bool ApplicationManagerImpl::CanAppStream(
@@ -3316,9 +3332,11 @@ void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) {
const std::string function_id = MessageHelper::StringifiedFunctionID(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asUInt()));
+ const WindowID window_id = MessageHelper::ExtractWindowIdFromSmartObject(
+ (*message)[strings::msg_params]);
const RPCParams params;
const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions(app, function_id, params);
+ CheckPolicyPermissions(app, window_id, function_id, params);
if (mobile_api::Result::SUCCESS == check_result) {
rpc_service_->ManageMobileCommand(message, commands::Command::SOURCE_SDL);
} else {
@@ -3373,39 +3391,6 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
}
}
-void ApplicationManagerImpl::SendHMIStatusNotification(
- const std::shared_ptr<Application> app) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(app);
- smart_objects::SmartObjectSPtr notification =
- std::make_shared<smart_objects::SmartObject>();
- smart_objects::SmartObject& message = *notification;
-
- message[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID);
-
- message[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
-
- message[strings::params][strings::connection_key] =
- static_cast<int32_t>(app->app_id());
-
- message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(app->hmi_level());
-
- message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(app->audio_streaming_state());
-
- message[strings::msg_params][strings::video_streaming_state] =
- static_cast<int32_t>(app->video_streaming_state());
-
- message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(app->system_context());
-
- rpc_service_->ManageMobileCommand(notification,
- commands::Command::SOURCE_SDL);
-}
-
void ApplicationManagerImpl::ClearTimerPool() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -3836,13 +3821,18 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
if (flag_diffirence_app_hmi_type) {
(*it)->set_app_types(transform_app_hmi_types);
(*it)->ChangeSupportingAppHMIType();
- if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
+ 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 (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
- ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
+ } else if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) ||
+ (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
state_controller().SetRegularState(
- *it, mobile_apis::HMILevel::HMI_BACKGROUND, true);
+ *it,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_BACKGROUND,
+ true);
}
}
}
@@ -3964,7 +3954,10 @@ void ApplicationManagerImpl::SendDriverDistractionState(
const std::string function_id = MessageHelper::StringifiedFunctionID(
mobile_api::FunctionID::OnDriverDistractionID);
const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions(application, function_id, params);
+ CheckPolicyPermissions(application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ function_id,
+ params);
if (mobile_api::Result::SUCCESS == check_result) {
rpc_service_->ManageMobileCommand(create_notification(),
commands::Command::SOURCE_SDL);
@@ -4342,9 +4335,10 @@ void ApplicationManagerImpl::ChangeAppsHMILevel(
LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id);
return;
}
- const mobile_apis::HMILevel::eType old_level = app->hmi_level();
+ const mobile_apis::HMILevel::eType old_level =
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW);
if (old_level != level) {
- app->set_hmi_level(level);
+ app->set_hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, level);
OnHMILevelChanged(app_id, old_level, level);
} else {
LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level);
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
index 2b02e9b658..6ed784424a 100644
--- a/src/components/application_manager/src/application_state.cc
+++ b/src/components/application_manager/src/application_state.cc
@@ -31,7 +31,10 @@
*/
#include "application_manager/application_state.h"
+
#include <algorithm>
+#include <string>
+
#include "utils/logger.h"
#include "utils/macro.h"
@@ -53,193 +56,293 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
ApplicationState::ApplicationState() {}
-void ApplicationState::InitState(HmiStatePtr state) {
+void ApplicationState::InitState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- hmi_states_.clear();
- hmi_states_.push_back(state);
+ LOG4CXX_DEBUG(logger_,
+ "Initing state " << state << " for window " << window_id
+ << " with name " << window_name);
+ {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& states = hmi_states_map_[window_id];
+ states.push_back(state);
+ }
}
-void ApplicationState::AddState(HmiStatePtr state) {
+void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
switch (state->state_id()) {
case HmiState::StateID::STATE_ID_REGULAR:
- SetRegularState(state);
+ SetRegularState(window_id, state);
return;
case HmiState::StateID::STATE_ID_POSTPONED:
- SetPostponedState(state);
+ SetPostponedState(window_id, state);
return;
case HmiState::StateID::STATE_ID_CURRENT:
- LOG4CXX_ERROR(logger_, "State of type '" << state << "' can't be added.");
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state << "' can't be added for window "
+ << window_id);
return;
default:
- AddHMIState(state);
+ AddHMIState(window_id, state);
break;
}
return;
}
-void ApplicationState::RemoveState(HmiState::StateID state) {
+void ApplicationState::RemoveState(const WindowID window_id,
+ HmiState::StateID state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
switch (state) {
case HmiState::StateID::STATE_ID_CURRENT:
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_ERROR(logger_,
- "State of type '" << state << "'can't be removed.");
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state
+ << "' can't be removed for window "
+ << window_id);
+ return;
+ }
+
+ RemoveWindowHMIStates(window_id);
break;
case HmiState::StateID::STATE_ID_POSTPONED:
- RemovePostponedState();
+ RemovePostponedState(window_id);
break;
default:
- RemoveHMIState(state);
+ RemoveHMIState(window_id, state);
break;
}
}
-HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const {
+HmiStatePtr ApplicationState::GetState(const WindowID window_id,
+ HmiState::StateID state_id) const {
switch (state_id) {
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_DEBUG(logger_, "Getting regular state.");
- return RegularHmiState();
+ LOG4CXX_DEBUG(logger_, "Getting regular state for window " << window_id);
+ return RegularHmiState(window_id);
case HmiState::StateID::STATE_ID_POSTPONED:
- LOG4CXX_DEBUG(logger_, "Getting postponed state.");
- return PostponedHmiState();
+ LOG4CXX_DEBUG(logger_,
+ "Getting postponed state for window " << window_id);
+ return PostponedHmiState(window_id);
default:
- LOG4CXX_DEBUG(logger_, "Getting current state.");
- return CurrentHmiState();
+ LOG4CXX_DEBUG(logger_, "Getting current state for window " << window_id);
+ return CurrentHmiState(window_id);
+ }
+}
+
+HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const {
+ LOG4CXX_DEBUG(logger_, "Collecting all states of type " << state_id);
+
+ HmiStates hmi_states;
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ for (const auto& hmi_state_pair : hmi_states_map_) {
+ hmi_states.push_back(GetState(hmi_state_pair.first, state_id));
}
+
+ return hmi_states;
}
-void ApplicationState::AddHMIState(HmiStatePtr state) {
+WindowIds ApplicationState::GetWindowIds() const {
+ LOG4CXX_DEBUG(logger_, "Collecting available window ID's");
+
+ WindowIds window_ids;
+ std::string stringified_window_ids;
+
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ for (const auto& hmi_state_pair : hmi_states_map_) {
+ window_ids.push_back(hmi_state_pair.first);
+ stringified_window_ids += (stringified_window_ids.empty() ? "" : ", ") +
+ std::to_string(hmi_state_pair.first);
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Existing window IDs: [" + stringified_window_ids + "]");
+ return window_ids;
+}
+
+void ApplicationState::AddHMIState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- HmiStates::iterator it = std::find_if(hmi_states_.begin(),
- hmi_states_.end(),
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ HmiStates::iterator it = std::find_if(hmi_states.begin(),
+ hmi_states.end(),
StateIDComparator(state->state_id()));
- if (hmi_states_.end() != it) {
- LOG4CXX_WARN(
- logger_,
- "Hmi state with ID "
- << state->state_id()
- << "has been already applied to this application. Ignoring");
+ if (hmi_states.end() != it) {
+ LOG4CXX_WARN(logger_,
+ "Hmi state with ID " << state->state_id()
+ << "has been already applied for window "
+ << window_id
+ << " of this application. Ignoring");
return;
}
- hmi_states_.push_back(state);
+ hmi_states.push_back(state);
}
-void ApplicationState::RemoveHMIState(HmiState::StateID state_id) {
+void ApplicationState::RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
HmiStates::iterator it = std::find_if(
- hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state_id));
- if (it == hmi_states_.end()) {
- LOG4CXX_ERROR(logger_, "Unsuccesful remove HmiState: " << state_id);
+ hmi_states.begin(), hmi_states.end(), StateIDComparator(state_id));
+ if (hmi_states.end() == it) {
+ LOG4CXX_ERROR(logger_,
+ "Unsuccesful remove HmiState: " << state_id << " for window "
+ << window_id);
return;
}
// unable to remove regular state
- DCHECK_OR_RETURN_VOID(it != hmi_states_.begin());
+ DCHECK_OR_RETURN_VOID(hmi_states.begin() != it);
HmiStates::iterator next = it;
HmiStates::iterator prev = it;
next++;
prev--;
- if (next != hmi_states_.end()) {
+
+ if (next != hmi_states.end()) {
HmiStatePtr next_state = *next;
HmiStatePtr prev_state = *prev;
next_state->set_parent(prev_state);
}
- hmi_states_.erase(it);
+
+ hmi_states.erase(it);
}
-void ApplicationState::RemovePostponedState() {
+void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ DCHECK_OR_RETURN_VOID(mobile_apis::PredefinedWindows::DEFAULT_WINDOW !=
+ window_id);
+
+ LOG4CXX_DEBUG(logger_,
+ "Removing HMI states for window with id #" << window_id);
+ {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ hmi_states_map_.erase(window_id);
+ }
+}
+
+void ApplicationState::RemovePostponedState(const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
StateIDComparator finder(HmiState::StateID::STATE_ID_POSTPONED);
HmiStates::iterator postponed_state =
- std::find_if(hmi_states_.begin(), hmi_states_.end(), finder);
+ std::find_if(hmi_states.begin(), hmi_states.end(), finder);
- if (hmi_states_.end() == postponed_state) {
- LOG4CXX_ERROR(logger_, "No postponed state is set for app.");
+ if (hmi_states.end() == postponed_state) {
+ LOG4CXX_ERROR(logger_,
+ "No postponed state is set for window " << window_id);
return;
}
- hmi_states_.erase(postponed_state);
+
+ hmi_states.erase(postponed_state);
}
-void ApplicationState::SetRegularState(HmiStatePtr state) {
+void ApplicationState::SetRegularState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_REGULAR);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
- HmiStatePtr front_state = hmi_states_.front();
+ HmiStatePtr front_state = hmi_states.front();
HmiState::StateID front_state_id = front_state->state_id();
if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
// Drop postponed state
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
}
// Drop regular state
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
- if (!hmi_states_.empty()) {
- HmiStatePtr front_state = hmi_states_.front();
+ if (!hmi_states.empty()) {
+ HmiStatePtr front_state = hmi_states.front();
front_state->set_parent(state);
}
- hmi_states_.insert(hmi_states_.begin(), state);
+
+ // Insert new regular state
+ hmi_states.insert(hmi_states.begin(), state);
if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
- hmi_states_.insert(hmi_states_.begin(), front_state);
+ // Restore postponed state if it was before
+ hmi_states.insert(hmi_states.begin(), front_state);
}
}
-void ApplicationState::SetPostponedState(HmiStatePtr state) {
+void ApplicationState::SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_POSTPONED);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
- HmiStatePtr front_state = hmi_states_.front();
+
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
+ HmiStatePtr front_state = hmi_states.front();
if (front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
}
- hmi_states_.insert(hmi_states_.begin(), state);
+
+ hmi_states.insert(hmi_states.begin(), state);
}
-HmiStatePtr ApplicationState::CurrentHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStatePtr back_state = hmi_states_.back();
+HmiStatePtr ApplicationState::CurrentHmiState(const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStatePtr back_state = hmi_states.back();
DCHECK_OR_RETURN(
back_state->state_id() != HmiState::StateID::STATE_ID_POSTPONED,
HmiStatePtr());
+
return back_state;
}
-HmiStatePtr ApplicationState::RegularHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStates::const_iterator front_itr = hmi_states_.begin();
+HmiStatePtr ApplicationState::RegularHmiState(const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStates::const_iterator front_itr = hmi_states.begin();
if ((*front_itr)->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
++front_itr;
}
+
return *front_itr;
}
-HmiStatePtr ApplicationState::PostponedHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStatePtr front_state = hmi_states_.front();
+HmiStatePtr ApplicationState::PostponedHmiState(
+ const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStatePtr front_state = hmi_states.front();
return front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED
? front_state
: HmiStatePtr();
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 521a44890f..8875895cb7 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2014, Ford Motor Company
All rights reserved.
@@ -96,6 +96,15 @@ int32_t CommandImpl::function_id() const {
return (*message_)[strings::params][strings::function_id].asInt();
}
+WindowID CommandImpl::window_id() const {
+ if ((*message_).keyExists(strings::msg_params)) {
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ return (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+ }
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
uint32_t CommandImpl::connection_key() const {
return (*message_)[strings::params][strings::connection_key].asUInt();
}
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index f67fde22a0..06e0220158 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -725,12 +725,17 @@ bool CommandRequestImpl::CheckAllowedParameters() {
}
mobile_apis::Result::eType check_result =
- application_manager_.CheckPolicyPermissions(
- app,
- MessageHelper::StringifiedFunctionID(
- static_cast<mobile_api::FunctionID::eType>(function_id())),
- params,
- &parameters_permissions_);
+ mobile_apis::Result::eType::INVALID_ID;
+ const auto current_window_id = window_id();
+ if (app->WindowIdExists(current_window_id)) {
+ check_result = application_manager_.CheckPolicyPermissions(
+ app,
+ current_window_id,
+ MessageHelper::StringifiedFunctionID(
+ static_cast<mobile_api::FunctionID::eType>(function_id())),
+ params,
+ &parameters_permissions_);
+ }
// Check, if RPC is allowed by policy
if (mobile_apis::Result::SUCCESS != check_result) {
diff --git a/src/components/application_manager/src/display_capabilities_builder.cc b/src/components/application_manager/src/display_capabilities_builder.cc
new file mode 100644
index 0000000000..8234128280
--- /dev/null
+++ b/src/components/application_manager/src/display_capabilities_builder.cc
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2019, 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 "application_manager/display_capabilities_builder.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+namespace application_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "DisplayCapabilitiesBuilder")
+
+const WindowID kDefaultWindowID = 0;
+
+DisplayCapabilitiesBuilder::DisplayCapabilitiesBuilder(Application& application)
+ : owner_(application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+void DisplayCapabilitiesBuilder::InitBuilder(
+ DisplayCapabilitiesBuilder::ResumeCallback resume_callback,
+ const smart_objects::SmartObject& windows_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ resume_callback_ = resume_callback;
+ window_ids_to_resume_.insert(kDefaultWindowID);
+ for (size_t i = 0; i < windows_info.length(); ++i) {
+ auto window_id = windows_info[i][strings::window_id].asInt();
+ LOG4CXX_DEBUG(logger_,
+ "Inserting " << window_id << " to waiting container");
+ window_ids_to_resume_.insert(window_id);
+ }
+}
+
+void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities(
+ const smart_objects::SmartObject& incoming_display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace smart_objects;
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+
+ if (!display_capabilities_) {
+ display_capabilities_ = std::make_shared<SmartObject>(SmartType_Array);
+ }
+
+ // As per v6.0, only single display is supported
+ auto cur_window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities];
+
+ const auto& inc_window_caps =
+ incoming_display_capabilities[0][strings::window_capabilities];
+
+ for (size_t i = 0; i < inc_window_caps.length(); ++i) {
+ const WindowID window_id =
+ inc_window_caps[i].keyExists(strings::window_id)
+ ? inc_window_caps[i][strings::window_id].asInt()
+ : kDefaultWindowID;
+ if (window_ids_to_resume_.end() != window_ids_to_resume_.find(window_id)) {
+ cur_window_caps[cur_window_caps.length()] = inc_window_caps[i];
+ LOG4CXX_DEBUG(logger_, "Stop waiting for: " << window_id);
+ window_ids_to_resume_.erase(window_id);
+ }
+ }
+
+ *display_capabilities_ = incoming_display_capabilities;
+ (*display_capabilities_)[0][strings::window_capabilities] = cur_window_caps;
+
+ if (window_ids_to_resume_.empty()) {
+ LOG4CXX_TRACE(logger_, "Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+ }
+} // namespace application_manager
+
+const smart_objects::SmartObjectSPtr
+DisplayCapabilitiesBuilder::display_capabilities() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return display_capabilities_;
+}
+
+void DisplayCapabilitiesBuilder::ResetDisplayCapabilities() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ display_capabilities_.reset();
+}
+
+void DisplayCapabilitiesBuilder::StopWaitingForWindow(
+ const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ LOG4CXX_DEBUG(logger_,
+ "Window id " << window_id << " will be erased due to failure");
+ window_ids_to_resume_.erase(window_id);
+ if (window_ids_to_resume_.empty()) {
+ LOG4CXX_TRACE(logger_,
+ window_id << " was the last window pending resumption. "
+ "Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+ }
+}
+} // namespace application_manager
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index 7c0e9b71fd..6b209ade0c 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -616,6 +616,12 @@ void HMICapabilitiesImpl::set_display_capabilities(
}
}
+void HMICapabilitiesImpl::set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ system_display_capabilities_.reset(
+ new smart_objects::SmartObject(display_capabilities));
+}
+
void HMICapabilitiesImpl::set_hmi_zone_capabilities(
const smart_objects::SmartObject& hmi_zone_capabilities) {
if (hmi_zone_capabilities_) {
@@ -806,6 +812,11 @@ const smart_objects::SmartObject* HMICapabilitiesImpl::display_capabilities()
return display_capabilities_;
}
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::system_display_capabilities() const {
+ return system_display_capabilities_;
+}
+
const smart_objects::SmartObject* HMICapabilitiesImpl::hmi_zone_capabilities()
const {
return hmi_zone_capabilities_;
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index 1400ead8cf..f1f8660217 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -138,6 +138,8 @@ generate_function_to_interface_convert_map() {
convert_map[UI_AddSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_DeleteSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_ShowAppMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_CreateWindow] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_DeleteWindow] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_PerformInteraction] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetMediaClockTimer] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_UI;
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 77880eddc0..844d0254cf 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -48,6 +48,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
: hmi_app_id_(app->hmi_app_id())
, state_id_(state_id)
, app_mngr_(app_mngr)
+ , window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
@@ -60,6 +61,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
: hmi_app_id_(app->hmi_app_id())
, state_id_(STATE_ID_REGULAR)
, app_mngr_(app_mngr)
+ , window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
@@ -96,6 +98,15 @@ bool HmiState::is_mobile_projection_app() const {
return app ? app->mobile_projection_enabled() : false;
}
+mobile_apis::WindowType::eType HmiState::window_type() const {
+ return window_type_;
+}
+
+void HmiState::set_window_type(
+ const mobile_apis::WindowType::eType window_type) {
+ window_type_ = window_type;
+}
+
mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
const {
using namespace mobile_apis;
@@ -173,17 +184,25 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
return parent()->hmi_level();
}
+
if (is_navi_app() || is_mobile_projection_app()) {
return HMILevel::HMI_LIMITED;
}
+
if (!is_media_app()) {
return parent()->hmi_level();
}
+
return HMILevel::HMI_BACKGROUND;
}
@@ -198,6 +217,11 @@ DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
@@ -215,14 +239,19 @@ AudioSource::AudioSource(std::shared_ptr<Application> app,
}
mobile_apis::HMILevel::eType AudioSource::hmi_level() const {
+ using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
// Checking for NONE is necessary to avoid issue during
// calculation of HMI level during setting default HMI level
- if (keep_context_ ||
- mobile_apis::HMILevel::HMI_NONE == parent()->hmi_level()) {
+ if (keep_context_ || HMILevel::HMI_NONE == parent()->hmi_level()) {
return parent()->hmi_level();
}
- return mobile_apis::HMILevel::HMI_BACKGROUND;
+ return HMILevel::HMI_BACKGROUND;
}
EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app,
@@ -232,11 +261,17 @@ EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const {
using namespace mobile_apis;
using namespace helpers;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
return parent()->hmi_level();
}
+
return HMILevel::HMI_BACKGROUND;
}
@@ -278,7 +313,8 @@ std::ostream& operator<<(std::ostream& os, const HmiState& src) {
} else {
os << "(none)";
}
- os << ", hmi app id:" << src.hmi_app_id_ << ", state:" << src.state_id()
+ os << ", hmi app id:" << src.hmi_app_id_
+ << ", window_type:" << src.window_type_ << ", state:" << src.state_id()
<< ", hmi_level:" << src.hmi_level()
<< ", audio:" << src.audio_streaming_state()
<< ", video:" << src.video_streaming_state()
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 bae4802e56..3639953a3a 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -357,6 +357,33 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
return message;
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& display_capabilities, Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto message = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
+ (*message)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+ (*message)[strings::params][strings::connection_key] = app.app_id();
+ (*message)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::mobile_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+
+ smart_objects::SmartObject system_capability(smart_objects::SmartType_Map);
+ system_capability[strings::system_capability_type] =
+ static_cast<int32_t>(mobile_apis::SystemCapabilityType::DISPLAYS);
+ system_capability[strings::display_capabilities] = display_capabilities;
+ (*message)[strings::msg_params][strings::system_capability] =
+ system_capability;
+
+ return message;
+}
+
void MessageHelper::BroadcastCapabilityUpdate(
smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -378,7 +405,8 @@ void MessageHelper::BroadcastCapabilityUpdate(
hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
smart_objects::SmartObjectSPtr hmi_notification =
std::make_shared<smart_objects::SmartObject>(message);
- app_mngr.GetRPCService().ManageHMICommand(hmi_notification);
+ app_mngr.GetRPCService().ManageHMICommand(
+ hmi_notification, commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
}
smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
@@ -771,7 +799,8 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr notification =
@@ -789,16 +818,21 @@ void MessageHelper::SendHMIStatusNotification(
static_cast<int32_t>(application_manager::MessageType::kNotification);
message[strings::params][strings::connection_key] =
- static_cast<int32_t>(application_impl.app_id());
+ static_cast<int32_t>(application->app_id());
+
+ message[strings::msg_params][strings::window_id] = window_id;
message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(application_impl.hmi_level());
+ static_cast<int32_t>(application->hmi_level(window_id));
message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(application_impl.audio_streaming_state());
+ static_cast<int32_t>(application->audio_streaming_state());
+
+ message[strings::msg_params][strings::video_streaming_state] =
+ static_cast<int32_t>(application->video_streaming_state());
message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(application_impl.system_context());
+ static_cast<int32_t>(application->system_context(window_id));
application_manager.GetRPCService().ManageMobileCommand(
notification, commands::Command::SOURCE_SDL);
@@ -1557,6 +1591,67 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
return vr_command;
}
+smart_objects::SmartObjectSPtr MessageHelper::CreateUICreateWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& window_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto ui_request = CreateMessageForHMI(hmi_apis::messageType::request,
+ app_mngr.GetNextHMICorrelationID());
+
+ (*ui_request)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_CreateWindow);
+
+ (*ui_request)[strings::correlation_id] =
+ (*ui_request)[strings::params][strings::correlation_id];
+ (*ui_request)[strings::function_id] =
+ (*ui_request)[strings::params][strings::function_id];
+
+ smart_objects::SmartObject msg_params(
+ smart_objects::SmartObject(smart_objects::SmartType_Map));
+
+ msg_params[strings::window_id] = window_info[strings::window_id].asInt();
+ msg_params[strings::window_type] = window_info[strings::window_type].asInt();
+ msg_params[strings::window_name] =
+ window_info[strings::window_name].asString();
+
+ if (window_info.keyExists(strings::associated_service_type)) {
+ msg_params[strings::associated_service_type] =
+ window_info[strings::associated_service_type].asString();
+ }
+ if (window_info.keyExists(strings::duplicate_updates_from_window_id)) {
+ msg_params[strings::duplicate_updates_from_window_id] =
+ window_info[strings::duplicate_updates_from_window_id].asInt();
+ }
+
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ (*ui_request)[strings::msg_params] = msg_params;
+
+ return ui_request;
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info) {
+ smart_objects::SmartObjectList requests;
+ DCHECK_OR_RETURN(application, requests);
+
+ for (size_t i = 0; i < windows_info.length(); ++i) {
+ const auto& info = windows_info[i];
+
+ const auto ui_request =
+ CreateUICreateWindowRequestToHMI(application, app_mngr, info);
+
+ DCHECK_OR_RETURN(ui_request, requests);
+
+ requests.push_back(ui_request);
+ }
+
+ return requests;
+}
+
bool MessageHelper::CreateDeviceInfo(
connection_handler::DeviceHandle device_handle,
const protocol_handler::SessionObserver& session_observer,
@@ -1609,8 +1704,8 @@ bool MessageHelper::CreateHMIApplicationStruct(
const smart_objects::SmartObject* app_types = app->app_types();
const smart_objects::SmartObject* ngn_media_screen_name =
app->ngn_media_screen_name();
- const smart_objects::SmartObject* day_color_scheme = app->day_color_scheme();
- const smart_objects::SmartObject* night_color_scheme =
+ const smart_objects::SmartObject day_color_scheme = app->day_color_scheme();
+ const smart_objects::SmartObject night_color_scheme =
app->night_color_scheme();
message = smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -1686,12 +1781,12 @@ bool MessageHelper::CreateHMIApplicationStruct(
SmartObject(smart_objects::SmartType_Array);
}
- if (day_color_scheme) {
- message[strings::day_color_scheme] = *day_color_scheme;
+ if (day_color_scheme.getType() == smart_objects::SmartType_Map) {
+ message[strings::day_color_scheme] = day_color_scheme;
}
- if (night_color_scheme) {
- message[strings::night_color_scheme] = *night_color_scheme;
+ if (night_color_scheme.getType() == smart_objects::SmartType_Map) {
+ message[strings::night_color_scheme] = night_color_scheme;
}
message[strings::device_info] =
@@ -3011,17 +3106,32 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
- int32_t function_id) {
+ int32_t function_id,
+ const WindowID window_id) {
SoftButtonID softbuttons_id;
smart_objects::SmartObject& soft_buttons =
message_params[strings::soft_buttons];
unsigned int length = soft_buttons.length();
for (unsigned int i = 0; i < length; ++i) {
- softbuttons_id.insert(soft_buttons[i][strings::soft_button_id].asUInt());
+ const auto button_id = std::make_pair(
+ soft_buttons[i][strings::soft_button_id].asUInt(), window_id);
+ softbuttons_id.insert(button_id);
}
app->SubscribeToSoftButtons(function_id, softbuttons_id);
}
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SubscribeApplicationToSoftButton(
+ message_params,
+ app,
+ function_id,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+}
+
bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
#ifdef DEBUG
Json::Value tmp;
@@ -3032,4 +3142,14 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
return true;
}
+WindowID MessageHelper::ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map) {
+ if (smart_objects::SmartType_Map == s_map.getType()) {
+ if (s_map.keyExists(strings::window_id)) {
+ return s_map[strings::window_id].asInt();
+ }
+ }
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
} // namespace application_manager
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index fdbd0ce391..ab07151b69 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -126,7 +126,10 @@ struct HMILevelPredicate
: level_(level) {}
bool operator()(const ApplicationSharedPtr app) const {
- return level_ == app->hmi_level() ? true : false;
+ return level_ == app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)
+ ? true
+ : false;
}
private:
@@ -165,6 +168,7 @@ struct DeactivateApplication {
if (device_id_ == app->device()) {
state_ctrl_.SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -959,6 +963,7 @@ void PolicyHandler::OnPendingPermissionChange(
app_id, permissions, application_manager_);
application_manager_.state_controller().SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -967,7 +972,8 @@ void PolicyHandler::OnPendingPermissionChange(
return;
}
- mobile_apis::HMILevel::eType app_hmi_level = app->hmi_level();
+ mobile_apis::HMILevel::eType app_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
switch (app_hmi_level) {
case mobile_apis::HMILevel::eType::HMI_FULL:
@@ -1122,7 +1128,11 @@ struct SDLAlowedNotification {
} else {
return;
}
- state_controller_.SetRegularState(app, default_mobile_hmi, true);
+ state_controller_.SetRegularState(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ default_mobile_hmi,
+ true);
}
}
@@ -1231,7 +1241,12 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
: VideoStreamingState::NOT_STREAMABLE;
application_manager_.state_controller().SetRegularState(
- app, mobile_apis::HMILevel::HMI_FULL, audio_state, video_state, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_FULL,
+ audio_state,
+ video_state,
+ true);
last_activated_app_id_ = 0;
} else {
DeactivateApplication deactivate_notification(
@@ -1357,7 +1372,8 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
// The application currently not running (i.e. in NONE) should change HMI
// level to default
- mobile_apis::HMILevel::eType current_hmi_level = app->hmi_level();
+ mobile_apis::HMILevel::eType current_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
mobile_apis::HMILevel::eType hmi_level =
MessageHelper::StringToHMILevel(default_hmi);
@@ -1378,12 +1394,19 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
<< policy_app_id << " to default hmi level "
<< default_hmi);
- const bool is_full_hmi_level =
- mobile_apis::HMILevel::HMI_FULL == hmi_level;
-
- application_manager_.state_controller().SetRegularState(
- app, hmi_level, is_full_hmi_level);
-
+ if (hmi_level == mobile_apis::HMILevel::HMI_FULL) {
+ application_manager_.state_controller().SetRegularState(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ hmi_level,
+ true);
+ } else {
+ application_manager_.state_controller().SetRegularState(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ hmi_level,
+ false);
+ }
break;
}
default:
@@ -1495,12 +1518,13 @@ bool PolicyHandler::GetPriority(const std::string& policy_app_id,
void PolicyHandler::CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) {
POLICY_LIB_CHECK_VOID();
const std::string hmi_level =
- MessageHelper::StringifiedHMILevel(app->hmi_level());
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
if (hmi_level.empty()) {
LOG4CXX_WARN(logger_,
"HMI level for " << app->policy_app_id() << " is invalid, rpc "
@@ -1514,7 +1538,6 @@ void PolicyHandler::CheckPermissions(
"Checking permissions for " << app->policy_app_id() << " in "
<< hmi_level << " on device "
<< device_id << " rpc " << rpc);
-
policy_manager_->CheckPermissions(
device_id, app->policy_app_id(), hmi_level, rpc, rpc_params, result);
}
@@ -2243,6 +2266,8 @@ bool PolicyHandler::IsUrlAppIdValid(const uint32_t app_idx,
const EndpointUrls& urls) const {
const EndpointData& app_data = urls[app_idx];
const std::vector<std::string> app_urls = app_data.url;
+ const ApplicationSharedPtr app =
+ application_manager_.application_by_policy_id(app_data.app_id);
if (policy::kDefaultId == app_data.app_id) {
return true;
@@ -2276,7 +2301,8 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
mobile_apis::HMILevel::eType level) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE) {
// If default is FULL, send request to HMI. Notification to mobile will be
// sent on response receiving.
if (mobile_apis::HMILevel::HMI_FULL == level) {
@@ -2288,7 +2314,10 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
// If hmi Level is full, it will be seted after ActivateApp response
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
}
}
@@ -2331,7 +2360,10 @@ void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id,
<< app->app_id() << " to default hmi level " << level);
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id,
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 fff1aefed3..957075150f 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -30,6 +30,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/resumption/resume_ctrl_impl.h"
+#include "application_manager/display_capabilities_builder.h"
#include <algorithm>
#include <fstream>
@@ -159,7 +160,13 @@ void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) {
}
void ResumeCtrlImpl::on_event(const event_engine::Event& event) {
- LOG4CXX_DEBUG(logger_, "Event received" << event.id());
+ LOG4CXX_DEBUG(logger_, "Event received: " << event.id());
+
+ if (hmi_apis::FunctionID::UI_CreateWindow == event.id()) {
+ LOG4CXX_INFO(logger_, "Received UI_CreateWindow event");
+ const auto& response_message = event.smart_object();
+ RestoreWidgetsHMIState(response_message);
+ }
}
bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
@@ -208,7 +215,12 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
<< saved_hmi_level);
}
- return SetAppHMIState(application, saved_hmi_level, true);
+ const bool app_hmi_state_is_set =
+ SetAppHMIState(application, saved_hmi_level, true);
+ if (app_hmi_state_is_set &&
+ application->is_app_data_resumption_allowed()) {
+ RestoreAppWidgets(application, saved_app);
+ }
} else {
result = false;
LOG4CXX_ERROR(logger_, "saved app data corrupted");
@@ -219,6 +231,89 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
return result;
}
+void ResumeCtrlImpl::RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto correlation_id =
+ response_message[strings::params][strings::correlation_id].asInt();
+ const auto& request = requests_msg_.find(correlation_id);
+ if (requests_msg_.end() == request) {
+ LOG4CXX_ERROR(logger_,
+ "Request UI_CreateWindow for correlation id: "
+ << correlation_id << " not found");
+ return;
+ }
+
+ const auto& msg_params = (*request->second)[strings::msg_params];
+ const auto hmi_app_id = msg_params[strings::app_id].asInt();
+ auto application = application_manager_.application_by_hmi_app(hmi_app_id);
+ if (!application) {
+ LOG4CXX_ERROR(logger_,
+ "Application is not registered by hmi id: " << hmi_app_id);
+ requests_msg_.erase(request);
+ return;
+ }
+ const WindowID window_id = msg_params[strings::window_id].asInt();
+
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt());
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_ERROR(logger_,
+ "UI_CreateWindow for correlation id: "
+ << correlation_id
+ << " failed with code: " << result_code);
+ requests_msg_.erase(request);
+ auto& builder = application->display_capabilities_builder();
+ builder.StopWaitingForWindow(window_id);
+ return;
+ }
+
+ smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
+ auto fill_optional_param = [&window_info,
+ &msg_params](const std::string& key) {
+ if (msg_params.keyExists(key)) {
+ window_info[key] = msg_params[key].asString();
+ }
+ };
+ fill_optional_param(strings::associated_service_type);
+ fill_optional_param(strings::duplicate_updates_from_window_id);
+
+ const auto window_name = msg_params[strings::window_name].asString();
+ window_info[strings::window_name] = window_name;
+ application->SetWindowInfo(window_id, window_info);
+
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ msg_params[strings::window_type].asInt());
+ // State should be initialized with INVALID_ENUM value to let state controller
+ // trigger OnHmiStatus notifiation sending
+ auto initial_state = application_manager_.CreateRegularState(
+ application,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_api::SystemContext::INVALID_ENUM);
+ application->SetInitialState(window_id, window_name, initial_state);
+
+ // Default HMI level for all windows except the main one is always NONE
+ application_manager_.state_controller().OnAppWindowAdded(
+ application, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
+
+ requests_msg_.erase(request);
+}
+
+void ResumeCtrlImpl::ProcessSystemCapabilityUpdated(
+ Application& app, const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto notification = MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ display_capabilities, app);
+
+ application_manager_.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::SOURCE_SDL);
+ app.set_is_resuming(false);
+}
+
bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN(application, false);
@@ -252,7 +347,9 @@ void ResumeCtrlImpl::ApplicationResumptiOnTimer() {
LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it);
continue;
}
- StartAppHmiStateResumption(app);
+ if (!StartAppHmiStateResumption(app)) {
+ app->set_is_resuming(false);
+ }
}
is_resumption_active_ = false;
waiting_for_timer_.clear();
@@ -292,14 +389,36 @@ bool ResumeCtrlImpl::SetAppHMIState(
return false;
}
application->set_is_resuming(true);
- application_manager_.state_controller().SetRegularState(application,
- hmi_level);
+ application_manager_.state_controller().SetRegularState(
+ application, mobile_apis::PredefinedWindows::DEFAULT_WINDOW, hmi_level);
LOG4CXX_INFO(logger_,
"Application with policy id " << application->policy_app_id()
<< " got HMI level " << hmi_level);
return true;
}
+void ResumeCtrlImpl::RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(application);
+ if (!saved_app.keyExists(strings::windows_info)) {
+ LOG4CXX_ERROR(logger_, "windows_info section does not exist");
+ return;
+ }
+ const auto& windows_info = saved_app[strings::windows_info];
+ auto request_list = MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application, application_manager_, windows_info);
+
+ requests_msg_.clear();
+ for (auto& request : request_list) {
+ requests_msg_.insert(std::make_pair(
+ (*request)[strings::params][strings::correlation_id].asInt(), request));
+ }
+ ProcessHMIRequests(request_list);
+}
+
bool ResumeCtrlImpl::IsHMIApplicationIdExist(uint32_t hmi_app_id) {
LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id);
@@ -473,18 +592,18 @@ void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) {
AddToResumptionTimerQueue(app_id);
}
-void ResumeCtrlImpl::StartAppHmiStateResumption(
+bool ResumeCtrlImpl::StartAppHmiStateResumption(
ApplicationSharedPtr application) {
using namespace date_time;
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(application);
+ DCHECK_OR_RETURN(application, false);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
const bool result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
if (!result) {
LOG4CXX_ERROR(logger_, "Application was not saved");
- return;
+ return false;
}
const bool is_hmi_level_applicable_to_resume =
@@ -492,7 +611,7 @@ void ResumeCtrlImpl::StartAppHmiStateResumption(
if (!is_hmi_level_applicable_to_resume) {
LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming");
- return;
+ return false;
}
const bool is_resume_allowed_by_low_voltage =
@@ -507,18 +626,20 @@ void ResumeCtrlImpl::StartAppHmiStateResumption(
if (restore_hmi_level_allowed) {
LOG4CXX_INFO(logger_,
"Resume application " << application->policy_app_id());
- RestoreAppHMIState(application);
+ bool result = RestoreAppHMIState(application);
if (mobile_apis::HMILevel::eType::INVALID_ENUM !=
application->deferred_resumption_hmi_level()) {
// the application has not been fully resumed
- return;
+ return false;
}
RemoveApplicationFromSaved(application);
+ return result;
} else {
LOG4CXX_INFO(
logger_,
"Do not need to resume application " << application->policy_app_id());
}
+ return true;
}
void ResumeCtrlImpl::ResetLaunchTime() {
@@ -561,9 +682,14 @@ bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application,
"app_id : " << application->app_id() << " hash : " << hash);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
- bool result = resumption_storage_->GetSavedApplication(
+ const bool get_app_result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
- return result ? saved_app[strings::hash_id].asString() == hash : false;
+ const bool check_result =
+ get_app_result ? saved_app[strings::hash_id].asString() == hash : false;
+ if (check_result) {
+ application->set_app_data_resumption_allowance(true);
+ }
+ return check_result;
}
void ResumeCtrlImpl::SaveDataOnTimer() {
@@ -628,6 +754,28 @@ bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) {
return result;
}
+void ResumeCtrlImpl::StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
+ resumption_storage_->GetSavedApplication(
+ application->policy_app_id(), application->mac_address(), saved_app);
+ auto resume_callback =
+ [this](Application& app,
+ const smart_objects::SmartObject& display_capabilities) -> void {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ProcessSystemCapabilityUpdated(app, display_capabilities);
+ };
+ auto& builder = application->display_capabilities_builder();
+
+ smart_objects::SmartObject windows_info(smart_objects::SmartType_Null);
+ if (saved_app.keyExists(strings::windows_info)) {
+ windows_info = saved_app[strings::windows_info];
+ }
+ builder.InitBuilder(resume_callback, windows_info);
+ application->set_is_resuming(true);
+}
+
void ResumeCtrlImpl::AddFiles(ApplicationSharedPtr application,
const smart_objects::SmartObject& saved_app) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1006,7 +1154,8 @@ bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request,
(*request)[strings::correlation_id].asInt();
subscribe_on_event(function_id, hmi_correlation_id);
}
- if (!application_manager_.GetRPCService().ManageHMICommand(request)) {
+ if (!application_manager_.GetRPCService().ManageHMICommand(
+ request, commands::Command::SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
return false;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index b4d39eccc1..9046fe35ad 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -198,6 +198,52 @@ smart_objects::SmartObject ResumptionData::GetApplicationFiles(
return files;
}
+smart_objects::SmartObject ResumptionData::GetApplicationWidgetsInfo(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject windows_info =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ DCHECK_OR_RETURN(application, windows_info);
+ const auto window_ids = application->GetWindowIds();
+ const auto& window_optional_params_map =
+ application->window_optional_params_map().GetData();
+ for (const auto& window_id : window_ids) {
+ const HmiStatePtr hmi_state = application->CurrentHmiState(window_id);
+ if (mobile_apis::WindowType::WIDGET != hmi_state->window_type()) {
+ continue;
+ }
+ auto info = CreateWindowInfoSO(
+ window_id, hmi_state->window_type(), window_optional_params_map);
+
+ windows_info[windows_info.length()] = info;
+ }
+ return windows_info;
+}
+
+smart_objects::SmartObject ResumptionData::CreateWindowInfoSO(
+ const app_mngr::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const app_mngr::WindowParamsMap& window_optional_params_map) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto window_info = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ window_info[strings::window_id] = window_id;
+ window_info[strings::window_type] = window_type;
+
+ const auto& it_info = window_optional_params_map.find(window_id);
+ if (window_optional_params_map.end() != it_info) {
+ const auto keys = it_info->second->enumerate();
+
+ for (const auto& key : keys) {
+ window_info[key] = (*it_info->second)[key];
+ }
+ }
+
+ return window_info;
+}
+
smart_objects::SmartObject ResumptionData::PointerToSmartObj(
const smart_objects::SmartObject* ptr) const {
LOG4CXX_AUTO_TRACE(logger_);
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 02b7098414..9188a47bf9 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -2731,7 +2731,8 @@ bool ResumptionDataDB::UpdateApplicationData(
utils::dbms::SQLQuery query(db());
const int64_t time_stamp = static_cast<int64_t>(time(NULL));
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+ const mobile_apis::HMILevel::eType hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (!query.Prepare(kUpdateApplicationData)) {
LOG4CXX_WARN(logger_,
@@ -2843,7 +2844,8 @@ ApplicationParams::ApplicationParams(app_mngr::ApplicationSharedPtr application)
m_grammar_id = application->get_grammar_id();
m_connection_key = application->app_id();
m_hmi_app_id = application->hmi_app_id();
- m_hmi_level = application->hmi_level();
+ m_hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
m_is_media_application = application->IsAudioApplication();
app_ptr = application;
}
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 591166c687..5da47d31ce 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -64,7 +64,8 @@ void ResumptionDataJson::SaveApplication(
const uint32_t grammar_id = application->get_grammar_id();
const uint32_t time_stamp = (uint32_t)time(NULL);
const std::string device_mac = application->mac_address();
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+ const mobile_apis::HMILevel::eType hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
const bool is_subscribed_for_way_points =
application_manager_.IsAppSubscribedForWayPoints(application);
@@ -99,6 +100,9 @@ void ResumptionDataJson::SaveApplication(
formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationFiles(application), tmp);
json_app[strings::application_files] = tmp;
+ formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationWidgetsInfo(application), tmp);
+ json_app[strings::windows_info] = tmp;
json_app[strings::time_stamp] = time_stamp;
json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 3fceaf573c..49877ce3ef 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -159,10 +159,6 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
smart_objects::SmartObjectSPtr smart_object =
std::make_shared<smart_objects::SmartObject>();
bool allow_unknown_parameters = false;
- if (!smart_object) {
- LOG4CXX_ERROR(logger_, "Null pointer");
- return;
- }
smart_objects::SmartObject converted_result;
formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
@@ -198,6 +194,7 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
}
+
void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc
index feb3bccc1f..8d63e9489f 100644
--- a/src/components/application_manager/src/rpc_passing_handler.cc
+++ b/src/components/application_manager/src/rpc_passing_handler.cc
@@ -108,9 +108,11 @@ bool RPCPassingHandler::ExtractRPCParams(
}
CommandParametersPermissions parameters_permissions;
+ const WindowID window_id =
+ MessageHelper::ExtractWindowIdFromSmartObject(s_map);
mobile_apis::Result::eType check_result = app_manager_.CheckPolicyPermissions(
- app, function_id_str, params, &parameters_permissions);
+ app, window_id, function_id_str, params, &parameters_permissions);
// Check if RPC is allowed by policy (since we are allowing unknown params,
// check should pass if only undefined parameters exist)
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index fef5ef0163..c7d1bde288 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -177,7 +177,8 @@ bool RPCServiceImpl::ManageMobileCommand(
mobile_apis::HMILevel::eType app_hmi_level =
mobile_apis::HMILevel::INVALID_ENUM;
if (app) {
- app_hmi_level = app->hmi_level();
+ app_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
}
// commands will be launched from request_ctrl
@@ -466,9 +467,12 @@ void RPCServiceImpl::SendMessageToMobile(
mobile_apis::FunctionID::eType function_id =
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asUInt());
+
RPCParams params;
const smart_objects::SmartObject& s_map = (*message)[strings::msg_params];
+ const WindowID window_id =
+ MessageHelper::ExtractWindowIdFromSmartObject(s_map);
if (smart_objects::SmartType_Map == s_map.getType()) {
smart_objects::SmartMap::iterator iter = s_map.map_begin();
smart_objects::SmartMap::iterator iter_end = s_map.map_end();
@@ -483,7 +487,8 @@ void RPCServiceImpl::SendMessageToMobile(
const std::string string_functionID =
MessageHelper::StringifiedFunctionID(function_id);
const mobile_apis::Result::eType check_result =
- app_manager_.CheckPolicyPermissions(app, string_functionID, params);
+ app_manager_.CheckPolicyPermissions(
+ app, window_id, string_functionID, params);
if (mobile_apis::Result::SUCCESS != check_result) {
LOG4CXX_WARN(logger_,
"Function \"" << string_functionID << "\" (#" << function_id
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 809d465d20..e9adf796af 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -20,6 +20,7 @@ const char* info = "info";
const char* app_id = "appID";
const char* full_app_id = "fullAppID";
const char* bundle_id = "appBundleID";
+const char* window_id = "windowID";
const char* app_info = "appInfo";
const char* app_launch = "app_launch";
const char* app_launch_list = "app_launch_list";
@@ -139,6 +140,13 @@ const char* activate_app_hmi_level = "level";
const char* audio_streaming_state = "audioStreamingState";
const char* video_streaming_state = "videoStreamingState";
const char* system_context = "systemContext";
+const char* window_name = "windowName";
+const char* window_type = "type";
+const char* window_type_supported = "windowTypeSupported";
+const char* maximum_number_of_windows = "maximumNumberOfWindows";
+const char* window_capabilities = "windowCapabilities";
+const char* associated_service_type = "associatedServiceType";
+const char* duplicate_updates_from_window_id = "duplicateUpdatesFromWindowID";
const char* speech_capabilities = "speechCapabilities";
const char* vr_capabilities = "vrCapabilities";
const char* audio_pass_thru_capabilities = "audioPassThruCapabilities";
@@ -163,6 +171,8 @@ const char* red = "red";
const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
+const char* template_configuration = "templateConfiguration";
+const char* template_layout = "template";
const char* icon_resumed = "iconResumed";
const char* nicknames = "nicknames";
const char* enabled = "enabled";
@@ -172,6 +182,7 @@ const char* hybrid_app_preference = "hybridAppPreference";
const char* is_cloud_application = "isCloudApplication";
const char* cloud_connection_status = "cloudConnectionStatus";
const char* endpoint = "endpoint";
+const char* display_capabilities = "displayCapabilities";
// PutFile
const char* sync_file_name = "syncFileName";
@@ -380,6 +391,8 @@ const char* delivery_mode = "deliveryMode";
const char* audio_streaming_indicator = "audioStreamingIndicator";
+const char* windows_info = "windowsInfo";
+
const char* const keyboard_properties_supported = "keyboardPropertiesSupported";
const char* const language_supported = "languageSupported";
const char* const keyboard_layout_supported = "keyboardLayoutSupported";
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index 994c7b8b7f..8368597370 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -67,6 +67,7 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr)
}
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state,
const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -74,7 +75,8 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(HmiState::STATE_ID_REGULAR == state->state_id());
- LOG4CXX_DEBUG(logger_, "Set regular state " << *state);
+ LOG4CXX_DEBUG(logger_,
+ "Set window #" << window_id << " regular state " << *state);
if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM ||
state->audio_streaming_state() ==
@@ -93,9 +95,10 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
HmiStatePtr resolved_state = ResolveHmiState(app, state);
if (!resolved_state) {
state->set_state_id(HmiState::STATE_ID_POSTPONED);
- app->SetPostponedState(state);
+ app->SetPostponedState(window_id, state);
return;
}
+
LOG4CXX_DEBUG(logger_, "Resolved state: " << *resolved_state);
const hmi_apis::Common_HMILevel::eType hmi_level =
static_cast<hmi_apis::Common_HMILevel::eType>(
@@ -117,18 +120,19 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
return;
}
- ApplyRegularState(app, resolved_state);
+ ApplyRegularState(app, window_id, resolved_state);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_regular = app->RegularHmiState();
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -137,16 +141,22 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_regular->system_context());
- SetRegularState(app, hmi_state, request_hmi_state_change);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const bool request_hmi_state_change) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
+ DCHECK_OR_RETURN_VOID(prev_regular);
+
const HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -155,11 +165,13 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level));
hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level));
hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state, request_hmi_state_change);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
@@ -167,21 +179,29 @@ void StateControllerImpl::SetRegularState(
const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
+ DCHECK_OR_RETURN_VOID(prev_regular);
+
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(hmi_state);
+
hmi_state->set_hmi_level(hmi_level);
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, request_hmi_state_change);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
- ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) {
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(hmi_state);
@@ -191,15 +211,16 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_system_context(prev_state
? prev_state->system_context()
: mobile_apis::SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state);
+ SetRegularState(app, window_id, hmi_state);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::SystemContext::eType system_context) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_regular = app->RegularHmiState();
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -210,16 +231,18 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_video_streaming_state(
CalcVideoState(app, prev_regular->hmi_level()));
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, false);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, false);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -228,18 +251,23 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_state->system_context());
- SetRegularState(app, hmi_state, false);
+ hmi_state->set_window_type(prev_state->window_type());
+ SetRegularState(app, window_id, hmi_state, false);
}
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
- if (mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
- SetRegularState(app, state, true);
+
+ // SDL should send BC.ActivateApp for main window during resumption
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
+ SetRegularState(app, window_id, state, true);
} else {
- SetRegularState(app, state, false);
+ SetRegularState(app, window_id, state, false);
}
}
@@ -300,7 +328,8 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
return;
}
- const HmiStatePtr state_to_resolve = app_to_resolve->RegularHmiState();
+ const HmiStatePtr state_to_resolve =
+ app_to_resolve->RegularHmiState(window_id_);
DCHECK_OR_RETURN_VOID(state_to_resolve);
// If applied HMI state is FULL:
@@ -384,22 +413,23 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
std::make_tuple(
result_hmi_level, result_audio_state, result_video_state)) {
LOG4CXX_DEBUG(logger_,
- "Application "
- << app_to_resolve->app_id() << " will change state to: "
- << "HMI level " << to_resolve_hmi_level << " --> "
- << result_hmi_level << ", audio "
- << state_to_resolve->audio_streaming_state() << " --> "
- << result_audio_state << ", video "
- << state_to_resolve->video_streaming_state() << " --> "
- << result_video_state);
+ "Application " << app_to_resolve->app_id() << " window "
+ << window_id_ << " will change state to: "
+ << "HMI level " << to_resolve_hmi_level
+ << " --> " << result_hmi_level << ", audio "
+ << state_to_resolve->audio_streaming_state()
+ << " --> " << result_audio_state << ", video "
+ << state_to_resolve->video_streaming_state()
+ << " --> " << result_video_state);
state_ctrl_->SetupRegularHmiState(app_to_resolve,
+ window_id_,
result_hmi_level,
result_audio_state,
result_video_state);
} else {
LOG4CXX_DEBUG(logger_,
- "Application " << app_to_resolve->app_id()
- << " will NOT change HMI level");
+ "Application " << app_to_resolve->app_id() << " window "
+ << window_id_ << " will NOT change HMI level");
}
}
@@ -413,6 +443,7 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app,
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN(available_state, HmiStatePtr());
available_state->set_hmi_level(state->hmi_level());
+ available_state->set_window_type(state->window_type());
available_state->set_audio_streaming_state(state->audio_streaming_state());
available_state->set_video_streaming_state(state->video_streaming_state());
available_state->set_system_context(state->system_context());
@@ -570,12 +601,14 @@ bool StateControllerImpl::IsStateAvailableForResumption(
}
void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- LOG4CXX_DEBUG(logger_, "Setup regular state: " << *state);
- HmiStatePtr curr_state = app->CurrentHmiState();
+ LOG4CXX_DEBUG(logger_,
+ "Setup window #" << window_id << " regular state: " << *state);
+ HmiStatePtr curr_state = app->CurrentHmiState(window_id);
HmiStatePtr old_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(old_state);
@@ -583,28 +616,30 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
old_state->set_audio_streaming_state(curr_state->audio_streaming_state());
old_state->set_video_streaming_state(curr_state->video_streaming_state());
old_state->set_system_context(curr_state->system_context());
- app->SetRegularState(state);
+ old_state->set_window_type(curr_state->window_type());
+ app->SetRegularState(window_id, state);
- if (HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
LOG4CXX_DEBUG(logger_,
"Resuming to LIMITED level. "
<< "Send OnResumeAudioSource notification");
MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id(), app_mngr_);
}
- app->set_is_resuming(false);
- HmiStatePtr new_state = app->CurrentHmiState();
- OnStateChanged(app, old_state, new_state);
+ HmiStatePtr new_state = app->CurrentHmiState(window_id);
+ OnStateChanged(app, window_id, old_state, new_state);
}
void StateControllerImpl::SetupRegularHmiState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
HmiStatePtr new_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -613,22 +648,64 @@ void StateControllerImpl::SetupRegularHmiState(
new_state->set_audio_streaming_state(audio_state);
new_state->set_video_streaming_state(video_state);
new_state->set_system_context(prev_state->system_context());
- SetupRegularHmiState(app, new_state);
+ new_state->set_window_type(prev_state->window_type());
+ SetupRegularHmiState(app, window_id, new_state);
}
void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
LOG4CXX_DEBUG(logger_,
- "Applying to app " << app->app_id() << " state " << *state);
- SetupRegularHmiState(app, state);
+ "Applying to app " << app->app_id() << " window #" << window_id
+ << " state " << *state);
+ SetupRegularHmiState(app, window_id, state);
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_DEBUG(logger_, "No need to resolve conflicts for a widget");
+ return;
+ }
+
LOG4CXX_DEBUG(logger_,
"Resolving HMI level conflicts for app " << app->app_id());
- ForEachApplication(HmiLevelConflictResolver(app, state, this));
+ ForEachApplication(HmiLevelConflictResolver(app, window_id, state, this));
+}
+
+void StateControllerImpl::UpdateAppWindowsStreamingState(
+ ApplicationSharedPtr app, HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto window_ids = app->GetWindowIds();
+ for (auto window_id : window_ids) {
+ HmiStatePtr window_hmi_state = app->RegularHmiState(window_id);
+ LOG4CXX_DEBUG(
+ logger_, "State: " << *state << " window state: " << *window_hmi_state);
+ if (window_hmi_state->audio_streaming_state() !=
+ state->audio_streaming_state() ||
+ window_hmi_state->video_streaming_state() !=
+ state->video_streaming_state()) {
+ LOG4CXX_DEBUG(logger_,
+ "Updating streaming state for window #" << window_id);
+
+ HmiStatePtr new_window_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(new_window_state);
+ new_window_state->set_hmi_level(window_hmi_state->hmi_level());
+ new_window_state->set_audio_streaming_state(
+ state->audio_streaming_state());
+ new_window_state->set_video_streaming_state(
+ state->video_streaming_state());
+ new_window_state->set_system_context(window_hmi_state->system_context());
+ new_window_state->set_window_type(window_hmi_state->window_type());
+ app->SetRegularState(window_id, new_window_state);
+
+ MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+ }
+ }
}
+
void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {}
void StateControllerImpl::on_event(const event_engine::Event& event) {
@@ -731,26 +808,82 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
}
}
+void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+
+ const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
+ const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
+ const AudioStreamingState::eType audio_state =
+ app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
+ : AudioStreamingState::NOT_AUDIBLE;
+ const VideoStreamingState::eType video_state =
+ app->IsVideoApplication() ? VideoStreamingState::STREAMABLE
+ : VideoStreamingState::NOT_STREAMABLE;
+
+ SetRegularState(app, window_id, hmi_level, audio_state, video_state, false);
+
+ // After main window activation, streaming state should be updated for another
+ // windows of the app
+ HmiStatePtr new_state =
+ app->RegularHmiState(PredefinedWindows::DEFAULT_WINDOW);
+ UpdateAppWindowsStreamingState(app, new_state);
+}
+
+void StateControllerImpl::ExitDefaultWindow(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+
+ const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
+ const HMILevel::eType hmi_level = HMILevel::HMI_NONE;
+ const AudioStreamingState::eType audio_state =
+ AudioStreamingState::NOT_AUDIBLE;
+ const VideoStreamingState::eType video_state =
+ VideoStreamingState::NOT_STREAMABLE;
+
+ SetRegularState(app, window_id, hmi_level, audio_state, video_state, false);
+
+ // After main window exiting, streaming state should be updated for another
+ // windows of the app
+ HmiStatePtr new_state =
+ app->RegularHmiState(PredefinedWindows::DEFAULT_WINDOW);
+ UpdateAppWindowsStreamingState(app, new_state);
+}
+
void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr old_state,
HmiStatePtr new_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(old_state);
DCHECK_OR_RETURN_VOID(new_state);
- LOG4CXX_DEBUG(logger_, "Old state: " << *old_state);
- LOG4CXX_DEBUG(logger_, "New state: " << *new_state);
- if (IsStateChanged(*old_state, *new_state)) {
- app_mngr_.SendHMIStatusNotification(app);
- if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
- app->ResetDataInNone();
- }
- app_mngr_.OnHMILevelChanged(
- app->app_id(), old_state->hmi_level(), new_state->hmi_level());
- app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
- } else {
- LOG4CXX_ERROR(logger_, "State has NOT been changed.");
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " old state: " << *old_state);
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " new state: " << *new_state);
+
+ if (!IsStateChanged(*old_state, *new_state)) {
+ LOG4CXX_DEBUG(logger_, "State has NOT been changed.");
+ return;
+ }
+
+ MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_DEBUG(logger_,
+ "State was changed not for a main application window. No "
+ "additional actions required");
+ return;
}
+
+ if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ app->ResetDataInNone();
+ }
+
+ app_mngr_.OnHMILevelChanged(
+ app->app_id(), old_state->hmi_level(), new_state->hmi_level());
+ app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
}
bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
@@ -761,6 +894,20 @@ bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
void StateControllerImpl::OnApplicationRegistered(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // After app registration HMI level should be set for DEFAUL_WINDOW only
+ OnAppWindowAdded(app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::WindowType::MAIN,
+ default_level);
+}
+
+void StateControllerImpl::OnAppWindowAdded(
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) {
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -774,9 +921,10 @@ void StateControllerImpl::OnApplicationRegistered(
DCHECK_OR_RETURN_VOID(new_state);
DCHECK_OR_RETURN_VOID(new_state->state_id() !=
HmiState::STATE_ID_REGULAR);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
+ HmiStatePtr old_hmi_state = app->CurrentHmiState(window_id);
new_state->set_parent(old_hmi_state);
- app->AddHMIState(new_state);
+ new_state->set_window_type(old_hmi_state->window_type());
+ app->AddHMIState(window_id, new_state);
}
}
@@ -787,14 +935,15 @@ void StateControllerImpl::OnApplicationRegistered(
default_state->set_audio_streaming_state(CalcAudioState(app, default_level));
default_state->set_video_streaming_state(CalcVideoState(app, default_level));
default_state->set_system_context(SystemContext::SYSCTXT_MAIN);
+ default_state->set_window_type(window_type);
- HmiStatePtr initial_state = app->RegularHmiState();
+ HmiStatePtr initial_state = app->RegularHmiState(window_id);
- app->SetRegularState(default_state);
+ app->SetRegularState(window_id, default_state);
- HmiStatePtr new_state = app->CurrentHmiState();
+ HmiStatePtr new_state = app->CurrentHmiState(window_id);
- OnStateChanged(app, initial_state, new_state);
+ OnStateChanged(app, window_id, initial_state, new_state);
}
int64_t StateControllerImpl::RequestHMIStateChange(
@@ -828,11 +977,15 @@ int64_t StateControllerImpl::RequestHMIStateChange(
void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
- HmiStatePtr state = app->PostponedHmiState();
- if (state) {
- app->RemovePostponedState();
- state->set_state_id(HmiState::STATE_ID_REGULAR);
- SetRegularState(app, state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (const auto& window_id : window_ids) {
+ HmiStatePtr state = app->PostponedHmiState(window_id);
+ if (state) {
+ app->RemovePostponedState(window_id);
+ state->set_state_id(HmiState::STATE_ID_REGULAR);
+ SetRegularState(app, window_id, state);
+ }
}
}
@@ -860,16 +1013,19 @@ void StateControllerImpl::TempStateStopped(HmiState::StateID ID) {
std::mem_fun(&StateControllerImpl::ApplyPostponedStateForApp), this));
}
-void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
+void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app,
+ const WindowID window_id) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- const HmiStatePtr regular = app->RegularHmiState();
+ const HmiStatePtr regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(regular);
HmiStatePtr new_regular = std::make_shared<HmiState>(*regular);
- LOG4CXX_DEBUG(logger_, "Current HMI level: '" << app->hmi_level() << "'");
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " current HMI level: '"
+ << app->hmi_level(window_id) << "'");
const bool is_audio_app = app->IsAudioApplication();
const bool is_video_app = app->IsVideoApplication();
@@ -895,7 +1051,7 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
new_regular->set_video_streaming_state(VideoStreamingState::NOT_STREAMABLE);
}
- SetRegularState(app, new_regular, false);
+ SetRegularState(app, window_id, new_regular, false);
}
void StateControllerImpl::OnHMIResponse(
@@ -911,7 +1067,9 @@ void StateControllerImpl::OnHMIResponse(
if (application && hmi_apis::Common_Result::SUCCESS == code) {
HmiStatePtr pending_state = waiting_for_response_[application->app_id()];
DCHECK_OR_RETURN_VOID(pending_state);
- ApplyRegularState(application, pending_state);
+ ApplyRegularState(application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ pending_state);
}
}
@@ -927,7 +1085,33 @@ void StateControllerImpl::OnAppActivated(
return;
}
- SetRegularState(app, HMILevel::HMI_FULL, true);
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if (message[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = message[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto window_ids = app->GetWindowIds();
+ if (!helpers::in_range(window_ids, window_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application " << app_id << " does not contain window #" << window_id);
+ return;
+ }
+
+ if (PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ const auto window_hmi_level = app->hmi_level(window_id);
+ const HMILevel::eType new_hmi_level = HMILevel::HMI_NONE == window_hmi_level
+ ? HMILevel::HMI_BACKGROUND
+ : HMILevel::HMI_FULL;
+ const AudioStreamingState::eType audio_state = app->audio_streaming_state();
+ const VideoStreamingState::eType video_state = app->video_streaming_state();
+
+ SetRegularState(
+ app, window_id, new_hmi_level, audio_state, video_state, false);
+ return;
+ }
+
+ SetRegularState(app, window_id, HMILevel::HMI_FULL, true);
}
void StateControllerImpl::OnAppDeactivated(
@@ -942,13 +1126,39 @@ void StateControllerImpl::OnAppDeactivated(
return;
}
- if (HMILevel::HMI_FULL != app->hmi_level()) {
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if (message[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = message[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto window_ids = app->GetWindowIds();
+ if (!helpers::in_range(window_ids, window_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application " << app_id << " does not contain window #" << window_id);
+ return;
+ }
+
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if (PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ const HMILevel::eType new_hmi_level = HMILevel::HMI_FULL == window_hmi_level
+ ? HMILevel::HMI_BACKGROUND
+ : HMILevel::HMI_NONE;
+ const AudioStreamingState::eType audio_state = app->audio_streaming_state();
+ const VideoStreamingState::eType video_state = app->video_streaming_state();
+
+ SetRegularState(
+ app, window_id, new_hmi_level, audio_state, video_state, false);
+ return;
+ }
+
+ if (HMILevel::HMI_FULL != window_hmi_level) {
return;
}
// TODO(AOleynik): Need to delete DeactivateReason and modify OnAppDeactivated
// when HMI will support that, otherwise won't be testable
- DeactivateApp(app);
+ DeactivateApp(app, window_id);
}
void StateControllerImpl::OnVideoStreamingStarted(
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index 46d35bdbef..7b45d387f7 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -69,7 +69,14 @@ using ::testing::Return;
using ::testing::ReturnRef;
using usage_statistics_test::MockStatisticsManager;
-typedef void (ApplicationImpl::*AddSet)(HmiStatePtr args);
+typedef void (ApplicationImpl::*AddSet)(const WindowID window_id,
+ HmiStatePtr args);
+
+namespace {
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+} // namespace
class ApplicationImplTest : public ::testing::Test {
protected:
@@ -106,7 +113,8 @@ class ApplicationImplTest : public ::testing::Test {
mock_application_manager_));
HmiStatePtr initial_state = CreateTestHmiState();
- app_impl->SetInitialState(initial_state);
+ app_impl->SetInitialState(
+ kDefaultWindowId, kDefaultWindowName, initial_state);
}
virtual void TearDown() OVERRIDE {
@@ -159,12 +167,12 @@ HmiStatePtr ApplicationImplTest::TestAddHmiState(HMILevel::eType hmi_lvl,
test_lvl = hmi_lvl;
state_id = id_state;
HmiStatePtr state = CreateTestHmiState();
- ((app_impl.get())->*hmi_action)(state);
+ ((app_impl.get())->*hmi_action)(kDefaultWindowId, state);
return state;
}
void ApplicationImplTest::CheckCurrentHMIState() {
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(test_lvl, current_state->hmi_level());
EXPECT_EQ(state_id, current_state->state_id());
}
@@ -207,7 +215,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetRegularState) {
HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
- HmiStatePtr current_state = app_impl->RegularHmiState();
+ HmiStatePtr current_state = app_impl->RegularHmiState(kDefaultWindowId);
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_REGULAR, current_state->state_id());
EXPECT_EQ(app_id, app_impl->app_id());
@@ -228,8 +236,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveLastState) {
CheckCurrentHMIState();
// Remove last state
- app_impl->RemoveHMIState(state3->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state3->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state2, current_state);
EXPECT_EQ(HMILevel::HMI_NONE, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_VIDEO_STREAMING, current_state->state_id());
@@ -249,8 +257,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
CheckCurrentHMIState();
// Remove not last state
- app_impl->RemoveHMIState(state2->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state2->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// HMI level is equal to parent hmi_level
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
@@ -272,8 +280,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
CheckCurrentHMIState();
// Remove first added state
- app_impl->RemoveHMIState(state1->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state does not have a parent
EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
@@ -295,8 +303,8 @@ TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
CheckCurrentHMIState();
// Remove first state
- app_impl->RemoveHMIState(state1->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state has a parent
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
@@ -311,12 +319,12 @@ TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) {
&ApplicationImpl::SetPostponedState);
// Check that state was setted correctly
- HmiStatePtr state2 = app_impl->PostponedHmiState();
+ HmiStatePtr state2 = app_impl->PostponedHmiState(kDefaultWindowId);
EXPECT_EQ(state1, state2);
// Check that state was correctly removed
- app_impl->RemovePostponedState();
- state2 = app_impl->PostponedHmiState();
+ app_impl->RemovePostponedState(kDefaultWindowId);
+ state2 = app_impl->PostponedHmiState(kDefaultWindowId);
EXPECT_EQ(nullptr, state2);
}
@@ -327,9 +335,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
HmiState::STATE_ID_REGULAR,
&ApplicationImpl::SetRegularState);
- EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId));
EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
- EXPECT_EQ(syst_context, app_impl->system_context());
+ EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId));
audiostate = AudioStreamingState::AUDIBLE;
syst_context = SystemContext::SYSCTXT_MENU;
@@ -337,9 +345,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
- EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId));
EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
- EXPECT_EQ(syst_context, app_impl->system_context());
+ EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId));
}
TEST_F(ApplicationImplTest, IsAudioApplication) {
@@ -565,7 +573,9 @@ TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
SoftButtonID test_button;
for (uint i = 0; i < btn_count; i++) {
- test_button.insert(i);
+ test_button.insert(std::make_pair(
+ i,
+ static_cast<WindowID>(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
}
app_impl->SubscribeToSoftButtons(FunctionID::ScrollableMessageID,
test_button);
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index 1f4b94a991..1f0b705f41 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -102,6 +102,8 @@ connection_handler::DeviceHandle kDeviceId = 12345u;
const std::string kAppId = "someID";
const uint32_t kConnectionKey = 1232u;
const std::string kAppName = "appName";
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
// Cloud application params
@@ -386,7 +388,7 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_VideoServiceStart) {
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -417,7 +419,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
// is_navi() is false
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -448,7 +450,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
// HMI level is not FULL nor LIMITED
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
bool result = false;
@@ -478,7 +480,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
bool result = false;
@@ -562,7 +564,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -636,7 +638,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -671,7 +673,7 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_AudioServiceStart) {
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -701,7 +703,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -837,7 +839,7 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_switch));
const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL;
- EXPECT_CALL(*switching_app_ptr, hmi_level())
+ EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_switching_app));
std::shared_ptr<MockApplication> nonswitching_app_ptr =
@@ -854,7 +856,7 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_nonswitch));
const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED;
- EXPECT_CALL(*nonswitching_app_ptr, hmi_level())
+ EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_nonswitching_app));
// Act
@@ -903,7 +905,7 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_switch));
const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL;
- EXPECT_CALL(*switching_app_ptr, hmi_level())
+ EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_switching_app));
std::shared_ptr<MockApplication> nonswitching_app_ptr =
@@ -925,7 +927,7 @@ TEST_F(ApplicationManagerImplTest,
Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4));
const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED;
- EXPECT_CALL(*nonswitching_app_ptr, hmi_level())
+ EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_nonswitching_app));
// Act
diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc
index 5ebcdd29c7..22d111f926 100644
--- a/src/components/application_manager/test/application_state_test.cc
+++ b/src/components/application_manager/test/application_state_test.cc
@@ -50,6 +50,11 @@ using namespace mobile_apis;
typedef HmiState::StateID StateID;
namespace {
+
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+
std::vector<StateID> GenerateCurrentStates() {
std::vector<StateID> states;
states.push_back(StateID::STATE_ID_PHONE_CALL);
@@ -87,8 +92,8 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
- EXPECT_EQ(state, app_state.GetState(current_id));
+ app_state.AddState(kDefaultWindowId, state);
+ EXPECT_EQ(state, app_state.GetState(kDefaultWindowId, current_id));
}
}
@@ -99,16 +104,16 @@ TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
- HmiStatePtr curr_state = app_state.GetState(current_id);
+ HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id);
ASSERT_EQ(*new_state, curr_state->state_id());
}
new_state = added_states_.end() - 1;
while (new_state != added_states_.begin()) {
- app_state.RemoveState(*new_state);
- HmiStatePtr curr_state = app_state.GetState(current_id);
+ app_state.RemoveState(kDefaultWindowId, *new_state);
+ HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id);
--new_state;
EXPECT_EQ(*new_state, curr_state->state_id());
}
@@ -122,19 +127,20 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
}
// Postponed state wasn't added
- HmiStatePtr get_postponed_id = app_state.GetState(postponed_id);
+ HmiStatePtr get_postponed_id =
+ app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(nullptr, get_postponed_id);
// Add posponed state
HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Postponed state exists
- get_postponed_id = app_state.GetState(postponed_id);
+ get_postponed_id = app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(state, get_postponed_id);
}
@@ -146,7 +152,7 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
app_mngr_,
*new_state);
state->set_hmi_level(HMILevel::HMI_FULL);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
++new_state;
// Add some other
for (; new_state != added_states_.end(); ++new_state) {
@@ -154,13 +160,14 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
state->set_hmi_level(HMILevel::HMI_LIMITED);
}
// Regular state will be the first added state
new_state = added_states_.begin();
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(*new_state, reg_state->state_id());
EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
}
@@ -171,7 +178,7 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
++new_state;
// Add postponed state
@@ -179,10 +186,10 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Make sure that the state was added
- HmiStatePtr post_state = app_state.GetState(postponed_id);
+ HmiStatePtr post_state = app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(state, post_state);
for (; new_state != added_states_.end(); ++new_state) {
@@ -190,19 +197,20 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
}
// Regular state will be the first added state
new_state = added_states_.begin();
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
ASSERT_EQ(*new_state, reg_state->state_id());
- app_state.RemoveState(*new_state);
+ app_state.RemoveState(kDefaultWindowId, *new_state);
++new_state;
// Now regular state is the next state except postponed
- reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(*new_state, reg_state->state_id());
}
@@ -213,14 +221,14 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
first_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add postponed state
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add new postponed state
std::shared_ptr<MockApplication> mock_app_2(new MockApplication);
@@ -228,21 +236,22 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add regular state
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
StateID::STATE_ID_REGULAR);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Postponed state is the first
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_POSTPONED);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_POSTPONED);
ASSERT_EQ(postponed_id, reg_state->state_id());
// Regular state is the second one
- reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
}
@@ -253,12 +262,14 @@ TEST_F(ApplicationStateTest, InitState_GetRegularState) {
app_mngr_,
init_state);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(state, reg_state);
- HmiStatePtr curr_state = app_state.GetState(StateID::STATE_ID_CURRENT);
+ HmiStatePtr curr_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_CURRENT);
EXPECT_EQ(state, curr_state);
}
@@ -271,23 +282,24 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) {
init_state);
state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
// Add postponed state
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Make sure that state was added
- HmiStatePtr get_postponed_state = app_state.GetState(postponed_id);
+ HmiStatePtr get_postponed_state =
+ app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(state, get_postponed_state);
// Remove postponed state
- app_state.RemoveState(postponed_id);
+ app_state.RemoveState(kDefaultWindowId, postponed_id);
- get_postponed_state = app_state.GetState(postponed_id);
+ get_postponed_state = app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(nullptr, get_postponed_state);
}
@@ -298,13 +310,13 @@ TEST_F(ApplicationStateTest,
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
reg_state);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
// Try deleting regular state
- app_state.RemoveState(reg_state);
+ app_state.RemoveState(kDefaultWindowId, reg_state);
// Get regular state
- HmiStatePtr get_reg_state = app_state.GetState(reg_state);
+ HmiStatePtr get_reg_state = app_state.GetState(kDefaultWindowId, reg_state);
EXPECT_EQ(state, get_reg_state);
}
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
index cf26c19249..27e21efd8d 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -154,6 +154,13 @@ class CommandRequestImplTest
typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
typedef std::shared_ptr<UCommandRequestImpl> CommandPtr;
+TEST_F(CommandRequestImplTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMessage();
+ const auto command = CreateCommand<UCommandRequestImpl>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>();
@@ -366,6 +373,12 @@ TEST_F(CommandRequestImplTest,
TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*mock_app,
+ WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
MessageSharedPtr message = CreateMessage();
(*message)[strings::msg_params] =
@@ -373,7 +386,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(kMobResultSuccess));
EXPECT_TRUE(command->CheckPermissions());
@@ -383,6 +396,12 @@ TEST_F(CommandRequestImplTest,
CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*mock_app,
+ WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
MessageSharedPtr message = CreateMessage();
(*message)[strings::msg_params] =
@@ -394,7 +413,7 @@ TEST_F(CommandRequestImplTest,
.Times(1)
.WillRepeatedly(Return(kConnectionKey));
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(mobile_apis::Result::INVALID_ENUM));
EXPECT_CALL(mock_message_helper_, CreateBlockedByPoliciesResponse(_, _, _, _))
@@ -405,7 +424,7 @@ TEST_F(CommandRequestImplTest,
}
ACTION_P(GetArg3, output) {
- *output = arg2;
+ *output = arg3;
}
TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
@@ -417,9 +436,14 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
MockAppPtr app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*app, WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
RPCParams params;
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(DoAll(GetArg3(&params), Return(kMobResultSuccess)));
EXPECT_TRUE(command->CheckPermissions());
diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc
index dc6635b049..502c1bdbbf 100644
--- a/src/components/application_manager/test/help_prompt_manager_test.cc
+++ b/src/components/application_manager/test/help_prompt_manager_test.cc
@@ -65,6 +65,9 @@ const std::string kDirectoryName = "./test_storage";
const uint8_t expected_tread_pool_size = 2u;
const uint8_t stop_streaming_timeout = 1u;
const std::vector<std::string> kTimeoutPrompt{"timeoutPrompt"};
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
} // namespace
using namespace application_manager;
@@ -244,7 +247,8 @@ void HelpPromptManagerTest::CreateApplication(
app_mngr_,
mock_help_prompt_manager));
HmiStatePtr initial_state = CreateTestHmiState();
- app_impl_->SetInitialState(initial_state);
+ app_impl_->SetInitialState(
+ kDefaultWindowId, kDefaultWindowName, initial_state);
}
TEST_F(HelpPromptManagerTest, AddCommand_OnVrCommandAdded) {
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 74d09661c7..29e1c1cf9f 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
@@ -34,6 +34,8 @@
#include <string>
#include "application_manager/app_extension.h"
#include "application_manager/application.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/hmi_state.h"
#include "application_manager/usage_statistics.h"
#include "gmock/gmock.h"
#include "smart_objects/smart_object.h"
@@ -56,6 +58,8 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));
+ MOCK_CONST_METHOD0(is_app_data_resumption_allowed, bool());
+ MOCK_METHOD1(set_app_data_resumption_allowance, void(bool allowed));
MOCK_METHOD0(CloseActiveMessage, void());
MOCK_CONST_METHOD0(IsFullscreen, bool());
MOCK_METHOD0(ChangeSupportingAppHMIType, void());
@@ -97,11 +101,15 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_folder_name, void(const std::string& folder_name));
MOCK_CONST_METHOD0(folder_name, const std::string());
MOCK_CONST_METHOD0(is_media_application, bool());
- MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType());
+ MOCK_CONST_METHOD1(hmi_level,
+ const mobile_apis::HMILevel::eType(
+ const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t());
MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t());
MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType());
+ MOCK_CONST_METHOD1(system_context,
+ const mobile_apis::SystemContext::eType(
+ const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(audio_streaming_state,
const mobile_apis::AudioStreamingState::eType());
MOCK_CONST_METHOD0(video_streaming_state,
@@ -109,11 +117,20 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(app_icon_path, const std::string&());
MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle());
MOCK_CONST_METHOD0(secondary_device, connection_handler::DeviceHandle());
- MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD1(CurrentHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(RegularHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD0(GetWindowIds, application_manager::WindowIds());
+ MOCK_CONST_METHOD0(GetWindowNames, application_manager::WindowNames());
+ MOCK_CONST_METHOD1(WindowIdExists,
+ bool(const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(IsAllowedToChangeAudioSource, bool());
- MOCK_CONST_METHOD0(PostponedHmiState,
- const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD1(PostponedHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
MOCK_METHOD1(set_tts_properties_in_none, void(bool active));
MOCK_METHOD0(tts_properties_in_none, bool());
MOCK_METHOD1(set_tts_properties_in_full, void(bool active));
@@ -167,14 +184,24 @@ class MockApplication : public ::application_manager::Application {
::application_manager::HelpPromptManager&());
MOCK_CONST_METHOD0(help_prompt_manager,
const ::application_manager::HelpPromptManager&());
- MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetPostponedState,
- void(::application_manager::HmiStatePtr state));
- MOCK_METHOD0(RemovePostponedState, void());
- MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(RemoveHMIState,
- void(::application_manager::HmiState::StateID state_id));
+ MOCK_METHOD3(SetInitialState,
+ void(const application_manager::WindowID window_id,
+ const std::string& window_name,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(SetRegularState,
+ void(const application_manager::WindowID window_id,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(SetPostponedState,
+ void(const application_manager::WindowID window_id,
+ ::application_manager::HmiStatePtr state));
+ MOCK_METHOD1(RemovePostponedState,
+ void(const application_manager::WindowID window_id));
+ MOCK_METHOD2(AddHMIState,
+ void(const application_manager::WindowID window_id,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(RemoveHMIState,
+ void(const application_manager::WindowID window_id,
+ ::application_manager::HmiState::StateID state_id));
MOCK_METHOD2(SubscribeToSoftButtons,
void(int32_t cmd_id,
const ::application_manager::SoftButtonID& softbuttons_id));
@@ -220,9 +247,35 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(day_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(night_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(display_layout, const std::string&());
+ MOCK_CONST_METHOD0(day_color_scheme, smart_objects::SmartObject());
+ MOCK_CONST_METHOD0(night_color_scheme, smart_objects::SmartObject());
+ MOCK_CONST_METHOD0(display_layout, std::string());
+ MOCK_CONST_METHOD0(display_capabilities, smart_objects::SmartObjectSPtr());
+ MOCK_CONST_METHOD1(display_capabilities,
+ smart_objects::SmartObjectSPtr(
+ const application_manager::WindowID window_id));
+
+ MOCK_METHOD2(set_window_layout,
+ void(const application_manager::WindowID window_id,
+ const std::string& layout));
+ MOCK_METHOD2(set_day_color_scheme,
+ void(const application_manager::WindowID window_id,
+ const smart_objects::SmartObject& color_scheme));
+ MOCK_METHOD2(set_night_color_scheme,
+ void(const application_manager::WindowID window_id,
+ const smart_objects::SmartObject& color_scheme));
+ MOCK_CONST_METHOD1(
+ window_layout,
+ std::string(const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(day_color_scheme,
+ smart_objects::SmartObject(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(night_color_scheme,
+ smart_objects::SmartObject(
+ const application_manager::WindowID window_id));
+ MOCK_METHOD1(set_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
MOCK_METHOD1(load_global_properties,
void(const smart_objects::SmartObject& so));
MOCK_METHOD1(set_help_prompt,
@@ -316,9 +369,10 @@ class MockApplication : public ::application_manager::Application {
SwapMobileMessageQueue,
void(::application_manager::MobileMessageQueue& mobile_messages));
- MOCK_METHOD1(
+ MOCK_METHOD2(
set_system_context,
- void(const application_manager::mobile_api::SystemContext::eType&));
+ void(const application_manager::WindowID window_id,
+ const application_manager::mobile_api::SystemContext::eType&));
MOCK_METHOD1(
set_audio_streaming_state,
void(const application_manager::mobile_api::AudioStreamingState::eType&
@@ -329,9 +383,10 @@ class MockApplication : public ::application_manager::Application {
bool(smart_objects::SmartObject module));
MOCK_METHOD1(UnsubscribeFromInteriorVehicleData,
bool(smart_objects::SmartObject module));
- MOCK_METHOD1(
+ MOCK_METHOD2(
set_hmi_level,
- void(const application_manager::mobile_api::HMILevel::eType& hmi_level));
+ void(const application_manager::WindowID window_id,
+ const application_manager::mobile_api::HMILevel::eType& hmi_level));
MOCK_METHOD1(QueryInterface,
application_manager::AppExtensionPtr(
application_manager::AppExtensionUID uid));
@@ -357,6 +412,19 @@ class MockApplication : public ::application_manager::Application {
void(const mobile_apis::HybridAppPreference::eType&
hybrid_app_preference));
MOCK_METHOD1(set_cloud_app_certificate, void(const std::string& certificate));
+ MOCK_METHOD2(SetWindowInfo,
+ void(const ::application_manager::WindowID windowID,
+ const smart_objects::SmartObject& window_info));
+ MOCK_METHOD1(RemoveWindowInfo,
+ void((const ::application_manager::WindowID window_id)));
+ MOCK_CONST_METHOD0(window_optional_params_map,
+ DataAccessor< ::application_manager::WindowParamsMap>());
+ MOCK_METHOD0(display_capabilities_builder,
+ application_manager::DisplayCapabilitiesBuilder&());
+ MOCK_METHOD1(GetSoftButtonWindowID,
+ application_manager::WindowID(const uint32_t button_id));
+ MOCK_METHOD1(remove_window_capability,
+ void(const application_manager::WindowID window_id));
};
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
index a662b211d7..6ca987c1b2 100644
--- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
+++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
@@ -103,6 +103,11 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_METHOD1(set_display_capabilities,
void(const smart_objects::SmartObject& display_capabilities));
+ MOCK_CONST_METHOD0(system_display_capabilities,
+ const smart_objects::SmartObjectSPtr());
+ MOCK_METHOD1(set_system_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
MOCK_CONST_METHOD0(hmi_zone_capabilities,
const smart_objects::SmartObject*());
MOCK_METHOD1(set_hmi_zone_capabilities,
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 29afd36e52..6cbe46f9ec 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
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_MESSAGE_HELPER_H_
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "gmock/gmock.h"
@@ -128,8 +129,9 @@ class MockMessageHelper {
MOCK_METHOD2(CreateMessageForHMI,
smart_objects::SmartObjectSPtr(hmi_apis::messageType::eType,
const uint32_t));
- MOCK_METHOD2(SendHMIStatusNotification,
- void(const Application& application_impl,
+ MOCK_METHOD3(SendHMIStatusNotification,
+ void(ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager));
MOCK_METHOD4(SendPolicyUpdate,
void(const std::string& file_path,
@@ -223,6 +225,11 @@ class MockMessageHelper {
ApplicationConstSharedPtr app,
const policy::PolicyHandlerInterface& policy_handler,
ApplicationManager& app_mngr));
+ MOCK_METHOD4(SubscribeApplicationToSoftButton,
+ void(smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id,
+ const application_manager::WindowID window_id));
MOCK_METHOD3(SubscribeApplicationToSoftButton,
void(smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
@@ -282,6 +289,10 @@ class MockMessageHelper {
MOCK_METHOD1(PrintSmartObject,
bool(const smart_objects::SmartObject& object));
+
+ MOCK_METHOD1(ExtractWindowIdFromSmartObject,
+ WindowID(const smart_objects::SmartObject& s_map));
+
MOCK_METHOD3(SendTTSGlobalProperties,
void(ApplicationSharedPtr app,
const bool default_help_prompt,
@@ -320,6 +331,15 @@ class MockMessageHelper {
MOCK_METHOD2(BroadcastCapabilityUpdate,
void(smart_objects::SmartObject& msg_params,
ApplicationManager& app_mngr));
+ MOCK_METHOD3(CreateUICreateWindowRequestsToHMI,
+ smart_objects::SmartObjectList(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_manager,
+ const smart_objects::SmartObject& windows_info));
+ MOCK_METHOD2(
+ CreateDisplayCapabilityUpdateToMobile,
+ smart_objects::SmartObjectSPtr(const smart_objects::SmartObject&,
+ application_manager::Application&));
static MockMessageHelper* message_helper_mock();
};
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 dfc6691ef4..77b5bb7c38 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
@@ -55,6 +55,7 @@ class MockRequest : public application_manager::commands::Command {
MOCK_METHOD0(CleanUp, bool());
MOCK_CONST_METHOD0(default_timeout, uint32_t());
MOCK_CONST_METHOD0(function_id, int32_t());
+ MOCK_CONST_METHOD0(window_id, application_manager::WindowID());
MOCK_METHOD0(onTimeOut, void());
MOCK_METHOD0(AllowedToTerminate, bool());
MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed));
diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
index 4fd3b7fc5a..56c2ae3cd4 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
@@ -94,13 +94,23 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(SetupDefaultHMILevel,
bool(application_manager::ApplicationSharedPtr application));
MOCK_METHOD1(StartAppHmiStateResumption,
- void(application_manager::ApplicationSharedPtr application));
+ bool(application_manager::ApplicationSharedPtr application));
MOCK_METHOD3(SetAppHMIState,
bool(application_manager::ApplicationSharedPtr application,
const mobile_apis::HMILevel::eType hmi_level,
bool check_policy));
MOCK_CONST_METHOD0(LaunchTime, time_t());
+ MOCK_METHOD2(RestoreAppWidgets,
+ void(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app));
+
+ MOCK_METHOD1(RestoreWidgetsHMIState,
+ void(const smart_objects::SmartObject& response_message));
+
+ MOCK_METHOD1(StartWaitingForDisplayCapabilitiesUpdate,
+ void(application_manager::ApplicationSharedPtr application));
+
#ifdef BUILD_TESTS
MOCK_METHOD1(set_resumption_storage,
void(std::shared_ptr<resumption::ResumptionData> mock_storage));
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 cab3c23253..e313427547 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
@@ -74,7 +74,9 @@ class ResumptionDataTest : public ::testing::Test {
, comlock_ptr_(std::make_shared<sync_primitives::Lock>())
, setlock_ptr_(std::make_shared<sync_primitives::Lock>())
, btnlock_ptr_(std::make_shared<sync_primitives::Lock>())
- , ivilock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
+ , ivilock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {
+ }
// Check structure in saved application
void CheckSavedApp(sm::SmartObject& saved_data);
// Set data for resumption
@@ -114,6 +116,9 @@ class ResumptionDataTest : public ::testing::Test {
void SetHelpAndTimeoutPrompt();
void SetVRHelpTitle();
void SetSubscriptions();
+ void SetWindowsInfo();
+ void SetDefaultCurrentHmiState();
+ void SetDefaultWindowIds();
void CheckCommands(sm::SmartObject& res_list);
void CheckGlobalProporties(sm::SmartObject& res_list);
@@ -129,6 +134,7 @@ class ResumptionDataTest : public ::testing::Test {
ns_smart_device_link::ns_smart_objects::SmartObject& res_list);
void CheckVRTitle(sm::SmartObject& res_list);
void CheckSubscriptions(sm::SmartObject& res_list);
+ void CheckWindowsInfo(sm::SmartObject& res_list);
const size_t kCountOfCommands_;
const size_t kCountOfChoice_;
@@ -145,11 +151,14 @@ class ResumptionDataTest : public ::testing::Test {
am::ButtonSubscriptions btn_subscr;
+ am::WindowParamsMap test_window_params_map_;
+
std::shared_ptr<sync_primitives::Lock> sublock_ptr_;
std::shared_ptr<sync_primitives::Lock> comlock_ptr_;
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::Lock> window_params_map_lock_ptr_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
application_manager_test::MockApplicationManager mock_application_manager_;
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index d0fbe696cd..a174d74d5d 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -1084,6 +1084,27 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
EXPECT_EQ(480, msg_params[strings::config][strings::height].asInt());
}
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_SUCCESS) {
+ const WindowID window_id = 145;
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ message[strings::msg_params][strings::window_id] = window_id;
+ EXPECT_EQ(window_id,
+ MessageHelper::ExtractWindowIdFromSmartObject(
+ message[strings::msg_params]));
+}
+
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromEmptyMessage) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ MessageHelper::ExtractWindowIdFromSmartObject(message));
+}
+
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromWrongType) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Array);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ MessageHelper::ExtractWindowIdFromSmartObject(message));
+}
+
} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 3284224237..cccadc5a9d 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -258,10 +258,11 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
MockMessageHelper::message_helper_mock()->SendHMIStatusNotification(
- application_impl, application_manager);
+ application, window_id, application_manager);
}
void MessageHelper::SendUpdateSDLResponse(const std::string& result,
@@ -408,6 +409,16 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
+ int32_t function_id,
+ const WindowID window_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->SubscribeApplicationToSoftButton(
+ message_params, app, function_id, window_id);
+}
+
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
int32_t function_id) {
return MockMessageHelper::message_helper_mock()
->SubscribeApplicationToSoftButton(message_params, app, function_id);
@@ -528,6 +539,12 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
return MockMessageHelper::message_helper_mock()->PrintSmartObject(object);
}
+WindowID MessageHelper::ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map) {
+ return MockMessageHelper::message_helper_mock()
+ ->ExtractWindowIdFromSmartObject(s_map);
+}
+
void MessageHelper::SendSetAppIcon(const uint32_t app_id,
const std::string& icon_path,
ApplicationManager& application_manager) {
@@ -595,4 +612,18 @@ void MessageHelper::BroadcastCapabilityUpdate(
msg_params, app_mngr);
}
+smart_objects::SmartObjectList MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateUICreateWindowRequestsToHMI(application, app_mngr, windows_info);
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& system_capabilities, Application& app) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateDisplayCapabilityUpdateToMobile(system_capabilities, app);
+}
} // namespace application_manager
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 6bd2c7fda6..6af4c4f018 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -91,6 +91,8 @@ using ::testing::SetArgReferee;
typedef NiceMock<application_manager_test::MockRPCService> MockRPCService;
const std::string kDummyData = "some_data";
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
class PolicyHandlerTest : public ::testing::Test {
public:
@@ -236,7 +238,7 @@ class PolicyHandlerTest : public ::testing::Test {
EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(default_hmi_level))
@@ -552,14 +554,15 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
EXPECT_CALL(app_manager_, state_controller())
.WillRepeatedly(ReturnRef(mock_state_controller));
- EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, true));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_, kDefaultWindowId, new_hmi_level, true));
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
@@ -580,14 +583,15 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
EXPECT_CALL(app_manager_, state_controller())
.WillRepeatedly(ReturnRef(mock_state_controller));
- EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, false));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_, kDefaultWindowId, new_hmi_level, false));
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
@@ -607,7 +611,7 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
@@ -637,7 +641,8 @@ TEST_F(PolicyHandlerTest, CheckPermissions) {
const uint32_t device = 3;
const mobile_apis::HMILevel::eType hmi_level =
mobile_apis::HMILevel::HMI_NONE;
- EXPECT_CALL(*mock_app_, hmi_level()).WillOnce(Return(hmi_level));
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(hmi_level));
EXPECT_CALL(*mock_app_, device()).WillOnce(Return(device));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_,
@@ -648,7 +653,8 @@ TEST_F(PolicyHandlerTest, CheckPermissions) {
EXPECT_CALL(mock_message_helper_, GetDeviceMacAddressForHandle(device, _))
.WillOnce(Return(kDeviceId));
// Act
- policy_handler_.CheckPermissions(mock_app_, kRpc_, kRpc_params, result);
+ policy_handler_.CheckPermissions(
+ mock_app_, kDefaultWindowId, kRpc_, kRpc_params, result);
}
TEST_F(PolicyHandlerTest, GetNotificationsNumber) {
@@ -963,7 +969,8 @@ void PolicyHandlerTest::OnPendingPermissionChangePrecondition(
EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(application));
EXPECT_CALL(*application, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*application, hmi_level()).WillRepeatedly(Return(hmi_level));
+ EXPECT_CALL(*application, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(hmi_level));
}
TEST_F(PolicyHandlerTest,
@@ -1018,6 +1025,7 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppLimitedAndRevoked) {
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
EXPECT_CALL(mock_state_controller,
SetRegularState(_,
+ kDefaultWindowId,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -1998,7 +2006,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_GetDefaultMacAddress) {
test_app.insert(mock_app_);
EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
@@ -2021,7 +2029,7 @@ void PolicyHandlerTest::GetAppIDForSending() {
// Check expectations
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(mock_session_observer,
GetDataOnDeviceID(
@@ -2048,7 +2056,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_full_id = 1;
EXPECT_CALL(*mock_app_in_full, app_id())
.WillRepeatedly(Return(app_in_full_id));
- EXPECT_CALL(*mock_app_in_full, hmi_level())
+ EXPECT_CALL(*mock_app_in_full, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
ON_CALL(*mock_app_in_full, IsRegistered()).WillByDefault(Return(true));
@@ -2060,7 +2068,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_limited_id = 2;
EXPECT_CALL(*mock_app_in_limited, app_id())
.WillRepeatedly(Return(app_in_limited_id));
- EXPECT_CALL(*mock_app_in_limited, hmi_level())
+ EXPECT_CALL(*mock_app_in_limited, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_LIMITED));
ON_CALL(*mock_app_in_limited, IsRegistered()).WillByDefault(Return(true));
@@ -2072,7 +2080,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_background_id = 3;
EXPECT_CALL(*mock_app_in_background, app_id())
.WillRepeatedly(Return(app_in_background_id));
- EXPECT_CALL(*mock_app_in_background, hmi_level())
+ EXPECT_CALL(*mock_app_in_background, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_BACKGROUND));
ON_CALL(*mock_app_in_background, IsRegistered()).WillByDefault(Return(true));
@@ -2083,7 +2091,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_none_id = 4;
EXPECT_CALL(*mock_app_in_none, app_id())
.WillRepeatedly(Return(app_in_none_id));
- EXPECT_CALL(*mock_app_in_none, hmi_level())
+ EXPECT_CALL(*mock_app_in_none, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app_in_none, IsRegistered()).Times(0);
@@ -2113,7 +2121,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
const uint32_t app_in_none_id_1 = 1;
EXPECT_CALL(*mock_app_in_none_1, app_id())
.WillRepeatedly(Return(app_in_none_id_1));
- EXPECT_CALL(*mock_app_in_none_1, hmi_level())
+ EXPECT_CALL(*mock_app_in_none_1, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
ON_CALL(*mock_app_in_none_1, IsRegistered()).WillByDefault(Return(true));
@@ -2125,7 +2133,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
const uint32_t app_in_none_id_2 = 2;
EXPECT_CALL(*mock_app_in_none_2, app_id())
.WillRepeatedly(Return(app_in_none_id_2));
- EXPECT_CALL(*mock_app_in_none_2, hmi_level())
+ EXPECT_CALL(*mock_app_in_none_2, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE));
ON_CALL(*mock_app_in_none_2, IsRegistered()).WillByDefault(Return(true));
@@ -2160,7 +2168,7 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, policy_app_id())
.WillRepeatedly(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
@@ -2187,7 +2195,7 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, policy_app_id())
.WillRepeatedly(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
@@ -2215,9 +2223,9 @@ TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) {
std::shared_ptr<application_manager_test::MockApplication> second_mock_app =
std::make_shared<application_manager_test::MockApplication>();
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_CALL(*second_mock_app, hmi_level())
+ EXPECT_CALL(*second_mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(*second_mock_app, app_id()).WillRepeatedly(Return(kAppId2_));
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 a82358b451..899fc00846 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -35,10 +35,12 @@
#include "application_manager/application.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/display_capabilities_builder.h"
#include "application_manager/mock_app_extension.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_resumption_data.h"
+#include "application_manager/mock_rpc_service.h"
#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/usage_statistics.h"
#include "config_profile/profile.h"
@@ -73,6 +75,12 @@ using namespace application_manager_test;
using namespace resumption;
using namespace mobile_apis::HMILevel;
+namespace {
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const int32_t kDefaultHmiAppId = 111;
+} // namespace
+
class ResumeCtrlTest : public ::testing::Test {
protected:
ResumeCtrlTest()
@@ -156,6 +164,43 @@ class ResumeCtrlTest : public ::testing::Test {
ON_CALL(*mock_app_, is_cloud_app()).WillByDefault(Return(false));
}
+ smart_objects::SmartObjectSPtr CreateStubCreateWindowRequest(
+ const std::string window_name,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type) const {
+ auto request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+
+ params[strings::correlation_id] = window_id;
+
+ msg_params[strings::window_name] = window_name;
+ msg_params[strings::window_id] = window_id;
+ msg_params[strings::window_type] = window_type;
+ msg_params[strings::app_id] = kDefaultHmiAppId;
+
+ (*request)[strings::msg_params] = msg_params;
+ (*request)[strings::params] = params;
+
+ return request;
+ }
+
+ smart_objects::SmartObjectSPtr CreateStubCreateWindowResponse(
+ const int32_t correlation_id,
+ const hmi_apis::Common_Result::eType result_code) const {
+ auto response = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+
+ params[strings::correlation_id] = correlation_id;
+ params[hmi_response::code] = result_code;
+
+ (*response)[strings::params] = params;
+
+ return response;
+ }
+
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
@@ -185,6 +230,7 @@ class ResumeCtrlTest : public ::testing::Test {
const std::string kNaviLowbandwidthLevel_;
const std::string kProjectionLowbandwidthLevel_;
const std::string kMediaLowbandwidthLevel_;
+ NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
};
/**
@@ -572,12 +618,231 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) {
mobile_apis::HMILevel::HMI_FULL;
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(hmi_test_level));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, hmi_test_level));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, hmi_test_level));
const bool result = res_ctrl_->StartResumption(mock_app_, kHash_);
EXPECT_TRUE(result);
}
+TEST_F(ResumeCtrlTest,
+ RestoreAppWidgets_AppWithWidgets_SendCreateWindowRequests) {
+ using namespace smart_objects;
+ using namespace application_manager;
+ GetInfoFromApp();
+ const uint32_t count_of_widgets = 10u;
+
+ auto create_window_info_so = []() -> SmartObject {
+ SmartObject widgets_info(SmartType_Array);
+ for (uint32_t i = 0; i < count_of_widgets; ++i) {
+ SmartObject widget_info(SmartType_Map);
+ widget_info[strings::associated_service_type] = "ServiceType";
+ widget_info[strings::duplicate_updates_from_window_id] = 0;
+ widget_info[strings::window_name] =
+ std::string("Widget ") + std::to_string(i + 1);
+ widget_info[strings::window_type] =
+ static_cast<int32_t>(mobile_apis::WindowType::WIDGET);
+ widget_info[strings::window_id] = i + 1;
+ widgets_info[widgets_info.length()] = widget_info;
+ }
+ return widgets_info;
+ };
+
+ auto create_saved_app_so = [&create_window_info_so, this]() -> SmartObject {
+ smart_objects::SmartObject saved_app;
+ const auto test_app_widgets = create_window_info_so();
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = test_app_widgets;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+ return saved_app;
+ };
+
+ const auto saved_app = create_saved_app_so();
+
+ const auto hmi_request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ const auto hmi_requests =
+ smart_objects::SmartObjectList(count_of_widgets, hmi_request);
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+ EXPECT_CALL(
+ *application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, saved_app[strings::windows_info]))
+ .WillOnce(Return(hmi_requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .Times(count_of_widgets)
+ .WillRepeatedly(Return(true));
+
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+}
+
+TEST_F(ResumeCtrlTest,
+ RestoreWidgetsHMIState_AppWithWidgets_AddWidgetsInternally) {
+ const uint32_t count_of_widgets = 10u;
+
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+ smart_objects::SmartObjectList responses;
+ for (uint32_t i = 0; i < count_of_widgets; ++i) {
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = i + 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+ responses.push_back(CreateStubCreateWindowResponse(
+ window_id, hmi_apis::Common_Result::SUCCESS));
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .WillRepeatedly(Return(nullptr));
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _));
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _));
+ }
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .Times(count_of_widgets)
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ for (const auto& response : responses) {
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+ }
+}
+
+TEST_F(ResumeCtrlTest,
+ RestoreAppWidgets_AppWithoutWidgets_NoCreateWindowRqSent) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .Times(0);
+
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+}
+
+TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_InvalidCorrId) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ const int32_t invalid_corr_id = -1;
+ auto response = CreateStubCreateWindowResponse(
+ invalid_corr_id, hmi_apis::Common_Result::SUCCESS);
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _))
+ .Times(0);
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+}
+
+TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_Unsuccess) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ const int32_t correlation_id = 1;
+ auto response = CreateStubCreateWindowResponse(
+ correlation_id, hmi_apis::Common_Result::GENERIC_ERROR);
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ smart_objects::SmartObject stub_window_info(smart_objects::SmartType_Null);
+ auto stub_resume_cb = [](Application&, const smart_objects::SmartObject&) {};
+ builder.InitBuilder(stub_resume_cb, stub_window_info);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+ smart_objects::SmartObjectList responses;
+
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _))
+ .Times(0);
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+}
+
TEST_F(ResumeCtrlTest, StartResumptionOnlyHMILevel) {
smart_objects::SmartObject saved_app;
@@ -632,7 +897,8 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInFull) {
DataAccessor<application_manager::CommandsMap> data_accessor(
command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -681,7 +947,8 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppHasDeferredResumption) {
saved_app[application_manager::strings::time_stamp] = time_stamp;
// resume into deferred level instead of restored level
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, deferred_level))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, deferred_level))
.Times(AtLeast(1));
GetInfoFromApp();
ON_CALL(*mock_storage_,
@@ -716,7 +983,8 @@ TEST_F(ResumeCtrlTest,
saved_app[application_manager::strings::hmi_level] = restored_test_type;
saved_app[application_manager::strings::time_stamp] = time_stamp;
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, eType::HMI_LIMITED))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_LIMITED))
.Times(AtLeast(1));
GetInfoFromApp();
ON_CALL(*mock_storage_,
@@ -760,7 +1028,8 @@ TEST_F(
// in this test, it is expected that the app will resume into LIMITED, which
// is the higher level among NONE and LIMITED
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, eType::HMI_LIMITED))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_LIMITED))
.Times(AtLeast(1));
GetInfoFromApp();
ON_CALL(*mock_storage_,
@@ -816,7 +1085,8 @@ TEST_F(ResumeCtrlTest, RestoreAppHMIState_RestoreHMILevelFull) {
saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -847,7 +1117,8 @@ TEST_F(ResumeCtrlTest, SetupDefaultHMILevel) {
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(kDefaultTestLevel_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
res_ctrl_->SetupDefaultHMILevel(mock_app_);
@@ -876,7 +1147,8 @@ TEST_F(ResumeCtrlTest,
EXPECT_CALL(*mock_app_, is_media_application()).WillRepeatedly(Return(false));
// SetRegularState() should be called with kProjectionLowbandwidthLevel_
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, eType::HMI_NONE))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_NONE))
.Times(AtLeast(1));
res_ctrl_->SetupDefaultHMILevel(mock_app_);
@@ -903,7 +1175,8 @@ TEST_F(ResumeCtrlTest, ApplicationResumptiOnTimer_AppInFull) {
MockStateController state_controller;
EXPECT_CALL(mock_app_mngr_, state_controller())
.WillOnce(ReturnRef(state_controller));
- EXPECT_CALL(state_controller, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(state_controller,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -932,7 +1205,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMINone_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
const bool res =
res_ctrl_->SetAppHMIState(mock_app_, kDefaultTestLevel_, false);
@@ -945,7 +1219,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMILimited_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, false);
EXPECT_TRUE(res);
@@ -959,7 +1234,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, false);
@@ -974,7 +1250,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevAllowed) {
.WillByDefault(Return(policy::kDeviceAllowed));
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, true);
@@ -991,7 +1268,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevDisallowed) {
EXPECT_CALL(*mock_app_, set_is_resuming(true));
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(kDefaultTestLevel_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, true);
EXPECT_FALSE(res);
@@ -1246,7 +1524,8 @@ TEST_F(
DataAccessor<application_manager::CommandsMap> data_accessor(
command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -1353,7 +1632,8 @@ TEST_F(
DataAccessor<application_manager::CommandsMap> data_accessor(
command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
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 29718b631c..e362064a78 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -74,6 +74,7 @@ void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
CheckGlobalProporties(
resume_app_list[am::strings::application_global_properties]);
CheckSubscriptions(resume_app_list[am::strings::application_subscriptions]);
+ CheckWindowsInfo(resume_app_list[am::strings::windows_info]);
}
void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
@@ -327,6 +328,33 @@ void ResumptionDataTest::CheckVRTitle(
EXPECT_EQ(vtitle, res_list[am::strings::vr_help_title].asString());
}
+void ResumptionDataTest::CheckWindowsInfo(sm::SmartObject& res_list) {
+ using namespace application_manager;
+ auto check_window_info = [this](
+ const smart_objects::SmartObject& window_info) {
+ using namespace application_manager;
+ const WindowID saved_window_id = window_info[strings::window_id].asInt();
+ const auto test_window_info = test_window_params_map_[saved_window_id];
+ const auto& saved_window_name =
+ window_info[strings::window_name].asString();
+ ASSERT_TRUE(0 != test_window_info.use_count());
+ const auto& window_name =
+ (*test_window_info)[strings::window_name].asString();
+ const auto& saved_duplicate_window_id =
+ window_info[strings::duplicate_updates_from_window_id].asInt();
+ const auto& saved_associated_service_type =
+ window_info[strings::associated_service_type].asString();
+ EXPECT_EQ(saved_window_name, window_name);
+ EXPECT_EQ("ServiceType", saved_associated_service_type);
+ EXPECT_EQ(0, saved_duplicate_window_id);
+ };
+
+ for (size_t i = 0; i < res_list.length(); ++i) {
+ const auto& saved_window_info = res_list[i];
+ check_window_info(saved_window_info);
+ }
+}
+
void ResumptionDataTest::PrepareData() {
mock_app_extension_ =
std::make_shared<NiceMock<application_manager_test::MockAppExtension> >();
@@ -341,9 +369,14 @@ void ResumptionDataTest::PrepareData() {
DataAccessor<am::SubMenuMap> sub_menu_m(test_submenu_map, sublock_ptr_);
DataAccessor<am::CommandsMap> commands_m(test_commands_map, comlock_ptr_);
DataAccessor<am::ChoiceSetMap> choice_set_m(test_choiceset_map, setlock_ptr_);
+ DataAccessor<am::WindowParamsMap> window_params_map(
+ test_window_params_map_, window_params_map_lock_ptr_);
SetSubscriptions();
DataAccessor<am::ButtonSubscriptions> btn_sub(btn_subscr, btnlock_ptr_);
+ SetWindowsInfo();
+ SetDefaultCurrentHmiState();
+ SetDefaultWindowIds();
ON_CALL(*app_mock, is_application_data_changed()).WillByDefault(Return(true));
@@ -352,7 +385,8 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, curHash()).WillByDefault(ReturnRef(hash_));
ON_CALL(*app_mock, get_grammar_id()).WillByDefault(Return(grammar_id_));
ON_CALL(*app_mock, device()).WillByDefault(Return(device_handle_));
- ON_CALL(*app_mock, hmi_level()).WillByDefault(Return(hmi_level_));
+ ON_CALL(*app_mock, hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(hmi_level_));
ON_CALL(*app_mock, app_id()).WillByDefault(Return(app_id_));
ON_CALL(*app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id_));
ON_CALL(*app_mock, IsAudioApplication()).WillByDefault(Return(is_audio_));
@@ -375,6 +409,21 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, SubscribedButtons()).WillByDefault(Return(btn_sub));
ON_CALL(*app_mock, getAppFiles()).WillByDefault(ReturnRef(app_files_map_));
+ ON_CALL(*app_mock, window_optional_params_map())
+ .WillByDefault(Return(window_params_map));
+}
+
+void ResumptionDataTest::SetDefaultCurrentHmiState() {
+ am::HmiStatePtr hmi_state =
+ std::make_shared<am::HmiState>(app_mock, mock_application_manager_);
+ hmi_state->set_window_type(mobile_apis::WindowType::WIDGET);
+
+ ON_CALL(*app_mock, CurrentHmiState(_)).WillByDefault(Return(hmi_state));
+}
+
+void ResumptionDataTest::SetDefaultWindowIds() {
+ const am::WindowIds window_ids{1, 2, 3, 4, 5};
+ ON_CALL(*app_mock, GetWindowIds()).WillByDefault(Return(window_ids));
}
void ResumptionDataTest::SetGlobalProporties() {
@@ -550,6 +599,21 @@ void ResumptionDataTest::SetSubscriptions() {
btn_subscr.insert(ButtonName::eType::OK);
}
+void ResumptionDataTest::SetWindowsInfo() {
+ using namespace application_manager;
+ const uint32_t number_of_widgets = 5;
+ for (uint32_t i = 0; i < number_of_widgets; ++i) {
+ auto window_info = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ const WindowID window_id = i + 1;
+ (*window_info)[strings::window_name] =
+ std::string("Widget ") + std::to_string(window_id);
+ (*window_info)[strings::associated_service_type] = "ServiceType";
+ (*window_info)[strings::duplicate_updates_from_window_id] = 0;
+ test_window_params_map_[window_id] = window_info;
+ }
+}
+
} // namespace resumption_test
} // namespace components
} // namespace test
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 9621e20629..0fe40366d6 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
@@ -75,10 +75,13 @@ namespace test {
namespace components {
namespace state_controller_test {
-namespace constants {
+namespace {
const uint32_t kCorrID = 314u;
const uint32_t kHMIAppID = 2718u;
-} // namespace constants
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const am::WindowID kCustomWindowId = 2;
+} // namespace
struct HmiStatesComparator {
mobile_apis::HMILevel::eType hmi_level_;
@@ -213,7 +216,11 @@ class StateControllerImplTest : public ::testing::Test {
std::vector<am::HmiStatePtr> invalid_states_for_not_audio_app;
std::vector<am::HmiStatePtr> invalid_states_for_audio_app;
std::vector<am::HmiState::StateID> valid_state_ids_;
- std::vector<am::ApplicationSharedPtr> applications_list_;
+
+ typedef std::map<am::ApplicationSharedPtr,
+ NiceMock<application_manager_test::MockApplication>*>
+ AppPtrMockMapping;
+ AppPtrMockMapping applications_list_;
connection_handler_test::MockConnectionHandlerSettings
mock_connection_handler__settings;
@@ -554,21 +561,26 @@ class StateControllerImplTest : public ::testing::Test {
// application properties, i.e. is_media_application flag from RAI and
// AppHmiTypes (NAVIGATION, etc.). Most likely logic should be changed
// after conclusion on APPLINK-20231
- std::vector<am::ApplicationSharedPtr>::iterator app = std::find_if(
- applications_list_.begin(),
- applications_list_.end(),
- [app_id](am::ApplicationSharedPtr a) { return app_id == a->app_id(); });
-
- if (app == applications_list_.end()) {
+ AppPtrMockMapping::iterator it =
+ std::find_if(applications_list_.begin(),
+ applications_list_.end(),
+ [app_id](AppPtrMockMapping::value_type& item) {
+ return app_id == item.first->app_id();
+ });
+
+ if (applications_list_.end() == it) {
return APP_TYPE_NON_MEDIA;
}
- if ((*app)->is_navi()) {
+ auto app = it->first;
+ if (app->is_navi()) {
return APP_TYPE_NAVI;
}
- if ((*app)->is_media_application()) {
+
+ if (app->is_media_application()) {
return APP_TYPE_MEDIA;
}
+
return APP_TYPE_NON_MEDIA;
}
@@ -644,17 +656,16 @@ class StateControllerImplTest : public ::testing::Test {
template <typename T, typename Q>
void TestMixState(void (StateControllerImplTest::*call_back_result)(
std::vector<am::HmiStatePtr>&, ApplicationType)) {
- std::vector<am::ApplicationSharedPtr>::iterator it_begin =
- applications_list_.begin();
- std::vector<am::ApplicationSharedPtr>::iterator it_end =
- applications_list_.end();
+ AppPtrMockMapping::iterator it_begin = applications_list_.begin();
+ AppPtrMockMapping::iterator it_end = applications_list_.end();
ApplicationType app_type;
uint32_t app_id;
am::ApplicationSharedPtr app;
+
for (; it_begin != it_end; ++it_begin) {
- app_id = (*it_begin)->app_id();
+ app_id = it_begin->first->app_id();
app_type = AppType(app_id);
- app = (*it_begin);
+ app = it_begin->first;
am::HmiStatePtr state_first = std::make_shared<T>(app, app_manager_mock_);
am::HmiStatePtr state_second =
std::make_shared<Q>(app, app_manager_mock_);
@@ -925,14 +936,14 @@ class StateControllerImplTest : public ::testing::Test {
MEDIA,
NAVI,
VC);
- applications_list_.push_back(simple_app_);
- applications_list_.push_back(media_app_);
- applications_list_.push_back(navi_app_);
- applications_list_.push_back(vc_app_);
- applications_list_.push_back(media_navi_app_);
- applications_list_.push_back(media_vc_app_);
- applications_list_.push_back(navi_vc_app_);
- applications_list_.push_back(media_navi_vc_app_);
+ applications_list_[simple_app_] = simple_app_ptr_;
+ applications_list_[media_app_] = media_app_ptr_;
+ applications_list_[navi_app_] = navi_app_ptr_;
+ applications_list_[vc_app_] = vc_app_ptr_;
+ applications_list_[media_navi_app_] = media_navi_app_ptr_;
+ applications_list_[media_vc_app_] = media_vc_app_ptr_;
+ applications_list_[navi_vc_app_] = navi_vc_app_ptr_;
+ applications_list_[media_navi_vc_app_] = media_navi_vc_app_ptr_;
}
void CheckAppConfiguration() {
ASSERT_EQ(simple_app_.get(), simple_app_ptr_);
@@ -1044,22 +1055,36 @@ class StateControllerImplTest : public ::testing::Test {
.WillByDefault(Return(true));
}
- void ExpectSuccesfullSetHmiState(
+ void ExpectSuccessfulSetHmiState(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr old_state,
+ am::HmiStatePtr new_state) {
+ ExpectSuccessfulSetHmiState(
+ app, app_mock, kDefaultWindowId, old_state, new_state);
+ }
+
+ void ExpectSuccessfulSetHmiState(
am::ApplicationSharedPtr app,
NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::WindowID window_id,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
- EXPECT_CALL(*app_mock, CurrentHmiState())
+ EXPECT_CALL(*app_mock, CurrentHmiState(window_id))
.WillOnce(Return(old_state))
.WillOnce(Return(new_state));
- EXPECT_CALL(*app_mock,
- SetRegularState(Truly(HmiStatesComparator(new_state))));
+ EXPECT_CALL(
+ *app_mock,
+ SetRegularState(window_id, Truly(HmiStatesComparator(new_state))));
if (!HmiStatesComparator(old_state)(new_state)) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app));
- EXPECT_CALL(
- app_manager_mock_,
- OnHMILevelChanged(
- app->app_id(), old_state->hmi_level(), new_state->hmi_level()));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(app, window_id, _));
+ if (kDefaultWindowId == window_id) {
+ EXPECT_CALL(
+ app_manager_mock_,
+ OnHMILevelChanged(
+ app->app_id(), old_state->hmi_level(), new_state->hmi_level()));
+ }
}
}
@@ -1068,22 +1093,33 @@ class StateControllerImplTest : public ::testing::Test {
NiceMock<application_manager_test::MockApplication>* app_mock,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
- EXPECT_CALL(*app_mock, RegularHmiState())
+ EXPECT_CALL(*app_mock, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(old_state))
.WillOnce(Return(old_state));
- ExpectSuccesfullSetHmiState(app, app_mock, old_state, new_state);
+ ExpectSuccessfulSetHmiState(app, app_mock, old_state, new_state);
}
void ExpectAppWontChangeHmiStateDueToConflictResolving(
am::ApplicationSharedPtr app,
NiceMock<application_manager_test::MockApplication>* app_mock,
+ const am::WindowID window_id,
am::HmiStatePtr state) {
- ON_CALL(*app_mock, RegularHmiState()).WillByDefault(Return(state));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app)).Times(0);
+ ON_CALL(*app_mock, RegularHmiState(window_id)).WillByDefault(Return(state));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(app, window_id, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(app->app_id(), _, _))
.Times(0);
}
+ void ExpectAppWontChangeHmiStateDueToConflictResolving(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr state) {
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ app, app_mock, kDefaultWindowId, state);
+ }
+
void InsertApplication(am::ApplicationSharedPtr app) {
application_set_.insert(app);
ON_CALL(app_manager_mock_, application(app->app_id()))
@@ -1135,13 +1171,14 @@ class StateControllerImplTest : public ::testing::Test {
using smart_objects::SmartObject;
namespace FunctionID = hmi_apis::FunctionID;
- EXPECT_CALL(app_mock, CurrentHmiState())
+ EXPECT_CALL(app_mock, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(NoneNotAudibleState()));
for (size_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
EXPECT_CALL(app_mock,
- AddHMIState(Truly(HmiStatesIDComparator(state_id))));
+ AddHMIState(kDefaultWindowId,
+ Truly(HmiStatesIDComparator(state_id))));
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_start_event(FunctionID::VR_Started);
@@ -1182,7 +1219,7 @@ class StateControllerImplTest : public ::testing::Test {
default:
break;
}
- EXPECT_CALL(app_mock, AddHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, AddHMIState(kDefaultWindowId, _)).Times(0);
}
}
@@ -1194,12 +1231,17 @@ class StateControllerImplTest : public ::testing::Test {
using smart_objects::SmartObject;
namespace FunctionID = hmi_apis::FunctionID;
- EXPECT_CALL(app_mock, CurrentHmiState())
+ EXPECT_CALL(app_mock, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(NoneNotAudibleState()));
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(app_mock, GetWindowIds()).WillRepeatedly(Return(window_ids));
+
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
- EXPECT_CALL(app_mock, AddHMIState(Truly(HmiStatesIDComparator(state_id))))
+ EXPECT_CALL(
+ app_mock,
+ AddHMIState(kDefaultWindowId, Truly(HmiStatesIDComparator(state_id))))
.Times(1);
switch (state_id) {
@@ -1243,16 +1285,17 @@ class StateControllerImplTest : public ::testing::Test {
break;
}
- EXPECT_CALL(app_mock, AddHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, AddHMIState(kDefaultWindowId, _)).Times(0);
}
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
- EXPECT_CALL(app_mock, RemoveHMIState(state_id)).Times(1);
+ EXPECT_CALL(app_mock, RemoveHMIState(kDefaultWindowId, state_id))
+ .Times(1);
- EXPECT_CALL(app_mock, PostponedHmiState())
+ EXPECT_CALL(app_mock, PostponedHmiState(kDefaultWindowId))
.WillOnce(Return(NoneNotAudibleState()));
- EXPECT_CALL(app_mock, RemovePostponedState());
+ EXPECT_CALL(app_mock, RemovePostponedState(kDefaultWindowId));
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
@@ -1295,7 +1338,7 @@ class StateControllerImplTest : public ::testing::Test {
break;
}
- EXPECT_CALL(app_mock, RemoveHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, RemoveHMIState(kDefaultWindowId, _)).Times(0);
}
}
};
@@ -1307,6 +1350,7 @@ TEST_F(StateControllerImplTest, OnStateChangedWithEqualStates) {
for (uint32_t i = 0; i < valid_states_for_not_audio_app_.size(); ++i) {
state_ctrl_->OnStateChanged(simple_app_,
+ kDefaultWindowId,
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[i]);
}
@@ -1317,8 +1361,9 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
for (uint32_t j = 0; j < valid_states_for_not_audio_app_.size(); ++j) {
HmiStatesComparator comp(valid_states_for_not_audio_app_[i]);
if (!comp(valid_states_for_not_audio_app_[j])) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
- .Times(1);
+ EXPECT_CALL(
+ message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(
app_manager_mock_,
OnHMILevelChanged(simple_app_id_,
@@ -1330,10 +1375,12 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
}
state_ctrl_->OnStateChanged(simple_app_,
+ kDefaultWindowId,
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[j]);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
+ EXPECT_CALL(message_helper_mock_, SendHMIStatusNotification(_, _, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
}
@@ -1356,10 +1403,12 @@ TEST_F(StateControllerImplTest, OnStateChangedToNone) {
SystemContext::SYSCTXT_MAIN);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- state_ctrl_->OnStateChanged(simple_app_, none_state, not_none_state);
+ state_ctrl_->OnStateChanged(
+ simple_app_, kDefaultWindowId, none_state, not_none_state);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
- state_ctrl_->OnStateChanged(simple_app_, not_none_state, none_state);
+ state_ctrl_->OnStateChanged(
+ simple_app_, kDefaultWindowId, not_none_state, none_state);
}
TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
@@ -1377,18 +1426,21 @@ TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
it != valid_states_for_not_audio_app_.end();
++it) {
HmiStatePtr state_to_setup = *it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_,
OnHMILevelChanged(simple_app_id_,
initial_state->hmi_level(),
state_to_setup->hmi_level()));
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_->SetRegularState(simple_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_setup))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1413,18 +1465,21 @@ TEST_F(StateControllerImplTest, MoveAudioNotResumeAppToValidStates) {
it != valid_states_for_audio_app_.end();
++it) {
HmiStatePtr state_to_setup = *it;
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
+ EXPECT_CALL(*audio_app_mock, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(audio_app, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_,
OnHMILevelChanged(audio_app->app_id(),
initial_state->hmi_level(),
state_to_setup->hmi_level()));
EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_setup))));
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1452,7 +1507,7 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
HmiStatePtr state_to_setup = *it;
HmiStatePtr state_to_check = state_to_setup;
// First time current state is initial, then it changes to setup state
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
+ EXPECT_CALL(*audio_app_mock, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
// Audio resume app when HMI level is LIMITED or FULL gets audible state
@@ -1480,8 +1535,10 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
// Check that we set correct state
EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(state_to_check))));
- state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_check))));
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1494,11 +1551,13 @@ TEST_F(StateControllerImplTest, MoveAppFromValidStateToInvalid) {
invalid_state_it != common_invalid_states_.end();
++invalid_state_it) {
HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
EXPECT_CALL(*simple_app_ptr_, is_resuming()).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_->SetRegularState(simple_app_, invalid_state, false);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, invalid_state, false);
}
for (std::vector<HmiStatePtr>::iterator invalid_state_it =
@@ -1506,11 +1565,14 @@ TEST_F(StateControllerImplTest, MoveAppFromValidStateToInvalid) {
invalid_state_it != common_invalid_states_.end();
++invalid_state_it) {
HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .Times(0);
EXPECT_CALL(*media_navi_vc_app_ptr_, is_resuming()).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_->SetRegularState(media_navi_vc_app_, invalid_state, false);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, invalid_state, false);
}
}
@@ -1532,7 +1594,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1540,7 +1602,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
@@ -1557,14 +1620,15 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1583,14 +1647,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1607,7 +1672,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1615,7 +1680,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1633,7 +1699,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1641,7 +1707,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1660,7 +1727,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
@@ -1668,7 +1735,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1686,14 +1754,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1712,14 +1781,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
@@ -1743,7 +1813,7 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
InsertApplication(limited_app1);
InsertApplication(limited_app2);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1753,7 +1823,8 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app2, limited_app2_mock, LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1778,7 +1849,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1789,7 +1860,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1814,7 +1886,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1825,7 +1897,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(
@@ -1851,7 +1924,7 @@ TEST_F(
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1862,7 +1935,8 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(
@@ -1888,7 +1962,7 @@ TEST_F(
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1899,7 +1973,8 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1912,19 +1987,20 @@ TEST_F(StateControllerImplTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ ExpectSuccessfulSetHmiState(media_navi_vc_app_,
media_navi_vc_app_ptr_,
BackgroundState(),
FullAudibleState());
- EXPECT_CALL(*media_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
ExpectAppChangeHmiStateDueToConflictResolving(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1937,19 +2013,20 @@ TEST_F(StateControllerImplTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ ExpectSuccessfulSetHmiState(media_navi_vc_app_,
media_navi_vc_app_ptr_,
BackgroundState(),
FullAudibleState());
- EXPECT_CALL(*media_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
ExpectAppChangeHmiStateDueToConflictResolving(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, FullAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
// TODO {AKozoriz} Changed logic in state_controller
@@ -1992,9 +2069,9 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(media_app_));
- ExpectSuccesfullSetHmiState(
+ ExpectSuccessfulSetHmiState(
media_app_, media_app_ptr_, initial_hmi_state, hmi_state);
- state_ctrl_->SetRegularState(media_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(media_app_, kDefaultWindowId, hmi_state, true);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] =
Common_Result::SUCCESS;
@@ -2050,9 +2127,10 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) {
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
@@ -2078,13 +2156,14 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) {
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(simple_app_->app_id(), _, _))
.Times(0);
SetBCActivateAppRequestToHMI(Common_HMILevel::FULL, corr_id);
- state_ctrl_->SetRegularState(simple_app_, FullNotAudibleState(), true);
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, FullNotAudibleState(), true);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] = Common_Result::SUCCESS;
message[am::strings::params][am::strings::correlation_id] = corr_id;
@@ -2510,43 +2589,43 @@ TEST_F(StateControllerImplTest, SetRegularStateWithNewHmiLvl) {
using namespace mobile_apis;
HMILevel::eType set_lvl = HMILevel::HMI_NONE;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_LIMITED;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_FULL;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
const uint32_t corr_id = 314;
SetBCActivateAppRequestToHMI(
static_cast<hmi_apis::Common_HMILevel::eType>(set_lvl), corr_id);
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_BACKGROUND;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
}
TEST_F(StateControllerImplTest, SetRegularStateWithAudioStateAudible) {
@@ -2556,16 +2635,18 @@ TEST_F(StateControllerImplTest, SetRegularStateWithAudioStateAudible) {
AudioStreamingState::AUDIBLE,
VideoStreamingState::STREAMABLE,
SystemContext::SYSCTXT_MAIN);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillRepeatedly(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
AudioStreamingState::AUDIBLE,
VideoStreamingState::STREAMABLE);
}
@@ -2582,23 +2663,27 @@ TEST_F(StateControllerImplTest,
// Non-media app can't have LIMITED-AUDIO state
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
check_state = LimitedState();
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
@@ -2615,7 +2700,7 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
HmiStatePtr check_state = FullNotAudibleState();
// Non-media app can't have LIMITED-AUDIO state
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
@@ -2625,16 +2710,19 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
SendOnResumeAudioSourceToHMI(simple_app_id_, _))
.Times(0);
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))))
.Times(0);
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
// Set state of media app after vr has stopped
check_state = LimitedState();
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
@@ -2643,11 +2731,14 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
EXPECT_CALL(message_helper_mock_,
SendOnResumeAudioSourceToHMI(media_app_id_, _));
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))))
.Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2670,28 +2761,32 @@ TEST_F(StateControllerImplTest,
HmiStatePtr check_state = FullNotAudibleState();
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
// Set media app
check_state = LimitedState();
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*media_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2724,8 +2819,10 @@ TEST_F(StateControllerImplTest,
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2753,13 +2850,13 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- state_ctrl_->SetRegularState(navi_app_, hmi_state, false);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2787,15 +2884,15 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*navi_app_ptr_, SetPostponedState(_)).Times(0);
+ EXPECT_CALL(*navi_app_ptr_, SetPostponedState(kDefaultWindowId, _)).Times(0);
- state_ctrl_->SetRegularState(navi_app_, hmi_state, false);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2803,7 +2900,6 @@ TEST_F(StateControllerImplTest,
using namespace hmi_apis;
using namespace smart_objects;
using namespace am::event_engine;
- using namespace constants;
const uint32_t app_id = navi_app_->app_id();
// Precondition
@@ -2827,13 +2923,13 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- state_ctrl_->SetRegularState(navi_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, true);
}
TEST_F(StateControllerImplTest,
@@ -2841,7 +2937,6 @@ TEST_F(StateControllerImplTest,
using namespace hmi_apis;
using namespace smart_objects;
using namespace am::event_engine;
- using namespace constants;
const uint32_t app_id = navi_app_->app_id();
// Precondition
@@ -2865,15 +2960,15 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*navi_app_ptr_, SetPostponedState(_)).Times(0);
+ EXPECT_CALL(*navi_app_ptr_, SetPostponedState(kDefaultWindowId, _)).Times(0);
- state_ctrl_->SetRegularState(navi_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, true);
}
TEST_F(StateControllerImplTest,
@@ -2894,13 +2989,16 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(*simple_app_ptr_, keep_context()).WillOnce(Return(true));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(FullAudibleState()));
EXPECT_CALL(*simple_app_ptr_, set_keep_context(false));
HmiStatePtr new_state;
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_))
- .WillOnce(SaveArg<0>(&new_state));
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
state_ctrl_->on_event(event);
@@ -2925,12 +3023,15 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
HmiStatePtr new_state;
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_))
- .WillOnce(SaveArg<0>(&new_state));
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
state_ctrl_->on_event(event);
@@ -2949,9 +3050,13 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) {
event.set_smart_object(msg);
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -2965,7 +3070,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) {
const am::ApplicationSharedPtr incorrect_app;
EXPECT_CALL(app_manager_mock_, application(_))
.WillOnce(Return(incorrect_app));
- EXPECT_CALL(*simple_app_ptr_, hmi_level()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)).Times(0);
state_ctrl_->on_event(event);
}
@@ -2986,15 +3091,20 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) {
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
// DeactivateApp
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -3015,16 +3125,21 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) {
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
// DeactivateApp
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -3044,25 +3159,35 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) {
}
TEST_F(StateControllerImplTest, OnEventOnAppActivated) {
- using namespace constants;
-
smart_objects::SmartObject msg;
- for (std::vector<am::ApplicationSharedPtr>::const_iterator it =
- applications_list_.begin();
+ am::WindowIds window_ids = {kDefaultWindowId};
+
+ for (AppPtrMockMapping::const_iterator it = applications_list_.begin();
it != applications_list_.end();
++it) {
- uint32_t app_id = (*it)->app_id();
+ uint32_t app_id = it->first->app_id();
msg[am::strings::msg_params][am::strings::app_id] = app_id;
const hmi_apis::FunctionID::eType event_id =
hmi_apis::FunctionID::BasicCommunication_OnAppActivated;
am::event_engine::Event event(event_id);
event.set_smart_object(msg);
- EXPECT_CALL(app_manager_mock_, application(app_id)).WillOnce(Return(*it));
+ EXPECT_CALL(app_manager_mock_, application(app_id))
+ .WillOnce(Return(it->first));
// SetRegularState
- EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
- .WillRepeatedly(Return(true));
+ EXPECT_CALL(*it->second, app_id()).WillRepeatedly(Return(app_id));
+ EXPECT_CALL(*it->second, IsAudioApplication()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*it->second, GetWindowIds()).WillOnce(Return(window_ids));
+
+ const am::HmiStatePtr old_state =
+ CreateHmiStateByHmiStateType<am::HmiState>(
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ mobile_apis::VideoStreamingState::NOT_STREAMABLE,
+ mobile_apis::SystemContext::SYSCTXT_MAIN,
+ simple_app_);
+ EXPECT_CALL(*it->second, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
smart_objects::SmartObjectSPtr activate_app =
std::make_shared<smart_objects::SmartObject>();
@@ -3143,9 +3268,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
simple_app_);
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_)).Times(4);
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _)).Times(4);
const am::HmiStatePtr default_state =
CreateHmiStateByHmiStateType<am::HmiState>(
@@ -3155,12 +3280,14 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
mobile_apis::SystemContext::SYSCTXT_MAIN,
simple_app_);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _));
state_ctrl_->OnApplicationRegistered(simple_app_,
@@ -3194,9 +3321,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
simple_app_);
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_)).Times(2);
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _)).Times(2);
const am::HmiStatePtr default_state =
CreateHmiStateByHmiStateType<am::HmiState>(
@@ -3205,9 +3332,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
mobile_apis::SystemContext::SYSCTXT_MAIN,
simple_app_);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(default_state));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
@@ -3218,6 +3345,328 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
mobile_apis::HMILevel::HMI_BACKGROUND);
}
+TEST_F(
+ StateControllerImplTest,
+ SetRegularState_AppIsResumingAndAudioSourceIsActive_HmiStateIsNotChanged) {
+ am::event_engine::Event audio_source_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+ audio_source_event.set_smart_object(message);
+ state_ctrl_->on_event(audio_source_event);
+
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const am::HmiStatePtr new_state = FullAudibleState();
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_BcActivateAppSendFailed_HmiLevelIsNotChanged) {
+ const am::HmiStatePtr new_state = FullAudibleState();
+ SetBCActivateAppRequestToHMI(
+ static_cast<hmi_apis::Common_HMILevel::eType>(new_state->hmi_level()),
+ kCorrID);
+
+ smart_objects::SmartObjectSPtr bc_activate_app_request;
+ EXPECT_CALL(message_helper_mock_, GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .WillOnce(Return(bc_activate_app_request));
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetLevelAudioAndVideoState_HmiStateIsChanged) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = BackgroundState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ const bool send_activate_app = false;
+ state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
+ new_state->hmi_level(),
+ new_state->audio_streaming_state(),
+ new_state->video_streaming_state(),
+ send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetLevelAudioVideoStatesAndContext_HmiStateIsChanged) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = BackgroundState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ const bool send_activate_app = false;
+ state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
+ new_state->hmi_level(),
+ new_state->audio_streaming_state(),
+ new_state->video_streaming_state(),
+ new_state->system_context(),
+ send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetSystemContextOnly_HmiStateIsChanged) {
+ HmiStatePtr old_state = FullAudibleState();
+ HmiStatePtr new_state = FullNotAudibleState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, new_state->system_context());
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppActivated_ActivateNotExistingWindow_HmiLevelIsNotChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ simple_app_, simple_app_ptr_, kCustomWindowId, NoneNotAudibleState());
+
+ state_ctrl_->on_event(activate_widget_event);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppActivated_ActivateCustomWindow_HmiStateIsChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ std::vector<std::pair<HmiStatePtr, HmiStatePtr> > states_transition = {
+ std::make_pair(NoneNotAudibleState(), BackgroundState()),
+ std::make_pair(BackgroundState(), FullNotAudibleState())};
+
+ for (auto& states_pair : states_transition) {
+ HmiStatePtr old_state = states_pair.first;
+ HmiStatePtr new_state = states_pair.second;
+
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kCustomWindowId))
+ .WillOnce(Return(old_state->hmi_level()));
+ EXPECT_CALL(*simple_app_ptr_, audio_streaming_state())
+ .WillOnce(Return(old_state->audio_streaming_state()));
+ EXPECT_CALL(*simple_app_ptr_, video_streaming_state())
+ .WillOnce(Return(old_state->video_streaming_state()));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, kCustomWindowId, old_state, new_state);
+
+ EXPECT_CALL(message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .Times(0);
+
+ state_ctrl_->on_event(activate_widget_event);
+ }
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppDeactivated_DeactivateNotExistingWindow_HmiStateIsNotChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ simple_app_, simple_app_ptr_, kCustomWindowId, FullNotAudibleState());
+
+ state_ctrl_->on_event(activate_widget_event);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppDeactivated_DeactivateCustomWindow_HmiStateIsChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ std::vector<std::pair<HmiStatePtr, HmiStatePtr> > states_transition = {
+ std::make_pair(FullNotAudibleState(), BackgroundState()),
+ std::make_pair(BackgroundState(), NoneNotAudibleState())};
+
+ for (auto& states_pair : states_transition) {
+ HmiStatePtr old_state = states_pair.first;
+ HmiStatePtr new_state = states_pair.second;
+
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kCustomWindowId))
+ .WillOnce(Return(old_state->hmi_level()));
+ EXPECT_CALL(*simple_app_ptr_, audio_streaming_state())
+ .WillOnce(Return(old_state->audio_streaming_state()));
+ EXPECT_CALL(*simple_app_ptr_, video_streaming_state())
+ .WillOnce(Return(old_state->video_streaming_state()));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, kCustomWindowId, old_state, new_state);
+
+ EXPECT_CALL(message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .Times(0);
+
+ state_ctrl_->on_event(activate_widget_event);
+ }
+}
+
+TEST_F(
+ StateControllerImplTest,
+ ActivateDefaultWindow_AppWithWindowWasActivated_WindowStreamingStateIsUpdated) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = FullAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state))
+ .WillRepeatedly(Return(new_state));
+ ExpectSuccessfulSetHmiState(
+ media_app_, media_app_ptr_, kDefaultWindowId, old_state, new_state);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*media_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+
+ HmiStatePtr expected_window_state = NoneNotAudibleState();
+ expected_window_state->set_audio_streaming_state(
+ new_state->audio_streaming_state());
+ expected_window_state->set_video_streaming_state(
+ new_state->video_streaming_state());
+
+ EXPECT_CALL(
+ *media_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_window_state))));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+
+ state_ctrl_->ActivateDefaultWindow(media_app_);
+}
+
+TEST_F(StateControllerImplTest,
+ ExitDefaultWindow_AppWithWindowWasExited_WindowStreamingStateIsUpdated) {
+ HmiStatePtr old_state = FullAudibleState();
+ HmiStatePtr new_state = NoneNotAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state))
+ .WillRepeatedly(Return(new_state));
+ ExpectSuccessfulSetHmiState(
+ media_app_, media_app_ptr_, kDefaultWindowId, old_state, new_state);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*media_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+
+ HmiStatePtr expected_window_state = FullAudibleState();
+ expected_window_state->set_audio_streaming_state(
+ new_state->audio_streaming_state());
+ expected_window_state->set_video_streaming_state(
+ new_state->video_streaming_state());
+
+ EXPECT_CALL(
+ *media_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_window_state))));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+
+ state_ctrl_->ExitDefaultWindow(media_app_);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppWindowAdded_NewAppWindowWasAdded_HmiNotificationIsSent) {
+ am::event_engine::Event audio_source_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+ audio_source_event.set_smart_object(message);
+ state_ctrl_->on_event(audio_source_event);
+
+ HmiStatePtr initial_state =
+ createHmiState(mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM);
+ HmiStatePtr expected_state = NoneNotAudibleState();
+
+ EXPECT_CALL(*simple_app_ptr_,
+ AddHMIState(kCustomWindowId,
+ Truly(HmiStatesIDComparator(
+ HmiState::StateID::STATE_ID_AUDIO_SOURCE))));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(initial_state));
+ EXPECT_CALL(*simple_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_state))));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kCustomWindowId))
+ .WillOnce(Return(initial_state))
+ .WillOnce(Return(expected_state));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kCustomWindowId, _));
+ EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+
+ state_ctrl_->OnAppWindowAdded(simple_app_,
+ kCustomWindowId,
+ mobile_apis::WindowType::WIDGET,
+ mobile_apis::HMILevel::HMI_NONE);
+}
+
} // namespace state_controller_test
} // namespace components
} // namespace test
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index 8e45d4ecd9..52fb3d35df 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -139,7 +139,7 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("RC.OnInteriorVehicleData");
MessageBrokerController::subscribeTo("RC.OnRemoteControlSettings");
MessageBrokerController::subscribeTo(
- "SystemCapability.OnSystemCapabilityUpdated");
+ "BasicCommunication.OnSystemCapabilityUpdated");
LOG4CXX_INFO(logger_, "Subscribed to notifications.");
}
diff --git a/src/components/include/application_manager/application_manager.h b/src/components/include/application_manager/application_manager.h
index e03fdcfb94..1e17974da4 100644
--- a/src/components/include/application_manager/application_manager.h
+++ b/src/components/include/application_manager/application_manager.h
@@ -281,15 +281,6 @@ class ApplicationManager {
mobile_apis::HMILevel::eType to) = 0;
/**
- * @brief Sends HMI status notification to mobile
- *
- * @param application_impl application with changed HMI status
- *
- **/
- virtual void SendHMIStatusNotification(
- const std::shared_ptr<Application> app) = 0;
-
- /**
* @brief Checks if driver distraction state is valid, creates message
* which is sent to the application if allowed, otherwise it is added
* to a list of postponed messages.
@@ -609,8 +600,8 @@ class ApplicationManager {
/**
* @brief Checks, if given RPC is allowed at current HMI level for specific
* application in policy table
- * @param policy_app_id Application id
- * @param hmi_level Current HMI level of application
+ * @param app Application
+ * @param window_id id of application's window
* @param function_id FunctionID of RPC
* @param params_permissions Permissions for RPC parameters (e.g.
* SubscribeVehicleData) defined in policy table
@@ -618,6 +609,7 @@ class ApplicationManager {
*/
virtual mobile_apis::Result::eType CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions = NULL) = 0;
@@ -711,6 +703,7 @@ class ApplicationManager {
/**
* @brief CreateRegularState create regular HMI state for application
* @param app Application
+ * @param window_type type of window
* @param hmi_level of returned state
* @param audio_state of returned state
* @param system_context of returned state
@@ -718,10 +711,11 @@ class ApplicationManager {
*/
virtual HmiStatePtr CreateRegularState(
std::shared_ptr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const = 0;
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const = 0;
/**
* @brief Checks if application can stream (streaming service is started and
diff --git a/src/components/include/application_manager/hmi_capabilities.h b/src/components/include/application_manager/hmi_capabilities.h
index ee3a2f4b4c..a30625347d 100644
--- a/src/components/include/application_manager/hmi_capabilities.h
+++ b/src/components/include/application_manager/hmi_capabilities.h
@@ -63,9 +63,9 @@ class HMICapabilities {
virtual HMILanguageHandler& get_hmi_language_handler() = 0;
/*
- * @brief Checks is image type(Static/Dynamic) requested by
+ * @brief Checks if image type(Static/Dynamic) requested by
* Mobile Device is supported on current HMI.
- * @param image_type recieved type of image from Enum.
+ * @param image_type received type of image from Enum.
* @return Bool true if supported
*/
virtual bool VerifyImageType(const int32_t image_type) const = 0;
@@ -230,6 +230,20 @@ class HMICapabilities {
const smart_objects::SmartObject& display_capabilities) = 0;
/*
+ * @brief Retrieves information about the display capability
+ * @return Currently supported display capability
+ */
+ virtual const smart_objects::SmartObjectSPtr system_display_capabilities()
+ const = 0;
+
+ /*
+ * @brief Sets supported display capability
+ * @param display_capabilities supported display capability
+ */
+ virtual void set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) = 0;
+
+ /*
* @brief Retrieves information about the HMI zone capabilities
*
* @return Currently supported HMI zone capabilities
diff --git a/src/components/include/application_manager/policies/policy_handler_interface.h b/src/components/include/application_manager/policies/policy_handler_interface.h
index 3387ed2fc6..75655f7f08 100644
--- a/src/components/include/application_manager/policies/policy_handler_interface.h
+++ b/src/components/include/application_manager/policies/policy_handler_interface.h
@@ -91,6 +91,7 @@ class PolicyHandlerInterface {
std::string* priority) const = 0;
virtual void CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) = 0;
diff --git a/src/components/include/application_manager/state_controller.h b/src/components/include/application_manager/state_controller.h
index fa0d65eb0c..2fa4b0c218 100644
--- a/src/components/include/application_manager/state_controller.h
+++ b/src/components/include/application_manager/state_controller.h
@@ -41,48 +41,145 @@
namespace application_manager {
class StateController {
public:
+ /**
+ * @brief SetRegularState setup regular hmi state, that will appear if
+ * no specific events are active
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param state state of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state,
const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Change regular hmi level and audio state
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @paran video_state of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Change regular hmi level
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Change regular hmi level, audio state and system
+ * context
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param video_state of new regular state
+ * @param system_context of new regular state
+ * @param request_hmi_state_change: if true, ActivateAppRequest or
+ * CloseApplication will be sent to HMI dependent on hmi level of resolved hmi
+ * state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
const bool request_hmi_state_change) = 0;
+ /**
+ * @brief SetRegularState Sets regular state with new hmi level
+ * to application
+ * @param app appication to setup regular state
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param hmi_level new hmi level for application
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level) = 0;
+ /**
+ * @brief SetRegularState Change regular audio state
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param audio_state of new regular state
+ * @param video_state of new regular state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) = 0;
+ /**
+ * @brief SetRegularState Change regular system context
+ * @param app appication to setup regular State
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param system_context of new regular state
+ */
virtual void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::SystemContext::eType system_context) = 0;
- virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) = 0;
+ /**
+ * @brief SetRegularState Sets new regular state to application
+ * @param app appication to setup regular state
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param state new hmi state for application
+ */
+ virtual void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state) = 0;
+ /**
+ * @brief Sets default application state and apply currently active HMI states
+ * on application registration
+ * @param app application to apply states
+ * @param default_level default HMI level
+ */
virtual void OnApplicationRegistered(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) = 0;
/**
+ * @brief OnAppWidgetAdded Sets default state for widget and apply currently
+ * active HMI states
+ * @param app application to apply states
+ * @param window_id id of window to add
+ * @param default_level default HMI level
+ */
+ virtual void OnAppWindowAdded(
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) = 0;
+
+ /**
* @brief OnVideoStreamingStarted process video streaming started
* @param app projection or navigation application starting streaming
*/
@@ -93,12 +190,41 @@ class StateController {
* @param app projection or navigation application stopping streaming
*/
virtual void OnVideoStreamingStopped(ApplicationConstSharedPtr app) = 0;
+
+ /**
+ * @brief OnStateChanged send HMIStatusNotification if needed
+ * @param app application
+ * @param window_id id of applicaion's window to apply HMI state
+ * @param old_state state before change
+ * @param new_state state after change
+ */
virtual void OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr old_state,
HmiStatePtr new_state) = 0;
+ /**
+ * @brief Checks activity of Deactivate HMI state.
+ * @return Returns TRUE if deactivate HMI state is active, otherwise returns
+ * FALSE.
+ */
virtual bool IsStateActive(HmiState::StateID state_id) const = 0;
+
+ /**
+ * @brief ActivateDefaultWindow performs set of actions required for a proper
+ * application activation (i.e. main window activation)
+ * @param app pointer to application to be activated
+ */
+ virtual void ActivateDefaultWindow(ApplicationSharedPtr app) = 0;
+
+ /**
+ * @brief ExitDefaultWindow performs set of action required for a proper
+ * application exiting (i.e. main window exit)
+ * @param app pointer to application to be exited
+ */
+ virtual void ExitDefaultWindow(ApplicationSharedPtr app) = 0;
};
+
} // namespace application_manager
#endif // SRC_COMPONENTS_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
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 1579341be7..60ee73c996 100644
--- a/src/components/include/test/application_manager/mock_application_manager.h
+++ b/src/components/include/test/application_manager/mock_application_manager.h
@@ -248,9 +248,10 @@ class MockApplicationManager : public application_manager::ApplicationManager {
MOCK_CONST_METHOD2(HMILevelAllowsStreaming,
bool(uint32_t app_id,
protocol_handler::ServiceType service_type));
- MOCK_METHOD4(CheckPolicyPermissions,
+ MOCK_METHOD5(CheckPolicyPermissions,
mobile_apis::Result::eType(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const std::string& function_id,
const application_manager::RPCParams& rpc_params,
application_manager::CommandParametersPermissions*
@@ -277,9 +278,10 @@ class MockApplicationManager : public application_manager::ApplicationManager {
void(uint32_t app_id,
protocol_handler::ServiceType service_type,
bool state));
- MOCK_CONST_METHOD5(CreateRegularState,
+ MOCK_CONST_METHOD6(CreateRegularState,
application_manager::HmiStatePtr(
application_manager::ApplicationSharedPtr app,
+ const mobile_apis::WindowType::eType window_type,
mobile_apis::HMILevel::eType hmi_level,
mobile_apis::AudioStreamingState::eType audio_state,
mobile_apis::VideoStreamingState::eType video_state,
diff --git a/src/components/include/test/application_manager/mock_state_controller.h b/src/components/include/test/application_manager/mock_state_controller.h
index 20a84e7f00..545090bf30 100644
--- a/src/components/include/test/application_manager/mock_state_controller.h
+++ b/src/components/include/test/application_manager/mock_state_controller.h
@@ -46,55 +46,68 @@ namespace am = application_manager;
class MockStateController : public am::StateController {
public:
- MOCK_METHOD3(SetRegularState,
+ MOCK_METHOD4(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
am::HmiStatePtr state,
const bool request_hmi_state_change));
- MOCK_METHOD5(SetRegularState,
+ MOCK_METHOD6(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const bool request_hmi_state_change));
- MOCK_METHOD3(SetRegularState,
+ MOCK_METHOD4(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const bool request_hmi_state_change));
- MOCK_METHOD6(SetRegularState,
+ MOCK_METHOD7(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
const bool request_hmi_state_change));
- MOCK_METHOD2(SetRegularState,
+ MOCK_METHOD3(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level));
- MOCK_METHOD3(SetRegularState,
+ MOCK_METHOD4(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state));
- MOCK_METHOD2(SetRegularState,
+ MOCK_METHOD3(SetRegularState,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
const mobile_apis::SystemContext::eType system_context));
- MOCK_METHOD2(SetRegularState,
- void(am::ApplicationSharedPtr app, am::HmiStatePtr state));
+ MOCK_METHOD3(SetRegularState,
+ void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
+ am::HmiStatePtr state));
MOCK_METHOD2(OnApplicationRegistered,
void(am::ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level));
- MOCK_METHOD3(RequestHMIStateChange,
- int64_t(am::ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority));
+ MOCK_METHOD4(OnAppWindowAdded,
+ void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level));
MOCK_METHOD1(OnVideoStreamingStarted,
void(am::ApplicationConstSharedPtr app));
MOCK_METHOD1(OnVideoStreamingStopped,
void(am::ApplicationConstSharedPtr app));
- MOCK_METHOD3(OnStateChanged,
+ MOCK_METHOD4(OnStateChanged,
void(am::ApplicationSharedPtr app,
+ const am::WindowID window_id,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state));
MOCK_CONST_METHOD1(IsStateActive, bool(am::HmiState::StateID state_id));
+ MOCK_METHOD1(ActivateDefaultWindow, void(am::ApplicationSharedPtr app));
+ MOCK_METHOD1(ExitDefaultWindow, void(am::ApplicationSharedPtr app));
};
} // namespace application_manager_test
diff --git a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
index 36a9ab4c4c..a2ec715dbf 100644
--- a/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
+++ b/src/components/include/test/application_manager/policies/mock_policy_handler_interface.h
@@ -79,8 +79,9 @@ class MockPolicyHandlerInterface : public policy::PolicyHandlerInterface {
MOCK_CONST_METHOD2(GetPriority,
bool(const std::string& policy_app_id,
std::string* priority));
- MOCK_METHOD4(CheckPermissions,
+ MOCK_METHOD5(CheckPermissions,
void(const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const policy::PTString& rpc,
const application_manager::RPCParams& rpc_params,
policy::CheckPermissionResult& result));
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index a13f0049e1..df7fbbfbad 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -66,6 +66,28 @@
<element name="READ_ONLY" value="26"/>
</enum>
+<enum name="WindowType">
+ <element name="MAIN">
+ <description>
+ This window type describes the main screen on a display.
+ </description>
+ </element>
+ <element name="WIDGET">
+ <description>
+ A widget is a small window that the app can create to provide information and softbuttons for a quick app control.
+ </description>
+ </element>
+</enum>
+
+<enum name="PredefinedWindows">
+ <element name="DEFAULT_WINDOW" value="0">
+ <description>The default window is a main window pre-created on behalf of the app.</description>
+ </element>
+ <element name="PRIMARY_WIDGET" value="1">
+ <description>The primary widget of the app.</description>
+ </element>
+</enum>
+
<enum name="TransportType">
<description>Lists of the transport types used for device connection to HU.</description>
<element name="BLUETOOTH"/>
@@ -2632,6 +2654,17 @@
</param>
</struct>
+<struct name="TemplateConfiguration">
+ <param name="template" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created window template.
+ Currently only predefined window template layouts are defined.
+ </description>
+ </param>
+ <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false" />
+ <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" />
+</struct>
+
<struct name="HMIApplication">
<description>Data type containing information about application needed by HMI.</description>
<param name="appName" type="String" maxlength="100" mandatory="true">
@@ -2892,6 +2925,12 @@
<param name="imageSupported" type="Boolean" mandatory="true">
<description>Must be true if the button supports referencing a static or dynamic image.</description>
</param>
+ <param name="textSupported" type="Boolean" mandatory="false" >
+ <description>
+ The button supports the use of text.
+ If not included, the default value should be considered true that the button will support text.
+ </description>
+ </param>
</struct>
<struct name="HMICapabilities">
@@ -3379,6 +3418,65 @@
</param>
</struct>
+
+ <struct name="WindowTypeCapabilities">
+ <param name="type" type="Common.WindowType" mandatory="true" />
+ <param name="maximumNumberOfWindows" type="Integer" mandatory="true" />
+ </struct>
+
+ <struct name="WindowCapability">
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ The specified ID of the window. Can be set to a predefined window,
+ or omitted for the main window on the main display.
+ </description>
+ </param>
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support text data. See TextField</description>
+ </param>
+ <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support images. See ImageField</description>
+ </param>
+ <param name="imageTypeSupported" type="ImageType" array="true" minsize="0" maxsize="1000" mandatory="false">
+ <description>Provides information about image types supported by the system.</description>
+ </param>
+ <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
+ <description>A set of all window templates available on the head unit.</description>
+ </param>
+ <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>The number of on-window custom presets available (if any); otherwise omitted.</description>
+ </param>
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of buttons and the capabilities of each on-window button.</description>
+ </param>
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of soft buttons available on-window and the capabilities for each button.</description>
+ </param>
+ </struct>
+
+ <struct name="DisplayCapability">
+ <description>Contains information about the display capabilities.</description>
+ <param name="displayName" type="String" mandatory="false" />
+ <param name="windowTypeSupported" type="WindowTypeCapabilities" array="true" minsize="1" mandatory="false">
+ <description>
+ Informs the application how many windows the app is allowed to create per type.
+ </description>
+ </param>
+ <param name="windowCapabilities" type="WindowCapability" array="true" minsize="1" maxsize="1000" mandatory="false">
+ <description>
+ Contains a list of capabilities of all windows related to the app.
+ Once the app has registered the capabilities of all windows are provided.
+ GetSystemCapability still allows requesting window capabilities of all windows.
+ After registration, only windows with capabilities changed will be included.
+ Following cases will cause only affected windows to be included:
+ 1. App creates a new window. After the window is created, a system capability notification will be sent
+ related only to the created window.
+ 2. App sets a new layout to the window. The new layout changes window capabilties.
+ The notification will reflect those changes to the single window.
+ </description>
+ </param>
+ </struct>
+
<struct name="SystemCapabilities">
<param name="navigationCapability" type="NavigationCapability" mandatory="false">
</param>
@@ -3388,6 +3486,7 @@
</param>
</struct>
+
<struct name="RemoteControlCapabilities">
<param name="climateControlCapabilities" type="ClimateControlCapabilities" mandatory="false" minsize="1" maxsize="100" array="true">
<description>If included, the platform supports RC climate controls. For this baseline version, maxsize=1. i.e. only one climate control module is supported.</description >
@@ -3867,10 +3966,14 @@
<element name="VIDEO_STREAMING"/>
<element name="REMOTE_CONTROL"/>
<element name="APP_SERVICES" />
+ <element name="DISPLAYS"/>
</enum>
<struct name="SystemCapability">
- <description>The systemCapabilityType identifies which data object exists in this struct. For example, if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist</description>
+ <description>
+ The systemCapabilityType identifies which data object exists in this struct. For example,
+ if the SystemCapability Type is NAVIGATION then a "navigationCapability" should exist
+ </description>
<param name="systemCapabilityType" type="Common.SystemCapabilityType" mandatory="true">
<description>Used as a descriptor of what data to expect in this struct. The corresponding param to this enum should be included and the only other param included.</description>
</param>
@@ -3887,8 +3990,13 @@
<description>Describes extended capabilities of the module's phone feature</description>
</param>
<param name="appServicesCapabilities" type="Common.AppServicesCapabilities" mandatory="false">
- <description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
- </param>
+ <description>
+ An array of currently available services.
+ If this is an update to the capability the affected services will include
+ an update reason in that item
+ </description>
+ </param>
+ <param name="displayCapabilities" type="Common.DisplayCapability" array="true" minsize="1" maxsize="1000" mandatory="false"/>
</struct>
</interface>
@@ -4071,12 +4179,22 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of selected application.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="OnAppDeactivated" messagetype="notification">
<description>Must be sent by HU system when the user switches to any functionality which is not other mobile application.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of deactivated application.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="OnAppRegistered" messagetype="notification">
<description>Issued by SDL to notify HMI about new application registered.</description>
@@ -4361,10 +4479,17 @@
</param>
</function>
<function name="OnSystemCapabilityUpdated" messagetype="notification">
- <description>A notification to inform the HMI that a specific system capability has changed.</description>
+ <description>
+ A notification between HMI and SDL that a specific system capability has been changed.
+ It can be sent in both directions SDL to HMI and HMI to SDL. Direction is dependent on
+ the point where capabilities have been changed
+ </description>
<param name="systemCapability" type="Common.SystemCapability" mandatory="true">
<description>The system capability that has been updated</description>
</param>
+ <param name="appID" type="Integer" mandatory="false">
+ <description>ID of application that is related to this RPC.</description>
+ </param>
</function>
</interface>
@@ -4681,11 +4806,44 @@
</description>
</param>
</function>
+
<function name="Alert" messagetype="response">
<param name="tryAgainTime" type="Integer" mandatory="false" minvalue="0" maxvalue="2000000000">
<description>Amount of time (in milliseconds) that SDL must wait before resending an alert. Must be provided if another system event or overlay currently has a higher priority than this alert.</description>
</param>
</function>
+
+ <function name="SetDisplayLayout" messagetype="request">
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
+ <param name="displayLayout" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created screen layout.
+ Currently only predefined screen layouts are defined.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application related to this RPC.</description>
+ </param>
+ <param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
+ </function>
+
+ <function name="SetDisplayLayout" messagetype="response">
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
+ <param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="false">
+ <description>See DisplayCapabilities</description>
+ </param>
+ <param name="buttonCapabilities" type="Common.ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>See ButtonCapabilities</description >
+ </param>
+ <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+ </param>
+ <param name="presetBankCapabilities" type="Common.PresetBankCapabilities" mandatory="false">
+ <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+ </param>
+ </function>
+
<function name="Show" messagetype="request">
<param name="showStrings" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="8">
<description>Array of lines of show text fields. See TextFieldStruct. If some field is not set, the corresponding text should stay unchanged. If field's text is empty "", the field must be cleared.
@@ -4723,16 +4881,105 @@
<param name="appID" type="Integer" mandatory="true">
<description>Id of application related to this RPC.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false" >
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended.
+ If this param is not included,
+ it will be assumed that this request is specifically for the main window
+ on the main display.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+
+ <param name="templateConfiguration" type="Common.TemplateConfiguration" mandatory="false">
+ <description>
+ Used to set an alternate template layout to a window.
+ </description>
+ </param>
</function>
+
<function name="Show" messagetype="response">
</function>
+
+ <function name="CreateWindow" messagetype="request">
+ <description>
+ Create a new window on the display with the specified window type.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ </description>
+ </param>
+
+ <param name="windowName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ Multiple apps can share the same window name except for the default main window.
+ Creating a window with a name which is already in use by the app will result in `DUPLICATE_NAME`.
+ </description>
+ </param>
+
+ <param name="type" type="Common.WindowType" mandatory="true">
+ <description>The type of the window to be created. Main window or widget.</description>
+ </param>
+
+ <param name="associatedServiceType" type="String" mandatory="false">
+ <description>
+ Allows an app to create a widget related to a specific service type.
+ As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio.
+ Actions such as skip or play/pause will be directed to this active media app.
+ In case of widgets, the system can provide a single "media" widget which will act as a placeholder for the active media app.
+ It is only allowed to have one window per service type. This means that a media app can only have a single MEDIA widget.
+ Still the app can create widgets omitting this parameter.
+ Those widgets would be available as app specific widgets that are permanently included in the HMI.
+ This parameter is related to widgets only. The default main window, which is pre-created during app registration,
+ will be created based on the HMI types specified in the app registration request.
+ </description>
+ </param>
+
+ <param name="duplicateUpdatesFromWindowID" type="Integer" mandatory="false">
+ <description>
+ Optional parameter. Specify whether the content sent to an existing window
+ should be duplicated to the created window.
+ If there isn't a window with the ID, the request will be rejected with `INVALID_DATA`.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application that concerns this RPC.</description>
+ </param>
+ </function>
+
+ <function name="CreateWindow" messagetype="response">
+ </function>
+
+ <function name="DeleteWindow" messagetype="request">
+ <description>
+ Deletes previously created window of the SDL application.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window
+ on the main display and cannot be deleted.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application that concerns this RPC.</description>
+ </param>
+ </function>
+
+ <function name="DeleteWindow" messagetype="response">
+ </function>
+
<function name="AddCommand" messagetype="request">
<description>Request from SDL to add a command to the application menu.</description>
<param name="cmdID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="true">
<description>ID of the command to be added.</description>
</param>
<param name="menuParams" type="Common.MenuParams" mandatory="false">
- <description>Optional sub value containing parameters of the command (position, name, etc.). See MenuParams. If omitted the command should be added to the end of the list of commands.</description>
+ <description>
+ Optional sub value containing parameters of the command (position, name, etc.). See MenuParams.
+ If omitted the command should be added to the end of the list of commands.</description>
</param>
<param name="cmdIcon" type="Common.Image" mandatory="false">
<description>Image to be displayed for representing the command. See Image.</description>
@@ -4742,8 +4989,10 @@
<description>ID of application that concerns this RPC.</description>
</param>
</function>
+
<function name="AddCommand" messagetype="response">
- </function>
+ </function>
+
<function name="DeleteCommand" messagetype="request">
<description>Request from SDL to delete a command from the in-application menu with the specified command id.</description>
<param name="cmdID" type="Integer" mandatory="true" minvalue="0" maxvalue="2000000000">
@@ -4753,8 +5002,10 @@
<description>ID of application that concerns this RPC.</description>
</param>
</function>
+
<function name="DeleteCommand" messagetype="response">
</function>
+
<function name="AddSubMenu" messagetype="request">
<description>Request from SDL to add a sub menu to the in-application menu.</description>
<param name="menuID" type="Integer" minvalue="1" maxvalue="2000000000" mandatory="true">
@@ -4931,6 +5182,11 @@
<param name="appID" type="Integer" mandatory="false">
<description>ID of application that is related to this RPC.</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="GetCapabilities" messagetype="request">
<description>Method is invoked at system startup by SDL to request information about UI capabilities of HMI.</description>
@@ -5026,33 +5282,7 @@
</function>
<function name="SetAppIcon" messagetype="response">
</function>
- <function name="SetDisplayLayout" messagetype="request">
- <param name="displayLayout" type="String" maxlength="500" mandatory="true">
- <description>
- Predefined or dynamically created screen layout.
- Currently only predefined screen layouts are defined.
- </description>
- </param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application related to this RPC.</description>
- </param>
- <param name="dayColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
- <param name="nightColorScheme" type="Common.TemplateColorScheme" mandatory="false"></param>
- </function>
- <function name="SetDisplayLayout" messagetype="response">
- <param name="displayCapabilities" type="Common.DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
- </param>
- <param name="buttonCapabilities" type="Common.ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description >
- </param>
- <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
- </param>
- <param name="presetBankCapabilities" type="Common.PresetBankCapabilities" mandatory="false">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
- </param>
- </function>
+
<function name="ShowCustomForm" messagetype="request">
<description>Used to show a custom form; it can be a parent or child screen. If no parent screen is designated, it is set as a parent screen.</description>
<param name="customFormID" type="String" maxlength="500" mandatory="true">
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 3329951c1b..a16a4afa53 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -346,7 +346,29 @@
<description>This mode causes the interaction to immediately display a keyboard entry through the HMI.</description>
</element>
</enum>
-
+
+ <enum name="WindowType" since="6.0">
+ <element name="MAIN">
+ <description>
+ This window type describes the main window on a display.
+ </description>
+ </element>
+ <element name="WIDGET">
+ <description>
+ A widget is a small window that the app can create to provide information and soft buttons for quick app control.
+ </description>
+ </element>
+ </enum>
+
+ <enum name="PredefinedWindows" since="6.0">
+ <element name="DEFAULT_WINDOW" value="0">
+ <description>The default window is a main window pre-created on behalf of the app.</description>
+ </element>
+ <element name="PRIMARY_WIDGET" value="1">
+ <description>The primary widget of the app.</description>
+ </element>
+ </enum>
+
<enum name="HMILevel" since="1.0">
<description>Enumeration that describes current levels of HMI.</description>
<element name="FULL" internal_name="HMI_FULL" />
@@ -2215,7 +2237,10 @@
<param name="parameterPermissions" type="ParameterPermissions" mandatory="true"/>
</struct>
- <struct name="DisplayCapabilities" since="1.0">
+ <struct name="DisplayCapabilities" deprecated="true" since="6.0">
+ <history>
+ <struct name="DisplayCapabilities" since="1.0" until="6.0"/>
+ </history>
<description>Contains information about the display capabilities.</description>
<param name="displayType" type="DisplayType" mandatory="true" deprecated="true" since="5.0">
<description>The type of the display. See DisplayType</description>
@@ -2303,6 +2328,12 @@
<param name="imageSupported" type="Boolean" mandatory="true">
<description>The button supports referencing a static or dynamic image.</description>
</param>
+ <param name="textSupported" type="Boolean" mandatory="false" since="6.0">
+ <description>
+ The button supports the use of text.
+ If not included, the default value should be considered true that the button will support text.
+ </description>
+ </param>
</struct>
<struct name="PresetBankCapabilities" since="2.0">
@@ -2312,6 +2343,60 @@
</param>
</struct>
+ <struct name="WindowCapability" since="6.0">
+ <param name="windowID" type="Integer" mandatory="false">
+ <description>
+ The specified ID of the window. Can be set to a predefined window,
+ or omitted for the main window on the main display.
+ </description>
+ </param>
+ <param name="textFields" type="TextField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support text data. See TextField</description>
+ </param>
+ <param name="imageFields" type="ImageField" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>A set of all fields that support images. See ImageField</description>
+ </param>
+ <param name="imageTypeSupported" type="ImageType" array="true" minsize="0" maxsize="1000" mandatory="false">
+ <description>Provides information about image types supported by the system.</description>
+ </param>
+ <param name="templatesAvailable" type="String" minsize="0" maxsize="100" maxlength="100" array="true" mandatory="false">
+ <description>A set of all window templates available on the head unit.</description>
+ </param>
+ <param name="numCustomPresetsAvailable" type="Integer" minvalue="1" maxvalue="100" mandatory="false">
+ <description>The number of on-window custom presets available (if any); otherwise omitted.</description>
+ </param>
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of buttons and the capabilities of each on-window button.</description>
+ </param>
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
+ <description>The number of soft buttons available on-window and the capabilities for each button.</description>
+ </param>
+ </struct>
+
+ <struct name="WindowTypeCapabilities" since="6.0">
+ <param name="type" type="WindowType" mandatory="true" />
+ <param name="maximumNumberOfWindows" type="Integer" mandatory="true" />
+ </struct>
+
+ <struct name="DisplayCapability" since="6.0">
+ <param name="displayName" type="String" mandatory="false" />
+ <param name="windowTypeSupported" type="WindowTypeCapabilities" array="true" minsize="1" mandatory="false">
+ <description>
+ Informs the application how many windows the app is allowed to create per type.
+ </description>
+ </param>
+ <param name="windowCapabilities" type="WindowCapability" array="true" minsize="1" maxsize="1000" mandatory="false">
+ <description>
+ Contains a list of capabilities of all windows related to the app.
+ Once the app has registered the capabilities of all windows are provided.
+ GetSystemCapability still allows requesting window capabilities of all windows.
+ After registration, only windows with capabilities changed will be included. Following cases will cause only affected windows to be included:
+ 1. App creates a new window. After the window is created, a system capability notification will be sent related only to the created window.
+ 2. App sets a new layout to the window. The new layout changes window capabilties. The notification will reflect those changes to the single window.
+ </description>
+ </param>
+ </struct>
+
<struct name="HMICapabilities" since="3.0">
<param name="navigation" type="Boolean" mandatory="false">
<description>Availability of build in Nav. True: Available, False: Not Available</description>
@@ -2701,6 +2786,8 @@
<element name="CancelInteractionID" value="57" hexvalue="39" since="6.0" />
<element name="CloseApplicationID" value="58" hexvalue="3A" since="6.0" />
<element name="ShowAppMenuID" value="59" hexvalue="3B" since="6.0" />
+ <element name="CreateWindowID" value="60" hexvalue="3C" since="6.0" />
+ <element name="DeleteWindowID" value="61" hexvalue="3D" since="6.0" />
<!--
Base Notifications
@@ -2885,6 +2972,7 @@
<element name="VIDEO_STREAMING"/>
<element name="REMOTE_CONTROL"/>
<element name="APP_SERVICES" since="5.1"/>
+ <element name="DISPLAYS" since="6.0"/>
</enum>
<struct name="NavigationCapability" since="4.5">
@@ -2959,7 +3047,18 @@
<description>The color of the background</description>
</param>
</struct>
-
+
+ <struct name="TemplateConfiguration" since="6.0">
+ <param name="template" type="String" maxlength="500" mandatory="true">
+ <description>
+ Predefined or dynamically created window template.
+ Currently only predefined window template layouts are defined.
+ </description>
+ </param>
+ <param name="dayColorScheme" type="TemplateColorScheme" mandatory="false" />
+ <param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" />
+ </struct>
+
<!---Remote control -->
<enum name="MassageZone" since="5.0">
@@ -4235,6 +4334,7 @@
<param name="appServicesCapabilities" type="AppServicesCapabilities" mandatory="false" since="5.1">
<description>An array of currently available services. If this is an update to the capability the affected services will include an update reason in that item</description>
</param>
+ <param name="displayCapabilities" type="DisplayCapability" array="true" minsize="1" maxsize="1000" mandatory="false" since="6.0"/>
</struct>
<!-- Requests/Responses -->
@@ -4383,22 +4483,45 @@
<param name="hmiDisplayLanguage" type="Language" mandatory="false" since="2.0">
<description>The currently active display language on the module. See "Language" for options.</description>
</param>
-
- <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
- <description>See DisplayCapabilities</description>
+
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ See DisplayCapabilities. This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="displayCapabilities" type="DisplayCapabilities" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
-
- <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
- <description>See ButtonCapabilities</description >
+
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ See ButtonCapabilities. This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
-
- <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0">
- <description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description >
+
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.
+ This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
-
- <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false" since="2.0">
- <description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description >
+
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false" deprecated="true" since="6.0">
+ <description>
+ If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.
+ This parameter is deprecated and replaced by SystemCapability using DISPLAYS.
+ </description>
+ <history>
+ <param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false" since="2.0" until="6.0"/>
+ </history>
</param>
+
<param name="hmiZoneCapabilities" type="HmiZoneCapabilities" minsize="1" maxsize="100" array="true" mandatory="false" since="1.0">
<description>See HmiZoneCapabilities</description>
</param>
@@ -4483,6 +4606,108 @@
</function>
+ <function name="CreateWindow" functionID="CreateWindowID" messagetype="request" since="6.0">
+ <description>
+ Create a new window on the display with the specified window type.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window on the main display and should not be used in this context as it will already be created for the app. See PredefinedWindows enum. Creating a window with an ID that is already in use will be rejected with `INVALID_ID`.
+ </description>
+ </param>
+
+ <param name="windowName" type="String" maxlength="100" mandatory="true">
+ <description>
+ The window name to be used by the HMI. The name of the pre-created default window will match the app name.
+ Multiple apps can share the same window name except for the default main window.
+ Creating a window with a name which is already in use by the app will result in `DUPLICATE_NAME`.
+ </description>
+ </param>
+
+ <param name="type" type="WindowType" mandatory="true">
+ <description>The type of the window to be created. Main window or widget.</description>
+ </param>
+
+ <param name="associatedServiceType" type="String" mandatory="false">
+ <description>
+ Allows an app to create a widget related to a specific service type.
+ As an example if a `MEDIA` app becomes active, this app becomes audible and is allowed to play audio. Actions such as skip or play/pause will be
+ directed to this active media app. In case of widgets, the system can provide a single "media" widget which will act as a placeholder for the active media app.
+
+ It is only allowed to have one window per service type. This means that a media app can only have a single MEDIA widget. Still the app can create widgets omitting this parameter. Those widgets would be available as app specific widgets that are permanently included in the HMI.
+
+ This parameter is related to widgets only. The default main window, which is pre-created during app registration, will be created based on the HMI types specified in the app registration request.
+ </description>
+ </param>
+ <param name="duplicateUpdatesFromWindowID" type="Integer" mandatory="false">
+ <description>
+ Optional parameter. Specify whether the content sent to an existing window
+ should be duplicated to the created window.
+ If there isn't a window with the ID, the request will be rejected with `INVALID_DATA`.
+ </description>
+ </param>
+ </function>
+
+ <function name="CreateWindow" functionID="CreateWindowID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_DATA"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="DISALLOWED"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+ </function>
+
+ <function name="DeleteWindow" functionID="DeleteWindowID" messagetype="request" since="6.0">
+ <description>
+ Deletes previously created window of the SDL application.
+ </description>
+ <param name="windowID" type="Integer" mandatory="true">
+ <description>
+ A unique ID to identify the window. The value of '0' will always be the default main window on the main display and cannot be deleted.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+ </function>
+
+ <function name="DeleteWindow" functionID="DeleteWindowID" messagetype="response" since="6.0">
+ <param name="success" type="Boolean" platform="documentation" mandatory="true">
+ <description> true if successful; false, if failed.</description>
+ </param>
+
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+
+ <param name="resultCode" type="Result" platform="documentation" mandatory="true">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="REJECTED"/>
+ <element name="INVALID_DATA"/>
+ <element name="INVALID_ID"/>
+ <element name="DUPLICATE_NAME"/>
+ <element name="DISALLOWED"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ </param>
+ </function>
+
<function name="SetGlobalProperties" functionID="SetGlobalPropertiesID" messagetype="request" since="1.0">
<description>Allows setting global properties.</description>
@@ -5176,19 +5401,31 @@
</param>
<param name="metadataTags" type="MetadataTags" mandatory="false" since="4.5">
- <description>
- App defined metadata information. See MetadataStruct. Uses mainField1, mainField2, mainField3, mainField4.
+ <description>App defined metadata information. See MetadataStruct. Uses mainField1, mainField2, mainField3, mainField4.
If omitted on supported displays, the currently set metadata tags will not change.
- If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.
- </description>
+ If any text field contains no tags or the none tag, the metadata tag for that textfield should be removed.</description>
</param>
- <param name="templateTitle" type="String" minlength="0" maxlength="100" mandatory="false" since="6.0">
+ <param name="templateTitle" type="String" maxlength="100" mandatory="false" since="6.0">
<description>
- The title of the new template that will be displayed.
+ The title of the new template that will be displayed.
How this will be displayed is dependent on the OEM design and implementation of the template.
</description>
</param>
+
+ <param name="windowID" type="Integer" mandatory="false" since="6.0" >
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included,
+ it will be assumed that this request is specifically for the main window on the main display.
+ See PredefinedWindows enum.
+ </description>
+ </param>
+
+ <param name="templateConfiguration" type="TemplateConfiguration" mandatory="false" since="6.0">
+ <description>
+ Used to set an alternate template layout to a window.
+ </description>
+ </param>
</function>
<function name="Show" functionID="ShowID" messagetype="response" since="1.0">
@@ -6841,12 +7078,8 @@
</function>
- <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request" since="3.0">
- <description>
- Used to set an alternate display layout.
- If not sent, default screen for given platform will be shown
- </description>
-
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="request" deprecated="true" since="6.0">
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
<param name="displayLayout" type="String" maxlength="500" mandatory="true">
<description>
Predefined or dynamically created screen layout.
@@ -6859,12 +7092,12 @@
<param name="nightColorScheme" type="TemplateColorScheme" mandatory="false" since="5.0"/>
</function>
- <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response" since="3.0">
-
+ <function name="SetDisplayLayout" functionID="SetDisplayLayoutID" messagetype="response" deprecated="true" since="6.0">
+ <description>This RPC is deprecated. Use Show RPC to change layout.</description>
<param name="success" type="Boolean" platform="documentation" mandatory="true">
<description> true, if successful; false, if failed </description>
</param>
-
+
<param name="resultCode" type="Result" platform="documentation" mandatory="true">
<description>See Result</description>
<element name="SUCCESS"/>
@@ -6876,23 +7109,23 @@
<element name="REJECTED"/>
<element name="UNSUPPORTED_REQUEST"/>
</param>
-
+
<param name="displayCapabilities" type="DisplayCapabilities" mandatory="false">
<description>See DisplayCapabilities</description>
</param>
-
+
<param name="buttonCapabilities" type="ButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>See ButtonCapabilities</description >
</param>
-
+
<param name="softButtonCapabilities" type="SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>If returned, the platform supports on-screen SoftButtons; see SoftButtonCapabilities.</description>
</param>
-
+
<param name="presetBankCapabilities" type="PresetBankCapabilities" mandatory="false">
<description>If returned, the platform supports custom on-screen Presets; see PresetBankCapabilities.</description>
</param>
-
+
<param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
<description>Provides additional human readable info regarding the result.</description>
</param>
@@ -7600,6 +7833,11 @@
If it is NOT_STREAMABLE, the app must stop streaming video to SDL Core(stop service).
</description>
</param>
+ <param name="windowID" type="Integer" mandatory="false" since="6.0">
+ <description>
+ This is the unique ID assigned to the window that this RPC is intended. If this param is not included, it will be assumed that this request is specifically for the main window on the main display. See PredefinedWindows enum.
+ </description>
+ </param>
</function>
<function name="OnAppInterfaceUnregistered" functionID="OnAppInterfaceUnregisteredID" messagetype="notification" since="1.0">
diff --git a/src/components/policy/policy_external/include/policy/policy_table/enums.h b/src/components/policy/policy_external/include/policy/policy_table/enums.h
index 2cff10d8be..d3aee9dcf8 100644
--- a/src/components/policy/policy_external/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_external/include/policy/policy_table/enums.h
@@ -492,6 +492,16 @@ enum FunctionID {
ShowAppMenuID = 59,
/**
+ * @brief CreateWindowID.
+ */
+ CreateWindowID = 60,
+
+ /**
+ * @brief DeleteWindowID.
+ */
+ DeleteWindowID = 61,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_external/src/policy_table/enums.cc b/src/components/policy/policy_external/src/policy_table/enums.cc
index 5628dd5729..6f60b43af9 100644
--- a/src/components/policy/policy_external/src/policy_table/enums.cc
+++ b/src/components/policy/policy_external/src/policy_table/enums.cc
@@ -1169,6 +1169,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("CreateWindow" == literal) {
+ *result = CreateWindowID;
+ return true;
+ }
+
+ if ("DeleteWindow" == literal) {
+ *result = DeleteWindowID;
+ return true;
+ }
+
if ("CloseApplication" == literal) {
*result = CloseApplicationID;
return true;
diff --git a/src/components/policy/policy_regular/include/policy/policy_table/enums.h b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
index 840f429bf7..899e40993e 100644
--- a/src/components/policy/policy_regular/include/policy/policy_table/enums.h
+++ b/src/components/policy/policy_regular/include/policy/policy_table/enums.h
@@ -477,6 +477,16 @@ enum FunctionID {
ShowAppMenuID = 59,
/**
+ * @brief CreateWindowID.
+ */
+ CreateWindowID = 60,
+
+ /**
+ * @brief DeleteWindowID.
+ */
+ DeleteWindowID = 61,
+
+ /**
* @brief OnHMIStatusID.
*/
OnHMIStatusID = 32768,
diff --git a/src/components/policy/policy_regular/src/policy_table/enums.cc b/src/components/policy/policy_regular/src/policy_table/enums.cc
index d753c22b49..56bbd53762 100644
--- a/src/components/policy/policy_regular/src/policy_table/enums.cc
+++ b/src/components/policy/policy_regular/src/policy_table/enums.cc
@@ -863,6 +863,10 @@ bool IsValidEnum(FunctionID val) {
return true;
case CancelInteractionID:
return true;
+ case CreateWindowID:
+ return true;
+ case DeleteWindowID:
+ return true;
case CloseApplicationID:
return true;
case ShowAppMenuID:
@@ -1034,6 +1038,10 @@ const char* EnumToJsonString(FunctionID val) {
return "UnpublishAppService";
case CancelInteractionID:
return "CancelInteraction";
+ case CreateWindowID:
+ return "CreateWindow";
+ case DeleteWindowID:
+ return "DeleteWindow";
case CloseApplicationID:
return "CloseApplication";
case ShowAppMenuID:
@@ -1372,6 +1380,16 @@ bool EnumFromJsonString(const std::string& literal, FunctionID* result) {
return true;
}
+ if ("CreateWindow" == literal) {
+ *result = CreateWindowID;
+ return true;
+ }
+
+ if ("DeleteWindow" == literal) {
+ *result = DeleteWindowID;
+ return true;
+ }
+
if ("CloseApplication" == literal) {
*result = CloseApplicationID;
return true;
diff --git a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
index 3b07506981..eb06856eae 100644
--- a/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
+++ b/src/components/policy/policy_regular/test/policy_manager_impl_test.cc
@@ -247,6 +247,53 @@ class PolicyManagerImplTest2 : public ::testing::Test {
ASSERT_TRUE(manager->InitPT(file_name, &policy_settings_));
}
+ Json::Value AddWidgetSupportToPt(const std::string& section_name,
+ const uint32_t group_number) {
+ std::ifstream ifile("sdl_preloaded_pt.json");
+ Json::Reader reader;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ auto& groups =
+ root["policy_table"]["app_policies"][section_name]["groups"];
+ if (groups.empty()) {
+ groups = Json::Value(Json::arrayValue);
+ }
+ groups[group_number] = Json::Value("WidgetSupport");
+ }
+ ifile.close();
+ return root;
+ }
+
+ std::string AddWidgetSupportToPt(Json::Value* root,
+ const std::string& section_name,
+ const uint32_t group_number) {
+ if (root) {
+ auto& groups =
+ (*root)["policy_table"]["app_policies"][section_name]["groups"];
+ if (groups.empty()) {
+ groups = Json::Value(Json::arrayValue);
+ }
+ groups[group_number] = Json::Value("WidgetSupport");
+ return root->toStyledString();
+ }
+ return std::string();
+ }
+
+ std::string AddWidgetSupportToFunctionalGroups(Json::Value* root,
+ const std::string& rpc_name,
+ const std::string& hmi_level) {
+ if (root) {
+ Json::Value val(Json::objectValue);
+ Json::Value val2(Json::arrayValue);
+ val2[0] = hmi_level;
+ val[rpc_name]["hmi_levels"] = val2;
+ (*root)["policy_table"]["functional_groupings"]["WidgetSupport"]["rpcs"] =
+ val;
+ return root->toStyledString();
+ }
+ return std::string();
+ }
+
void AddRTtoPT(const std::string& update_file_name,
const std::string& section_name,
const uint32_t rt_number,
@@ -588,6 +635,122 @@ TEST_F(PolicyManagerImplTest2,
ASSERT_TRUE(output.list_of_allowed_params.empty());
}
+TEST_F(
+ PolicyManagerImplTest2,
+ CheckPermissions_PersistsWidgetAppPermissionsAfter_PTU_ExpectRPCAllowed) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ (manager->GetCache())->AddDevice(dev_id1, "Bluetooth");
+ (manager->GetCache())
+ ->SetDeviceData(dev_id1,
+ "hardware IPX",
+ "v.8.0.1",
+ "Android",
+ "4.4.2",
+ "Life",
+ 2,
+ "Bluetooth");
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id1))
+ .WillRepeatedly(Return(dev_id1));
+ manager->SetUserConsentForDevice(dev_id1, true);
+ // Add app from consented device. App will be assigned with default policies
+ manager->AddApplication(
+ app_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id1))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ // Act
+ const char* const rpc_name = "CreateWindow";
+ const char* const hmi_level = "NONE";
+ const uint32_t group_number = 0;
+ Json::Value root = AddWidgetSupportToPt("default", group_number);
+ std::string json =
+ AddWidgetSupportToFunctionalGroups(&root, rpc_name, hmi_level);
+
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+
+ ::policy::RPCParams input_params;
+ ::policy::CheckPermissionResult output;
+
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+
+ // Check RPC is allowed
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+ // Act
+ json = AddWidgetSupportToPt(&root, app_id1, group_number);
+ msg = BinaryMessage(json.begin(), json.end());
+ ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+
+ output.hmi_level_permitted = ::policy::kRpcDisallowed;
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+ // Check RPC is allowed
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+}
+
+TEST_F(
+ PolicyManagerImplTest2,
+ CheckPermissions_AbsenceOfWidgetPermissionsAfter_PTU_ExpectRPCDisallowed) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ (manager->GetCache())->AddDevice(dev_id1, "Bluetooth");
+ (manager->GetCache())
+ ->SetDeviceData(dev_id1,
+ "hardware IPX",
+ "v.8.0.1",
+ "Android",
+ "4.4.2",
+ "Life",
+ 2,
+ "Bluetooth");
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(_, app_id1))
+ .WillRepeatedly(Return(dev_id1));
+ manager->SetUserConsentForDevice(dev_id1, true);
+ // Add app from consented device. App will be assigned with default policies
+ manager->AddApplication(
+ dev_id1, app_id1, HmiTypes(policy_table::AHT_DEFAULT));
+ EXPECT_CALL(listener, GetDevicesIds(app_id1))
+ .WillRepeatedly(Return(transport_manager::DeviceList()));
+ // Act
+ const char* const rpc_name = "DeleteWindow";
+ const char* const hmi_level = "NONE";
+ const uint32_t group_number = 0;
+ Json::Value root = AddWidgetSupportToPt("default", group_number);
+ std::string json =
+ AddWidgetSupportToFunctionalGroups(&root, rpc_name, hmi_level);
+
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+
+ ::policy::RPCParams input_params;
+ ::policy::CheckPermissionResult output;
+
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+
+ // Check RPC is allowed
+ EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+ output.hmi_level_permitted = ::policy::kRpcDisallowed;
+ // Act
+ root["policy_table"]["app_policies"][app_id1]["groups"] =
+ Json::Value(Json::arrayValue);
+ root["policy_table"]["app_policies"][app_id1]["groups"][group_number] =
+ Json::Value("Base-4");
+ json = root.toStyledString();
+ msg = BinaryMessage(json.begin(), json.end());
+ ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+
+ manager->CheckPermissions(
+ dev_id1, app_id1, hmi_level, rpc_name, input_params, output);
+ // Check RPC is disallowed
+ EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
+ ASSERT_TRUE(output.list_of_allowed_params.empty());
+}
+
TEST_F(PolicyManagerImplTest2,
CheckPermissions_SetAppIDwithPolicies_ExpectRPCAllowed) {
// Arrange
diff --git a/tools/InterfaceGenerator/generator/parsers/RPCBase.py b/tools/InterfaceGenerator/generator/parsers/RPCBase.py
index 21f07e6ac5..955de31dc7 100755
--- a/tools/InterfaceGenerator/generator/parsers/RPCBase.py
+++ b/tools/InterfaceGenerator/generator/parsers/RPCBase.py
@@ -270,7 +270,7 @@ class Parser(object):
result = self._parse_version(attrib[attribute])
until = result
elif attribute == "deprecated":
- deprecated = attributes[attribute]
+ deprecated = attrib[attribute]
elif attribute == "removed":
removed = attrib[attribute]
else: