diff options
author | Iryna Lytvynenko (GitHub) <ILytvynenko@luxoft.com> | 2022-02-11 21:17:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 14:17:25 -0500 |
commit | e28694c01fcd4c45b084c343d16f05611fd1115a (patch) | |
tree | 5c90c9fea81b137e48da3288998324cf7a8caf55 | |
parent | 2f002290411cae9a414c4dfccc93bb777a9482d0 (diff) | |
download | sdl_core-e28694c01fcd4c45b084c343d16f05611fd1115a.tar.gz |
Fix perform interaction close pop up (#3844)
* fix for rejected Perform Interaction
* avoid close popup for VR_ONLY PI
Co-authored-by: Yana Chernysheva (GitHub) <59469418+ychernysheva@users.noreply.github.com>
fixup
Co-authored-by: Vadym Luchko (gitHub) <vluchko@luxoft.com>
2 files changed, 32 insertions, 45 deletions
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 7708df9363..a11f123337 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 @@ -246,6 +246,8 @@ void PerformInteractionRequest::Run() { // increment amount of active requests ++pi_requests_count_; + SDL_LOG_DEBUG("Send PerformInteraction requests"); + StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_VR); StartAwaitForInterface(HmiInterfaces::HMI_INTERFACE_UI); @@ -369,16 +371,10 @@ bool PerformInteractionRequest::ProcessVRResponse( SDL_LOG_DEBUG("Update timeout for UI"); application_manager_.UpdateRequestTimeout( - connection_key(), correlation_id(), default_timeout_); return false; } - if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) && - InteractionMode::MANUAL_ONLY != interaction_mode_) { - SendClosePopupRequestToHMI(); - } - const SmartObject& hmi_msg_params = message[strings::msg_params]; if (hmi_msg_params.keyExists(strings::choice_id)) { const int choice_id = hmi_msg_params[strings::choice_id].asInt(); @@ -392,6 +388,26 @@ bool PerformInteractionRequest::ProcessVRResponse( vr_choice_id_received_ = choice_id; } + const bool is_vr_result_successful = CommandImpl::IsHMIResultSuccess( + vr_result_code_, HmiInterfaces::HMI_INTERFACE_VR); + + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI) && + is_vr_result_successful) { + switch (interaction_mode_) { + case mobile_apis::InteractionMode::BOTH: + // Close UI popup only if choice ID was included in VR + if (vr_choice_id_received_ != INVALID_CHOICE_ID) { + SendClosePopupRequestToHMI(); + } + break; + case mobile_apis::InteractionMode::VR_ONLY: + SendClosePopupRequestToHMI(); + break; + default: + break; + } + } + if (mobile_apis::InteractionMode::BOTH == interaction_mode_ || mobile_apis::InteractionMode::MANUAL_ONLY == interaction_mode_) { SDL_LOG_DEBUG("Update timeout for UI"); @@ -399,17 +415,6 @@ bool PerformInteractionRequest::ProcessVRResponse( connection_key(), correlation_id(), default_timeout_); } - const bool is_vr_result_success = Compare<Common_Result::eType, EQ, ONE>( - vr_result_code_, Common_Result::SUCCESS, Common_Result::WARNINGS); - - if (is_vr_result_success && - InteractionMode::MANUAL_ONLY == interaction_mode_) { - SDL_LOG_DEBUG("VR response is successfull in MANUAL_ONLY mode " - << "Wait for UI response"); - // in case MANUAL_ONLY mode VR.PI SUCCESS just return - return false; - } - return false; } @@ -901,7 +906,10 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() { void PerformInteractionRequest::TerminatePerformInteraction() { SDL_LOG_AUTO_TRACE(); - SendClosePopupRequestToHMI(); + if (IsInterfaceAwaited(HmiInterfaces::HMI_INTERFACE_UI)) { + SendClosePopupRequestToHMI(); + } + DisablePerformInteraction(); } diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc index ee2eb720e0..aa6d02b81c 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/perform_interaction_test.cc @@ -467,9 +467,8 @@ TEST_F( command->StartAwaitForInterfaces(); - MessageSharedPtr response_msg_vr = - CreateHMIResponseMessage(hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - "VR is not supported by system"); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessage( + hmi_apis::Common_Result::WRONG_LANGUAGE, "VR error message"); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); event_vr.set_smart_object(*response_msg_vr); @@ -484,23 +483,13 @@ TEST_F( ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); - MessageSharedPtr request_to_hmi; - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) - .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true))); - command->on_event(event_vr); command->on_event(event_ui); - HMIRequestExpectations(request_to_hmi, - hmi_apis::FunctionID::UI_ClosePopUp, - "UI.PerformInteraction"); - ResultCommandExpectations(response_to_mobile, true, - hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, - "VR is not supported by system"); + hmi_apis::Common_Result::WRONG_LANGUAGE, + "VR error message"); } TEST_F( @@ -618,8 +607,8 @@ TEST_F( command->StartAwaitForInterfaces(); - MessageSharedPtr response_msg_vr = - CreateHMIResponseMessage(hmi_apis::Common_Result::SUCCESS, ""); + MessageSharedPtr response_msg_vr = CreateHMIResponseMessageWithChoiceID( + hmi_apis::Common_Result::SUCCESS, "", kVrChoiceID); am::event_engine::Event event_vr(hmi_apis::FunctionID::VR_PerformInteraction); event_vr.set_smart_object(*response_msg_vr); @@ -684,19 +673,9 @@ TEST_F( ManageMobileCommand(_, am::commands::Command::CommandSource::SOURCE_SDL)) .WillOnce(DoAll(SaveArg<0>(&response_to_mobile), Return(true))); - MessageSharedPtr request_to_hmi; - EXPECT_CALL(mock_rpc_service_, - ManageHMICommand( - _, am::commands::Command::CommandSource::SOURCE_SDL_TO_HMI)) - .WillOnce(DoAll(SaveArg<0>(&request_to_hmi), Return(true))); - command->on_event(event_vr); command->on_event(event_ui); - HMIRequestExpectations(request_to_hmi, - hmi_apis::FunctionID::UI_ClosePopUp, - "UI.PerformInteraction"); - ResultCommandExpectations(response_to_mobile, true, hmi_apis::Common_Result::UNSUPPORTED_RESOURCE, |