diff options
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc')
-rw-r--r-- | src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc index a85dec10bb..9c868172f5 100644 --- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc +++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc @@ -86,8 +86,8 @@ void OnSystemRequestNotification::Run() { static_cast<rpc::policy_table_interface_base::RequestType>( request_type)); - if (!policy_handler.IsRequestTypeAllowed(app->policy_app_id(), - request_type)) { + if (!policy_handler.IsRequestTypeAllowed( + app->device(), app->policy_app_id(), request_type)) { LOG4CXX_WARN(logger_, "Request type " << stringified_request_type << " is not allowed by policies"); @@ -118,22 +118,23 @@ void OnSystemRequestNotification::Run() { mobile_apis::RequestType::OEM_SPECIFIC); BinaryMessage binary_data; - if (binary_data_is_required) { + if (binary_data_is_required && + (*message_)[strings::msg_params].keyExists(strings::file_name)) { const std::string filename = (*message_)[strings::msg_params][strings::file_name].asString(); file_system::ReadBinaryFile(filename, binary_data); + } else if ((*message_)[strings::params].keyExists(strings::binary_data)) { + // Binary data may already be attached to the message + binary_data = (*message_)[strings::params][strings::binary_data].asBinary(); } if (mobile_apis::RequestType::OEM_SPECIFIC == request_type) { (*message_)[strings::params][strings::binary_data] = binary_data; - } - - if (mobile_apis::RequestType::PROPRIETARY == request_type) { + } else if (mobile_apis::RequestType::PROPRIETARY == request_type) { /* According to requirements: "If the requestType = PROPRIETARY, add to mobile API fileType = JSON If the requestType = HTTP, add to mobile API fileType = BINARY" - Also in Genivi SDL we don't save the PT to file - we put it directly in - binary_data */ + Also we don't save the PT to file - we put it directly in binary_data */ #if defined(PROPRIETARY_MODE) AddHeader(binary_data); @@ -144,14 +145,19 @@ void OnSystemRequestNotification::Run() { #endif // PROPRIETARY_MODE (*message_)[strings::msg_params][strings::file_type] = FileType::JSON; - } - - if (mobile_apis::RequestType::HTTP == request_type) { + } else if (mobile_apis::RequestType::HTTP == request_type) { (*message_)[strings::msg_params][strings::file_type] = FileType::BINARY; if ((*message_)[strings::msg_params].keyExists(strings::url)) { (*message_)[strings::msg_params][strings::timeout] = policy_handler.TimeoutExchangeSec(); } + } else if (mobile_apis::RequestType::LOCK_SCREEN_ICON_URL == request_type) { + if (!(*message_)[strings::msg_params].keyExists(strings::url) || + (*message_)[strings::msg_params][strings::url].empty()) { + LOG4CXX_ERROR(logger_, + "discarding LOCK_SCREEN_ICON_URL request without URL"); + return; + } } SendNotification(); |