diff options
author | Igor Kozyrenko <IKozyrenko@luxoft.com> | 2014-04-09 16:28:43 +0300 |
---|---|---|
committer | Justin Dickow <jjdickow@gmail.com> | 2014-07-09 14:10:00 -0400 |
commit | 25d6739f19ca4b066efc0b842693b6c505074688 (patch) | |
tree | c39f8161c0684a7f7172b085619da8c9a9c11c46 | |
parent | 13ca1b5a9ac191cf4554837f4d2e487d34056825 (diff) | |
download | smartdevicelink-25d6739f19ca4b066efc0b842693b6c505074688.tar.gz |
APPLINK-6701, Fexed forwarding OnSystemRequest notification to single mobile app
Signed-off-by: Justin Dickow <jjdickow@gmail.com>
Conflicts:
src/components/application_manager/include/application_manager/policies/policy_handler.h
src/components/application_manager/src/commands/hmi/on_system_request_notification.cc
-rw-r--r-- | src/components/application_manager/include/application_manager/policies/policy_handler.h | 13 | ||||
-rw-r--r-- | src/components/application_manager/src/commands/hmi/on_system_request_notification.cc | 20 |
2 files changed, 12 insertions, 21 deletions
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h index f6efa74fc..3695c6a66 100644 --- a/src/components/application_manager/include/application_manager/policies/policy_handler.h +++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h @@ -190,8 +190,11 @@ class PolicyHandler : public utils::Singleton<PolicyHandler>, */ void OnSystemError(int code); - void OnCurrentDeviceIdUpdateRequired( - const std::string& policy_app_id) {} + /** + * @brief Choose application id to be used for snapshot sending + * @return Application id or 0, if there are no applications registered + */ + uint32_t GetAppIdForSending(); protected: /** @@ -212,12 +215,6 @@ class PolicyHandler : public utils::Singleton<PolicyHandler>, private: /** - * @brief Choose application id to be used for snapshot sending - * @return Application id or 0, if there are no applications registered - */ - uint32_t GetAppIdForSending(); - - /** * @brief Choose device according to app HMI status and user consent for * device * @param device_info Struct with selected device parameters 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 b0977dc9c..cd904aa7f 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 @@ -44,8 +44,8 @@ namespace application_manager { namespace commands { OnSystemRequestNotification::OnSystemRequestNotification( - const MessageSharedPtr& message) - : NotificationFromHMI(message) { + const MessageSharedPtr& message) + : NotificationFromHMI(message) { } OnSystemRequestNotification::~OnSystemRequestNotification() { @@ -58,7 +58,7 @@ void OnSystemRequestNotification::Run() { smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params]; params[strings::function_id] = - static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID); + static_cast<int32_t>(mobile_apis::FunctionID::eType::OnSystemRequestID); std::string app_id = msg_params[strings::app_id].asString(); @@ -67,24 +67,18 @@ void OnSystemRequestNotification::Run() { int32_t selected_app_id = policy_handler->GetAppIdForSending(); if (0 == selected_app_id) { LOG4CXX_WARN(logger_, - "Can't select application to forward OnSystemRequestNotification"); + "Can't select application to forward OnSystemRequestNotification"); return; } ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance(); ApplicationSharedPtr selected_app = app_mgr->application(selected_app_id); - if (!selected_app.valid()) { + if(!selected_app.valid()) { LOG4CXX_ERROR(logger_, "PolicyHandler selected invalid app_id"); return; } - params[strings::connection_key] = selected_app_id; + params[strings::connection_key] = static_cast<int32_t>(selected_app_id); } else { - ApplicationSharedPtr app = - ApplicationManagerImpl::instance()->application_by_policy_id(app_id); - if (!app.valid()) { - LOG4CXX_WARN(logger_, "Application with such id is not yet registered."); - return; - } - params[strings::connection_key] = app->app_id(); + params[strings::connection_key] = app_id; } SendNotificationToMobile(message_); |