diff options
author | agaliuzov <agaliuzov@luxoft.com> | 2016-05-16 00:12:12 -0700 |
---|---|---|
committer | agaliuzov <agaliuzov@luxoft.com> | 2016-05-16 01:45:41 -0700 |
commit | 59c5e55149cfe84367e3e3475eb1b090c3dd6402 (patch) | |
tree | cb0efd4c41bb3db0e4d93af2f3c5914ebc16a793 /src/components/application_manager/src/commands/hmi/on_system_request_notification.cc | |
parent | 793155c8d67254aa92fadb8a972476484c214b22 (diff) | |
parent | 2b17b5546d4d94665a37697d73f10adfb14b6dd3 (diff) | |
download | sdl_core-59c5e55149cfe84367e3e3475eb1b090c3dd6402.tar.gz |
Merge remote-tracking branch 'upstream/master' into develop
Diffstat (limited to 'src/components/application_manager/src/commands/hmi/on_system_request_notification.cc')
-rw-r--r-- | src/components/application_manager/src/commands/hmi/on_system_request_notification.cc | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc index ce83d28db4..531692b136 100644 --- a/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc +++ b/src/components/application_manager/src/commands/hmi/on_system_request_notification.cc @@ -58,30 +58,35 @@ void OnSystemRequestNotification::Run() { params[strings::function_id] = static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID); - const std::string app_id = msg_params[strings::app_id].asString(); - LOG4CXX_DEBUG(logger_, "Received OnSystemRequest for " << app_id); - ApplicationSharedPtr app; - if (strings::default_app_id == app_id) { + if (!msg_params.keyExists(strings::app_id)) { + LOG4CXX_DEBUG(logger_, + "No application specified, trying to choose automatically."); const policy::PolicyHandlerInterface& policy_handler = - application_manager_.GetPolicyHandler(); - const uint32_t selected_app_id = policy_handler.GetAppIdForSending(); + application_manager_.GetPolicyHandler(); + uint32_t selected_app_id = policy_handler.GetAppIdForSending(); if (0 == selected_app_id) { - LOG4CXX_WARN( - logger_, - "Can't select application to forward OnSystemRequestNotification"); + LOG4CXX_WARN(logger_, + "Can't select application to forward OnSystemRequest."); return; } app = application_manager_.application(selected_app_id); + } else { + const uint32_t app_id = msg_params[strings::app_id].asUInt(); + LOG4CXX_WARN(logger_, "Looking for application with connection key " + << app_id); + app = application_manager_.application(app_id); } if (!app.valid()) { LOG4CXX_WARN(logger_, - "Application with connection key " << app_id - << "is not registered."); + "No valid application found to forward OnSystemRequest."); return; } + LOG4CXX_DEBUG(logger_, + "Sending request with application id " << app->policy_app_id()); + params[strings::connection_key] = app->app_id(); SendNotificationToMobile(message_); } |