summaryrefslogtreecommitdiff
path: root/src/components/application_manager
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager')
-rw-r--r--src/components/application_manager/include/application_manager/application.h235
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h50
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h60
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h48
-rw-r--r--src/components/application_manager/include/application_manager/application_state.h86
-rw-r--r--src/components/application_manager/include/application_manager/commands/command.h6
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_impl.h5
-rw-r--r--src/components/application_manager/include/application_manager/display_capabilities_builder.h96
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities_impl.h40
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h14
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h83
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h1
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h5
-rw-r--r--src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h5
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h40
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h22
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h34
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h27
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h41
-rw-r--r--src/components/application_manager/include/application_manager/state_controller_impl.h245
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt13
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h1
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h78
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h79
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc97
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc90
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc62
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt12
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc6
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt12
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h3
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h1
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc1
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc4
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc30
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc26
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt11
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc151
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc117
-rw-r--r--src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc13
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/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
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt11
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc2
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc9
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt10
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc67
-rw-r--r--src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc98
-rw-r--r--src/components/application_manager/src/app_service_manager.cc58
-rw-r--r--src/components/application_manager/src/application_data_impl.cc324
-rw-r--r--src/components/application_manager/src/application_impl.cc155
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc289
-rw-r--r--src/components/application_manager/src/application_state.cc253
-rw-r--r--src/components/application_manager/src/commands/command_impl.cc11
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc17
-rw-r--r--src/components/application_manager/src/display_capabilities_builder.cc128
-rw-r--r--src/components/application_manager/src/hmi_capabilities_impl.cc171
-rw-r--r--src/components/application_manager/src/hmi_interfaces_impl.cc8
-rw-r--r--src/components/application_manager/src/hmi_state.cc44
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc194
-rw-r--r--src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc50
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc249
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl_impl.cc177
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc46
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc6
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc6
-rw-r--r--src/components/application_manager/src/rpc_handler_impl.cc5
-rw-r--r--src/components/application_manager/src/rpc_passing_handler.cc4
-rw-r--r--src/components/application_manager/src/rpc_service_impl.cc15
-rw-r--r--src/components/application_manager/src/smart_object_keys.cc38
-rw-r--r--src/components/application_manager/src/state_controller_impl.cc426
-rwxr-xr-xsrc/components/application_manager/test/CMakeLists.txt3
-rw-r--r--src/components/application_manager/test/app_service_manager_test.cc8
-rw-r--r--src/components/application_manager/test/application_impl_test.cc52
-rw-r--r--src/components/application_manager/test/application_manager_impl_test.cc52
-rw-r--r--src/components/application_manager/test/application_state_test.cc86
-rw-r--r--src/components/application_manager/test/commands/CMakeLists.txt2
-rw-r--r--src/components/application_manager/test/commands/command_request_impl_test.cc32
-rw-r--r--src/components/application_manager/test/help_prompt_manager_test.cc6
-rw-r--r--src/components/application_manager/test/hmi_capabilities.json4
-rw-r--r--src/components/application_manager/test/hmi_capabilities_old_apt.json9
-rw-r--r--src/components/application_manager/test/hmi_capabilities_test.cc60
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_application.h110
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h11
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_message_helper.h32
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_request.h1
-rw-r--r--src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h12
-rw-r--r--src/components/application_manager/test/include/application_manager/resumption_data_test.h11
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt2
-rw-r--r--src/components/application_manager/test/message_helper/message_helper_test.cc21
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc55
-rw-r--r--src/components/application_manager/test/policy_handler_test.cc222
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc312
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc66
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc849
215 files changed, 12986 insertions, 1789 deletions
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 72122ff3ec..de4319acb7 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -62,13 +62,17 @@ typedef int32_t ErrorCode;
class UsageStatistics;
+class DisplayCapabilitiesBuilder;
+
enum APIVersion {
kUnknownAPI = -1,
kAPIV0 = 0,
kAPIV1 = 1,
kAPIV2 = 2,
kAPIV3 = 3,
- kAPIV4 = 4
+ kAPIV4 = 4,
+ kAPIV5 = 5,
+ kAPIV6 = 6
};
enum TLimitSource { POLICY_TABLE = 0, CONFIG_FILE };
@@ -146,6 +150,12 @@ typedef std::map<uint32_t, smart_objects::SmartObject*> SubMenuMap;
typedef std::map<uint32_t, smart_objects::SmartObject*> ChoiceSetMap;
/*
+ * @brief Typedef for map of window ids to data used as parameters
+ * to CreateWindow request.
+ */
+typedef std::map<WindowID, smart_objects::SmartObjectSPtr> WindowParamsMap;
+
+/*
* @brief Typedef for perform interaction choice
* @param choice id
* @param SmartObject choice
@@ -162,7 +172,7 @@ typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap;
/**
* @brief Defines id of SoftButton
*/
-typedef std::set<uint32_t> SoftButtonID;
+typedef std::set<std::pair<uint32_t, WindowID> > SoftButtonID;
/**
* @brief Defines set of buttons subscription
@@ -188,9 +198,25 @@ class DynamicApplicationData {
virtual const smart_objects::SmartObject* keyboard_props() const = 0;
virtual const smart_objects::SmartObject* menu_title() const = 0;
virtual const smart_objects::SmartObject* menu_icon() const = 0;
- virtual const smart_objects::SmartObject* day_color_scheme() const = 0;
- virtual const smart_objects::SmartObject* night_color_scheme() const = 0;
- virtual const std::string& display_layout() const = 0;
+ virtual smart_objects::SmartObject day_color_scheme() const = 0;
+ virtual smart_objects::SmartObject night_color_scheme() const = 0;
+ virtual std::string display_layout() const = 0;
+
+ /**
+ * @brief Specific display capabilities of application
+ * @return display capabilities of application or NULL-initialized pointer if
+ * not specified
+ */
+ virtual smart_objects::SmartObjectSPtr display_capabilities() const = 0;
+
+ /**
+ * @brief Specific display capabilities of application
+ * @param window id - id of an affected widget
+ * @return display capabilities of application or NULL-initialized pointer if
+ * not specified
+ */
+ virtual smart_objects::SmartObjectSPtr display_capabilities(
+ const WindowID window_id) const = 0;
virtual void load_global_properties(const smart_objects::SmartObject& so) = 0;
virtual void set_help_prompt(
@@ -222,12 +248,77 @@ class DynamicApplicationData {
virtual void set_video_stream_retry_number(
const uint32_t& video_stream_retry_number) = 0;
+ virtual void set_display_layout(const std::string& layout) = 0;
virtual void set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) = 0;
virtual void set_night_color_scheme(
const smart_objects::SmartObject& color_scheme) = 0;
- virtual void set_display_layout(const std::string& layout) = 0;
+ /**
+ * @brief Set specific application display capabilities
+ * @param display_capabilities new display capabilities of application
+ */
+ virtual void set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) = 0;
+
+ /**
+ * @brief deletes stored window capability for given window id
+ * @param window id of capability to remove
+ */
+ virtual void remove_window_capability(const WindowID window_id) = 0;
+
+ /**
+ * @brief Sets layout for application's specific window
+ * @param window_id window id for which layout should be set
+ * @param layout - layout to be set
+ */
+ virtual void set_window_layout(const WindowID window_id,
+ const std::string& layout) = 0;
+
+ /**
+ * @brief Sets day color scheme for application's specific window
+ * @param window_id window id for which day color scheme should be set
+ * @param color_scheme - color scheme to be set
+ */
+ virtual void set_day_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) = 0;
+
+ /**
+ * @brief Sets night color scheme for application's specific window
+ * @param window_id window id for which night color scheme should be set
+ * @param color_scheme - color scheme to be set
+ */
+ virtual void set_night_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) = 0;
+
+ /**
+ * @brief Gets window layout for application's specific window_id
+ * @param window_id window id for which display layout should be returned
+ * @return string containing set display layout,
+ * if no display layout is set - empty string is returned
+ */
+ virtual std::string window_layout(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Gets day color scheme for application's specific window_id
+ * @param window_id window id for which color scheme should be returned
+ * @return day color scheme which is set for specified app window,
+ * if no day color scheme is set - Smart object with NullType is returned
+ */
+ virtual smart_objects::SmartObject day_color_scheme(
+ const WindowID window_id) const = 0;
+
+ /**
+ * @brief Gets night color scheme for application's specific window_id
+ * @param window_id window id for which color scheme should be returned
+ * @return night color scheme which is set for specified app window
+ * if no night color scheme is set - Smart object with NullType is returned
+ */
+ virtual smart_objects::SmartObject night_color_scheme(
+ const WindowID window_id) const = 0;
+
/**
* @brief Checks if application is media, voice communication or navigation
* @return true if application is media, voice communication or navigation,
@@ -290,6 +381,20 @@ class DynamicApplicationData {
virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0;
/*
+ * @brief Adds window info
+ * @param window_id unique id of a window
+ * @param window_info SmartObject that represent window info
+ */
+ virtual void SetWindowInfo(const WindowID window_id,
+ const smart_objects::SmartObject& window_info) = 0;
+
+ /*
+ * @brief Removes window info
+ * @param window_id unique id of a window
+ */
+ virtual void RemoveWindowInfo(const WindowID window_id) = 0;
+
+ /*
* @brief Finds choice set with the specified choice_set_id id
*
* @param choice_set_id Unique ID of the interaction choice set
@@ -324,6 +429,16 @@ class DynamicApplicationData {
const = 0;
/*
+ * @brief Retrieves window info map
+ */
+ virtual DataAccessor<WindowParamsMap> window_optional_params_map() const = 0;
+
+ /*
+ * @brief Retrieves display capabilities builder
+ */
+ virtual DisplayCapabilitiesBuilder& display_capabilities_builder() = 0;
+
+ /*
* @brief Retrieve application commands
*/
virtual DataAccessor<CommandsMap> commands_map() const = 0;
@@ -449,6 +564,20 @@ class Application : public virtual InitialApplicationData,
*/
virtual void set_is_application_data_changed(bool state_application_data) = 0;
+ /**
+ * @brief Checks if application data is allowed to be resumed
+ * @return TRUE if data of application is allowed to be resumed, otherwise
+ * return FALSE
+ */
+ virtual bool is_app_data_resumption_allowed() const = 0;
+
+ /**
+ * @brief Sets resumption allowance for application data
+ * @param allowed - true if app data allowed to be resumed,
+ * false value means that app data is disallowed for resumption
+ */
+ virtual void set_app_data_resumption_allowance(const bool allowed) = 0;
+
virtual void CloseActiveMessage() = 0;
virtual bool IsFullscreen() const = 0;
virtual void ChangeSupportingAppHMIType() = 0;
@@ -545,11 +674,26 @@ class Application : public virtual InitialApplicationData,
virtual bool is_media_application() const = 0;
virtual bool is_foreground() const = 0;
virtual void set_foreground(const bool is_foreground) = 0;
- virtual const mobile_api::HMILevel::eType hmi_level() const = 0;
+
+ /**
+ * @brief hmi_level current HMI level of application's window
+ * @param window_id id of application's window to get
+ * @return HMI level of application's window
+ */
+ virtual const mobile_api::HMILevel::eType hmi_level(
+ const WindowID window_id) const = 0;
+
virtual const uint32_t put_file_in_none_count() const = 0;
virtual const uint32_t delete_file_in_none_count() const = 0;
virtual const uint32_t list_files_in_none_count() const = 0;
- virtual const mobile_api::SystemContext::eType system_context() const = 0;
+
+ /**
+ * @brief system_context current system context of application's window
+ * @param window_id id of application's window to get
+ * @return system context of application's window
+ */
+ virtual const mobile_api::SystemContext::eType system_context(
+ const WindowID window_id) const = 0;
virtual const mobile_api::AudioStreamingState::eType audio_streaming_state()
const = 0;
virtual const mobile_api::VideoStreamingState::eType video_streaming_state()
@@ -694,58 +838,91 @@ class Application : public virtual InitialApplicationData,
/**
* @brief SetInitialState sets initial HMI state for application on
* registration
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Hmi state value
*/
- virtual void SetInitialState(HmiStatePtr state) = 0;
+ virtual void SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) = 0;
/**
* @brief SetRegularState set permanent state of application
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetRegularState(HmiStatePtr state) = 0;
+ virtual void SetRegularState(const WindowID window_id, HmiStatePtr state) = 0;
/**
* @brief SetPostponedState sets postponed state to application.
* This state could be set as regular later
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetPostponedState(HmiStatePtr state) = 0;
+ virtual void SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) = 0;
- virtual void RemovePostponedState() = 0;
+ /**
+ * @brief RemovePostponedState removes postponed state for application
+ * After removal, this state will not be set as regular later
+ * @param window_id window id for HMI state
+ */
+ virtual void RemovePostponedState(const WindowID window_id) = 0;
/**
* @brief AddHMIState the function that will change application's
* hmi state.
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state new hmi state for certain application.
*/
- virtual void AddHMIState(HmiStatePtr state) = 0;
+ virtual void AddHMIState(const WindowID window_id, HmiStatePtr state) = 0;
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
* of some event
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state_id that should be removed
*/
- virtual void RemoveHMIState(HmiState::StateID state_id) = 0;
+ virtual void RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) = 0;
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @param window_id window id for HMI state
* @return Active HmiState of application
*/
- virtual const HmiStatePtr CurrentHmiState() const = 0;
+ virtual const HmiStatePtr CurrentHmiState(const WindowID window_id) const = 0;
+
+ /**
+ * @brief Getter for a list of available application windows including the
+ * main
+ * @return list of available window IDs created by application
+ */
+ virtual WindowIds GetWindowIds() const = 0;
+
+ /**
+ * @brief Getter for a list of all existing window names
+ * @return list of available window names created by application
+ */
+ virtual WindowNames GetWindowNames() const = 0;
+
+ /**
+ * @brief Check if application has specified window
+ * @param window_id - id of window to check
+ * @return true if app has specified window , otherwise false
+ */
+ virtual bool WindowIdExists(const WindowID window_id) const = 0;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @param window_id window id for HMI state
* @return HmiState of application
*/
- virtual const HmiStatePtr RegularHmiState() const = 0;
+ virtual const HmiStatePtr RegularHmiState(const WindowID window_id) const = 0;
/**
* @brief Checks if app is allowed to change audio source
@@ -756,10 +933,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief PostponedHmiState returns postponed hmi state of application
* if it's present
- *
+ * @param window_id window id for HMI state
* @return Postponed hmi state of application
*/
- virtual const HmiStatePtr PostponedHmiState() const = 0;
+ virtual const HmiStatePtr PostponedHmiState(
+ const WindowID window_id) const = 0;
/**
* @brief Keeps id of softbuttons which is created in commands:
@@ -772,6 +950,13 @@ class Application : public virtual InitialApplicationData,
const SoftButtonID& softbuttons_id) = 0;
/**
+ * @brief Retreives window id on which given button is created
+ * @param button_id identifier of a button
+ * @param window id of a widget containing button
+ */
+ virtual WindowID GetSoftButtonWindowID(const uint32_t button_id) = 0;
+
+ /**
* @brief Determine the existence of softbutton
* @param Softbutton_id contains id of softbutton
* @return Returns true if application contains softbutton id otherwise
@@ -901,9 +1086,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief set_system_context Set system context for application
+ * @param window_id window id for HMI state
* @param system_context Current context
*/
virtual void set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) = 0;
/**
@@ -915,9 +1102,11 @@ class Application : public virtual InitialApplicationData,
/**
* @brief set_hmi_level Set HMI level for application
+ * @param window_id window id for HMI state
* @param hmi_level Current HMI level
*/
- virtual void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) = 0;
+ virtual void set_hmi_level(const WindowID window_id,
+ const mobile_api::HMILevel::eType& hmi_level) = 0;
/**
* @brief Return pointer to extension by uid
diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h
index 7852d6805b..dd093c9890 100644
--- a/src/components/application_manager/include/application_manager/application_data_impl.h
+++ b/src/components/application_manager/include/application_manager/application_data_impl.h
@@ -35,6 +35,7 @@
#include <string>
#include "application_manager/application.h"
+#include "application_manager/display_capabilities_builder.h"
#include "interfaces/MOBILE_API.h"
#include "smart_objects/smart_object.h"
#include "utils/lock.h"
@@ -88,6 +89,7 @@ class InitialApplicationDataImpl : public virtual Application {
class DynamicApplicationDataImpl : public virtual Application {
public:
+ typedef std::map<WindowID, smart_objects::SmartObject> AppWindowsTemplates;
DynamicApplicationDataImpl();
~DynamicApplicationDataImpl();
const smart_objects::SmartObject* help_prompt() const;
@@ -100,9 +102,31 @@ class DynamicApplicationDataImpl : public virtual Application {
const smart_objects::SmartObject* keyboard_props() const;
const smart_objects::SmartObject* menu_title() const;
const smart_objects::SmartObject* menu_icon() const;
- const smart_objects::SmartObject* day_color_scheme() const;
- const smart_objects::SmartObject* night_color_scheme() const;
- const std::string& display_layout() const;
+
+ smart_objects::SmartObject day_color_scheme() const OVERRIDE;
+ smart_objects::SmartObject night_color_scheme() const OVERRIDE;
+ std::string display_layout() const OVERRIDE;
+ smart_objects::SmartObjectSPtr display_capabilities() const OVERRIDE;
+ smart_objects::SmartObjectSPtr display_capabilities(
+ const WindowID window_id) const OVERRIDE;
+
+ void set_window_layout(const WindowID window_id,
+ const std::string& layout) OVERRIDE;
+
+ void set_day_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) OVERRIDE;
+ void set_night_color_scheme(
+ const WindowID window_id,
+ const smart_objects::SmartObject& color_scheme) OVERRIDE;
+
+ std::string window_layout(const WindowID window_id) const OVERRIDE;
+
+ smart_objects::SmartObject day_color_scheme(
+ const WindowID window_id) const OVERRIDE;
+
+ smart_objects::SmartObject night_color_scheme(
+ const WindowID window_id) const OVERRIDE;
void load_global_properties(const smart_objects::SmartObject& properties_so);
void set_help_prompt(const smart_objects::SmartObject& help_prompt);
@@ -120,6 +144,9 @@ class DynamicApplicationDataImpl : public virtual Application {
void set_day_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_night_color_scheme(const smart_objects::SmartObject& color_scheme);
void set_display_layout(const std::string& layout);
+ void set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) OVERRIDE;
+ void remove_window_capability(const WindowID window_id) OVERRIDE;
/*
* @brief Adds a command to the in application menu
*/
@@ -156,6 +183,11 @@ class DynamicApplicationDataImpl : public virtual Application {
*/
bool IsSubMenuNameAlreadyExist(const std::string& name);
+ void SetWindowInfo(const WindowID window_id,
+ const smart_objects::SmartObject& window_info) OVERRIDE;
+
+ void RemoveWindowInfo(const WindowID window_id) OVERRIDE;
+
/*
* @brief Adds a interaction choice set to the application
*
@@ -221,6 +253,10 @@ class DynamicApplicationDataImpl : public virtual Application {
*/
inline DataAccessor<ChoiceSetMap> choice_set_map() const;
+ DataAccessor<WindowParamsMap> window_optional_params_map() const;
+
+ DisplayCapabilitiesBuilder& display_capabilities_builder();
+
/*
* @brief Sets perform interaction state
*
@@ -274,9 +310,8 @@ class DynamicApplicationDataImpl : public virtual Application {
smart_objects::SmartObject* menu_title_;
smart_objects::SmartObject* menu_icon_;
smart_objects::SmartObject* tbt_show_command_;
- smart_objects::SmartObject* day_color_scheme_;
- smart_objects::SmartObject* night_color_scheme_;
- std::string display_layout_;
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ AppWindowsTemplates window_templates_;
CommandsMap commands_;
mutable std::shared_ptr<sync_primitives::RecursiveLock> commands_lock_ptr_;
@@ -287,9 +322,12 @@ class DynamicApplicationDataImpl : public virtual Application {
PerformChoiceSetMap performinteraction_choice_set_map_;
mutable std::shared_ptr<sync_primitives::RecursiveLock>
performinteraction_choice_set_lock_ptr_;
+ WindowParamsMap window_params_map_;
+ mutable std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
uint32_t is_perform_interaction_active_;
bool is_reset_global_properties_active_;
int32_t perform_interaction_mode_;
+ DisplayCapabilitiesBuilder display_capabilities_builder_;
private:
void SetGlobalProperties(
diff --git a/src/components/application_manager/include/application_manager/application_impl.h b/src/components/application_manager/include/application_manager/application_impl.h
index fd9b77eb0f..40bb58c009 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -158,11 +158,13 @@ class ApplicationImpl : public virtual Application,
bool is_media_application() const;
bool is_foreground() const OVERRIDE;
void set_foreground(const bool is_foreground) OVERRIDE;
- const mobile_apis::HMILevel::eType hmi_level() const;
+ const mobile_apis::HMILevel::eType hmi_level(
+ const WindowID window_id) const OVERRIDE;
const uint32_t put_file_in_none_count() const;
const uint32_t delete_file_in_none_count() const;
const uint32_t list_files_in_none_count() const;
- const mobile_api::SystemContext::eType system_context() const;
+ const mobile_api::SystemContext::eType system_context(
+ const WindowID window_id) const OVERRIDE;
inline const mobile_apis::AudioStreamingState::eType audio_streaming_state()
const;
inline const mobile_apis::VideoStreamingState::eType video_streaming_state()
@@ -229,6 +231,8 @@ class ApplicationImpl : public virtual Application,
bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name);
bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name);
+ WindowID GetSoftButtonWindowID(const uint32_t button_id) OVERRIDE;
+
inline bool IsRegistered() const OVERRIDE;
/**
@@ -279,6 +283,9 @@ class ApplicationImpl : public virtual Application,
virtual bool is_application_data_changed() const;
+ bool is_app_data_resumption_allowed() const OVERRIDE;
+ void set_app_data_resumption_allowance(const bool allowed) OVERRIDE;
+
virtual void set_is_application_data_changed(bool state_application_data);
/**
@@ -299,26 +306,35 @@ class ApplicationImpl : public virtual Application,
/**
* @brief SetInitialState sets initial HMI state for application on
* registration
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Hmi state value
*/
- void SetInitialState(HmiStatePtr state) FINAL;
+ void SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) FINAL;
/**
* @brief SetRegularState set permanent state of application
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetRegularState(HmiStatePtr state);
+ void SetRegularState(const WindowID window_id, HmiStatePtr state) FINAL;
/**
* @brief SetPostponedState sets postponed state to application.
* This state could be set as regular later
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- virtual void SetPostponedState(HmiStatePtr state);
+ void SetPostponedState(const WindowID window_id, HmiStatePtr state) FINAL;
- virtual void RemovePostponedState();
+ /**
+ * @brief RemovePostponedState removes postponed state for application
+ * After removal, this state will not be set as regular later
+ * @param window_id window id for HMI state
+ */
+ void RemovePostponedState(const WindowID window_id) FINAL;
/**
* @brief AddHMIState the function that will change application's
@@ -328,7 +344,7 @@ class ApplicationImpl : public virtual Application,
*
* @param state new hmi state for certain application.
*/
- virtual void AddHMIState(HmiStatePtr state);
+ void AddHMIState(const WindowID window_id, HmiStatePtr state) FINAL;
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
@@ -338,13 +354,20 @@ class ApplicationImpl : public virtual Application,
*
* @param state_id that should be removed
*/
- virtual void RemoveHMIState(HmiState::StateID state_id);
+ void RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) FINAL;
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
* @return Active HmiState of application
*/
- virtual const HmiStatePtr CurrentHmiState() const;
+ const HmiStatePtr CurrentHmiState(const WindowID window_i) const FINAL;
+
+ WindowNames GetWindowNames() const FINAL;
+
+ WindowIds GetWindowIds() const FINAL;
+
+ bool WindowIdExists(const WindowID window_id) const FINAL;
/**
* @brief Checks if app is allowed to change audio source
@@ -356,7 +379,7 @@ class ApplicationImpl : public virtual Application,
* @brief RegularHmiState of application without active events VR, TTS etc ...
* @return HmiState of application
*/
- virtual const HmiStatePtr RegularHmiState() const;
+ const HmiStatePtr RegularHmiState(const WindowID window_id) const FINAL;
/**
* @brief PostponedHmiState returns postponed hmi state of application
@@ -364,7 +387,7 @@ class ApplicationImpl : public virtual Application,
*
* @return Postponed hmi state of application
*/
- virtual const HmiStatePtr PostponedHmiState() const;
+ const HmiStatePtr PostponedHmiState(const WindowID window_id) const FINAL;
uint32_t audio_stream_retry_number() const;
@@ -391,6 +414,7 @@ class ApplicationImpl : public virtual Application,
* @param system_context new system context
*/
void set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) OVERRIDE;
/**
* @brief Sets current audio streaming state
@@ -402,7 +426,8 @@ class ApplicationImpl : public virtual Application,
* @brief Sets current HMI level
* @param hmi_level new HMI level
*/
- void set_hmi_level(const mobile_api::HMILevel::eType& hmi_level) OVERRIDE;
+ void set_hmi_level(const WindowID window_id,
+ const mobile_api::HMILevel::eType& hmi_level) OVERRIDE;
void PushMobileMessage(
smart_objects::SmartObjectSPtr mobile_message) OVERRIDE;
@@ -546,6 +571,7 @@ class ApplicationImpl : public virtual Application,
sync_primitives::Lock streaming_stop_lock_;
bool is_app_allowed_;
+ bool is_app_data_resumption_allowed_;
bool has_been_activated_;
bool tts_properties_in_none_;
bool tts_properties_in_full_;
@@ -632,7 +658,8 @@ uint32_t ApplicationImpl::app_id() const {
const mobile_api::AudioStreamingState::eType
ApplicationImpl::audio_streaming_state() const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state =
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
return hmi_state ? hmi_state->audio_streaming_state()
: AudioStreamingState::INVALID_ENUM;
}
@@ -640,7 +667,8 @@ ApplicationImpl::audio_streaming_state() const {
const mobile_api::VideoStreamingState::eType
ApplicationImpl::video_streaming_state() const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state =
+ CurrentHmiState(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
return hmi_state ? hmi_state->video_streaming_state()
: VideoStreamingState::INVALID_ENUM;
}
diff --git a/src/components/application_manager/include/application_manager/application_manager_impl.h b/src/components/application_manager/include/application_manager/application_manager_impl.h
index c34affbf13..a224d51a33 100644
--- a/src/components/application_manager/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/application_manager_impl.h
@@ -203,9 +203,6 @@ class ApplicationManagerImpl
mobile_apis::HMILevel::eType from,
mobile_apis::HMILevel::eType to) OVERRIDE;
- void SendHMIStatusNotification(
- const std::shared_ptr<Application> app) OVERRIDE;
-
void SendDriverDistractionState(ApplicationSharedPtr application);
void SendGetIconUrlNotifications(const uint32_t connection_key,
@@ -476,6 +473,7 @@ class ApplicationManagerImpl
/**
* @brief CreateRegularState create regular HMI state for application
* @param app Application
+ * @param window_type type of window
* @param hmi_level of returned state
* @param audio_state of returned state
* @param system_context of returned state
@@ -483,16 +481,17 @@ class ApplicationManagerImpl
*/
HmiStatePtr CreateRegularState(
std::shared_ptr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const OVERRIDE;
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const OVERRIDE;
/**
* @brief Checks, if given RPC is allowed at current HMI level for specific
* application in policy table
* @param app Application
- * @param hmi_level Current HMI level of application
+ * @param window_id id of application's window
* @param function_id FunctionID of RPC
* @param params_permissions Permissions for RPC parameters (e.g.
* SubscribeVehicleData) defined in policy table
@@ -500,6 +499,7 @@ class ApplicationManagerImpl
*/
mobile_apis::Result::eType CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions = NULL) OVERRIDE;
@@ -517,32 +517,6 @@ class ApplicationManagerImpl
bool IsApplicationForbidden(uint32_t connection_key,
const std::string& mobile_app_id);
- struct ApplicationsAppIdSorter {
- bool operator()(const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
- return lhs->app_id() < rhs->app_id();
- }
- };
-
- struct ApplicationsMobileAppIdSorter {
- bool operator()(const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
- if (lhs->policy_app_id() == rhs->policy_app_id()) {
- return lhs->device() < rhs->device();
- }
- return lhs->policy_app_id() < rhs->policy_app_id();
- }
- };
-
- // typedef for Applications list
- typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplictionSet;
-
- // typedef for Applications list iterator
- typedef ApplictionSet::iterator ApplictionSetIt;
-
- // typedef for Applications list const iterator
- typedef ApplictionSet::const_iterator ApplictionSetConstIt;
-
/**
* @brief Notification from PolicyHandler about PTU.
* Compares AppHMIType between saved in app and received from PTU. If they are
@@ -1065,10 +1039,12 @@ class ApplicationManagerImpl
* @brief IsAppInReconnectMode check if application belongs to session
* affected by transport switching at the moment by checking internal
* waiting list prepared on switching start
+ * @param device_id device identifier
* @param policy_app_id Application id
* @return True if application is in the waiting list, otherwise - false
*/
- bool IsAppInReconnectMode(const std::string& policy_app_id) const FINAL;
+ bool IsAppInReconnectMode(const connection_handler::DeviceHandle& device_id,
+ const std::string& policy_app_id) const FINAL;
bool IsStopping() const OVERRIDE {
return is_stopping_;
@@ -1452,8 +1428,8 @@ class ApplicationManagerImpl
connection_handler::ConnectionHandler* connection_handler_;
std::unique_ptr<policy::PolicyHandlerInterface> policy_handler_;
protocol_handler::ProtocolHandler* protocol_handler_;
- request_controller::RequestController request_ctrl_;
std::unique_ptr<plugin_manager::RPCPluginManager> plugin_manager_;
+ request_controller::RequestController request_ctrl_;
std::unique_ptr<application_manager::AppServiceManager> app_service_manager_;
/**
diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h
index d708a6188d..8c4d2d49d6 100644
--- a/src/components/application_manager/include/application_manager/application_state.h
+++ b/src/components/application_manager/include/application_manager/application_state.h
@@ -32,14 +32,21 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
+
+#include <map>
#include <vector>
+
#include "application_manager/hmi_state.h"
#include "utils/lock.h"
#include "utils/macro.h"
namespace application_manager {
+typedef std::vector<WindowID> WindowIds;
typedef std::vector<HmiStatePtr> HmiStates;
+typedef std::map<WindowID, HmiStates> HmiStatesMap;
+typedef std::vector<std::string> WindowNames;
+typedef std::map<WindowID, std::string> WindowNamesMap;
/*
* Class represents application state, i.e. current HMI level, audio streaming
@@ -63,94 +70,137 @@ class ApplicationState {
/**
* @brief Init state
+ * @param window_id window id for HMI state
+ * @param window_name name of inited window
* @param state Initial state
*/
- void InitState(HmiStatePtr state);
+ void InitState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state);
/**
* @brief Adds state to states storage
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void AddState(HmiStatePtr state);
+ void AddState(const WindowID window_id, HmiStatePtr state);
/**
* @brief Removes state from states storage
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void RemoveState(HmiState::StateID state);
+ void RemoveState(const WindowID window_id, HmiState::StateID state);
/**
* @brief Gets state by state id
+ * @param window_id window id for HMI state
* @param state_id State id
* @return Pointer to application state
*/
- HmiStatePtr GetState(HmiState::StateID state_id) const;
+ HmiStatePtr GetState(const WindowID window_id,
+ HmiState::StateID state_id) const;
+
+ /**
+ * @brief Gets the list of all states matches provided state id
+ * @param state_id state id to get
+ * @return list of all states matches provided state id
+ */
+ HmiStates GetStates(const HmiState::StateID state_id) const;
+
+ /**
+ * @brief Getter for a list of available application windows including the
+ * main
+ * @return list of available window ids
+ */
+ WindowIds GetWindowIds() const;
+
+ /**
+ * @brief Getter f0r a list of all existing window names
+ * @return list of available window names
+ */
+ WindowNames GetWindowNames() const;
private:
/**
* @brief AddHMIState the function that will change application's
* hmi state.
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state
*
* @param state new hmi state for certain application.
*/
- void AddHMIState(HmiStatePtr state);
+ void AddHMIState(const WindowID window_id, HmiStatePtr state);
/**
* @brief RemoveHMIState the function that will turn back hmi_level after end
* of some event
*
- * @param app_id id of the application whose hmi level should be changed.
+ * @param window_id window id for HMI state.
*
* @param state_id that should be removed
*/
- void RemoveHMIState(HmiState::StateID state_id);
+ void RemoveHMIState(const WindowID window_id, HmiState::StateID state_id);
+
+ /**
+ * @brief RemoveWindowHMIStates removes all HMI states related to specified
+ * window
+ * @param window_id window ID to remove
+ */
+ void RemoveWindowHMIStates(const WindowID window_id);
/**
* @brief Removes postponed state
+ * @param window_id window id for HMI state
*/
- void RemovePostponedState();
+ void RemovePostponedState(const WindowID window_id);
/**
* @brief Sets regular state of application
+ * @param window_id window id for HMI state
* @param state State of application
*/
- void SetRegularState(HmiStatePtr state);
+ void SetRegularState(const WindowID window_id, HmiStatePtr state);
/**
* @brief Sets postponed state of application.
* This state could be set as regular later on
- *
+ * @param window_id window id for HMI state
* @param state state to setup
*/
- void SetPostponedState(HmiStatePtr state);
+ void SetPostponedState(const WindowID window_id, HmiStatePtr state);
/**
* @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @param window_id window id for HMI state
* @return Active HmiState of application
*/
- HmiStatePtr CurrentHmiState() const;
+ HmiStatePtr CurrentHmiState(const WindowID window_id) const;
/**
* @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @param window_id window id for HMI state
* @return HmiState of application
*/
- HmiStatePtr RegularHmiState() const;
+ HmiStatePtr RegularHmiState(const WindowID window_id) const;
/**
* @brief PostponedHmiState returns postponed hmi state of application
* if it's present
- *
+ * @param window_id window id for HMI state
* @return Postponed hmi state of application
*/
- HmiStatePtr PostponedHmiState() const;
+ HmiStatePtr PostponedHmiState(const WindowID window_id) const;
/**
* @brief Active states of application
*/
- HmiStates hmi_states_;
- mutable sync_primitives::Lock hmi_states_lock_;
+ HmiStatesMap hmi_states_map_;
+
+ /**
+ * @brief hmi_states_map_lock_
+ */
+ mutable sync_primitives::Lock hmi_states_map_lock_;
DISALLOW_COPY_AND_ASSIGN(ApplicationState);
};
diff --git a/src/components/application_manager/include/application_manager/commands/command.h b/src/components/application_manager/include/application_manager/commands/command.h
index 0693f9868d..0536c7aee1 100644
--- a/src/components/application_manager/include/application_manager/commands/command.h
+++ b/src/components/application_manager/include/application_manager/commands/command.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_COMMAND_H_
#include <stdint.h>
+#include "application_manager/hmi_state.h"
#include "smart_objects/smart_object.h"
namespace application_manager {
@@ -93,6 +94,11 @@ class Command {
virtual int32_t function_id() const = 0;
/*
+ * @brief Retrieves Window ID
+ */
+ virtual WindowID window_id() const = 0;
+
+ /*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
diff --git a/src/components/application_manager/include/application_manager/commands/command_impl.h b/src/components/application_manager/include/application_manager/commands/command_impl.h
index 4e52ac23ce..a526fede6e 100644
--- a/src/components/application_manager/include/application_manager/commands/command_impl.h
+++ b/src/components/application_manager/include/application_manager/commands/command_impl.h
@@ -118,6 +118,11 @@ class CommandImpl : public Command {
int32_t function_id() const OVERRIDE;
/*
+ * @brief Retrieves Window ID
+ */
+ WindowID window_id() const OVERRIDE;
+
+ /*
* @brief Function is called by RequestController when request execution time
* has exceed it's limit
*
diff --git a/src/components/application_manager/include/application_manager/display_capabilities_builder.h b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
new file mode 100644
index 0000000000..529c9a32c1
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/display_capabilities_builder.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DISPLAY_CAPABILITIES_BUILDER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_DISPLAY_CAPABILITIES_BUILDER_H_
+#include "application_manager/application.h"
+
+namespace application_manager {
+/**
+ * @brief DisplayCapabilitiesBuilder utility class used for building cached
+ * notification, which is sent to mobile on resumption finish
+ */
+class DisplayCapabilitiesBuilder {
+ typedef std::function<void(Application&, const smart_objects::SmartObject)>
+ ResumeCallback;
+
+ public:
+ /**
+ * @brief DisplayCapabilitiesBuilder class constructor
+ * @param Application reference to application owner
+ */
+ DisplayCapabilitiesBuilder(Application& application);
+
+ /**
+ * @brief InitBuilder initialize builder with callback and windows to be
+ * restored
+ * @param resume_callback callback to be called when notifications for all
+ * windows have been received
+ * @param windows_info SO containing data of windows to be restored
+ */
+ void InitBuilder(ResumeCallback resume_callback,
+ const smart_objects::SmartObject& windows_info);
+
+ /**
+ * @brief UpdateDisplayCapabilities update cached notification
+ * @param display_capabilities to update cached notification with
+ */
+ void UpdateDisplayCapabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ /**
+ * @brief ResetDisplayCapabilities resets stored notification
+ */
+ void ResetDisplayCapabilities();
+
+ /**
+ * @brief StopWaitingForWindow stop waiting for window resumption by removing
+ * window_id from windows pending resumption
+ * @param window_id window id to be removed
+ */
+ void StopWaitingForWindow(const WindowID window_id);
+
+ /**
+ * @brief retreives stored notification data
+ */
+ const smart_objects::SmartObjectSPtr display_capabilities() const;
+
+ private:
+ smart_objects::SmartObjectSPtr display_capabilities_;
+ typedef std::set<WindowID> WindowIDsToResume;
+ WindowIDsToResume window_ids_to_resume_;
+ Application& owner_;
+ ResumeCallback resume_callback_;
+ sync_primitives::Lock display_capabilities_lock_;
+};
+} // namespace application_manager
+#endif
diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
index 94fc293c3e..c75306345b 100644
--- a/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
+++ b/src/components/application_manager/include/application_manager/hmi_capabilities_impl.h
@@ -230,6 +230,20 @@ class HMICapabilitiesImpl : public HMICapabilities {
const smart_objects::SmartObject& display_capabilities) OVERRIDE;
/*
+ * @brief Retrieves information about the display capability
+ * @return Currently supported display capability
+ */
+ const smart_objects::SmartObjectSPtr system_display_capabilities()
+ const OVERRIDE;
+
+ /*
+ * @brief Sets supported display capability
+ * @param display_capabilities supported display capability
+ */
+ void set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities);
+
+ /*
* @brief Retrieves information about the HMI zone capabilities
*
* @return Currently supported HMI zone capabilities
@@ -439,6 +453,14 @@ class HMICapabilitiesImpl : public HMICapabilities {
bool rc_supported() const OVERRIDE;
/*
+ * @brief Retrieves whether HMI supports passed Menu Layout
+ *
+ * @return TRUE if it supported, otherwise FALSE
+ */
+ bool menu_layout_supported(
+ mobile_apis::MenuLayout::eType layout) const OVERRIDE;
+
+ /*
* @brief Interface used to store information regarding
* the navigation "System Capability"
*
@@ -542,6 +564,18 @@ class HMICapabilitiesImpl : public HMICapabilities {
const Json::Value& json_languages,
smart_objects::SmartObject& languages) const OVERRIDE;
+ /*
+ * @brief function that converts a single entry of audio pass thru capability
+ * to smart object
+ *
+ * @param capability json object that represents a single entry of audio pass
+ * thru capability
+ * @param output_so the converted object
+ */
+ void convert_audio_capability_to_obj(
+ const Json::Value& capability,
+ smart_objects::SmartObject& output_so) const OVERRIDE;
+
private:
bool is_vr_cooperating_;
bool is_tts_cooperating_;
@@ -558,7 +592,13 @@ class HMICapabilitiesImpl : public HMICapabilities {
smart_objects::SmartObject* ui_supported_languages_;
smart_objects::SmartObject* tts_supported_languages_;
smart_objects::SmartObject* vr_supported_languages_;
+ /*
+ * display_capabilities_ is deprecated and replaced by
+ * system_display_capabilities_. For backward compatibility
+ * display_capabilities_ is not removed.
+ */
smart_objects::SmartObject* display_capabilities_;
+ smart_objects::SmartObjectSPtr system_display_capabilities_;
smart_objects::SmartObject* hmi_zone_capabilities_;
smart_objects::SmartObject* soft_buttons_capabilities_;
smart_objects::SmartObject* button_capabilities_;
diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h
index b6a4c180e6..e8c2f8b914 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -46,6 +46,7 @@ class ApplicationManager;
class Application;
typedef std::shared_ptr<HmiState> HmiStatePtr;
+typedef int32_t WindowID;
/**
* @brief The HmiState class
@@ -206,11 +207,24 @@ class HmiState {
state_id_ = state_id;
}
+ /**
+ * @brief window_type getter for a window type for this type
+ * @return current state window type
+ */
+ mobile_apis::WindowType::eType window_type() const;
+
+ /**
+ * @brief set_window_type sets current state window type
+ * @param window_type new window type
+ */
+ void set_window_type(const mobile_apis::WindowType::eType window_type);
+
protected:
uint32_t hmi_app_id_;
StateID state_id_;
const ApplicationManager& app_mngr_;
HmiStatePtr parent_;
+ mobile_apis::WindowType::eType window_type_;
mobile_apis::HMILevel::eType hmi_level_;
mobile_apis::AudioStreamingState::eType audio_streaming_state_;
mobile_apis::VideoStreamingState::eType video_streaming_state_;
diff --git a/src/components/application_manager/include/application_manager/message_helper.h b/src/components/application_manager/include/application_manager/message_helper.h
index 0642dd3cd1..44046be523 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -42,6 +42,7 @@
#include <application_manager/smart_object_keys.h>
#include "application_manager/application.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "connection_handler/device.h"
#include "interfaces/HMI_API.h"
@@ -302,6 +303,30 @@ class MessageHelper {
const uint32_t app_id,
ApplicationManager& app_mngr);
+ /**
+ * @brief Creates UI.CreateWindow request
+ * @param application application instance
+ * @param app_mngr reference to application manager
+ * @param windows_info smart object containing saved windows info
+ * @return smart object with UI.CreateWindow request
+ */
+ static smart_objects::SmartObjectSPtr CreateUICreateWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& window_info);
+
+ /**
+ * @brief Creates UI.CreateWindow requests
+ * @param application application instance
+ * @param app_mngr reference to application manager
+ * @param windows_info smart object containing saved windows info
+ * @return list of smart objects with UI.CreateWindow requests
+ */
+ static smart_objects::SmartObjectList CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info);
+
/*
* @brief Create Common.DeviceInfo struct from device handle
* @param device_handle device handle of the app
@@ -348,15 +373,16 @@ class MessageHelper {
bool is_unexpected_disconnect,
ApplicationManager& app_mngr);
- static ns_smart_device_link::ns_smart_objects::SmartObjectSPtr
- GetBCActivateAppRequestToHMI(
+ static smart_objects::SmartObjectSPtr GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr);
+ static smart_objects::SmartObjectSPtr GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr);
+
static void SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr);
@@ -694,6 +720,23 @@ class MessageHelper {
* @param app current application
*
* @param function_id Unique command id from mobile API
+ *
+ * @param window_id window id containing soft buttons
+ */
+ static void SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id,
+ const WindowID window_id);
+
+ /*
+ * @brief subscribe application to softbutton
+ *
+ * @param message_params contains data of request
+ *
+ * @param app current application
+ *
+ * @param function_id Unique command id from mobile API
*/
static void SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
@@ -710,6 +753,15 @@ class MessageHelper {
*/
static bool PrintSmartObject(const smart_objects::SmartObject& object);
+ /**
+ * @brief Extract window unique ID from message, this id is used for identify
+ * the window
+ * @param s_map contains application's window id
+ * @return window id from current message
+ */
+ static WindowID ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map);
+
template <typename From, typename To>
static To ConvertEnumAPINoCheck(const From& input) {
return static_cast<To>(input);
@@ -725,6 +777,14 @@ class MessageHelper {
hmi_apis::Common_Language::eType language);
/**
+ * @brief Converts mobile language to string representation
+ * @param language Mobile UI language
+ * @return Mobile language string representation
+ */
+ static std::string MobileLanguageToString(
+ mobile_apis::Language::eType language);
+
+ /**
* @brief Converts string to mobile language enum value
* @param language language as string
* @return Mobile language enum value
@@ -855,10 +915,13 @@ class MessageHelper {
/**
* @brief Sends HMI status notification to mobile
- * @param application_impl application with changed HMI status
+ * @param application application with changed HMI status
+ * @param window_id id of affected window
+ * @param application_manager reference to application manager
**/
static void SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager);
/**
@@ -892,6 +955,16 @@ class MessageHelper {
static void BroadcastCapabilityUpdate(smart_objects::SmartObject& msg_params,
ApplicationManager& app_mngr);
+ /**
+ * @brief CreateDisplayCapabilityUpdateToMobile creates notification with
+ * updated display capabilities acccoring to message type
+ * @param system_capabilities SO containing notification data
+ * @param app reference to application
+ * @return shared ptr to notification SO
+ */
+ static smart_objects::SmartObjectSPtr CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& system_capabilities, Application& app);
+
private:
/**
* @brief Allows to fill SO according to the current permissions.
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
index aea0361f19..c3b0d67d67 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin.h
@@ -117,7 +117,6 @@ class RPCPlugin {
ApplicationEvent event,
application_manager::ApplicationSharedPtr application) = 0;
};
-typedef std::unique_ptr<RPCPlugin> RPCPluginPtr;
} // namespace plugin_manager
} // namespace application_manager
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h
index b658e40b1c..abf5494ecb 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager.h
@@ -44,6 +44,10 @@ namespace application_manager {
namespace plugin_manager {
class RPCPluginManager {
+ protected:
+ typedef std::unique_ptr<RPCPlugin, std::function<void(RPCPlugin*)> >
+ RPCPluginPtr;
+
public:
virtual ~RPCPluginManager() {}
/**
@@ -59,6 +63,7 @@ class RPCPluginManager {
* @brief GetPlugins get list of plugins
* @return list of loaded plugins
*/
+ DEPRECATED
virtual std::vector<RPCPluginPtr>& GetPlugins() = 0;
/**
diff --git a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
index 885181e9c4..368817c89c 100644
--- a/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
+++ b/src/components/application_manager/include/application_manager/plugin_manager/rpc_plugin_manager_impl.h
@@ -58,12 +58,17 @@ class RPCPluginManagerImpl : public RPCPluginManager {
policy::PolicyHandlerInterface& policy_handler);
uint32_t LoadPlugins(const std::string& plugins_path) OVERRIDE;
+
+ DEPRECATED
std::vector<RPCPluginPtr>& GetPlugins() OVERRIDE;
+
utils::Optional<RPCPlugin> FindPluginToProcess(
const int32_t function_id,
const commands::Command::CommandSource message_source) OVERRIDE;
private:
+ RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) const;
+
std::vector<RPCPluginPtr> loaded_plugins_;
ApplicationManager& app_manager_;
rpc_service::RPCService& rpc_service_;
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index abffd3eebb..ccbd466cdd 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -87,11 +87,14 @@ class PolicyHandler : public PolicyHandlerInterface,
bool ReceiveMessageFromSDK(const std::string& file,
const BinaryMessage& pt_string) OVERRIDE;
bool UnloadPolicyLibrary() OVERRIDE;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) OVERRIDE;
- virtual void OnPermissionsUpdated(const std::string& policy_app_id,
+ virtual void OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) OVERRIDE;
#ifdef EXTERNAL_PROPRIETARY_MODE
@@ -105,6 +108,7 @@ class PolicyHandler : public PolicyHandlerInterface,
std::string* priority) const OVERRIDE;
virtual void CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) OVERRIDE;
@@ -115,10 +119,12 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Sets HMI default type for specified application
+ * @param device_handle device identifier
* @param application_id ID application
* @param app_types list of HMI types
*/
- void SetDefaultHmiTypes(const std::string& application_id,
+ void SetDefaultHmiTypes(const transport_manager::DeviceHandle& device_handle,
+ const std::string& application_id,
const smart_objects::SmartObject* app_types) OVERRIDE;
/**
@@ -177,7 +183,8 @@ class PolicyHandler : public PolicyHandlerInterface,
bool GetModuleTypes(const std::string& policy_app_id,
std::vector<std::string>* modules) const OVERRIDE;
- bool GetDefaultHmi(const std::string& policy_app_id,
+ bool GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const OVERRIDE;
bool GetInitialAppData(const std::string& application_id,
StringArray* nicknames = NULL,
@@ -204,6 +211,9 @@ class PolicyHandler : public PolicyHandlerInterface,
uint32_t TimeoutExchangeMSec() const OVERRIDE;
void OnExceededTimeout() OVERRIDE;
void OnSystemReady() OVERRIDE;
+ const boost::optional<bool> LockScreenDismissalEnabledState() const OVERRIDE;
+ const boost::optional<std::string> LockScreenDismissalWarningMessage(
+ const std::string& language) const OVERRIDE;
void PTUpdatedAt(Counters counter, int value) OVERRIDE;
void add_listener(PolicyHandlerObserver* listener) OVERRIDE;
void remove_listener(PolicyHandlerObserver* listener) OVERRIDE;
@@ -247,7 +257,8 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void OnIgnitionCycleOver() OVERRIDE;
- void OnPendingPermissionChange(const std::string& policy_app_id) OVERRIDE;
+ void OnPendingPermissionChange(const std::string& device_id,
+ const std::string& policy_app_id) OVERRIDE;
/**
* Initializes PT exchange at user request
@@ -334,9 +345,11 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Update currently used device id in policies manager for given
* application
+ * @param device_handle device identifier
* @param policy_app_id Application id
*/
std::string OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) OVERRIDE;
/**
@@ -500,6 +513,7 @@ class PolicyHandler : public PolicyHandlerInterface,
virtual void SendOnAppPermissionsChanged(
const AppPermissions& permissions,
+ const std::string& device_id,
const std::string& policy_app_id) const OVERRIDE;
virtual void OnPTExchangeNeeded() OVERRIDE;
@@ -509,11 +523,13 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Allows to add new or update existed application during
* registration process
+ * @param device_id device identifier
* @param application_id The policy aplication id.
* @param hmi_types list of hmi types
* @return function that will notify update manager about new application
*/
StatusNotifier AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) OVERRIDE;
@@ -557,17 +573,21 @@ class PolicyHandler : public PolicyHandlerInterface,
* succesfully registered on mobile device.
* It will send OnAppPermissionSend notification and will try to start PTU.
*
+ * @param device_id device identifier
* @param application_id registered application.
*/
- void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE;
+ void OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) OVERRIDE;
/**
* @brief Checks if certain request type is allowed for application
+ * @param device_handle device identifier
* @param policy_app_id Unique applicaion id
* @param type Request type
* @return true, if allowed, otherwise - false
*/
bool IsRequestTypeAllowed(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const OVERRIDE;
@@ -599,10 +619,12 @@ class PolicyHandler : public PolicyHandlerInterface,
/**
* @brief Gets application request types
+ * @param device_id device identifier
* @param policy_app_id Unique application id
* @return request types
*/
const std::vector<std::string> GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_id,
const std::string& policy_app_id) const OVERRIDE;
/**
@@ -661,6 +683,8 @@ class PolicyHandler : public PolicyHandlerInterface,
void OnDeviceSwitching(const std::string& device_id_from,
const std::string& device_id_to) FINAL;
+ void OnLockScreenDismissalStateChanged() FINAL;
+
protected:
/**
* Starts next retry exchange policy table
@@ -720,7 +744,7 @@ class PolicyHandler : public PolicyHandlerInterface,
void UpdateHMILevel(application_manager::ApplicationSharedPtr app,
mobile_apis::HMILevel::eType level);
std::vector<std::string> GetDevicesIds(
- const std::string& policy_app_id) OVERRIDE;
+ const std::string& policy_app_id) const OVERRIDE;
/**
* @brief Sets days after epoch on successful policy update
@@ -807,7 +831,6 @@ class PolicyHandler : public PolicyHandlerInterface,
std::vector<FunctionalGroupPermission> CollectAppPermissions(
const uint32_t connection_key);
- private:
static const std::string kLibrary;
/**
@@ -817,7 +840,6 @@ class PolicyHandler : public PolicyHandlerInterface,
*/
void GetRegisteredLinks(std::map<std::string, std::string>& out_links) const;
- private:
mutable sync_primitives::RWLock policy_manager_lock_;
std::shared_ptr<PolicyManager> policy_manager_;
void* dl_handle_;
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
index 0b744eec7f..11b1bcf926 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -81,6 +81,13 @@ class ResumeCtrl {
application_manager::ApplicationSharedPtr application) = 0;
/**
+ * @brief Restore widgets HMI level on the resumption response from HMI
+ * @param response_message smart_object with HMI message
+ */
+ virtual void RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) = 0;
+
+ /**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
* @return true if success, otherwise return false
@@ -103,6 +110,16 @@ class ResumeCtrl {
bool check_policy = true) = 0;
/**
+ * @brief RestoreAppWidgets add widgets for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ * @return true if widgets resumed successfully otherwise - false
+ */
+ virtual void RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) = 0;
+
+ /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -233,7 +250,7 @@ class ResumeCtrl {
* @param application - application to restore hmi level
* and audio streaming state
*/
- virtual void StartAppHmiStateResumption(
+ virtual bool StartAppHmiStateResumption(
application_manager::ApplicationSharedPtr application) = 0;
/**
@@ -282,6 +299,9 @@ class ResumeCtrl {
virtual int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const = 0;
+ virtual void StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) = 0;
+
virtual time_t LaunchTime() const = 0;
#ifdef BUILD_TESTS
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
index a70e2453de..5e6fb58671 100644
--- a/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl_impl.h
@@ -95,6 +95,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
*/
bool RestoreAppHMIState(app_mngr::ApplicationSharedPtr application) OVERRIDE;
+ void RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) OVERRIDE;
+
/**
* @brief Set application HMI Level as stored in policy
* @param application is application witch HMI Level is need to setup
@@ -117,6 +120,14 @@ class ResumeCtrlImpl : public ResumeCtrl,
bool check_policy = true) OVERRIDE;
/**
+ * @brief RestoreAppWidgets add widgets for the application
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void RestoreAppWidgets(application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) OVERRIDE;
+
+ /**
* @brief Remove application from list of saved applications
* @param application is application which need to be removed
* @return return true, if success, otherwise return false
@@ -250,8 +261,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
* @brief Resume HMI Level and audio streaming state if needed
* @param application - application to restore hmi level
* and audio streaming state
+ * @return true if success otherwise false
*/
- void StartAppHmiStateResumption(
+ bool StartAppHmiStateResumption(
app_mngr::ApplicationSharedPtr application) OVERRIDE;
/**
@@ -296,6 +308,9 @@ class ResumeCtrlImpl : public ResumeCtrl,
int32_t GetSavedAppHmiLevel(const std::string& app_id,
const std::string& device_id) const OVERRIDE;
+ void StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) OVERRIDE;
+
/**
* @brief geter for launch_time_
* @return value of launch_time_
@@ -592,6 +607,16 @@ class ResumeCtrlImpl : public ResumeCtrl,
app_mngr::ApplicationConstSharedPtr application) const;
/**
+ * @brief Constructs and sends system capability mobile notification
+ *
+ * @param app to send display capabilities updated
+ * @param display_capabilities SO containing notification data
+ */
+ void ProcessSystemCapabilityUpdated(
+ app_mngr::Application& app,
+ const smart_objects::SmartObject& display_capabilities);
+
+ /**
*@brief Mapping applications to time_stamps
* wait for timer to resume HMI Level
*
@@ -609,6 +634,13 @@ class ResumeCtrlImpl : public ResumeCtrl,
time_t wake_up_time_;
std::shared_ptr<ResumptionData> resumption_storage_;
application_manager::ApplicationManager& application_manager_;
+ /**
+ *@brief Mapping correlation id to request
+ *wait for on event response from HMI to resume HMI Level
+ */
+ typedef std::map<int32_t, smart_objects::SmartObjectSPtr>
+ WaitingResponseToRequest;
+ WaitingResponseToRequest requests_msg_;
};
} // namespace resumption
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_data.h b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
index 7db7a09cb4..d1dada345c 100644
--- a/src/components/application_manager/include/application_manager/resumption/resumption_data.h
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -1,5 +1,5 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
+/*
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -256,6 +256,14 @@ class ResumptionData {
app_mngr::ApplicationConstSharedPtr application) const;
/**
+ * @brief Retrieves of windows info from list of available window
+ * @param application contains list of available windows
+ * @return windows info from list of available window
+ */
+ smart_objects::SmartObject GetApplicationWidgetsInfo(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
* @brief checks pointer that it is not equal NULL
* @param ptr - contains pointer which need to check
* @return smartObject from pointer
@@ -264,6 +272,21 @@ class ResumptionData {
const smart_objects::SmartObject* ptr) const;
/**
+ * @brief creates smart object containing window info
+ * @param window_id window id
+ * @param window_type window type
+ * @param window_name window name
+ * @param window_optional_params_map collection containing optional params for
+ * creating window
+ * @return smart object with window data
+ */
+ smart_objects::SmartObject CreateWindowInfoSO(
+ const application_manager::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const application_manager::WindowParamsMap& window_optional_params_map)
+ const;
+
+ /**
* @brief Creates smart array from received data
* @param first - iterator points to beginning of the data
* @param last - iterator points to ending of the data
diff --git a/src/components/application_manager/include/application_manager/smart_object_keys.h b/src/components/application_manager/include/application_manager/smart_object_keys.h
index fc124f7558..1831d8cb4d 100644
--- a/src/components/application_manager/include/application_manager/smart_object_keys.h
+++ b/src/components/application_manager/include/application_manager/smart_object_keys.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2019, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -53,6 +53,7 @@ extern const char* info;
extern const char* app_id;
extern const char* full_app_id;
extern const char* bundle_id;
+extern const char* window_id;
extern const char* app_info;
extern const char* app_launch;
extern const char* app_launch_list;
@@ -92,6 +93,7 @@ extern const char* main_field_1;
extern const char* main_field_2;
extern const char* main_field_3;
extern const char* main_field_4;
+extern const char* template_title;
extern const char* metadata_tags;
extern const char* eta;
extern const char* time_to_destination;
@@ -114,6 +116,8 @@ extern const char* num_ticks;
extern const char* slider_footer;
extern const char* menu_id;
extern const char* menu_name;
+extern const char* menu_layout;
+extern const char* menu_layouts_available;
extern const char* interaction_choice_set_id;
extern const char* interaction_choice_set_id_list;
extern const char* choice_set;
@@ -129,7 +133,10 @@ extern const char* initial_prompt;
extern const char* initial_text;
extern const char* duration;
extern const char* progress_indicator;
+extern const char* func_id;
+extern const char* cancel_id;
extern const char* alert_type;
+extern const char* alert_icon;
extern const char* play_tone;
extern const char* soft_buttons;
extern const char* soft_button_id;
@@ -166,9 +173,17 @@ extern const char* activate_app_hmi_level;
extern const char* audio_streaming_state;
extern const char* video_streaming_state;
extern const char* system_context;
+extern const char* window_name;
+extern const char* window_type;
+extern const char* window_type_supported;
+extern const char* maximum_number_of_windows;
+extern const char* window_capabilities;
+extern const char* associated_service_type;
+extern const char* duplicate_updates_from_window_id;
extern const char* speech_capabilities;
extern const char* vr_capabilities;
extern const char* audio_pass_thru_capabilities;
+extern const char* audio_pass_thru_capabilities_list;
extern const char* pcm_stream_capabilities;
extern const char* audio_pass_thru_icon;
extern const char* way_points;
@@ -189,6 +204,8 @@ extern const char* red;
extern const char* green;
extern const char* blue;
extern const char* display_layout;
+extern const char* template_configuration;
+extern const char* template_layout;
extern const char* icon_resumed;
extern const char* nicknames;
extern const char* enabled;
@@ -198,6 +215,7 @@ extern const char* hybrid_app_preference;
extern const char* is_cloud_application;
extern const char* cloud_connection_status;
extern const char* endpoint;
+extern const char* display_capabilities;
// PutFile
extern const char* sync_file_name;
@@ -216,6 +234,7 @@ extern const char* is_template;
extern const char* image;
extern const char* type;
extern const char* system_file;
+extern const char* is_system_file;
extern const char* offset;
extern const char* length;
extern const char* secondary_image;
@@ -254,6 +273,7 @@ extern const char* key_press_mode;
// duplicate names from hmi_request
extern const char* limited_character_list;
extern const char* auto_complete_text;
+extern const char* auto_complete_list;
extern const char* navigation_text;
// vehicle info
@@ -344,6 +364,10 @@ extern const char* activate;
extern const char* set_as_default;
extern const char* origin_app;
+// sis data
+extern const char* station_short_name;
+extern const char* station_location;
+
// resuming
extern const char* application_commands;
extern const char* application_submenus;
@@ -364,11 +388,16 @@ extern const char* ign_off_count;
extern const char* global_ign_on_counter;
+extern const char* suspend_count;
+
extern const char* connection_info;
extern const char* is_download_complete;
+extern const char* shifted;
+extern const char* altitude;
extern const char* longitude_degrees;
extern const char* latitude_degrees;
+
extern const char* address;
extern const char* country_name;
extern const char* country_code;
@@ -397,6 +426,8 @@ extern const char* delivery_mode;
extern const char* audio_streaming_indicator;
+extern const char* windows_info;
+
// keys for default parameters loaded from hmi_capabilities.json:
extern const char* const keyboard_properties_default;
extern const char* const language_default;
@@ -409,7 +440,6 @@ extern const char* const language_supported;
extern const char* const keyboard_layout_supported;
extern const char* const keypress_mode_supported;
extern const char* const limited_characters_list_supported;
-extern const char* const auto_complete_text_supported;
extern const char* const send_location_enabled;
extern const char* const get_way_points_enabled;
extern const char* const entity_type;
@@ -430,6 +460,9 @@ extern const char* const resolution_height;
extern const char* const max_bitrate;
extern const char* const supported_formats;
extern const char* const haptic_spatial_data_supported;
+extern const char* const diagonal_screen_size;
+extern const char* const pixel_per_inch;
+extern const char* const scale;
extern const char* const haptic_rect_data;
extern const char* const rect;
extern const char* const x;
@@ -472,6 +505,8 @@ namespace mobile_notification {
extern const char* state;
extern const char* syncp_timeout;
extern const char* syncp_url;
+extern const char* lock_screen_dismissal_enabled;
+extern const char* lock_screen_dismissal_warning;
} // namespace mobile_notification
namespace hmi_levels {
@@ -518,7 +553,7 @@ extern const char* keyboard_properties;
extern const char* method_name;
extern const char* keyboard_layout;
extern const char* limited_character_list;
-extern const char* auto_complete_text;
+extern const char* auto_complete_list;
extern const char* file;
extern const char* file_name;
extern const char* retry;
diff --git a/src/components/application_manager/include/application_manager/state_controller_impl.h b/src/components/application_manager/include/application_manager/state_controller_impl.h
index f3b2966fca..000569e450 100644
--- a/src/components/application_manager/include/application_manager/state_controller_impl.h
+++ b/src/components/application_manager/include/application_manager/state_controller_impl.h
@@ -52,155 +52,101 @@ class StateControllerImpl : public event_engine::EventObserver,
public:
explicit StateControllerImpl(ApplicationManager& app_mngr);
- /**
- * @brief SetRegularState setup regular hmi state, that will appear if
- * no specific events are active
- * @param app appication to setup regular State
- * @param state state of new regular state
- */
-
- virtual void SetRegularState(ApplicationSharedPtr app,
- HmiStatePtr state,
- const bool SendActivateApp);
-
- /**
- * @brief SetRegularState Change regular hmi level and audio state
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @paran video_state of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state,
+ const bool SendActivateApp) OVERRIDE;
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool SendActivateApp);
-
- /**
- * @brief SetRegularState Change regular hmi level
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
- */
- virtual void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const bool SendActivateApp);
+ const bool SendActivateApp) OVERRIDE;
- /**
- * @brief SetRegularState Change regular hmi level, audio state and system
- * context
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param video_state of new regular state
- * @param system_context of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const bool SendActivateApp) OVERRIDE;
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool SendActivateApp);
+ const bool SendActivateApp) OVERRIDE;
- /**
- * @brief SetRegularState Sets regular state with new hmi level
- * to application
- * @param app appication to setup regular state
- * @param hmi_level new hmi level for application
- */
- virtual void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level);
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level) OVERRIDE;
- /**
- * @brief SetRegularState Change regular audio state
- * @param app appication to setup regular State
- * @param audio_state of new regular state
- * @param video_state of new regular state
- */
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
- const mobile_apis::VideoStreamingState::eType video_state);
+ const mobile_apis::VideoStreamingState::eType video_state) OVERRIDE;
- /**
- * @brief SetRegularState Change regular system context
- * @param app appication to setup regular State
- * @param system_context of new regular state
- */
- virtual void SetRegularState(
+ void SetRegularState(
ApplicationSharedPtr app,
- const mobile_apis::SystemContext::eType system_context);
+ const WindowID window_id,
+ const mobile_apis::SystemContext::eType system_context) OVERRIDE;
- /**
- * @brief SetRegularState Sets new regular state to application
- * @param app appication to setup regular state
- * @param state new hmi state for application
- */
- virtual void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+ void SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state) OVERRIDE;
- // EventObserver interface
- void on_event(const event_engine::Event& event);
- void on_event(const event_engine::MobileEvent& event);
+ void OnApplicationRegistered(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType default_level) OVERRIDE;
- /**
- * @brief Sets default application state and apply currently active HMI states
- * on application registration
- * @param app application to apply states
- * @param default_level default HMI level
- */
- virtual void OnApplicationRegistered(
+ void OnAppWindowAdded(
ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType default_level);
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) OVERRIDE;
- /**
- * @brief OnVideoStreamingStarted process video streaming started
- * @param app projection or navigation application starting streaming
- */
- virtual void OnVideoStreamingStarted(ApplicationConstSharedPtr app);
+ void OnVideoStreamingStarted(ApplicationConstSharedPtr app) OVERRIDE;
- /**
- * @brief OnVideoStreamingStopped process video streaming stopped
- * @param app projection or navigation application stopping streaming
- */
- virtual void OnVideoStreamingStopped(ApplicationConstSharedPtr app);
+ void OnVideoStreamingStopped(ApplicationConstSharedPtr app) OVERRIDE;
- /**
- * @brief OnStateChanged send HMIStatusNotification if needed
- * @param app application
- * @param old_state state before change
- * @param new_state state after change
- */
- virtual void OnStateChanged(ApplicationSharedPtr app,
- HmiStatePtr old_state,
- HmiStatePtr new_state);
+ void OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr old_state,
+ HmiStatePtr new_state) OVERRIDE;
- /**
- * @brief Checks activity of Deactivate HMI state.
- * @return Returns TRUE if deactivate HMI state is active, otherwise returns
- * FALSE.
- */
- virtual bool IsStateActive(HmiState::StateID state_id) const;
+ bool IsStateActive(HmiState::StateID state_id) const OVERRIDE;
+
+ // EventObserver interface
+ void on_event(const event_engine::Event& event) OVERRIDE;
+ void on_event(const event_engine::MobileEvent& event) OVERRIDE;
+
+ void ActivateDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
+ void ExitDefaultWindow(ApplicationSharedPtr app) OVERRIDE;
private:
- int64_t SendBCActivateApp(ApplicationConstSharedPtr app,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority);
+ int64_t RequestHMIStateChange(ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority);
/**
* @brief The HmiLevelConflictResolver struct
* Move other application to HmiStates if applied moved to FULL or LIMITED
*/
struct HmiLevelConflictResolver {
const ApplicationSharedPtr applied_;
+ const WindowID window_id_;
const HmiStatePtr state_;
StateControllerImpl* state_ctrl_;
HmiLevelConflictResolver(const ApplicationSharedPtr app,
+ const WindowID window_id,
const HmiStatePtr state,
StateControllerImpl* state_ctrl)
- : applied_(app), state_(state), state_ctrl_(state_ctrl) {}
+ : applied_(app)
+ , window_id_(window_id)
+ , state_(state)
+ , state_ctrl_(state_ctrl) {}
void operator()(ApplicationSharedPtr to_resolve);
};
@@ -298,14 +244,19 @@ class StateControllerImpl : public event_engine::EventObserver,
template <HmiState::StateID ID>
void HMIStateStarted(ApplicationSharedPtr app) {
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
- HmiStatePtr new_hmi_state = CreateHmiState(app, ID);
- DCHECK_OR_RETURN_VOID(new_hmi_state);
- DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
- HmiState::STATE_ID_REGULAR);
- new_hmi_state->set_parent(old_hmi_state);
- app->AddHMIState(new_hmi_state);
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (auto window_id : window_ids) {
+ HmiStatePtr old_hmi_state = app->CurrentHmiState(window_id);
+ HmiStatePtr new_hmi_state = CreateHmiState(app, ID);
+ DCHECK_OR_RETURN_VOID(new_hmi_state);
+ DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
+ HmiState::STATE_ID_REGULAR);
+ new_hmi_state->set_parent(old_hmi_state);
+ new_hmi_state->set_window_type(old_hmi_state->window_type());
+ app->AddHMIState(window_id, new_hmi_state);
+ OnStateChanged(app, window_id, old_hmi_state, new_hmi_state);
+ }
}
/**
@@ -326,7 +277,7 @@ class StateControllerImpl : public event_engine::EventObserver,
* depends on application type
* @param app Application to deactivate
*/
- void DeactivateApp(ApplicationSharedPtr app);
+ void DeactivateApp(ApplicationSharedPtr app, const WindowID window_id);
/**
* Function to remove temporary HmiState for application
@@ -334,54 +285,78 @@ class StateControllerImpl : public event_engine::EventObserver,
template <HmiState::StateID ID>
void HMIStateStopped(ApplicationSharedPtr app) {
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr cur = app->CurrentHmiState();
- HmiStatePtr old_hmi_state =
- CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(old_hmi_state);
- old_hmi_state->set_hmi_level(cur->hmi_level());
- old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
- old_hmi_state->set_video_streaming_state(cur->video_streaming_state());
- old_hmi_state->set_system_context(cur->system_context());
- app->RemoveHMIState(ID);
- HmiStatePtr new_hmi_state = app->CurrentHmiState();
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (auto window_id : window_ids) {
+ HmiStatePtr cur = app->CurrentHmiState(window_id);
+ HmiStatePtr old_hmi_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(old_hmi_state);
+ old_hmi_state->set_hmi_level(cur->hmi_level());
+ old_hmi_state->set_window_type(cur->window_type());
+ old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
+ old_hmi_state->set_video_streaming_state(cur->video_streaming_state());
+ old_hmi_state->set_system_context(cur->system_context());
+ app->RemoveHMIState(window_id, ID);
+ HmiStatePtr new_hmi_state = app->CurrentHmiState(window_id);
+ OnStateChanged(app, window_id, old_hmi_state, new_hmi_state);
+ }
}
/**
* @brief ApplyRegularState setup regular hmi state, that will appear if no
* specific events are active, without sending ActivateApp
* @param app appication to setup default State
+ * @param window_id id of applicaion's window to apply HMI state
* @param state state of new defailt state
*/
- void ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+ void ApplyRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state);
+
+ /**
+ * @brief UpdateAppWindowsStreamingState updates all application windows
+ * audio/video streaming state according to a new HMI state of the main window
+ * @param app pointer to affected application
+ * @param state pointer to state with the new streaming state of the main
+ * window
+ */
+ void UpdateAppWindowsStreamingState(ApplicationSharedPtr app,
+ HmiStatePtr state);
/**
* @brief SetupRegularHmiState set regular HMI State without
* resolving conflicts and ActivateApp request
* @param app application
+ * @param window_id id of applicaion's window to apply HMI state
* @param state hmi_state to setup
*/
- void SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state);
+ void SetupRegularHmiState(ApplicationSharedPtr app,
+ const WindowID window_id,
+ HmiStatePtr state);
/**
* @brief SetupRegularHmiState set regular HMI State without
* resolving conflicts and ActivateApp request
* @param app application
+ * @param window_id id of applicaion's window to apply HMI state
* @param hmi_level of new regular state
* @param audio_state of new regular state
* @param video_state of new regular state
*/
void SetupRegularHmiState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state);
/**
- * @brief OnActivateAppResponse calback for activate app response
+ * @brief OnHMIResponse callback for activate app or close application
+ * response
* @param message Smart Object
*/
- void OnActivateAppResponse(const smart_objects::SmartObject& message);
+ void OnHMIResponse(const smart_objects::SmartObject& message);
/**
* @brief OnAppDeactivated callback for OnAppDeactivated notification
@@ -449,7 +424,7 @@ class StateControllerImpl : public event_engine::EventObserver,
typedef std::list<HmiState::StateID> StateIDList;
StateIDList active_states_;
mutable sync_primitives::Lock active_states_lock_;
- std::map<uint32_t, HmiStatePtr> waiting_for_activate_;
+ std::map<uint32_t, HmiStatePtr> waiting_for_response_;
ApplicationManager& app_mngr_;
};
} // namespace application_manager
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
index 1e23aac8ee..ef215cdd5a 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/CMakeLists.txt
@@ -53,22 +53,25 @@ collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands")
set(LIBRARIES
HMI_API
MOBILE_API
+ MessageHelper
ApplicationManager
+ Resumption
v4_protocol_v1_2_no_extra
SmartObjects
Utils
- sdl_rpc_plugin
+ sdl_rpc_plugin_static
)
if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("app_service_rpc_plugin" SHARED ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${COMMANDS_SOURCES})
-target_link_libraries("app_service_rpc_plugin" ${LIBRARIES})
+add_library("app_service_rpc_plugin_static" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
+target_link_libraries("app_service_rpc_plugin_static" ${LIBRARIES})
+
+add_library("app_service_rpc_plugin" SHARED "src/app_service_rpc_plugin.cc")
+target_link_libraries("app_service_rpc_plugin" app_service_rpc_plugin_static)
-add_library("AppServiceRpcPluginStaticLib" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
-target_link_libraries("AppServiceRpcPluginStaticLib" ${LIBRARIES})
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
index c9cb98cdfb..1120f68327 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/app_service_rpc_plugin.h
@@ -69,5 +69,6 @@ class AppServiceRpcPlugin : public plugins::RPCPlugin {
} // namespace app_service_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_APP_SERVICE_PLUGIN_INCLUDE_APP_SERVICE_PLUGIN_APP_SERVICE_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h
new file mode 100644
index 0000000000..fdeadfa7c0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h
@@ -0,0 +1,78 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "application_manager/commands/request_from_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASUnpublishAppServiceRequest command class
+ **/
+class ASUnpublishAppServiceRequest : public app_mngr::commands::RequestFromHMI {
+ public:
+ /**
+ * @brief ASUnpublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASUnpublishAppServiceRequest(
+ 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 ASUnpublishAppServiceRequest class destructor
+ **/
+ virtual ~ASUnpublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASUnpublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h
new file mode 100644
index 0000000000..51edd2dadb
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h
@@ -0,0 +1,78 @@
+/*
+ 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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "application_manager/commands/response_to_hmi.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief ASUnpublishAppServiceResponse command class
+ **/
+class ASUnpublishAppServiceResponse : public app_mngr::commands::ResponseToHMI {
+ public:
+ /**
+ * @brief ASUnpublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ ASUnpublishAppServiceResponse(
+ 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 ASUnpublishAppServiceResponse class destructor
+ **/
+ virtual ~ASUnpublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ASUnpublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_HMI_AS_UNPUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h
new file mode 100644
index 0000000000..4a883b92ee
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
+
+#include "application_manager/commands/command_request_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UnpublishAppServiceRequest command class
+ **/
+class UnpublishAppServiceRequest
+ : public app_mngr::commands::CommandRequestImpl {
+ public:
+ /**
+ * @brief UnpublishAppServiceRequest class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UnpublishAppServiceRequest(
+ 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 UnpublishAppServiceRequest class destructor
+ **/
+ virtual ~UnpublishAppServiceRequest();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnpublishAppServiceRequest);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_REQUEST_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h
new file mode 100644
index 0000000000..512e39eea0
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/include/app_service_rpc_plugin/commands/mobile/unpublish_app_service_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_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+
+namespace app_service_rpc_plugin {
+namespace app_mngr = application_manager;
+
+namespace commands {
+
+/**
+ * @brief UnpublishAppServiceResponse command class
+ **/
+class UnpublishAppServiceResponse
+ : public app_mngr::commands::CommandResponseImpl {
+ public:
+ /**
+ * @brief UnpublishAppServiceResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ UnpublishAppServiceResponse(
+ 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 UnpublishAppServiceResponse class destructor
+ **/
+ virtual ~UnpublishAppServiceResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(UnpublishAppServiceResponse);
+};
+
+} // namespace commands
+
+} // namespace app_service_rpc_plugin
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_RPC_PLUGINS_APP_SERVICE_RPC_PLUGIN_INCLUDE_APP_SERVICE_RPC_PLUGIN_COMMANDS_MOBILE_UNPUBLISH_APP_SERVICE_RESPONSE_H_
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
index 1cec2ccdce..3090ea8ced 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_hmi_command_factory.cc
@@ -50,6 +50,8 @@
#include "app_service_rpc_plugin/commands/hmi/as_perform_app_service_interaction_response_to_hmi.h"
#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_request.h"
#include "app_service_rpc_plugin/commands/hmi/as_publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h"
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification.h"
#include "app_service_rpc_plugin/commands/hmi/on_as_app_service_data_notification_from_hmi.h"
@@ -126,6 +128,11 @@ app_mngr::CommandCreator& AppServiceHmiCommandFactory::buildCommandCreator(
return hmi_apis::messageType::request == message_type
? factory.GetCreator<commands::ASPublishAppServiceRequest>()
: factory.GetCreator<commands::ASPublishAppServiceResponse>();
+ case hmi_apis::FunctionID::AppService_UnpublishAppService:
+ return hmi_apis::messageType::request == message_type
+ ? factory.GetCreator<commands::ASUnpublishAppServiceRequest>()
+ : factory
+ .GetCreator<commands::ASUnpublishAppServiceResponse>();
case hmi_apis::FunctionID::AppService_OnAppServiceData:
return app_mngr::commands::Command::CommandSource::SOURCE_HMI == source
? factory.GetCreator<
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
index 76be96cf8f..5c44fb5fae 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_mobile_command_factory.cc
@@ -47,6 +47,8 @@
#include "app_service_rpc_plugin/commands/mobile/perform_app_service_interaction_response_from_mobile.h"
#include "app_service_rpc_plugin/commands/mobile/publish_app_service_request.h"
#include "app_service_rpc_plugin/commands/mobile/publish_app_service_response.h"
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
+#include "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "AppServiceRpcPlugin")
@@ -120,6 +122,16 @@ app_mngr::CommandCreator& AppServiceMobileCommandFactory::buildCommandCreator(
return factory.GetCreator<commands::PublishAppServiceResponse>();
}
break;
+ case mobile_apis::FunctionID::UnpublishAppServiceID:
+ if (app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source &&
+ mobile_apis::messageType::response != message_type) {
+ return factory.GetCreator<commands::UnpublishAppServiceRequest>();
+ } else if (app_mngr::commands::Command::CommandSource::SOURCE_SDL ==
+ source &&
+ mobile_apis::messageType::request != message_type) {
+ return factory.GetCreator<commands::UnpublishAppServiceResponse>();
+ }
+ break;
case mobile_apis::FunctionID::OnAppServiceDataID:
return app_mngr::commands::Command::CommandSource::SOURCE_MOBILE == source
? factory.GetCreator<
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
index 3b1b0715d4..7195ce234f 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/app_service_rpc_plugin.cc
@@ -93,6 +93,13 @@ void AppServiceRpcPlugin::DeleteSubscriptions(
} // namespace app_service_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new app_service_rpc_plugin::AppServiceRpcPlugin();
}
+
+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/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
new file mode 100644
index 0000000000..30905b5fa2
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_request.cc
@@ -0,0 +1,97 @@
+/*
+ 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 "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_request.h"
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASUnpublishAppServiceRequest::ASUnpublishAppServiceRequest(
+ 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)
+ : RequestFromHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASUnpublishAppServiceRequest::~ASUnpublishAppServiceRequest() {}
+
+void ASUnpublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_id].asString();
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+ if (!service || service->mobile_service) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::INVALID_ID,
+ "Invalid Service ID",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ bool ret = application_manager_.GetAppServiceManager().UnpublishAppService(
+ service_id);
+
+ if (!ret) {
+ SendErrorResponse(
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::REJECTED,
+ "The app service with that requested service ID does not exist",
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+ return;
+ }
+
+ SendResponse(true,
+ (*message_)[strings::params][strings::correlation_id].asUInt(),
+ hmi_apis::FunctionID::AppService_UnpublishAppService,
+ hmi_apis::Common_Result::SUCCESS,
+ NULL,
+ application_manager::commands::Command::SOURCE_SDL_TO_HMI);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
new file mode 100644
index 0000000000..0c8b479da8
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/hmi/as_unpublish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ 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 "app_service_rpc_plugin/commands/hmi/as_unpublish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+ASUnpublishAppServiceResponse::ASUnpublishAppServiceResponse(
+ 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)
+ : ResponseToHMI(message,
+ application_manager,
+ rpc_service,
+ hmi_capabilities,
+ policy_handler) {}
+
+ASUnpublishAppServiceResponse::~ASUnpublishAppServiceResponse() {}
+
+void ASUnpublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToHMI(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
index c168b4bf2f..53d1bf82fa 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/publish_app_service_request.cc
@@ -120,12 +120,6 @@ void PublishAppServiceRequest::Run() {
return;
}
- if (app->IsFullscreen()) {
- // Service should be activated if app is in the foreground
- application_manager_.GetAppServiceManager().ActivateAppService(
- service_record[strings::service_id].asString());
- }
-
response_params[strings::app_service_record] = service_record;
SendResponse(true, mobile_apis::Result::SUCCESS, NULL, &response_params);
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
new file mode 100644
index 0000000000..2cb43bce07
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_request.cc
@@ -0,0 +1,90 @@
+/*
+ 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 "app_service_rpc_plugin/commands/mobile/unpublish_app_service_request.h"
+
+#include "application_manager/app_service_manager.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+UnpublishAppServiceRequest::UnpublishAppServiceRequest(
+ 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) {}
+
+UnpublishAppServiceRequest::~UnpublishAppServiceRequest() {}
+
+void UnpublishAppServiceRequest::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ std::string service_id =
+ (*message_)[strings::msg_params][strings::service_id].asString();
+
+ auto service =
+ application_manager_.GetAppServiceManager().FindServiceByID(service_id);
+
+ if (!service || service->connection_key != connection_key()) {
+ SendResponse(false,
+ mobile_apis::Result::INVALID_ID,
+ "No app service with the requested service ID was published "
+ "by this application");
+ return;
+ }
+
+ bool ret = application_manager_.GetAppServiceManager().UnpublishAppService(
+ service_id);
+
+ if (!ret) {
+ SendResponse(
+ false,
+ mobile_apis::Result::INVALID_ID,
+ "The app service with that requested service ID does not exist");
+ return;
+ }
+
+ SendResponse(true, mobile_apis::Result::SUCCESS, NULL, NULL);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
new file mode 100644
index 0000000000..22450ecc4c
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/src/commands/mobile/unpublish_app_service_response.cc
@@ -0,0 +1,62 @@
+/*
+ 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 "app_service_rpc_plugin/commands/mobile/unpublish_app_service_response.h"
+#include "application_manager/application_impl.h"
+#include "application_manager/rpc_service.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace app_service_rpc_plugin {
+using namespace application_manager;
+namespace commands {
+
+UnpublishAppServiceResponse::UnpublishAppServiceResponse(
+ 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) {}
+
+UnpublishAppServiceResponse::~UnpublishAppServiceResponse() {}
+
+void UnpublishAppServiceResponse::Run() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ rpc_service_.SendMessageToMobile(message_);
+}
+
+} // namespace commands
+} // namespace app_service_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
index 0b56ddb7e9..0b69c01606 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/CMakeLists.txt
@@ -25,16 +25,8 @@ file(GLOB SOURCES
set(LIBRARIES
gmock
- Utils
- SmartObjects
- HMI_API
- MOBILE_API
- connectionHandler
- app_service_rpc_plugin
- sdl_rpc_plugin
- jsoncpp
- Policy
- Resumption
+ sdl_rpc_plugin_static
+ app_service_rpc_plugin_static
)
create_cotired_test("app_services_commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
index f64f353767..4236ac23f9 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/hmi/dummy_hmi_commands_test.cc
@@ -53,6 +53,8 @@
#include "hmi/as_perform_app_service_interaction_response_to_hmi.h"
#include "hmi/as_publish_app_service_request.h"
#include "hmi/as_publish_app_service_response.h"
+#include "hmi/as_unpublish_app_service_request.h"
+#include "hmi/as_unpublish_app_service_response.h"
#include "hmi/on_as_app_service_data_notification.h"
#include "hmi/on_as_app_service_data_notification_from_hmi.h"
@@ -132,6 +134,8 @@ typedef Types<commands::ASAppServiceActivationRequest,
commands::ASPerformAppServiceInteractionResponseToHMI,
commands::ASPublishAppServiceRequest,
commands::ASPublishAppServiceResponse,
+ commands::ASUnpublishAppServiceRequest,
+ commands::ASUnpublishAppServiceResponse,
commands::OnASAppServiceDataNotification,
commands::OnASAppServiceDataNotificationFromHMI>
HMICommandsListFirst;
diff --git a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
index e77b21ca6d..69bff3ad76 100644
--- a/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
+++ b/src/components/application_manager/rpc_plugins/app_service_rpc_plugin/test/commands/mobile/dummy_mobile_commands_test.cc
@@ -49,6 +49,8 @@
#include "mobile/perform_app_service_interaction_response_from_mobile.h"
#include "mobile/publish_app_service_request.h"
#include "mobile/publish_app_service_response.h"
+#include "mobile/unpublish_app_service_request.h"
+#include "mobile/unpublish_app_service_response.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_application_manager.h"
@@ -118,7 +120,9 @@ typedef Types<commands::GetAppServiceDataRequest,
commands::PerformAppServiceInteractionResponse,
commands::PerformAppServiceInteractionResponseFromMobile,
commands::PublishAppServiceRequest,
- commands::PublishAppServiceResponse>
+ commands::PublishAppServiceResponse,
+ commands::UnpublishAppServiceRequest,
+ commands::UnpublishAppServiceResponse>
MobileCommandsListFirst;
TYPED_TEST_CASE(MobileCommandsTestFirst, MobileCommandsListFirst);
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
index 00de927b6e..8129e1240d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/CMakeLists.txt
@@ -50,7 +50,10 @@ collect_sources(COMMANDS_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/commands")
set(LIBRARIES
HMI_API
MOBILE_API
+ MessageHelper
ApplicationManager
+ ProtocolHandler
+ connectionHandler
v4_protocol_v1_2_no_extra
SmartObjects
Utils
@@ -60,11 +63,12 @@ if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("rc_rpc_plugin" SHARED ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${COMMANDS_SOURCES})
-target_link_libraries("rc_rpc_plugin" ${LIBRARIES})
+add_library("rc_rpc_plugin_static" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
+target_link_libraries("rc_rpc_plugin_static" ${LIBRARIES})
+
+add_library("rc_rpc_plugin" SHARED "src/rc_rpc_plugin.cc")
+target_link_libraries("rc_rpc_plugin" rc_rpc_plugin_static)
-add_library("RCRpcPluginStaticLib" ${PLUGIN_SOURCES} ${MOBILE_COMMANDS} ${HMI_COMMANDS})
-target_link_libraries("RCRpcPluginStaticLib" ${LIBRARIES})
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
index cd87ad326e..e85ab758ad 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_helpers.h
@@ -91,6 +91,15 @@ class RCHelpers {
AppsModules;
static AppsModules GetApplicationsAllowedModules(
application_manager::ApplicationManager& app_mngr);
+
+ /**
+ * @brief RemoveRedundantGPSDataFromVIDataMsg removes redundant GPS data
+ * params from interior vehicle data response message if one contains radio
+ * station location data
+ * @param msg_params Params of the interior vehicle data response message
+ */
+ static void RemoveRedundantGPSDataFromIVDataMsg(
+ smart_objects::SmartObject& msg_params);
};
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
index 92ff7e5f01..b9f922a1be 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_module_constants.h
@@ -152,6 +152,7 @@ const char kBand[] = "band";
const char kRdsData[] = "rdsData";
const char kHdRadioEnable[] = "hdRadioEnable";
const char kAvailableHDs[] = "availableHDs";
+const char kAvailableHdChannels[] = "availableHdChannels";
const char kHdChannel[] = "hdChannel";
const char kSignalStrength[] = "signalStrength";
const char kSignalChangeThreshold[] = "signalChangeThreshold";
@@ -176,6 +177,8 @@ const char kHeatedSteeringWheelEnable[] = "heatedSteeringWheelEnable";
const char kHeatedWindshieldEnable[] = "heatedWindshieldEnable";
const char kHeatedRearWindowEnable[] = "heatedRearWindowEnable";
const char kHeatedMirrorsEnable[] = "heatedMirrorsEnable";
+const char kClimateEnable[] = "climateEnable";
+const char kClimateEnableAvailable[] = "climateEnableAvailable";
// ClimateControlData struct
// LightControlData
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
index 303b31f857..cd15674889 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/include/rc_rpc_plugin/rc_rpc_plugin.h
@@ -109,5 +109,6 @@ class RCRPCPlugin : public plugins::RPCPlugin {
} // namespace rc_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_RC_RPC_PLUGIN_INCLUDE_RC_RPC_PLUGIN_RC_RPC_PLUGIN_H_
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
index 47363bddcd..ded96461f5 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_request.cc
@@ -109,6 +109,7 @@ void GetInteriorVehicleDataRequest::FilterDisabledModuleData(
module_data[message_params::kHdRadioEnable].asBool() == false) {
module_data.erase(message_params::kHdChannel);
module_data.erase(message_params::kAvailableHDs);
+ module_data.erase(message_params::kAvailableHdChannels);
module_data.erase(message_params::kSisData);
}
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
index a7572f1d62..b1fa8d6ea0 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/get_interior_vehicle_data_response.cc
@@ -31,6 +31,7 @@
*/
#include "rc_rpc_plugin/commands/mobile/get_interior_vehicle_data_response.h"
+#include "rc_rpc_plugin/rc_helpers.h"
#include "utils/macro.h"
namespace rc_rpc_plugin {
@@ -49,6 +50,9 @@ GetInteriorVehicleDataResponse::~GetInteriorVehicleDataResponse() {}
void GetInteriorVehicleDataResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+
+ RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ (*message_)[app_mngr::strings::msg_params]);
application_manager_.GetRPCService().SendMessageToMobile(message_);
}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
index 53b04ce3ef..06b5218bb3 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/on_interior_vehicle_data_notification.cc
@@ -75,6 +75,8 @@ void OnInteriorVehicleDataNotification::Run() {
typedef std::vector<application_manager::ApplicationSharedPtr> AppPtrs;
AppPtrs apps = RCRPCPlugin::GetRCApplications(application_manager_);
+ RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ (*message_)[app_mngr::strings::msg_params]);
for (AppPtrs::iterator it = apps.begin(); it != apps.end(); ++it) {
DCHECK(*it);
application_manager::Application& app = **it;
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
index 2bf8fbbe92..44d302276d 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/commands/mobile/set_interior_vehicle_data_request.cc
@@ -55,6 +55,7 @@ std::vector<std::string> GetModuleReadOnlyParams(
} else if (enums_value::kRadio == module_type) {
module_ro_params.push_back(kRdsData);
module_ro_params.push_back(kAvailableHDs);
+ module_ro_params.push_back(kAvailableHdChannels);
module_ro_params.push_back(kSignalStrength);
module_ro_params.push_back(kSignalChangeThreshold);
module_ro_params.push_back(kState);
@@ -92,6 +93,8 @@ const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() {
mapping["heatedWindshieldEnable"] = "heatedWindshieldAvailable";
mapping["heatedMirrorsEnable"] = "heatedMirrorsAvailable";
mapping["heatedRearWindowEnable"] = "heatedRearWindowAvailable";
+ mapping["climateEnable"] = "climateEnableAvailable";
+ mapping["climateEnableAvailable"] = "climateEnableAvailable";
// radio
mapping["band"] = "radioBandAvailable";
@@ -99,7 +102,8 @@ const std::map<std::string, std::string> GetModuleDataToCapabilitiesMapping() {
mapping["frequencyFraction"] = "radioFrequencyAvailable";
mapping["rdsData"] = "rdsDataAvailable";
mapping["availableHDs"] = "availableHDsAvailable";
- mapping["hdChannel"] = "availableHDsAvailable";
+ mapping["availableHdChannels"] = "availableHdChannelsAvailable";
+ mapping["hdChannel"] = "availableHdChannelsAvailable";
mapping["hdRadioEnable"] = "hdRadioEnableAvailable";
mapping["signalStrength"] = "signalStrengthAvailable";
mapping["signalChangeThreshold"] = "signalChangeThresholdAvailable";
@@ -716,21 +720,6 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
const smart_objects::SmartObject& module_type_params =
ControlData(module_data);
const std::string module_type = ModuleType();
- std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type);
-
- for (auto& it : ro_params) {
- if (module_type_params.keyExists(it)) {
- if (enums_value::kClimate == module_type) {
- module_data[message_params::kClimateControlData].erase(it);
- } else if (enums_value::kRadio == module_type) {
- module_data[message_params::kRadioControlData].erase(it);
- } else {
- continue;
- }
-
- LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << it);
- }
- }
if (enums_value::kAudio == module_type) {
auto& equalizer_settings = module_data[message_params::kAudioControlData]
@@ -745,6 +734,15 @@ void SetInteriorVehicleDataRequest::CutOffReadOnlyParams(
}
}
}
+
+ std::vector<std::string> ro_params = GetModuleReadOnlyParams(module_type);
+ const auto& data_mapping = RCHelpers::GetModuleTypeToDataMapping();
+ for (const auto& param : ro_params) {
+ if (module_type_params.keyExists(param)) {
+ module_data[data_mapping(module_type)].erase(param);
+ LOG4CXX_DEBUG(logger_, "Cutting-off READ ONLY parameter: " << param);
+ }
+ }
}
std::string SetInteriorVehicleDataRequest::ModuleType() {
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
index b39b67d669..5785e58e5b 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_helpers.cc
@@ -115,4 +115,30 @@ RCHelpers::AppsModules RCHelpers::GetApplicationsAllowedModules(
}
return result;
}
+
+void RCHelpers::RemoveRedundantGPSDataFromIVDataMsg(
+ smart_objects::SmartObject& msg_params) {
+ using namespace message_params;
+ using namespace application_manager::strings;
+
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto& module_data = msg_params[kModuleData];
+ if (!module_data.keyExists(kRadioControlData) ||
+ !module_data[kRadioControlData].keyExists(kSisData) ||
+ !module_data[kRadioControlData][kSisData].keyExists(station_location)) {
+ return;
+ }
+
+ auto& location_data =
+ module_data[kRadioControlData][kSisData][station_location];
+ auto new_location_data =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ new_location_data[latitude_degrees] = location_data[latitude_degrees];
+ new_location_data[longitude_degrees] = location_data[longitude_degrees];
+ if (location_data.keyExists(altitude)) {
+ new_location_data[altitude] = location_data[altitude];
+
+ location_data = new_location_data;
+ }
+}
} // namespace rc_rpc_plugin
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
index 026e03eeff..0c4a5a4e53 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/rc_rpc_plugin.cc
@@ -136,6 +136,13 @@ RCRPCPlugin::Apps RCRPCPlugin::GetRCApplications(
} // namespace rc_rpc_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new rc_rpc_plugin::RCRPCPlugin();
} // namespace rc_rpc_plugin
+
+extern "C" __attribute__((visibility("default"))) void Delete(
+ application_manager::plugin_manager::RPCPlugin* data) {
+ delete data;
+}
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
index cf1df2cb68..0a512b2839 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/src/resource_allocation_manager_impl.cc
@@ -94,7 +94,7 @@ AcquireResult::eType ResourceAllocationManagerImpl::AcquireResource(
}
const mobile_apis::HMILevel::eType acquiring_app_hmi_level =
- acquiring_app->hmi_level();
+ acquiring_app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (mobile_apis::HMILevel::HMI_FULL != acquiring_app_hmi_level) {
LOG4CXX_DEBUG(logger_,
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
index c1c59d7e78..c5a191650e 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/CMakeLists.txt
@@ -52,17 +52,8 @@ file(GLOB SOURCES
)
set(LIBRARIES
- RCRpcPluginStaticLib
- ApplicationManager
- connectionHandler
- SmartObjects
- ProtocolHandler
- MessageHelper
- connectionHandler
- Utils
- jsoncpp
+ rc_rpc_plugin_static
gmock_main
- dl
)
if(ENABLE_LOG)
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
index 9549830cec..123c22b944 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/get_interior_vehicle_data_request_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -44,6 +44,7 @@
#include "rc_rpc_plugin/rc_module_constants.h"
#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include <stdint.h>
#include <chrono>
#include <thread>
@@ -205,6 +206,8 @@ TEST_F(GetInteriorVehicleDataRequestTest,
HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
// Act
+
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -232,6 +235,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
HMIResultCodeIs(hmi_apis::FunctionID::RC_GetInteriorVehicleData), _))
.WillOnce(Return(true));
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -244,7 +248,19 @@ TEST_F(
(*mobile_message)[application_manager::strings::msg_params]
[message_params::kModuleType] = module_type;
smart_objects::SmartObject radio_data;
+ smart_objects::SmartObject sis_data;
+ smart_objects::SmartObject gps_data;
+
+ gps_data[application_manager::strings::longitude_degrees] = 1.0;
+ gps_data[application_manager::strings::latitude_degrees] = 1.0;
+
+ sis_data[application_manager::strings::station_short_name] =
+ "dummy_short_name";
+ sis_data[application_manager::strings::station_location] = gps_data;
+
radio_data[message_params::kBand] = enums_value::kAM;
+ radio_data[message_params::kSisData] = sis_data;
+
std::shared_ptr<rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>
command = CreateRCCommand<
rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
@@ -263,6 +279,7 @@ TEST_F(
.WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
// Assert
@@ -314,6 +331,7 @@ TEST_F(
command = CreateRCCommand<
rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
application_manager::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
@@ -358,6 +376,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
.WillOnce(DoAll(SaveArg<0>(&command_result), Return(true)));
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
// Assert
@@ -393,6 +412,7 @@ TEST_F(
MobileResultCodeIs(mobile_apis::Result::UNSUPPORTED_RESOURCE), _))
.WillOnce((Return(true)));
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -418,6 +438,7 @@ TEST_F(
.WillOnce((Return(true)));
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -458,6 +479,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
application_manager::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
event.set_smart_object(*hmi_response_message);
+ ASSERT_TRUE(command->Init());
command->Run();
command->on_event(event);
}
@@ -498,6 +520,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
event.set_smart_object(*hmi_message);
auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
command->on_event(event);
}
@@ -542,6 +565,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
command = CreateRCCommand<
rc_rpc_plugin::commands::GetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
application_manager::event_engine::Event event(
hmi_apis::FunctionID::RC_GetInteriorVehicleData);
@@ -583,6 +607,7 @@ TEST_F(GetInteriorVehicleDataRequestTest,
_))
.WillRepeatedly(Return(true));
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -597,6 +622,130 @@ TEST_F(GetInteriorVehicleDataRequestTest,
EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).Times(0);
// Act
+ ASSERT_TRUE(command->Init());
command->Run();
}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ OnEvent_ValidHmiResponse_AvailableHDChanelsIsArrayWithHDChanels) {
+ using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest;
+ namespace hmi_response = application_manager::hmi_response;
+ namespace strings = application_manager::strings;
+
+ const uint32_t chanel1_index = 1u;
+ const uint32_t chanel2_index = 2u;
+ const uint32_t chanel3_index = 3u;
+
+ const uint32_t expected_array_length = 3u;
+
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ MessageSharedPtr hmi_response_message = CreateBasicMessage();
+ auto& hmi_response_params = (*hmi_response_message)[strings::msg_params];
+ hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
+ hmi_response_params[strings::connection_key] = kAppId;
+
+ auto& msg_params = (*hmi_response_message)[strings::msg_params];
+ msg_params[message_params::kModuleType] = module_type;
+
+ auto available_hd_chanels =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ available_hd_chanels[0] = chanel1_index;
+ available_hd_chanels[1] = chanel2_index;
+ available_hd_chanels[2] = chanel3_index;
+
+ msg_params[message_params::kModuleData][message_params::kRadioControlData]
+ [message_params::kAvailableHdChannels] = available_hd_chanels;
+
+ ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ MessageSharedPtr message_to_mob = CreateBasicMessage();
+
+ // Expectations
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mob), Return(true)));
+
+ // Act
+ auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ event.set_smart_object(*hmi_response_message);
+ command->on_event(event);
+
+ auto& hd_chanels =
+ (*message_to_mob)[strings::msg_params][message_params::kModuleData]
+ [message_params::kRadioControlData]
+ [message_params::kAvailableHdChannels];
+ const size_t array_length = hd_chanels.length();
+
+ EXPECT_EQ(expected_array_length, array_length);
+
+ EXPECT_EQ(chanel1_index, hd_chanels[0].asUInt());
+ EXPECT_EQ(chanel2_index, hd_chanels[1].asUInt());
+ EXPECT_EQ(chanel3_index, hd_chanels[2].asUInt());
+}
+
+TEST_F(GetInteriorVehicleDataRequestTest,
+ OnEvent_ValidHmiResponse_ClimateEnableAvailable) {
+ using rc_rpc_plugin::commands::GetInteriorVehicleDataRequest;
+ namespace hmi_response = application_manager::hmi_response;
+ namespace strings = application_manager::strings;
+
+ // Arrange
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+
+ MessageSharedPtr hmi_response_message = CreateBasicMessage();
+ auto& hmi_response_params = (*hmi_response_message)[strings::msg_params];
+ hmi_response_params[hmi_response::code] = hmi_apis::Common_Result::SUCCESS;
+ hmi_response_params[strings::connection_key] = kAppId;
+
+ auto& msg_params = (*hmi_response_message)[strings::msg_params];
+
+ auto climate_control_data =
+ smart_objects::SmartObject(smart_objects::SmartType_Boolean);
+ climate_control_data = true;
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData]
+ [message_params::kClimateEnableAvailable] = climate_control_data;
+
+ ON_CALL(mock_interior_data_cache_, Contains(_)).WillByDefault(Return(false));
+ ON_CALL(mock_interior_data_manager_, CheckRequestsToHMIFrequency(_))
+ .WillByDefault(Return(true));
+
+ auto message_to_mob = CreateBasicMessage();
+
+ // Expectations
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _)).WillOnce(Return(true));
+ EXPECT_CALL(mock_rpc_service_, ManageMobileCommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_to_mob), Return(true)));
+
+ // Act
+ auto command = CreateRCCommand<GetInteriorVehicleDataRequest>(mobile_message);
+ application_manager::event_engine::Event event(
+ hmi_apis::FunctionID::RC_GetInteriorVehicleData);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ event.set_smart_object(*hmi_response_message);
+ command->on_event(event);
+
+ const bool climate_enable_available =
+ (*message_to_mob)[strings::msg_params][message_params::kModuleData]
+ [message_params::kClimateControlData]
+ [message_params::kClimateEnableAvailable]
+ .asBool();
+
+ EXPECT_TRUE(climate_enable_available);
+}
+
} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
index 66280eb183..f7718a7248 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/commands/set_interior_vehicle_data_request_test.cc
@@ -34,7 +34,6 @@
#include "application_manager/application.h"
#include "application_manager/commands/command_request_test.h"
#include "application_manager/mock_application.h"
-#include "gtest/gtest.h"
#include "interfaces/MOBILE_API.h"
#include "rc_rpc_plugin/mock/mock_interior_data_cache.h"
#include "rc_rpc_plugin/mock/mock_interior_data_manager.h"
@@ -42,15 +41,20 @@
#include "rc_rpc_plugin/rc_module_constants.h"
#include "rc_rpc_plugin/rc_rpc_plugin.h"
+#include <stdint.h>
+#include "gtest/gtest.h"
+
using application_manager::ApplicationSet;
using application_manager::commands::MessageSharedPtr;
using test::components::application_manager_test::MockApplication;
using test::components::application_manager_test::MockApplicationManager;
using test::components::commands_test::CommandRequestTest;
using test::components::commands_test::CommandsTestMocks;
+using test::components::commands_test::HMIResultCodeIs;
using ::testing::_;
using ::testing::NiceMock;
using ::testing::Return;
+using ::testing::SaveArg;
namespace {
const uint32_t kAppId = 0u;
@@ -140,8 +144,11 @@ TEST_F(SetInteriorVehicleDataRequestTest,
(*mobile_message)[application_manager::strings::msg_params];
msg_params[message_params::kModuleData][message_params::kModuleType] =
mobile_apis::ModuleType::CLIMATE;
+ smart_objects::SmartObject climate_control_data(smart_objects::SmartType_Map);
+ climate_control_data[message_params::kFanSpeed] = 10;
+
msg_params[message_params::kModuleData][message_params::kClimateControlData] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ climate_control_data;
// Expectations
EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
.WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
@@ -151,14 +158,15 @@ TEST_F(SetInteriorVehicleDataRequestTest,
EXPECT_CALL(
mock_rpc_service_,
- ManageMobileCommand(test::components::commands_test::MobileResultCodeIs(
- mobile_apis::Result::READ_ONLY),
- application_manager::commands::Command::SOURCE_SDL));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_SetInteriorVehicleData), _))
+ .WillOnce(Return(true));
// Act
std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
command = CreateRCCommand<
rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -189,15 +197,16 @@ TEST_F(
EXPECT_CALL(
mock_rpc_service_,
- ManageMobileCommand(test::components::commands_test::MobileResultCodeIs(
- mobile_apis::Result::OUT_OF_MEMORY),
- application_manager::commands::Command::SOURCE_SDL));
+ ManageHMICommand(
+ HMIResultCodeIs(hmi_apis::FunctionID::RC_SetInteriorVehicleData), _))
+ .WillOnce(Return(true));
// Act
std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
command = CreateRCCommand<
rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
}
@@ -229,7 +238,99 @@ TEST_F(
command = CreateRCCommand<
rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
mobile_message);
+ ASSERT_TRUE(command->Init());
command->Run();
}
+TEST_F(SetInteriorVehicleDataRequestTest,
+ Execute_ValidWithSettableParams_SUCCESSSendToHMI) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::CLIMATE;
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ msg_params[message_params::kModuleData][message_params::kClimateControlData]
+ [message_params::kClimateEnable] = true;
+
+ // Expectations
+ EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
+ .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
+
+ EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillOnce(Return(nullptr));
+
+ MessageSharedPtr message_from_mobile = CreateBasicMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true)));
+
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ ASSERT_TRUE(command->Init());
+ command->Run();
+
+ auto& msg_params_from_mobile =
+ (*message_from_mobile)[application_manager::strings::msg_params];
+
+ const bool climate_enable =
+ msg_params_from_mobile[message_params::kModuleData]
+ [message_params::kClimateControlData]
+ [message_params::kClimateEnable]
+ .asBool();
+ EXPECT_TRUE(climate_enable);
+}
+
+TEST_F(SetInteriorVehicleDataRequestTest,
+ Execute_ValidWithSettableParams_SUCCESSSendToHMI_HDChannel) {
+ MessageSharedPtr mobile_message = CreateBasicMessage();
+ auto& msg_params =
+ (*mobile_message)[application_manager::strings::msg_params];
+ msg_params[message_params::kModuleData][message_params::kModuleType] =
+ mobile_apis::ModuleType::RADIO;
+
+ msg_params[message_params::kModuleData][message_params::kRadioControlData] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ const std::uint32_t hd_channel = 2u;
+ msg_params[message_params::kModuleData][message_params::kRadioControlData]
+ [message_params::kHdChannel] = hd_channel;
+
+ // Expectations
+ EXPECT_CALL(mock_policy_handler_, CheckModule(kPolicyAppId, _))
+ .WillOnce(Return(rc_rpc_plugin::TypeAccess::kAllowed));
+
+ EXPECT_CALL(mock_hmi_capabilities_, rc_capability())
+ .WillOnce(Return(nullptr));
+
+ auto message_from_mobile = CreateBasicMessage();
+
+ EXPECT_CALL(mock_rpc_service_, ManageHMICommand(_, _))
+ .WillOnce(DoAll(SaveArg<0>(&message_from_mobile), Return(true)));
+
+ std::shared_ptr<rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>
+ command = CreateRCCommand<
+ rc_rpc_plugin::commands::SetInteriorVehicleDataRequest>(
+ mobile_message);
+
+ command->Init();
+ command->Run();
+
+ auto& msg_params_from_mobile =
+ (*message_from_mobile)[application_manager::strings::msg_params];
+
+ const uint64_t hd_channel_from_hmi =
+ msg_params_from_mobile[message_params::kModuleData]
+ [message_params::kRadioControlData]
+ [message_params::kHdChannel]
+ .asUInt();
+
+ EXPECT_EQ(hd_channel, hd_channel_from_hmi);
+}
} // namespace rc_rpc_plugin_test
diff --git a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
index a72b89b9de..bbf9032c96 100644
--- a/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
+++ b/src/components/application_manager/rpc_plugins/rc_rpc_plugin/test/resource_allocation_manager_impl_test.cc
@@ -72,6 +72,8 @@ const uint32_t kHMIAppId1 = 1u;
const uint32_t kAppId2 = 22u;
const std::string policy_app_id_1_ = "policy_id_1";
const uint32_t kSizeOfModules = 6u;
+const application_manager::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
} // namespace
namespace rc_rpc_plugin_test {
@@ -134,7 +136,8 @@ void RAManagerTest::CheckResultWithHMILevelAndAccessMode(
ra_manager.AcquireResource(kModuleType1, kAppId1));
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level()).WillOnce(Return(app_level));
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(app_level));
// Second app tries to get already acquired resource by 1st app
EXPECT_EQ(expected_result, ra_manager.AcquireResource(kModuleType1, kAppId2));
}
@@ -306,7 +309,7 @@ TEST_F(RAManagerTest, AnotherAppExit_NoReleaseResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
ra_manager.AcquireResource(kModuleType1, kAppId2));
@@ -360,7 +363,7 @@ TEST_F(RAManagerTest, AnotherAppUnregistered_NoReleaseResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillOnce(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
ra_manager.AcquireResource(kModuleType1, kAppId2));
@@ -400,7 +403,7 @@ TEST_F(RAManagerTest, AppsDisallowed_ReleaseAllResources) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::ALLOWED,
ra_manager.AcquireResource(kModuleType1, kAppId2));
@@ -461,7 +464,7 @@ TEST_F(RAManagerTest, AppGotRevokedModulesWithPTU_ReleaseRevokedResource) {
EXPECT_CALL(mock_app_mngr_, application(kAppId2))
.WillRepeatedly(Return(mock_app_2_));
- EXPECT_CALL(*mock_app_2_, hmi_level())
+ EXPECT_CALL(*mock_app_2_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_EQ(rc_rpc_plugin::AcquireResult::IN_USE,
ra_manager.AcquireResource(kModuleType1, kAppId2));
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/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));
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
index 0e556a6993..8c29cccfff 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/CMakeLists.txt
@@ -45,18 +45,25 @@ collect_sources(VEHICLE_INFO_PLUGIN_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src")
set(LIBRARIES
HMI_API
MOBILE_API
+ MessageHelper
ApplicationManager
v4_protocol_v1_2_no_extra
SmartObjects
Utils
+ jsoncpp
+ connectionHandler
)
if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-add_library("vehicle_info_plugin" SHARED ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${VEHICLE_INFO_PLUGIN_SOURCES})
-target_link_libraries("vehicle_info_plugin" ${LIBRARIES})
+add_library("vehicle_info_plugin_static" ${MOBILE_COMMANDS} ${HMI_COMMANDS} ${VEHICLE_INFO_PLUGIN_SOURCES})
+target_link_libraries("vehicle_info_plugin_static" ${LIBRARIES})
+
+add_library(vehicle_info_plugin SHARED "src/vehicle_info_plugin.cc" )
+target_link_libraries(vehicle_info_plugin vehicle_info_plugin_static)
+
set(INSTALL_DESTINATION bin)
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
index d0e4926a65..7b0b0a59b8 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/include/vehicle_info_plugin/vehicle_info_plugin.h
@@ -78,5 +78,5 @@ class VehicleInfoPlugin : public plugins::RPCPlugin {
} // namespace vehicle_info_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_VEHICLE_INFO_PLUGIN_INCLUDE_VEHICLE_INFO_PLUGIN_VEHICLE_INFO_PLUGIN_H
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
index 6ef76ad125..7d34bbbe37 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/commands/mobile/on_vehicle_data_notification.cc
@@ -72,7 +72,7 @@ void OnVehicleDataNotification::Run() {
for (; vehicle_data.end() != it; ++it) {
if (true == (*message_)[strings::msg_params].keyExists(it->first)) {
- LOG4CXX_ERROR(logger_, "vehicle_data nanme" << it->first);
+ LOG4CXX_DEBUG(logger_, "vehicle_data name" << it->first);
auto vehicle_data_value =
(*message_)[strings::msg_params][it->first].asInt();
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
index 70210f704e..cc1c22a248 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/src/vehicle_info_plugin.cc
@@ -163,6 +163,13 @@ void VehicleInfoPlugin::DeleteSubscriptions(
}
} // namespace vehicle_info_plugin
-extern "C" application_manager::plugin_manager::RPCPlugin* Create() {
+extern "C" __attribute__((visibility("default")))
+application_manager::plugin_manager::RPCPlugin*
+Create() {
return new vehicle_info_plugin::VehicleInfoPlugin();
}
+
+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/vehicle_info_plugin/test/CMakeLists.txt b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
index 3ea4a50a8a..92984b6ad5 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/CMakeLists.txt
@@ -51,14 +51,8 @@ file(GLOB SOURCES
)
set(LIBRARIES
- gmock
- Utils
- SmartObjects
- HMI_API
- MOBILE_API
- connectionHandler
- vehicle_info_plugin
- jsoncpp
+ gmock
+ vehicle_info_plugin_static
)
create_cotired_test("vi_commands_test" "${SOURCES}" "${LIBRARIES}" )
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc
new file mode 100644
index 0000000000..fb14373bcf
--- /dev/null
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/get_vehicle_data_response_test.cc
@@ -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.
+ */
+
+#include "gtest/gtest.h"
+
+#include "application_manager/commands/commands_test.h"
+#include "mobile/get_vehicle_data_response.h"
+#include "smart_objects/smart_object.h"
+
+namespace test {
+namespace components {
+namespace commands_test {
+namespace mobile_commands_test {
+namespace get_vehicle_data_response {
+
+namespace am = ::application_manager;
+using am::commands::MessageSharedPtr;
+using vehicle_info_plugin::commands::GetVehicleDataResponse;
+
+typedef std::shared_ptr<GetVehicleDataResponse> GetVehicleDataResponsePtr;
+
+class GetVehicleDataResponseTest
+ : public CommandsTest<CommandsTestMocks::kIsNice> {};
+
+TEST_F(GetVehicleDataResponseTest, GetVehicleDataResponse_SUCCESS) {
+ MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
+ GetVehicleDataResponsePtr command(
+ CreateCommand<GetVehicleDataResponse>(message));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _));
+ command->Run();
+}
+
+} // namespace get_vehicle_data_response
+} // namespace mobile_commands_test
+} // namespace commands_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
index 7081746f28..8df00521de 100644
--- a/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
+++ b/src/components/application_manager/rpc_plugins/vehicle_info_plugin/test/commands/mobile/on_vehicle_data_notification_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Ford Motor Company
+ * Copyright (c) 2019, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,9 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <stdint.h>
-#include <map>
-#include <vector>
+#include <strings.h>
#include "gtest/gtest.h"
#include "mobile/on_vehicle_data_notification.h"
@@ -45,6 +43,8 @@
#include "smart_objects/smart_object.h"
#include "utils/custom_string.h"
#include "utils/helpers.h"
+#include "vehicle_info_plugin/vehicle_info_app_extension.h"
+#include "vehicle_info_plugin/vehicle_info_plugin.h"
namespace test {
namespace components {
@@ -62,49 +62,75 @@ using am::commands::MessageSharedPtr;
using vehicle_info_plugin::commands::OnVehicleDataNotification;
typedef std::shared_ptr<OnVehicleDataNotification> NotificationPtr;
+typedef std::shared_ptr<vehicle_info_plugin::VehicleInfoAppExtension>
+ VehicleInfoAppExtensionPtr;
+typedef DataAccessor<application_manager::ApplicationSet> ApplicationSetDA;
namespace {
const uint32_t kAppId = 1u;
+const utils::custom_string::CustomString kAppName("test_app");
} // namespace
class OnVehicleDataNotificationTest
: public CommandsTest<CommandsTestMocks::kIsNice> {
public:
- OnVehicleDataNotificationTest()
- : command_msg_(CreateMessage(smart_objects::SmartType_Map))
- , command_(CreateCommand<OnVehicleDataNotification>(command_msg_)) {}
+ OnVehicleDataNotificationTest() : mock_app_(CreateMockApp()) {}
- MessageSharedPtr command_msg_;
- NotificationPtr command_;
+ protected:
+ void SetUp() OVERRIDE {
+ ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId));
+ ON_CALL(*mock_app_, name()).WillByDefault(ReturnRef(kAppName));
+
+ ON_CALL(mock_message_helper_, PrintSmartObject(_))
+ .WillByDefault(Return(false));
+ }
+ MockAppPtr mock_app_;
};
-MATCHER_P2(CheckMessageData, key, value, "") {
- const bool kIsMobileProtocolTypeCorrect =
- (*arg)[am::strings::params][am::strings::protocol_type].asInt() ==
- am::commands::CommandImpl::mobile_protocol_type_;
-
- const bool kIsProtocolVersionCorrect =
- (*arg)[am::strings::params][am::strings::protocol_version].asInt() ==
- am::commands::CommandImpl::protocol_version_;
-
- const bool kIsNotificationCorrect =
- (*arg)[am::strings::params][am::strings::message_type].asInt() ==
- am::MessageType::kNotification;
-
- const bool kIsConnectionKeyCorrect =
- (*arg)[am::strings::params][am::strings::connection_key].asUInt() ==
- kAppId;
-
- const bool kAreMsgParamsCorrect =
- (*arg)[am::strings::msg_params][key].asInt() == value;
-
- using namespace helpers;
- return Compare<bool, EQ, ALL>(true,
- kIsMobileProtocolTypeCorrect,
- kIsProtocolVersionCorrect,
- kIsNotificationCorrect,
- kIsConnectionKeyCorrect,
- kAreMsgParamsCorrect);
+TEST_F(OnVehicleDataNotificationTest, OnVehicleDataNotification_SUCCESS) {
+ MessageSharedPtr message(CreateMessage(smart_objects::SmartType_Map));
+ smart_objects::SmartObject gps_data;
+ gps_data[am::strings::longitude_degrees] = 1.0;
+ gps_data[am::strings::latitude_degrees] = 1.0;
+ gps_data[am::strings::shifted] = true;
+
+ (*message)[am::strings::msg_params][am::strings::gps] = gps_data;
+ (*message)[am::strings::msg_params][am::strings::speed] = 0;
+
+ NotificationPtr command(CreateCommand<OnVehicleDataNotification>(message));
+
+ vehicle_info_plugin::VehicleInfoPlugin vi_plugin;
+ VehicleInfoAppExtensionPtr vi_app_extention_ptr =
+ std::make_shared<vehicle_info_plugin::VehicleInfoAppExtension>(
+ vi_plugin, *mock_app_);
+ vi_app_extention_ptr->subscribeToVehicleInfo(
+ mobile_apis::VehicleDataType::VEHICLEDATA_GPS);
+ vi_app_extention_ptr->subscribeToVehicleInfo(
+ mobile_apis::VehicleDataType::VEHICLEDATA_SPEED);
+
+ EXPECT_CALL(*mock_app_,
+ QueryInterface(vehicle_info_plugin::VehicleInfoAppExtension::
+ VehicleInfoAppExtensionUID))
+ .WillOnce(Return(vi_app_extention_ptr));
+
+ application_manager::ApplicationSet apps;
+ apps.insert(mock_app_);
+ std::shared_ptr<sync_primitives::Lock> apps_lock =
+ std::make_shared<sync_primitives::Lock>();
+ ApplicationSetDA apps_da(apps, apps_lock);
+ EXPECT_CALL(app_mngr_, applications()).WillOnce(Return(apps_da));
+
+ am::VehicleData vehicle_data;
+ vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_GPS));
+ vehicle_data.insert(am::VehicleData::value_type(
+ am::strings::gps, mobile_apis::VehicleDataType::VEHICLEDATA_SPEED));
+ EXPECT_CALL(mock_message_helper_, vehicle_data())
+ .WillOnce(ReturnRef(vehicle_data));
+
+ EXPECT_CALL(mock_rpc_service_, SendMessageToMobile(message, _));
+
+ command->Run();
}
} // namespace on_vehicle_data_notification
diff --git a/src/components/application_manager/src/app_service_manager.cc b/src/components/application_manager/src/app_service_manager.cc
index bab8147d9f..a85921a8cd 100644
--- a/src/components/application_manager/src/app_service_manager.cc
+++ b/src/components/application_manager/src/app_service_manager.cc
@@ -72,10 +72,44 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
std::string service_type = manifest[strings::service_type].asString();
- if (FindServiceByProvider(connection_key, service_type)) {
- LOG4CXX_WARN(logger_,
- "Service already exists for this provider, rejecting");
- return smart_objects::SmartObject();
+ AppService* found_service =
+ FindServiceByProvider(connection_key, service_type);
+ if (found_service) {
+ // Check if there is a different existing service with the same updated
+ // name.
+ if (manifest.keyExists(strings::service_name)) {
+ auto service_by_name =
+ FindServiceByName(manifest[strings::service_name].asString());
+ if (service_by_name) {
+ auto service_by_name_id =
+ service_by_name->record[strings::service_id].asString();
+ auto found_service_id =
+ found_service->record[strings::service_id].asString();
+ if (service_by_name_id != found_service_id) {
+ LOG4CXX_WARN(logger_,
+ "A service already exists with this name, rejecting");
+ return smart_objects::SmartObject();
+ }
+ }
+ }
+ LOG4CXX_WARN(logger_, "Service already exists for this provider, updating");
+ published_services_lock_.Acquire();
+ found_service->record[strings::service_manifest] = manifest;
+ found_service->record[strings::service_published] = true;
+ smart_objects::SmartObject updated_service_record = found_service->record;
+ published_services_lock_.Release();
+
+ smart_objects::SmartObject msg_params;
+ msg_params[strings::system_capability][strings::system_capability_type] =
+ mobile_apis::SystemCapabilityType::APP_SERVICES;
+
+ AppServiceUpdated(updated_service_record,
+ mobile_apis::ServiceUpdateReason::MANIFEST_UPDATE,
+ msg_params);
+
+ MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
+
+ return updated_service_record;
}
if (manifest.keyExists(strings::service_name) &&
@@ -131,10 +165,16 @@ smart_objects::SmartObject AppServiceManager::PublishAppService(
MessageHelper::BroadcastCapabilityUpdate(msg_params, app_manager_);
- // Activate the new service if it is the default for its service type, or if
- // no service is active of its service type
+ // Activate the new service if it is the default for its service type, if
+ // no service is active of its service type, or it is a mobile app in full.
AppService* active_service = ActiveServiceForType(service_type);
- if (!active_service || app_service.default_service) {
+ ApplicationSharedPtr app = NULL;
+ if (mobile_service && connection_key) {
+ app = app_manager_.application(connection_key);
+ }
+
+ if (!active_service || app_service.default_service ||
+ (app && app->IsFullscreen())) {
ActivateAppService(service_id);
}
@@ -163,7 +203,9 @@ bool AppServiceManager::UnpublishAppService(const std::string service_id) {
// Activate embedded service, if available
auto embedded_service = EmbeddedServiceForType(
record[strings::service_manifest][strings::service_type].asString());
- if (embedded_service) {
+ if (embedded_service &&
+ (embedded_service->record[strings::service_id].asString() !=
+ service_id)) {
embedded_service->record[strings::service_active] = true;
AppServiceUpdated(embedded_service->record,
mobile_apis::ServiceUpdateReason::ACTIVATED,
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index 0636748977..f6b87d3a7e 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -173,19 +173,16 @@ InitialApplicationDataImpl::perform_interaction_layout() const {
}
DynamicApplicationDataImpl::DynamicApplicationDataImpl()
- : help_prompt_(NULL)
- , timeout_prompt_(NULL)
- , vr_help_title_(NULL)
- , vr_help_(NULL)
+ : help_prompt_(nullptr)
+ , timeout_prompt_(nullptr)
+ , vr_help_title_(nullptr)
+ , vr_help_(nullptr)
, tbt_state_(mobile_api::TBTState::INVALID_ENUM)
- , show_command_(NULL)
- , keyboard_props_(NULL)
- , menu_title_(NULL)
- , menu_icon_(NULL)
- , tbt_show_command_(NULL)
- , day_color_scheme_(NULL)
- , night_color_scheme_(NULL)
- , display_layout_("")
+ , show_command_(nullptr)
+ , keyboard_props_(nullptr)
+ , menu_title_(nullptr)
+ , menu_icon_(nullptr)
+ , tbt_show_command_(nullptr)
, commands_()
, commands_lock_ptr_(std::make_shared<sync_primitives::RecursiveLock>())
, sub_menu_()
@@ -195,9 +192,12 @@ DynamicApplicationDataImpl::DynamicApplicationDataImpl()
, performinteraction_choice_set_map_()
, performinteraction_choice_set_lock_ptr_(
std::make_shared<sync_primitives::RecursiveLock>())
+ , window_params_map_()
+ , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>())
, is_perform_interaction_active_(false)
, is_reset_global_properties_active_(false)
- , perform_interaction_mode_(-1) {}
+ , perform_interaction_mode_(-1)
+ , display_capabilities_builder_(*this) {}
DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
if (help_prompt_) {
@@ -230,16 +230,6 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
tbt_show_command_ = NULL;
}
- if (day_color_scheme_) {
- delete day_color_scheme_;
- day_color_scheme_ = NULL;
- }
-
- if (night_color_scheme_) {
- delete night_color_scheme_;
- night_color_scheme_ = NULL;
- }
-
for (CommandsMap::iterator command_it = commands_.begin();
commands_.end() != command_it;
++command_it) {
@@ -265,6 +255,8 @@ DynamicApplicationDataImpl::~DynamicApplicationDataImpl() {
performinteraction_choice_set_map_[it->first].clear();
}
performinteraction_choice_set_map_.clear();
+
+ window_params_map_.clear();
}
const smart_objects::SmartObject* DynamicApplicationDataImpl::help_prompt()
@@ -316,18 +308,93 @@ const smart_objects::SmartObject* DynamicApplicationDataImpl::menu_icon()
return menu_icon_;
}
-const smart_objects::SmartObject* DynamicApplicationDataImpl::day_color_scheme()
+smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme()
const {
- return day_color_scheme_;
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ const smart_objects::SmartObject template_config =
+ default_window_it->second;
+ if (template_config.keyExists(strings::day_color_scheme)) {
+ return template_config[strings::day_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
}
-const smart_objects::SmartObject*
-DynamicApplicationDataImpl::night_color_scheme() const {
- return night_color_scheme_;
+smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme()
+ const {
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ const smart_objects::SmartObject template_config =
+ default_window_it->second;
+ if (template_config.keyExists(strings::night_color_scheme)) {
+ return template_config[strings::night_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
+}
+
+std::string DynamicApplicationDataImpl::display_layout() const {
+ using namespace mobile_apis::PredefinedWindows;
+ auto default_window_it = window_templates_.find(DEFAULT_WINDOW);
+
+ if (window_templates_.end() != default_window_it) {
+ smart_objects::SmartObject template_config = default_window_it->second;
+ if (template_config.keyExists(strings::template_layout)) {
+ return template_config[strings::template_layout].asString();
+ }
+ }
+
+ return std::string();
}
-const std::string& DynamicApplicationDataImpl::display_layout() const {
- return display_layout_;
+smart_objects::SmartObjectSPtr
+DynamicApplicationDataImpl::display_capabilities() const {
+ return display_capabilities_;
+}
+
+smart_objects::SmartObjectSPtr DynamicApplicationDataImpl::display_capabilities(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto result_display_caps = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Array);
+ const auto window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ if (!window_caps) {
+ LOG4CXX_WARN(logger_, "Current window capabilities are empty");
+ // SDL still needs to retreive display capabilities
+ return display_capabilities_;
+ }
+ auto find_res =
+ std::find_if(window_caps->begin(),
+ window_caps->end(),
+ [&window_id](const smart_objects::SmartObject& element) {
+ if (window_id == element[strings::window_id].asInt()) {
+ return true;
+ }
+
+ return false;
+ });
+
+ DCHECK(find_res != window_caps->end());
+ const auto disp_caps_keys = (*display_capabilities_)[0].enumerate();
+ for (const auto& key : disp_caps_keys) {
+ if (strings::window_capabilities == key) {
+ continue;
+ }
+ (*result_display_caps)[0][key] = (*display_capabilities_)[0][key];
+ }
+
+ (*result_display_caps)[0][strings::window_capabilities][0] = *find_res;
+
+ return result_display_caps;
}
void DynamicApplicationDataImpl::load_global_properties(
@@ -447,24 +514,176 @@ void DynamicApplicationDataImpl::set_menu_icon(
void DynamicApplicationDataImpl::set_day_color_scheme(
const smart_objects::SmartObject& color_scheme) {
- if (day_color_scheme_) {
- delete day_color_scheme_;
+ using namespace mobile_apis::PredefinedWindows;
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[DEFAULT_WINDOW][strings::day_color_scheme] = color_scheme;
+}
+
+void DynamicApplicationDataImpl::set_night_color_scheme(
+ const smart_objects::SmartObject& color_scheme) {
+ using namespace mobile_apis::PredefinedWindows;
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[DEFAULT_WINDOW][strings::night_color_scheme] = color_scheme;
+}
+
+void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis::PredefinedWindows;
+ smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
+ template_config[strings::template_layout] = layout;
+ window_templates_[DEFAULT_WINDOW] = template_config;
+}
+
+void DynamicApplicationDataImpl::set_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto& incoming_window_capabilities =
+ display_capabilities[0][strings::window_capabilities];
+
+ smart_objects::SmartObject tmp_window_capabilities;
+ if (display_capabilities_) {
+ tmp_window_capabilities =
+ (*display_capabilities_)[0][strings::window_capabilities];
}
- day_color_scheme_ = new smart_objects::SmartObject(color_scheme);
+ display_capabilities_.reset(
+ new smart_objects::SmartObject(display_capabilities));
+
+ auto has_window_id = [&tmp_window_capabilities](const WindowID window_id) {
+ const auto tmp_window_capabilities_arr = tmp_window_capabilities.asArray();
+ if (!tmp_window_capabilities_arr) {
+ return false;
+ }
+
+ const auto find_res = std::find_if(
+ tmp_window_capabilities_arr->begin(),
+ tmp_window_capabilities_arr->end(),
+ [&window_id](const smart_objects::SmartObject& element) {
+ LOG4CXX_DEBUG(logger_,
+ "Searching for "
+ << window_id << " with element window id "
+ << element[strings::window_id].asInt());
+ if ((!element.keyExists(strings::window_id)) && 0 == window_id) {
+ return true;
+ }
+ const auto current_window_id = element[strings::window_id].asInt();
+ if (window_id == current_window_id) {
+ return true;
+ }
+ return false;
+ });
+
+ return find_res != tmp_window_capabilities_arr->end();
+ };
+ for (uint32_t i = 0; i < incoming_window_capabilities.length(); ++i) {
+ const auto window_id =
+ incoming_window_capabilities[i][strings::window_id].asInt();
+ if (!has_window_id(window_id)) {
+ tmp_window_capabilities[tmp_window_capabilities.length()] =
+ incoming_window_capabilities[i];
+ }
+ }
+
+ (*display_capabilities_)[0][strings::window_capabilities] =
+ tmp_window_capabilities;
+}
+
+void DynamicApplicationDataImpl::remove_window_capability(
+ const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto window_capabilities =
+ (*display_capabilities_)[0][strings::window_capabilities].asArray();
+ DCHECK_OR_RETURN_VOID(window_capabilities);
+
+ for (auto it = window_capabilities->begin(); it != window_capabilities->end();
+ ++it) {
+ const auto cur_window_id = (*it).keyExists(strings::window_id)
+ ? (*it)[strings::window_id].asInt()
+ : 0;
+ if (window_id == cur_window_id) {
+ window_capabilities->erase(it);
+ return;
+ }
+ }
+
+ LOG4CXX_WARN(
+ logger_,
+ "No window id " << window_id << " found in display capabilities");
+}
+
+void DynamicApplicationDataImpl::set_window_layout(const WindowID window_id,
+ const std::string& layout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject template_config(smart_objects::SmartType_Map);
+
+ template_config[strings::template_layout] = layout;
+ window_templates_[window_id] = template_config;
+}
+
+void DynamicApplicationDataImpl::set_day_color_scheme(
+ const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[window_id][strings::day_color_scheme] = color_scheme;
}
void DynamicApplicationDataImpl::set_night_color_scheme(
- const smart_objects::SmartObject& color_scheme) {
- if (night_color_scheme_) {
- delete night_color_scheme_;
+ const WindowID window_id, const smart_objects::SmartObject& color_scheme) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(color_scheme.getType() == smart_objects::SmartType_Map);
+ window_templates_[window_id][strings::night_color_scheme] = color_scheme;
+}
+
+std::string DynamicApplicationDataImpl::window_layout(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::template_layout)) {
+ return template_config[strings::template_layout].asString();
+ }
}
- night_color_scheme_ = new smart_objects::SmartObject(color_scheme);
+ return std::string();
}
-void DynamicApplicationDataImpl::set_display_layout(const std::string& layout) {
- display_layout_ = layout;
+smart_objects::SmartObject DynamicApplicationDataImpl::day_color_scheme(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::day_color_scheme)) {
+ return template_config[strings::day_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
+}
+
+smart_objects::SmartObject DynamicApplicationDataImpl::night_color_scheme(
+ const WindowID window_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ AppWindowsTemplates::const_iterator window_template_it =
+ window_templates_.find(window_id);
+
+ if (window_templates_.end() != window_template_it) {
+ const smart_objects::SmartObject template_config =
+ window_template_it->second;
+ if (template_config.keyExists(strings::night_color_scheme)) {
+ return template_config[strings::night_color_scheme];
+ }
+ }
+
+ return smart_objects::SmartObject(smart_objects::SmartType::SmartType_Null);
}
void DynamicApplicationDataImpl::SetGlobalProperties(
@@ -555,6 +774,33 @@ bool DynamicApplicationDataImpl::IsSubMenuNameAlreadyExist(
return false;
}
+DataAccessor<WindowParamsMap>
+DynamicApplicationDataImpl::window_optional_params_map() const {
+ return DataAccessor<WindowParamsMap>(window_params_map_,
+ window_params_map_lock_ptr_);
+}
+
+void DynamicApplicationDataImpl::SetWindowInfo(
+ const WindowID window_id, const smart_objects::SmartObject& window_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto it = window_params_map_.find(window_id);
+ if (window_params_map_.end() == it) {
+ window_params_map_[window_id] =
+ std::make_shared<smart_objects::SmartObject>(window_info);
+ }
+}
+
+DisplayCapabilitiesBuilder&
+DynamicApplicationDataImpl::display_capabilities_builder() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return display_capabilities_builder_;
+}
+
+void DynamicApplicationDataImpl::RemoveWindowInfo(const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ window_params_map_.erase(window_id);
+}
+
void DynamicApplicationDataImpl::AddChoiceSet(
uint32_t choice_set_id, const smart_objects::SmartObject& choice_set) {
sync_primitives::AutoLock lock(choice_set_map_lock_ptr_);
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 3b2f51f26c..bb505e2498 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -113,6 +113,7 @@ ApplicationImpl::ApplicationImpl(
, video_streaming_suspended_(true)
, audio_streaming_suspended_(true)
, is_app_allowed_(true)
+ , is_app_data_resumption_allowed_(false)
, has_been_activated_(false)
, tts_properties_in_none_(false)
, tts_properties_in_full_(false)
@@ -187,7 +188,8 @@ void ApplicationImpl::CloseActiveMessage() {
}
bool ApplicationImpl::IsFullscreen() const {
- return mobile_api::HMILevel::HMI_FULL == hmi_level();
+ return mobile_api::HMILevel::HMI_FULL ==
+ hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
}
bool ApplicationImpl::is_audio() const {
@@ -265,19 +267,21 @@ bool ApplicationImpl::IsVideoApplication() const {
return is_video_app;
}
-void ApplicationImpl::SetRegularState(HmiStatePtr state) {
+void ApplicationImpl::SetRegularState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
-void ApplicationImpl::RemovePostponedState() {
+void ApplicationImpl::RemovePostponedState(const WindowID window_id) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.RemoveState(HmiState::STATE_ID_POSTPONED);
+ state_.RemoveState(window_id, HmiState::STATE_ID_POSTPONED);
}
-void ApplicationImpl::SetPostponedState(HmiStatePtr state) {
+void ApplicationImpl::SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
void ApplicationImpl::set_mobile_projection_enabled(bool option) {
@@ -297,22 +301,56 @@ struct StateIDComparator {
}
};
-void ApplicationImpl::AddHMIState(HmiStatePtr state) {
+void ApplicationImpl::AddHMIState(const WindowID window_id, HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.AddState(state);
+ state_.AddState(window_id, state);
}
-void ApplicationImpl::RemoveHMIState(HmiState::StateID state_id) {
+void ApplicationImpl::RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- state_.RemoveState(state_id);
+ state_.RemoveState(window_id, state_id);
}
-const HmiStatePtr ApplicationImpl::CurrentHmiState() const {
- return state_.GetState(HmiState::STATE_ID_CURRENT);
+const HmiStatePtr ApplicationImpl::CurrentHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_CURRENT);
}
-const HmiStatePtr ApplicationImpl::RegularHmiState() const {
- return state_.GetState(HmiState::STATE_ID_REGULAR);
+const HmiStatePtr ApplicationImpl::RegularHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_REGULAR);
+}
+
+WindowNames ApplicationImpl::GetWindowNames() const {
+ LOG4CXX_DEBUG(logger_,
+ "Collecting window names for application " << app_id());
+
+ WindowNames window_names;
+ std::string stringified_window_names;
+
+ sync_primitives::AutoLock auto_lock(window_params_map_lock_ptr_);
+ for (const auto& window_info_item : window_params_map_) {
+ const auto window_name =
+ (*window_info_item.second)[strings::window_name].asString();
+ window_names.push_back(window_name);
+ stringified_window_names +=
+ (stringified_window_names.empty() ? "" : ",") + window_name;
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Existing window names: [" + stringified_window_names + "]");
+ return window_names;
+}
+
+WindowIds ApplicationImpl::GetWindowIds() const {
+ LOG4CXX_DEBUG(logger_, "Collecting window IDs for application " << app_id());
+ return state_.GetWindowIds();
+}
+
+bool ApplicationImpl::WindowIdExists(const WindowID window_id) const {
+ const WindowIds window_ids = GetWindowIds();
+ return helpers::in_range(window_ids, window_id);
}
bool ApplicationImpl::IsAllowedToChangeAudioSource() const {
@@ -322,8 +360,9 @@ bool ApplicationImpl::IsAllowedToChangeAudioSource() const {
return false;
}
-const HmiStatePtr ApplicationImpl::PostponedHmiState() const {
- return state_.GetState(HmiState::STATE_ID_POSTPONED);
+const HmiStatePtr ApplicationImpl::PostponedHmiState(
+ const WindowID window_id) const {
+ return state_.GetState(window_id, HmiState::STATE_ID_POSTPONED);
}
const smart_objects::SmartObject* ApplicationImpl::active_message() const {
@@ -354,9 +393,10 @@ bool ApplicationImpl::is_media_application() const {
return is_media_;
}
-const mobile_api::HMILevel::eType ApplicationImpl::hmi_level() const {
+const mobile_api::HMILevel::eType ApplicationImpl::hmi_level(
+ const WindowID window_id) const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state = CurrentHmiState(window_id);
return hmi_state ? hmi_state->hmi_level() : HMILevel::INVALID_ENUM;
}
@@ -380,9 +420,10 @@ const uint32_t ApplicationImpl::list_files_in_none_count() const {
return list_files_in_none_count_;
}
-const mobile_api::SystemContext::eType ApplicationImpl::system_context() const {
+const mobile_api::SystemContext::eType ApplicationImpl::system_context(
+ const WindowID window_id) const {
using namespace mobile_apis;
- const HmiStatePtr hmi_state = CurrentHmiState();
+ const HmiStatePtr hmi_state = CurrentHmiState(window_id);
return hmi_state ? hmi_state->system_context() : SystemContext::INVALID_ENUM;
;
}
@@ -680,6 +721,14 @@ void ApplicationImpl::set_app_allowed(const bool allowed) {
is_app_allowed_ = allowed;
}
+bool ApplicationImpl::is_app_data_resumption_allowed() const {
+ return is_app_data_resumption_allowed_;
+}
+
+void ApplicationImpl::set_app_data_resumption_allowance(const bool allowed) {
+ is_app_data_resumption_allowed_ = allowed;
+}
+
void ApplicationImpl::set_secondary_device(
connection_handler::DeviceHandle secondary_device) {
secondary_device_id_ = secondary_device;
@@ -930,8 +979,10 @@ bool ApplicationImpl::is_application_data_changed() const {
return is_application_data_changed_;
}
-void ApplicationImpl::SetInitialState(HmiStatePtr state) {
- state_.InitState(state);
+void ApplicationImpl::SetInitialState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) {
+ state_.InitState(window_id, window_name, state);
}
void ApplicationImpl::set_is_application_data_changed(
@@ -1074,21 +1125,58 @@ void ApplicationImpl::SubscribeToSoftButtons(
cmd_softbuttonid_[cmd_id] = softbuttons_id;
}
} else {
- cmd_softbuttonid_[cmd_id] = softbuttons_id;
+ auto& soft_button_ids = cmd_softbuttonid_[cmd_id];
+ for (auto& softbutton_item : softbuttons_id) {
+ soft_button_ids.insert(softbutton_item);
+ }
}
}
+struct FindSoftButtonId {
+ uint32_t soft_button_id_;
+
+ FindSoftButtonId(const uint32_t soft_button_id)
+ : soft_button_id_(soft_button_id) {}
+
+ bool operator()(const std::pair<uint32_t, WindowID>& element) {
+ return soft_button_id_ == element.first;
+ }
+};
+
bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
for (; it != cmd_softbuttonid_.end(); ++it) {
- if ((it->second).find(softbutton_id) != (it->second).end()) {
+ const auto& soft_button_ids = (*it).second;
+ FindSoftButtonId finder(softbutton_id);
+ const auto find_res =
+ std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
+ if ((soft_button_ids.end() != find_res)) {
return true;
}
}
return false;
}
+WindowID ApplicationImpl::GetSoftButtonWindowID(const uint32_t softbutton_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
+ CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
+ for (; it != cmd_softbuttonid_.end(); ++it) {
+ const auto& soft_button_ids = (*it).second;
+ FindSoftButtonId finder(softbutton_id);
+ const auto find_res =
+ std::find_if(soft_button_ids.begin(), soft_button_ids.end(), finder);
+ if ((soft_button_ids.end() != find_res)) {
+ return find_res->second;
+ }
+ }
+
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
@@ -1098,8 +1186,9 @@ void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
}
void ApplicationImpl::set_system_context(
+ const WindowID window_id,
const mobile_api::SystemContext::eType& system_context) {
- const HmiStatePtr hmi_state = CurrentHmiState();
+ HmiStatePtr hmi_state = CurrentHmiState(window_id);
hmi_state->set_system_context(system_context);
}
@@ -1112,13 +1201,20 @@ void ApplicationImpl::set_audio_streaming_state(
" for non-media application to different from NOT_AUDIBLE");
return;
}
- CurrentHmiState()->set_audio_streaming_state(state);
+
+ // According to proposal SDL-0216 audio streaming state should
+ // be applied for all windows to keep consistency
+ HmiStates hmi_states = state_.GetStates(HmiState::STATE_ID_CURRENT);
+ for (const auto& hmi_state : hmi_states) {
+ hmi_state->set_audio_streaming_state(state);
+ }
}
void ApplicationImpl::set_hmi_level(
+ const WindowID window_id,
const mobile_api::HMILevel::eType& new_hmi_level) {
using namespace mobile_apis;
- const HMILevel::eType current_hmi_level = hmi_level();
+ const HMILevel::eType current_hmi_level = hmi_level(window_id);
if (HMILevel::HMI_NONE != current_hmi_level &&
HMILevel::HMI_NONE == new_hmi_level) {
put_file_in_none_count_ = 0;
@@ -1127,7 +1223,8 @@ void ApplicationImpl::set_hmi_level(
}
ApplicationSharedPtr app = application_manager_.application(app_id());
DCHECK_OR_RETURN_VOID(app)
- application_manager_.state_controller().SetRegularState(app, new_hmi_level);
+ application_manager_.state_controller().SetRegularState(
+ app, window_id, new_hmi_level);
LOG4CXX_INFO(logger_, "hmi_level = " << new_hmi_level);
usage_report_.RecordHmiStateChanged(new_hmi_level);
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index 3a92009d4f..20a53b9780 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -121,17 +121,26 @@ bool device_id_comparator(const std::string& device_id,
}
/**
- * @brief policy_app_id_comparator is predicate to compare policy application
- * ids
- * @param policy_app_id Policy id of application
- * @param app Application pointer
- * @return True if policy id of application matches to policy id passed
+ * @brief PolicyAppIdComparator is struct predicate to compare policy
+ * application ids & device
+ * @param device_handle of application
+ * @param id of application
+ * @return True if policy id & device_handle of application matches to policy id
+ * & device_handle passed
*/
-bool policy_app_id_comparator(const std::string& policy_app_id,
- ApplicationSharedPtr app) {
- DCHECK_OR_RETURN(app, false);
- return app->policy_app_id() == policy_app_id;
-}
+struct PolicyAppIdComparator {
+ PolicyAppIdComparator(const connection_handler::DeviceHandle& device_handle,
+ const std::string& policy_app_id)
+ : device_handle_(device_handle), policy_app_id_(policy_app_id) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app && app->device() == device_handle_ &&
+ app->policy_app_id() == policy_app_id_;
+ }
+
+ private:
+ const connection_handler::DeviceHandle& device_handle_;
+ const std::string& policy_app_id_;
+};
uint32_t ApplicationManagerImpl::mobile_corelation_id_ = 0;
uint32_t ApplicationManagerImpl::corelation_id_ = 0;
@@ -295,7 +304,9 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
}
bool LimitedAppPredicate(const ApplicationSharedPtr app) {
- return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false;
+ return app ? app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED
+ : false;
}
ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
@@ -306,7 +317,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_navi() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -318,7 +330,8 @@ ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application()
bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_voice_communication_supported() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -340,7 +353,8 @@ ApplicationManagerImpl::applications_with_navi() {
bool LimitedMobileProjectionPredicate(const ApplicationSharedPtr app) {
return app ? (app->mobile_projection_enabled() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_api::HMILevel::HMI_LIMITED)
: false;
}
@@ -565,12 +579,16 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
HmiStatePtr initial_state =
CreateRegularState(std::shared_ptr<Application>(application),
+ mobile_apis::WindowType::MAIN,
mobile_apis::HMILevel::INVALID_ENUM,
mobile_apis::AudioStreamingState::INVALID_ENUM,
mobile_apis::VideoStreamingState::INVALID_ENUM,
mobile_api::SystemContext::SYSCTXT_MAIN);
- application->SetInitialState(initial_state);
+ application->SetInitialState(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ std::string(), // should not be tracked for main window
+ initial_state);
application->set_folder_name(policy_app_id + "_" +
application->mac_address());
@@ -726,18 +744,15 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
LOG4CXX_DEBUG(logger_, "Activating application with id:" << app->app_id());
- // remove from resumption if app was activated by user
+ // Remove from resumption if app was activated by user
resume_controller().OnAppActivated(app);
+
// Activate any app services published by the app
GetAppServiceManager().OnAppActivated(app);
- const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
- const AudioStreamingState::eType audio_state =
- app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
- : AudioStreamingState::NOT_AUDIBLE;
- const VideoStreamingState::eType video_state =
- app->IsVideoApplication() ? VideoStreamingState::STREAMABLE
- : VideoStreamingState::NOT_STREAMABLE;
- state_ctrl_.SetRegularState(app, hmi_level, audio_state, video_state, false);
+
+ // Activate main window in state controller
+ state_ctrl_.ActivateDefaultWindow(app);
+
return true;
}
@@ -1305,11 +1320,13 @@ void ApplicationManagerImpl::SetAllAppsAllowed(const bool allowed) {
HmiStatePtr ApplicationManagerImpl::CreateRegularState(
std::shared_ptr<Application> app,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::VideoStreamingState::eType video_state,
- mobile_apis::SystemContext::eType system_context) const {
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::VideoStreamingState::eType video_state,
+ const mobile_apis::SystemContext::eType system_context) const {
HmiStatePtr state(new HmiState(app, *this));
+ state->set_window_type(window_type);
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_state);
state->set_video_streaming_state(video_state);
@@ -1631,7 +1648,8 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
if (GetPolicyHandler().PolicyEnabled()) {
const std::string policy_app_id = application->policy_app_id();
std::string default_hmi_string = "";
- if (GetPolicyHandler().GetDefaultHmi(policy_app_id, &default_hmi_string)) {
+ if (GetPolicyHandler().GetDefaultHmi(
+ application->mac_address(), policy_app_id, &default_hmi_string)) {
if ("BACKGROUND" == default_hmi_string) {
default_hmi = HMILevel::HMI_BACKGROUND;
} else if ("FULL" == default_hmi_string) {
@@ -1943,7 +1961,7 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
return;
}
- if (IsAppInReconnectMode(app->policy_app_id())) {
+ if (IsAppInReconnectMode(app->device(), app->policy_app_id())) {
LOG4CXX_DEBUG(logger_,
"Application is in reconnection list and won't be closed.");
return;
@@ -2490,8 +2508,24 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
}
const std::string policy_app_id(app_data[json::appId].asString());
- ApplicationSharedPtr registered_app =
- application_by_policy_id(policy_app_id);
+
+ connection_handler::DeviceHandle device_handle;
+ if (-1 == connection_handler().get_session_observer().GetDataOnSessionKey(
+ connection_key, nullptr, nullptr, &device_handle)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to create application: no connection info.");
+ continue;
+ }
+
+ std::string device_id;
+ if (-1 == connection_handler().get_session_observer().GetDataOnDeviceID(
+ device_handle, nullptr, nullptr, &device_id)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to create application: no connection info.");
+ continue;
+ }
+
+ ApplicationSharedPtr registered_app = application(device_id, policy_app_id);
if (registered_app) {
LOG4CXX_DEBUG(logger_,
"Application with the same id: "
@@ -2530,22 +2564,9 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
const std::string app_icon_dir(settings_.app_icons_folder());
const std::string full_icon_path(app_icon_dir + "/" + policy_app_id);
- connection_handler::DeviceHandle device_id = 0;
-
- if (-1 == connection_handler().get_session_observer().GetDataOnSessionKey(
- connection_key, NULL, NULL, &device_id)) {
- LOG4CXX_ERROR(logger_,
- "Failed to create application: no connection info.");
- continue;
- }
-
- std::string device_mac;
- connection_handler().get_session_observer().GetDataOnDeviceID(
- device_id, NULL, NULL, &device_mac, NULL);
-
const uint32_t hmi_app_id =
- resume_controller().IsApplicationSaved(policy_app_id, device_mac)
- ? resume_controller().GetHMIApplicationID(policy_app_id, device_mac)
+ resume_controller().IsApplicationSaved(policy_app_id, device_id)
+ ? resume_controller().GetHMIApplicationID(policy_app_id, device_id)
: GenerateNewHMIAppID();
// AppId = 0 because this is query_app(provided by hmi for download, but not
@@ -2553,8 +2574,8 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
ApplicationSharedPtr app(
new ApplicationImpl(0,
policy_app_id,
- device_mac,
device_id,
+ device_handle,
appName,
GetPolicyHandler().GetStatisticManager(),
*this));
@@ -3030,6 +3051,7 @@ void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
const ApplicationSharedPtr app,
+ const WindowID window_id,
const std::string& function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions) {
@@ -3042,7 +3064,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
DCHECK(app);
policy::CheckPermissionResult result;
- GetPolicyHandler().CheckPermissions(app, function_id, rpc_params, result);
+ GetPolicyHandler().CheckPermissions(
+ app, window_id, function_id, rpc_params, result);
if (NULL != params_permissions) {
params_permissions->allowed_params = result.list_of_allowed_params;
@@ -3050,7 +3073,9 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
params_permissions->undefined_params = result.list_of_undefined_params;
}
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE &&
+ // Record statistics for default window only
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE &&
function_id != MessageHelper::StringifiedFunctionID(
mobile_apis::FunctionID::UnregisterAppInterfaceID)) {
if (result.hmi_level_permitted != policy::kRpcAllowed) {
@@ -3061,7 +3086,8 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
#ifdef ENABLE_LOG
const std::string log_msg =
"Application: " + app->policy_app_id() + ", RPC: " + function_id +
- ", HMI status: " + MessageHelper::StringifiedHMILevel(app->hmi_level());
+ ", window_id: " + std::to_string(window_id) + ", HMI status: " +
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
#endif // ENABLE_LOG
if (result.hmi_level_permitted != policy::kRpcAllowed) {
LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg);
@@ -3134,7 +3160,10 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming(
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED);
+ return Compare<eType, EQ, ONE>(
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW),
+ HMI_FULL,
+ HMI_LIMITED);
}
bool ApplicationManagerImpl::CanAppStream(
@@ -3303,9 +3332,11 @@ void ApplicationManagerImpl::ProcessPostponedMessages(const uint32_t app_id) {
const std::string function_id = MessageHelper::StringifiedFunctionID(
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asUInt()));
+ const WindowID window_id = MessageHelper::ExtractWindowIdFromSmartObject(
+ (*message)[strings::msg_params]);
const RPCParams params;
const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions(app, function_id, params);
+ CheckPolicyPermissions(app, window_id, function_id, params);
if (mobile_api::Result::SUCCESS == check_result) {
rpc_service_->ManageMobileCommand(message, commands::Command::SOURCE_SDL);
} else {
@@ -3360,39 +3391,6 @@ void ApplicationManagerImpl::ProcessApp(const uint32_t app_id,
}
}
-void ApplicationManagerImpl::SendHMIStatusNotification(
- const std::shared_ptr<Application> app) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(app);
- smart_objects::SmartObjectSPtr notification =
- std::make_shared<smart_objects::SmartObject>();
- smart_objects::SmartObject& message = *notification;
-
- message[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID);
-
- message[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
-
- message[strings::params][strings::connection_key] =
- static_cast<int32_t>(app->app_id());
-
- message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(app->hmi_level());
-
- message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(app->audio_streaming_state());
-
- message[strings::msg_params][strings::video_streaming_state] =
- static_cast<int32_t>(app->video_streaming_state());
-
- message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(app->system_context());
-
- rpc_service_->ManageMobileCommand(notification,
- commands::Command::SOURCE_SDL);
-}
-
void ApplicationManagerImpl::ClearTimerPool() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -3514,14 +3512,14 @@ bool ApplicationManagerImpl::IsApplicationForbidden(
}
bool ApplicationManagerImpl::IsAppInReconnectMode(
+ const connection_handler::DeviceHandle& device_id,
const std::string& policy_app_id) const {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(reregister_wait_list_lock_);
return reregister_wait_list_.end() !=
std::find_if(reregister_wait_list_.begin(),
reregister_wait_list_.end(),
- std::bind1st(std::ptr_fun(&policy_app_id_comparator),
- policy_app_id));
+ PolicyAppIdComparator(device_id, policy_app_id));
}
policy::DeviceConsent ApplicationManagerImpl::GetUserConsentForDevice(
@@ -3823,13 +3821,18 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
if (flag_diffirence_app_hmi_type) {
(*it)->set_app_types(transform_app_hmi_types);
(*it)->ChangeSupportingAppHMIType();
- if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
+ const mobile_apis::HMILevel::eType app_hmi_level =
+ (*it)->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+ if (app_hmi_level == mobile_api::HMILevel::HMI_BACKGROUND) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
- } else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
- ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
+ } else if ((app_hmi_level == mobile_api::HMILevel::HMI_FULL) ||
+ (app_hmi_level == mobile_api::HMILevel::HMI_LIMITED)) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it, *this);
state_controller().SetRegularState(
- *it, mobile_apis::HMILevel::HMI_BACKGROUND, true);
+ *it,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_BACKGROUND,
+ true);
}
}
}
@@ -3846,10 +3849,10 @@ void ApplicationManagerImpl::EraseAppFromReconnectionList(
const auto policy_app_id = app->policy_app_id();
sync_primitives::AutoLock lock(reregister_wait_list_lock_);
- auto app_it = std::find_if(
- reregister_wait_list_.begin(),
- reregister_wait_list_.end(),
- std::bind1st(std::ptr_fun(&policy_app_id_comparator), policy_app_id));
+ auto app_it =
+ std::find_if(reregister_wait_list_.begin(),
+ reregister_wait_list_.end(),
+ PolicyAppIdComparator(app->device(), policy_app_id));
if (reregister_wait_list_.end() != app_it) {
reregister_wait_list_.erase(app_it);
}
@@ -3907,30 +3910,72 @@ void ApplicationManagerImpl::SendDriverDistractionState(
LOG4CXX_WARN(logger_, "DriverDistractionState is INVALID_ENUM");
return;
}
- smart_objects::SmartObjectSPtr on_driver_distraction =
- std::make_shared<smart_objects::SmartObject>();
- (*on_driver_distraction)[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
- (*on_driver_distraction)[strings::params][strings::function_id] =
- mobile_api::FunctionID::OnDriverDistractionID;
- (*on_driver_distraction)[strings::msg_params][mobile_notification::state] =
- driver_distraction_state();
- (*on_driver_distraction)[strings::params][strings::connection_key] =
- application->app_id();
+ auto create_notification = [application, this]() {
+ auto notification = std::make_shared<smart_objects::SmartObject>();
+ auto& msg_params = (*notification)[strings::msg_params];
+ auto& params = (*notification)[strings::params];
+
+ params[strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ params[strings::function_id] =
+ static_cast<int32_t>(mobile_apis::FunctionID::OnDriverDistractionID);
+ msg_params[mobile_notification::state] = driver_distraction_state();
+ const auto lock_screen_dismissal =
+ policy_handler_->LockScreenDismissalEnabledState();
+
+ if (lock_screen_dismissal &&
+ hmi_apis::Common_DriverDistractionState::DD_ON ==
+ driver_distraction_state()) {
+ bool dismissal_enabled = *lock_screen_dismissal;
+ if (dismissal_enabled) {
+ const auto language =
+ MessageHelper::MobileLanguageToString(application->ui_language());
+
+ const auto warning_message =
+ policy_handler_->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 {
+ dismissal_enabled = false;
+ }
+ }
+ msg_params[mobile_notification::lock_screen_dismissal_enabled] =
+ dismissal_enabled;
+ }
+
+ params[strings::connection_key] = application->app_id();
+ return notification;
+ };
- const std::string function_id = MessageHelper::StringifiedFunctionID(
- static_cast<mobile_apis::FunctionID::eType>(
- (*on_driver_distraction)[strings::params][strings::function_id]
- .asUInt()));
const RPCParams params;
+ const std::string function_id = MessageHelper::StringifiedFunctionID(
+ mobile_api::FunctionID::OnDriverDistractionID);
const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions(application, function_id, params);
+ CheckPolicyPermissions(application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ function_id,
+ params);
if (mobile_api::Result::SUCCESS == check_result) {
- rpc_service_->ManageMobileCommand(on_driver_distraction,
+ rpc_service_->ManageMobileCommand(create_notification(),
commands::Command::SOURCE_SDL);
} else {
- application->PushMobileMessage(on_driver_distraction);
+ MobileMessageQueue messages;
+ application->SwapMobileMessageQueue(messages);
+ messages.erase(
+ std::remove_if(
+ messages.begin(),
+ messages.end(),
+ [](smart_objects::SmartObjectSPtr message) {
+ return (*message)[strings::params][strings::function_id]
+ .asUInt() ==
+ mobile_apis::FunctionID::OnDriverDistractionID;
+ }),
+ messages.end());
+ application->SwapMobileMessageQueue(messages);
+ application->PushMobileMessage(create_notification());
}
}
@@ -4203,16 +4248,11 @@ bool ApplicationManagerImpl::IsSOStructValid(
const smart_objects::SmartObject& display_capabilities) {
smart_objects::SmartObject display_capabilities_so = display_capabilities;
if (hmi_so_factory().AttachSchema(struct_id, display_capabilities_so)) {
- if (display_capabilities_so.isValid()) {
- return true;
- } else {
- return false;
- }
- } else {
- LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id);
- return false;
+ return display_capabilities_so.isValid();
}
- return true;
+
+ LOG4CXX_ERROR(logger_, "Could not find struct id: " << struct_id);
+ return false;
}
#ifdef BUILD_TESTS
@@ -4295,9 +4335,10 @@ void ApplicationManagerImpl::ChangeAppsHMILevel(
LOG4CXX_ERROR(logger_, "There is no app with id: " << app_id);
return;
}
- const mobile_apis::HMILevel::eType old_level = app->hmi_level();
+ const mobile_apis::HMILevel::eType old_level =
+ app->hmi_level(mobile_api::PredefinedWindows::DEFAULT_WINDOW);
if (old_level != level) {
- app->set_hmi_level(level);
+ app->set_hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW, level);
OnHMILevelChanged(app_id, old_level, level);
} else {
LOG4CXX_WARN(logger_, "Redundant changing HMI level: " << level);
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
index 2b02e9b658..6ed784424a 100644
--- a/src/components/application_manager/src/application_state.cc
+++ b/src/components/application_manager/src/application_state.cc
@@ -31,7 +31,10 @@
*/
#include "application_manager/application_state.h"
+
#include <algorithm>
+#include <string>
+
#include "utils/logger.h"
#include "utils/macro.h"
@@ -53,193 +56,293 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
ApplicationState::ApplicationState() {}
-void ApplicationState::InitState(HmiStatePtr state) {
+void ApplicationState::InitState(const WindowID window_id,
+ const std::string& window_name,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- hmi_states_.clear();
- hmi_states_.push_back(state);
+ LOG4CXX_DEBUG(logger_,
+ "Initing state " << state << " for window " << window_id
+ << " with name " << window_name);
+ {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& states = hmi_states_map_[window_id];
+ states.push_back(state);
+ }
}
-void ApplicationState::AddState(HmiStatePtr state) {
+void ApplicationState::AddState(const WindowID window_id, HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
switch (state->state_id()) {
case HmiState::StateID::STATE_ID_REGULAR:
- SetRegularState(state);
+ SetRegularState(window_id, state);
return;
case HmiState::StateID::STATE_ID_POSTPONED:
- SetPostponedState(state);
+ SetPostponedState(window_id, state);
return;
case HmiState::StateID::STATE_ID_CURRENT:
- LOG4CXX_ERROR(logger_, "State of type '" << state << "' can't be added.");
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state << "' can't be added for window "
+ << window_id);
return;
default:
- AddHMIState(state);
+ AddHMIState(window_id, state);
break;
}
return;
}
-void ApplicationState::RemoveState(HmiState::StateID state) {
+void ApplicationState::RemoveState(const WindowID window_id,
+ HmiState::StateID state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
switch (state) {
case HmiState::StateID::STATE_ID_CURRENT:
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_ERROR(logger_,
- "State of type '" << state << "'can't be removed.");
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id) {
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state
+ << "' can't be removed for window "
+ << window_id);
+ return;
+ }
+
+ RemoveWindowHMIStates(window_id);
break;
case HmiState::StateID::STATE_ID_POSTPONED:
- RemovePostponedState();
+ RemovePostponedState(window_id);
break;
default:
- RemoveHMIState(state);
+ RemoveHMIState(window_id, state);
break;
}
}
-HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const {
+HmiStatePtr ApplicationState::GetState(const WindowID window_id,
+ HmiState::StateID state_id) const {
switch (state_id) {
case HmiState::StateID::STATE_ID_REGULAR:
- LOG4CXX_DEBUG(logger_, "Getting regular state.");
- return RegularHmiState();
+ LOG4CXX_DEBUG(logger_, "Getting regular state for window " << window_id);
+ return RegularHmiState(window_id);
case HmiState::StateID::STATE_ID_POSTPONED:
- LOG4CXX_DEBUG(logger_, "Getting postponed state.");
- return PostponedHmiState();
+ LOG4CXX_DEBUG(logger_,
+ "Getting postponed state for window " << window_id);
+ return PostponedHmiState(window_id);
default:
- LOG4CXX_DEBUG(logger_, "Getting current state.");
- return CurrentHmiState();
+ LOG4CXX_DEBUG(logger_, "Getting current state for window " << window_id);
+ return CurrentHmiState(window_id);
+ }
+}
+
+HmiStates ApplicationState::GetStates(const HmiState::StateID state_id) const {
+ LOG4CXX_DEBUG(logger_, "Collecting all states of type " << state_id);
+
+ HmiStates hmi_states;
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ for (const auto& hmi_state_pair : hmi_states_map_) {
+ hmi_states.push_back(GetState(hmi_state_pair.first, state_id));
}
+
+ return hmi_states;
}
-void ApplicationState::AddHMIState(HmiStatePtr state) {
+WindowIds ApplicationState::GetWindowIds() const {
+ LOG4CXX_DEBUG(logger_, "Collecting available window ID's");
+
+ WindowIds window_ids;
+ std::string stringified_window_ids;
+
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ for (const auto& hmi_state_pair : hmi_states_map_) {
+ window_ids.push_back(hmi_state_pair.first);
+ stringified_window_ids += (stringified_window_ids.empty() ? "" : ", ") +
+ std::to_string(hmi_state_pair.first);
+ }
+
+ LOG4CXX_DEBUG(logger_,
+ "Existing window IDs: [" + stringified_window_ids + "]");
+ return window_ids;
+}
+
+void ApplicationState::AddHMIState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- HmiStates::iterator it = std::find_if(hmi_states_.begin(),
- hmi_states_.end(),
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ HmiStates::iterator it = std::find_if(hmi_states.begin(),
+ hmi_states.end(),
StateIDComparator(state->state_id()));
- if (hmi_states_.end() != it) {
- LOG4CXX_WARN(
- logger_,
- "Hmi state with ID "
- << state->state_id()
- << "has been already applied to this application. Ignoring");
+ if (hmi_states.end() != it) {
+ LOG4CXX_WARN(logger_,
+ "Hmi state with ID " << state->state_id()
+ << "has been already applied for window "
+ << window_id
+ << " of this application. Ignoring");
return;
}
- hmi_states_.push_back(state);
+ hmi_states.push_back(state);
}
-void ApplicationState::RemoveHMIState(HmiState::StateID state_id) {
+void ApplicationState::RemoveHMIState(const WindowID window_id,
+ HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
HmiStates::iterator it = std::find_if(
- hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state_id));
- if (it == hmi_states_.end()) {
- LOG4CXX_ERROR(logger_, "Unsuccesful remove HmiState: " << state_id);
+ hmi_states.begin(), hmi_states.end(), StateIDComparator(state_id));
+ if (hmi_states.end() == it) {
+ LOG4CXX_ERROR(logger_,
+ "Unsuccesful remove HmiState: " << state_id << " for window "
+ << window_id);
return;
}
// unable to remove regular state
- DCHECK_OR_RETURN_VOID(it != hmi_states_.begin());
+ DCHECK_OR_RETURN_VOID(hmi_states.begin() != it);
HmiStates::iterator next = it;
HmiStates::iterator prev = it;
next++;
prev--;
- if (next != hmi_states_.end()) {
+
+ if (next != hmi_states.end()) {
HmiStatePtr next_state = *next;
HmiStatePtr prev_state = *prev;
next_state->set_parent(prev_state);
}
- hmi_states_.erase(it);
+
+ hmi_states.erase(it);
}
-void ApplicationState::RemovePostponedState() {
+void ApplicationState::RemoveWindowHMIStates(const WindowID window_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ DCHECK_OR_RETURN_VOID(mobile_apis::PredefinedWindows::DEFAULT_WINDOW !=
+ window_id);
+
+ LOG4CXX_DEBUG(logger_,
+ "Removing HMI states for window with id #" << window_id);
+ {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ hmi_states_map_.erase(window_id);
+ }
+}
+
+void ApplicationState::RemovePostponedState(const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
StateIDComparator finder(HmiState::StateID::STATE_ID_POSTPONED);
HmiStates::iterator postponed_state =
- std::find_if(hmi_states_.begin(), hmi_states_.end(), finder);
+ std::find_if(hmi_states.begin(), hmi_states.end(), finder);
- if (hmi_states_.end() == postponed_state) {
- LOG4CXX_ERROR(logger_, "No postponed state is set for app.");
+ if (hmi_states.end() == postponed_state) {
+ LOG4CXX_ERROR(logger_,
+ "No postponed state is set for window " << window_id);
return;
}
- hmi_states_.erase(postponed_state);
+
+ hmi_states.erase(postponed_state);
}
-void ApplicationState::SetRegularState(HmiStatePtr state) {
+void ApplicationState::SetRegularState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_REGULAR);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
- HmiStatePtr front_state = hmi_states_.front();
+ HmiStatePtr front_state = hmi_states.front();
HmiState::StateID front_state_id = front_state->state_id();
if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
// Drop postponed state
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
}
// Drop regular state
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
- if (!hmi_states_.empty()) {
- HmiStatePtr front_state = hmi_states_.front();
+ if (!hmi_states.empty()) {
+ HmiStatePtr front_state = hmi_states.front();
front_state->set_parent(state);
}
- hmi_states_.insert(hmi_states_.begin(), state);
+
+ // Insert new regular state
+ hmi_states.insert(hmi_states.begin(), state);
if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
- hmi_states_.insert(hmi_states_.begin(), front_state);
+ // Restore postponed state if it was before
+ hmi_states.insert(hmi_states.begin(), front_state);
}
}
-void ApplicationState::SetPostponedState(HmiStatePtr state) {
+void ApplicationState::SetPostponedState(const WindowID window_id,
+ HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() ==
HmiState::StateID::STATE_ID_POSTPONED);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
- HmiStatePtr front_state = hmi_states_.front();
+
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ HmiStates& hmi_states = hmi_states_map_[window_id];
+ DCHECK_OR_RETURN_VOID(!hmi_states.empty());
+ HmiStatePtr front_state = hmi_states.front();
if (front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
- hmi_states_.erase(hmi_states_.begin());
+ hmi_states.erase(hmi_states.begin());
}
- hmi_states_.insert(hmi_states_.begin(), state);
+
+ hmi_states.insert(hmi_states.begin(), state);
}
-HmiStatePtr ApplicationState::CurrentHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStatePtr back_state = hmi_states_.back();
+HmiStatePtr ApplicationState::CurrentHmiState(const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStatePtr back_state = hmi_states.back();
DCHECK_OR_RETURN(
back_state->state_id() != HmiState::StateID::STATE_ID_POSTPONED,
HmiStatePtr());
+
return back_state;
}
-HmiStatePtr ApplicationState::RegularHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStates::const_iterator front_itr = hmi_states_.begin();
+HmiStatePtr ApplicationState::RegularHmiState(const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStates::const_iterator front_itr = hmi_states.begin();
if ((*front_itr)->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
++front_itr;
}
+
return *front_itr;
}
-HmiStatePtr ApplicationState::PostponedHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- HmiStatePtr front_state = hmi_states_.front();
+HmiStatePtr ApplicationState::PostponedHmiState(
+ const WindowID window_id) const {
+ sync_primitives::AutoLock auto_lock(hmi_states_map_lock_);
+ auto it_states = hmi_states_map_.find(window_id);
+ DCHECK_OR_RETURN(it_states != hmi_states_map_.end(), HmiStatePtr());
+
+ const HmiStates& hmi_states = it_states->second;
+ DCHECK_OR_RETURN(!hmi_states.empty(), HmiStatePtr());
+
+ HmiStatePtr front_state = hmi_states.front();
return front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED
? front_state
: HmiStatePtr();
diff --git a/src/components/application_manager/src/commands/command_impl.cc b/src/components/application_manager/src/commands/command_impl.cc
index 521a44890f..8875895cb7 100644
--- a/src/components/application_manager/src/commands/command_impl.cc
+++ b/src/components/application_manager/src/commands/command_impl.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2014, Ford Motor Company
All rights reserved.
@@ -96,6 +96,15 @@ int32_t CommandImpl::function_id() const {
return (*message_)[strings::params][strings::function_id].asInt();
}
+WindowID CommandImpl::window_id() const {
+ if ((*message_).keyExists(strings::msg_params)) {
+ if ((*message_)[strings::msg_params].keyExists(strings::window_id)) {
+ return (*message_)[strings::msg_params][strings::window_id].asInt();
+ }
+ }
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
uint32_t CommandImpl::connection_key() const {
return (*message_)[strings::params][strings::connection_key].asUInt();
}
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index f67fde22a0..06e0220158 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -725,12 +725,17 @@ bool CommandRequestImpl::CheckAllowedParameters() {
}
mobile_apis::Result::eType check_result =
- application_manager_.CheckPolicyPermissions(
- app,
- MessageHelper::StringifiedFunctionID(
- static_cast<mobile_api::FunctionID::eType>(function_id())),
- params,
- &parameters_permissions_);
+ mobile_apis::Result::eType::INVALID_ID;
+ const auto current_window_id = window_id();
+ if (app->WindowIdExists(current_window_id)) {
+ check_result = application_manager_.CheckPolicyPermissions(
+ app,
+ current_window_id,
+ MessageHelper::StringifiedFunctionID(
+ static_cast<mobile_api::FunctionID::eType>(function_id())),
+ params,
+ &parameters_permissions_);
+ }
// Check, if RPC is allowed by policy
if (mobile_apis::Result::SUCCESS != check_result) {
diff --git a/src/components/application_manager/src/display_capabilities_builder.cc b/src/components/application_manager/src/display_capabilities_builder.cc
new file mode 100644
index 0000000000..8234128280
--- /dev/null
+++ b/src/components/application_manager/src/display_capabilities_builder.cc
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2019, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+namespace application_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "DisplayCapabilitiesBuilder")
+
+const WindowID kDefaultWindowID = 0;
+
+DisplayCapabilitiesBuilder::DisplayCapabilitiesBuilder(Application& application)
+ : owner_(application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+}
+
+void DisplayCapabilitiesBuilder::InitBuilder(
+ DisplayCapabilitiesBuilder::ResumeCallback resume_callback,
+ const smart_objects::SmartObject& windows_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ resume_callback_ = resume_callback;
+ window_ids_to_resume_.insert(kDefaultWindowID);
+ for (size_t i = 0; i < windows_info.length(); ++i) {
+ auto window_id = windows_info[i][strings::window_id].asInt();
+ LOG4CXX_DEBUG(logger_,
+ "Inserting " << window_id << " to waiting container");
+ window_ids_to_resume_.insert(window_id);
+ }
+}
+
+void DisplayCapabilitiesBuilder::UpdateDisplayCapabilities(
+ const smart_objects::SmartObject& incoming_display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace smart_objects;
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+
+ if (!display_capabilities_) {
+ display_capabilities_ = std::make_shared<SmartObject>(SmartType_Array);
+ }
+
+ // As per v6.0, only single display is supported
+ auto cur_window_caps =
+ (*display_capabilities_)[0][strings::window_capabilities];
+
+ const auto& inc_window_caps =
+ incoming_display_capabilities[0][strings::window_capabilities];
+
+ for (size_t i = 0; i < inc_window_caps.length(); ++i) {
+ const WindowID window_id =
+ inc_window_caps[i].keyExists(strings::window_id)
+ ? inc_window_caps[i][strings::window_id].asInt()
+ : kDefaultWindowID;
+ if (window_ids_to_resume_.end() != window_ids_to_resume_.find(window_id)) {
+ cur_window_caps[cur_window_caps.length()] = inc_window_caps[i];
+ LOG4CXX_DEBUG(logger_, "Stop waiting for: " << window_id);
+ window_ids_to_resume_.erase(window_id);
+ }
+ }
+
+ *display_capabilities_ = incoming_display_capabilities;
+ (*display_capabilities_)[0][strings::window_capabilities] = cur_window_caps;
+
+ if (window_ids_to_resume_.empty()) {
+ LOG4CXX_TRACE(logger_, "Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+ }
+} // namespace application_manager
+
+const smart_objects::SmartObjectSPtr
+DisplayCapabilitiesBuilder::display_capabilities() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return display_capabilities_;
+}
+
+void DisplayCapabilitiesBuilder::ResetDisplayCapabilities() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ display_capabilities_.reset();
+}
+
+void DisplayCapabilitiesBuilder::StopWaitingForWindow(
+ const WindowID window_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(display_capabilities_lock_);
+ LOG4CXX_DEBUG(logger_,
+ "Window id " << window_id << " will be erased due to failure");
+ window_ids_to_resume_.erase(window_id);
+ if (window_ids_to_resume_.empty()) {
+ LOG4CXX_TRACE(logger_,
+ window_id << " was the last window pending resumption. "
+ "Invoking resume callback");
+ resume_callback_(owner_, *display_capabilities_);
+ display_capabilities_.reset();
+ }
+}
+} // namespace application_manager
diff --git a/src/components/application_manager/src/hmi_capabilities_impl.cc b/src/components/application_manager/src/hmi_capabilities_impl.cc
index 0f5bc80d56..6b209ade0c 100644
--- a/src/components/application_manager/src/hmi_capabilities_impl.cc
+++ b/src/components/application_manager/src/hmi_capabilities_impl.cc
@@ -58,6 +58,7 @@ std::map<std::string, hmi_apis::Common_TextFieldName::eType>
text_fields_enum_name;
std::map<std::string, hmi_apis::Common_MediaClockFormat::eType>
media_clock_enum_name;
+std::map<std::string, hmi_apis::Common_MenuLayout::eType> menu_layout_enum;
std::map<std::string, hmi_apis::Common_ImageType::eType> image_type_enum;
std::map<std::string, hmi_apis::Common_SamplingRate::eType> sampling_rate_enum;
std::map<std::string, hmi_apis::Common_BitsPerSample::eType>
@@ -135,6 +136,46 @@ void InitCapabilities() {
hmi_apis::Common_ButtonName::CUSTOM_BUTTON));
button_enum_name.insert(std::make_pair(std::string("SEARCH"),
hmi_apis::Common_ButtonName::SEARCH));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_CENTER_LOCATION"),
+ hmi_apis::Common_ButtonName::NAV_CENTER_LOCATION));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_IN"), hmi_apis::Common_ButtonName::NAV_ZOOM_IN));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_ZOOM_OUT"), hmi_apis::Common_ButtonName::NAV_ZOOM_OUT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_UP"), hmi_apis::Common_ButtonName::NAV_PAN_UP));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_RIGHT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_RIGHT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_RIGHT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_DOWN"), hmi_apis::Common_ButtonName::NAV_PAN_DOWN));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_DOWN_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_DOWN_LEFT));
+ button_enum_name.insert(std::make_pair(
+ std::string("NAV_PAN_LEFT"), hmi_apis::Common_ButtonName::NAV_PAN_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_PAN_UP_LEFT"),
+ hmi_apis::Common_ButtonName::NAV_PAN_UP_LEFT));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_TILT_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_TILT_TOGGLE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_CLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_CLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_ROTATE_COUNTERCLOCKWISE"),
+ hmi_apis::Common_ButtonName::NAV_ROTATE_COUNTERCLOCKWISE));
+ button_enum_name.insert(
+ std::make_pair(std::string("NAV_HEADING_TOGGLE"),
+ hmi_apis::Common_ButtonName::NAV_HEADING_TOGGLE));
text_fields_enum_name.insert(std::make_pair(
std::string("mainField1"), hmi_apis::Common_TextFieldName::mainField1));
@@ -239,6 +280,11 @@ void InitCapabilities() {
std::make_pair(std::string("CLOCKTEXT4"),
hmi_apis::Common_MediaClockFormat::CLOCKTEXT4));
+ menu_layout_enum.insert(
+ std::make_pair(std::string("LIST"), hmi_apis::Common_MenuLayout::LIST));
+ menu_layout_enum.insert(
+ std::make_pair(std::string("TILES"), hmi_apis::Common_MenuLayout::TILES));
+
image_type_enum.insert(std::make_pair(std::string("STATIC"),
hmi_apis::Common_ImageType::STATIC));
image_type_enum.insert(std::make_pair(std::string("DYNAMIC"),
@@ -337,6 +383,8 @@ void InitCapabilities() {
std::make_pair(std::string("MFD5"), hmi_apis::Common_DisplayType::MFD5));
display_type_enum.insert(std::make_pair(
std::string("GEN3_8_INCH"), hmi_apis::Common_DisplayType::GEN3_8_INCH));
+ display_type_enum.insert(std::make_pair(
+ std::string("SDL_GENERIC"), hmi_apis::Common_DisplayType::SDL_GENERIC));
character_set_enum.insert(std::make_pair(
std::string("TYPE2SET"), hmi_apis::Common_CharacterSet::TYPE2SET));
@@ -568,6 +616,12 @@ void HMICapabilitiesImpl::set_display_capabilities(
}
}
+void HMICapabilitiesImpl::set_system_display_capabilities(
+ const smart_objects::SmartObject& display_capabilities) {
+ system_display_capabilities_.reset(
+ new smart_objects::SmartObject(display_capabilities));
+}
+
void HMICapabilitiesImpl::set_hmi_zone_capabilities(
const smart_objects::SmartObject& hmi_zone_capabilities) {
if (hmi_zone_capabilities_) {
@@ -758,6 +812,11 @@ const smart_objects::SmartObject* HMICapabilitiesImpl::display_capabilities()
return display_capabilities_;
}
+const smart_objects::SmartObjectSPtr
+HMICapabilitiesImpl::system_display_capabilities() const {
+ return system_display_capabilities_;
+}
+
const smart_objects::SmartObject* HMICapabilitiesImpl::hmi_zone_capabilities()
const {
return hmi_zone_capabilities_;
@@ -826,6 +885,26 @@ bool HMICapabilitiesImpl::rc_supported() const {
return is_rc_supported_;
}
+bool HMICapabilitiesImpl::menu_layout_supported(
+ mobile_apis::MenuLayout::eType layout) const {
+ if (!display_capabilities_ ||
+ !display_capabilities_->keyExists(strings::menu_layouts_available))
+ return false;
+
+ auto menu_layouts =
+ display_capabilities_->getElement(strings::menu_layouts_available);
+ if (menu_layouts.getType() == smart_objects::SmartType_Array) {
+ for (uint32_t i = 0; i < menu_layouts.length(); ++i) {
+ if (layout == static_cast<mobile_apis::MenuLayout::eType>(
+ menu_layouts.getElement(i).asUInt())) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
const smart_objects::SmartObject* HMICapabilitiesImpl::navigation_capability()
const {
return navigation_capability_;
@@ -1002,6 +1081,25 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
}
if (display_capabilities_so.keyExists(
+ strings::menu_layouts_available)) {
+ smart_objects::SmartObject menu_layouts_available_enum(
+ smart_objects::SmartType_Array);
+ auto menu_layouts_available_array =
+ display_capabilities_so[strings::menu_layouts_available];
+ for (uint32_t i = 0, j = 0; i < menu_layouts_available_array.length();
+ ++i) {
+ auto it = menu_layout_enum.find(
+ menu_layouts_available_array[i].asString());
+ if (it != menu_layout_enum.end()) {
+ menu_layouts_available_enum[j++] = it->second;
+ }
+ }
+ display_capabilities_so.erase(strings::menu_layouts_available);
+ display_capabilities_so[strings::menu_layouts_available] =
+ menu_layouts_available_enum;
+ }
+
+ if (display_capabilities_so.keyExists(
hmi_response::image_capabilities)) {
smart_objects::SmartObject& image_capabilities_array =
display_capabilities_so[hmi_response::image_capabilities];
@@ -1026,27 +1124,16 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
if (check_existing_json_member(ui, "audioPassThruCapabilities")) {
Json::Value audio_capabilities =
ui.get("audioPassThruCapabilities", "");
- smart_objects::SmartObject audio_capabilities_so =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
- audio_capabilities_so =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
- if (check_existing_json_member(audio_capabilities, "samplingRate")) {
- audio_capabilities_so["samplingRate"] =
- sampling_rate_enum
- .find(audio_capabilities.get("samplingRate", "").asString())
- ->second;
- }
- if (check_existing_json_member(audio_capabilities, "bitsPerSample")) {
- audio_capabilities_so["bitsPerSample"] =
- bit_per_sample_enum
- .find(audio_capabilities.get("bitsPerSample", "").asString())
- ->second;
- }
- if (check_existing_json_member(audio_capabilities, "audioType")) {
- audio_capabilities_so["audioType"] =
- audio_type_enum
- .find(audio_capabilities.get("audioType", "").asString())
- ->second;
+ smart_objects::SmartObject audio_capabilities_so(
+ smart_objects::SmartType_Array);
+ if (audio_capabilities.type() == Json::arrayValue) {
+ for (uint32_t i = 0; i < audio_capabilities.size(); i++) {
+ convert_audio_capability_to_obj(audio_capabilities[i],
+ audio_capabilities_so[i]);
+ }
+ } else if (audio_capabilities.type() == Json::objectValue) {
+ convert_audio_capability_to_obj(audio_capabilities,
+ audio_capabilities_so[0]);
}
set_audio_pass_thru_capabilities(audio_capabilities_so);
}
@@ -1055,26 +1142,7 @@ bool HMICapabilitiesImpl::load_capabilities_from_file() {
Json::Value pcm_capabilities = ui.get("pcmStreamCapabilities", "");
smart_objects::SmartObject pcm_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- if (check_existing_json_member(pcm_capabilities, "samplingRate")) {
- pcm_capabilities_so["samplingRate"] =
- sampling_rate_enum
- .find(pcm_capabilities.get("samplingRate", "").asString())
- ->second;
- }
- if (check_existing_json_member(pcm_capabilities, "bitsPerSample")) {
- pcm_capabilities_so["bitsPerSample"] =
- bit_per_sample_enum
- .find(pcm_capabilities.get("bitsPerSample", "").asString())
- ->second;
- }
- if (check_existing_json_member(pcm_capabilities, "audioType")) {
- pcm_capabilities_so["audioType"] =
- audio_type_enum
- .find(pcm_capabilities.get("audioType", "").asString())
- ->second;
- }
-
+ convert_audio_capability_to_obj(pcm_capabilities, pcm_capabilities_so);
set_pcm_stream_capabilities(pcm_capabilities_so);
}
@@ -1331,6 +1399,27 @@ void HMICapabilitiesImpl::convert_json_languages_to_obj(
}
}
+void HMICapabilitiesImpl::convert_audio_capability_to_obj(
+ const Json::Value& capability,
+ smart_objects::SmartObject& output_so) const {
+ if (check_existing_json_member(capability, "samplingRate")) {
+ output_so[strings::sampling_rate] =
+ sampling_rate_enum.find(capability.get("samplingRate", "").asString())
+ ->second;
+ }
+ if (check_existing_json_member(capability, "bitsPerSample")) {
+ output_so[strings::bits_per_sample] =
+ bit_per_sample_enum
+ .find(capability.get("bitsPerSample", "").asString())
+ ->second;
+ }
+ if (check_existing_json_member(capability, "audioType")) {
+ output_so[strings::audio_type] =
+ audio_type_enum.find(capability.get("audioType", "").asString())
+ ->second;
+ }
+}
+
HMILanguageHandler& HMICapabilitiesImpl::get_hmi_language_handler() {
return hmi_language_handler_;
}
diff --git a/src/components/application_manager/src/hmi_interfaces_impl.cc b/src/components/application_manager/src/hmi_interfaces_impl.cc
index 9aff403e09..f1f8660217 100644
--- a/src/components/application_manager/src/hmi_interfaces_impl.cc
+++ b/src/components/application_manager/src/hmi_interfaces_impl.cc
@@ -105,6 +105,8 @@ generate_function_to_interface_convert_map() {
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[BasicCommunication_GetFilePath] =
HmiInterfaces::HMI_INTERFACE_BasicCommunication;
+ convert_map[BasicCommunication_CloseApplication] =
+ HmiInterfaces::HMI_INTERFACE_BasicCommunication;
convert_map[VR_IsReady] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Started] = HmiInterfaces::HMI_INTERFACE_VR;
convert_map[VR_Stopped] = HmiInterfaces::HMI_INTERFACE_VR;
@@ -135,12 +137,16 @@ generate_function_to_interface_convert_map() {
convert_map[UI_DeleteCommand] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_AddSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_DeleteSubMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_ShowAppMenu] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_CreateWindow] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_DeleteWindow] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_PerformInteraction] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetMediaClockTimer] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_SetGlobalProperties] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnCommand] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnSystemContext] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_GetCapabilities] = HmiInterfaces::HMI_INTERFACE_UI;
+ convert_map[UI_CancelInteraction] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_ChangeRegistration] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_OnLanguageChange] = HmiInterfaces::HMI_INTERFACE_UI;
convert_map[UI_GetSupportedLanguages] = HmiInterfaces::HMI_INTERFACE_UI;
@@ -231,6 +237,8 @@ generate_function_to_interface_convert_map() {
convert_map[RC_OnRemoteControlSettings] = HmiInterfaces::HMI_INTERFACE_RC;
convert_map[AppService_PublishAppService] =
HmiInterfaces::HMI_INTERFACE_AppService;
+ convert_map[AppService_UnpublishAppService] =
+ HmiInterfaces::HMI_INTERFACE_AppService;
convert_map[AppService_GetAppServiceData] =
HmiInterfaces::HMI_INTERFACE_AppService;
convert_map[AppService_PerformAppServiceInteraction] =
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 77880eddc0..844d0254cf 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -48,6 +48,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
: hmi_app_id_(app->hmi_app_id())
, state_id_(state_id)
, app_mngr_(app_mngr)
+ , window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
@@ -60,6 +61,7 @@ HmiState::HmiState(std::shared_ptr<Application> app,
: hmi_app_id_(app->hmi_app_id())
, state_id_(STATE_ID_REGULAR)
, app_mngr_(app_mngr)
+ , window_type_(mobile_apis::WindowType::INVALID_ENUM)
, hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
, audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
, video_streaming_state_(mobile_apis::VideoStreamingState::INVALID_ENUM)
@@ -96,6 +98,15 @@ bool HmiState::is_mobile_projection_app() const {
return app ? app->mobile_projection_enabled() : false;
}
+mobile_apis::WindowType::eType HmiState::window_type() const {
+ return window_type_;
+}
+
+void HmiState::set_window_type(
+ const mobile_apis::WindowType::eType window_type) {
+ window_type_ = window_type;
+}
+
mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
const {
using namespace mobile_apis;
@@ -173,17 +184,25 @@ PhoneCallHmiState::PhoneCallHmiState(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
return parent()->hmi_level();
}
+
if (is_navi_app() || is_mobile_projection_app()) {
return HMILevel::HMI_LIMITED;
}
+
if (!is_media_app()) {
return parent()->hmi_level();
}
+
return HMILevel::HMI_BACKGROUND;
}
@@ -198,6 +217,11 @@ DeactivateHMI::DeactivateHMI(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const {
using namespace helpers;
using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
@@ -215,14 +239,19 @@ AudioSource::AudioSource(std::shared_ptr<Application> app,
}
mobile_apis::HMILevel::eType AudioSource::hmi_level() const {
+ using namespace mobile_apis;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
// Checking for NONE is necessary to avoid issue during
// calculation of HMI level during setting default HMI level
- if (keep_context_ ||
- mobile_apis::HMILevel::HMI_NONE == parent()->hmi_level()) {
+ if (keep_context_ || HMILevel::HMI_NONE == parent()->hmi_level()) {
return parent()->hmi_level();
}
- return mobile_apis::HMILevel::HMI_BACKGROUND;
+ return HMILevel::HMI_BACKGROUND;
}
EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app,
@@ -232,11 +261,17 @@ EmbeddedNavi::EmbeddedNavi(std::shared_ptr<Application> app,
mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const {
using namespace mobile_apis;
using namespace helpers;
+
+ if (WindowType::WIDGET == window_type()) {
+ return parent()->hmi_level();
+ }
+
if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
HMILevel::HMI_BACKGROUND,
HMILevel::HMI_NONE)) {
return parent()->hmi_level();
}
+
return HMILevel::HMI_BACKGROUND;
}
@@ -278,7 +313,8 @@ std::ostream& operator<<(std::ostream& os, const HmiState& src) {
} else {
os << "(none)";
}
- os << ", hmi app id:" << src.hmi_app_id_ << ", state:" << src.state_id()
+ os << ", hmi app id:" << src.hmi_app_id_
+ << ", window_type:" << src.window_type_ << ", state:" << src.state_id()
<< ", hmi_level:" << src.hmi_level()
<< ", audio:" << src.audio_streaming_state()
<< ", video:" << src.video_streaming_state()
diff --git a/src/components/application_manager/src/message_helper/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index 6530004499..3639953a3a 100644
--- a/src/components/application_manager/src/message_helper/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -332,6 +332,15 @@ std::string MessageHelper::CommonLanguageToString(
return std::string();
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType language) {
+ using namespace ns_smart_device_link::ns_smart_objects;
+ const char* str = 0;
+ EnumConversionHelper<mobile_apis::Language::eType>::EnumToCString(language,
+ &str);
+ return str ? str : std::string();
+}
+
smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
hmi_apis::messageType::eType message_type, const uint32_t correlation_id) {
using namespace smart_objects;
@@ -348,6 +357,33 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
return message;
}
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& display_capabilities, Application& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto message = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
+ (*message)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemCapabilityUpdatedID;
+ (*message)[strings::params][strings::connection_key] = app.app_id();
+ (*message)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::mobile_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+
+ smart_objects::SmartObject system_capability(smart_objects::SmartType_Map);
+ system_capability[strings::system_capability_type] =
+ static_cast<int32_t>(mobile_apis::SystemCapabilityType::DISPLAYS);
+ system_capability[strings::display_capabilities] = display_capabilities;
+ (*message)[strings::msg_params][strings::system_capability] =
+ system_capability;
+
+ return message;
+}
+
void MessageHelper::BroadcastCapabilityUpdate(
smart_objects::SmartObject& msg_params, ApplicationManager& app_mngr) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -369,7 +405,8 @@ void MessageHelper::BroadcastCapabilityUpdate(
hmi_apis::FunctionID::BasicCommunication_OnSystemCapabilityUpdated;
smart_objects::SmartObjectSPtr hmi_notification =
std::make_shared<smart_objects::SmartObject>(message);
- app_mngr.GetRPCService().ManageHMICommand(hmi_notification);
+ app_mngr.GetRPCService().ManageHMICommand(
+ hmi_notification, commands::Command::CommandSource::SOURCE_SDL_TO_HMI);
}
smart_objects::SmartObject MessageHelper::CreateAppServiceCapabilities(
@@ -623,15 +660,16 @@ void MessageHelper::SendResetPropertiesRequest(ApplicationSharedPtr application,
msg_params = *MessageHelper::CreateAppVrHelp(application);
msg_params[hmi_request::menu_title] = "";
- smart_objects::SmartObject key_board_properties =
+ smart_objects::SmartObject keyboard_properties =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- key_board_properties[strings::language] =
+ keyboard_properties[strings::language] =
static_cast<int32_t>(hmi_apis::Common_Language::EN_US);
- key_board_properties[hmi_request::keyboard_layout] =
+ keyboard_properties[hmi_request::keyboard_layout] =
static_cast<int32_t>(hmi_apis::Common_KeyboardLayout::QWERTY);
- key_board_properties[hmi_request::auto_complete_text] = "";
- msg_params[hmi_request::keyboard_properties] = key_board_properties;
+ keyboard_properties[hmi_request::auto_complete_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[hmi_request::keyboard_properties] = keyboard_properties;
msg_params[strings::app_id] = application->app_id();
@@ -761,7 +799,8 @@ hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr notification =
@@ -779,16 +818,21 @@ void MessageHelper::SendHMIStatusNotification(
static_cast<int32_t>(application_manager::MessageType::kNotification);
message[strings::params][strings::connection_key] =
- static_cast<int32_t>(application_impl.app_id());
+ static_cast<int32_t>(application->app_id());
+
+ message[strings::msg_params][strings::window_id] = window_id;
message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(application_impl.hmi_level());
+ static_cast<int32_t>(application->hmi_level(window_id));
message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(application_impl.audio_streaming_state());
+ static_cast<int32_t>(application->audio_streaming_state());
+
+ message[strings::msg_params][strings::video_streaming_state] =
+ static_cast<int32_t>(application->video_streaming_state());
message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(application_impl.system_context());
+ static_cast<int32_t>(application->system_context(window_id));
application_manager.GetRPCService().ManageMobileCommand(
notification, commands::Command::SOURCE_SDL);
@@ -1547,6 +1591,67 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
return vr_command;
}
+smart_objects::SmartObjectSPtr MessageHelper::CreateUICreateWindowRequestToHMI(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& window_info) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto ui_request = CreateMessageForHMI(hmi_apis::messageType::request,
+ app_mngr.GetNextHMICorrelationID());
+
+ (*ui_request)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::UI_CreateWindow);
+
+ (*ui_request)[strings::correlation_id] =
+ (*ui_request)[strings::params][strings::correlation_id];
+ (*ui_request)[strings::function_id] =
+ (*ui_request)[strings::params][strings::function_id];
+
+ smart_objects::SmartObject msg_params(
+ smart_objects::SmartObject(smart_objects::SmartType_Map));
+
+ msg_params[strings::window_id] = window_info[strings::window_id].asInt();
+ msg_params[strings::window_type] = window_info[strings::window_type].asInt();
+ msg_params[strings::window_name] =
+ window_info[strings::window_name].asString();
+
+ if (window_info.keyExists(strings::associated_service_type)) {
+ msg_params[strings::associated_service_type] =
+ window_info[strings::associated_service_type].asString();
+ }
+ if (window_info.keyExists(strings::duplicate_updates_from_window_id)) {
+ msg_params[strings::duplicate_updates_from_window_id] =
+ window_info[strings::duplicate_updates_from_window_id].asInt();
+ }
+
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ (*ui_request)[strings::msg_params] = msg_params;
+
+ return ui_request;
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info) {
+ smart_objects::SmartObjectList requests;
+ DCHECK_OR_RETURN(application, requests);
+
+ for (size_t i = 0; i < windows_info.length(); ++i) {
+ const auto& info = windows_info[i];
+
+ const auto ui_request =
+ CreateUICreateWindowRequestToHMI(application, app_mngr, info);
+
+ DCHECK_OR_RETURN(ui_request, requests);
+
+ requests.push_back(ui_request);
+ }
+
+ return requests;
+}
+
bool MessageHelper::CreateDeviceInfo(
connection_handler::DeviceHandle device_handle,
const protocol_handler::SessionObserver& session_observer,
@@ -1599,8 +1704,8 @@ bool MessageHelper::CreateHMIApplicationStruct(
const smart_objects::SmartObject* app_types = app->app_types();
const smart_objects::SmartObject* ngn_media_screen_name =
app->ngn_media_screen_name();
- const smart_objects::SmartObject* day_color_scheme = app->day_color_scheme();
- const smart_objects::SmartObject* night_color_scheme =
+ const smart_objects::SmartObject day_color_scheme = app->day_color_scheme();
+ const smart_objects::SmartObject night_color_scheme =
app->night_color_scheme();
message = smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -1638,7 +1743,8 @@ bool MessageHelper::CreateHMIApplicationStruct(
const policy::RequestType::State app_request_types_state =
policy_handler.GetAppRequestTypeState(policy_app_id);
if (policy::RequestType::State::AVAILABLE == app_request_types_state) {
- const auto request_types = policy_handler.GetAppRequestTypes(policy_app_id);
+ const auto request_types =
+ policy_handler.GetAppRequestTypes(app->device(), policy_app_id);
message[strings::request_type] =
SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& request_types_array =
@@ -1675,12 +1781,12 @@ bool MessageHelper::CreateHMIApplicationStruct(
SmartObject(smart_objects::SmartType_Array);
}
- if (day_color_scheme) {
- message[strings::day_color_scheme] = *day_color_scheme;
+ if (day_color_scheme.getType() == smart_objects::SmartType_Map) {
+ message[strings::day_color_scheme] = day_color_scheme;
}
- if (night_color_scheme) {
- message[strings::night_color_scheme] = *night_color_scheme;
+ if (night_color_scheme.getType() == smart_objects::SmartType_Map) {
+ message[strings::night_color_scheme] = night_color_scheme;
}
message[strings::device_info] =
@@ -1789,12 +1895,16 @@ void MessageHelper::SendOnAppUnregNotificationToHMI(
smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr) {
DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+ if (hmi_apis::Common_HMILevel::NONE == level) {
+ LOG4CXX_WARN(logger_,
+ "BC.ActivateApp cannot be used to deactivate an application");
+ return NULL;
+ }
const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
smart_objects::SmartObjectSPtr message =
@@ -1831,6 +1941,23 @@ smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
return message;
}
+smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
+
+ const uint32_t correlation_id = app_mngr.GetNextHMICorrelationID();
+ smart_objects::SmartObjectSPtr message =
+ std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ hmi_apis::FunctionID::BasicCommunication_CloseApplication;
+ (*message)[strings::params][strings::message_type] = MessageType::kRequest;
+ (*message)[strings::params][strings::correlation_id] = correlation_id;
+ (*message)[strings::msg_params][strings::app_id] = app->app_id();
+
+ return message;
+}
+
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id,
ApplicationManager& app_mngr) {
LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
@@ -2979,17 +3106,32 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
- int32_t function_id) {
+ int32_t function_id,
+ const WindowID window_id) {
SoftButtonID softbuttons_id;
smart_objects::SmartObject& soft_buttons =
message_params[strings::soft_buttons];
unsigned int length = soft_buttons.length();
for (unsigned int i = 0; i < length; ++i) {
- softbuttons_id.insert(soft_buttons[i][strings::soft_button_id].asUInt());
+ const auto button_id = std::make_pair(
+ soft_buttons[i][strings::soft_button_id].asUInt(), window_id);
+ softbuttons_id.insert(button_id);
}
app->SubscribeToSoftButtons(function_id, softbuttons_id);
}
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SubscribeApplicationToSoftButton(
+ message_params,
+ app,
+ function_id,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
+}
+
bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
#ifdef DEBUG
Json::Value tmp;
@@ -3000,4 +3142,14 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
return true;
}
+WindowID MessageHelper::ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map) {
+ if (smart_objects::SmartType_Map == s_map.getType()) {
+ if (s_map.keyExists(strings::window_id)) {
+ return s_map[strings::window_id].asInt();
+ }
+ }
+ return mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+}
+
} // namespace application_manager
diff --git a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
index ad313c638f..2248711037 100644
--- a/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
+++ b/src/components/application_manager/src/plugin_manager/rpc_plugin_manager_impl.cc
@@ -29,10 +29,23 @@ bool IsLibraryFile(const std::string& file_path) {
return true;
}
-RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) {
+template <typename T>
+T GetFuncFromLib(void* dl_handle, const std::string& function_name) {
+ T exported_func =
+ reinterpret_cast<T>(dlsym(dl_handle, function_name.c_str()));
+ char* error_string = dlerror();
+ if (nullptr != error_string) {
+ LOG4CXX_ERROR(logger_, "Failed to export symbols : " << error_string);
+ return nullptr;
+ }
+ return exported_func;
+}
+
+RPCPluginManagerImpl::RPCPluginPtr RPCPluginManagerImpl::LoadPlugin(
+ const std::string& full_plugin_path) const {
if (!IsLibraryFile(full_plugin_path)) {
LOG4CXX_DEBUG(logger_, "Skip loading " << full_plugin_path);
- return RPCPluginPtr();
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
void* plugin_dll = dlopen(full_plugin_path.c_str(), RTLD_LAZY);
@@ -40,21 +53,33 @@ RPCPluginPtr LoadPlugin(const std::string& full_plugin_path) {
LOG4CXX_ERROR(
logger_,
"Failed to open dll " << full_plugin_path << " : " << dlerror());
- return RPCPluginPtr();
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
typedef RPCPlugin* (*Create)();
- Create create_plugin = reinterpret_cast<Create>(dlsym(plugin_dll, "Create"));
- char* error_string = dlerror();
- if (nullptr != error_string) {
- LOG4CXX_ERROR(logger_,
- "Failed to export dll's " << full_plugin_path
- << " symbols : " << error_string);
+ Create create_plugin = GetFuncFromLib<Create>(plugin_dll, "Create");
+ if (!create_plugin) {
+ LOG4CXX_ERROR(logger_, "No Create function in " << full_plugin_path);
+ dlclose(plugin_dll);
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
+ }
+
+ typedef void (*Delete)(RPCPlugin*);
+ Delete delete_plugin = GetFuncFromLib<Delete>(plugin_dll, "Delete");
+ if (!delete_plugin) {
+ LOG4CXX_ERROR(logger_, "No Delete function in " << full_plugin_path);
dlclose(plugin_dll);
- return RPCPluginPtr();
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
}
+
+ auto plugin_destroyer = [delete_plugin, plugin_dll](RPCPlugin* plugin) {
+ LOG4CXX_DEBUG(logger_, "Delete plugin " << plugin->PluginName());
+ delete_plugin(plugin);
+ dlclose(plugin_dll);
+ return RPCPluginPtr(nullptr, [](RPCPlugin*) {});
+ };
RPCPlugin* plugin = create_plugin();
- return RPCPluginPtr(plugin);
+ return RPCPluginPtr(plugin, plugin_destroyer);
}
uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
@@ -82,7 +107,8 @@ uint32_t RPCPluginManagerImpl::LoadPlugins(const std::string& plugins_path) {
return loaded_plugins_.size();
}
-std::vector<RPCPluginPtr>& RPCPluginManagerImpl::GetPlugins() {
+std::vector<RPCPluginManagerImpl::RPCPluginPtr>&
+RPCPluginManagerImpl::GetPlugins() {
return loaded_plugins_;
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index d94a364c8c..ab07151b69 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -126,7 +126,10 @@ struct HMILevelPredicate
: level_(level) {}
bool operator()(const ApplicationSharedPtr app) const {
- return level_ == app->hmi_level() ? true : false;
+ return level_ == app->hmi_level(
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW)
+ ? true
+ : false;
}
private:
@@ -165,6 +168,7 @@ struct DeactivateApplication {
if (device_id_ == app->device()) {
state_ctrl_.SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -177,41 +181,6 @@ struct DeactivateApplication {
StateController& state_ctrl_;
};
-struct SDLAllowedNotification {
- SDLAllowedNotification(const connection_handler::DeviceHandle& device_id,
- PolicyManager* policy_manager,
- StateController& state_controller)
- : device_id_(device_id)
- , policy_manager_(policy_manager)
- , state_controller_(state_controller) {}
-
- void operator()(const ApplicationSharedPtr& app) {
- DCHECK_OR_RETURN_VOID(policy_manager_);
- if (device_id_ == app->device()) {
- std::string hmi_level = "NONE";
- mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level);
- if ("BACKGROUND" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else if ("FULL" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL;
- } else if ("LIMITED" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED;
- } else if ("NONE" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE;
- } else {
- return;
- }
- state_controller_.SetRegularState(app, default_mobile_hmi, true);
- }
- }
-
- private:
- connection_handler::DeviceHandle device_id_;
- PolicyManager* policy_manager_;
- StateController& state_controller_;
-};
-
/**
* @brief Gets from system list of currently registered applications and
* create collection of links device-to-application
@@ -505,21 +474,25 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
continue;
}
- policy_manager_->ReactOnUserDevConsentForApp(policy_app_id, is_allowed);
+ policy_manager_->ReactOnUserDevConsentForApp(
+ device_handle, policy_app_id, is_allowed);
- policy_manager_->SendNotificationOnPermissionsUpdated(policy_app_id);
+ policy_manager_->SendNotificationOnPermissionsUpdated(device_id,
+ policy_app_id);
}
}
}
void PolicyHandler::SendOnAppPermissionsChanged(
- const AppPermissions& permissions, const std::string& policy_app_id) const {
+ const AppPermissions& permissions,
+ const std::string& device_id,
+ const std::string& policy_app_id) const {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(
logger_,
"PolicyHandler::SendOnAppPermissionsChanged for " << policy_app_id);
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
+ application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
LOG4CXX_WARN(logger_, "No app found for policy app id = " << policy_app_id);
return;
@@ -553,10 +526,11 @@ struct SmartObjectToInt {
};
StatusNotifier PolicyHandler::AddApplication(
+ const std::string& device_id,
const std::string& application_id,
const rpc::policy_table_interface_base::AppHmiTypes& hmi_types) {
POLICY_LIB_CHECK(std::make_shared<utils::CallNothing>());
- return policy_manager_->AddApplication(application_id, hmi_types);
+ return policy_manager_->AddApplication(device_id, application_id, hmi_types);
}
void PolicyHandler::AddDevice(const std::string& device_id,
@@ -608,13 +582,9 @@ void PolicyHandler::OnAppPermissionConsentInternal(
#endif
}
} else if (!app_to_device_link_.empty()) {
- sync_primitives::AutoLock lock(app_to_device_link_lock_);
- std::map<std::string, std::string>::const_iterator it =
- app_to_device_link_.begin();
- for (; app_to_device_link_.end() != it; ++it) {
- ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(it->second);
-
+ const ApplicationSet& accessor =
+ application_manager_.applications().GetData();
+ for (const auto& app : accessor) {
// If list of apps sent to HMI for user consents is not the same as
// current,
// permissions should be set only for coincident to registered apps
@@ -625,19 +595,26 @@ void PolicyHandler::OnAppPermissionConsentInternal(
continue;
}
+ if (!app->IsRegistered()) {
+ LOG4CXX_DEBUG(logger_,
+ "Application " << app->policy_app_id()
+ << " is not marked as registered.");
+ continue;
+ }
+
DeviceParams device_params = GetDeviceParams(
app->device(),
application_manager_.connection_handler().get_session_observer());
- if (device_params.device_mac_address != it->first) {
+ if (device_params.device_mac_address != app->mac_address()) {
LOG4CXX_WARN(logger_,
"Device_id of application is changed."
"Permissions setting skipped.");
continue;
}
- out_permissions.policy_app_id = it->second;
- out_permissions.device_id = it->first;
+ out_permissions.policy_app_id = app->policy_app_id();
+ out_permissions.device_id = app->mac_address();
#ifdef EXTERNAL_PROPRIETARY_MODE
policy_manager_->SetUserConsentForApp(out_permissions, mode);
#else
@@ -861,6 +838,15 @@ void PolicyHandler::OnDeviceSwitching(const std::string& device_id_from,
policy_manager_->OnDeviceSwitching(device_id_from, device_id_to);
}
+void PolicyHandler::OnLockScreenDismissalStateChanged() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto accessor = application_manager_.applications();
+ const auto apps = accessor.GetData();
+ for (auto& app : apps) {
+ application_manager_.SendDriverDistractionState(app);
+ }
+}
+
void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
@@ -878,10 +864,15 @@ void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
}
std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
+ DeviceParams device_params = GetDeviceParams(
+ device_handle,
+ application_manager_.connection_handler().get_session_observer());
+
+ ApplicationSharedPtr app = application_manager_.application(
+ device_params.device_mac_address, policy_app_id);
if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
@@ -889,11 +880,8 @@ std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
<< policy_app_id
<< "' "
"not found within registered applications.");
- return "";
+ return std::string();
}
- DeviceParams device_params = GetDeviceParams(
- app->device(),
- application_manager_.connection_handler().get_session_observer());
return device_params.device_mac_address;
}
@@ -951,14 +939,14 @@ void PolicyHandler::OnVehicleDataUpdated(
}
void PolicyHandler::OnPendingPermissionChange(
- const std::string& policy_app_id) {
+ const std::string& device_id, const std::string& policy_app_id) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(
logger_,
"PolicyHandler::OnPendingPermissionChange for " << policy_app_id);
POLICY_LIB_CHECK_VOID();
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
+ application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
LOG4CXX_WARN(logger_,
"No app found for " << policy_app_id << " policy app id.");
@@ -966,7 +954,7 @@ void PolicyHandler::OnPendingPermissionChange(
}
AppPermissions permissions =
- policy_manager_->GetAppPermissionsChanges(policy_app_id);
+ policy_manager_->GetAppPermissionsChanges(device_id, policy_app_id);
const uint32_t app_id = app->app_id();
@@ -975,6 +963,7 @@ void PolicyHandler::OnPendingPermissionChange(
app_id, permissions, application_manager_);
application_manager_.state_controller().SetRegularState(
app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
@@ -983,7 +972,8 @@ void PolicyHandler::OnPendingPermissionChange(
return;
}
- mobile_apis::HMILevel::eType app_hmi_level = app->hmi_level();
+ mobile_apis::HMILevel::eType app_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
switch (app_hmi_level) {
case mobile_apis::HMILevel::eType::HMI_FULL:
@@ -1125,7 +1115,8 @@ struct SDLAlowedNotification {
if (app->device() == device_id_) {
std::string hmi_level;
mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->policy_app_id(), &hmi_level);
+ policy_manager_->GetDefaultHmi(
+ app->mac_address(), app->policy_app_id(), &hmi_level);
if ("BACKGROUND" == hmi_level) {
default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
} else if ("FULL" == hmi_level) {
@@ -1137,7 +1128,11 @@ struct SDLAlowedNotification {
} else {
return;
}
- state_controller_.SetRegularState(app, default_mobile_hmi, true);
+ state_controller_.SetRegularState(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ default_mobile_hmi,
+ true);
}
}
@@ -1246,7 +1241,12 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(
: VideoStreamingState::NOT_STREAMABLE;
application_manager_.state_controller().SetRegularState(
- app, mobile_apis::HMILevel::HMI_FULL, audio_state, video_state, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::HMILevel::HMI_FULL,
+ audio_state,
+ video_state,
+ true);
last_activated_app_id_ = 0;
} else {
DeactivateApplication deactivate_notification(
@@ -1282,7 +1282,8 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
permissions.isSDLAllowed = true;
}
} else {
- permissions = policy_manager_->GetAppPermissionsChanges(policy_app_id);
+ permissions = policy_manager_->GetAppPermissionsChanges(app->mac_address(),
+ policy_app_id);
#ifdef EXTERNAL_PROPRIETARY_MODE
UsageStatistics& usage = app->usage_report();
@@ -1353,24 +1354,26 @@ void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) {
update_status, correlation_id, application_manager_);
}
-void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
+void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions,
const HMILevel& default_hmi) {
LOG4CXX_AUTO_TRACE(logger_);
- OnPermissionsUpdated(policy_app_id, permissions);
+ OnPermissionsUpdated(device_id, policy_app_id, permissions);
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
+ application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
LOG4CXX_WARN(
logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ "Connection_key not found for application_id: " << policy_app_id);
return;
}
// The application currently not running (i.e. in NONE) should change HMI
// level to default
- mobile_apis::HMILevel::eType current_hmi_level = app->hmi_level();
+ mobile_apis::HMILevel::eType current_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
mobile_apis::HMILevel::eType hmi_level =
MessageHelper::StringToHMILevel(default_hmi);
@@ -1393,10 +1396,16 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
if (hmi_level == mobile_apis::HMILevel::HMI_FULL) {
application_manager_.state_controller().SetRegularState(
- app, hmi_level, true);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ hmi_level,
+ true);
} else {
application_manager_.state_controller().SetRegularState(
- app, hmi_level, false);
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ hmi_level,
+ false);
}
break;
}
@@ -1409,15 +1418,16 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
}
}
-void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
+void PolicyHandler::OnPermissionsUpdated(const std::string& device_id,
+ const std::string& policy_app_id,
const Permissions& permissions) {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
- application_manager_.application_by_policy_id(policy_app_id);
+ application_manager_.application(device_id, policy_app_id);
if (app.use_count() == 0) {
LOG4CXX_WARN(
logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ "Connection_key not found for application_id: " << policy_app_id);
return;
}
@@ -1425,7 +1435,7 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
app->app_id(), permissions, application_manager_);
LOG4CXX_DEBUG(logger_,
- "Notification sent for application_id:"
+ "Notification sent for application_id: "
<< policy_app_id << " and connection_key "
<< app->app_id());
}
@@ -1508,12 +1518,13 @@ bool PolicyHandler::GetPriority(const std::string& policy_app_id,
void PolicyHandler::CheckPermissions(
const application_manager::ApplicationSharedPtr app,
+ const application_manager::WindowID window_id,
const PTString& rpc,
const RPCParams& rpc_params,
CheckPermissionResult& result) {
POLICY_LIB_CHECK_VOID();
const std::string hmi_level =
- MessageHelper::StringifiedHMILevel(app->hmi_level());
+ MessageHelper::StringifiedHMILevel(app->hmi_level(window_id));
if (hmi_level.empty()) {
LOG4CXX_WARN(logger_,
"HMI level for " << app->policy_app_id() << " is invalid, rpc "
@@ -1527,13 +1538,8 @@ void PolicyHandler::CheckPermissions(
"Checking permissions for " << app->policy_app_id() << " in "
<< hmi_level << " on device "
<< device_id << " rpc " << rpc);
-#ifdef EXTERNAL_PROPRIETARY_MODE
- policy_manager_->CheckPermissions(
- app->policy_app_id(), hmi_level, rpc, rpc_params, result);
-#else // EXTERNAL_PROPRIETARY_MODE
policy_manager_->CheckPermissions(
device_id, app->policy_app_id(), hmi_level, rpc, rpc_params, result);
-#endif // EXTERNAL_PROPRIETARY_MODE
}
uint32_t PolicyHandler::GetNotificationsNumber(
@@ -1548,10 +1554,11 @@ DeviceConsent PolicyHandler::GetUserConsentForDevice(
return policy_manager_->GetUserConsentForDevice(device_id);
}
-bool PolicyHandler::GetDefaultHmi(const std::string& policy_app_id,
+bool PolicyHandler::GetDefaultHmi(const std::string& device_id,
+ const std::string& policy_app_id,
std::string* default_hmi) const {
POLICY_LIB_CHECK(false);
- return policy_manager_->GetDefaultHmi(policy_app_id, default_hmi);
+ return policy_manager_->GetDefaultHmi(device_id, policy_app_id, default_hmi);
}
bool PolicyHandler::GetInitialAppData(const std::string& application_id,
@@ -1609,6 +1616,19 @@ void PolicyHandler::OnSystemReady() {
policy_manager_->OnSystemReady();
}
+const boost::optional<bool> PolicyHandler::LockScreenDismissalEnabledState()
+ const {
+ POLICY_LIB_CHECK(boost::optional<bool>());
+ return policy_manager_->LockScreenDismissalEnabledState();
+}
+
+const boost::optional<std::string>
+PolicyHandler::LockScreenDismissalWarningMessage(
+ const std::string& language) const {
+ POLICY_LIB_CHECK(boost::optional<std::string>());
+ return policy_manager_->LockScreenDismissalWarningMessage(language);
+}
+
void PolicyHandler::PTUpdatedAt(Counters counter, int value) {
POLICY_LIB_CHECK_VOID();
policy_manager_->PTUpdatedAt(counter, value);
@@ -1675,7 +1695,7 @@ custom_str::CustomString PolicyHandler::GetAppName(
if (app.use_count() == 0) {
LOG4CXX_WARN(
logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ "Connection_key not found for application_id: " << policy_app_id);
return custom_str::CustomString("");
}
return app->name();
@@ -2091,9 +2111,10 @@ void PolicyHandler::OnAppsSearchCompleted(const bool trigger_ptu) {
policy_manager_->OnAppsSearchCompleted(trigger_ptu);
}
-void PolicyHandler::OnAppRegisteredOnMobile(const std::string& application_id) {
+void PolicyHandler::OnAppRegisteredOnMobile(const std::string& device_id,
+ const std::string& application_id) {
POLICY_LIB_CHECK_VOID();
- policy_manager_->OnAppRegisteredOnMobile(application_id);
+ policy_manager_->OnAppRegisteredOnMobile(device_id, application_id);
}
RequestType::State PolicyHandler::GetAppRequestTypeState(
@@ -2109,12 +2130,13 @@ RequestSubType::State PolicyHandler::GetAppRequestSubTypeState(
}
bool PolicyHandler::IsRequestTypeAllowed(
+ const transport_manager::DeviceHandle& device_id,
const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const {
POLICY_LIB_CHECK(false);
using namespace mobile_apis;
- std::string stringified_type = RequestTypeToString(type);
+ const std::string stringified_type = RequestTypeToString(type);
if (stringified_type.empty()) {
LOG4CXX_ERROR(logger_, "Unknown request type.");
return false;
@@ -2137,7 +2159,11 @@ bool PolicyHandler::IsRequestTypeAllowed(
case RequestType::State::AVAILABLE: {
// If any of request types is available for current application - get them
const auto request_types =
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ policy_manager_->GetAppRequestTypes(device_id, policy_app_id);
+#else
policy_manager_->GetAppRequestTypes(policy_app_id);
+#endif
return helpers::in_range(request_types, stringified_type);
}
default:
@@ -2183,9 +2209,14 @@ bool PolicyHandler::IsRequestSubTypeAllowed(
}
const std::vector<std::string> PolicyHandler::GetAppRequestTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& policy_app_id) const {
POLICY_LIB_CHECK(std::vector<std::string>());
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ return policy_manager_->GetAppRequestTypes(device_handle, policy_app_id);
+#else
return policy_manager_->GetAppRequestTypes(policy_app_id);
+#endif
}
const std::vector<std::string> PolicyHandler::GetAppRequestSubTypes(
@@ -2238,15 +2269,31 @@ bool PolicyHandler::IsUrlAppIdValid(const uint32_t app_idx,
const ApplicationSharedPtr app =
application_manager_.application_by_policy_id(app_data.app_id);
- const bool is_registered = (app && (app->IsRegistered()));
- const bool is_default = (app_data.app_id == policy::kDefaultId);
- const bool is_empty_urls = app_urls.empty();
+ if (policy::kDefaultId == app_data.app_id) {
+ return true;
+ }
+
+ if (app_urls.empty()) {
+ return false;
+ }
+
+ const auto devices_ids = GetDevicesIds(app_data.app_id);
+ LOG4CXX_TRACE(logger_,
+ "Count devices: " << devices_ids.size()
+ << " for app_id: " << app_data.app_id);
+ for (const auto& device_id : devices_ids) {
+ ApplicationSharedPtr app =
+ application_manager_.application(device_id, app_data.app_id);
+ if (app && (app->IsRegistered())) {
+ return true;
+ }
+ }
- return ((is_registered && !is_empty_urls) || is_default);
+ return false;
}
std::vector<std::string> PolicyHandler::GetDevicesIds(
- const std::string& policy_app_id) {
+ const std::string& policy_app_id) const {
return application_manager_.devices(policy_app_id);
}
@@ -2254,7 +2301,8 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
mobile_apis::HMILevel::eType level) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- if (app->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ if (app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW) ==
+ mobile_apis::HMILevel::HMI_NONE) {
// If default is FULL, send request to HMI. Notification to mobile will be
// sent on response receiving.
if (mobile_apis::HMILevel::HMI_FULL == level) {
@@ -2266,7 +2314,10 @@ void PolicyHandler::UpdateHMILevel(ApplicationSharedPtr app,
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
// If hmi Level is full, it will be seted after ActivateApp response
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
}
}
@@ -2309,7 +2360,10 @@ void PolicyHandler::OnUpdateHMIStatus(const std::string& device_id,
<< app->app_id() << " to default hmi level " << level);
// Set application hmi level
application_manager_.ChangeAppsHMILevel(app->app_id(), level);
- MessageHelper::SendHMIStatusNotification(*app, application_manager_);
+ MessageHelper::SendHMIStatusNotification(
+ app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ application_manager_);
}
bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id,
@@ -2320,6 +2374,7 @@ bool PolicyHandler::GetModuleTypes(const std::string& policy_app_id,
}
void PolicyHandler::SetDefaultHmiTypes(
+ const transport_manager::DeviceHandle& device_handle,
const std::string& application_id,
const smart_objects::SmartObject* app_types) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -2332,7 +2387,7 @@ void PolicyHandler::SetDefaultHmiTypes(
std::back_inserter(hmi_types),
SmartObjectToInt());
}
- policy_manager_->SetDefaultHmiTypes(application_id, hmi_types);
+ policy_manager_->SetDefaultHmiTypes(device_handle, application_id, hmi_types);
}
bool PolicyHandler::CheckHMIType(const std::string& application_id,
diff --git a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
index fff1aefed3..957075150f 100644
--- a/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
+++ b/src/components/application_manager/src/resumption/resume_ctrl_impl.cc
@@ -30,6 +30,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
#include "application_manager/resumption/resume_ctrl_impl.h"
+#include "application_manager/display_capabilities_builder.h"
#include <algorithm>
#include <fstream>
@@ -159,7 +160,13 @@ void ResumeCtrlImpl::SaveApplication(ApplicationSharedPtr application) {
}
void ResumeCtrlImpl::on_event(const event_engine::Event& event) {
- LOG4CXX_DEBUG(logger_, "Event received" << event.id());
+ LOG4CXX_DEBUG(logger_, "Event received: " << event.id());
+
+ if (hmi_apis::FunctionID::UI_CreateWindow == event.id()) {
+ LOG4CXX_INFO(logger_, "Received UI_CreateWindow event");
+ const auto& response_message = event.smart_object();
+ RestoreWidgetsHMIState(response_message);
+ }
}
bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
@@ -208,7 +215,12 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
<< saved_hmi_level);
}
- return SetAppHMIState(application, saved_hmi_level, true);
+ const bool app_hmi_state_is_set =
+ SetAppHMIState(application, saved_hmi_level, true);
+ if (app_hmi_state_is_set &&
+ application->is_app_data_resumption_allowed()) {
+ RestoreAppWidgets(application, saved_app);
+ }
} else {
result = false;
LOG4CXX_ERROR(logger_, "saved app data corrupted");
@@ -219,6 +231,89 @@ bool ResumeCtrlImpl::RestoreAppHMIState(ApplicationSharedPtr application) {
return result;
}
+void ResumeCtrlImpl::RestoreWidgetsHMIState(
+ const smart_objects::SmartObject& response_message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto correlation_id =
+ response_message[strings::params][strings::correlation_id].asInt();
+ const auto& request = requests_msg_.find(correlation_id);
+ if (requests_msg_.end() == request) {
+ LOG4CXX_ERROR(logger_,
+ "Request UI_CreateWindow for correlation id: "
+ << correlation_id << " not found");
+ return;
+ }
+
+ const auto& msg_params = (*request->second)[strings::msg_params];
+ const auto hmi_app_id = msg_params[strings::app_id].asInt();
+ auto application = application_manager_.application_by_hmi_app(hmi_app_id);
+ if (!application) {
+ LOG4CXX_ERROR(logger_,
+ "Application is not registered by hmi id: " << hmi_app_id);
+ requests_msg_.erase(request);
+ return;
+ }
+ const WindowID window_id = msg_params[strings::window_id].asInt();
+
+ const auto result_code = static_cast<hmi_apis::Common_Result::eType>(
+ response_message[strings::params][hmi_response::code].asInt());
+ if (hmi_apis::Common_Result::SUCCESS != result_code) {
+ LOG4CXX_ERROR(logger_,
+ "UI_CreateWindow for correlation id: "
+ << correlation_id
+ << " failed with code: " << result_code);
+ requests_msg_.erase(request);
+ auto& builder = application->display_capabilities_builder();
+ builder.StopWaitingForWindow(window_id);
+ return;
+ }
+
+ smart_objects::SmartObject window_info(smart_objects::SmartType_Map);
+ auto fill_optional_param = [&window_info,
+ &msg_params](const std::string& key) {
+ if (msg_params.keyExists(key)) {
+ window_info[key] = msg_params[key].asString();
+ }
+ };
+ fill_optional_param(strings::associated_service_type);
+ fill_optional_param(strings::duplicate_updates_from_window_id);
+
+ const auto window_name = msg_params[strings::window_name].asString();
+ window_info[strings::window_name] = window_name;
+ application->SetWindowInfo(window_id, window_info);
+
+ const auto window_type = static_cast<mobile_apis::WindowType::eType>(
+ msg_params[strings::window_type].asInt());
+ // State should be initialized with INVALID_ENUM value to let state controller
+ // trigger OnHmiStatus notifiation sending
+ auto initial_state = application_manager_.CreateRegularState(
+ application,
+ window_type,
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_api::SystemContext::INVALID_ENUM);
+ application->SetInitialState(window_id, window_name, initial_state);
+
+ // Default HMI level for all windows except the main one is always NONE
+ application_manager_.state_controller().OnAppWindowAdded(
+ application, window_id, window_type, mobile_apis::HMILevel::HMI_NONE);
+
+ requests_msg_.erase(request);
+}
+
+void ResumeCtrlImpl::ProcessSystemCapabilityUpdated(
+ Application& app, const smart_objects::SmartObject& display_capabilities) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ auto notification = MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ display_capabilities, app);
+
+ application_manager_.GetRPCService().ManageMobileCommand(
+ notification, commands::Command::SOURCE_SDL);
+ app.set_is_resuming(false);
+}
+
bool ResumeCtrlImpl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN(application, false);
@@ -252,7 +347,9 @@ void ResumeCtrlImpl::ApplicationResumptiOnTimer() {
LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it);
continue;
}
- StartAppHmiStateResumption(app);
+ if (!StartAppHmiStateResumption(app)) {
+ app->set_is_resuming(false);
+ }
}
is_resumption_active_ = false;
waiting_for_timer_.clear();
@@ -292,14 +389,36 @@ bool ResumeCtrlImpl::SetAppHMIState(
return false;
}
application->set_is_resuming(true);
- application_manager_.state_controller().SetRegularState(application,
- hmi_level);
+ application_manager_.state_controller().SetRegularState(
+ application, mobile_apis::PredefinedWindows::DEFAULT_WINDOW, hmi_level);
LOG4CXX_INFO(logger_,
"Application with policy id " << application->policy_app_id()
<< " got HMI level " << hmi_level);
return true;
}
+void ResumeCtrlImpl::RestoreAppWidgets(
+ application_manager::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(application);
+ if (!saved_app.keyExists(strings::windows_info)) {
+ LOG4CXX_ERROR(logger_, "windows_info section does not exist");
+ return;
+ }
+ const auto& windows_info = saved_app[strings::windows_info];
+ auto request_list = MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application, application_manager_, windows_info);
+
+ requests_msg_.clear();
+ for (auto& request : request_list) {
+ requests_msg_.insert(std::make_pair(
+ (*request)[strings::params][strings::correlation_id].asInt(), request));
+ }
+ ProcessHMIRequests(request_list);
+}
+
bool ResumeCtrlImpl::IsHMIApplicationIdExist(uint32_t hmi_app_id) {
LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id);
@@ -473,18 +592,18 @@ void ResumeCtrlImpl::RetryResumption(const uint32_t app_id) {
AddToResumptionTimerQueue(app_id);
}
-void ResumeCtrlImpl::StartAppHmiStateResumption(
+bool ResumeCtrlImpl::StartAppHmiStateResumption(
ApplicationSharedPtr application) {
using namespace date_time;
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN_VOID(application);
+ DCHECK_OR_RETURN(application, false);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
const bool result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
if (!result) {
LOG4CXX_ERROR(logger_, "Application was not saved");
- return;
+ return false;
}
const bool is_hmi_level_applicable_to_resume =
@@ -492,7 +611,7 @@ void ResumeCtrlImpl::StartAppHmiStateResumption(
if (!is_hmi_level_applicable_to_resume) {
LOG4CXX_DEBUG(logger_, "No applicable HMI level found for resuming");
- return;
+ return false;
}
const bool is_resume_allowed_by_low_voltage =
@@ -507,18 +626,20 @@ void ResumeCtrlImpl::StartAppHmiStateResumption(
if (restore_hmi_level_allowed) {
LOG4CXX_INFO(logger_,
"Resume application " << application->policy_app_id());
- RestoreAppHMIState(application);
+ bool result = RestoreAppHMIState(application);
if (mobile_apis::HMILevel::eType::INVALID_ENUM !=
application->deferred_resumption_hmi_level()) {
// the application has not been fully resumed
- return;
+ return false;
}
RemoveApplicationFromSaved(application);
+ return result;
} else {
LOG4CXX_INFO(
logger_,
"Do not need to resume application " << application->policy_app_id());
}
+ return true;
}
void ResumeCtrlImpl::ResetLaunchTime() {
@@ -561,9 +682,14 @@ bool ResumeCtrlImpl::CheckApplicationHash(ApplicationSharedPtr application,
"app_id : " << application->app_id() << " hash : " << hash);
smart_objects::SmartObject saved_app;
const std::string& device_mac = application->mac_address();
- bool result = resumption_storage_->GetSavedApplication(
+ const bool get_app_result = resumption_storage_->GetSavedApplication(
application->policy_app_id(), device_mac, saved_app);
- return result ? saved_app[strings::hash_id].asString() == hash : false;
+ const bool check_result =
+ get_app_result ? saved_app[strings::hash_id].asString() == hash : false;
+ if (check_result) {
+ application->set_app_data_resumption_allowance(true);
+ }
+ return check_result;
}
void ResumeCtrlImpl::SaveDataOnTimer() {
@@ -628,6 +754,28 @@ bool ResumeCtrlImpl::RestoreApplicationData(ApplicationSharedPtr application) {
return result;
}
+void ResumeCtrlImpl::StartWaitingForDisplayCapabilitiesUpdate(
+ app_mngr::ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
+ resumption_storage_->GetSavedApplication(
+ application->policy_app_id(), application->mac_address(), saved_app);
+ auto resume_callback =
+ [this](Application& app,
+ const smart_objects::SmartObject& display_capabilities) -> void {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ProcessSystemCapabilityUpdated(app, display_capabilities);
+ };
+ auto& builder = application->display_capabilities_builder();
+
+ smart_objects::SmartObject windows_info(smart_objects::SmartType_Null);
+ if (saved_app.keyExists(strings::windows_info)) {
+ windows_info = saved_app[strings::windows_info];
+ }
+ builder.InitBuilder(resume_callback, windows_info);
+ application->set_is_resuming(true);
+}
+
void ResumeCtrlImpl::AddFiles(ApplicationSharedPtr application,
const smart_objects::SmartObject& saved_app) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -1006,7 +1154,8 @@ bool ResumeCtrlImpl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request,
(*request)[strings::correlation_id].asInt();
subscribe_on_event(function_id, hmi_correlation_id);
}
- if (!application_manager_.GetRPCService().ManageHMICommand(request)) {
+ if (!application_manager_.GetRPCService().ManageHMICommand(
+ request, commands::Command::SOURCE_SDL_TO_HMI)) {
LOG4CXX_ERROR(logger_, "Unable to send request");
return false;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
index b4d39eccc1..9046fe35ad 100644
--- a/src/components/application_manager/src/resumption/resumption_data.cc
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -198,6 +198,52 @@ smart_objects::SmartObject ResumptionData::GetApplicationFiles(
return files;
}
+smart_objects::SmartObject ResumptionData::GetApplicationWidgetsInfo(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject windows_info =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ DCHECK_OR_RETURN(application, windows_info);
+ const auto window_ids = application->GetWindowIds();
+ const auto& window_optional_params_map =
+ application->window_optional_params_map().GetData();
+ for (const auto& window_id : window_ids) {
+ const HmiStatePtr hmi_state = application->CurrentHmiState(window_id);
+ if (mobile_apis::WindowType::WIDGET != hmi_state->window_type()) {
+ continue;
+ }
+ auto info = CreateWindowInfoSO(
+ window_id, hmi_state->window_type(), window_optional_params_map);
+
+ windows_info[windows_info.length()] = info;
+ }
+ return windows_info;
+}
+
+smart_objects::SmartObject ResumptionData::CreateWindowInfoSO(
+ const app_mngr::WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const app_mngr::WindowParamsMap& window_optional_params_map) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ auto window_info = smart_objects::SmartObject(smart_objects::SmartType_Map);
+
+ window_info[strings::window_id] = window_id;
+ window_info[strings::window_type] = window_type;
+
+ const auto& it_info = window_optional_params_map.find(window_id);
+ if (window_optional_params_map.end() != it_info) {
+ const auto keys = it_info->second->enumerate();
+
+ for (const auto& key : keys) {
+ window_info[key] = (*it_info->second)[key];
+ }
+ }
+
+ return window_info;
+}
+
smart_objects::SmartObject ResumptionData::PointerToSmartObj(
const smart_objects::SmartObject* ptr) const {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/resumption/resumption_data_db.cc b/src/components/application_manager/src/resumption/resumption_data_db.cc
index 02b7098414..9188a47bf9 100644
--- a/src/components/application_manager/src/resumption/resumption_data_db.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -2731,7 +2731,8 @@ bool ResumptionDataDB::UpdateApplicationData(
utils::dbms::SQLQuery query(db());
const int64_t time_stamp = static_cast<int64_t>(time(NULL));
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+ const mobile_apis::HMILevel::eType hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
if (!query.Prepare(kUpdateApplicationData)) {
LOG4CXX_WARN(logger_,
@@ -2843,7 +2844,8 @@ ApplicationParams::ApplicationParams(app_mngr::ApplicationSharedPtr application)
m_grammar_id = application->get_grammar_id();
m_connection_key = application->app_id();
m_hmi_app_id = application->hmi_app_id();
- m_hmi_level = application->hmi_level();
+ m_hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
m_is_media_application = application->IsAudioApplication();
app_ptr = application;
}
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
index 591166c687..5da47d31ce 100644
--- a/src/components/application_manager/src/resumption/resumption_data_json.cc
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -64,7 +64,8 @@ void ResumptionDataJson::SaveApplication(
const uint32_t grammar_id = application->get_grammar_id();
const uint32_t time_stamp = (uint32_t)time(NULL);
const std::string device_mac = application->mac_address();
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+ const mobile_apis::HMILevel::eType hmi_level =
+ application->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
const bool is_subscribed_for_way_points =
application_manager_.IsAppSubscribedForWayPoints(application);
@@ -99,6 +100,9 @@ void ResumptionDataJson::SaveApplication(
formatters::CFormatterJsonBase::objToJsonValue(
GetApplicationFiles(application), tmp);
json_app[strings::application_files] = tmp;
+ formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationWidgetsInfo(application), tmp);
+ json_app[strings::windows_info] = tmp;
json_app[strings::time_stamp] = time_stamp;
json_app[strings::subscribed_for_way_points] = is_subscribed_for_way_points;
diff --git a/src/components/application_manager/src/rpc_handler_impl.cc b/src/components/application_manager/src/rpc_handler_impl.cc
index 3fceaf573c..49877ce3ef 100644
--- a/src/components/application_manager/src/rpc_handler_impl.cc
+++ b/src/components/application_manager/src/rpc_handler_impl.cc
@@ -159,10 +159,6 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
smart_objects::SmartObjectSPtr smart_object =
std::make_shared<smart_objects::SmartObject>();
bool allow_unknown_parameters = false;
- if (!smart_object) {
- LOG4CXX_ERROR(logger_, "Null pointer");
- return;
- }
smart_objects::SmartObject converted_result;
formatters::FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
@@ -198,6 +194,7 @@ void RPCHandlerImpl::ProcessMessageFromHMI(
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
}
+
void RPCHandlerImpl::Handle(const impl::MessageFromMobile message) {
LOG4CXX_AUTO_TRACE(logger_);
diff --git a/src/components/application_manager/src/rpc_passing_handler.cc b/src/components/application_manager/src/rpc_passing_handler.cc
index feb3bccc1f..8d63e9489f 100644
--- a/src/components/application_manager/src/rpc_passing_handler.cc
+++ b/src/components/application_manager/src/rpc_passing_handler.cc
@@ -108,9 +108,11 @@ bool RPCPassingHandler::ExtractRPCParams(
}
CommandParametersPermissions parameters_permissions;
+ const WindowID window_id =
+ MessageHelper::ExtractWindowIdFromSmartObject(s_map);
mobile_apis::Result::eType check_result = app_manager_.CheckPolicyPermissions(
- app, function_id_str, params, &parameters_permissions);
+ app, window_id, function_id_str, params, &parameters_permissions);
// Check if RPC is allowed by policy (since we are allowing unknown params,
// check should pass if only undefined parameters exist)
diff --git a/src/components/application_manager/src/rpc_service_impl.cc b/src/components/application_manager/src/rpc_service_impl.cc
index b5cae1c126..c7d1bde288 100644
--- a/src/components/application_manager/src/rpc_service_impl.cc
+++ b/src/components/application_manager/src/rpc_service_impl.cc
@@ -82,7 +82,8 @@ bool RPCServiceImpl::ManageMobileCommand(
(*message)[strings::params][strings::connection_key].asUInt());
auto app_ptr = app_manager_.application(connection_key);
- if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->policy_app_id())) {
+ if (app_ptr && app_manager_.IsAppInReconnectMode(app_ptr->device(),
+ app_ptr->policy_app_id())) {
commands_holder_.Suspend(
app_ptr, CommandHolder::CommandType::kMobileCommand, message);
return true;
@@ -176,7 +177,8 @@ bool RPCServiceImpl::ManageMobileCommand(
mobile_apis::HMILevel::eType app_hmi_level =
mobile_apis::HMILevel::INVALID_ENUM;
if (app) {
- app_hmi_level = app->hmi_level();
+ app_hmi_level =
+ app->hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW);
}
// commands will be launched from request_ctrl
@@ -296,7 +298,8 @@ bool RPCServiceImpl::ManageHMICommand(const commands::MessageSharedPtr message,
(*message)[strings::msg_params][strings::app_id].asUInt();
auto app = app_manager_.application(static_cast<uint32_t>(connection_key));
- if (app && app_manager_.IsAppInReconnectMode(app->policy_app_id())) {
+ if (app && app_manager_.IsAppInReconnectMode(app->device(),
+ app->policy_app_id())) {
commands_holder_.Suspend(
app, CommandHolder::CommandType::kHmiCommand, message);
return true;
@@ -464,9 +467,12 @@ void RPCServiceImpl::SendMessageToMobile(
mobile_apis::FunctionID::eType function_id =
static_cast<mobile_apis::FunctionID::eType>(
(*message)[strings::params][strings::function_id].asUInt());
+
RPCParams params;
const smart_objects::SmartObject& s_map = (*message)[strings::msg_params];
+ const WindowID window_id =
+ MessageHelper::ExtractWindowIdFromSmartObject(s_map);
if (smart_objects::SmartType_Map == s_map.getType()) {
smart_objects::SmartMap::iterator iter = s_map.map_begin();
smart_objects::SmartMap::iterator iter_end = s_map.map_end();
@@ -481,7 +487,8 @@ void RPCServiceImpl::SendMessageToMobile(
const std::string string_functionID =
MessageHelper::StringifiedFunctionID(function_id);
const mobile_apis::Result::eType check_result =
- app_manager_.CheckPolicyPermissions(app, string_functionID, params);
+ app_manager_.CheckPolicyPermissions(
+ app, window_id, string_functionID, params);
if (mobile_apis::Result::SUCCESS != check_result) {
LOG4CXX_WARN(logger_,
"Function \"" << string_functionID << "\" (#" << function_id
diff --git a/src/components/application_manager/src/smart_object_keys.cc b/src/components/application_manager/src/smart_object_keys.cc
index 872103929f..e9adf796af 100644
--- a/src/components/application_manager/src/smart_object_keys.cc
+++ b/src/components/application_manager/src/smart_object_keys.cc
@@ -20,6 +20,7 @@ const char* info = "info";
const char* app_id = "appID";
const char* full_app_id = "fullAppID";
const char* bundle_id = "appBundleID";
+const char* window_id = "windowID";
const char* app_info = "appInfo";
const char* app_launch = "app_launch";
const char* app_launch_list = "app_launch_list";
@@ -59,6 +60,7 @@ const char* main_field_1 = "mainField1";
const char* main_field_2 = "mainField2";
const char* main_field_3 = "mainField3";
const char* main_field_4 = "mainField4";
+const char* template_title = "templateTitle";
const char* metadata_tags = "metadataTags";
const char* eta = "eta";
const char* time_to_destination = "timeToDestination";
@@ -81,6 +83,8 @@ const char* num_ticks = "numTicks";
const char* slider_footer = "sliderFooter";
const char* menu_id = "menuID";
const char* menu_name = "menuName";
+const char* menu_layout = "menuLayout";
+const char* menu_layouts_available = "menuLayoutsAvailable";
const char* interaction_choice_set_id = "interactionChoiceSetID";
const char* interaction_choice_set_id_list = "interactionChoiceSetIDList";
const char* choice_set = "choiceSet";
@@ -96,7 +100,10 @@ const char* initial_prompt = "initialPrompt";
const char* initial_text = "initialText";
const char* duration = "duration";
const char* progress_indicator = "progressIndicator";
+const char* func_id = "functionID";
+const char* cancel_id = "cancelID";
const char* alert_type = "alertType";
+const char* alert_icon = "alertIcon";
const char* play_tone = "playTone";
const char* soft_buttons = "softButtons";
const char* soft_button_id = "softButtonID";
@@ -133,9 +140,17 @@ const char* activate_app_hmi_level = "level";
const char* audio_streaming_state = "audioStreamingState";
const char* video_streaming_state = "videoStreamingState";
const char* system_context = "systemContext";
+const char* window_name = "windowName";
+const char* window_type = "type";
+const char* window_type_supported = "windowTypeSupported";
+const char* maximum_number_of_windows = "maximumNumberOfWindows";
+const char* window_capabilities = "windowCapabilities";
+const char* associated_service_type = "associatedServiceType";
+const char* duplicate_updates_from_window_id = "duplicateUpdatesFromWindowID";
const char* speech_capabilities = "speechCapabilities";
const char* vr_capabilities = "vrCapabilities";
const char* audio_pass_thru_capabilities = "audioPassThruCapabilities";
+const char* audio_pass_thru_capabilities_list = "audioPassThruCapabilitiesList";
const char* pcm_stream_capabilities = "pcmStreamCapabilities";
const char* audio_pass_thru_icon = "audioPassThruIcon";
const char* way_points = "wayPoints";
@@ -156,6 +171,8 @@ const char* red = "red";
const char* green = "green";
const char* blue = "blue";
const char* display_layout = "displayLayout";
+const char* template_configuration = "templateConfiguration";
+const char* template_layout = "template";
const char* icon_resumed = "iconResumed";
const char* nicknames = "nicknames";
const char* enabled = "enabled";
@@ -165,6 +182,7 @@ const char* hybrid_app_preference = "hybridAppPreference";
const char* is_cloud_application = "isCloudApplication";
const char* cloud_connection_status = "cloudConnectionStatus";
const char* endpoint = "endpoint";
+const char* display_capabilities = "displayCapabilities";
// PutFile
const char* sync_file_name = "syncFileName";
@@ -183,6 +201,7 @@ const char* is_template = "isTemplate";
const char* image = "image";
const char* type = "type";
const char* system_file = "systemFile";
+const char* is_system_file = "isSystemFile";
const char* offset = "offset";
const char* length = "length";
const char* secondary_image = "secondaryImage";
@@ -221,6 +240,7 @@ const char* key_press_mode = "keypressMode";
// duplicate names from hmi_request
const char* limited_character_list = "limitedCharacterList";
const char* auto_complete_text = "autoCompleteText";
+const char* auto_complete_list = "autoCompleteList";
const char* navigation_text = "navigationText";
// vehicle info
@@ -311,6 +331,10 @@ const char* activate = "activate";
const char* set_as_default = "setAsDefault";
const char* origin_app = "originApp";
+// sis data
+const char* station_short_name = "stationShortName";
+const char* station_location = "stationLocation";
+
// resuming
const char* application_commands = "applicationCommands";
const char* application_submenus = "applicationSubMenus";
@@ -339,8 +363,12 @@ const char* time_stamp = "timeStamp";
const char* manual_text_entry = "manualTextEntry";
const char* image_type_supported = "imageTypeSupported";
const char* unexpected_disconnect = "unexpectedDisconnect";
+
+const char* shifted = "shifted";
+const char* altitude = "altitude";
const char* longitude_degrees = "longitudeDegrees";
const char* latitude_degrees = "latitudeDegrees";
+
const char* address = "address";
const char* country_name = "countryName";
const char* country_code = "countryCode";
@@ -363,13 +391,14 @@ const char* delivery_mode = "deliveryMode";
const char* audio_streaming_indicator = "audioStreamingIndicator";
+const char* windows_info = "windowsInfo";
+
const char* const keyboard_properties_supported = "keyboardPropertiesSupported";
const char* const language_supported = "languageSupported";
const char* const keyboard_layout_supported = "keyboardLayoutSupported";
const char* const keypress_mode_supported = "keypressModeSupported";
const char* const limited_characters_list_supported =
"limitedCharactersListSupported";
-const char* const auto_complete_text_supported = "autoCompleteTextSupported";
const char* const send_location_enabled = "sendLocationEnabled";
const char* const get_way_points_enabled = "getWayPointsEnabled";
const char* const entity_type = "entityType";
@@ -390,6 +419,9 @@ const char* const resolution_height = "resolutionHeight";
const char* const max_bitrate = "maxBitrate";
const char* const supported_formats = "supportedFormats";
const char* const haptic_spatial_data_supported = "hapticSpatialDataSupported";
+const char* const diagonal_screen_size = "diagonalScreenSize";
+const char* const pixel_per_inch = "pixelPerInch";
+const char* const scale = "scale";
const char* const haptic_rect_data = "hapticRectData";
const char* const rect = "rect";
const char* const x = "x";
@@ -432,6 +464,8 @@ namespace mobile_notification {
const char* state = "state";
const char* syncp_timeout = "Timeout";
const char* syncp_url = "URL";
+const char* lock_screen_dismissal_enabled = "lockScreenDismissalEnabled";
+const char* lock_screen_dismissal_warning = "lockScreenDismissalWarning";
} // namespace mobile_notification
namespace hmi_levels {
@@ -476,7 +510,7 @@ const char* keyboard_properties = "keyboardProperties";
const char* method_name = "methodName";
const char* keyboard_layout = "keyboardLayout";
const char* limited_character_list = "limitedCharacterList";
-const char* auto_complete_text = "autoCompleteText";
+const char* auto_complete_list = "autoCompleteList";
const char* file = "file";
const char* file_name = "fileName";
const char* retry = "retry";
diff --git a/src/components/application_manager/src/state_controller_impl.cc b/src/components/application_manager/src/state_controller_impl.cc
index c791f58047..8368597370 100644
--- a/src/components/application_manager/src/state_controller_impl.cc
+++ b/src/components/application_manager/src/state_controller_impl.cc
@@ -67,14 +67,16 @@ StateControllerImpl::StateControllerImpl(ApplicationManager& app_mngr)
}
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(HmiState::STATE_ID_REGULAR == state->state_id());
- LOG4CXX_DEBUG(logger_, "Set regular state " << *state);
+ LOG4CXX_DEBUG(logger_,
+ "Set window #" << window_id << " regular state " << *state);
if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM ||
state->audio_streaming_state() ==
@@ -93,37 +95,44 @@ void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
HmiStatePtr resolved_state = ResolveHmiState(app, state);
if (!resolved_state) {
state->set_state_id(HmiState::STATE_ID_POSTPONED);
- app->SetPostponedState(state);
+ app->SetPostponedState(window_id, state);
return;
}
+
LOG4CXX_DEBUG(logger_, "Resolved state: " << *resolved_state);
const hmi_apis::Common_HMILevel::eType hmi_level =
static_cast<hmi_apis::Common_HMILevel::eType>(
resolved_state->hmi_level());
- if (send_activate_app) {
- const int64_t corr_id = SendBCActivateApp(app, hmi_level, true);
- if (-1 != corr_id) {
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- corr_id);
- waiting_for_activate_[app->app_id()] = resolved_state;
+ if (request_hmi_state_change) {
+ const int64_t result = RequestHMIStateChange(app, hmi_level, true);
+ if (-1 != result) {
+ const uint32_t corr_id = static_cast<uint32_t>(result);
+ subscribe_on_event(
+ hmi_apis::Common_HMILevel::NONE == hmi_level
+ ? hmi_apis::FunctionID::BasicCommunication_CloseApplication
+ : hmi_apis::FunctionID::BasicCommunication_ActivateApp,
+ corr_id);
+ waiting_for_response_[app->app_id()] = resolved_state;
+ app_mngr_.set_application_id(corr_id, app->hmi_app_id());
return;
}
LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
return;
}
- ApplyRegularState(app, resolved_state);
+ ApplyRegularState(app, window_id, resolved_state);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_regular = app->RegularHmiState();
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -132,16 +141,22 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_regular->system_context());
- SetRegularState(app, hmi_state, send_activate_app);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
+ DCHECK_OR_RETURN_VOID(prev_regular);
+
const HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -150,33 +165,43 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level));
hmi_state->set_video_streaming_state(CalcVideoState(app, hmi_level));
hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state, send_activate_app);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state,
const mobile_apis::SystemContext::eType system_context,
- const bool send_activate_app) {
+ const bool request_hmi_state_change) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
+ DCHECK_OR_RETURN_VOID(prev_regular);
+
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(hmi_state);
+
hmi_state->set_hmi_level(hmi_level);
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, send_activate_app);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, request_hmi_state_change);
}
void StateControllerImpl::SetRegularState(
- ApplicationSharedPtr app, const mobile_apis::HMILevel::eType hmi_level) {
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::HMILevel::eType hmi_level) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(hmi_state);
@@ -186,15 +211,16 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_system_context(prev_state
? prev_state->system_context()
: mobile_apis::SystemContext::SYSCTXT_MAIN);
- SetRegularState(app, hmi_state);
+ SetRegularState(app, window_id, hmi_state);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::SystemContext::eType system_context) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_regular = app->RegularHmiState();
+ HmiStatePtr prev_regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_regular);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -205,16 +231,18 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_video_streaming_state(
CalcVideoState(app, prev_regular->hmi_level()));
hmi_state->set_system_context(system_context);
- SetRegularState(app, hmi_state, false);
+ hmi_state->set_window_type(prev_regular->window_type());
+ SetRegularState(app, window_id, hmi_state, false);
}
void StateControllerImpl::SetRegularState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
HmiStatePtr hmi_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -223,18 +251,23 @@ void StateControllerImpl::SetRegularState(
hmi_state->set_audio_streaming_state(audio_state);
hmi_state->set_video_streaming_state(video_state);
hmi_state->set_system_context(prev_state->system_context());
- SetRegularState(app, hmi_state, false);
+ hmi_state->set_window_type(prev_state->window_type());
+ SetRegularState(app, window_id, hmi_state, false);
}
void StateControllerImpl::SetRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
- if (mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
- SetRegularState(app, state, true);
+
+ // SDL should send BC.ActivateApp for main window during resumption
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
+ SetRegularState(app, window_id, state, true);
} else {
- SetRegularState(app, state, false);
+ SetRegularState(app, window_id, state, false);
}
}
@@ -295,7 +328,8 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
return;
}
- const HmiStatePtr state_to_resolve = app_to_resolve->RegularHmiState();
+ const HmiStatePtr state_to_resolve =
+ app_to_resolve->RegularHmiState(window_id_);
DCHECK_OR_RETURN_VOID(state_to_resolve);
// If applied HMI state is FULL:
@@ -379,22 +413,23 @@ void StateControllerImpl::HmiLevelConflictResolver::operator()(
std::make_tuple(
result_hmi_level, result_audio_state, result_video_state)) {
LOG4CXX_DEBUG(logger_,
- "Application "
- << app_to_resolve->app_id() << " will change state to: "
- << "HMI level " << to_resolve_hmi_level << " --> "
- << result_hmi_level << ", audio "
- << state_to_resolve->audio_streaming_state() << " --> "
- << result_audio_state << ", video "
- << state_to_resolve->video_streaming_state() << " --> "
- << result_video_state);
+ "Application " << app_to_resolve->app_id() << " window "
+ << window_id_ << " will change state to: "
+ << "HMI level " << to_resolve_hmi_level
+ << " --> " << result_hmi_level << ", audio "
+ << state_to_resolve->audio_streaming_state()
+ << " --> " << result_audio_state << ", video "
+ << state_to_resolve->video_streaming_state()
+ << " --> " << result_video_state);
state_ctrl_->SetupRegularHmiState(app_to_resolve,
+ window_id_,
result_hmi_level,
result_audio_state,
result_video_state);
} else {
LOG4CXX_DEBUG(logger_,
- "Application " << app_to_resolve->app_id()
- << " will NOT change HMI level");
+ "Application " << app_to_resolve->app_id() << " window "
+ << window_id_ << " will NOT change HMI level");
}
}
@@ -408,6 +443,7 @@ HmiStatePtr StateControllerImpl::ResolveHmiState(ApplicationSharedPtr app,
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN(available_state, HmiStatePtr());
available_state->set_hmi_level(state->hmi_level());
+ available_state->set_window_type(state->window_type());
available_state->set_audio_streaming_state(state->audio_streaming_state());
available_state->set_video_streaming_state(state->video_streaming_state());
available_state->set_system_context(state->system_context());
@@ -565,12 +601,14 @@ bool StateControllerImpl::IsStateAvailableForResumption(
}
void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- LOG4CXX_DEBUG(logger_, "Setup regular state: " << *state);
- HmiStatePtr curr_state = app->CurrentHmiState();
+ LOG4CXX_DEBUG(logger_,
+ "Setup window #" << window_id << " regular state: " << *state);
+ HmiStatePtr curr_state = app->CurrentHmiState(window_id);
HmiStatePtr old_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(old_state);
@@ -578,28 +616,30 @@ void StateControllerImpl::SetupRegularHmiState(ApplicationSharedPtr app,
old_state->set_audio_streaming_state(curr_state->audio_streaming_state());
old_state->set_video_streaming_state(curr_state->video_streaming_state());
old_state->set_system_context(curr_state->system_context());
- app->SetRegularState(state);
+ old_state->set_window_type(curr_state->window_type());
+ app->SetRegularState(window_id, state);
- if (HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW == window_id &&
+ HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
LOG4CXX_DEBUG(logger_,
"Resuming to LIMITED level. "
<< "Send OnResumeAudioSource notification");
MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id(), app_mngr_);
}
- app->set_is_resuming(false);
- HmiStatePtr new_state = app->CurrentHmiState();
- OnStateChanged(app, old_state, new_state);
+ HmiStatePtr new_state = app->CurrentHmiState(window_id);
+ OnStateChanged(app, window_id, old_state, new_state);
}
void StateControllerImpl::SetupRegularHmiState(
ApplicationSharedPtr app,
+ const WindowID window_id,
const mobile_apis::HMILevel::eType hmi_level,
const mobile_apis::AudioStreamingState::eType audio_state,
const mobile_apis::VideoStreamingState::eType video_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr prev_state = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(prev_state);
HmiStatePtr new_state =
CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
@@ -608,22 +648,64 @@ void StateControllerImpl::SetupRegularHmiState(
new_state->set_audio_streaming_state(audio_state);
new_state->set_video_streaming_state(video_state);
new_state->set_system_context(prev_state->system_context());
- SetupRegularHmiState(app, new_state);
+ new_state->set_window_type(prev_state->window_type());
+ SetupRegularHmiState(app, window_id, new_state);
}
void StateControllerImpl::ApplyRegularState(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
LOG4CXX_DEBUG(logger_,
- "Applying to app " << app->app_id() << " state " << *state);
- SetupRegularHmiState(app, state);
+ "Applying to app " << app->app_id() << " window #" << window_id
+ << " state " << *state);
+ SetupRegularHmiState(app, window_id, state);
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_DEBUG(logger_, "No need to resolve conflicts for a widget");
+ return;
+ }
+
LOG4CXX_DEBUG(logger_,
"Resolving HMI level conflicts for app " << app->app_id());
- ForEachApplication(HmiLevelConflictResolver(app, state, this));
+ ForEachApplication(HmiLevelConflictResolver(app, window_id, state, this));
}
+
+void StateControllerImpl::UpdateAppWindowsStreamingState(
+ ApplicationSharedPtr app, HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const auto window_ids = app->GetWindowIds();
+ for (auto window_id : window_ids) {
+ HmiStatePtr window_hmi_state = app->RegularHmiState(window_id);
+ LOG4CXX_DEBUG(
+ logger_, "State: " << *state << " window state: " << *window_hmi_state);
+ if (window_hmi_state->audio_streaming_state() !=
+ state->audio_streaming_state() ||
+ window_hmi_state->video_streaming_state() !=
+ state->video_streaming_state()) {
+ LOG4CXX_DEBUG(logger_,
+ "Updating streaming state for window #" << window_id);
+
+ HmiStatePtr new_window_state =
+ CreateHmiState(app, HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(new_window_state);
+ new_window_state->set_hmi_level(window_hmi_state->hmi_level());
+ new_window_state->set_audio_streaming_state(
+ state->audio_streaming_state());
+ new_window_state->set_video_streaming_state(
+ state->video_streaming_state());
+ new_window_state->set_system_context(window_hmi_state->system_context());
+ new_window_state->set_window_type(window_hmi_state->window_type());
+ app->SetRegularState(window_id, new_window_state);
+
+ MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+ }
+ }
+}
+
void StateControllerImpl::on_event(const event_engine::MobileEvent& event) {}
void StateControllerImpl::on_event(const event_engine::Event& event) {
@@ -636,8 +718,9 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
const SmartObject& message = event.smart_object();
const FunctionID::eType id = static_cast<FunctionID::eType>(event.id());
switch (id) {
- case FunctionID::BasicCommunication_ActivateApp: {
- OnActivateAppResponse(message);
+ case FunctionID::BasicCommunication_ActivateApp:
+ case FunctionID::BasicCommunication_CloseApplication: {
+ OnHMIResponse(message);
break;
}
case FunctionID::BasicCommunication_OnAppActivated: {
@@ -725,26 +808,82 @@ void StateControllerImpl::on_event(const event_engine::Event& event) {
}
}
+void StateControllerImpl::ActivateDefaultWindow(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+
+ const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
+ const HMILevel::eType hmi_level = HMILevel::HMI_FULL;
+ const AudioStreamingState::eType audio_state =
+ app->IsAudioApplication() ? AudioStreamingState::AUDIBLE
+ : AudioStreamingState::NOT_AUDIBLE;
+ const VideoStreamingState::eType video_state =
+ app->IsVideoApplication() ? VideoStreamingState::STREAMABLE
+ : VideoStreamingState::NOT_STREAMABLE;
+
+ SetRegularState(app, window_id, hmi_level, audio_state, video_state, false);
+
+ // After main window activation, streaming state should be updated for another
+ // windows of the app
+ HmiStatePtr new_state =
+ app->RegularHmiState(PredefinedWindows::DEFAULT_WINDOW);
+ UpdateAppWindowsStreamingState(app, new_state);
+}
+
+void StateControllerImpl::ExitDefaultWindow(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+
+ const WindowID window_id = PredefinedWindows::DEFAULT_WINDOW;
+ const HMILevel::eType hmi_level = HMILevel::HMI_NONE;
+ const AudioStreamingState::eType audio_state =
+ AudioStreamingState::NOT_AUDIBLE;
+ const VideoStreamingState::eType video_state =
+ VideoStreamingState::NOT_STREAMABLE;
+
+ SetRegularState(app, window_id, hmi_level, audio_state, video_state, false);
+
+ // After main window exiting, streaming state should be updated for another
+ // windows of the app
+ HmiStatePtr new_state =
+ app->RegularHmiState(PredefinedWindows::DEFAULT_WINDOW);
+ UpdateAppWindowsStreamingState(app, new_state);
+}
+
void StateControllerImpl::OnStateChanged(ApplicationSharedPtr app,
+ const WindowID window_id,
HmiStatePtr old_state,
HmiStatePtr new_state) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(old_state);
DCHECK_OR_RETURN_VOID(new_state);
- LOG4CXX_DEBUG(logger_, "Old state: " << *old_state);
- LOG4CXX_DEBUG(logger_, "New state: " << *new_state);
- if (IsStateChanged(*old_state, *new_state)) {
- app_mngr_.SendHMIStatusNotification(app);
- if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
- app->ResetDataInNone();
- }
- app_mngr_.OnHMILevelChanged(
- app->app_id(), old_state->hmi_level(), new_state->hmi_level());
- app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
- } else {
- LOG4CXX_ERROR(logger_, "State has NOT been changed.");
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " old state: " << *old_state);
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " new state: " << *new_state);
+
+ if (!IsStateChanged(*old_state, *new_state)) {
+ LOG4CXX_DEBUG(logger_, "State has NOT been changed.");
+ return;
+ }
+
+ MessageHelper::SendHMIStatusNotification(app, window_id, app_mngr_);
+
+ if (mobile_apis::PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ LOG4CXX_DEBUG(logger_,
+ "State was changed not for a main application window. No "
+ "additional actions required");
+ return;
+ }
+
+ if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
+ app->ResetDataInNone();
}
+
+ app_mngr_.OnHMILevelChanged(
+ app->app_id(), old_state->hmi_level(), new_state->hmi_level());
+ app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
}
bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
@@ -755,6 +894,20 @@ bool StateControllerImpl::IsTempStateActive(HmiState::StateID id) const {
void StateControllerImpl::OnApplicationRegistered(
ApplicationSharedPtr app,
const mobile_apis::HMILevel::eType default_level) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ // After app registration HMI level should be set for DEFAUL_WINDOW only
+ OnAppWindowAdded(app,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ mobile_apis::WindowType::MAIN,
+ default_level);
+}
+
+void StateControllerImpl::OnAppWindowAdded(
+ ApplicationSharedPtr app,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type,
+ const mobile_apis::HMILevel::eType default_level) {
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -768,9 +921,10 @@ void StateControllerImpl::OnApplicationRegistered(
DCHECK_OR_RETURN_VOID(new_state);
DCHECK_OR_RETURN_VOID(new_state->state_id() !=
HmiState::STATE_ID_REGULAR);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
+ HmiStatePtr old_hmi_state = app->CurrentHmiState(window_id);
new_state->set_parent(old_hmi_state);
- app->AddHMIState(new_state);
+ new_state->set_window_type(old_hmi_state->window_type());
+ app->AddHMIState(window_id, new_state);
}
}
@@ -781,50 +935,57 @@ void StateControllerImpl::OnApplicationRegistered(
default_state->set_audio_streaming_state(CalcAudioState(app, default_level));
default_state->set_video_streaming_state(CalcVideoState(app, default_level));
default_state->set_system_context(SystemContext::SYSCTXT_MAIN);
+ default_state->set_window_type(window_type);
- HmiStatePtr initial_state = app->RegularHmiState();
+ HmiStatePtr initial_state = app->RegularHmiState(window_id);
- app->SetRegularState(default_state);
+ app->SetRegularState(window_id, default_state);
- HmiStatePtr new_state = app->CurrentHmiState();
+ HmiStatePtr new_state = app->CurrentHmiState(window_id);
- OnStateChanged(app, initial_state, new_state);
+ OnStateChanged(app, window_id, initial_state, new_state);
}
-int64_t StateControllerImpl::SendBCActivateApp(
+int64_t StateControllerImpl::RequestHMIStateChange(
ApplicationConstSharedPtr app,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr bc_activate_app_request =
- MessageHelper::GetBCActivateAppRequestToHMI(
- app,
- app_mngr_.connection_handler().get_session_observer(),
- app_mngr_.GetPolicyHandler(),
- level,
- send_policy_priority,
- app_mngr_);
- if (!bc_activate_app_request) {
- LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest");
+ smart_objects::SmartObjectSPtr request = NULL;
+ if (hmi_apis::Common_HMILevel::NONE == level) {
+ request = MessageHelper::GetBCCloseApplicationRequestToHMI(app, app_mngr_);
+ } else {
+ request = MessageHelper::GetBCActivateAppRequestToHMI(
+ app,
+ app_mngr_.GetPolicyHandler(),
+ level,
+ send_policy_priority,
+ app_mngr_);
+ }
+ if (!request) {
+ LOG4CXX_ERROR(logger_, "Unable to create request");
return -1;
}
- if (!app_mngr_.GetRPCService().ManageHMICommand(bc_activate_app_request)) {
- LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateAppRequest");
+ if (!app_mngr_.GetRPCService().ManageHMICommand(request)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
return -1;
}
- const int64_t corr_id =
- (*bc_activate_app_request)[strings::params][strings::correlation_id]
- .asInt();
- return corr_id;
+ const uint32_t corr_id =
+ (*request)[strings::params][strings::correlation_id].asUInt();
+ return static_cast<int64_t>(corr_id);
}
void StateControllerImpl::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
- HmiStatePtr state = app->PostponedHmiState();
- if (state) {
- app->RemovePostponedState();
- state->set_state_id(HmiState::STATE_ID_REGULAR);
- SetRegularState(app, state);
+ const WindowIds window_ids = app->GetWindowIds();
+
+ for (const auto& window_id : window_ids) {
+ HmiStatePtr state = app->PostponedHmiState(window_id);
+ if (state) {
+ app->RemovePostponedState(window_id);
+ state->set_state_id(HmiState::STATE_ID_REGULAR);
+ SetRegularState(app, window_id, state);
+ }
}
}
@@ -852,16 +1013,19 @@ void StateControllerImpl::TempStateStopped(HmiState::StateID ID) {
std::mem_fun(&StateControllerImpl::ApplyPostponedStateForApp), this));
}
-void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
+void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app,
+ const WindowID window_id) {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
- const HmiStatePtr regular = app->RegularHmiState();
+ const HmiStatePtr regular = app->RegularHmiState(window_id);
DCHECK_OR_RETURN_VOID(regular);
HmiStatePtr new_regular = std::make_shared<HmiState>(*regular);
- LOG4CXX_DEBUG(logger_, "Current HMI level: '" << app->hmi_level() << "'");
+ LOG4CXX_DEBUG(logger_,
+ "Window #" << window_id << " current HMI level: '"
+ << app->hmi_level(window_id) << "'");
const bool is_audio_app = app->IsAudioApplication();
const bool is_video_app = app->IsVideoApplication();
@@ -887,23 +1051,25 @@ void StateControllerImpl::DeactivateApp(ApplicationSharedPtr app) {
new_regular->set_video_streaming_state(VideoStreamingState::NOT_STREAMABLE);
}
- SetRegularState(app, new_regular, false);
+ SetRegularState(app, window_id, new_regular, false);
}
-void StateControllerImpl::OnActivateAppResponse(
+void StateControllerImpl::OnHMIResponse(
const smart_objects::SmartObject& message) {
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- const int32_t correlation_id =
- message[strings::params][strings::correlation_id].asInt();
+ const uint32_t correlation_id =
+ message[strings::params][strings::correlation_id].asUInt();
const uint32_t hmi_app_id = app_mngr_.application_id(correlation_id);
ApplicationSharedPtr application =
app_mngr_.application_by_hmi_app(hmi_app_id);
if (application && hmi_apis::Common_Result::SUCCESS == code) {
- HmiStatePtr pending_state = waiting_for_activate_[application->app_id()];
+ HmiStatePtr pending_state = waiting_for_response_[application->app_id()];
DCHECK_OR_RETURN_VOID(pending_state);
- ApplyRegularState(application, pending_state);
+ ApplyRegularState(application,
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ pending_state);
}
}
@@ -919,7 +1085,33 @@ void StateControllerImpl::OnAppActivated(
return;
}
- SetRegularState(app, HMILevel::HMI_FULL, true);
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if (message[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = message[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto window_ids = app->GetWindowIds();
+ if (!helpers::in_range(window_ids, window_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application " << app_id << " does not contain window #" << window_id);
+ return;
+ }
+
+ if (PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ const auto window_hmi_level = app->hmi_level(window_id);
+ const HMILevel::eType new_hmi_level = HMILevel::HMI_NONE == window_hmi_level
+ ? HMILevel::HMI_BACKGROUND
+ : HMILevel::HMI_FULL;
+ const AudioStreamingState::eType audio_state = app->audio_streaming_state();
+ const VideoStreamingState::eType video_state = app->video_streaming_state();
+
+ SetRegularState(
+ app, window_id, new_hmi_level, audio_state, video_state, false);
+ return;
+ }
+
+ SetRegularState(app, window_id, HMILevel::HMI_FULL, true);
}
void StateControllerImpl::OnAppDeactivated(
@@ -934,13 +1126,39 @@ void StateControllerImpl::OnAppDeactivated(
return;
}
- if (HMILevel::HMI_FULL != app->hmi_level()) {
+ WindowID window_id = mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+ if (message[strings::msg_params].keyExists(strings::window_id)) {
+ window_id = message[strings::msg_params][strings::window_id].asInt();
+ }
+
+ const auto window_ids = app->GetWindowIds();
+ if (!helpers::in_range(window_ids, window_id)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Application " << app_id << " does not contain window #" << window_id);
+ return;
+ }
+
+ const auto window_hmi_level = app->hmi_level(window_id);
+ if (PredefinedWindows::DEFAULT_WINDOW != window_id) {
+ const HMILevel::eType new_hmi_level = HMILevel::HMI_FULL == window_hmi_level
+ ? HMILevel::HMI_BACKGROUND
+ : HMILevel::HMI_NONE;
+ const AudioStreamingState::eType audio_state = app->audio_streaming_state();
+ const VideoStreamingState::eType video_state = app->video_streaming_state();
+
+ SetRegularState(
+ app, window_id, new_hmi_level, audio_state, video_state, false);
+ return;
+ }
+
+ if (HMILevel::HMI_FULL != window_hmi_level) {
return;
}
// TODO(AOleynik): Need to delete DeactivateReason and modify OnAppDeactivated
// when HMI will support that, otherwise won't be testable
- DeactivateApp(app);
+ DeactivateApp(app, window_id);
}
void StateControllerImpl::OnVideoStreamingStarted(
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index ccec05a795..5b7aa80f20 100755
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -88,7 +88,7 @@ set (RequestController_SOURCES
set(LIBRARIES
Utils
ApplicationManager
- sdl_rpc_plugin
+ sdl_rpc_plugin_static
jsoncpp
Policy
connectionHandler
@@ -154,6 +154,7 @@ set(ResumptionData_SOURCES
file(COPY hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_sc1.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY hmi_capabilities_sc2.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY hmi_capabilities_old_apt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resumption)
diff --git a/src/components/application_manager/test/app_service_manager_test.cc b/src/components/application_manager/test/app_service_manager_test.cc
index 0f2b4469a2..daabdeedf4 100644
--- a/src/components/application_manager/test/app_service_manager_test.cc
+++ b/src/components/application_manager/test/app_service_manager_test.cc
@@ -60,6 +60,7 @@ const std::string kServiceType = "MEDIA";
const std::string kServiceName = "service_name";
const std::string kServiceId = "service_id";
const std::string kPolicyAppId = "p_app_id";
+const std::string kPolicyAppId2 = "p_app_id2";
const uint32_t kConnectionKey = 43629;
const uint32_t kHMIConnectionKey = 0;
@@ -83,6 +84,7 @@ class AppServiceManagerTest : public testing::Test {
public:
AppServiceManagerTest()
: mock_app_ptr_(new MockApplication)
+ , mock_app_ptr2_(new MockApplication)
, app_service_manager_(mock_app_manager_, mock_last_state_)
, mock_message_helper_(
application_manager::MockMessageHelper::message_helper_mock()) {
@@ -101,10 +103,15 @@ class AppServiceManagerTest : public testing::Test {
.WillByDefault(ReturnRef(mock_settings_));
ON_CALL(*mock_app_ptr_, policy_app_id())
.WillByDefault(Return(kPolicyAppId));
+ ON_CALL(*mock_app_ptr2_, policy_app_id())
+ .WillByDefault(Return(kPolicyAppId2));
ON_CALL(mock_last_state_, get_dictionary()).WillByDefault(ReturnRef(dict_));
auto app_ptr = std::static_pointer_cast<am::Application>(mock_app_ptr_);
+ auto app_ptr2 = std::static_pointer_cast<am::Application>(mock_app_ptr2_);
ON_CALL(mock_app_manager_, application(kConnectionKey))
.WillByDefault(Return(app_ptr));
+ ON_CALL(mock_app_manager_, application(kConnectionKey + 1))
+ .WillByDefault(Return(app_ptr2));
}
protected:
@@ -192,6 +199,7 @@ class AppServiceManagerTest : public testing::Test {
Json::Value dict_;
std::vector<std::string> embedded_services_;
std::shared_ptr<MockApplication> mock_app_ptr_;
+ std::shared_ptr<MockApplication> mock_app_ptr2_;
MockApplicationManager mock_app_manager_;
resumption_test::MockLastState mock_last_state_;
MockApplicationManagerSettings mock_settings_;
diff --git a/src/components/application_manager/test/application_impl_test.cc b/src/components/application_manager/test/application_impl_test.cc
index 46d35bdbef..7b45d387f7 100644
--- a/src/components/application_manager/test/application_impl_test.cc
+++ b/src/components/application_manager/test/application_impl_test.cc
@@ -69,7 +69,14 @@ using ::testing::Return;
using ::testing::ReturnRef;
using usage_statistics_test::MockStatisticsManager;
-typedef void (ApplicationImpl::*AddSet)(HmiStatePtr args);
+typedef void (ApplicationImpl::*AddSet)(const WindowID window_id,
+ HmiStatePtr args);
+
+namespace {
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+} // namespace
class ApplicationImplTest : public ::testing::Test {
protected:
@@ -106,7 +113,8 @@ class ApplicationImplTest : public ::testing::Test {
mock_application_manager_));
HmiStatePtr initial_state = CreateTestHmiState();
- app_impl->SetInitialState(initial_state);
+ app_impl->SetInitialState(
+ kDefaultWindowId, kDefaultWindowName, initial_state);
}
virtual void TearDown() OVERRIDE {
@@ -159,12 +167,12 @@ HmiStatePtr ApplicationImplTest::TestAddHmiState(HMILevel::eType hmi_lvl,
test_lvl = hmi_lvl;
state_id = id_state;
HmiStatePtr state = CreateTestHmiState();
- ((app_impl.get())->*hmi_action)(state);
+ ((app_impl.get())->*hmi_action)(kDefaultWindowId, state);
return state;
}
void ApplicationImplTest::CheckCurrentHMIState() {
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(test_lvl, current_state->hmi_level());
EXPECT_EQ(state_id, current_state->state_id());
}
@@ -207,7 +215,7 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetRegularState) {
HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
- HmiStatePtr current_state = app_impl->RegularHmiState();
+ HmiStatePtr current_state = app_impl->RegularHmiState(kDefaultWindowId);
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_REGULAR, current_state->state_id());
EXPECT_EQ(app_id, app_impl->app_id());
@@ -228,8 +236,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveLastState) {
CheckCurrentHMIState();
// Remove last state
- app_impl->RemoveHMIState(state3->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state3->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state2, current_state);
EXPECT_EQ(HMILevel::HMI_NONE, current_state->hmi_level());
EXPECT_EQ(HmiState::STATE_ID_VIDEO_STREAMING, current_state->state_id());
@@ -249,8 +257,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveNotLastNotFirstState) {
CheckCurrentHMIState();
// Remove not last state
- app_impl->RemoveHMIState(state2->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state2->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// HMI level is equal to parent hmi_level
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
@@ -272,8 +280,8 @@ TEST_F(ApplicationImplTest, AddStates_RemoveFirstState) {
CheckCurrentHMIState();
// Remove first added state
- app_impl->RemoveHMIState(state1->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state does not have a parent
EXPECT_EQ(HMILevel::HMI_LIMITED, current_state->hmi_level());
@@ -295,8 +303,8 @@ TEST_F(ApplicationImplTest, SetRegularState_RemoveFirstState) {
CheckCurrentHMIState();
// Remove first state
- app_impl->RemoveHMIState(state1->state_id());
- HmiStatePtr current_state = app_impl->CurrentHmiState();
+ app_impl->RemoveHMIState(kDefaultWindowId, state1->state_id());
+ HmiStatePtr current_state = app_impl->CurrentHmiState(kDefaultWindowId);
EXPECT_EQ(state3, current_state);
// Last state has a parent
EXPECT_EQ(HMILevel::HMI_FULL, current_state->hmi_level());
@@ -311,12 +319,12 @@ TEST_F(ApplicationImplTest, SetPostponedState_RemovePostponedState) {
&ApplicationImpl::SetPostponedState);
// Check that state was setted correctly
- HmiStatePtr state2 = app_impl->PostponedHmiState();
+ HmiStatePtr state2 = app_impl->PostponedHmiState(kDefaultWindowId);
EXPECT_EQ(state1, state2);
// Check that state was correctly removed
- app_impl->RemovePostponedState();
- state2 = app_impl->PostponedHmiState();
+ app_impl->RemovePostponedState(kDefaultWindowId);
+ state2 = app_impl->PostponedHmiState(kDefaultWindowId);
EXPECT_EQ(nullptr, state2);
}
@@ -327,9 +335,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
HmiState::STATE_ID_REGULAR,
&ApplicationImpl::SetRegularState);
- EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId));
EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
- EXPECT_EQ(syst_context, app_impl->system_context());
+ EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId));
audiostate = AudioStreamingState::AUDIBLE;
syst_context = SystemContext::SYSCTXT_MENU;
@@ -337,9 +345,9 @@ TEST_F(ApplicationImplTest, AddStateAddRegularState_GetHmiLvlAudioSystemState) {
HmiState::STATE_ID_VIDEO_STREAMING,
&ApplicationImpl::AddHMIState);
- EXPECT_EQ(test_lvl, app_impl->hmi_level());
+ EXPECT_EQ(test_lvl, app_impl->hmi_level(kDefaultWindowId));
EXPECT_EQ(audiostate, app_impl->audio_streaming_state());
- EXPECT_EQ(syst_context, app_impl->system_context());
+ EXPECT_EQ(syst_context, app_impl->system_context(kDefaultWindowId));
}
TEST_F(ApplicationImplTest, IsAudioApplication) {
@@ -565,7 +573,9 @@ TEST_F(ApplicationImplTest, SubscribeToSoftButton_UnsubscribeFromSoftButton) {
SoftButtonID test_button;
for (uint i = 0; i < btn_count; i++) {
- test_button.insert(i);
+ test_button.insert(std::make_pair(
+ i,
+ static_cast<WindowID>(mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
}
app_impl->SubscribeToSoftButtons(FunctionID::ScrollableMessageID,
test_button);
diff --git a/src/components/application_manager/test/application_manager_impl_test.cc b/src/components/application_manager/test/application_manager_impl_test.cc
index 804959e1db..1f0b705f41 100644
--- a/src/components/application_manager/test/application_manager_impl_test.cc
+++ b/src/components/application_manager/test/application_manager_impl_test.cc
@@ -102,6 +102,8 @@ connection_handler::DeviceHandle kDeviceId = 12345u;
const std::string kAppId = "someID";
const uint32_t kConnectionKey = 1232u;
const std::string kAppName = "appName";
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
#if defined(CLOUD_APP_WEBSOCKET_TRANSPORT_SUPPORT)
// Cloud application params
@@ -145,8 +147,10 @@ class ApplicationManagerImplTest : public ::testing::Test {
protected:
void SetUp() OVERRIDE {
CreateAppManager();
- ON_CALL(mock_session_observer_, GetDataOnSessionKey(_, _, _, _))
- .WillByDefault(DoAll(SetArgPointee<3u>(kDeviceId), Return(0)));
+ ON_CALL(*mock_app_ptr_, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*mock_app_ptr_, device()).WillByDefault(Return(kDeviceId));
+ ON_CALL(mock_connection_handler_, GetDataOnSessionKey(_, _, _, &kDeviceId))
+ .WillByDefault(DoAll(SetArgPointee<3u>(app_id_), Return(0)));
ON_CALL(mock_connection_handler_, get_session_observer())
.WillByDefault(ReturnRef(mock_session_observer_));
app_manager_impl_->SetMockRPCService(mock_rpc_service_);
@@ -384,7 +388,7 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_VideoServiceStart) {
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -415,7 +419,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
// is_navi() is false
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(false));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -446,7 +450,7 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
// HMI level is not FULL nor LIMITED
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
bool result = false;
@@ -476,7 +480,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
bool result = false;
@@ -560,7 +564,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -634,7 +638,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -669,7 +673,7 @@ TEST_F(ApplicationManagerImplTest, OnServiceStartedCallback_AudioServiceStart) {
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -699,7 +703,7 @@ TEST_F(ApplicationManagerImplTest,
const int32_t session_key = 123;
EXPECT_CALL(*mock_app_ptr_, app_id()).WillRepeatedly(Return(session_key));
EXPECT_CALL(*mock_app_ptr_, is_navi()).WillRepeatedly(Return(true));
- EXPECT_CALL(*mock_app_ptr_, hmi_level())
+ EXPECT_CALL(*mock_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
bool result = false;
@@ -820,6 +824,9 @@ TEST_F(ApplicationManagerImplTest,
std::shared_ptr<MockApplication> switching_app_ptr =
std::make_shared<MockApplication>();
+ ON_CALL(*switching_app_ptr, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*switching_app_ptr, device()).WillByDefault(Return(kDeviceId));
+
const std::string switching_device_id = "switching";
const std::string switching_device_id_hash =
encryption::MakeHash(switching_device_id);
@@ -832,12 +839,11 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_switch));
const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL;
- EXPECT_CALL(*switching_app_ptr, hmi_level())
+ EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_switching_app));
std::shared_ptr<MockApplication> nonswitching_app_ptr =
std::make_shared<MockApplication>();
-
const std::string nonswitching_device_id = "nonswitching";
const std::string nonswitching_device_id_hash =
encryption::MakeHash(nonswitching_device_id);
@@ -850,7 +856,7 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_nonswitch));
const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED;
- EXPECT_CALL(*nonswitching_app_ptr, hmi_level())
+ EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_nonswitching_app));
// Act
@@ -868,15 +874,18 @@ TEST_F(ApplicationManagerImplTest,
.WillOnce(Return(smart_objects::SmartObjectSPtr()));
app_manager_impl_->OnDeviceSwitchingStart(switching_device,
non_switching_device);
- EXPECT_TRUE(app_manager_impl_->IsAppInReconnectMode(policy_app_id_switch));
- EXPECT_FALSE(
- app_manager_impl_->IsAppInReconnectMode(policy_app_id_nonswitch));
+ EXPECT_TRUE(
+ app_manager_impl_->IsAppInReconnectMode(kDeviceId, policy_app_id_switch));
+ EXPECT_FALSE(app_manager_impl_->IsAppInReconnectMode(
+ kDeviceId, policy_app_id_nonswitch));
}
TEST_F(ApplicationManagerImplTest,
OnDeviceSwitchingFinish_ExpectUnregisterAppsInWaitList) {
std::shared_ptr<MockApplication> switching_app_ptr =
std::make_shared<MockApplication>();
+ ON_CALL(*switching_app_ptr, app_id()).WillByDefault(Return(kConnectionKey));
+ ON_CALL(*switching_app_ptr, device()).WillByDefault(Return(kDeviceId));
plugin_manager::MockRPCPluginManager* mock_rpc_plugin_manager =
new plugin_manager::MockRPCPluginManager;
@@ -896,7 +905,7 @@ TEST_F(ApplicationManagerImplTest,
.WillRepeatedly(Return(policy_app_id_switch));
const auto hmi_level_switching_app = mobile_apis::HMILevel::HMI_FULL;
- EXPECT_CALL(*switching_app_ptr, hmi_level())
+ EXPECT_CALL(*switching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_switching_app));
std::shared_ptr<MockApplication> nonswitching_app_ptr =
@@ -913,8 +922,12 @@ TEST_F(ApplicationManagerImplTest,
EXPECT_CALL(*nonswitching_app_ptr, policy_app_id())
.WillRepeatedly(Return(policy_app_id_nonswitch));
+ ON_CALL(*nonswitching_app_ptr, protocol_version())
+ .WillByDefault(
+ Return(protocol_handler::MajorProtocolVersion::PROTOCOL_VERSION_4));
+
const auto hmi_level_nonswitching_app = mobile_apis::HMILevel::HMI_LIMITED;
- EXPECT_CALL(*nonswitching_app_ptr, hmi_level())
+ EXPECT_CALL(*nonswitching_app_ptr, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(hmi_level_nonswitching_app));
// Act
@@ -933,7 +946,8 @@ TEST_F(ApplicationManagerImplTest,
app_manager_impl_->OnDeviceSwitchingStart(switching_device,
non_switching_device);
- EXPECT_TRUE(app_manager_impl_->IsAppInReconnectMode(policy_app_id_switch));
+ EXPECT_TRUE(
+ app_manager_impl_->IsAppInReconnectMode(kDeviceId, policy_app_id_switch));
app_manager_impl_->OnDeviceSwitchingFinish(switching_device_id);
EXPECT_FALSE(
diff --git a/src/components/application_manager/test/application_state_test.cc b/src/components/application_manager/test/application_state_test.cc
index 5ebcdd29c7..22d111f926 100644
--- a/src/components/application_manager/test/application_state_test.cc
+++ b/src/components/application_manager/test/application_state_test.cc
@@ -50,6 +50,11 @@ using namespace mobile_apis;
typedef HmiState::StateID StateID;
namespace {
+
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
+
std::vector<StateID> GenerateCurrentStates() {
std::vector<StateID> states;
states.push_back(StateID::STATE_ID_PHONE_CALL);
@@ -87,8 +92,8 @@ TEST_F(ApplicationStateTest, AddStates_GetCurrentStates) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
- EXPECT_EQ(state, app_state.GetState(current_id));
+ app_state.AddState(kDefaultWindowId, state);
+ EXPECT_EQ(state, app_state.GetState(kDefaultWindowId, current_id));
}
}
@@ -99,16 +104,16 @@ TEST_F(ApplicationStateTest, AddStates_RemoveStates_GetCurrentState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
- HmiStatePtr curr_state = app_state.GetState(current_id);
+ HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id);
ASSERT_EQ(*new_state, curr_state->state_id());
}
new_state = added_states_.end() - 1;
while (new_state != added_states_.begin()) {
- app_state.RemoveState(*new_state);
- HmiStatePtr curr_state = app_state.GetState(current_id);
+ app_state.RemoveState(kDefaultWindowId, *new_state);
+ HmiStatePtr curr_state = app_state.GetState(kDefaultWindowId, current_id);
--new_state;
EXPECT_EQ(*new_state, curr_state->state_id());
}
@@ -122,19 +127,20 @@ TEST_F(ApplicationStateTest, AddStatesAddPostponedState_GetPostponedState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
}
// Postponed state wasn't added
- HmiStatePtr get_postponed_id = app_state.GetState(postponed_id);
+ HmiStatePtr get_postponed_id =
+ app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(nullptr, get_postponed_id);
// Add posponed state
HmiStatePtr state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Postponed state exists
- get_postponed_id = app_state.GetState(postponed_id);
+ get_postponed_id = app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(state, get_postponed_id);
}
@@ -146,7 +152,7 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
app_mngr_,
*new_state);
state->set_hmi_level(HMILevel::HMI_FULL);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
++new_state;
// Add some other
for (; new_state != added_states_.end(); ++new_state) {
@@ -154,13 +160,14 @@ TEST_F(ApplicationStateTest, AddStates_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
state->set_hmi_level(HMILevel::HMI_LIMITED);
}
// Regular state will be the first added state
new_state = added_states_.begin();
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(*new_state, reg_state->state_id());
EXPECT_EQ(HMILevel::HMI_FULL, reg_state->hmi_level());
}
@@ -171,7 +178,7 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
++new_state;
// Add postponed state
@@ -179,10 +186,10 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Make sure that the state was added
- HmiStatePtr post_state = app_state.GetState(postponed_id);
+ HmiStatePtr post_state = app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(state, post_state);
for (; new_state != added_states_.end(); ++new_state) {
@@ -190,19 +197,20 @@ TEST_F(ApplicationStateTest, AddRegularState_RemoveFirstState_GetRegularState) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
*new_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
}
// Regular state will be the first added state
new_state = added_states_.begin();
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
ASSERT_EQ(*new_state, reg_state->state_id());
- app_state.RemoveState(*new_state);
+ app_state.RemoveState(kDefaultWindowId, *new_state);
++new_state;
// Now regular state is the next state except postponed
- reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(*new_state, reg_state->state_id());
}
@@ -213,14 +221,14 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
first_state);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add postponed state
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add new postponed state
std::shared_ptr<MockApplication> mock_app_2(new MockApplication);
@@ -228,21 +236,22 @@ TEST_F(ApplicationStateTest, AddRegularState_PreviousStatePostponed) {
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Add regular state
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
StateID::STATE_ID_REGULAR);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Postponed state is the first
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_POSTPONED);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_POSTPONED);
ASSERT_EQ(postponed_id, reg_state->state_id());
// Regular state is the second one
- reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ reg_state = app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(StateID::STATE_ID_REGULAR, reg_state->state_id());
}
@@ -253,12 +262,14 @@ TEST_F(ApplicationStateTest, InitState_GetRegularState) {
app_mngr_,
init_state);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
- HmiStatePtr reg_state = app_state.GetState(StateID::STATE_ID_REGULAR);
+ HmiStatePtr reg_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_REGULAR);
EXPECT_EQ(state, reg_state);
- HmiStatePtr curr_state = app_state.GetState(StateID::STATE_ID_CURRENT);
+ HmiStatePtr curr_state =
+ app_state.GetState(kDefaultWindowId, StateID::STATE_ID_CURRENT);
EXPECT_EQ(state, curr_state);
}
@@ -271,23 +282,24 @@ TEST_F(ApplicationStateTest, AddPosponedState_DeletePosponedState) {
init_state);
state->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
// Add postponed state
state = std::make_shared<HmiState>(
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
postponed_id);
- app_state.AddState(state);
+ app_state.AddState(kDefaultWindowId, state);
// Make sure that state was added
- HmiStatePtr get_postponed_state = app_state.GetState(postponed_id);
+ HmiStatePtr get_postponed_state =
+ app_state.GetState(kDefaultWindowId, postponed_id);
ASSERT_EQ(state, get_postponed_state);
// Remove postponed state
- app_state.RemoveState(postponed_id);
+ app_state.RemoveState(kDefaultWindowId, postponed_id);
- get_postponed_state = app_state.GetState(postponed_id);
+ get_postponed_state = app_state.GetState(kDefaultWindowId, postponed_id);
EXPECT_EQ(nullptr, get_postponed_state);
}
@@ -298,13 +310,13 @@ TEST_F(ApplicationStateTest,
static_cast<std::shared_ptr<Application> >(mock_app_),
app_mngr_,
reg_state);
- app_state.InitState(state);
+ app_state.InitState(kDefaultWindowId, kDefaultWindowName, state);
// Try deleting regular state
- app_state.RemoveState(reg_state);
+ app_state.RemoveState(kDefaultWindowId, reg_state);
// Get regular state
- HmiStatePtr get_reg_state = app_state.GetState(reg_state);
+ HmiStatePtr get_reg_state = app_state.GetState(kDefaultWindowId, reg_state);
EXPECT_EQ(state, get_reg_state);
}
diff --git a/src/components/application_manager/test/commands/CMakeLists.txt b/src/components/application_manager/test/commands/CMakeLists.txt
index 556f3a5032..ec7f454c47 100644
--- a/src/components/application_manager/test/commands/CMakeLists.txt
+++ b/src/components/application_manager/test/commands/CMakeLists.txt
@@ -58,7 +58,7 @@ set(LIBRARIES
connectionHandler
ApplicationManager
jsoncpp
- Policy
+ PolicyStatic
Resumption
)
diff --git a/src/components/application_manager/test/commands/command_request_impl_test.cc b/src/components/application_manager/test/commands/command_request_impl_test.cc
index cf26c19249..27e21efd8d 100644
--- a/src/components/application_manager/test/commands/command_request_impl_test.cc
+++ b/src/components/application_manager/test/commands/command_request_impl_test.cc
@@ -154,6 +154,13 @@ class CommandRequestImplTest
typedef CommandRequestImplTest::UnwrappedCommandRequestImpl UCommandRequestImpl;
typedef std::shared_ptr<UCommandRequestImpl> CommandPtr;
+TEST_F(CommandRequestImplTest, WindowID_ExpectDefaultWindowID) {
+ auto msg = CreateMessage();
+ const auto command = CreateCommand<UCommandRequestImpl>(msg);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ command->window_id());
+}
+
TEST_F(CommandRequestImplTest, OnTimeOut_StateCompleted_UNSUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>();
@@ -366,6 +373,12 @@ TEST_F(CommandRequestImplTest,
TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*mock_app,
+ WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
MessageSharedPtr message = CreateMessage();
(*message)[strings::msg_params] =
@@ -373,7 +386,7 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_NoMsgParamsMap_SUCCESS) {
CommandPtr command = CreateCommand<UCommandRequestImpl>(message);
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(kMobResultSuccess));
EXPECT_TRUE(command->CheckPermissions());
@@ -383,6 +396,12 @@ TEST_F(CommandRequestImplTest,
CheckAllowedParameters_WrongPolicyPermissions_UNSUCCESS) {
MockAppPtr mock_app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(mock_app));
+ ON_CALL(*mock_app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*mock_app,
+ WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
MessageSharedPtr message = CreateMessage();
(*message)[strings::msg_params] =
@@ -394,7 +413,7 @@ TEST_F(CommandRequestImplTest,
.Times(1)
.WillRepeatedly(Return(kConnectionKey));
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(Return(mobile_apis::Result::INVALID_ENUM));
EXPECT_CALL(mock_message_helper_, CreateBlockedByPoliciesResponse(_, _, _, _))
@@ -405,7 +424,7 @@ TEST_F(CommandRequestImplTest,
}
ACTION_P(GetArg3, output) {
- *output = arg2;
+ *output = arg3;
}
TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
@@ -417,9 +436,14 @@ TEST_F(CommandRequestImplTest, CheckAllowedParameters_MsgParamsMap_SUCCESS) {
MockAppPtr app = CreateMockApp();
ON_CALL(app_mngr_, application(_)).WillByDefault(Return(app));
+ ON_CALL(*app, GetWindowIds())
+ .WillByDefault(Return(
+ am::WindowIds(1, mobile_apis::PredefinedWindows::DEFAULT_WINDOW)));
+ ON_CALL(*app, WindowIdExists(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(true));
RPCParams params;
- EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _))
+ EXPECT_CALL(app_mngr_, CheckPolicyPermissions(_, _, _, _, _))
.WillOnce(DoAll(GetArg3(&params), Return(kMobResultSuccess)));
EXPECT_TRUE(command->CheckPermissions());
diff --git a/src/components/application_manager/test/help_prompt_manager_test.cc b/src/components/application_manager/test/help_prompt_manager_test.cc
index dc6635b049..502c1bdbbf 100644
--- a/src/components/application_manager/test/help_prompt_manager_test.cc
+++ b/src/components/application_manager/test/help_prompt_manager_test.cc
@@ -65,6 +65,9 @@ const std::string kDirectoryName = "./test_storage";
const uint8_t expected_tread_pool_size = 2u;
const uint8_t stop_streaming_timeout = 1u;
const std::vector<std::string> kTimeoutPrompt{"timeoutPrompt"};
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const std::string kDefaultWindowName = "DefaultName";
} // namespace
using namespace application_manager;
@@ -244,7 +247,8 @@ void HelpPromptManagerTest::CreateApplication(
app_mngr_,
mock_help_prompt_manager));
HmiStatePtr initial_state = CreateTestHmiState();
- app_impl_->SetInitialState(initial_state);
+ app_impl_->SetInitialState(
+ kDefaultWindowId, kDefaultWindowName, initial_state);
}
TEST_F(HelpPromptManagerTest, AddCommand_OnVrCommandAdded) {
diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json
index ca67d81d8c..afa5fa6056 100644
--- a/src/components/application_manager/test/hmi_capabilities.json
+++ b/src/components/application_manager/test/hmi_capabilities.json
@@ -355,11 +355,11 @@
"STATIC"
]
},
- "audioPassThruCapabilities": {
+ "audioPassThruCapabilities": [{
"samplingRate": "44KHZ",
"bitsPerSample": "RATE_8_BIT",
"audioType": "PCM"
- },
+ }],
"pcmStreamCapabilities": {
"samplingRate": "16KHZ",
"bitsPerSample": "RATE_16_BIT",
diff --git a/src/components/application_manager/test/hmi_capabilities_old_apt.json b/src/components/application_manager/test/hmi_capabilities_old_apt.json
new file mode 100644
index 0000000000..5a5af37e2f
--- /dev/null
+++ b/src/components/application_manager/test/hmi_capabilities_old_apt.json
@@ -0,0 +1,9 @@
+{
+ "UI": {
+ "audioPassThruCapabilities": {
+ "samplingRate": "22KHZ",
+ "bitsPerSample": "RATE_16_BIT",
+ "audioType": "PCM"
+ }
+ }
+}
diff --git a/src/components/application_manager/test/hmi_capabilities_test.cc b/src/components/application_manager/test/hmi_capabilities_test.cc
index e883e7bddb..3d47c717e1 100644
--- a/src/components/application_manager/test/hmi_capabilities_test.cc
+++ b/src/components/application_manager/test/hmi_capabilities_test.cc
@@ -336,15 +336,18 @@ TEST_F(HMICapabilitiesTest, LoadCapabilitiesFromFile) {
// Check audio pass thru
const smart_objects::SmartObject audio_pass_thru_capabilities_so =
*(hmi_capabilities_test->audio_pass_thru_capabilities());
+ EXPECT_EQ(smart_objects::SmartType_Array,
+ audio_pass_thru_capabilities_so.getType());
+ EXPECT_EQ(1u, audio_pass_thru_capabilities_so.length());
EXPECT_EQ(hmi_apis::Common_SamplingRate::RATE_44KHZ,
static_cast<hmi_apis::Common_SamplingRate::eType>(
- audio_pass_thru_capabilities_so["samplingRate"].asInt()));
+ audio_pass_thru_capabilities_so[0]["samplingRate"].asInt()));
EXPECT_EQ(hmi_apis::Common_BitsPerSample::RATE_8_BIT,
static_cast<hmi_apis::Common_BitsPerSample::eType>(
- audio_pass_thru_capabilities_so["bitsPerSample"].asInt()));
+ audio_pass_thru_capabilities_so[0]["bitsPerSample"].asInt()));
EXPECT_EQ(hmi_apis::Common_AudioType::PCM,
static_cast<hmi_apis::Common_AudioType::eType>(
- audio_pass_thru_capabilities_so["audioType"].asInt()));
+ audio_pass_thru_capabilities_so[0]["audioType"].asInt()));
// Check hmi zone capabilities
const smart_objects::SmartObject hmi_zone_capabilities_so =
@@ -569,6 +572,57 @@ TEST_F(HMICapabilitiesTest,
EXPECT_FALSE(navigation_capability_so["getWayPointsEnabled"].asBool());
}
+TEST_F(HMICapabilitiesTest,
+ LoadCapabilitiesFromFileAndVerifyOldAudioPassThruCapabilities) {
+ MockApplicationManager mock_app_mngr;
+ event_engine_test::MockEventDispatcher mock_dispatcher;
+ MockApplicationManagerSettings mock_application_manager_settings;
+
+ const std::string hmi_capabilities_file = "hmi_capabilities_old_apt.json";
+
+ EXPECT_CALL(mock_app_mngr, event_dispatcher())
+ .WillOnce(ReturnRef(mock_dispatcher));
+ EXPECT_CALL(mock_app_mngr, get_settings())
+ .WillRepeatedly(ReturnRef(mock_application_manager_settings));
+ EXPECT_CALL(mock_application_manager_settings, hmi_capabilities_file_name())
+ .WillOnce(ReturnRef(hmi_capabilities_file));
+ EXPECT_CALL(mock_dispatcher, add_observer(_, _, _)).Times(1);
+ EXPECT_CALL(mock_dispatcher, remove_observer(_)).Times(1);
+ EXPECT_CALL(mock_application_manager_settings, launch_hmi())
+ .WillOnce(Return(false));
+ EXPECT_CALL(*(MockMessageHelper::message_helper_mock()),
+ CommonLanguageFromString(_))
+ .WillRepeatedly(Invoke(TestCommonLanguageFromString));
+
+ if (file_system::FileExists("./app_info_data")) {
+ EXPECT_TRUE(::file_system::DeleteFile("./app_info_data"));
+ }
+
+ std::shared_ptr<HMICapabilitiesForTesting> hmi_capabilities =
+ std::make_shared<HMICapabilitiesForTesting>(mock_app_mngr);
+ hmi_capabilities->Init(&last_state_);
+
+ // with old audio pass thru format, the object is an array containing a single
+ // object
+ smart_objects::SmartObject audio_pass_thru_capabilities_so =
+ *(hmi_capabilities->audio_pass_thru_capabilities());
+ EXPECT_EQ(smart_objects::SmartType_Array,
+ audio_pass_thru_capabilities_so.getType());
+ EXPECT_EQ(1u, audio_pass_thru_capabilities_so.length());
+ EXPECT_TRUE(audio_pass_thru_capabilities_so[0].keyExists("samplingRate"));
+ EXPECT_EQ(hmi_apis::Common_SamplingRate::RATE_22KHZ,
+ static_cast<hmi_apis::Common_SamplingRate::eType>(
+ audio_pass_thru_capabilities_so[0]["samplingRate"].asInt()));
+ EXPECT_TRUE(audio_pass_thru_capabilities_so[0].keyExists("bitsPerSample"));
+ EXPECT_EQ(hmi_apis::Common_BitsPerSample::RATE_16_BIT,
+ static_cast<hmi_apis::Common_BitsPerSample::eType>(
+ audio_pass_thru_capabilities_so[0]["bitsPerSample"].asInt()));
+ EXPECT_TRUE(audio_pass_thru_capabilities_so[0].keyExists("audioType"));
+ EXPECT_EQ(hmi_apis::Common_AudioType::PCM,
+ static_cast<hmi_apis::Common_AudioType::eType>(
+ audio_pass_thru_capabilities_so[0]["audioType"].asInt()));
+}
+
TEST_F(HMICapabilitiesTest, VerifyImageType) {
const int32_t image_type = 1;
smart_objects::SmartObject sm_obj;
diff --git a/src/components/application_manager/test/include/application_manager/mock_application.h b/src/components/application_manager/test/include/application_manager/mock_application.h
index 74d09661c7..29e1c1cf9f 100644
--- a/src/components/application_manager/test/include/application_manager/mock_application.h
+++ b/src/components/application_manager/test/include/application_manager/mock_application.h
@@ -34,6 +34,8 @@
#include <string>
#include "application_manager/app_extension.h"
#include "application_manager/application.h"
+#include "application_manager/display_capabilities_builder.h"
+#include "application_manager/hmi_state.h"
#include "application_manager/usage_statistics.h"
#include "gmock/gmock.h"
#include "smart_objects/smart_object.h"
@@ -56,6 +58,8 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(is_application_data_changed, bool());
MOCK_METHOD1(set_is_application_data_changed,
void(bool state_application_data));
+ MOCK_CONST_METHOD0(is_app_data_resumption_allowed, bool());
+ MOCK_METHOD1(set_app_data_resumption_allowance, void(bool allowed));
MOCK_METHOD0(CloseActiveMessage, void());
MOCK_CONST_METHOD0(IsFullscreen, bool());
MOCK_METHOD0(ChangeSupportingAppHMIType, void());
@@ -97,11 +101,15 @@ class MockApplication : public ::application_manager::Application {
MOCK_METHOD1(set_folder_name, void(const std::string& folder_name));
MOCK_CONST_METHOD0(folder_name, const std::string());
MOCK_CONST_METHOD0(is_media_application, bool());
- MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType());
+ MOCK_CONST_METHOD1(hmi_level,
+ const mobile_apis::HMILevel::eType(
+ const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t());
MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t());
MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType());
+ MOCK_CONST_METHOD1(system_context,
+ const mobile_apis::SystemContext::eType(
+ const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(audio_streaming_state,
const mobile_apis::AudioStreamingState::eType());
MOCK_CONST_METHOD0(video_streaming_state,
@@ -109,11 +117,20 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(app_icon_path, const std::string&());
MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle());
MOCK_CONST_METHOD0(secondary_device, connection_handler::DeviceHandle());
- MOCK_CONST_METHOD0(CurrentHmiState, const application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(RegularHmiState, const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD1(CurrentHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(RegularHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD0(GetWindowIds, application_manager::WindowIds());
+ MOCK_CONST_METHOD0(GetWindowNames, application_manager::WindowNames());
+ MOCK_CONST_METHOD1(WindowIdExists,
+ bool(const application_manager::WindowID window_id));
MOCK_CONST_METHOD0(IsAllowedToChangeAudioSource, bool());
- MOCK_CONST_METHOD0(PostponedHmiState,
- const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD1(PostponedHmiState,
+ const application_manager::HmiStatePtr(
+ const application_manager::WindowID window_id));
MOCK_METHOD1(set_tts_properties_in_none, void(bool active));
MOCK_METHOD0(tts_properties_in_none, bool());
MOCK_METHOD1(set_tts_properties_in_full, void(bool active));
@@ -167,14 +184,24 @@ class MockApplication : public ::application_manager::Application {
::application_manager::HelpPromptManager&());
MOCK_CONST_METHOD0(help_prompt_manager,
const ::application_manager::HelpPromptManager&());
- MOCK_METHOD1(SetInitialState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetPostponedState,
- void(::application_manager::HmiStatePtr state));
- MOCK_METHOD0(RemovePostponedState, void());
- MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(RemoveHMIState,
- void(::application_manager::HmiState::StateID state_id));
+ MOCK_METHOD3(SetInitialState,
+ void(const application_manager::WindowID window_id,
+ const std::string& window_name,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(SetRegularState,
+ void(const application_manager::WindowID window_id,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(SetPostponedState,
+ void(const application_manager::WindowID window_id,
+ ::application_manager::HmiStatePtr state));
+ MOCK_METHOD1(RemovePostponedState,
+ void(const application_manager::WindowID window_id));
+ MOCK_METHOD2(AddHMIState,
+ void(const application_manager::WindowID window_id,
+ application_manager::HmiStatePtr state));
+ MOCK_METHOD2(RemoveHMIState,
+ void(const application_manager::WindowID window_id,
+ ::application_manager::HmiState::StateID state_id));
MOCK_METHOD2(SubscribeToSoftButtons,
void(int32_t cmd_id,
const ::application_manager::SoftButtonID& softbuttons_id));
@@ -220,9 +247,35 @@ class MockApplication : public ::application_manager::Application {
MOCK_CONST_METHOD0(keyboard_props, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_title, const smart_objects::SmartObject*());
MOCK_CONST_METHOD0(menu_icon, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(day_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(night_color_scheme, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(display_layout, const std::string&());
+ MOCK_CONST_METHOD0(day_color_scheme, smart_objects::SmartObject());
+ MOCK_CONST_METHOD0(night_color_scheme, smart_objects::SmartObject());
+ MOCK_CONST_METHOD0(display_layout, std::string());
+ MOCK_CONST_METHOD0(display_capabilities, smart_objects::SmartObjectSPtr());
+ MOCK_CONST_METHOD1(display_capabilities,
+ smart_objects::SmartObjectSPtr(
+ const application_manager::WindowID window_id));
+
+ MOCK_METHOD2(set_window_layout,
+ void(const application_manager::WindowID window_id,
+ const std::string& layout));
+ MOCK_METHOD2(set_day_color_scheme,
+ void(const application_manager::WindowID window_id,
+ const smart_objects::SmartObject& color_scheme));
+ MOCK_METHOD2(set_night_color_scheme,
+ void(const application_manager::WindowID window_id,
+ const smart_objects::SmartObject& color_scheme));
+ MOCK_CONST_METHOD1(
+ window_layout,
+ std::string(const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(day_color_scheme,
+ smart_objects::SmartObject(
+ const application_manager::WindowID window_id));
+ MOCK_CONST_METHOD1(night_color_scheme,
+ smart_objects::SmartObject(
+ const application_manager::WindowID window_id));
+ MOCK_METHOD1(set_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
MOCK_METHOD1(load_global_properties,
void(const smart_objects::SmartObject& so));
MOCK_METHOD1(set_help_prompt,
@@ -316,9 +369,10 @@ class MockApplication : public ::application_manager::Application {
SwapMobileMessageQueue,
void(::application_manager::MobileMessageQueue& mobile_messages));
- MOCK_METHOD1(
+ MOCK_METHOD2(
set_system_context,
- void(const application_manager::mobile_api::SystemContext::eType&));
+ void(const application_manager::WindowID window_id,
+ const application_manager::mobile_api::SystemContext::eType&));
MOCK_METHOD1(
set_audio_streaming_state,
void(const application_manager::mobile_api::AudioStreamingState::eType&
@@ -329,9 +383,10 @@ class MockApplication : public ::application_manager::Application {
bool(smart_objects::SmartObject module));
MOCK_METHOD1(UnsubscribeFromInteriorVehicleData,
bool(smart_objects::SmartObject module));
- MOCK_METHOD1(
+ MOCK_METHOD2(
set_hmi_level,
- void(const application_manager::mobile_api::HMILevel::eType& hmi_level));
+ void(const application_manager::WindowID window_id,
+ const application_manager::mobile_api::HMILevel::eType& hmi_level));
MOCK_METHOD1(QueryInterface,
application_manager::AppExtensionPtr(
application_manager::AppExtensionUID uid));
@@ -357,6 +412,19 @@ class MockApplication : public ::application_manager::Application {
void(const mobile_apis::HybridAppPreference::eType&
hybrid_app_preference));
MOCK_METHOD1(set_cloud_app_certificate, void(const std::string& certificate));
+ MOCK_METHOD2(SetWindowInfo,
+ void(const ::application_manager::WindowID windowID,
+ const smart_objects::SmartObject& window_info));
+ MOCK_METHOD1(RemoveWindowInfo,
+ void((const ::application_manager::WindowID window_id)));
+ MOCK_CONST_METHOD0(window_optional_params_map,
+ DataAccessor< ::application_manager::WindowParamsMap>());
+ MOCK_METHOD0(display_capabilities_builder,
+ application_manager::DisplayCapabilitiesBuilder&());
+ MOCK_METHOD1(GetSoftButtonWindowID,
+ application_manager::WindowID(const uint32_t button_id));
+ MOCK_METHOD1(remove_window_capability,
+ void(const application_manager::WindowID window_id));
};
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
index 468bdbe5eb..6ca987c1b2 100644
--- a/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
+++ b/src/components/application_manager/test/include/application_manager/mock_hmi_capabilities.h
@@ -103,6 +103,11 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_METHOD1(set_display_capabilities,
void(const smart_objects::SmartObject& display_capabilities));
+ MOCK_CONST_METHOD0(system_display_capabilities,
+ const smart_objects::SmartObjectSPtr());
+ MOCK_METHOD1(set_system_display_capabilities,
+ void(const smart_objects::SmartObject& display_capabilities));
+
MOCK_CONST_METHOD0(hmi_zone_capabilities,
const smart_objects::SmartObject*());
MOCK_METHOD1(set_hmi_zone_capabilities,
@@ -163,6 +168,9 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD0(rc_supported, bool());
MOCK_METHOD1(set_rc_supported, void(const bool supported));
+ MOCK_CONST_METHOD1(menu_layout_supported,
+ bool(mobile_apis::MenuLayout::eType layout));
+
MOCK_CONST_METHOD0(navigation_capability,
const smart_objects::SmartObject*());
MOCK_METHOD1(set_navigation_capability,
@@ -198,6 +206,9 @@ class MockHMICapabilities : public ::application_manager::HMICapabilities {
MOCK_CONST_METHOD2(convert_json_languages_to_obj,
void(const Json::Value& json_languages,
smart_objects::SmartObject& languages));
+ MOCK_CONST_METHOD2(convert_audio_capability_to_obj,
+ void(const Json::Value& capability,
+ smart_objects::SmartObject& output_so));
};
} // namespace application_manager_test
diff --git a/src/components/application_manager/test/include/application_manager/mock_message_helper.h b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
index ec13137abe..6cbe46f9ec 100644
--- a/src/components/application_manager/test/include/application_manager/mock_message_helper.h
+++ b/src/components/application_manager/test/include/application_manager/mock_message_helper.h
@@ -34,6 +34,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_APPLICATION_MANAGER_MOCK_MESSAGE_HELPER_H_
#include "application_manager/application.h"
#include "application_manager/application_manager.h"
+#include "application_manager/hmi_capabilities.h"
#include "application_manager/message_helper.h"
#include "application_manager/policies/policy_handler_interface.h"
#include "gmock/gmock.h"
@@ -128,8 +129,9 @@ class MockMessageHelper {
MOCK_METHOD2(CreateMessageForHMI,
smart_objects::SmartObjectSPtr(hmi_apis::messageType::eType,
const uint32_t));
- MOCK_METHOD2(SendHMIStatusNotification,
- void(const Application& application_impl,
+ MOCK_METHOD3(SendHMIStatusNotification,
+ void(ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager));
MOCK_METHOD4(SendPolicyUpdate,
void(const std::string& file_path,
@@ -168,6 +170,8 @@ class MockMessageHelper {
hmi_apis::Common_LightName::eType(const std::string& lightName));
MOCK_METHOD1(CommonLanguageToString,
std::string(hmi_apis::Common_Language::eType));
+ MOCK_METHOD1(MobileLanguageToString,
+ std::string(mobile_apis::Language::eType));
MOCK_METHOD2(CreateModuleInfoSO,
smart_objects::SmartObjectSPtr(uint32_t function_id,
ApplicationManager& app_mngr));
@@ -201,14 +205,16 @@ class MockMessageHelper {
MessageHelper::ChoiceSetVRCommandsStatus(
const smart_objects::SmartObject&));
- MOCK_METHOD6(GetBCActivateAppRequestToHMI,
+ MOCK_METHOD5(GetBCActivateAppRequestToHMI,
smart_objects::SmartObjectSPtr(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr));
+ MOCK_METHOD2(GetBCCloseApplicationRequestToHMI,
+ smart_objects::SmartObjectSPtr(ApplicationConstSharedPtr app,
+ ApplicationManager& app_mngr));
MOCK_METHOD2(GetOnAppInterfaceUnregisteredNotificationToMobile,
ns_smart_device_link::ns_smart_objects::SmartObjectSPtr(
int32_t connection_key,
@@ -219,6 +225,11 @@ class MockMessageHelper {
ApplicationConstSharedPtr app,
const policy::PolicyHandlerInterface& policy_handler,
ApplicationManager& app_mngr));
+ MOCK_METHOD4(SubscribeApplicationToSoftButton,
+ void(smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id,
+ const application_manager::WindowID window_id));
MOCK_METHOD3(SubscribeApplicationToSoftButton,
void(smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
@@ -278,6 +289,10 @@ class MockMessageHelper {
MOCK_METHOD1(PrintSmartObject,
bool(const smart_objects::SmartObject& object));
+
+ MOCK_METHOD1(ExtractWindowIdFromSmartObject,
+ WindowID(const smart_objects::SmartObject& s_map));
+
MOCK_METHOD3(SendTTSGlobalProperties,
void(ApplicationSharedPtr app,
const bool default_help_prompt,
@@ -316,6 +331,15 @@ class MockMessageHelper {
MOCK_METHOD2(BroadcastCapabilityUpdate,
void(smart_objects::SmartObject& msg_params,
ApplicationManager& app_mngr));
+ MOCK_METHOD3(CreateUICreateWindowRequestsToHMI,
+ smart_objects::SmartObjectList(
+ ApplicationSharedPtr application,
+ ApplicationManager& app_manager,
+ const smart_objects::SmartObject& windows_info));
+ MOCK_METHOD2(
+ CreateDisplayCapabilityUpdateToMobile,
+ smart_objects::SmartObjectSPtr(const smart_objects::SmartObject&,
+ application_manager::Application&));
static MockMessageHelper* message_helper_mock();
};
diff --git a/src/components/application_manager/test/include/application_manager/mock_request.h b/src/components/application_manager/test/include/application_manager/mock_request.h
index dfc6691ef4..77b5bb7c38 100644
--- a/src/components/application_manager/test/include/application_manager/mock_request.h
+++ b/src/components/application_manager/test/include/application_manager/mock_request.h
@@ -55,6 +55,7 @@ class MockRequest : public application_manager::commands::Command {
MOCK_METHOD0(CleanUp, bool());
MOCK_CONST_METHOD0(default_timeout, uint32_t());
MOCK_CONST_METHOD0(function_id, int32_t());
+ MOCK_CONST_METHOD0(window_id, application_manager::WindowID());
MOCK_METHOD0(onTimeOut, void());
MOCK_METHOD0(AllowedToTerminate, bool());
MOCK_METHOD1(SetAllowedToTerminate, void(bool is_allowed));
diff --git a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
index 4fd3b7fc5a..56c2ae3cd4 100644
--- a/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
+++ b/src/components/application_manager/test/include/application_manager/mock_resume_ctrl.h
@@ -94,13 +94,23 @@ class MockResumeCtrl : public resumption::ResumeCtrl {
MOCK_METHOD1(SetupDefaultHMILevel,
bool(application_manager::ApplicationSharedPtr application));
MOCK_METHOD1(StartAppHmiStateResumption,
- void(application_manager::ApplicationSharedPtr application));
+ bool(application_manager::ApplicationSharedPtr application));
MOCK_METHOD3(SetAppHMIState,
bool(application_manager::ApplicationSharedPtr application,
const mobile_apis::HMILevel::eType hmi_level,
bool check_policy));
MOCK_CONST_METHOD0(LaunchTime, time_t());
+ MOCK_METHOD2(RestoreAppWidgets,
+ void(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app));
+
+ MOCK_METHOD1(RestoreWidgetsHMIState,
+ void(const smart_objects::SmartObject& response_message));
+
+ MOCK_METHOD1(StartWaitingForDisplayCapabilitiesUpdate,
+ void(application_manager::ApplicationSharedPtr application));
+
#ifdef BUILD_TESTS
MOCK_METHOD1(set_resumption_storage,
void(std::shared_ptr<resumption::ResumptionData> mock_storage));
diff --git a/src/components/application_manager/test/include/application_manager/resumption_data_test.h b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
index cab3c23253..e313427547 100644
--- a/src/components/application_manager/test/include/application_manager/resumption_data_test.h
+++ b/src/components/application_manager/test/include/application_manager/resumption_data_test.h
@@ -74,7 +74,9 @@ class ResumptionDataTest : public ::testing::Test {
, comlock_ptr_(std::make_shared<sync_primitives::Lock>())
, setlock_ptr_(std::make_shared<sync_primitives::Lock>())
, btnlock_ptr_(std::make_shared<sync_primitives::Lock>())
- , ivilock_ptr_(std::make_shared<sync_primitives::Lock>()) {}
+ , ivilock_ptr_(std::make_shared<sync_primitives::Lock>())
+ , window_params_map_lock_ptr_(std::make_shared<sync_primitives::Lock>()) {
+ }
// Check structure in saved application
void CheckSavedApp(sm::SmartObject& saved_data);
// Set data for resumption
@@ -114,6 +116,9 @@ class ResumptionDataTest : public ::testing::Test {
void SetHelpAndTimeoutPrompt();
void SetVRHelpTitle();
void SetSubscriptions();
+ void SetWindowsInfo();
+ void SetDefaultCurrentHmiState();
+ void SetDefaultWindowIds();
void CheckCommands(sm::SmartObject& res_list);
void CheckGlobalProporties(sm::SmartObject& res_list);
@@ -129,6 +134,7 @@ class ResumptionDataTest : public ::testing::Test {
ns_smart_device_link::ns_smart_objects::SmartObject& res_list);
void CheckVRTitle(sm::SmartObject& res_list);
void CheckSubscriptions(sm::SmartObject& res_list);
+ void CheckWindowsInfo(sm::SmartObject& res_list);
const size_t kCountOfCommands_;
const size_t kCountOfChoice_;
@@ -145,11 +151,14 @@ class ResumptionDataTest : public ::testing::Test {
am::ButtonSubscriptions btn_subscr;
+ am::WindowParamsMap test_window_params_map_;
+
std::shared_ptr<sync_primitives::Lock> sublock_ptr_;
std::shared_ptr<sync_primitives::Lock> comlock_ptr_;
std::shared_ptr<sync_primitives::Lock> setlock_ptr_;
std::shared_ptr<sync_primitives::Lock> btnlock_ptr_;
std::shared_ptr<sync_primitives::Lock> ivilock_ptr_;
+ std::shared_ptr<sync_primitives::Lock> window_params_map_lock_ptr_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
application_manager_test::MockApplicationManager mock_application_manager_;
diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt b/src/components/application_manager/test/message_helper/CMakeLists.txt
index 99031849f6..31b175cbf0 100755
--- a/src/components/application_manager/test/message_helper/CMakeLists.txt
+++ b/src/components/application_manager/test/message_helper/CMakeLists.txt
@@ -40,7 +40,7 @@ set(LIBRARIES
ApplicationManager
MessageHelper
jsoncpp
- Policy
+ PolicyStatic
connectionHandler
MediaManager
Resumption
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
index d0fbe696cd..a174d74d5d 100644
--- a/src/components/application_manager/test/message_helper/message_helper_test.cc
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -1084,6 +1084,27 @@ TEST_F(MessageHelperTest, SendNaviSetVideoConfigRequest) {
EXPECT_EQ(480, msg_params[strings::config][strings::height].asInt());
}
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_SUCCESS) {
+ const WindowID window_id = 145;
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ message[strings::msg_params][strings::window_id] = window_id;
+ EXPECT_EQ(window_id,
+ MessageHelper::ExtractWindowIdFromSmartObject(
+ message[strings::msg_params]));
+}
+
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromEmptyMessage) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Map);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ MessageHelper::ExtractWindowIdFromSmartObject(message));
+}
+
+TEST_F(MessageHelperTest, ExtractWindowIdFromSmartObject_FromWrongType) {
+ smart_objects::SmartObject message(smart_objects::SmartType_Array);
+ EXPECT_EQ(mobile_apis::PredefinedWindows::DEFAULT_WINDOW,
+ MessageHelper::ExtractWindowIdFromSmartObject(message));
+}
+
} // namespace application_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
index 0629619397..cccadc5a9d 100644
--- a/src/components/application_manager/test/mock_message_helper.cc
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -258,10 +258,11 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateMessageForHMI(
}
void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl,
+ ApplicationSharedPtr application,
+ const WindowID window_id,
ApplicationManager& application_manager) {
MockMessageHelper::message_helper_mock()->SendHMIStatusNotification(
- application_impl, application_manager);
+ application, window_id, application_manager);
}
void MessageHelper::SendUpdateSDLResponse(const std::string& result,
@@ -366,20 +367,25 @@ std::string MessageHelper::CommonLanguageToString(
return MockMessageHelper::message_helper_mock()->CommonLanguageToString(lang);
}
+std::string MessageHelper::MobileLanguageToString(
+ mobile_apis::Language::eType lang) {
+ return MockMessageHelper::message_helper_mock()->MobileLanguageToString(lang);
+}
+
smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
ApplicationConstSharedPtr app,
- const protocol_handler::SessionObserver& session_observer,
const policy::PolicyHandlerInterface& policy_handler,
hmi_apis::Common_HMILevel::eType level,
bool send_policy_priority,
ApplicationManager& app_mngr) {
return MockMessageHelper::message_helper_mock()->GetBCActivateAppRequestToHMI(
- app,
- session_observer,
- policy_handler,
- level,
- send_policy_priority,
- app_mngr);
+ app, policy_handler, level, send_policy_priority, app_mngr);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::GetBCCloseApplicationRequestToHMI(
+ ApplicationConstSharedPtr app, ApplicationManager& app_mngr) {
+ return MockMessageHelper::message_helper_mock()
+ ->GetBCCloseApplicationRequestToHMI(app, app_mngr);
}
ns_smart_device_link::ns_smart_objects::SmartObjectSPtr
@@ -403,6 +409,16 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
void MessageHelper::SubscribeApplicationToSoftButton(
smart_objects::SmartObject& message_params,
ApplicationSharedPtr app,
+ int32_t function_id,
+ const WindowID window_id) {
+ return MockMessageHelper::message_helper_mock()
+ ->SubscribeApplicationToSoftButton(
+ message_params, app, function_id, window_id);
+}
+
+void MessageHelper::SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
int32_t function_id) {
return MockMessageHelper::message_helper_mock()
->SubscribeApplicationToSoftButton(message_params, app, function_id);
@@ -523,6 +539,12 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
return MockMessageHelper::message_helper_mock()->PrintSmartObject(object);
}
+WindowID MessageHelper::ExtractWindowIdFromSmartObject(
+ const smart_objects::SmartObject& s_map) {
+ return MockMessageHelper::message_helper_mock()
+ ->ExtractWindowIdFromSmartObject(s_map);
+}
+
void MessageHelper::SendSetAppIcon(const uint32_t app_id,
const std::string& icon_path,
ApplicationManager& application_manager) {
@@ -589,4 +611,19 @@ void MessageHelper::BroadcastCapabilityUpdate(
MockMessageHelper::message_helper_mock()->BroadcastCapabilityUpdate(
msg_params, app_mngr);
}
+
+smart_objects::SmartObjectList MessageHelper::CreateUICreateWindowRequestsToHMI(
+ application_manager::ApplicationSharedPtr application,
+ ApplicationManager& app_mngr,
+ const smart_objects::SmartObject& windows_info) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateUICreateWindowRequestsToHMI(application, app_mngr, windows_info);
+}
+
+smart_objects::SmartObjectSPtr
+MessageHelper::CreateDisplayCapabilityUpdateToMobile(
+ const smart_objects::SmartObject& system_capabilities, Application& app) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateDisplayCapabilityUpdateToMobile(system_capabilities, app);
+}
} // namespace application_manager
diff --git a/src/components/application_manager/test/policy_handler_test.cc b/src/components/application_manager/test/policy_handler_test.cc
index 458b065cdd..6af4c4f018 100644
--- a/src/components/application_manager/test/policy_handler_test.cc
+++ b/src/components/application_manager/test/policy_handler_test.cc
@@ -91,6 +91,8 @@ using ::testing::SetArgReferee;
typedef NiceMock<application_manager_test::MockRPCService> MockRPCService;
const std::string kDummyData = "some_data";
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
class PolicyHandlerTest : public ::testing::Test {
public:
@@ -233,10 +235,10 @@ class PolicyHandlerTest : public ::testing::Test {
void TestOnPermissionsUpdated(const std::string& default_hmi_level,
const mobile_apis::HMILevel::eType hmi_level) {
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(default_hmi_level))
@@ -247,7 +249,7 @@ class PolicyHandlerTest : public ::testing::Test {
Permissions permissions;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, permissions, default_hmi_level);
+ kDeviceId, kPolicyAppId_, permissions, default_hmi_level);
}
void CreateFunctionalGroupPermission(
@@ -494,31 +496,31 @@ TEST_F(PolicyHandlerTest, UnloadPolicyLibrary_method_ExpectLibraryUnloaded) {
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_method_With2Parameters) {
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillOnce(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
// Act
Permissions perms;
- policy_handler_.OnPermissionsUpdated(kPolicyAppId_, perms);
+ policy_handler_.OnPermissionsUpdated(kDeviceId, kPolicyAppId_, perms);
}
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_TwoParams_InvalidApp_UNSUCCESS) {
std::shared_ptr<application_manager_test::MockApplication> invalid_app;
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillOnce(Return(invalid_app));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(_, _, _))
.Times(0);
Permissions permissions;
- policy_handler_.OnPermissionsUpdated(kPolicyAppId_, permissions);
+ policy_handler_.OnPermissionsUpdated(kDeviceId, kPolicyAppId_, permissions);
}
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_InvalidApp_UNSUCCESS) {
std::shared_ptr<application_manager_test::MockApplication> invalid_app;
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.WillOnce(Return(mock_app_))
.WillOnce(Return(invalid_app));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
@@ -526,7 +528,8 @@ TEST_F(PolicyHandlerTest, OnPermissionsUpdated_InvalidApp_UNSUCCESS) {
SendOnPermissionsChangeNotification(kAppId1_, _, _));
Permissions permissions;
- policy_handler_.OnPermissionsUpdated(kPolicyAppId_, permissions, "HMI_FULL");
+ policy_handler_.OnPermissionsUpdated(
+ kDeviceId, kPolicyAppId_, permissions, "HMI_FULL");
}
TEST_F(PolicyHandlerTest, OnPermissionsUpdated_HmiLevelInvalidEnum_UNSUCCESS) {
@@ -544,25 +547,26 @@ TEST_F(PolicyHandlerTest,
const std::string new_kHmiLevel_string = "HMI_FULL";
mobile_apis::HMILevel::eType new_hmi_level = mobile_apis::HMILevel::HMI_FULL;
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.Times(2)
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
EXPECT_CALL(app_manager_, state_controller())
.WillRepeatedly(ReturnRef(mock_state_controller));
- EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, true));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_, kDefaultWindowId, new_hmi_level, true));
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, perms, new_kHmiLevel_string);
+ kDeviceId, kPolicyAppId_, perms, new_kHmiLevel_string);
}
TEST_F(PolicyHandlerTest,
@@ -572,25 +576,26 @@ TEST_F(PolicyHandlerTest,
mobile_apis::HMILevel::eType new_hmi_level =
mobile_apis::HMILevel::HMI_LIMITED;
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.Times(2)
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
EXPECT_CALL(app_manager_, state_controller())
.WillRepeatedly(ReturnRef(mock_state_controller));
- EXPECT_CALL(mock_state_controller, SetRegularState(_, new_hmi_level, false));
+ EXPECT_CALL(mock_state_controller,
+ SetRegularState(_, kDefaultWindowId, new_hmi_level, false));
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, perms, new_kHmiLevel_string);
+ kDeviceId, kPolicyAppId_, perms, new_kHmiLevel_string);
}
TEST_F(PolicyHandlerTest,
@@ -599,14 +604,14 @@ TEST_F(PolicyHandlerTest,
std::string new_kHmiLevel_string = "HMI_FULL";
mobile_apis::HMILevel::eType new_hmi_level = mobile_apis::HMILevel::HMI_FULL;
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId, kPolicyAppId_))
.Times(2)
.WillRepeatedly(Return(mock_app_));
EXPECT_CALL(*mock_app_, app_id()).WillOnce(Return(kAppId1_));
EXPECT_CALL(mock_message_helper_, StringToHMILevel(new_kHmiLevel_string))
.WillOnce(Return(new_hmi_level));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(mock_message_helper_,
SendOnPermissionsChangeNotification(kAppId1_, _, _));
@@ -615,7 +620,7 @@ TEST_F(PolicyHandlerTest,
// Act
Permissions perms;
policy_handler_.OnPermissionsUpdated(
- kPolicyAppId_, perms, new_kHmiLevel_string);
+ kDeviceId, kPolicyAppId_, perms, new_kHmiLevel_string);
}
TEST_F(PolicyHandlerTest, GetPriority) {
@@ -636,25 +641,20 @@ TEST_F(PolicyHandlerTest, CheckPermissions) {
const uint32_t device = 3;
const mobile_apis::HMILevel::eType hmi_level =
mobile_apis::HMILevel::HMI_NONE;
- EXPECT_CALL(*mock_app_, hmi_level()).WillOnce(Return(hmi_level));
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
+ .WillOnce(Return(hmi_level));
EXPECT_CALL(*mock_app_, device()).WillOnce(Return(device));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
-#ifdef EXTERNAL_PROPRIETARY_MODE
- EXPECT_CALL(
- *mock_policy_manager_,
- CheckPermissions(kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _));
-
-#else // EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(*mock_policy_manager_,
CheckPermissions(
kDeviceId, kPolicyAppId_, kHmiLevel_, kRpc_, kRpc_params, _));
-#endif // EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(mock_message_helper_, StringifiedHMILevel(hmi_level))
.WillOnce(Return(kHmiLevel_));
EXPECT_CALL(mock_message_helper_, GetDeviceMacAddressForHandle(device, _))
.WillOnce(Return(kDeviceId));
// Act
- policy_handler_.CheckPermissions(mock_app_, kRpc_, kRpc_params, result);
+ policy_handler_.CheckPermissions(
+ mock_app_, kDefaultWindowId, kRpc_, kRpc_params, result);
}
TEST_F(PolicyHandlerTest, GetNotificationsNumber) {
@@ -681,9 +681,9 @@ TEST_F(PolicyHandlerTest, GetDefaultHmi) {
EnablePolicyAndPolicyManagerMock();
// Check expectations
EXPECT_CALL(*mock_policy_manager_,
- GetDefaultHmi(kPolicyAppId_, &default_hmi_));
+ GetDefaultHmi(kDeviceId_, kPolicyAppId_, &default_hmi_));
// Act
- policy_handler_.GetDefaultHmi(kPolicyAppId_, &default_hmi_);
+ policy_handler_.GetDefaultHmi(kDeviceId_, kPolicyAppId_, &default_hmi_);
}
TEST_F(PolicyHandlerTest, GetInitialAppData) {
@@ -882,12 +882,14 @@ void PolicyHandlerTest::TestActivateApp(const uint32_t connection_key,
#endif // EXTERNAL_PROPRIETARY_MODE
EXPECT_CALL(*application1, policy_app_id()).WillOnce(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kMacAddr_, kPolicyAppId_))
.WillOnce(Return(permissions));
ON_CALL(*mock_policy_manager_, Increment(_, _)).WillByDefault(Return());
EXPECT_CALL(*mock_policy_manager_, RemovePendingPermissionChanges(_));
EXPECT_CALL(mock_message_helper_, SendSDLActivateAppResponse(_, _, _));
ON_CALL(*application1, app_id()).WillByDefault(Return(kAppId1_));
+ ON_CALL(*application1, mac_address()).WillByDefault(ReturnRef(kMacAddr_));
// Act
policy_handler_.OnActivateApp(connection_key, correlation_id);
}
@@ -936,12 +938,14 @@ TEST_F(PolicyHandlerTest, OnActivateApp_AppIsRevoked_AppNotActivated) {
// Check expectations
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDefaultId, kPolicyAppId_))
.WillOnce(Return(permissions));
ON_CALL(*mock_policy_manager_, Increment(_, _)).WillByDefault(Return());
EXPECT_CALL(*mock_policy_manager_, RemovePendingPermissionChanges(_));
EXPECT_CALL(mock_message_helper_, SendSDLActivateAppResponse(_, _, _));
ON_CALL(*mock_app_, app_id()).WillByDefault(Return(kAppId1_));
+ ON_CALL(*mock_app_, mac_address()).WillByDefault(ReturnRef(kDefaultId));
// Act
policy_handler_.OnActivateApp(kConnectionKey_, kCorrelationKey_);
}
@@ -963,10 +967,10 @@ void PolicyHandlerTest::OnPendingPermissionChangePrecondition(
std::shared_ptr<application_manager_test::MockApplication> application =
std::make_shared<application_manager_test::MockApplication>();
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
- .WillOnce(Return(application));
+ EXPECT_CALL(app_manager_, application(_, _)).WillOnce(Return(application));
EXPECT_CALL(*application, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*application, hmi_level()).WillRepeatedly(Return(hmi_level));
+ EXPECT_CALL(*application, hmi_level(kDefaultWindowId))
+ .WillRepeatedly(Return(hmi_level));
}
TEST_F(PolicyHandlerTest,
@@ -980,13 +984,13 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _))
.Times(0);
-
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInLimitedConsentNeeded) {
@@ -998,12 +1002,13 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInLimitedConsentNeeded) {
// Check expectations
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppLimitedAndRevoked) {
@@ -1020,17 +1025,19 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppLimitedAndRevoked) {
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
EXPECT_CALL(mock_state_controller,
SetRegularState(_,
+ kDefaultWindowId,
mobile_apis::HMILevel::HMI_NONE,
mobile_apis::AudioStreamingState::NOT_AUDIBLE,
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
true));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInBackgroundAndRevoked) {
@@ -1044,12 +1051,13 @@ TEST_F(PolicyHandlerTest, OnPendingPermissionChange_AppInBackgroundAndRevoked) {
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest,
@@ -1066,7 +1074,8 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(mock_message_helper_,
@@ -1083,7 +1092,7 @@ TEST_F(PolicyHandlerTest,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest,
@@ -1096,13 +1105,14 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _));
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(*mock_policy_manager_,
RemovePendingPermissionChanges(kPolicyAppId_));
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest,
@@ -1121,7 +1131,8 @@ TEST_F(PolicyHandlerTest,
SendOnAppPermissionsChangedNotification(kAppId1_, _, _))
.Times(0);
- EXPECT_CALL(*mock_policy_manager_, GetAppPermissionsChanges(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ GetAppPermissionsChanges(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(permissions));
EXPECT_CALL(mock_message_helper_,
@@ -1138,7 +1149,7 @@ TEST_F(PolicyHandlerTest,
RemovePendingPermissionChanges(kPolicyAppId_));
// Act
- policy_handler_.OnPendingPermissionChange(kPolicyAppId_);
+ policy_handler_.OnPendingPermissionChange(kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, PTExchangeAtUserRequest) {
@@ -1234,7 +1245,7 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) {
// Check expectations
std::shared_ptr<application_manager_test::MockApplication> application =
std::make_shared<application_manager_test::MockApplication>();
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(application));
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
@@ -1251,10 +1262,11 @@ TEST_F(PolicyHandlerTest, OnCurrentDeviceIdUpdateRequired) {
_,
_,
_,
- _));
+ _))
+ .WillOnce(DoAll(SetArgPointee<3>(kDeviceId_), Return(0)));
// Act
- policy_handler_.OnCurrentDeviceIdUpdateRequired(kPolicyAppId_);
+ policy_handler_.OnCurrentDeviceIdUpdateRequired(handle, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnSystemInfoChanged) {
@@ -1303,11 +1315,17 @@ TEST_F(PolicyHandlerTest, GetAppRequestTypes) {
// Arrange
EnablePolicy();
ChangePolicyManagerToMock();
- // Check expectations
+ const transport_manager::DeviceHandle handle = 0u;
+// Check expectations
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(handle, kPolicyAppId_))
+ .WillOnce(Return(std::vector<std::string>()));
+#else
EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(kPolicyAppId_))
.WillOnce(Return(std::vector<std::string>()));
+#endif
// Act
- policy_handler_.GetAppRequestTypes(kPolicyAppId_);
+ policy_handler_.GetAppRequestTypes(handle, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnVIIsReady) {
@@ -1376,13 +1394,14 @@ TEST_F(PolicyHandlerTest, SendOnAppPermissionsChanged) {
std::shared_ptr<application_manager_test::MockApplication> application =
std::make_shared<application_manager_test::MockApplication>();
// Check expectations
- EXPECT_CALL(app_manager_, application_by_policy_id(kPolicyAppId_))
+ EXPECT_CALL(app_manager_, application(kDeviceId_, kPolicyAppId_))
.WillOnce(Return(application));
EXPECT_CALL(mock_message_helper_,
SendOnAppPermissionsChangedNotification(_, _, _));
AppPermissions permissions(kPolicyAppId_);
// Act
- policy_handler_.SendOnAppPermissionsChanged(permissions, kPolicyAppId_);
+ policy_handler_.SendOnAppPermissionsChanged(
+ permissions, kDeviceId_, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, OnPTExchangeNeeded) {
@@ -1400,11 +1419,12 @@ TEST_F(PolicyHandlerTest, AddApplication) {
// Check expectations
EXPECT_CALL(
*mock_policy_manager_,
- AddApplication(kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT)))
+ AddApplication(
+ kMacAddr_, kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT)))
.WillOnce(Return(std::make_shared<utils::CallNothing>()));
// Act
- policy_handler_.AddApplication(kPolicyAppId_,
- HmiTypes(policy_table::AHT_DEFAULT));
+ policy_handler_.AddApplication(
+ kMacAddr_, kPolicyAppId_, HmiTypes(policy_table::AHT_DEFAULT));
}
TEST_F(PolicyHandlerTest, HeartBeatTimeout) {
@@ -1439,9 +1459,10 @@ TEST_F(PolicyHandlerTest, OnAppRegisteredOnMobile) {
EnablePolicyAndPolicyManagerMock();
// Check expectations
- EXPECT_CALL(*mock_policy_manager_, OnAppRegisteredOnMobile(kPolicyAppId_));
+ EXPECT_CALL(*mock_policy_manager_,
+ OnAppRegisteredOnMobile(kDeviceId, kPolicyAppId_));
// Act
- policy_handler_.OnAppRegisteredOnMobile(kPolicyAppId_);
+ policy_handler_.OnAppRegisteredOnMobile(kDeviceId, kPolicyAppId_);
}
TEST_F(PolicyHandlerTest, IsRequestTypeAllowed) {
@@ -1452,13 +1473,20 @@ TEST_F(PolicyHandlerTest, IsRequestTypeAllowed) {
mobile_apis::RequestType::eType type =
mobile_apis::RequestType::eType::EMERGENCY;
+ const transport_manager::DeviceHandle handle = 0u;
+
EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypesState(kPolicyAppId_))
.WillOnce(Return(policy::RequestType::State::AVAILABLE));
-
+#ifdef EXTERNAL_PROPRIETARY_MODE
+ EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(handle, kPolicyAppId_))
+ .WillOnce(Return(std::vector<std::string>({"HTTP"})));
+#else
EXPECT_CALL(*mock_policy_manager_, GetAppRequestTypes(kPolicyAppId_))
.WillOnce(Return(std::vector<std::string>({"HTTP"})));
+#endif
// Act
- EXPECT_FALSE(policy_handler_.IsRequestTypeAllowed(kPolicyAppId_, type));
+ EXPECT_FALSE(
+ policy_handler_.IsRequestTypeAllowed(handle, kPolicyAppId_, type));
}
TEST_F(PolicyHandlerTest, IsRequestSubTypeAllowed) {
@@ -1848,8 +1876,9 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
connection_handler::DeviceHandle test_device_id = 100u;
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
- EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ EXPECT_CALL(conn_handler, GetDeviceID(kDeviceId, _))
.WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
test_app.insert(mock_app_);
@@ -1859,12 +1888,13 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentAllowed) {
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
.WillOnce(Return(true));
+ EXPECT_CALL(
+ *mock_policy_manager_,
+ ReactOnUserDevConsentForApp(test_device_id, kPolicyAppId_, is_allowed));
EXPECT_CALL(*mock_policy_manager_,
- ReactOnUserDevConsentForApp(kPolicyAppId_, is_allowed));
- EXPECT_CALL(*mock_policy_manager_,
- SendNotificationOnPermissionsUpdated(kPolicyAppId_));
+ SendNotificationOnPermissionsUpdated(kDeviceId, kPolicyAppId_));
- policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+ policy_handler_.OnDeviceConsentChanged(kDeviceId, is_allowed);
}
TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
@@ -1872,27 +1902,29 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_ConsentNotAllowed) {
// Arrange
EnablePolicyAndPolicyManagerMock();
- connection_handler::DeviceHandle test_device_id = 100u;
+ connection_handler::DeviceHandle handle = 100u;
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
// Check expectations
- EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
- .WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
+ EXPECT_CALL(conn_handler, GetDeviceID(kMacAddr_, _))
+ .WillOnce(DoAll(SetArgPointee<1>(handle), Return(true)));
test_app.insert(mock_app_);
- EXPECT_CALL(*mock_app_, device()).WillOnce(Return(test_device_id));
+ EXPECT_CALL(*mock_app_, device()).WillOnce(Return(handle));
EXPECT_CALL(*mock_app_, policy_app_id()).WillOnce(Return(kPolicyAppId_));
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
.WillOnce(Return(true));
- EXPECT_CALL(*mock_policy_manager_, ReactOnUserDevConsentForApp(_, _))
+ EXPECT_CALL(*mock_policy_manager_,
+ ReactOnUserDevConsentForApp(handle, kPolicyAppId_, is_allowed))
.Times(0);
- EXPECT_CALL(*mock_policy_manager_, SendNotificationOnPermissionsUpdated(_))
+ EXPECT_CALL(*mock_policy_manager_,
+ SendNotificationOnPermissionsUpdated(kMacAddr_, kPolicyAppId_))
.Times(0);
- policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+ policy_handler_.OnDeviceConsentChanged(kMacAddr_, is_allowed);
}
TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
@@ -1903,8 +1935,9 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
connection_handler::DeviceHandle test_device_id = 100u;
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
+ EXPECT_CALL(app_manager_, applications()).WillRepeatedly(Return(app_set));
- EXPECT_CALL(conn_handler, GetDeviceID(kPolicyAppId_, _))
+ EXPECT_CALL(conn_handler, GetDeviceID(kMacAddr_, _))
.WillOnce(DoAll(SetArgPointee<1>(test_device_id), Return(true)));
test_app.insert(mock_app_);
@@ -1916,12 +1949,13 @@ TEST_F(PolicyHandlerTest, OnDeviceConsentChanged_PredatePolicyNotAllowed) {
EXPECT_CALL(*mock_policy_manager_, IsPredataPolicy(kPolicyAppId_))
.WillOnce(Return(false));
+ EXPECT_CALL(
+ *mock_policy_manager_,
+ ReactOnUserDevConsentForApp(test_device_id, kPolicyAppId_, is_allowed));
EXPECT_CALL(*mock_policy_manager_,
- ReactOnUserDevConsentForApp(kPolicyAppId_, is_allowed));
- EXPECT_CALL(*mock_policy_manager_,
- SendNotificationOnPermissionsUpdated(kPolicyAppId_));
+ SendNotificationOnPermissionsUpdated(kMacAddr_, kPolicyAppId_));
- policy_handler_.OnDeviceConsentChanged(kPolicyAppId_, is_allowed);
+ policy_handler_.OnDeviceConsentChanged(kMacAddr_, is_allowed);
}
#ifdef ENABLE_SECURITY
#ifdef EXTERNAL_PROPRIETARY_MODE
@@ -1972,7 +2006,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_GetDefaultMacAddress) {
test_app.insert(mock_app_);
EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(app_manager_, connection_handler())
.WillOnce(ReturnRef(conn_handler));
@@ -1995,7 +2029,7 @@ void PolicyHandlerTest::GetAppIDForSending() {
// Check expectations
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, IsRegistered()).WillOnce(Return(true));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
EXPECT_CALL(mock_session_observer,
GetDataOnDeviceID(
@@ -2022,7 +2056,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_full_id = 1;
EXPECT_CALL(*mock_app_in_full, app_id())
.WillRepeatedly(Return(app_in_full_id));
- EXPECT_CALL(*mock_app_in_full, hmi_level())
+ EXPECT_CALL(*mock_app_in_full, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
ON_CALL(*mock_app_in_full, IsRegistered()).WillByDefault(Return(true));
@@ -2034,7 +2068,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_limited_id = 2;
EXPECT_CALL(*mock_app_in_limited, app_id())
.WillRepeatedly(Return(app_in_limited_id));
- EXPECT_CALL(*mock_app_in_limited, hmi_level())
+ EXPECT_CALL(*mock_app_in_limited, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_LIMITED));
ON_CALL(*mock_app_in_limited, IsRegistered()).WillByDefault(Return(true));
@@ -2046,7 +2080,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_background_id = 3;
EXPECT_CALL(*mock_app_in_background, app_id())
.WillRepeatedly(Return(app_in_background_id));
- EXPECT_CALL(*mock_app_in_background, hmi_level())
+ EXPECT_CALL(*mock_app_in_background, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_BACKGROUND));
ON_CALL(*mock_app_in_background, IsRegistered()).WillByDefault(Return(true));
@@ -2057,7 +2091,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyIdButNone) {
const uint32_t app_in_none_id = 4;
EXPECT_CALL(*mock_app_in_none, app_id())
.WillRepeatedly(Return(app_in_none_id));
- EXPECT_CALL(*mock_app_in_none, hmi_level())
+ EXPECT_CALL(*mock_app_in_none, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app_in_none, IsRegistered()).Times(0);
@@ -2087,7 +2121,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
const uint32_t app_in_none_id_1 = 1;
EXPECT_CALL(*mock_app_in_none_1, app_id())
.WillRepeatedly(Return(app_in_none_id_1));
- EXPECT_CALL(*mock_app_in_none_1, hmi_level())
+ EXPECT_CALL(*mock_app_in_none_1, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_FULL));
ON_CALL(*mock_app_in_none_1, IsRegistered()).WillByDefault(Return(true));
@@ -2099,7 +2133,7 @@ TEST_F(PolicyHandlerTest, GetAppIdForSending_ExpectReturnAnyAppInNone) {
const uint32_t app_in_none_id_2 = 2;
EXPECT_CALL(*mock_app_in_none_2, app_id())
.WillRepeatedly(Return(app_in_none_id_2));
- EXPECT_CALL(*mock_app_in_none_2, hmi_level())
+ EXPECT_CALL(*mock_app_in_none_2, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_api::HMILevel::HMI_NONE));
ON_CALL(*mock_app_in_none_2, IsRegistered()).WillByDefault(Return(true));
@@ -2134,7 +2168,7 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, policy_app_id())
.WillRepeatedly(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
@@ -2161,7 +2195,7 @@ TEST_F(PolicyHandlerTest,
EXPECT_CALL(*mock_app_, app_id()).WillRepeatedly(Return(kAppId1_));
EXPECT_CALL(*mock_app_, policy_app_id())
.WillRepeatedly(Return(kPolicyAppId_));
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(*mock_app_, IsRegistered()).WillRepeatedly(Return(true));
@@ -2189,9 +2223,9 @@ TEST_F(PolicyHandlerTest, CanUpdate_TwoApplicationForSending_SUCCESS) {
std::shared_ptr<application_manager_test::MockApplication> second_mock_app =
std::make_shared<application_manager_test::MockApplication>();
- EXPECT_CALL(*mock_app_, hmi_level())
+ EXPECT_CALL(*mock_app_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_FULL));
- EXPECT_CALL(*second_mock_app, hmi_level())
+ EXPECT_CALL(*second_mock_app, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_LIMITED));
EXPECT_CALL(*second_mock_app, app_id()).WillRepeatedly(Return(kAppId2_));
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
index a82358b451..899fc00846 100644
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
@@ -35,10 +35,12 @@
#include "application_manager/application.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/display_capabilities_builder.h"
#include "application_manager/mock_app_extension.h"
#include "application_manager/mock_application.h"
#include "application_manager/mock_help_prompt_manager.h"
#include "application_manager/mock_resumption_data.h"
+#include "application_manager/mock_rpc_service.h"
#include "application_manager/resumption/resume_ctrl_impl.h"
#include "application_manager/usage_statistics.h"
#include "config_profile/profile.h"
@@ -73,6 +75,12 @@ using namespace application_manager_test;
using namespace resumption;
using namespace mobile_apis::HMILevel;
+namespace {
+const WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const int32_t kDefaultHmiAppId = 111;
+} // namespace
+
class ResumeCtrlTest : public ::testing::Test {
protected:
ResumeCtrlTest()
@@ -156,6 +164,43 @@ class ResumeCtrlTest : public ::testing::Test {
ON_CALL(*mock_app_, is_cloud_app()).WillByDefault(Return(false));
}
+ smart_objects::SmartObjectSPtr CreateStubCreateWindowRequest(
+ const std::string window_name,
+ const WindowID window_id,
+ const mobile_apis::WindowType::eType window_type) const {
+ auto request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+
+ params[strings::correlation_id] = window_id;
+
+ msg_params[strings::window_name] = window_name;
+ msg_params[strings::window_id] = window_id;
+ msg_params[strings::window_type] = window_type;
+ msg_params[strings::app_id] = kDefaultHmiAppId;
+
+ (*request)[strings::msg_params] = msg_params;
+ (*request)[strings::params] = params;
+
+ return request;
+ }
+
+ smart_objects::SmartObjectSPtr CreateStubCreateWindowResponse(
+ const int32_t correlation_id,
+ const hmi_apis::Common_Result::eType result_code) const {
+ auto response = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ smart_objects::SmartObject params(smart_objects::SmartType_Map);
+
+ params[strings::correlation_id] = correlation_id;
+ params[hmi_response::code] = result_code;
+
+ (*response)[strings::params] = params;
+
+ return response;
+ }
+
NiceMock<event_engine_test::MockEventDispatcher> mock_event_dispatcher_;
application_manager_test::MockApplicationManagerSettings
mock_application_manager_settings_;
@@ -185,6 +230,7 @@ class ResumeCtrlTest : public ::testing::Test {
const std::string kNaviLowbandwidthLevel_;
const std::string kProjectionLowbandwidthLevel_;
const std::string kMediaLowbandwidthLevel_;
+ NiceMock<application_manager_test::MockRPCService> mock_rpc_service_;
};
/**
@@ -572,12 +618,231 @@ TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToWayPoints) {
mobile_apis::HMILevel::HMI_FULL;
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(hmi_test_level));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, hmi_test_level));
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, hmi_test_level));
const bool result = res_ctrl_->StartResumption(mock_app_, kHash_);
EXPECT_TRUE(result);
}
+TEST_F(ResumeCtrlTest,
+ RestoreAppWidgets_AppWithWidgets_SendCreateWindowRequests) {
+ using namespace smart_objects;
+ using namespace application_manager;
+ GetInfoFromApp();
+ const uint32_t count_of_widgets = 10u;
+
+ auto create_window_info_so = []() -> SmartObject {
+ SmartObject widgets_info(SmartType_Array);
+ for (uint32_t i = 0; i < count_of_widgets; ++i) {
+ SmartObject widget_info(SmartType_Map);
+ widget_info[strings::associated_service_type] = "ServiceType";
+ widget_info[strings::duplicate_updates_from_window_id] = 0;
+ widget_info[strings::window_name] =
+ std::string("Widget ") + std::to_string(i + 1);
+ widget_info[strings::window_type] =
+ static_cast<int32_t>(mobile_apis::WindowType::WIDGET);
+ widget_info[strings::window_id] = i + 1;
+ widgets_info[widgets_info.length()] = widget_info;
+ }
+ return widgets_info;
+ };
+
+ auto create_saved_app_so = [&create_window_info_so, this]() -> SmartObject {
+ smart_objects::SmartObject saved_app;
+ const auto test_app_widgets = create_window_info_so();
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = test_app_widgets;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+ return saved_app;
+ };
+
+ const auto saved_app = create_saved_app_so();
+
+ const auto hmi_request = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ const auto hmi_requests =
+ smart_objects::SmartObjectList(count_of_widgets, hmi_request);
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+ EXPECT_CALL(
+ *application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, saved_app[strings::windows_info]))
+ .WillOnce(Return(hmi_requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .Times(count_of_widgets)
+ .WillRepeatedly(Return(true));
+
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+}
+
+TEST_F(ResumeCtrlTest,
+ RestoreWidgetsHMIState_AppWithWidgets_AddWidgetsInternally) {
+ const uint32_t count_of_widgets = 10u;
+
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+ smart_objects::SmartObjectList responses;
+ for (uint32_t i = 0; i < count_of_widgets; ++i) {
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = i + 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+ responses.push_back(CreateStubCreateWindowResponse(
+ window_id, hmi_apis::Common_Result::SUCCESS));
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .WillRepeatedly(Return(nullptr));
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _));
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _));
+ }
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .Times(count_of_widgets)
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ for (const auto& response : responses) {
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+ }
+}
+
+TEST_F(ResumeCtrlTest,
+ RestoreAppWidgets_AppWithoutWidgets_NoCreateWindowRqSent) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .Times(0);
+
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+}
+
+TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_InvalidCorrId) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ const int32_t invalid_corr_id = -1;
+ auto response = CreateStubCreateWindowResponse(
+ invalid_corr_id, hmi_apis::Common_Result::SUCCESS);
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _))
+ .Times(0);
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+}
+
+TEST_F(ResumeCtrlTest, RestoreWidgetsHMIState_HMIResponseWith_Unsuccess) {
+ smart_objects::SmartObject saved_app;
+ saved_app[strings::hash_id] = kHash_;
+ saved_app[strings::windows_info] = smart_objects::SmartObject();
+ saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
+ saved_app[application_manager::strings::hmi_level] = eType::HMI_FULL;
+
+ const int32_t correlation_id = 1;
+ auto response = CreateStubCreateWindowResponse(
+ correlation_id, hmi_apis::Common_Result::GENERIC_ERROR);
+
+ ON_CALL(mock_app_mngr_, application_by_hmi_app(kDefaultHmiAppId))
+ .WillByDefault(Return(mock_app_));
+
+ DisplayCapabilitiesBuilder builder(*mock_app_);
+ smart_objects::SmartObject stub_window_info(smart_objects::SmartType_Null);
+ auto stub_resume_cb = [](Application&, const smart_objects::SmartObject&) {};
+ builder.InitBuilder(stub_resume_cb, stub_window_info);
+ ON_CALL(*mock_app_, display_capabilities_builder())
+ .WillByDefault(ReturnRef(builder));
+
+ smart_objects::SmartObjectList requests;
+ smart_objects::SmartObjectList responses;
+
+ const auto window_type = mobile_apis::WindowType::WIDGET;
+ const WindowID window_id = 1;
+ const auto window_name = std::string("Widget ") + std::to_string(window_id);
+ requests.push_back(
+ CreateStubCreateWindowRequest(window_name, window_id, window_type));
+
+ EXPECT_CALL(mock_app_mngr_, CreateRegularState(_, window_type, _, _, _, _))
+ .Times(0);
+ EXPECT_CALL(*mock_app_, SetInitialState(window_id, window_name, _)).Times(0);
+ EXPECT_CALL(mock_state_controller_,
+ OnAppWindowAdded(_, window_id, window_type, _))
+ .Times(0);
+
+ EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
+ CreateUICreateWindowRequestsToHMI(_, _, _))
+ .WillOnce(Return(requests));
+
+ ON_CALL(mock_app_mngr_, GetRPCService())
+ .WillByDefault(ReturnRef(mock_rpc_service_));
+ EXPECT_CALL(mock_rpc_service_,
+ ManageHMICommand(_, commands::Command::SOURCE_SDL_TO_HMI))
+ .WillRepeatedly(Return(true));
+ res_ctrl_->RestoreAppWidgets(mock_app_, saved_app);
+ res_ctrl_->RestoreWidgetsHMIState(*response);
+}
+
TEST_F(ResumeCtrlTest, StartResumptionOnlyHMILevel) {
smart_objects::SmartObject saved_app;
@@ -632,7 +897,8 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInFull) {
DataAccessor<application_manager::CommandsMap> data_accessor(
command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -681,7 +947,8 @@ TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppHasDeferredResumption) {
saved_app[application_manager::strings::time_stamp] = time_stamp;
// resume into deferred level instead of restored level
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, deferred_level))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, deferred_level))
.Times(AtLeast(1));
GetInfoFromApp();
ON_CALL(*mock_storage_,
@@ -716,7 +983,8 @@ TEST_F(ResumeCtrlTest,
saved_app[application_manager::strings::hmi_level] = restored_test_type;
saved_app[application_manager::strings::time_stamp] = time_stamp;
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, eType::HMI_LIMITED))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_LIMITED))
.Times(AtLeast(1));
GetInfoFromApp();
ON_CALL(*mock_storage_,
@@ -760,7 +1028,8 @@ TEST_F(
// in this test, it is expected that the app will resume into LIMITED, which
// is the higher level among NONE and LIMITED
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, eType::HMI_LIMITED))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_LIMITED))
.Times(AtLeast(1));
GetInfoFromApp();
ON_CALL(*mock_storage_,
@@ -816,7 +1085,8 @@ TEST_F(ResumeCtrlTest, RestoreAppHMIState_RestoreHMILevelFull) {
saved_app[application_manager::strings::grammar_id] = kTestGrammarId_;
saved_app[application_manager::strings::hmi_level] = restored_test_type;
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -847,7 +1117,8 @@ TEST_F(ResumeCtrlTest, SetupDefaultHMILevel) {
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(kDefaultTestLevel_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
res_ctrl_->SetupDefaultHMILevel(mock_app_);
@@ -876,7 +1147,8 @@ TEST_F(ResumeCtrlTest,
EXPECT_CALL(*mock_app_, is_media_application()).WillRepeatedly(Return(false));
// SetRegularState() should be called with kProjectionLowbandwidthLevel_
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, eType::HMI_NONE))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, eType::HMI_NONE))
.Times(AtLeast(1));
res_ctrl_->SetupDefaultHMILevel(mock_app_);
@@ -903,7 +1175,8 @@ TEST_F(ResumeCtrlTest, ApplicationResumptiOnTimer_AppInFull) {
MockStateController state_controller;
EXPECT_CALL(mock_app_mngr_, state_controller())
.WillOnce(ReturnRef(state_controller));
- EXPECT_CALL(state_controller, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(state_controller,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -932,7 +1205,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMINone_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
const bool res =
res_ctrl_->SetAppHMIState(mock_app_, kDefaultTestLevel_, false);
@@ -945,7 +1219,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMILimited_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, false);
EXPECT_TRUE(res);
@@ -959,7 +1234,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithoutCheckPolicy) {
EXPECT_CALL(mock_app_mngr_, GetUserConsentForDevice("12345")).Times(0);
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, false);
@@ -974,7 +1250,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevAllowed) {
.WillByDefault(Return(policy::kDeviceAllowed));
EXPECT_CALL(*mock_app_, set_is_resuming(true));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, test_type))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, true);
@@ -991,7 +1268,8 @@ TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_WithPolicy_DevDisallowed) {
EXPECT_CALL(*mock_app_, set_is_resuming(true));
ON_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
.WillByDefault(Return(kDefaultTestLevel_));
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, kDefaultTestLevel_))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, kDefaultTestLevel_))
.Times(AtLeast(1));
const bool res = res_ctrl_->SetAppHMIState(mock_app_, test_type, true);
EXPECT_FALSE(res);
@@ -1246,7 +1524,8 @@ TEST_F(
DataAccessor<application_manager::CommandsMap> data_accessor(
command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
@@ -1353,7 +1632,8 @@ TEST_F(
DataAccessor<application_manager::CommandsMap> data_accessor(
command, app_set_lock_ptr_);
- EXPECT_CALL(mock_state_controller_, SetRegularState(_, restored_test_type))
+ EXPECT_CALL(mock_state_controller_,
+ SetRegularState(_, kDefaultWindowId, restored_test_type))
.Times(AtLeast(1));
GetInfoFromApp();
EXPECT_CALL(mock_app_mngr_, GetDefaultHmiLevel(const_app_))
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.cc b/src/components/application_manager/test/resumption/resumption_data_test.cc
index 29718b631c..e362064a78 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -74,6 +74,7 @@ void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
CheckGlobalProporties(
resume_app_list[am::strings::application_global_properties]);
CheckSubscriptions(resume_app_list[am::strings::application_subscriptions]);
+ CheckWindowsInfo(resume_app_list[am::strings::windows_info]);
}
void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
@@ -327,6 +328,33 @@ void ResumptionDataTest::CheckVRTitle(
EXPECT_EQ(vtitle, res_list[am::strings::vr_help_title].asString());
}
+void ResumptionDataTest::CheckWindowsInfo(sm::SmartObject& res_list) {
+ using namespace application_manager;
+ auto check_window_info = [this](
+ const smart_objects::SmartObject& window_info) {
+ using namespace application_manager;
+ const WindowID saved_window_id = window_info[strings::window_id].asInt();
+ const auto test_window_info = test_window_params_map_[saved_window_id];
+ const auto& saved_window_name =
+ window_info[strings::window_name].asString();
+ ASSERT_TRUE(0 != test_window_info.use_count());
+ const auto& window_name =
+ (*test_window_info)[strings::window_name].asString();
+ const auto& saved_duplicate_window_id =
+ window_info[strings::duplicate_updates_from_window_id].asInt();
+ const auto& saved_associated_service_type =
+ window_info[strings::associated_service_type].asString();
+ EXPECT_EQ(saved_window_name, window_name);
+ EXPECT_EQ("ServiceType", saved_associated_service_type);
+ EXPECT_EQ(0, saved_duplicate_window_id);
+ };
+
+ for (size_t i = 0; i < res_list.length(); ++i) {
+ const auto& saved_window_info = res_list[i];
+ check_window_info(saved_window_info);
+ }
+}
+
void ResumptionDataTest::PrepareData() {
mock_app_extension_ =
std::make_shared<NiceMock<application_manager_test::MockAppExtension> >();
@@ -341,9 +369,14 @@ void ResumptionDataTest::PrepareData() {
DataAccessor<am::SubMenuMap> sub_menu_m(test_submenu_map, sublock_ptr_);
DataAccessor<am::CommandsMap> commands_m(test_commands_map, comlock_ptr_);
DataAccessor<am::ChoiceSetMap> choice_set_m(test_choiceset_map, setlock_ptr_);
+ DataAccessor<am::WindowParamsMap> window_params_map(
+ test_window_params_map_, window_params_map_lock_ptr_);
SetSubscriptions();
DataAccessor<am::ButtonSubscriptions> btn_sub(btn_subscr, btnlock_ptr_);
+ SetWindowsInfo();
+ SetDefaultCurrentHmiState();
+ SetDefaultWindowIds();
ON_CALL(*app_mock, is_application_data_changed()).WillByDefault(Return(true));
@@ -352,7 +385,8 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, curHash()).WillByDefault(ReturnRef(hash_));
ON_CALL(*app_mock, get_grammar_id()).WillByDefault(Return(grammar_id_));
ON_CALL(*app_mock, device()).WillByDefault(Return(device_handle_));
- ON_CALL(*app_mock, hmi_level()).WillByDefault(Return(hmi_level_));
+ ON_CALL(*app_mock, hmi_level(mobile_apis::PredefinedWindows::DEFAULT_WINDOW))
+ .WillByDefault(Return(hmi_level_));
ON_CALL(*app_mock, app_id()).WillByDefault(Return(app_id_));
ON_CALL(*app_mock, hmi_app_id()).WillByDefault(Return(hmi_app_id_));
ON_CALL(*app_mock, IsAudioApplication()).WillByDefault(Return(is_audio_));
@@ -375,6 +409,21 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, SubscribedButtons()).WillByDefault(Return(btn_sub));
ON_CALL(*app_mock, getAppFiles()).WillByDefault(ReturnRef(app_files_map_));
+ ON_CALL(*app_mock, window_optional_params_map())
+ .WillByDefault(Return(window_params_map));
+}
+
+void ResumptionDataTest::SetDefaultCurrentHmiState() {
+ am::HmiStatePtr hmi_state =
+ std::make_shared<am::HmiState>(app_mock, mock_application_manager_);
+ hmi_state->set_window_type(mobile_apis::WindowType::WIDGET);
+
+ ON_CALL(*app_mock, CurrentHmiState(_)).WillByDefault(Return(hmi_state));
+}
+
+void ResumptionDataTest::SetDefaultWindowIds() {
+ const am::WindowIds window_ids{1, 2, 3, 4, 5};
+ ON_CALL(*app_mock, GetWindowIds()).WillByDefault(Return(window_ids));
}
void ResumptionDataTest::SetGlobalProporties() {
@@ -550,6 +599,21 @@ void ResumptionDataTest::SetSubscriptions() {
btn_subscr.insert(ButtonName::eType::OK);
}
+void ResumptionDataTest::SetWindowsInfo() {
+ using namespace application_manager;
+ const uint32_t number_of_widgets = 5;
+ for (uint32_t i = 0; i < number_of_widgets; ++i) {
+ auto window_info = std::make_shared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
+ const WindowID window_id = i + 1;
+ (*window_info)[strings::window_name] =
+ std::string("Widget ") + std::to_string(window_id);
+ (*window_info)[strings::associated_service_type] = "ServiceType";
+ (*window_info)[strings::duplicate_updates_from_window_id] = 0;
+ test_window_params_map_[window_id] = window_info;
+ }
+}
+
} // namespace resumption_test
} // namespace components
} // namespace test
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index fbada47fec..0fe40366d6 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -75,10 +75,13 @@ namespace test {
namespace components {
namespace state_controller_test {
-namespace constants {
+namespace {
const uint32_t kCorrID = 314u;
const uint32_t kHMIAppID = 2718u;
-} // namespace constants
+const am::WindowID kDefaultWindowId =
+ mobile_apis::PredefinedWindows::DEFAULT_WINDOW;
+const am::WindowID kCustomWindowId = 2;
+} // namespace
struct HmiStatesComparator {
mobile_apis::HMILevel::eType hmi_level_;
@@ -213,7 +216,11 @@ class StateControllerImplTest : public ::testing::Test {
std::vector<am::HmiStatePtr> invalid_states_for_not_audio_app;
std::vector<am::HmiStatePtr> invalid_states_for_audio_app;
std::vector<am::HmiState::StateID> valid_state_ids_;
- std::vector<am::ApplicationSharedPtr> applications_list_;
+
+ typedef std::map<am::ApplicationSharedPtr,
+ NiceMock<application_manager_test::MockApplication>*>
+ AppPtrMockMapping;
+ AppPtrMockMapping applications_list_;
connection_handler_test::MockConnectionHandlerSettings
mock_connection_handler__settings;
@@ -554,21 +561,26 @@ class StateControllerImplTest : public ::testing::Test {
// application properties, i.e. is_media_application flag from RAI and
// AppHmiTypes (NAVIGATION, etc.). Most likely logic should be changed
// after conclusion on APPLINK-20231
- std::vector<am::ApplicationSharedPtr>::iterator app = std::find_if(
- applications_list_.begin(),
- applications_list_.end(),
- [app_id](am::ApplicationSharedPtr a) { return app_id == a->app_id(); });
-
- if (app == applications_list_.end()) {
+ AppPtrMockMapping::iterator it =
+ std::find_if(applications_list_.begin(),
+ applications_list_.end(),
+ [app_id](AppPtrMockMapping::value_type& item) {
+ return app_id == item.first->app_id();
+ });
+
+ if (applications_list_.end() == it) {
return APP_TYPE_NON_MEDIA;
}
- if ((*app)->is_navi()) {
+ auto app = it->first;
+ if (app->is_navi()) {
return APP_TYPE_NAVI;
}
- if ((*app)->is_media_application()) {
+
+ if (app->is_media_application()) {
return APP_TYPE_MEDIA;
}
+
return APP_TYPE_NON_MEDIA;
}
@@ -644,17 +656,16 @@ class StateControllerImplTest : public ::testing::Test {
template <typename T, typename Q>
void TestMixState(void (StateControllerImplTest::*call_back_result)(
std::vector<am::HmiStatePtr>&, ApplicationType)) {
- std::vector<am::ApplicationSharedPtr>::iterator it_begin =
- applications_list_.begin();
- std::vector<am::ApplicationSharedPtr>::iterator it_end =
- applications_list_.end();
+ AppPtrMockMapping::iterator it_begin = applications_list_.begin();
+ AppPtrMockMapping::iterator it_end = applications_list_.end();
ApplicationType app_type;
uint32_t app_id;
am::ApplicationSharedPtr app;
+
for (; it_begin != it_end; ++it_begin) {
- app_id = (*it_begin)->app_id();
+ app_id = it_begin->first->app_id();
app_type = AppType(app_id);
- app = (*it_begin);
+ app = it_begin->first;
am::HmiStatePtr state_first = std::make_shared<T>(app, app_manager_mock_);
am::HmiStatePtr state_second =
std::make_shared<Q>(app, app_manager_mock_);
@@ -925,14 +936,14 @@ class StateControllerImplTest : public ::testing::Test {
MEDIA,
NAVI,
VC);
- applications_list_.push_back(simple_app_);
- applications_list_.push_back(media_app_);
- applications_list_.push_back(navi_app_);
- applications_list_.push_back(vc_app_);
- applications_list_.push_back(media_navi_app_);
- applications_list_.push_back(media_vc_app_);
- applications_list_.push_back(navi_vc_app_);
- applications_list_.push_back(media_navi_vc_app_);
+ applications_list_[simple_app_] = simple_app_ptr_;
+ applications_list_[media_app_] = media_app_ptr_;
+ applications_list_[navi_app_] = navi_app_ptr_;
+ applications_list_[vc_app_] = vc_app_ptr_;
+ applications_list_[media_navi_app_] = media_navi_app_ptr_;
+ applications_list_[media_vc_app_] = media_vc_app_ptr_;
+ applications_list_[navi_vc_app_] = navi_vc_app_ptr_;
+ applications_list_[media_navi_vc_app_] = media_navi_vc_app_ptr_;
}
void CheckAppConfiguration() {
ASSERT_EQ(simple_app_.get(), simple_app_ptr_);
@@ -1036,7 +1047,7 @@ class StateControllerImplTest : public ::testing::Test {
(*bc_activate_app_request)[am::strings::params]
[am::strings::correlation_id] = corr_id;
ON_CALL(message_helper_mock_,
- GetBCActivateAppRequestToHMI(_, _, _, hmi_lvl, _, _))
+ GetBCActivateAppRequestToHMI(_, _, hmi_lvl, _, _))
.WillByDefault(Return(bc_activate_app_request));
ON_CALL(app_manager_mock_, GetRPCService())
.WillByDefault(ReturnRef(mock_rpc_service_));
@@ -1044,22 +1055,36 @@ class StateControllerImplTest : public ::testing::Test {
.WillByDefault(Return(true));
}
- void ExpectSuccesfullSetHmiState(
+ void ExpectSuccessfulSetHmiState(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr old_state,
+ am::HmiStatePtr new_state) {
+ ExpectSuccessfulSetHmiState(
+ app, app_mock, kDefaultWindowId, old_state, new_state);
+ }
+
+ void ExpectSuccessfulSetHmiState(
am::ApplicationSharedPtr app,
NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::WindowID window_id,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
- EXPECT_CALL(*app_mock, CurrentHmiState())
+ EXPECT_CALL(*app_mock, CurrentHmiState(window_id))
.WillOnce(Return(old_state))
.WillOnce(Return(new_state));
- EXPECT_CALL(*app_mock,
- SetRegularState(Truly(HmiStatesComparator(new_state))));
+ EXPECT_CALL(
+ *app_mock,
+ SetRegularState(window_id, Truly(HmiStatesComparator(new_state))));
if (!HmiStatesComparator(old_state)(new_state)) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app));
- EXPECT_CALL(
- app_manager_mock_,
- OnHMILevelChanged(
- app->app_id(), old_state->hmi_level(), new_state->hmi_level()));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(app, window_id, _));
+ if (kDefaultWindowId == window_id) {
+ EXPECT_CALL(
+ app_manager_mock_,
+ OnHMILevelChanged(
+ app->app_id(), old_state->hmi_level(), new_state->hmi_level()));
+ }
}
}
@@ -1068,22 +1093,33 @@ class StateControllerImplTest : public ::testing::Test {
NiceMock<application_manager_test::MockApplication>* app_mock,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
- EXPECT_CALL(*app_mock, RegularHmiState())
+ EXPECT_CALL(*app_mock, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(old_state))
.WillOnce(Return(old_state));
- ExpectSuccesfullSetHmiState(app, app_mock, old_state, new_state);
+ ExpectSuccessfulSetHmiState(app, app_mock, old_state, new_state);
}
void ExpectAppWontChangeHmiStateDueToConflictResolving(
am::ApplicationSharedPtr app,
NiceMock<application_manager_test::MockApplication>* app_mock,
+ const am::WindowID window_id,
am::HmiStatePtr state) {
- ON_CALL(*app_mock, RegularHmiState()).WillByDefault(Return(state));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app)).Times(0);
+ ON_CALL(*app_mock, RegularHmiState(window_id)).WillByDefault(Return(state));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(app, window_id, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(app->app_id(), _, _))
.Times(0);
}
+ void ExpectAppWontChangeHmiStateDueToConflictResolving(
+ am::ApplicationSharedPtr app,
+ NiceMock<application_manager_test::MockApplication>* app_mock,
+ am::HmiStatePtr state) {
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ app, app_mock, kDefaultWindowId, state);
+ }
+
void InsertApplication(am::ApplicationSharedPtr app) {
application_set_.insert(app);
ON_CALL(app_manager_mock_, application(app->app_id()))
@@ -1135,13 +1171,14 @@ class StateControllerImplTest : public ::testing::Test {
using smart_objects::SmartObject;
namespace FunctionID = hmi_apis::FunctionID;
- EXPECT_CALL(app_mock, CurrentHmiState())
+ EXPECT_CALL(app_mock, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(NoneNotAudibleState()));
for (size_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
EXPECT_CALL(app_mock,
- AddHMIState(Truly(HmiStatesIDComparator(state_id))));
+ AddHMIState(kDefaultWindowId,
+ Truly(HmiStatesIDComparator(state_id))));
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_start_event(FunctionID::VR_Started);
@@ -1182,7 +1219,7 @@ class StateControllerImplTest : public ::testing::Test {
default:
break;
}
- EXPECT_CALL(app_mock, AddHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, AddHMIState(kDefaultWindowId, _)).Times(0);
}
}
@@ -1194,12 +1231,17 @@ class StateControllerImplTest : public ::testing::Test {
using smart_objects::SmartObject;
namespace FunctionID = hmi_apis::FunctionID;
- EXPECT_CALL(app_mock, CurrentHmiState())
+ EXPECT_CALL(app_mock, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(NoneNotAudibleState()));
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(app_mock, GetWindowIds()).WillRepeatedly(Return(window_ids));
+
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
- EXPECT_CALL(app_mock, AddHMIState(Truly(HmiStatesIDComparator(state_id))))
+ EXPECT_CALL(
+ app_mock,
+ AddHMIState(kDefaultWindowId, Truly(HmiStatesIDComparator(state_id))))
.Times(1);
switch (state_id) {
@@ -1243,16 +1285,17 @@ class StateControllerImplTest : public ::testing::Test {
break;
}
- EXPECT_CALL(app_mock, AddHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, AddHMIState(kDefaultWindowId, _)).Times(0);
}
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
- EXPECT_CALL(app_mock, RemoveHMIState(state_id)).Times(1);
+ EXPECT_CALL(app_mock, RemoveHMIState(kDefaultWindowId, state_id))
+ .Times(1);
- EXPECT_CALL(app_mock, PostponedHmiState())
+ EXPECT_CALL(app_mock, PostponedHmiState(kDefaultWindowId))
.WillOnce(Return(NoneNotAudibleState()));
- EXPECT_CALL(app_mock, RemovePostponedState());
+ EXPECT_CALL(app_mock, RemovePostponedState(kDefaultWindowId));
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
@@ -1295,7 +1338,7 @@ class StateControllerImplTest : public ::testing::Test {
break;
}
- EXPECT_CALL(app_mock, RemoveHMIState(_)).Times(0);
+ EXPECT_CALL(app_mock, RemoveHMIState(kDefaultWindowId, _)).Times(0);
}
}
};
@@ -1307,6 +1350,7 @@ TEST_F(StateControllerImplTest, OnStateChangedWithEqualStates) {
for (uint32_t i = 0; i < valid_states_for_not_audio_app_.size(); ++i) {
state_ctrl_->OnStateChanged(simple_app_,
+ kDefaultWindowId,
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[i]);
}
@@ -1317,8 +1361,9 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
for (uint32_t j = 0; j < valid_states_for_not_audio_app_.size(); ++j) {
HmiStatesComparator comp(valid_states_for_not_audio_app_[i]);
if (!comp(valid_states_for_not_audio_app_[j])) {
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
- .Times(1);
+ EXPECT_CALL(
+ message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(
app_manager_mock_,
OnHMILevelChanged(simple_app_id_,
@@ -1330,10 +1375,12 @@ TEST_F(StateControllerImplTest, OnStateChangedWithDifferentStates) {
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
}
state_ctrl_->OnStateChanged(simple_app_,
+ kDefaultWindowId,
valid_states_for_not_audio_app_[i],
valid_states_for_not_audio_app_[j]);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_)).Times(0);
+ EXPECT_CALL(message_helper_mock_, SendHMIStatusNotification(_, _, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
}
@@ -1356,10 +1403,12 @@ TEST_F(StateControllerImplTest, OnStateChangedToNone) {
SystemContext::SYSCTXT_MAIN);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- state_ctrl_->OnStateChanged(simple_app_, none_state, not_none_state);
+ state_ctrl_->OnStateChanged(
+ simple_app_, kDefaultWindowId, none_state, not_none_state);
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
- state_ctrl_->OnStateChanged(simple_app_, not_none_state, none_state);
+ state_ctrl_->OnStateChanged(
+ simple_app_, kDefaultWindowId, not_none_state, none_state);
}
TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
@@ -1377,18 +1426,21 @@ TEST_F(StateControllerImplTest, MoveSimpleAppToValidStates) {
it != valid_states_for_not_audio_app_.end();
++it) {
HmiStatePtr state_to_setup = *it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_,
OnHMILevelChanged(simple_app_id_,
initial_state->hmi_level(),
state_to_setup->hmi_level()));
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_->SetRegularState(simple_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_setup))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1413,18 +1465,21 @@ TEST_F(StateControllerImplTest, MoveAudioNotResumeAppToValidStates) {
it != valid_states_for_audio_app_.end();
++it) {
HmiStatePtr state_to_setup = *it;
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
+ EXPECT_CALL(*audio_app_mock, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(audio_app, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_,
OnHMILevelChanged(audio_app->app_id(),
initial_state->hmi_level(),
state_to_setup->hmi_level()));
EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
- state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_setup))));
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1452,7 +1507,7 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
HmiStatePtr state_to_setup = *it;
HmiStatePtr state_to_check = state_to_setup;
// First time current state is initial, then it changes to setup state
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
+ EXPECT_CALL(*audio_app_mock, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
// Audio resume app when HMI level is LIMITED or FULL gets audible state
@@ -1480,8 +1535,10 @@ TEST_F(StateControllerImplTest, MoveAudioResumeAppToValidStates) {
// Check that we set correct state
EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(state_to_check))));
- state_ctrl_->SetRegularState(media_navi_vc_app_, state_to_setup, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(state_to_check))));
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, state_to_setup, false);
initial_state = state_to_setup;
}
}
@@ -1494,11 +1551,13 @@ TEST_F(StateControllerImplTest, MoveAppFromValidStateToInvalid) {
invalid_state_it != common_invalid_states_.end();
++invalid_state_it) {
HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
EXPECT_CALL(*simple_app_ptr_, is_resuming()).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_->SetRegularState(simple_app_, invalid_state, false);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, invalid_state, false);
}
for (std::vector<HmiStatePtr>::iterator invalid_state_it =
@@ -1506,11 +1565,14 @@ TEST_F(StateControllerImplTest, MoveAppFromValidStateToInvalid) {
invalid_state_it != common_invalid_states_.end();
++invalid_state_it) {
HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState(kDefaultWindowId))
+ .Times(0);
EXPECT_CALL(*media_navi_vc_app_ptr_, is_resuming()).Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_->SetRegularState(media_navi_vc_app_, invalid_state, false);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, invalid_state, false);
}
}
@@ -1532,7 +1594,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1540,7 +1602,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
@@ -1557,14 +1620,15 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1583,14 +1647,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1607,7 +1672,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1615,7 +1680,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1633,7 +1699,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1641,7 +1707,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1660,7 +1727,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
@@ -1668,7 +1735,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1686,14 +1754,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1712,14 +1781,15 @@ TEST_F(StateControllerImplTest,
InsertApplication(app_in_full);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ ExpectSuccessfulSetHmiState(app_moved_to_limited,
app_moved_to_limited_mock,
BackgroundState(),
LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState());
- state_ctrl_->SetRegularState(app_moved_to_limited, LimitedState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_limited, kDefaultWindowId, LimitedState(), false);
}
TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
@@ -1743,7 +1813,7 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
InsertApplication(limited_app1);
InsertApplication(limited_app2);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1753,7 +1823,8 @@ TEST_F(StateControllerImplTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app2, limited_app2_mock, LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1778,7 +1849,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1789,7 +1860,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1814,7 +1886,7 @@ TEST_F(StateControllerImplTest,
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullNotAudibleState());
@@ -1825,7 +1897,8 @@ TEST_F(StateControllerImplTest,
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullNotAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullNotAudibleState(), false);
}
TEST_F(
@@ -1851,7 +1924,7 @@ TEST_F(
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1862,7 +1935,8 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullNotAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(
@@ -1888,7 +1962,7 @@ TEST_F(
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full,
+ ExpectSuccessfulSetHmiState(app_moved_to_full,
app_moved_to_full_mock,
BackgroundState(),
FullAudibleState());
@@ -1899,7 +1973,8 @@ TEST_F(
ExpectAppChangeHmiStateDueToConflictResolving(
full_app, full_app_mock, FullAudibleState(), LimitedState());
- state_ctrl_->SetRegularState(app_moved_to_full, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ app_moved_to_full, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1912,19 +1987,20 @@ TEST_F(StateControllerImplTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ ExpectSuccessfulSetHmiState(media_navi_vc_app_,
media_navi_vc_app_ptr_,
BackgroundState(),
FullAudibleState());
- EXPECT_CALL(*media_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
ExpectAppChangeHmiStateDueToConflictResolving(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, LimitedState(), BackgroundState());
- state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
TEST_F(StateControllerImplTest,
@@ -1937,19 +2013,20 @@ TEST_F(StateControllerImplTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ ExpectSuccessfulSetHmiState(media_navi_vc_app_,
media_navi_vc_app_ptr_,
BackgroundState(),
FullAudibleState());
- EXPECT_CALL(*media_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
ExpectAppChangeHmiStateDueToConflictResolving(
navi_app_, navi_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
vc_app_, vc_app_ptr_, FullAudibleState(), BackgroundState());
- state_ctrl_->SetRegularState(media_navi_vc_app_, FullAudibleState(), false);
+ state_ctrl_->SetRegularState(
+ media_navi_vc_app_, kDefaultWindowId, FullAudibleState(), false);
}
// TODO {AKozoriz} Changed logic in state_controller
@@ -1969,12 +2046,6 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
StateLevelPair(LimitedState(), Common_HMILevel::LIMITED));
hmi_states.push_back(
StateLevelPair(BackgroundState(), Common_HMILevel::BACKGROUND));
- hmi_states.push_back(
- StateLevelPair(createHmiState(HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- VideoStreamingState::NOT_STREAMABLE,
- SystemContext::SYSCTXT_MAIN),
- Common_HMILevel::NONE));
std::vector<StateLevelPair> initial_hmi_states = hmi_states;
std::vector<StateLevelPair>::iterator it = hmi_states.begin();
std::vector<StateLevelPair>::iterator it2 = initial_hmi_states.begin();
@@ -1998,9 +2069,9 @@ TEST_F(StateControllerImplTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(media_app_));
- ExpectSuccesfullSetHmiState(
+ ExpectSuccessfulSetHmiState(
media_app_, media_app_ptr_, initial_hmi_state, hmi_state);
- state_ctrl_->SetRegularState(media_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(media_app_, kDefaultWindowId, hmi_state, true);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] =
Common_Result::SUCCESS;
@@ -2056,9 +2127,10 @@ TEST_F(StateControllerImplTest, SendEventBCActivateApp_HMIReceivesError) {
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _))
+ .Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
@@ -2084,13 +2156,14 @@ TEST_F(StateControllerImplTest, ActivateAppInvalidCorrelationId) {
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(simple_app_->app_id(), _, _))
.Times(0);
SetBCActivateAppRequestToHMI(Common_HMILevel::FULL, corr_id);
- state_ctrl_->SetRegularState(simple_app_, FullNotAudibleState(), true);
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, FullNotAudibleState(), true);
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] = Common_Result::SUCCESS;
message[am::strings::params][am::strings::correlation_id] = corr_id;
@@ -2516,43 +2589,43 @@ TEST_F(StateControllerImplTest, SetRegularStateWithNewHmiLvl) {
using namespace mobile_apis;
HMILevel::eType set_lvl = HMILevel::HMI_NONE;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_LIMITED;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_FULL;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
const uint32_t corr_id = 314;
SetBCActivateAppRequestToHMI(
static_cast<hmi_apis::Common_HMILevel::eType>(set_lvl), corr_id);
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
set_lvl = HMILevel::HMI_BACKGROUND;
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
- state_ctrl_->SetRegularState(simple_app_, set_lvl);
+ state_ctrl_->SetRegularState(simple_app_, kDefaultWindowId, set_lvl);
}
TEST_F(StateControllerImplTest, SetRegularStateWithAudioStateAudible) {
@@ -2562,16 +2635,18 @@ TEST_F(StateControllerImplTest, SetRegularStateWithAudioStateAudible) {
AudioStreamingState::AUDIBLE,
VideoStreamingState::STREAMABLE,
SystemContext::SYSCTXT_MAIN);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillRepeatedly(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
AudioStreamingState::AUDIBLE,
VideoStreamingState::STREAMABLE);
}
@@ -2588,23 +2663,27 @@ TEST_F(StateControllerImplTest,
// Non-media app can't have LIMITED-AUDIO state
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
check_state = LimitedState();
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
@@ -2621,7 +2700,7 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
HmiStatePtr check_state = FullNotAudibleState();
// Non-media app can't have LIMITED-AUDIO state
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
@@ -2631,16 +2710,19 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
SendOnResumeAudioSourceToHMI(simple_app_id_, _))
.Times(0);
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))))
.Times(0);
EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
// Set state of media app after vr has stopped
check_state = LimitedState();
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(check_state))
.WillOnce(Return(check_state));
@@ -2649,11 +2731,14 @@ TEST_F(StateControllerImplTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
EXPECT_CALL(message_helper_mock_,
SendOnResumeAudioSourceToHMI(media_app_id_, _));
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))))
.Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetRegularState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2676,28 +2761,32 @@ TEST_F(StateControllerImplTest,
HmiStatePtr check_state = FullNotAudibleState();
EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*simple_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(simple_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, check_state, false);
// Set media app
check_state = LimitedState();
EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
- EXPECT_CALL(*media_app_ptr_, RegularHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
- EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState(kDefaultWindowId)).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(kDefaultWindowId, _)).Times(0);
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2730,8 +2819,10 @@ TEST_F(StateControllerImplTest,
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
EXPECT_CALL(*media_app_ptr_,
- SetPostponedState(Truly(HmiStatesComparator(check_state))));
- state_ctrl_->SetRegularState(media_app_, check_state, false);
+ SetPostponedState(kDefaultWindowId,
+ Truly(HmiStatesComparator(check_state))));
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, check_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2759,13 +2850,13 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- state_ctrl_->SetRegularState(navi_app_, hmi_state, false);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2793,15 +2884,15 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*navi_app_ptr_, SetPostponedState(_)).Times(0);
+ EXPECT_CALL(*navi_app_ptr_, SetPostponedState(kDefaultWindowId, _)).Times(0);
- state_ctrl_->SetRegularState(navi_app_, hmi_state, false);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, false);
}
TEST_F(StateControllerImplTest,
@@ -2809,7 +2900,6 @@ TEST_F(StateControllerImplTest,
using namespace hmi_apis;
using namespace smart_objects;
using namespace am::event_engine;
- using namespace constants;
const uint32_t app_id = navi_app_->app_id();
// Precondition
@@ -2833,13 +2923,13 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- state_ctrl_->SetRegularState(navi_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, true);
}
TEST_F(StateControllerImplTest,
@@ -2847,7 +2937,6 @@ TEST_F(StateControllerImplTest,
using namespace hmi_apis;
using namespace smart_objects;
using namespace am::event_engine;
- using namespace constants;
const uint32_t app_id = navi_app_->app_id();
// Precondition
@@ -2871,15 +2960,15 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
.WillRepeatedly(Return(false));
- EXPECT_CALL(*navi_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*navi_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(hmi_state));
EXPECT_CALL(app_manager_mock_, active_application())
.WillRepeatedly(Return(am::ApplicationSharedPtr()));
- EXPECT_CALL(*navi_app_ptr_, SetPostponedState(_)).Times(0);
+ EXPECT_CALL(*navi_app_ptr_, SetPostponedState(kDefaultWindowId, _)).Times(0);
- state_ctrl_->SetRegularState(navi_app_, hmi_state, true);
+ state_ctrl_->SetRegularState(navi_app_, kDefaultWindowId, hmi_state, true);
}
TEST_F(StateControllerImplTest,
@@ -2900,13 +2989,16 @@ TEST_F(StateControllerImplTest,
EXPECT_CALL(*simple_app_ptr_, keep_context()).WillOnce(Return(true));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(FullAudibleState()));
EXPECT_CALL(*simple_app_ptr_, set_keep_context(false));
HmiStatePtr new_state;
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_))
- .WillOnce(SaveArg<0>(&new_state));
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
state_ctrl_->on_event(event);
@@ -2931,12 +3023,15 @@ TEST_F(StateControllerImplTest, OnEventChangedAudioSourceAppToBackground) {
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(LimitedState()));
HmiStatePtr new_state;
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_))
- .WillOnce(SaveArg<0>(&new_state));
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _))
+ .WillOnce(SaveArg<1>(&new_state));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
state_ctrl_->on_event(event);
@@ -2955,9 +3050,13 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectHmiLevel) {
event.set_smart_object(msg);
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillOnce(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId)).Times(0);
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -2971,7 +3070,7 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedIncorrectApp) {
const am::ApplicationSharedPtr incorrect_app;
EXPECT_CALL(app_manager_mock_, application(_))
.WillOnce(Return(incorrect_app));
- EXPECT_CALL(*simple_app_ptr_, hmi_level()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId)).Times(0);
state_ctrl_->on_event(event);
}
@@ -2992,15 +3091,20 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedAudioApplication) {
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
// DeactivateApp
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(true));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -3021,16 +3125,21 @@ TEST_F(StateControllerImplTest, OnEventOnAppDeactivatedNotAudioApplication) {
EXPECT_CALL(app_manager_mock_, application(app_id))
.WillOnce(Return(simple_app_));
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, hmi_level())
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kDefaultWindowId))
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
// DeactivateApp
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(state));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(state));
EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
.WillRepeatedly(Return(false));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillOnce(Return(BackgroundState()))
.WillOnce(Return(BackgroundState()));
+
+ am::WindowIds window_ids = {kDefaultWindowId};
+ EXPECT_CALL(*simple_app_ptr_, GetWindowIds()).WillOnce(Return(window_ids));
+
state_ctrl_->on_event(event);
}
@@ -3050,25 +3159,35 @@ TEST_F(StateControllerImplTest, OnEventOnAppActivatedIncorrectApp) {
}
TEST_F(StateControllerImplTest, OnEventOnAppActivated) {
- using namespace constants;
-
smart_objects::SmartObject msg;
- for (std::vector<am::ApplicationSharedPtr>::const_iterator it =
- applications_list_.begin();
+ am::WindowIds window_ids = {kDefaultWindowId};
+
+ for (AppPtrMockMapping::const_iterator it = applications_list_.begin();
it != applications_list_.end();
++it) {
- uint32_t app_id = (*it)->app_id();
+ uint32_t app_id = it->first->app_id();
msg[am::strings::msg_params][am::strings::app_id] = app_id;
const hmi_apis::FunctionID::eType event_id =
hmi_apis::FunctionID::BasicCommunication_OnAppActivated;
am::event_engine::Event event(event_id);
event.set_smart_object(msg);
- EXPECT_CALL(app_manager_mock_, application(app_id)).WillOnce(Return(*it));
+ EXPECT_CALL(app_manager_mock_, application(app_id))
+ .WillOnce(Return(it->first));
// SetRegularState
- EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, IsAudioApplication())
- .WillRepeatedly(Return(true));
+ EXPECT_CALL(*it->second, app_id()).WillRepeatedly(Return(app_id));
+ EXPECT_CALL(*it->second, IsAudioApplication()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*it->second, GetWindowIds()).WillOnce(Return(window_ids));
+
+ const am::HmiStatePtr old_state =
+ CreateHmiStateByHmiStateType<am::HmiState>(
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE,
+ mobile_apis::VideoStreamingState::NOT_STREAMABLE,
+ mobile_apis::SystemContext::SYSCTXT_MAIN,
+ simple_app_);
+ EXPECT_CALL(*it->second, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
smart_objects::SmartObjectSPtr activate_app =
std::make_shared<smart_objects::SmartObject>();
@@ -3149,9 +3268,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
simple_app_);
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_)).Times(4);
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _)).Times(4);
const am::HmiStatePtr default_state =
CreateHmiStateByHmiStateType<am::HmiState>(
@@ -3161,12 +3280,14 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredDifferentStates) {
mobile_apis::SystemContext::SYSCTXT_MAIN,
simple_app_);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).WillOnce(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
- EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(_));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kDefaultWindowId, _));
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _));
state_ctrl_->OnApplicationRegistered(simple_app_,
@@ -3200,9 +3321,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
simple_app_);
EXPECT_CALL(*simple_app_ptr_, app_id()).WillRepeatedly(Return(app_id));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(old_state));
- EXPECT_CALL(*simple_app_ptr_, AddHMIState(_)).Times(2);
+ EXPECT_CALL(*simple_app_ptr_, AddHMIState(kDefaultWindowId, _)).Times(2);
const am::HmiStatePtr default_state =
CreateHmiStateByHmiStateType<am::HmiState>(
@@ -3211,9 +3332,9 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
mobile_apis::VideoStreamingState::NOT_STREAMABLE,
mobile_apis::SystemContext::SYSCTXT_MAIN,
simple_app_);
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
.WillOnce(Return(default_state));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kDefaultWindowId))
.WillRepeatedly(Return(default_state));
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(0);
@@ -3224,6 +3345,328 @@ TEST_F(StateControllerImplTest, OnApplicationRegisteredEqualStates) {
mobile_apis::HMILevel::HMI_BACKGROUND);
}
+TEST_F(
+ StateControllerImplTest,
+ SetRegularState_AppIsResumingAndAudioSourceIsActive_HmiStateIsNotChanged) {
+ am::event_engine::Event audio_source_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+ audio_source_event.set_smart_object(message);
+ state_ctrl_->on_event(audio_source_event);
+
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const am::HmiStatePtr new_state = FullAudibleState();
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ media_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_BcActivateAppSendFailed_HmiLevelIsNotChanged) {
+ const am::HmiStatePtr new_state = FullAudibleState();
+ SetBCActivateAppRequestToHMI(
+ static_cast<hmi_apis::Common_HMILevel::eType>(new_state->hmi_level()),
+ kCorrID);
+
+ smart_objects::SmartObjectSPtr bc_activate_app_request;
+ EXPECT_CALL(message_helper_mock_, GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .WillOnce(Return(bc_activate_app_request));
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_, _)).Times(0);
+
+ const bool send_activate_app = true;
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, new_state, send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetLevelAudioAndVideoState_HmiStateIsChanged) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = BackgroundState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ const bool send_activate_app = false;
+ state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
+ new_state->hmi_level(),
+ new_state->audio_streaming_state(),
+ new_state->video_streaming_state(),
+ send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetLevelAudioVideoStatesAndContext_HmiStateIsChanged) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = BackgroundState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ const bool send_activate_app = false;
+ state_ctrl_->SetRegularState(simple_app_,
+ kDefaultWindowId,
+ new_state->hmi_level(),
+ new_state->audio_streaming_state(),
+ new_state->video_streaming_state(),
+ new_state->system_context(),
+ send_activate_app);
+}
+
+TEST_F(StateControllerImplTest,
+ SetRegularState_SetSystemContextOnly_HmiStateIsChanged) {
+ HmiStatePtr old_state = FullAudibleState();
+ HmiStatePtr new_state = FullNotAudibleState();
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, old_state, new_state);
+
+ state_ctrl_->SetRegularState(
+ simple_app_, kDefaultWindowId, new_state->system_context());
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppActivated_ActivateNotExistingWindow_HmiLevelIsNotChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ simple_app_, simple_app_ptr_, kCustomWindowId, NoneNotAudibleState());
+
+ state_ctrl_->on_event(activate_widget_event);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppActivated_ActivateCustomWindow_HmiStateIsChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ std::vector<std::pair<HmiStatePtr, HmiStatePtr> > states_transition = {
+ std::make_pair(NoneNotAudibleState(), BackgroundState()),
+ std::make_pair(BackgroundState(), FullNotAudibleState())};
+
+ for (auto& states_pair : states_transition) {
+ HmiStatePtr old_state = states_pair.first;
+ HmiStatePtr new_state = states_pair.second;
+
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kCustomWindowId))
+ .WillOnce(Return(old_state->hmi_level()));
+ EXPECT_CALL(*simple_app_ptr_, audio_streaming_state())
+ .WillOnce(Return(old_state->audio_streaming_state()));
+ EXPECT_CALL(*simple_app_ptr_, video_streaming_state())
+ .WillOnce(Return(old_state->video_streaming_state()));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, kCustomWindowId, old_state, new_state);
+
+ EXPECT_CALL(message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .Times(0);
+
+ state_ctrl_->on_event(activate_widget_event);
+ }
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppDeactivated_DeactivateNotExistingWindow_HmiStateIsNotChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ ExpectAppWontChangeHmiStateDueToConflictResolving(
+ simple_app_, simple_app_ptr_, kCustomWindowId, FullNotAudibleState());
+
+ state_ctrl_->on_event(activate_widget_event);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppDeactivated_DeactivateCustomWindow_HmiStateIsChanged) {
+ InsertApplication(simple_app_);
+
+ am::event_engine::Event activate_widget_event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::strings::app_id] = simple_app_id_;
+ message[am::strings::msg_params][am::strings::window_id] = kCustomWindowId;
+ activate_widget_event.set_smart_object(message);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*simple_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ std::vector<std::pair<HmiStatePtr, HmiStatePtr> > states_transition = {
+ std::make_pair(FullNotAudibleState(), BackgroundState()),
+ std::make_pair(BackgroundState(), NoneNotAudibleState())};
+
+ for (auto& states_pair : states_transition) {
+ HmiStatePtr old_state = states_pair.first;
+ HmiStatePtr new_state = states_pair.second;
+
+ EXPECT_CALL(*simple_app_ptr_, hmi_level(kCustomWindowId))
+ .WillOnce(Return(old_state->hmi_level()));
+ EXPECT_CALL(*simple_app_ptr_, audio_streaming_state())
+ .WillOnce(Return(old_state->audio_streaming_state()));
+ EXPECT_CALL(*simple_app_ptr_, video_streaming_state())
+ .WillOnce(Return(old_state->video_streaming_state()));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+ ExpectSuccessfulSetHmiState(
+ simple_app_, simple_app_ptr_, kCustomWindowId, old_state, new_state);
+
+ EXPECT_CALL(message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, _, _, _, _))
+ .Times(0);
+
+ state_ctrl_->on_event(activate_widget_event);
+ }
+}
+
+TEST_F(
+ StateControllerImplTest,
+ ActivateDefaultWindow_AppWithWindowWasActivated_WindowStreamingStateIsUpdated) {
+ HmiStatePtr old_state = NoneNotAudibleState();
+ HmiStatePtr new_state = FullAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state))
+ .WillRepeatedly(Return(new_state));
+ ExpectSuccessfulSetHmiState(
+ media_app_, media_app_ptr_, kDefaultWindowId, old_state, new_state);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*media_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+
+ HmiStatePtr expected_window_state = NoneNotAudibleState();
+ expected_window_state->set_audio_streaming_state(
+ new_state->audio_streaming_state());
+ expected_window_state->set_video_streaming_state(
+ new_state->video_streaming_state());
+
+ EXPECT_CALL(
+ *media_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_window_state))));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+
+ state_ctrl_->ActivateDefaultWindow(media_app_);
+}
+
+TEST_F(StateControllerImplTest,
+ ExitDefaultWindow_AppWithWindowWasExited_WindowStreamingStateIsUpdated) {
+ HmiStatePtr old_state = FullAudibleState();
+ HmiStatePtr new_state = NoneNotAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kDefaultWindowId))
+ .WillOnce(Return(old_state))
+ .WillRepeatedly(Return(new_state));
+ ExpectSuccessfulSetHmiState(
+ media_app_, media_app_ptr_, kDefaultWindowId, old_state, new_state);
+
+ const am::WindowIds window_ids = {kDefaultWindowId, kCustomWindowId};
+ ON_CALL(*media_app_ptr_, GetWindowIds()).WillByDefault(Return(window_ids));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(old_state));
+
+ HmiStatePtr expected_window_state = FullAudibleState();
+ expected_window_state->set_audio_streaming_state(
+ new_state->audio_streaming_state());
+ expected_window_state->set_video_streaming_state(
+ new_state->video_streaming_state());
+
+ EXPECT_CALL(
+ *media_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_window_state))));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(media_app_, kCustomWindowId, _));
+
+ state_ctrl_->ExitDefaultWindow(media_app_);
+}
+
+TEST_F(StateControllerImplTest,
+ OnAppWindowAdded_NewAppWindowWasAdded_HmiNotificationIsSent) {
+ am::event_engine::Event audio_source_event(
+ hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
+ smart_objects::SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::AUDIO_SOURCE;
+ audio_source_event.set_smart_object(message);
+ state_ctrl_->on_event(audio_source_event);
+
+ HmiStatePtr initial_state =
+ createHmiState(mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_apis::VideoStreamingState::INVALID_ENUM,
+ mobile_apis::SystemContext::INVALID_ENUM);
+ HmiStatePtr expected_state = NoneNotAudibleState();
+
+ EXPECT_CALL(*simple_app_ptr_,
+ AddHMIState(kCustomWindowId,
+ Truly(HmiStatesIDComparator(
+ HmiState::StateID::STATE_ID_AUDIO_SOURCE))));
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState(kCustomWindowId))
+ .WillOnce(Return(initial_state));
+ EXPECT_CALL(*simple_app_ptr_,
+ SetRegularState(kCustomWindowId,
+ Truly(HmiStatesComparator(expected_state))));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState(kCustomWindowId))
+ .WillOnce(Return(initial_state))
+ .WillOnce(Return(expected_state));
+ EXPECT_CALL(message_helper_mock_,
+ SendHMIStatusNotification(simple_app_, kCustomWindowId, _));
+ EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+
+ state_ctrl_->OnAppWindowAdded(simple_app_,
+ kCustomWindowId,
+ mobile_apis::WindowType::WIDGET,
+ mobile_apis::HMILevel::HMI_NONE);
+}
+
} // namespace state_controller_test
} // namespace components
} // namespace test