summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin <iCollin@users.noreply.github.com>2020-05-20 13:47:25 -0700
committerGitHub <noreply@github.com>2020-05-20 16:47:25 -0400
commited2815162dfb192faa5a42750bd264414952374b (patch)
treed738e9b7c308e11f5437f435d57c8f9a02e0aff6
parent6f6c864f138cbe65545fa18f34476349017b571f (diff)
downloadsdl_core-ed2815162dfb192faa5a42750bd264414952374b.tar.gz
Forward OnButtonPressNotifications where HMI specifies appID to apps in LIMITED HMI Level (#3378)
* initialize app in non custom button path of on_button_press run * fixup! initialize app in non custom button path of on_button_press run fix unit tests with changes in run
-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.cc1
2 files changed, 5 insertions, 3 deletions
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 c51991742d..a205660e23 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
@@ -67,6 +67,10 @@ void OnButtonPressNotification::Run() {
const bool is_app_id_exists =
(*message_)[strings::msg_params].keyExists(strings::app_id);
ApplicationSharedPtr app;
+ if (is_app_id_exists) {
+ app = application_manager_.application(
+ (*message_)[strings::msg_params][strings::app_id].asUInt());
+ }
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
@@ -76,9 +80,6 @@ void OnButtonPressNotification::Run() {
return;
}
- app = application_manager_.application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
-
// custom_button_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(
hmi_response::custom_button_id)) {
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 aa48e8916b..e4536ddeea 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
@@ -351,6 +351,7 @@ TYPED_TEST(OnButtonNotificationCommandsTest, Run_SUCCESS) {
.WillRepeatedly(Return(mobile_apis::HMILevel::HMI_FULL));
ON_CALL(*mock_app, IsFullscreen()).WillByDefault(Return(true));
+ ON_CALL(this->app_mngr_, application(kAppId)).WillByDefault(Return(mock_app));
EXPECT_CALL(this->app_mngr_, applications_by_button(kButtonName))
.WillOnce(Return(subscribed_apps_list));