diff options
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)); |