summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerii Malkov (GitHub) <vmalkov@luxoft.com>2020-01-10 21:20:59 +0200
committerCollin <iCollin@users.noreply.github.com>2020-01-10 14:20:59 -0500
commit05fdb9006ef9c337c49474d0996789124e2401d7 (patch)
treef8b3ac7ced658b93aa18872271cd012b6b4626d2
parentf113bc7dfb651908cdd8b68db1a634c798f88e89 (diff)
downloadsdl_core-05fdb9006ef9c337c49474d0996789124e2401d7.tar.gz
SDL forwards `OnButtonEvent` notification of `CUSTOM_BUTTON` to `BACKGROUND` App. (#2365)
* Bugfix `SDL forwards OnButtonEvent notification` Bugfix `SDL forwards OnButtonEvent notification of CUSTOM_BUTTON to BACKGROUND App.` Issue number #967 * Check that SDL forwards OnButtonEvent notification of CUSTOM_BUTTON to BACKGROUND App * fixup! Bugfix `SDL forwards OnButtonEvent notification` Co-authored-by: Ira Lytvynenko (GitHub) <ILytvynenko@luxoft.com> Co-authored-by: Igor Gapchuk (GitHub) <41586842+IGapchuk@users.noreply.github.com>
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_event_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_button_press_notification.cc7
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/test/commands/mobile/on_button_notification_commands_test.cc29
3 files changed, 35 insertions, 8 deletions
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 0bf9b40cb6..bca3b20fe0 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
@@ -105,11 +105,10 @@ void OnButtonEventNotification::Run() {
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)) {
+ if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
LOG4CXX_WARN(logger_,
- "CUSTOM_BUTTON OnButtonEvent notification is allowed only "
- << "in FULL or LIMITED hmi level");
+ "CUSTOM_BUTTON OnButtonEvent notification is not allowed in "
+ "NONE hmi level");
return;
}
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 8c22844865..c51991742d 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
@@ -108,11 +108,10 @@ void OnButtonPressNotification::Run() {
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)) {
+ if ((mobile_api::HMILevel::HMI_NONE == window_hmi_level)) {
LOG4CXX_WARN(logger_,
- "CUSTOM_BUTTON OnButtonPress notification is allowed only "
- << "in FULL or LIMITED hmi level");
+ "CUSTOM_BUTTON OnButtonPress notification is not allowed in "
+ "NONE hmi level");
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 c0305a15ca..aa48e8916b 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
@@ -231,6 +231,35 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_CustomButton_SUCCESS) {
command->Run();
}
+TYPED_TEST(OnButtonNotificationCommandsTest,
+ Run_CustomButton_SUCCESS_BACKGROUND) {
+ typedef typename TestFixture::Notification Notification;
+
+ MessageSharedPtr notification_msg(
+ this->CreateMessage(smart_objects::SmartType_Map));
+
+ (*notification_msg)[am::strings::msg_params][am::hmi_response::button_name] =
+ mobile_apis::ButtonName::CUSTOM_BUTTON;
+ (*notification_msg)[am::strings::msg_params][am::strings::app_id] = kAppId;
+ (*notification_msg)[am::strings::msg_params]
+ [am::hmi_response::custom_button_id] = kCustomButtonId;
+
+ std::shared_ptr<Notification> command(
+ this->template CreateCommand<Notification>(notification_msg));
+
+ typename TestFixture::MockAppPtr mock_app = this->CreateMockApp();
+ ON_CALL(*mock_app, hmi_level(kDefaultWindowId))
+ .WillByDefault(Return(mobile_apis::HMILevel::HMI_BACKGROUND));
+ EXPECT_CALL(this->app_mngr_, application(kAppId)).WillOnce(Return(mock_app));
+ EXPECT_CALL(*mock_app, IsSubscribedToSoftButton(kCustomButtonId))
+ .WillOnce(Return(true));
+ EXPECT_CALL(this->mock_rpc_service_,
+ SendMessageToMobile(
+ CheckNotificationMessage(TestFixture::kFunctionId), _));
+
+ command->Run();
+}
+
TYPED_TEST(OnButtonNotificationCommandsTest, Run_NoSubscribedApps_UNSUCCESS) {
typedef typename TestFixture::Notification Notification;