summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt14
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h80
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h80
-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_cancel_interaction_request.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h78
-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/hmi/ui_show_app_menu_request.h74
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h74
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h85
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h85
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h79
-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/put_file_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/register_app_interface_request.h20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h81
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h74
-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/include/sdl_rpc_plugin/sdl_rpc_plugin.h2
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc65
-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.cc62
-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_cancel_interaction_request.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc64
-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.cc18
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc61
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc31
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/alert_request.cc25
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc117
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc60
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc119
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc61
-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_system_request_notification.cc4
-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/perform_interaction_request.cc10
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/put_file_request.cc11
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/register_app_interface_request.cc222
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc3
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc5
-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/set_global_properties_request.cc120
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc143
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc63
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc193
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc5
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc20
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/hmi_command_factory.cc47
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/mobile_command_factory.cc35
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/sdl_rpc_plugin.cc19
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt9
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/hmi_notifications_test.cc104
-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.cc271
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/ui_get_capabilities_response_test.cc62
-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_system_request_notification_test.cc22
-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/register_app_interface_request_test.cc245
-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/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc64
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc32
109 files changed, 7269 insertions, 386 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
index fdf02b57cb..fe8857b6b1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/CMakeLists.txt
@@ -51,21 +51,27 @@ collect_sources(APP_EXTENSIONS "${EXTENSIONS_SOURCE_DIR}")
collect_sources(RPC_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIBRARIES
+ ApplicationManager
HMI_API
MOBILE_API
- ApplicationManager
+ MessageHelper
+ connectionHandler
v4_protocol_v1_2_no_extra
SmartObjects
Utils
- Policy
+ PolicyStatic
+ jsoncpp
)
if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("sdl_rpc_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES} ${APP_EXTENSIONS})
-target_link_libraries("sdl_rpc_plugin" ${LIBRARIES})
+add_library("sdl_rpc_plugin_static" ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${RPC_PLUGIN_SOURCES} ${APP_EXTENSIONS})
+target_link_libraries("sdl_rpc_plugin_static" ${LIBRARIES})
+
+add_library("sdl_rpc_plugin" SHARED "src/sdl_rpc_plugin.cc")
+target_link_libraries("sdl_rpc_plugin" sdl_rpc_plugin_static)
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h
new file mode 100644
index 0000000000..9847f567e0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BasicCommunicationCloseApplicationRequest command class
+ **/
+class BasicCommunicationCloseApplicationRequest
+ : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief BasicCommunicationCloseApplicationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationCloseApplicationRequest(
+ 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 BasicCommunicationCloseApplicationRequest class destructor
+ **/
+ ~BasicCommunicationCloseApplicationRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h
new file mode 100644
index 0000000000..9576684b77
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h
@@ -0,0 +1,80 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief BasicCommunicationCloseApplicationResponse command class
+ **/
+class BasicCommunicationCloseApplicationResponse
+ : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief BasicCommunicationCloseApplicationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ BasicCommunicationCloseApplicationResponse(
+ 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 BasicCommunicationCloseApplicationResponse class destructor
+ **/
+ ~BasicCommunicationCloseApplicationResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(BasicCommunicationCloseApplicationResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_BASIC_COMMUNICATION_CLOSE_APPLICATION_RESPONSE_H_
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_cancel_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h
new file mode 100644
index 0000000000..a637f53df3
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h
@@ -0,0 +1,79 @@
+/*
+ * 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_CANCEL_INTERACTION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UICancelInteractionRequest command class
+ **/
+class UICancelInteractionRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief UICancelInteractionRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UICancelInteractionRequest(
+ 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 UICancelInteractionRequest class destructor
+ **/
+ virtual ~UICancelInteractionRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UICancelInteractionRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h
new file mode 100644
index 0000000000..751a2ceef8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h
@@ -0,0 +1,78 @@
+/*
+ * 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_CANCEL_INTERACTION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UICancelInteractionResponse command class
+ **/
+class UICancelInteractionResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief UICancelInteractionResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UICancelInteractionResponse(
+ 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 UICancelInteractionResponse class destructor
+ **/
+ virtual ~UICancelInteractionResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UICancelInteractionResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_CANCEL_INTERACTION_RESPONSE_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/hmi/ui_show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h
new file mode 100644
index 0000000000..c47d73b858
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018, 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_SHOW_APP_MENU_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_
+
+#include "application_manager/commands/request_to_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UIShowAppMenuRequest command class
+ **/
+class UIShowAppMenuRequest : public app_mngr::commands::RequestToHMI {
+ public:
+ /**
+ * @brief UIShowAppMenuRequest class constructor
+ **/
+ UIShowAppMenuRequest(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 UIShowAppMenuRequest class destructor
+ **/
+ ~UIShowAppMenuRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIShowAppMenuRequest);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h
new file mode 100644
index 0000000000..c03a043e12
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018, 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_SHOW_APP_MENU_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_
+
+#include "application_manager/commands/response_from_hmi.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UIShowAppMenuResponse command class
+ **/
+class UIShowAppMenuResponse : public app_mngr::commands::ResponseFromHMI {
+ public:
+ /**
+ * @brief UIShowAppMenuResponse class constructor
+ **/
+ UIShowAppMenuResponse(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 UIShowAppMenuResponse class destructor
+ **/
+ ~UIShowAppMenuResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UIShowAppMenuResponse);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_HMI_UI_SHOW_APP_MENU_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
index 2da94ae67e..d99c5dab38 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/add_sub_menu_request.h
@@ -88,6 +88,8 @@ class AddSubMenuRequest : public app_mngr::commands::CommandRequestImpl {
*/
bool CheckSubMenuName();
+ bool is_menu_layout_available_ = true;
+
DISALLOW_COPY_AND_ASSIGN(AddSubMenuRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
new file mode 100644
index 0000000000..0063c07512
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h
@@ -0,0 +1,85 @@
+/*
+ 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_CANCEL_INTERACTION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CancelInteractionRequest command class
+ **/
+class CancelInteractionRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief CancelInteractionRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CancelInteractionRequest(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 CancelInteractionRequest class destructor
+ **/
+ virtual ~CancelInteractionRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CancelInteractionRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h
new file mode 100644
index 0000000000..3e8536e617
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h
@@ -0,0 +1,79 @@
+/*
+ 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_CANCEL_INTERACTION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CancelInteractionResponse command class
+ **/
+class CancelInteractionResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief CancelInteractionResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CancelInteractionResponse(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 CancelInteractionResponse class destructor
+ **/
+ virtual ~CancelInteractionResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CancelInteractionResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CANCEL_INTERACTION_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
index 01f20a68e3..f9f780b84b 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/change_registration_request.h
@@ -123,11 +123,12 @@ class ChangeRegistrationRequest
/**
* @brief Check parameters (name, vr) for
* coincidence with already known parameters of registered applications
- *
+ * @param device_id device identifier
* @return SUCCESS if there is no coincidence of app.name/VR synonyms,
* otherwise appropriate error code returns
*/
- mobile_apis::Result::eType CheckCoincidence();
+ mobile_apis::Result::eType CheckCoincidence(
+ const connection_handler::DeviceHandle& device_id);
/**
* @brief Checks if requested name is allowed by policy
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
new file mode 100644
index 0000000000..b965e880b4
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_request.h
@@ -0,0 +1,85 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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_CLOSE_APPLICATION_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CloseApplicationRequest command class
+ **/
+class CloseApplicationRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief CloseApplicationRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CloseApplicationRequest(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 CloseApplicationRequest class destructor
+ **/
+ ~CloseApplicationRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ void on_event(const app_mngr::event_engine::Event& event);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloseApplicationRequest);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h
new file mode 100644
index 0000000000..c7b649f4e9
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/close_application_response.h
@@ -0,0 +1,79 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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_CLOSE_APPLICATION_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "sdl_rpc_plugin/sdl_rpc_plugin.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief CloseApplicationResponse command class
+ **/
+class CloseApplicationResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief CloseApplicationResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ CloseApplicationResponse(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 CloseApplicationResponse class destructor
+ **/
+ ~CloseApplicationResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloseApplicationResponse);
+};
+
+} // namespace commands
+
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_CLOSE_APPLICATION_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/put_file_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
index f24ce422f2..b3e04f7796 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/put_file_request.h
@@ -76,7 +76,7 @@ class PutFileRequest : public app_mngr::commands::CommandRequestImpl {
mobile_apis::FileType::eType file_type_;
bool is_persistent_file_;
- void SendOnPutFileNotification();
+ void SendOnPutFileNotification(bool is_system_file);
DISALLOW_COPY_AND_ASSIGN(PutFileRequest);
};
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 8a80db9cdf..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,17 +207,31 @@ 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.
*/
bool IsApplicationSwitched();
+ /**
+ * @brief Information about given Connection Key.
+ * @param key Unique key used by other components as session identifier
+ * @param device_id device identifier.
+ * @param mac_address uniq address
+ * @return false in case of error or true in case of success
+ */
+ bool GetDataOnSessionKey(
+ const uint32_t key,
+ connection_handler::DeviceHandle* device_id = nullptr,
+ std::string* mac_address = nullptr) const;
+
private:
std::string response_info_;
mobile_apis::Result::eType result_code_;
+ connection_handler::DeviceHandle device_handle_;
+ std::string device_id_;
policy::PolicyHandlerInterface& GetPolicyHandler();
DISALLOW_COPY_AND_ASSIGN(RegisterAppInterfaceRequest);
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
index e84bf6e5e6..7e67428fb0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/set_global_properties_request.h
@@ -149,6 +149,8 @@ class SetGlobalPropertiesRequest
std::string ui_response_info_;
std::string tts_response_info_;
+ bool is_menu_layout_available_ = true;
+
DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest);
};
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
new file mode 100644
index 0000000000..c9691a808f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_request.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2018, 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_SHOW_APP_MENU_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ShowAppMenuRequest command class
+ **/
+class ShowAppMenuRequest : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief ShowAppMenuRequest class constructor
+ **/
+ ShowAppMenuRequest(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);
+
+ /**
+ * @brief ShowAppMenuRequest class destructor
+ **/
+ ~ShowAppMenuRequest() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ **/
+ void on_event(const app_mngr::event_engine::Event& event) OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ShowAppMenuRequest);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h
new file mode 100644
index 0000000000..1e357e8a11
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/commands/mobile/show_app_menu_response.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2018, 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_SHOW_APP_MENU_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ShowAppMenuResponse command class
+ **/
+class ShowAppMenuResponse : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief ShowAppMenuResponse class constructor
+ **/
+ ShowAppMenuResponse(const app_mngr::commands::MessageSharedPtr& messasge,
+ app_mngr::ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler);
+
+ /**
+ * @brief ShowAppMenuResponse class destructor
+ **/
+ ~ShowAppMenuResponse() OVERRIDE;
+
+ /**
+ * @brief Execute command
+ **/
+ void Run() OVERRIDE;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ShowAppMenuResponse);
+};
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_COMMANDS_MOBILE_SHOW_APP_MENU_RESPONSE_H_
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/include/sdl_rpc_plugin/sdl_rpc_plugin.h b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
index 7d482709cb..288410e342 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/include/sdl_rpc_plugin/sdl_rpc_plugin.h
@@ -67,5 +67,5 @@ class SDLRPCPlugin : public plugins::RPCPlugin {
} // namespace sdl_rpc_plugin
extern "C" application_manager::plugin_manager::RPCPlugin* Create();
-
+extern "C" void Delete(application_manager::plugin_manager::RPCPlugin* data);
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_SDL_RPC_PLUGIN_INCLUDE_SDL_RPC_PLUGIN_SDL_RPC_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
new file mode 100644
index 0000000000..b021faefd8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_request.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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/basic_communication_close_application_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BasicCommunicationCloseApplicationRequest::
+ BasicCommunicationCloseApplicationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BasicCommunicationCloseApplicationRequest::
+ ~BasicCommunicationCloseApplicationRequest() {}
+
+void BasicCommunicationCloseApplicationRequest::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/basic_communication_close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
new file mode 100644
index 0000000000..2e56271cf2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/basic_communication_close_application_response.cc
@@ -0,0 +1,65 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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/basic_communication_close_application_response.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+BasicCommunicationCloseApplicationResponse::
+ BasicCommunicationCloseApplicationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+BasicCommunicationCloseApplicationResponse::
+ ~BasicCommunicationCloseApplicationResponse() {}
+
+void BasicCommunicationCloseApplicationResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication);
+ 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/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 2f3ee60a16..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
@@ -59,12 +59,39 @@ struct OnDriverDistractionProcessor {
void operator()(ApplicationSharedPtr application) {
if (application) {
- (*on_driver_distraction_so_)[strings::params][strings::connection_key] =
- application->app_id();
+ // Create modifiable copy of base message
+ smart_objects::SmartObject message = *on_driver_distraction_so_;
+ message[strings::params][strings::connection_key] = application->app_id();
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);
+
+ if (is_lock_screen_dismissal_exists &&
+ msg_params[mobile_notification::lock_screen_dismissal_enabled]
+ .asBool()) {
+ const auto language =
+ MessageHelper::MobileLanguageToString(application->ui_language());
+
+ const auto warning_message =
+ application_manager_.GetPolicyHandler()
+ .LockScreenDismissalWarningMessage(language);
+ // Only allow lock screen dismissal if a warning message is available
+ if (warning_message && !warning_message->empty()) {
+ msg_params[mobile_notification::lock_screen_dismissal_warning] =
+ *warning_message;
+ } else {
+ msg_params[mobile_notification::lock_screen_dismissal_enabled] =
+ false;
+ }
+ }
if (result.hmi_level_permitted != policy::kRpcAllowed) {
MobileMessageQueue messages;
application->SwapMobileMessageQueue(messages);
@@ -72,15 +99,19 @@ struct OnDriverDistractionProcessor {
std::remove_if(
messages.begin(),
messages.end(),
- [this](smart_objects::SmartObjectSPtr message) {
+ [](smart_objects::SmartObjectSPtr message) {
return (*message)[strings::params][strings::function_id]
- .asString() == stringified_function_id_;
+ .asUInt() ==
+ mobile_api::FunctionID::OnDriverDistractionID;
}),
messages.end());
- application->PushMobileMessage(on_driver_distraction_so_);
+ application->SwapMobileMessageQueue(messages);
+ application->PushMobileMessage(
+ std::make_shared<smart_objects::SmartObject>(message));
return;
}
- command_.SendNotificationToMobile(on_driver_distraction_so_);
+ command_.SendNotificationToMobile(
+ std::make_shared<smart_objects::SmartObject>(message));
}
}
@@ -108,14 +139,12 @@ OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const hmi_apis::Common_DriverDistractionState::eType state =
+ const auto state =
static_cast<hmi_apis::Common_DriverDistractionState::eType>(
(*message_)[strings::msg_params][hmi_notification::state].asInt());
application_manager_.set_driver_distraction_state(state);
- smart_objects::SmartObjectSPtr on_driver_distraction =
- std::make_shared<smart_objects::SmartObject>();
-
+ auto on_driver_distraction = std::make_shared<smart_objects::SmartObject>();
if (!on_driver_distraction) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
@@ -127,6 +156,17 @@ void OnDriverDistractionNotification::Run() {
(*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
state;
+ const auto lock_screen_dismissal =
+ application_manager_.GetPolicyHandler().LockScreenDismissalEnabledState();
+
+ if (lock_screen_dismissal &&
+ hmi_apis::Common_DriverDistractionState::DD_ON == state) {
+ (*on_driver_distraction)
+ [strings::msg_params]
+ [mobile_notification::lock_screen_dismissal_enabled] =
+ *lock_screen_dismissal;
+ }
+
const ApplicationSet applications =
application_manager_.applications().GetData();
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_cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_request.cc
new file mode 100644
index 0000000000..c186077b1e
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_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_cancel_interaction_request.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICancelInteractionRequest::UICancelInteractionRequest(
+ 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) {}
+
+UICancelInteractionRequest::~UICancelInteractionRequest() {}
+
+void UICancelInteractionRequest::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_cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_response.cc
new file mode 100644
index 0000000000..2d5db4eecb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_cancel_interaction_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/hmi/ui_cancel_interaction_response.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+
+namespace commands {
+
+UICancelInteractionResponse::UICancelInteractionResponse(
+ 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) {}
+
+UICancelInteractionResponse::~UICancelInteractionResponse() {}
+
+void UICancelInteractionResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ event_engine::Event event(hmi_apis::FunctionID::UI_CancelInteraction);
+ 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_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 909e3bae47..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
@@ -73,9 +73,17 @@ void UIGetCapabilitiesResponse::Run() {
msg_params[hmi_response::soft_button_capabilities]);
}
- if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) {
+ // use newer parameter "audioPassThruCapabilitiesList" when available
+ if (msg_params.keyExists(strings::audio_pass_thru_capabilities_list)) {
hmi_capabilities.set_audio_pass_thru_capabilities(
- msg_params[strings::audio_pass_thru_capabilities]);
+ msg_params[strings::audio_pass_thru_capabilities_list]);
+ } else if (msg_params.keyExists(strings::audio_pass_thru_capabilities)) {
+ smart_objects::SmartObject audio_pass_thru_capabilities_list(
+ smart_objects::SmartType_Array);
+ audio_pass_thru_capabilities_list[0] =
+ msg_params[strings::audio_pass_thru_capabilities];
+ hmi_capabilities.set_audio_pass_thru_capabilities(
+ audio_pass_thru_capabilities_list);
}
if (msg_params.keyExists(strings::hmi_capabilities)) {
@@ -113,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/hmi/ui_show_app_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
new file mode 100644
index 0000000000..c2c8566e82
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_request.cc
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2018, 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_show_app_menu_request.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+UIShowAppMenuRequest::UIShowAppMenuRequest(
+ 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)
+ : RequestToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIShowAppMenuRequest::~UIShowAppMenuRequest() {}
+
+void UIShowAppMenuRequest::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_show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
new file mode 100644
index 0000000000..14bbc79e03
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/hmi/ui_show_app_menu_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, 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_show_app_menu_response.h"
+#include "application_manager/event_engine/event.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+UIShowAppMenuResponse::UIShowAppMenuResponse(
+ 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)
+ : ResponseFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handle) {}
+
+UIShowAppMenuResponse::~UIShowAppMenuResponse() {}
+
+void UIShowAppMenuResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ app_mngr::event_engine::Event event(hmi_apis::FunctionID::UI_ShowAppMenu);
+ 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/mobile/add_sub_menu_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
index fbfcd4d38a..d5ec8b8bb3 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/add_sub_menu_request.cc
@@ -109,6 +109,18 @@ void AddSubMenuRequest::Run() {
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (received_msg_params.keyExists(strings::menu_layout)) {
+ auto menu_layout = static_cast<mobile_apis::MenuLayout::eType>(
+ received_msg_params[strings::menu_layout].asUInt());
+ if (application_manager_.hmi_capabilities().menu_layout_supported(
+ menu_layout)) {
+ msg_params[strings::menu_layout] =
+ received_msg_params[strings::menu_layout];
+ } else {
+ is_menu_layout_available_ = false;
+ }
+ }
+
msg_params[strings::menu_id] = received_msg_params[strings::menu_id];
if (received_msg_params.keyExists(strings::position)) {
msg_params[strings::menu_params][strings::position] =
@@ -152,11 +164,22 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
application->AddSubMenu(
(*message_)[strings::msg_params][strings::menu_id].asInt(),
(*message_)[strings::msg_params]);
+ response_info =
+ "The MenuLayout specified is unsupported, the "
+ "default MenuLayout will be used." +
+ response_info;
+ SendResponse(result,
+ is_menu_layout_available_
+ ? MessageHelper::HMIToMobileResult(result_code)
+ : mobile_apis::Result::WARNINGS,
+ is_menu_layout_available_ ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
+ } else {
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
}
- SendResponse(result,
- MessageHelper::HMIToMobileResult(result_code),
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
break;
}
default: {
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 7173aaf2d0..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)) {
@@ -321,6 +322,11 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
msg_params[hmi_request::alert_strings] =
smart_objects::SmartObject(smart_objects::SmartType_Array);
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
int32_t index = 0;
if ((*message_)[strings::msg_params].keyExists(strings::alert_text1)) {
msg_params[hmi_request::alert_strings][index][hmi_request::field_name] =
@@ -350,6 +356,23 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
MessageHelper::SubscribeApplicationToSoftButton(
(*message_)[strings::msg_params], app, function_id());
}
+
+ if ((*message_)[strings::msg_params].keyExists(strings::alert_icon)) {
+ auto verification_result = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::alert_icon],
+ app,
+ application_manager_);
+
+ if (mobile_apis::Result::INVALID_DATA == verification_result) {
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
+ SendResponse(false, verification_result);
+ return;
+ }
+
+ msg_params[strings::alert_icon] =
+ (*message_)[strings::msg_params][strings::alert_icon];
+ }
+
// app_id
msg_params[strings::app_id] = app_id;
msg_params[strings::duration] = default_timeout_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
new file mode 100644
index 0000000000..82e0703da1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_request.cc
@@ -0,0 +1,117 @@
+
+/*
+Copyright (c) 2019, Ford Motor Company, Livio
+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 the copyright holders nor the names of their
+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/cancel_interaction_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CancelInteractionRequest::CancelInteractionRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CancelInteractionRequest::~CancelInteractionRequest() {}
+
+void CancelInteractionRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto function_id = static_cast<mobile_apis::FunctionID::eType>(
+ (*message_)[strings::msg_params][strings::func_id].asInt());
+
+ if (helpers::
+ Compare<mobile_apis::FunctionID::eType, helpers::NEQ, helpers::ALL>(
+ function_id,
+ mobile_apis::FunctionID::PerformInteractionID,
+ mobile_apis::FunctionID::AlertID,
+ mobile_apis::FunctionID::ScrollableMessageID,
+ mobile_apis::FunctionID::SliderID)) {
+ LOG4CXX_ERROR(logger_, "Bad function ID" << function_id);
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::app_id] = connection_key();
+ msg_params[strings::func_id] = function_id;
+
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
+ SendHMIRequest(hmi_apis::FunctionID::UI_CancelInteraction, &msg_params, true);
+}
+
+void CancelInteractionRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (event.id() != hmi_apis::FunctionID::UI_CancelInteraction) {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+
+ auto message = event.smart_object();
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_UI);
+
+ auto msg_params = message[strings::msg_params];
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
new file mode 100644
index 0000000000..af73e72a6f
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/cancel_interaction_response.cc
@@ -0,0 +1,60 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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/cancel_interaction_response.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CancelInteractionResponse::CancelInteractionResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CancelInteractionResponse::~CancelInteractionResponse() {}
+
+void CancelInteractionResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
index ef81babdd6..8940ea3f59 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/change_registration_request.cc
@@ -49,7 +49,7 @@ struct IsSameNickname {
}
private:
- const custom_str::CustomString& app_id_;
+ const custom_str::CustomString app_id_;
};
} // namespace
@@ -160,7 +160,7 @@ void ChangeRegistrationRequest::Run() {
return;
}
- if (mobile_apis::Result::SUCCESS != CheckCoincidence()) {
+ if (mobile_apis::Result::SUCCESS != CheckCoincidence(app->device())) {
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
return;
}
@@ -578,36 +578,46 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
return false;
}
-mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
+mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence(
+ const connection_handler::DeviceHandle& device_id) {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- ApplicationSet accessor = application_manager_.applications().GetData();
+ auto compare_tts_name = [](const smart_objects::SmartObject& obj_1,
+ const smart_objects::SmartObject& obj_2) {
+ return obj_1[application_manager::strings::text]
+ .asCustomString()
+ .CompareIgnoreCase(
+ obj_2[application_manager::strings::text].asCustomString());
+ };
+
+ const auto& accessor = application_manager_.applications().GetData();
custom_str::CustomString app_name;
- uint32_t app_id = connection_key();
+ const uint32_t app_id = connection_key();
if (msg_params.keyExists(strings::app_name)) {
app_name = msg_params[strings::app_name].asCustomString();
}
- ApplicationSetConstIt it = accessor.begin();
- for (; accessor.end() != it; ++it) {
- if (app_id == (*it)->app_id()) {
+ for (const auto& app : accessor) {
+ if (app->device() != device_id) {
+ continue;
+ }
+
+ if (app->app_id() == app_id) {
continue;
}
- const custom_str::CustomString& cur_name = (*it)->name();
+ const auto& cur_name = app->name();
if (msg_params.keyExists(strings::app_name)) {
if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
-
- const smart_objects::SmartObject* vr = (*it)->vr_synonyms();
- const std::vector<smart_objects::SmartObject>* curr_vr = NULL;
- if (NULL != vr) {
- curr_vr = vr->asArray();
+ const auto vr = app->vr_synonyms();
+ if (vr) {
+ const auto curr_vr = vr->asArray();
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
@@ -617,18 +627,37 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
}
}
- // vr check
+ // VR check
if (msg_params.keyExists(strings::vr_synonyms)) {
- const std::vector<smart_objects::SmartObject>* new_vr =
- msg_params[strings::vr_synonyms].asArray();
+ const auto new_vr = msg_params[strings::vr_synonyms].asArray();
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
return mobile_apis::Result::DUPLICATE_NAME;
}
- } // end vr check
- } // application for end
+ } // End vr check
+
+ // TTS check
+ if (msg_params.keyExists(strings::tts_name) && app->tts_name()) {
+ const auto tts_array = msg_params[strings::tts_name].asArray();
+ const auto tts_curr = app->tts_name()->asArray();
+ const auto& it_tts = std::find_first_of(tts_array->begin(),
+ tts_array->end(),
+ tts_curr->begin(),
+ tts_curr->end(),
+ compare_tts_name);
+ if (it_tts != tts_array->end()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
+ return mobile_apis::Result::DUPLICATE_NAME;
+ }
+ } // End tts check
+
+ } // Application for end
return mobile_apis::Result::SUCCESS;
}
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
new file mode 100644
index 0000000000..275f1d82a6
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_request.cc
@@ -0,0 +1,119 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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/close_application_request.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CloseApplicationRequest::CloseApplicationRequest(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CloseApplicationRequest::~CloseApplicationRequest() {}
+
+void CloseApplicationRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ LOG4CXX_ERROR(logger_, "Application does not exist");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::app_id] = connection_key();
+ SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_CloseApplication,
+ &msg_params,
+ true);
+}
+
+void CloseApplicationRequest::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ auto msg_params = message[strings::msg_params];
+
+ hmi_apis::Common_Result::eType hmi_result =
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ mobile_apis::Result::eType result =
+ MessageHelper::HMIToMobileResult(hmi_result);
+ bool success = PrepareResultForMobileResponse(
+ hmi_result, HmiInterfaces::HMI_INTERFACE_BasicCommunication);
+ if (success) {
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (app.use_count() == 0) {
+ LOG4CXX_ERROR(logger_, "Application does not exist");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ auto on_app_exit = [app](plugin_manager::RPCPlugin& plugin) {
+ plugin.OnApplicationEvent(plugin_manager::kApplicationExit, app);
+ };
+
+ 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,
+ false);
+ }
+
+ const char* info = msg_params.keyExists(strings::info)
+ ? msg_params[strings::info].asCharArray()
+ : NULL;
+
+ SendResponse(success, result, info, &msg_params);
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
new file mode 100644
index 0000000000..934804e1b1
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/close_application_response.cc
@@ -0,0 +1,61 @@
+/*
+ Copyright (c) 2019, Ford Motor Company, Livio
+ 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 the copyright holders nor the names of their
+ 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/close_application_response.h"
+#include "application_manager/application_impl.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace sdl_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+CloseApplicationResponse::CloseApplicationResponse(
+ const application_manager::commands::MessageSharedPtr& message,
+ ApplicationManager& application_manager,
+ app_mngr::rpc_service::RPCService& rpc_service,
+ app_mngr::HMICapabilities& hmi_capabilities,
+ policy::PolicyHandlerInterface& policy_handler)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+CloseApplicationResponse::~CloseApplicationResponse() {}
+
+void CloseApplicationResponse::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/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_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index a85dec10bb..fc99bb323c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -86,8 +86,8 @@ void OnSystemRequestNotification::Run() {
static_cast<rpc::policy_table_interface_base::RequestType>(
request_type));
- if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(),
- request_type)) {
+ if (!policy_handler.IsRequestTypeAllowed(
+ app->device(), app->policy_app_id(), request_type)) {
LOG4CXX_WARN(logger_,
"Request type " << stringified_request_type
<< " is not allowed by policies");
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/perform_interaction_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
index 6b2f3cbcc5..cc109afcf0 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/perform_interaction_request.cc
@@ -449,6 +449,11 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
mobile_apis::InteractionMode::eType mode =
static_cast<mobile_apis::InteractionMode::eType>(
(*message_)[strings::msg_params][strings::interaction_mode].asInt());
@@ -532,6 +537,11 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
smart_objects::SmartObject& choice_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
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 41558c08f0..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
@@ -284,9 +286,7 @@ void PutFileRequest::Run() {
}
SendResponse(true, save_result, "File was downloaded", &response_params);
- if (is_system_file) {
- SendOnPutFileNotification();
- }
+ SendOnPutFileNotification(is_system_file);
break;
}
default:
@@ -297,7 +297,7 @@ void PutFileRequest::Run() {
}
}
-void PutFileRequest::SendOnPutFileNotification() {
+void PutFileRequest::SendOnPutFileNotification(bool is_system_file) {
LOG4CXX_INFO(logger_, "SendOnPutFileNotification");
smart_objects::SmartObjectSPtr notification =
std::make_shared<smart_objects::SmartObject>(
@@ -316,6 +316,7 @@ void PutFileRequest::SendOnPutFileNotification() {
message[strings::msg_params][strings::length] = length_;
message[strings::msg_params][strings::persistent_file] = is_persistent_file_;
message[strings::msg_params][strings::file_type] = file_type_;
+ message[strings::msg_params][strings::is_system_file] = is_system_file;
rpc_service_.ManageHMICommand(notification);
}
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 597df26d0a..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
@@ -184,13 +185,14 @@ RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
rpc_service,
hmi_capabilities,
policy_handler)
- , result_code_(mobile_apis::Result::INVALID_ENUM) {}
+ , result_code_(mobile_apis::Result::INVALID_ENUM)
+ , device_handle_(0) {}
RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {}
bool RegisterAppInterfaceRequest::Init() {
LOG4CXX_AUTO_TRACE(logger_);
- return true;
+ return GetDataOnSessionKey(connection_key(), &device_handle_, &device_id_);
}
void RegisterAppInterfaceRequest::Run() {
@@ -224,20 +226,25 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
+ LOG4CXX_DEBUG(
+ logger_,
+ "device_handle: " << device_handle_ << " device_id: " << device_id_);
+
if (IsApplicationSwitched()) {
return;
}
+ // Cache the original app ID (for legacy behavior)
+ const auto policy_app_id =
+ application_manager_.GetCorrectMobileIDFromMessage(message_);
+
ApplicationSharedPtr application =
- application_manager_.application(connection_key());
+ application_manager_.application(device_id_, policy_app_id);
if (application) {
SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY);
return;
}
- // cache the original app ID (for legacy behavior)
- const std::string policy_app_id =
- application_manager_.GetCorrectMobileIDFromMessage(message_);
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -576,6 +583,13 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
}
if (hmi_capabilities.display_capabilities()->keyExists(
+ strings::menu_layouts_available)) {
+ display_caps[strings::menu_layouts_available] =
+ hmi_capabilities.display_capabilities()->getElement(
+ strings::menu_layouts_available);
+ }
+
+ if (hmi_capabilities.display_capabilities()->keyExists(
hmi_response::media_clock_formats)) {
display_caps[hmi_response::media_clock_formats] =
hmi_capabilities.display_capabilities()->getElement(
@@ -613,15 +627,9 @@ void FillUIRelatedFields(smart_objects::SmartObject& response_params,
}
if (hmi_capabilities.audio_pass_thru_capabilities()) {
- if (smart_objects::SmartType_Array ==
- hmi_capabilities.audio_pass_thru_capabilities()->getType()) {
- // hmi_capabilities json contains array and HMI response object
- response_params[strings::audio_pass_thru_capabilities] =
- *hmi_capabilities.audio_pass_thru_capabilities();
- } else {
- response_params[strings::audio_pass_thru_capabilities][0] =
- *hmi_capabilities.audio_pass_thru_capabilities();
- }
+ // hmi_capabilities json contains array and HMI response object
+ response_params[strings::audio_pass_thru_capabilities] =
+ *hmi_capabilities.audio_pass_thru_capabilities();
}
response_params[strings::hmi_capabilities] =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -821,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 =
@@ -835,14 +853,15 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
}
}
policy::StatusNotifier notify_upd_manager = GetPolicyHandler().AddApplication(
- application->policy_app_id(), hmi_types);
+ application->mac_address(), application->policy_app_id(), hmi_types);
response_params[strings::icon_resumed] =
file_system::FileExists(application->app_icon_path());
SendResponse(true, result_code, add_info.c_str(), &response_params);
if (msg_params.keyExists(strings::app_hmi_type)) {
- GetPolicyHandler().SetDefaultHmiTypes(application->policy_app_id(),
+ GetPolicyHandler().SetDefaultHmiTypes(application->device(),
+ application->policy_app_id(),
&(msg_params[strings::app_hmi_type]));
}
@@ -856,12 +875,14 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
// Start PTU after successfull registration
// Sends OnPermissionChange notification to mobile right after RAI response
// and HMI level set-up
- GetPolicyHandler().OnAppRegisteredOnMobile(application->policy_app_id());
-
- if (result_code != mobile_apis::Result::RESUME_FAILED) {
- resumer.StartResumption(application, hash_id);
- } else {
- resumer.StartResumptionOnlyHMILevel(application);
+ GetPolicyHandler().OnAppRegisteredOnMobile(application->mac_address(),
+ application->policy_app_id());
+ 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
@@ -961,48 +982,72 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence(
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- ApplicationSet accessor = application_manager_.applications().GetData();
+ auto compare_tts_name = [](const smart_objects::SmartObject& obj_1,
+ const smart_objects::SmartObject& obj_2) {
+ return obj_1[application_manager::strings::text]
+ .asCustomString()
+ .CompareIgnoreCase(
+ obj_2[application_manager::strings::text].asCustomString());
+ };
- ApplicationSetConstIt it = accessor.begin();
- const custom_str::CustomString& app_name =
- msg_params[strings::app_name].asCustomString();
+ const auto& accessor = application_manager_.applications().GetData();
+ const auto& app_name = msg_params[strings::app_name].asCustomString();
- for (; accessor.end() != it; ++it) {
- // name check
- const custom_str::CustomString& cur_name = (*it)->name();
+ for (const auto& app : accessor) {
+ if (app->device() != device_handle_) {
+ continue;
+ }
+ // Name check
+ const auto& cur_name = app->name();
if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
- out_duplicate_apps.push_back(*it);
+ out_duplicate_apps.push_back(app);
continue;
}
-
- const smart_objects::SmartObject* vr = (*it)->vr_synonyms();
- const std::vector<smart_objects::SmartObject>* curr_vr = NULL;
- if (NULL != vr) {
- curr_vr = vr->asArray();
+ const auto vr = app->vr_synonyms();
+ if (vr) {
+ const auto curr_vr = vr->asArray();
CoincidencePredicateVR v(app_name);
if (0 != std::count_if(curr_vr->begin(), curr_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
- out_duplicate_apps.push_back(*it);
+ out_duplicate_apps.push_back(app);
continue;
}
}
- // vr check
+ // VR check
if (msg_params.keyExists(strings::vr_synonyms)) {
- const std::vector<smart_objects::SmartObject>* new_vr =
- msg_params[strings::vr_synonyms].asArray();
+ const auto new_vr = msg_params[strings::vr_synonyms].asArray();
CoincidencePredicateVR v(cur_name);
if (0 != std::count_if(new_vr->begin(), new_vr->end(), v)) {
LOG4CXX_ERROR(logger_, "vr_synonyms duplicated with app_name .");
- out_duplicate_apps.push_back(*it);
+ out_duplicate_apps.push_back(app);
continue;
}
- } // end vr check
+ } // End vr check
+
+ // TTS check
+ if (msg_params.keyExists(strings::tts_name) && app->tts_name()) {
+ const auto tts_array = msg_params[strings::tts_name].asArray();
+ const auto tts_curr = app->tts_name()->asArray();
+ const auto& it_tts = std::find_first_of(tts_array->begin(),
+ tts_array->end(),
+ tts_curr->begin(),
+ tts_curr->end(),
+ compare_tts_name);
+ if (it_tts != tts_array->end()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "TTS name: "
+ << (*it_tts)[strings::text].asCustomString().AsMBString()
+ << " is known already");
+ return mobile_apis::Result::DUPLICATE_NAME;
+ }
+ } // End tts check
- } // application for end
+ } // Application for end
if (!out_duplicate_apps.empty()) {
return mobile_apis::Result::DUPLICATE_NAME;
@@ -1131,14 +1176,19 @@ bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
const custom_string::CustomString mobile_app_id(
application_manager_.GetCorrectMobileIDFromMessage(message_));
- const ApplicationSet& applications =
- application_manager_.applications().GetData();
-
- ApplicationSetConstIt it = applications.begin();
- ApplicationSetConstIt it_end = applications.end();
-
- for (; it != it_end; ++it) {
- if (mobile_app_id.CompareIgnoreCase((*it)->policy_app_id().c_str())) {
+ const auto& applications = application_manager_.applications().GetData();
+
+ for (const auto& app : applications) {
+ if (mobile_app_id.CompareIgnoreCase(app->policy_app_id().c_str())) {
+ if (app->device() != device_handle_) {
+ LOG4CXX_DEBUG(logger_,
+ "These policy_app_id equal, but applications have "
+ "different device id"
+ << " mobile_app_id: " << mobile_app_id.c_str()
+ << " device_handle: " << device_handle_
+ << " device_handle: " << app->device());
+ continue;
+ }
return true;
}
}
@@ -1308,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() {
@@ -1323,7 +1372,7 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
LOG4CXX_DEBUG(logger_, "Looking for application id " << policy_app_id);
- auto app = application_manager_.application_by_policy_id(policy_app_id);
+ auto app = application_manager_.application(device_id_, policy_app_id);
if (!app) {
LOG4CXX_DEBUG(
@@ -1334,12 +1383,13 @@ bool RegisterAppInterfaceRequest::IsApplicationSwitched() {
LOG4CXX_DEBUG(logger_,
"Application with policy id " << policy_app_id << " is found.");
- if (!application_manager_.IsAppInReconnectMode(policy_app_id)) {
+ if (!application_manager_.IsAppInReconnectMode(device_handle_,
+ policy_app_id)) {
LOG4CXX_DEBUG(
logger_,
"Policy id " << policy_app_id << " is not found in reconnection list.");
SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY);
- return false;
+ return true;
}
LOG4CXX_DEBUG(logger_, "Application is found in reconnection list.");
@@ -1358,13 +1408,61 @@ 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);
return true;
}
+bool RegisterAppInterfaceRequest::GetDataOnSessionKey(
+ const uint32_t key,
+ connection_handler::DeviceHandle* device_id,
+ std::string* mac_address) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if ((nullptr == mac_address) && (nullptr == device_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Can't get data on session key because device id and mac "
+ "address are empty.");
+ return false;
+ }
+
+ connection_handler::DeviceHandle device_handle = 0;
+ auto& connect_handler = application_manager_.connection_handler();
+
+ auto result = connect_handler.GetDataOnSessionKey(
+ connection_key(), nullptr, nullptr, &device_handle);
+
+ if (result) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "Failed to get device info for connection key: " << connection_key());
+ return false;
+ }
+
+ if (mac_address) {
+ result = connect_handler.get_session_observer().GetDataOnDeviceID(
+ device_handle, nullptr, nullptr, mac_address, nullptr);
+ }
+
+ if (result) {
+ LOG4CXX_DEBUG(logger_,
+ "Failed get unique address info for connection key: "
+ << connection_key());
+ return false;
+ }
+
+ if (device_id) {
+ *device_id = device_handle;
+ }
+
+ return true;
+}
+
policy::PolicyHandlerInterface&
RegisterAppInterfaceRequest::GetPolicyHandler() {
return policy_handler_;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
index 39363bbad1..ffd8a7dc81 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/reset_global_properties_request.cc
@@ -161,7 +161,8 @@ void ResetGlobalPropertiesRequest::Run() {
key_board_properties[hmi_request::limited_character_list] =
limited_character_list;*/
- key_board_properties[hmi_request::auto_complete_text] = "";
+ key_board_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
msg_params[hmi_request::keyboard_properties] = key_board_properties;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
index c1d02c96d3..5bef1d56fc 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/scrollable_message_request.cc
@@ -112,6 +112,11 @@ void ScrollableMessageRequest::Run() {
msg_params[strings::app_id] = app->app_id();
msg_params[strings::timeout] = default_timeout_;
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
msg_params[strings::soft_buttons] =
(*message_)[strings::msg_params][strings::soft_buttons];
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/set_global_properties_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
index bbfc61d463..4a73740ccf 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/set_global_properties_request.cc
@@ -68,8 +68,7 @@ SetGlobalPropertiesRequest::~SetGlobalPropertiesRequest() {}
void SetGlobalPropertiesRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
ApplicationSharedPtr app = application_manager_.application(connection_key());
@@ -90,11 +89,9 @@ void SetGlobalPropertiesRequest::Run() {
mobile_apis::Result::eType verification_result = mobile_apis::Result::SUCCESS;
- if ((*message_)[strings::msg_params].keyExists(strings::menu_icon)) {
+ if (msg_params.keyExists(strings::menu_icon)) {
verification_result = MessageHelper::VerifyImage(
- (*message_)[strings::msg_params][strings::menu_icon],
- app,
- application_manager_);
+ msg_params[strings::menu_icon], app, application_manager_);
if (mobile_apis::Result::INVALID_DATA == verification_result) {
LOG4CXX_ERROR(
logger_, "MessageHelper::VerifyImage return " << verification_result);
@@ -103,18 +100,29 @@ void SetGlobalPropertiesRequest::Run() {
}
}
// Check for image file(s) in vrHelpItem
- if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) {
+ if (msg_params.keyExists(strings::vr_help)) {
if (mobile_apis::Result::INVALID_DATA ==
MessageHelper::VerifyImageVrHelpItems(
- (*message_)[strings::msg_params][strings::vr_help],
- app,
- application_manager_)) {
+ msg_params[strings::vr_help], app, application_manager_)) {
LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
+ if (msg_params.keyExists(strings::keyboard_properties)) {
+ if (!msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_list) &&
+ msg_params[strings::keyboard_properties].keyExists(
+ strings::auto_complete_text)) {
+ LOG4CXX_ERROR(logger_, "Replacing deprecated autoCompleteText property");
+ msg_params[strings::keyboard_properties][strings::auto_complete_list][0] =
+ msg_params[strings::keyboard_properties][strings::auto_complete_text]
+ .asString();
+ }
+ msg_params[strings::keyboard_properties].erase(strings::auto_complete_text);
+ }
+
if (IsWhiteSpaceExist()) {
LOG4CXX_ERROR(logger_, "White spaces found");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
@@ -138,6 +146,20 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
+ smart_objects::SmartObject params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ if (msg_params.keyExists(strings::menu_layout)) {
+ auto menu_layout = static_cast<mobile_apis::MenuLayout::eType>(
+ msg_params[strings::menu_layout].asUInt());
+ if (application_manager_.hmi_capabilities().menu_layout_supported(
+ menu_layout)) {
+ params[strings::menu_layout] = msg_params[strings::menu_layout];
+ } else {
+ is_menu_layout_available_ = false;
+ }
+ }
+
/* Need to set flags before sending request to HMI
* for correct processing this flags in method on_event */
if (is_help_prompt_present || is_timeout_prompt_present) {
@@ -154,9 +176,6 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
PrepareUIRequestVRHelpData(app, msg_params, params);
PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
@@ -169,9 +188,6 @@ void SetGlobalPropertiesRequest::Run() {
LOG4CXX_DEBUG(logger_, "VRHelp params does not present");
DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present);
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
// Preparing data
@@ -186,14 +202,13 @@ void SetGlobalPropertiesRequest::Run() {
// check TTS params
if (is_help_prompt_present || is_timeout_prompt_present) {
LOG4CXX_DEBUG(logger_, "TTS params presents");
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ auto tts_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
std::vector<std::string> invalid_params;
if (is_help_prompt_present) {
smart_objects::SmartObject& help_prompt =
(*message_)[strings::msg_params][strings::help_prompt];
- mobile_apis::Result::eType verification_result =
+ verification_result =
MessageHelper::VerifyTtsFiles(help_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
@@ -203,16 +218,15 @@ void SetGlobalPropertiesRequest::Run() {
invalid_params.push_back("help_prompt");
} else {
app->set_help_prompt(help_prompt);
- params[strings::help_prompt] = (*app->help_prompt());
+ tts_params[strings::help_prompt] = (*app->help_prompt());
}
}
if (is_timeout_prompt_present) {
smart_objects::SmartObject& timeout_prompt =
(*message_)[strings::msg_params][strings::timeout_prompt];
- mobile_apis::Result::eType verification_result =
- MessageHelper::VerifyTtsFiles(
- timeout_prompt, app, application_manager_);
+ verification_result = MessageHelper::VerifyTtsFiles(
+ timeout_prompt, app, application_manager_);
if (mobile_apis::Result::FILE_NOT_FOUND == verification_result) {
LOG4CXX_ERROR(
@@ -221,7 +235,7 @@ void SetGlobalPropertiesRequest::Run() {
invalid_params.push_back("timeout_prompt");
} else {
app->set_timeout_prompt(timeout_prompt);
- params[strings::timeout_prompt] = (*app->timeout_prompt());
+ tts_params[strings::timeout_prompt] = (*app->timeout_prompt());
}
}
@@ -239,11 +253,18 @@ void SetGlobalPropertiesRequest::Run() {
return;
}
- params[strings::app_id] = app->app_id();
- SendTTSRequest(params, true);
+ tts_params[strings::app_id] = app->app_id();
+ SendTTSRequest(tts_params, true);
auto& help_prompt_manager = app->help_prompt_manager();
- help_prompt_manager.OnSetGlobalPropertiesReceived(params, false);
+ help_prompt_manager.OnSetGlobalPropertiesReceived(tts_params, false);
+ } else if (!is_ui_send_) {
+ std::string response_info = "There are no parameters present in request.";
+ if (!is_menu_layout_available_) {
+ response_info += " The MenuLayout specified is unsupported.";
+ }
+ SendResponse(
+ false, mobile_apis::Result::INVALID_DATA, response_info.c_str());
}
}
@@ -317,10 +338,21 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
std::string response_info;
const bool result = PrepareResponseParameters(result_code, response_info);
- SendResponse(result,
- result_code,
- response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
+ if (result && !is_menu_layout_available_) {
+ response_info =
+ "The MenuLayout specified is unsupported, the "
+ "default MenuLayout will be used." +
+ response_info;
+ SendResponse(result,
+ mobile_apis::Result::WARNINGS,
+ response_info.c_str(),
+ &(message[strings::msg_params]));
+ } else {
+ SendResponse(result,
+ result_code,
+ response_info.empty() ? NULL : response_info.c_str(),
+ &(message[strings::msg_params]));
+ }
}
bool SetGlobalPropertiesRequest::Init() {
@@ -435,7 +467,8 @@ bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
params.keyExists(strings::vr_help) ||
params.keyExists(strings::menu_title) ||
params.keyExists(strings::menu_icon) ||
- params.keyExists(strings::keyboard_properties);
+ params.keyExists(strings::keyboard_properties) ||
+ params.keyExists(strings::menu_layout);
}
bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
@@ -549,16 +582,21 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
}
if (msg_params[strings::keyboard_properties].keyExists(
- strings::auto_complete_text)) {
- str =
- msg_params[strings::keyboard_properties][strings::auto_complete_text]
- .asCharArray();
+ strings::auto_complete_list)) {
+ const smart_objects::SmartArray* acl_array =
+ msg_params[strings::keyboard_properties][strings::auto_complete_list]
+ .asArray();
- if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid keyboard_properties "
- "auto_complete_text syntax check failed");
- return true;
+ smart_objects::SmartArray::const_iterator it = acl_array->begin();
+
+ for (; it != acl_array->end(); ++it) {
+ str = it->asCharArray();
+ if (!CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_,
+ "Invalid keyboard_properties "
+ "auto_complete_list syntax check failed");
+ return true;
+ }
}
}
}
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
new file mode 100644
index 0000000000..36278168dc
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_request.cc
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2018, 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/show_app_menu_request.h"
+
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+ShowAppMenuRequest::ShowAppMenuRequest(
+ 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)
+ : CommandRequestImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ShowAppMenuRequest::~ShowAppMenuRequest() {}
+
+void ShowAppMenuRequest::Run() {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application with id " << connection_key() << " is not registered.");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+
+ 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(mobile_apis::PredefinedWindows::DEFAULT_WINDOW),
+ mobile_apis::SystemContext::SYSCTXT_MAIN,
+ mobile_apis::SystemContext::SYSCTXT_MENU)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application with id " << connection_key() << " is not activated.");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
+ }
+
+ auto msg_params = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::app_id] = app->app_id();
+
+ const auto& received_msg_params = (*message_)[strings::msg_params];
+ if (received_msg_params.keyExists(strings::menu_id)) {
+ const int32_t menu_id = received_msg_params[strings::menu_id].asInt();
+ if (!app->FindSubMenu(menu_id)) {
+ LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
+ msg_params[strings::menu_id] = menu_id;
+ }
+
+ StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ SendHMIRequest(hmi_apis::FunctionID::UI_ShowAppMenu, &msg_params, true);
+}
+
+void ShowAppMenuRequest::on_event(const app_mngr::event_engine::Event& event) {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+
+ switch (event.id()) {
+ case hmi_apis::FunctionID::UI_ShowAppMenu: {
+ EndAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+ std::string response_info;
+ GetInfo(message, response_info);
+ const bool result = PrepareResultForMobileResponse(
+ result_code, HmiInterfaces::HMI_INTERFACE_UI);
+
+ ApplicationSharedPtr app =
+ application_manager_.application(connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with id " << connection_key()
+ << " is not registered.");
+ return;
+ }
+
+ SendResponse(result,
+ MessageHelper::HMIToMobileResult(result_code),
+ response_info.empty() ? NULL : response_info.c_str(),
+ &message[strings::msg_params]);
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event: " << event.id());
+ return;
+ }
+ }
+}
+
+} // namespace commands
+} // namespace sdl_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
new file mode 100644
index 0000000000..2b952ea9ac
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_app_menu_response.cc
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018, 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/show_app_menu_response.h"
+
+#include "application_manager/rpc_service.h"
+
+namespace sdl_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+ShowAppMenuResponse::ShowAppMenuResponse(
+ 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)
+ : CommandResponseImpl(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ShowAppMenuResponse::~ShowAppMenuResponse() {}
+
+void ShowAppMenuResponse::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/show_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/show_request.cc
index 2bf1a81261..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_);
@@ -218,6 +354,14 @@ void ShowRequest::Run() {
HandleMetadata(strings::main_field_4, main_field_4_index, msg_params);
}
+ if ((*message_)[strings::msg_params].keyExists(strings::template_title)) {
+ msg_params[hmi_request::show_strings][index][hmi_request::field_name] =
+ static_cast<int32_t>(hmi_apis::Common_TextFieldName::templateTitle);
+ msg_params[hmi_request::show_strings][index][hmi_request::field_text] =
+ (*message_)[strings::msg_params][strings::template_title];
+ ++index;
+ }
+
if ((*message_)[strings::msg_params].keyExists(strings::media_clock)) {
msg_params[hmi_request::show_strings][index][hmi_request::field_name] =
static_cast<int32_t>(hmi_apis::Common_TextFieldName::mediaClock);
@@ -264,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());
}
}
@@ -273,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);
@@ -286,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: {
@@ -305,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_;
@@ -355,6 +536,14 @@ bool ShowRequest::CheckStringsOfShowRequest() {
return false;
}
}
+ if ((*message_)[strings::msg_params].keyExists(strings::template_title)) {
+ str =
+ (*message_)[strings::msg_params][strings::template_title].asCharArray();
+ if (strlen(str) && !CheckSyntax(str)) {
+ LOG4CXX_ERROR(logger_, "Invalid templateTitle syntax check failed");
+ return false;
+ }
+ }
if ((*message_)[strings::msg_params].keyExists(strings::status_bar)) {
str = (*message_)[strings::msg_params][strings::status_bar].asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
index d80e73ccbf..dd7b426b40 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/slider_request.cc
@@ -116,6 +116,11 @@ void SliderRequest::Run() {
msg_params[strings::timeout] = default_timeout_;
}
+ if ((*message_)[strings::msg_params].keyExists(strings::cancel_id)) {
+ msg_params[strings::cancel_id] =
+ (*message_)[strings::msg_params][strings::cancel_id].asInt();
+ }
+
StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI);
SendHMIRequest(hmi_apis::FunctionID::UI_Slider, &msg_params, true);
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
index 0d3158d841..1acb2a7438 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/subscribe_button_request.cc
@@ -126,6 +126,26 @@ bool SubscribeButtonRequest::IsSubscriptionAllowed(
(mobile_apis::ButtonName::TUNEDOWN == btn_id))) {
return false;
}
+
+ if (!app->is_navi() &&
+ ((mobile_apis::ButtonName::NAV_CENTER_LOCATION == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_IN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ZOOM_OUT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_RIGHT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_DOWN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_PAN_UP_LEFT == btn_id) ||
+ (mobile_apis::ButtonName::NAV_TILT_TOGGLE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_CLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_ROTATE_COUNTERCLOCKWISE == btn_id) ||
+ (mobile_apis::ButtonName::NAV_HEADING_TOGGLE == btn_id))) {
+ return false;
+ }
+
return true;
}
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
index e70433f29b..9be5a270f5 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/system_request.cc
@@ -470,8 +470,8 @@ void SystemRequest::Run() {
static_cast<rpc::policy_table_interface_base::RequestType>(
request_type));
- if (!policy_handler.IsRequestTypeAllowed(application->policy_app_id(),
- request_type)) {
+ if (!policy_handler.IsRequestTypeAllowed(
+ application->device(), application->policy_app_id(), request_type)) {
LOG4CXX_ERROR(logger_,
"RequestType " << stringified_request_type
<< " is DISALLOWED by policies");
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 0734e1935d..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"
@@ -158,6 +162,8 @@
#endif // EXTERNAL_PROPRIETARY_MODE
#include "sdl_rpc_plugin/commands/hmi/add_statistics_info_notification.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_request.h"
+#include "sdl_rpc_plugin/commands/hmi/basic_communication_close_application_response.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_request.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_get_system_time_response.h"
#include "sdl_rpc_plugin/commands/hmi/basic_communication_on_awake_sdl.h"
@@ -230,10 +236,14 @@
#include "sdl_rpc_plugin/commands/hmi/on_vr_stopped_notification.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update.h"
#include "sdl_rpc_plugin/commands/hmi/sdl_policy_update_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_cancel_interaction_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_send_haptic_data_response.h"
#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_request.h"
#include "sdl_rpc_plugin/commands/hmi/ui_set_display_layout_response.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_request.h"
+#include "sdl_rpc_plugin/commands/hmi/ui_show_app_menu_response.h"
#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_request.h"
#include "sdl_rpc_plugin/commands/hmi/bc_get_file_path_response.h"
@@ -243,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;
@@ -317,6 +328,13 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::ActivateAppRequest>()
: factory.GetCreator<commands::ActivateAppResponse>();
}
+ case hmi_apis::FunctionID::BasicCommunication_CloseApplication: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<
+ commands::BasicCommunicationCloseApplicationRequest>()
+ : factory.GetCreator<
+ commands::BasicCommunicationCloseApplicationResponse>();
+ }
#ifdef EXTERNAL_PROPRIETARY_MODE
case hmi_apis::FunctionID::BasicCommunication_DecryptCertificate: {
return hmi_apis::messageType::request == message_type
@@ -385,6 +403,11 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIAddCommandRequest>()
: factory.GetCreator<commands::UIAddCommandResponse>();
}
+ case hmi_apis::FunctionID::UI_CancelInteraction: {
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::UICancelInteractionRequest>()
+ : factory.GetCreator<commands::UICancelInteractionResponse>();
+ }
case hmi_apis::FunctionID::UI_DeleteCommand: {
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::UIDeleteCommandRequest>()
@@ -400,6 +423,16 @@ CommandCreator& HMICommandFactory::get_creator_factory(
? factory.GetCreator<commands::UIDeleteSubmenuRequest>()
: factory.GetCreator<commands::UIDeleteSubmenuResponse>();
}
+ case hmi_apis::FunctionID::UI_ShowAppMenu: {
+ return hmi_apis::messageType::request == message_type
+ ? 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>()
@@ -448,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>()
@@ -852,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 1a1d4f725c..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
@@ -40,10 +40,16 @@
#include "sdl_rpc_plugin/commands/mobile/alert_maneuver_response.h"
#include "sdl_rpc_plugin/commands/mobile/alert_request.h"
#include "sdl_rpc_plugin/commands/mobile/alert_response.h"
+#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_request.h"
+#include "sdl_rpc_plugin/commands/mobile/cancel_interaction_response.h"
#include "sdl_rpc_plugin/commands/mobile/change_registration_request.h"
#include "sdl_rpc_plugin/commands/mobile/change_registration_response.h"
+#include "sdl_rpc_plugin/commands/mobile/close_application_request.h"
+#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"
@@ -52,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"
@@ -110,6 +118,8 @@
#include "sdl_rpc_plugin/commands/mobile/set_global_properties_response.h"
#include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_request.h"
#include "sdl_rpc_plugin/commands/mobile/set_media_clock_timer_response.h"
+#include "sdl_rpc_plugin/commands/mobile/show_app_menu_request.h"
+#include "sdl_rpc_plugin/commands/mobile/show_app_menu_response.h"
#include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_request.h"
#include "sdl_rpc_plugin/commands/mobile/show_constant_tbt_response.h"
#include "sdl_rpc_plugin/commands/mobile/show_request.h"
@@ -170,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>()
@@ -185,6 +200,16 @@ CommandCreator& MobileCommandFactory::get_command_creator(
? factory.GetCreator<commands::DeleteSubMenuRequest>()
: factory.GetCreator<commands::DeleteSubMenuResponse>();
}
+ case mobile_apis::FunctionID::ShowAppMenuID: {
+ return mobile_api::messageType::request == message_type
+ ? 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<
@@ -212,6 +237,11 @@ CommandCreator& MobileCommandFactory::get_command_creator(
? factory.GetCreator<commands::PerformAudioPassThruRequest>()
: factory.GetCreator<commands::PerformAudioPassThruResponse>();
}
+ case mobile_apis::FunctionID::CancelInteractionID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CancelInteractionRequest>()
+ : factory.GetCreator<commands::CancelInteractionResponse>();
+ }
case mobile_apis::FunctionID::CreateInteractionChoiceSetID: {
return mobile_api::messageType::request == message_type
? factory.GetCreator<
@@ -356,6 +386,11 @@ CommandCreator& MobileCommandFactory::get_command_creator(
: factory
.GetCreator<commands::GetCloudAppPropertiesResponse>();
}
+ case mobile_apis::FunctionID::CloseApplicationID: {
+ return mobile_api::messageType::request == message_type
+ ? factory.GetCreator<commands::CloseApplicationRequest>()
+ : factory.GetCreator<commands::CloseApplicationResponse>();
+ }
case mobile_apis::FunctionID::GenericResponseID: {
using app_mngr::commands::Command;
return factory.GetCreator<commands::GenericResponse>();
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 b261b20c24..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);
}
@@ -84,6 +90,13 @@ void SDLRPCPlugin::ClearSubscriptions(app_mngr::ApplicationSharedPtr app) {
} // namespace sdl_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new sdl_rpc_plugin::SDLRPCPlugin();
}
+
+extern "C" __attribute__((visibility("default"))) void Delete(
+ application_manager::plugin_manager::RPCPlugin* data) {
+ delete data;
+} \ No newline at end of file
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
index 1a206c2cce..b21ab9dca8 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/CMakeLists.txt
@@ -23,15 +23,8 @@ file(GLOB SOURCES
)
set(LIBRARIES
+ sdl_rpc_plugin_static
gmock
- Utils
- SmartObjects
- HMI_API
- MOBILE_API
- connectionHandler
- sdl_rpc_plugin
- jsoncpp
- Policy
)
create_cotired_test("sdl_commands_test" "${SOURCES}" "${LIBRARIES}" )
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 8f2feed877..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) {
@@ -192,6 +197,14 @@ const int32_t kMobileProtocolType_ = 0;
const int32_t kProtocolVersion_ = 3;
const uint32_t kCorrelationId_ = 1939u;
const uint32_t kAppId_ = 2014u;
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
+
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
} // namespace
class HMICommandsNotificationsTest
@@ -240,6 +253,9 @@ class HMICommandsNotificationsTest
.WillByDefault(ReturnRef(mock_event_dispatcher_));
ON_CALL(app_mngr_, application_by_hmi_app(_)).WillByDefault(Return(app_));
ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
+ ON_CALL(app_mngr_, application(kConnectionKey)).WillByDefault(Return(app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
}
am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock,
@@ -259,6 +275,8 @@ class HMICommandsNotificationsTest
.WillByDefault(Return(vc));
ON_CALL(**app_mock, IsAudioApplication())
.WillByDefault(Return(media || navi || vc));
+ ON_CALL(**app_mock, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
return app;
}
#if defined(OS_POSIX)
@@ -1090,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,
@@ -1114,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();
}
@@ -1137,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_));
@@ -1338,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_,
@@ -1416,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();
}
}
@@ -1465,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();
}
}
@@ -1793,11 +1812,26 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
EXPECT_CALL(app_mngr_, set_driver_distraction_state(state));
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1805,16 +1839,28 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationEmptyData) {
TEST_F(HMICommandsNotificationsTest,
OnDriverDistractionNotificationInvalidApp) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
ApplicationSharedPtr invalid_app;
application_set_.insert(invalid_app);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _)).Times(0);
EXPECT_CALL(*app_ptr_, app_id()).Times(0);
command->Run();
@@ -1825,21 +1871,33 @@ TEST_F(HMICommandsNotificationsTest, OnDriverDistractionNotificationValidApp) {
hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr message = CreateMessage();
(*message)[am::strings::msg_params][am::mobile_notification::state] = state;
+ (*message)[am::strings::params][am::strings::connection_key] = kConnectionKey;
std::shared_ptr<Command> command =
CreateCommand<hmi::OnDriverDistractionNotification>(message);
application_set_.insert(app_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(applications_));
+
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_));
+ typedef boost::optional<bool> OptionalBool;
+ ON_CALL(mock_policy_handler_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+ std::string required_language = "en-us";
+ ON_CALL(mock_policy_handler_,
+ LockScreenDismissalWarningMessage(required_language))
+ .WillByDefault(Return(
+ boost::optional<std::string>(kLockScreenDismissalWarningMessage_en)));
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(applications_));
+
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_));
- 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))
.WillOnce(GetMessage(message));
- EXPECT_CALL(*app_ptr_, app_id()).WillRepeatedly(Return(kAppId_));
+ ON_CALL(*app_ptr_, app_id()).WillByDefault(Return(kAppId_));
command->Run();
EXPECT_EQ(
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 802ad01d0b..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
@@ -52,22 +52,65 @@ namespace hmi_commands_test {
namespace on_driver_distraction_notification {
using ::testing::_;
+using ::testing::DoAll;
using ::testing::Eq;
+using ::testing::NiceMock;
using ::testing::Return;
+using ::testing::SaveArg;
+using ::testing::SetArgumentPointee;
+
namespace am = ::application_manager;
using am::commands::MessageSharedPtr;
using sdl_rpc_plugin::commands::hmi::OnDriverDistractionNotification;
using namespace am::commands;
+using test::components::commands_test::MobileResultCodeIs;
+
+namespace {
+const std::string kDefaultLanguage = "en-us";
+const mobile_apis::Language::eType kMobileLanguage =
+ mobile_apis::Language::EN_US;
-typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+// LSDW - lock screen dismissal warning
+const std::string kLockScreenDismissalWarningMessage_en =
+ "Swipe down to dismiss, acknowledging that you are not the driver";
+const uint32_t kConnectionKey = 2u;
+} // namespace
class HMIOnDriverDistractionNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
HMIOnDriverDistractionNotificationTest()
- : app_set_lock_(std::make_shared<sync_primitives::Lock>()) {}
+ : mock_app_(CreateMockApp())
+ , app_set_lock_(std::make_shared<sync_primitives::Lock>())
+ , accessor(app_set_, app_set_lock_) {
+ app_set_.insert(mock_app_);
+ InitMocksRelations();
+ }
+
+ typedef std::shared_ptr<OnDriverDistractionNotification> NotificationPtr;
+ typedef boost::optional<bool> OptionalBool;
+
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, ui_language())
+ .WillByDefault(ReturnRef(kMobileLanguage));
+ ON_CALL(app_mngr_, application(kConnectionKey))
+ .WillByDefault(Return(mock_app_));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(kMobileLanguage))
+ .WillByDefault(Return(kDefaultLanguage));
+ }
+
+ MockAppPtr mock_app_;
std::shared_ptr<sync_primitives::Lock> app_set_lock_;
- policy_test::MockPolicyHandlerInterface mock_policy_handler_interface_;
+ am::ApplicationSet app_set_;
+ DataAccessor<am::ApplicationSet> accessor;
+ NiceMock<policy_test::MockPolicyHandlerInterface>
+ mock_policy_handler_interface_;
+
+ void InitMocksRelations() {
+ ON_CALL(app_mngr_, applications()).WillByDefault(Return(accessor));
+ ON_CALL(app_mngr_, GetPolicyHandler())
+ .WillByDefault(ReturnRef(mock_policy_handler_interface_));
+ }
};
MATCHER_P2(CheckNotificationParams, function_id, state, "") {
@@ -83,75 +126,237 @@ 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;
}
-TEST_F(HMIOnDriverDistractionNotificationTest, Run_PushMobileMessage_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ACTION_P(SetMessage, lockScreenDismissalWarning) {
+ smart_objects::SmartObject& notification = arg0;
+
+ notification[application_manager::strings::msg_params]
+ [application_manager::mobile_notification::
+ lock_screen_dismissal_warning] = lockScreenDismissalWarning;
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto LSDW_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en, LSDW_message);
+}
+
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_PushMobileMessage_If_DisallowedByPolicy) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcDisallowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
- 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));
- EXPECT_CALL(*mock_app,
+ MessageSharedPtr pushed_message(CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(*mock_app_,
PushMobileMessage(CheckNotificationParams(
- am::mobile_api::FunctionID::OnDriverDistractionID, state)));
+ am::mobile_api::FunctionID::OnDriverDistractionID, state)))
+ .WillOnce(SaveArg<0>(&pushed_message));
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
command->Run();
+
+ ASSERT_TRUE((*pushed_message)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*pushed_message)[am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
}
TEST_F(HMIOnDriverDistractionNotificationTest,
- Run_SendNotificationToMobile_SUCCESS) {
- const hmi_apis::Common_DriverDistractionState::eType state =
- hmi_apis::Common_DriverDistractionState::DD_ON;
+ Run_SendNotificationIfLockScreenDismissalMissed) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
(*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
NotificationPtr command(
CreateCommand<OnDriverDistractionNotification>(commands_msg));
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(boost::optional<bool>()));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ ON_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillByDefault(GetArg4(&result));
+
+ MessageSharedPtr command_result;
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
+
+ command->Run();
+
+ auto& msg_params =
+ (*command_result)[application_manager::strings::msg_params];
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_enabled));
+ EXPECT_FALSE(msg_params.keyExists(
+ application_manager::mobile_notification::lock_screen_dismissal_warning));
+}
+
+// LSDW - lock screen dimissal
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_LSDWMessageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
- MockAppPtr mock_app = CreateMockApp();
- am::ApplicationSet app_set;
- app_set.insert(mock_app);
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(false)));
- DataAccessor<am::ApplicationSet> accessor(app_set, app_set_lock_);
- EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(accessor));
+ // LockScreenDismissalWarning won't be added to message if value of
+ // LockScreenDismissalEnabledState is false
+ std::string required_language = "en-us";
+ EXPECT_CALL(mock_policy_handler_interface_,
+ LockScreenDismissalWarningMessage(required_language))
+ .Times(0);
policy::CheckPermissionResult result;
result.hmi_level_permitted = policy::kRpcAllowed;
- EXPECT_CALL(app_mngr_, GetPolicyHandler())
- .WillOnce(ReturnRef(mock_policy_handler_interface_));
- 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(
am::mobile_api::FunctionID::OnDriverDistractionID, state),
- Command::CommandSource::SOURCE_SDL));
-
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
command->Run();
+
+ EXPECT_FALSE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
}
+TEST_F(HMIOnDriverDistractionNotificationTest,
+ Run_SendNotificationToMobile_SpecifiedLanguageIsAbsent_SUCCESS) {
+ const auto state = hmi_apis::Common_DriverDistractionState::DD_ON;
+ MessageSharedPtr commands_msg(CreateMessage(smart_objects::SmartType_Map));
+ (*commands_msg)[am::strings::msg_params][am::hmi_notification::state] = state;
+ (*commands_msg)[am::strings::params][am::strings::connection_key] =
+ kConnectionKey;
+
+ NotificationPtr command(
+ CreateCommand<OnDriverDistractionNotification>(commands_msg));
+
+ EXPECT_CALL(app_mngr_, set_driver_distraction_state(Eq(state)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalEnabledState())
+ .WillByDefault(Return(OptionalBool(true)));
+
+ ON_CALL(mock_policy_handler_interface_, LockScreenDismissalWarningMessage(_))
+ .WillByDefault(Return(kLockScreenDismissalWarningMessage_en));
+
+ // In case when specified language is absent in policy table, will added
+ // message on default language (en-us)
+ const mobile_apis::Language::eType mobile_language =
+ mobile_apis::Language::FR_FR;
+ std::string required_language = "FR-FR";
+ ON_CALL(*mock_app_, ui_language()).WillByDefault(ReturnRef(mobile_language));
+ ON_CALL(mock_message_helper_, MobileLanguageToString(mobile_language))
+ .WillByDefault(Return(required_language));
+
+ policy::CheckPermissionResult result;
+ result.hmi_level_permitted = policy::kRpcAllowed;
+ EXPECT_CALL(mock_policy_handler_interface_, CheckPermissions(_, _, _, _, _))
+ .WillOnce(GetArg4(&result));
+
+ MessageSharedPtr message_to_mobile(
+ CreateMessage(smart_objects::SmartType_Map));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ CheckNotificationParams(
+ am::mobile_api::FunctionID::OnDriverDistractionID, state),
+ Command::CommandSource::SOURCE_SDL))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mobile), Return(true)));
+ command->Run();
+
+ ASSERT_TRUE((*message_to_mobile)[am::strings::msg_params].keyExists(
+ am::mobile_notification::lock_screen_dismissal_warning));
+
+ auto lock_screen_dismissal_warning_message =
+ (*message_to_mobile)
+ [am::strings::msg_params]
+ [am::mobile_notification::lock_screen_dismissal_warning]
+ .asString();
+
+ EXPECT_EQ(kLockScreenDismissalWarningMessage_en,
+ lock_screen_dismissal_warning_message);
+}
} // namespace on_driver_distraction_notification
} // namespace hmi_commands_test
} // namespace commands_test
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
index d6df3e61ee..67c36dce9c 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/hmi/rc_get_capabilities_response_test.cc
@@ -139,6 +139,7 @@ TEST_F(RCGetCapabilitiesResponseTest, RUN_SUCCESSS) {
radio_control_capability["hdChannelAvailable"] = true;
radio_control_capability["rdsDataAvailable"] = true;
radio_control_capability["availableHDsAvailable"] = true;
+ radio_control_capability["availableHdChannelsAvailable"] = true;
radio_control_capability["stateAvailable"] = true;
radio_control_capability["signalStrengthAvailable"] = true;
radio_control_capability["signalChangeThresholdAvailable"] = true;
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 3fd3a39dca..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
@@ -145,7 +145,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetHmiZone_SUCCESS) {
TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) {
MessageSharedPtr command_msg = CreateCommandMsg();
(*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
@@ -153,9 +153,40 @@ TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThru_SUCCESS) {
smart_objects::SmartObject audio_pass_thru_capabilities_so =
(*command_msg)[strings::msg_params]
[strings::audio_pass_thru_capabilities];
+
+ // hmi_capabilities will receive a list of capabilities, the first element
+ // being audio_pass_thru_capabilities_so
+ smart_objects::SmartObject audio_pass_thru_capabilities_list_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ audio_pass_thru_capabilities_list_so[0] = audio_pass_thru_capabilities_so;
EXPECT_CALL(
mock_hmi_capabilities_,
- set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_so));
+ set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
+
+ command->Run();
+}
+
+TEST_F(UIGetCapabilitiesResponseTest, SetAudioPassThruList_SUCCESS) {
+ MessageSharedPtr command_msg = CreateCommandMsg();
+
+ // if both audioPassThruCapabilities and audioPassThruCapabilitiesList are
+ // supplied, audioPassThruCapabilitiesList should be used
+ smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject audio_pass_thru_capabilities_list_so =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ (*command_msg)[strings::msg_params][strings::audio_pass_thru_capabilities] =
+ audio_pass_thru_capabilities_so;
+ (*command_msg)[strings::msg_params]
+ [strings::audio_pass_thru_capabilities_list] =
+ audio_pass_thru_capabilities_list_so;
+
+ ResponseFromHMIPtr command(
+ CreateCommand<UIGetCapabilitiesResponse>(command_msg));
+
+ EXPECT_CALL(
+ mock_hmi_capabilities_,
+ set_audio_pass_thru_capabilities(audio_pass_thru_capabilities_list_so));
command->Run();
}
@@ -279,7 +310,7 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::preferred_resolution]
[strings::resolution_width] = 800;
video_streaming_capability[strings::preferred_resolution]
- [strings::resolution_height] = 350;
+ [strings::resolution_height] = 354;
video_streaming_capability[strings::max_bitrate] = 10000;
@@ -297,6 +328,12 @@ TEST_F(UIGetCapabilitiesResponseTest, SetVideoStreamingCapability_SUCCESS) {
video_streaming_capability[strings::haptic_spatial_data_supported] = true;
+ video_streaming_capability[strings::diagonal_screen_size] = 7.47;
+
+ video_streaming_capability[strings::pixel_per_inch] = 117.f;
+
+ video_streaming_capability[strings::scale] = 1.f;
+
ResponseFromHMIPtr command(
CreateCommand<UIGetCapabilitiesResponse>(command_msg));
@@ -306,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_system_request_notification_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
index 69ed8fb311..ffa7203f1f 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_system_request_notification_test.cc
@@ -62,6 +62,7 @@ using testing::SaveArg;
namespace {
const uint32_t kConnectionKey = 1u;
const std::string kPolicyAppId = "fake-app-id";
+const connection_handler::DeviceHandle kDeviceId = 1u;
} // namespace
class OnSystemRequestNotificationTest
@@ -73,6 +74,7 @@ class OnSystemRequestNotificationTest
ON_CALL(app_mngr_, application(kConnectionKey))
.WillByDefault(Return(mock_app_));
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
}
protected:
@@ -90,12 +92,14 @@ TEST_F(OnSystemRequestNotificationTest, Run_ProprietaryType_SUCCESS) {
std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillRepeatedly(Return(true));
#ifdef PROPRIETARY_MODE
@@ -130,10 +134,13 @@ TEST_F(OnSystemRequestNotificationTest, Run_HTTPType_SUCCESS) {
std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_))
@@ -167,7 +174,7 @@ TEST_F(OnSystemRequestNotificationTest, Run_InvalidApp_NoNotification) {
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(MockAppPtr()));
EXPECT_CALL(*mock_app_, policy_app_id()).Times(0);
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _, _)).Times(0);
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
@@ -187,10 +194,13 @@ TEST_F(OnSystemRequestNotificationTest, Run_RequestNotAllowed_NoNotification) {
std::shared_ptr<OnSystemRequestNotification> command =
CreateCommand<OnSystemRequestNotification>(msg);
+ PreConditions();
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId));
- EXPECT_CALL(mock_policy_handler_, IsRequestTypeAllowed(_, _))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(false));
EXPECT_CALL(mock_message_helper_, PrintSmartObject(_)).Times(0);
@@ -214,7 +224,7 @@ TEST_F(
PreConditions();
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
IsRequestSubTypeAllowed(kPolicyAppId, request_subtype))
@@ -241,7 +251,7 @@ TEST_F(OnSystemRequestNotificationTest,
PreConditions();
EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kPolicyAppId, request_type))
+ IsRequestTypeAllowed(kDeviceId, kPolicyAppId, request_type))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
IsRequestSubTypeAllowed(kPolicyAppId, request_subtype))
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/register_app_interface_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
index 0e8374b75a..ac45e90d8e 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/register_app_interface_request_test.cc
@@ -67,6 +67,8 @@ using ::testing::_;
using ::testing::DoAll;
using ::testing::Return;
using ::testing::ReturnRef;
+using ::testing::SaveArg;
+using ::testing::SetArgPointee;
namespace am = ::application_manager;
@@ -75,12 +77,15 @@ using sdl_rpc_plugin::commands::RegisterAppInterfaceRequest;
namespace {
const uint32_t kConnectionKey = 1u;
+const uint32_t kConnectionKey2 = 2u;
const hmi_apis::Common_Language::eType kHmiLanguage =
hmi_apis::Common_Language::EN_US;
const mobile_apis::Language::eType kMobileLanguage =
mobile_apis::Language::EN_US;
-const std::string kMacAddress = "test_mac_address";
-const std::string kAppId = "test_app_id";
+const std::string kMacAddress1 = "test_mac_address1";
+const std::string kMacAddress2 = "test_mac_address2";
+const std::string kAppId1 = "test_app1_id";
+const std::string kAppId2 = "test_app2_id";
const std::string kFullAppId = "test_app_id_long";
const std::string kDummyString = "test_string";
const std::vector<uint32_t> kDummyDiagModes;
@@ -94,6 +99,7 @@ class RegisterAppInterfaceRequestTest
: msg_(CreateMessage())
, command_(CreateCommand<RegisterAppInterfaceRequest>(msg_))
, app_name_("test_app_name_")
+ , app2_name_("test_app2_name_")
, lock_ptr_(std::make_shared<sync_primitives::Lock>())
, mock_application_helper_(
application_manager_test::MockApplicationHelper::
@@ -112,7 +118,7 @@ class RegisterAppInterfaceRequestTest
void InitBasicMessage() {
(*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey;
- (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*msg_)[am::strings::msg_params][am::strings::app_id] = kAppId1;
(*msg_)[am::strings::msg_params][am::strings::full_app_id] = kFullAppId;
(*msg_)[am::strings::msg_params][am::strings::app_name] = app_name_;
(*msg_)[am::strings::msg_params][am::strings::language_desired] =
@@ -130,11 +136,11 @@ class RegisterAppInterfaceRequestTest
MockAppPtr CreateBasicMockedApp() {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(*mock_app, name()).WillByDefault(ReturnRef(app_name_));
- ON_CALL(*mock_app, mac_address()).WillByDefault(ReturnRef(kMacAddress));
+ ON_CALL(*mock_app, mac_address()).WillByDefault(ReturnRef(kMacAddress1));
ON_CALL(*mock_app, app_icon_path()).WillByDefault(ReturnRef(kDummyString));
ON_CALL(*mock_app, language()).WillByDefault(ReturnRef(kMobileLanguage));
ON_CALL(*mock_app, ui_language()).WillByDefault(ReturnRef(kMobileLanguage));
- ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app, policy_app_id()).WillByDefault(Return(kAppId1));
ON_CALL(*mock_app, msg_version())
.WillByDefault(ReturnRef(mock_semantic_version));
return mock_app;
@@ -154,7 +160,7 @@ class RegisterAppInterfaceRequestTest
void InitGetters() {
ON_CALL(app_mngr_, GetCorrectMobileIDFromMessage(msg_))
- .WillByDefault(Return(kAppId));
+ .WillByDefault(Return(kAppId1));
ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(true));
ON_CALL(app_mngr_, resume_controller())
.WillByDefault(ReturnRef(mock_resume_crt_));
@@ -168,7 +174,7 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(ReturnRef(kDummyString));
ON_CALL(app_mngr_settings_, supported_diag_modes())
.WillByDefault(ReturnRef(kDummyDiagModes));
- ON_CALL(mock_policy_handler_, GetAppRequestTypes(_))
+ ON_CALL(mock_policy_handler_, GetAppRequestTypes(_, _))
.WillByDefault(Return(std::vector<std::string>()));
ON_CALL(mock_policy_handler_, GetAppRequestTypeState(_))
.WillByDefault(Return(policy::RequestType::State::EMPTY));
@@ -180,7 +186,7 @@ class RegisterAppInterfaceRequestTest
.WillByDefault(Return(policy::DeviceConsent::kDeviceAllowed));
ON_CALL(app_mngr_, GetDeviceTransportType(_))
.WillByDefault(Return(hmi_apis::Common_TransportType::WIFI));
- ON_CALL(app_mngr_, IsAppInReconnectMode(_)).WillByDefault(Return(false));
+ ON_CALL(app_mngr_, IsAppInReconnectMode(_, _)).WillByDefault(Return(false));
ON_CALL(app_mngr_, application_by_policy_id(_))
.WillByDefault(Return(ApplicationSharedPtr()));
ON_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
@@ -201,7 +207,7 @@ class RegisterAppInterfaceRequestTest
void SetCommonExpectionsOnSwitchedApplication(
MockAppPtr mock_app, mobile_apis::Result::eType response_result_code) {
- EXPECT_CALL(mock_policy_handler_, AddApplication(_, _)).Times(0);
+ EXPECT_CALL(mock_policy_handler_, AddApplication(_, _, _)).Times(0);
EXPECT_CALL(
mock_rpc_service_,
@@ -250,6 +256,7 @@ class RegisterAppInterfaceRequestTest
std::shared_ptr<RegisterAppInterfaceRequest> command_;
const utils::custom_string::CustomString app_name_;
+ const utils::custom_string::CustomString app2_name_;
std::shared_ptr<sync_primitives::Lock> lock_ptr_;
am::ApplicationSet app_set_;
@@ -280,7 +287,7 @@ TEST_F(RegisterAppInterfaceRequestTest, Init_SUCCESS) {
TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
InitBasicMessage();
- (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId;
+ (*msg_)[am::strings::msg_params][am::strings::hash_id] = kAppId1;
EXPECT_CALL(app_mngr_, IsStopping())
.WillOnce(Return(false))
.WillOnce(Return(true))
@@ -289,20 +296,30 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
+ connection_handler::DeviceHandle handle = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(handle, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(ApplicationSharedPtr()))
- .WillRepeatedly(Return(mock_app));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
ON_CALL(app_mngr_, applications())
.WillByDefault(
Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey))
+ .WillOnce(Return(mock_app));
+
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
- ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _))
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
policy::StatusNotifier notify_upd_manager =
std::make_shared<utils::CallNothing>();
- ON_CALL(mock_policy_handler_, AddApplication(_, _))
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
.WillByDefault(Return(notify_upd_manager));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -323,6 +340,7 @@ TEST_F(RegisterAppInterfaceRequestTest, Run_MinimalData_SUCCESS) {
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -360,10 +378,19 @@ TEST_F(RegisterAppInterfaceRequestTest,
EXPECT_CALL(app_mngr_, updateRequestTimeout(_, _, _));
EXPECT_CALL(app_mngr_, IsApplicationForbidden(_, _)).WillOnce(Return(false));
+ connection_handler::DeviceHandle handle = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(handle), Return(0)));
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(_, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
+
EXPECT_CALL(app_mngr_, application(kConnectionKey))
- .WillOnce(Return(ApplicationSharedPtr()))
- .WillRepeatedly(Return(mock_app));
+ .WillOnce(Return(mock_app));
MessageSharedPtr expected_message =
CreateMessage(smart_objects::SmartType_Map);
@@ -401,11 +428,11 @@ TEST_F(RegisterAppInterfaceRequestTest,
.WillByDefault(
Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
- ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId, _, _))
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
.WillByDefault(Return(true));
policy::StatusNotifier notify_upd_manager =
std::make_shared<utils::CallNothing>();
- ON_CALL(mock_policy_handler_, AddApplication(_, _))
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress1, kAppId1, _))
.WillByDefault(Return(notify_upd_manager));
EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app));
@@ -444,7 +471,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
.Times(2);
EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
-
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -456,10 +483,23 @@ TEST_F(RegisterAppInterfaceRequestTest,
(*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
+ app_set_.insert(mock_app);
+ EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId1))
.WillRepeatedly(Return(mock_app));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ ON_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillByDefault(Return(mock_app));
+
+ ON_CALL(app_mngr_, IsAppInReconnectMode(device_id, kAppId1))
+ .WillByDefault(Return(true));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -482,6 +522,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::SUCCESS);
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -492,11 +533,22 @@ TEST_F(RegisterAppInterfaceRequestTest,
const std::string request_hash_id = "abc123";
(*msg_)[am::strings::msg_params][am::strings::hash_id] = request_hash_id;
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
+ EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId1))
.WillRepeatedly(Return(mock_app));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillOnce(Return(mock_app));
+ ON_CALL(app_mngr_, IsAppInReconnectMode(device_id, kAppId1))
+ .WillByDefault(Return(true));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -520,7 +572,7 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
-
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
@@ -528,11 +580,23 @@ TEST_F(RegisterAppInterfaceRequestTest,
SwitchApplication_NoHash_ExpectCleanupResumeFailed) {
InitBasicMessage();
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
MockAppPtr mock_app = CreateBasicMockedApp();
- EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId))
+ EXPECT_CALL(app_mngr_, application_by_policy_id(kAppId1))
.WillRepeatedly(Return(mock_app));
- EXPECT_CALL(app_mngr_, IsAppInReconnectMode(kAppId)).WillOnce(Return(true));
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillOnce(Return(mock_app));
+
+ EXPECT_CALL(app_mngr_, IsAppInReconnectMode(device_id, kAppId1))
+ .WillOnce(Return(true));
EXPECT_CALL(app_mngr_, ProcessReconnection(_, kConnectionKey));
@@ -550,6 +614,133 @@ TEST_F(RegisterAppInterfaceRequestTest,
SetCommonExpectionsOnSwitchedApplication(mock_app,
mobile_apis::Result::RESUME_FAILED);
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_SameAppId_SameDeviceFailed) {
+ using namespace am;
+
+ InitBasicMessage();
+
+ MockAppPtr mock_app1 = CreateBasicMockedApp();
+
+ app_set_.insert(mock_app1);
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+
+ MockAppPtr mock_app2 = CreateBasicMockedApp();
+
+ connection_handler::DeviceHandle device_id = 1;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress1), Return(0)));
+
+ EXPECT_CALL(app_mngr_, application(kMacAddress1, kAppId1))
+ .WillOnce(Return(mock_app1));
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(
+ MobileResultCodeIs(
+ mobile_apis::Result::APPLICATION_REGISTERED_ALREADY),
+ am::commands::Command::SOURCE_SDL));
+
+ ASSERT_TRUE(command_->Init());
+ command_->Run();
+}
+
+TEST_F(RegisterAppInterfaceRequestTest,
+ RegisterApp_SameAppId_DifferentDevicesSuccess) {
+ MockAppPtr mock_app1 = CreateBasicMockedApp();
+ const connection_handler::DeviceHandle device_id1 = 1u;
+ ON_CALL(*mock_app1, device()).WillByDefault(Return(device_id1));
+ app_set_.insert(mock_app1);
+ ON_CALL(app_mngr_, applications())
+ .WillByDefault(
+ Return(DataAccessor<am::ApplicationSet>(app_set_, lock_ptr_)));
+
+ InitBasicMessage();
+ (*msg_)[am::strings::params][am::strings::connection_key] = kConnectionKey2;
+ EXPECT_CALL(app_mngr_, IsStopping())
+ .WillOnce(Return(false))
+ .WillOnce(Return(true))
+ .WillOnce(Return(false));
+ ON_CALL(app_mngr_, IsHMICooperating()).WillByDefault(Return(false));
+ EXPECT_CALL(app_mngr_, updateRequestTimeout(kConnectionKey2, _, _));
+ EXPECT_CALL(app_mngr_, IsApplicationForbidden(kConnectionKey2, kAppId1))
+ .WillOnce(Return(false));
+
+ connection_handler::DeviceHandle device_id2 = 2u;
+ ON_CALL(mock_connection_handler_,
+ GetDataOnSessionKey(kConnectionKey2, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(device_id2), Return(0)));
+
+ ON_CALL(mock_session_observer_, GetDataOnDeviceID(device_id2, _, _, _, _))
+ .WillByDefault(DoAll(SetArgPointee<3>(kMacAddress2), Return(0)));
+
+ MockAppPtr mock_app2 = CreateBasicMockedApp();
+
+ ON_CALL(*mock_app2, device()).WillByDefault(Return(device_id2));
+ ON_CALL(*mock_app2, mac_address()).WillByDefault(ReturnRef(kMacAddress2));
+ EXPECT_CALL(app_mngr_, application(kMacAddress2, kAppId1))
+ .WillRepeatedly(Return(ApplicationSharedPtr()));
+
+ EXPECT_CALL(app_mngr_, application(kConnectionKey2))
+ .WillOnce(Return(mock_app2));
+
+ ON_CALL(mock_policy_handler_, PolicyEnabled()).WillByDefault(Return(true));
+ ON_CALL(mock_policy_handler_, GetInitialAppData(kAppId1, _, _))
+ .WillByDefault(Return(true));
+ policy::StatusNotifier notify_upd_manager =
+ std::make_shared<utils::CallNothing>();
+ ON_CALL(mock_policy_handler_, AddApplication(kMacAddress2, kAppId1, _))
+ .WillByDefault(Return(notify_upd_manager));
+
+ EXPECT_CALL(app_mngr_, RegisterApplication(msg_)).WillOnce(Return(mock_app2));
+
+ EXPECT_CALL(mock_hmi_interfaces_, GetInterfaceState(_))
+ .WillRepeatedly(Return(am::HmiInterfaces::STATE_AVAILABLE));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered),
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::Buttons_OnButtonSubscription),
+ _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::VR_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::TTS_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(
+ mock_rpc_service_,
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::UI_ChangeRegistration), _))
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageMobileCommand(_, am::commands::Command::SOURCE_SDL))
+ .Times(2);
+ EXPECT_CALL(app_mngr_, SendDriverDistractionState(_));
+
+ ASSERT_TRUE(command_->Init());
command_->Run();
}
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/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
index 01f8f313b6..786f2b6bd1 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/subscribe_button_request_test.cc
@@ -106,6 +106,23 @@ TEST_F(SubscribeButtonRequestTest, Run_SubscriptionNotAllowed_UNSUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NavSubscriptionNotAllowed_UNSUCCESS) {
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(false));
+
+ MessageSharedPtr result_msg(CatchMobileCommandResult(CallRun(*command)));
+ EXPECT_EQ(mobile_apis::Result::REJECTED,
+ static_cast<mobile_apis::Result::eType>(
+ (*result_msg)[am::strings::msg_params][am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_UiIsNotSupported_UNSUCCESS) {
CommandPtr command(CreateCommand<SubscribeButtonRequest>());
@@ -203,6 +220,53 @@ TEST_F(SubscribeButtonRequestTest, Run_SUCCESS) {
.asInt()));
}
+TEST_F(SubscribeButtonRequestTest, Run_NAV_SUCCESS) {
+ const mobile_apis::ButtonName::eType kButtonName =
+ mobile_apis::ButtonName::NAV_CENTER_LOCATION;
+
+ MessageSharedPtr msg(CreateMessage());
+ (*msg)[am::strings::msg_params][am::strings::button_name] = kButtonName;
+ CommandPtr command(CreateCommand<SubscribeButtonRequest>(msg));
+
+ MockAppPtr app(CreateMockApp());
+ ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, msg_version()).WillByDefault(ReturnRef(mock_semantic_version));
+ ON_CALL(*app, is_navi()).WillByDefault(Return(true));
+
+ ON_CALL(mock_hmi_capabilities_, is_ui_cooperating())
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr button_caps_ptr(CreateMessage(smart_objects::SmartType_Map));
+ (*button_caps_ptr)[0][am::hmi_response::button_name] = kButtonName;
+
+ ON_CALL(mock_hmi_capabilities_, button_capabilities())
+ .WillByDefault(Return(button_caps_ptr.get()));
+
+ ON_CALL(*app, IsSubscribedToButton(_)).WillByDefault(Return(false));
+
+ MessageSharedPtr hmi_result_msg;
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&hmi_result_msg), Return(true)));
+
+ MessageSharedPtr mobile_result_msg;
+ EXPECT_CALL(this->mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&mobile_result_msg), Return(true)));
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ EXPECT_EQ(hmi_apis::FunctionID::Buttons_OnButtonSubscription,
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*hmi_result_msg)[am::strings::params][am::strings::function_id]
+ .asInt()));
+
+ EXPECT_EQ(mobile_apis::Result::SUCCESS,
+ static_cast<mobile_apis::Result::eType>(
+ (*mobile_result_msg)[am::strings::msg_params]
+ [am::strings::result_code]
+ .asInt()));
+}
+
TEST_F(SubscribeButtonRequestTest, Run_SUCCESS_App_Base_RPC_Version) {
const mobile_apis::ButtonName::eType kButtonName =
mobile_apis::ButtonName::OK;
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
index 7351cd67d3..211888d6be 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/system_request_test.cc
@@ -74,6 +74,7 @@ const std::string kAppStorageFolder = "fake-storage";
const std::string kSystemFilesPath = "/fake/system/files";
const std::string kFileName = "Filename";
const uint32_t kHmiAppId = 3u;
+const connection_handler::DeviceHandle kDeviceId = 1u;
} // namespace
class SystemRequestTest
@@ -99,13 +100,15 @@ class SystemRequestTest
ON_CALL(*mock_app_, policy_app_id()).WillByDefault(Return(kAppPolicyId));
ON_CALL(*mock_app_, folder_name()).WillByDefault(Return(kAppFolderName));
ON_CALL(*mock_app_, hmi_app_id()).WillByDefault(Return(kHmiAppId));
+ ON_CALL(*mock_app_, device()).WillByDefault(Return(kDeviceId));
ON_CALL(app_mngr_settings_, system_files_path())
.WillByDefault(ReturnRef(kSystemFilesPath));
ON_CALL(app_mngr_settings_, app_storage_folder())
.WillByDefault(ReturnRef(kAppStorageFolder));
- ON_CALL(mock_policy_handler_, IsRequestTypeAllowed(kAppPolicyId, _))
+ ON_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(kDeviceId, kAppPolicyId, _))
.WillByDefault(Return(true));
}
@@ -146,9 +149,10 @@ TEST_F(SystemRequestTest,
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
@@ -191,9 +195,10 @@ TEST_F(
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(true));
EXPECT_CALL(mock_policy_handler_,
@@ -216,9 +221,10 @@ TEST_F(SystemRequestTest, Run_RequestTypeDisallowed_SendDisallowedResponse) {
PreConditions();
- EXPECT_CALL(mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId,
- mobile_apis::RequestType::OEM_SPECIFIC))
+ EXPECT_CALL(
+ mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::OEM_SPECIFIC))
.WillOnce(Return(false));
ExpectManageMobileCommandWithResultCode(mobile_apis::Result::DISALLOWED);
@@ -241,9 +247,9 @@ TEST_F(SystemRequestTest, Run_RequestType_IconURL_Success) {
const std::vector<uint8_t> binary_data = {1u, 2u};
(*msg)[am::strings::params][am::strings::binary_data] = binary_data;
- EXPECT_CALL(
- mock_policy_handler_,
- IsRequestTypeAllowed(kAppPolicyId, mobile_apis::RequestType::ICON_URL))
+ EXPECT_CALL(mock_policy_handler_,
+ IsRequestTypeAllowed(
+ kDeviceId, kAppPolicyId, mobile_apis::RequestType::ICON_URL))
.WillOnce(Return(true));
EXPECT_CALL(app_mngr_settings_, app_icons_folder())
.WillOnce(ReturnRef(kAppStorageFolder));