message: allow all OnSystemRequest types to contain binary data
diff: @@ -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();
  }
  