diff options
author | collin <collin+i@collinmcqueen.com> | 2020-11-16 16:28:46 -0500 |
---|---|---|
committer | collin <collin+i@collinmcqueen.com> | 2020-11-16 16:28:46 -0500 |
commit | e4d25f3403d4e210d08d0d959a99fc3530ac0c01 (patch) | |
tree | 57162626f9d8c22887810f3eac74ed2e99f7f79d | |
parent | 9dc3c070c58a644bb54b08808aa0a39627e0cf09 (diff) | |
download | sdl_core-fix/osr_binary_data.tar.gz |
allow all OnSystemRequest types to contain binary datafix/osr_binary_data
-rw-r--r-- | src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc | 34 |
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(); } |