summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCollin <iCollin@users.noreply.github.com>2020-11-19 14:55:20 -0500
committerGitHub <noreply@github.com>2020-11-19 14:55:20 -0500
commit1cd41269dc11cb8ea5fbe6c4ad44fa8a43ef7e30 (patch)
treeea4819e6df603c0a68d0a161bebf1050c9d2799d
parentd1dcdc1cf2741a7952a77d132ea8c1cfa7bc7961 (diff)
downloadsdl_core-1cd41269dc11cb8ea5fbe6c4ad44fa8a43ef7e30.tar.gz
allow all OnSystemRequest types to contain binary data (#3575)
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc34
1 files changed, 14 insertions, 20 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 4a97d5b970..40705491fc 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
@@ -109,15 +109,8 @@ void OnSystemRequestNotification::Run() {
SDL_LOG_DEBUG("Processing Request type : " << stringified_request_type);
- const bool binary_data_is_required =
- Compare<mobile_apis::RequestType::eType, EQ, ONE>(
- request_type,
- mobile_apis::RequestType::PROPRIETARY,
- mobile_apis::RequestType::OEM_SPECIFIC);
-
BinaryMessage binary_data;
- if (binary_data_is_required &&
- (*message_)[strings::msg_params].keyExists(strings::file_name)) {
+ if ((*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);
@@ -126,22 +119,15 @@ void OnSystemRequestNotification::Run() {
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;
- } else if (mobile_apis::RequestType::PROPRIETARY == request_type) {
+ 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 we don't save the PT to file - we put it directly in binary_data */
+ If the requestType = HTTP, add to mobile API fileType = BINARY" */
#if defined(PROPRIETARY_MODE)
AddHeader(binary_data);
#endif // PROPRIETARY_MODE
-#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
- (*message_)[strings::params][strings::binary_data] = binary_data;
-#endif // PROPRIETARY_MODE
-
(*message_)[strings::msg_params][strings::file_type] = FileType::JSON;
} else if (mobile_apis::RequestType::HTTP == request_type) {
(*message_)[strings::msg_params][strings::file_type] = FileType::BINARY;
@@ -150,13 +136,21 @@ void OnSystemRequestNotification::Run() {
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()) {
- SDL_LOG_ERROR("discarding LOCK_SCREEN_ICON_URL request without URL");
+ if (binary_data.empty() &&
+ (!(*message_)[strings::msg_params].keyExists(strings::url) ||
+ (*message_)[strings::msg_params][strings::url].empty())) {
+ SDL_LOG_ERROR(
+ "discarding LOCK_SCREEN_ICON_URL request with no URL or data");
return;
}
}
+#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
+ if (!binary_data.empty()) {
+ (*message_)[strings::params][strings::binary_data] = binary_data;
+ }
+#endif // PROPRIETARY_MODE
+
SendNotification();
}