summaryrefslogtreecommitdiff
path: root/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/application_manager/src/commands/mobile/on_button_event_notification.cc')
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_event_notification.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
index 64043d2a88..7c631d6d4b 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
@@ -56,8 +56,7 @@ void OnButtonEventNotification::Run() {
const bool is_app_id_exists =
(*message_)[strings::msg_params].keyExists(strings::app_id);
- const ApplicationSharedPtr app = application_manager_.application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
+ ApplicationSharedPtr app;
// CUSTOM_BUTTON notification
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
@@ -67,6 +66,9 @@ void OnButtonEventNotification::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(
@@ -92,6 +94,14 @@ void OnButtonEventNotification::Run() {
return;
}
+ if ((mobile_api::HMILevel::HMI_FULL != app->hmi_level()) &&
+ (mobile_api::HMILevel::HMI_LIMITED != app->hmi_level())) {
+ LOG4CXX_WARN(logger_,
+ "CUSTOM_BUTTON OnButtonEvent notification is allowed only "
+ << "in FULL or LIMITED hmi level");
+ return;
+ }
+
SendButtonEvent(app);
return;
}