Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eb3d1032 authored by Henri Chataing's avatar Henri Chataing Committed by Automerger Merge Worker
Browse files

Merge changes I4eba0fbd,I21c359d7 into main am: c38fbb86 am: 971bdca6

parents 3f5eaed1 971bdca6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -48,6 +48,15 @@ void vlog(Level level, char const* tag, char const* file_name, int line,
      .message = buffer.c_str(),
  };
  __android_log_write_log_message(&message);

  if (level == Level::kFatal) {
    // Log assertion failures to stderr for the benefit of "adb shell" users
    // and gtests (http://b/23675822).
    char const* buf = buffer.c_str();
    TEMP_FAILURE_RETRY(write(2, buf, strlen(buf)));
    TEMP_FAILURE_RETRY(write(2, "\n", 1));
    __android_log_call_aborter(buf);
  }
}

}  // namespace bluetooth::log_internal
+1 −2
Original line number Diff line number Diff line
@@ -15,14 +15,13 @@
 */

#include <base/functional/bind.h>
#include <base/logging.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include "sdpdefs.h"
#include "avrcp_internal.h"
#include "avrcp_test_helper.h"
#include "connection_handler.h"
#include "sdpdefs.h"
#include "types/raw_address.h"

using ::testing::_;
+0 −1
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
 */

#include <base/functional/bind.h>
#include <base/logging.h>
#include <base/threading/thread.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
+6 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ cc_library_static {
    static_libs: [
        "lib-bt-packets",
        "libbluetooth-types",
        "libbluetooth_log",
    ],
    header_libs: ["libbluetooth_headers"],
}
@@ -47,9 +48,13 @@ cc_test {
        "lib-bt-packets-avrcp",
        "lib-bt-packets-base",
        "libbluetooth-types",
        "libbluetooth_log",
        "libchrome",
        "libgmock",
        "sdp_service",
    ],
    shared_libs: ["liblog"],
    shared_libs: [
        "libbase",
        "liblog",
    ],
}
+16 −16
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

#include "data_element_reader.h"

#include <base/logging.h>
#include <bluetooth/log.h>

#include <type_traits>

@@ -30,7 +30,7 @@
#define CHECK_REMAINING_LEN(x)                           \
  do {                                                   \
    if ((size_t)(end_ - it_) < x) {                      \
      LOG(WARNING) << __func__ << ": Extract would read past end of data."; \
      log::warn("Extract would read past end of data."); \
      return ParseFail();                                \
    }                                                    \
  } while (0)
@@ -39,7 +39,7 @@ namespace bluetooth {
namespace sdp {

DataElementReader::DataElement DataElementReader::ReadNext() {
  if (it_ > end_) LOG(FATAL) << "Beginning of buffer is past end of buffer.";
  if (it_ > end_) log::fatal("Beginning of buffer is past end of buffer.");
  if (it_ == end_) return std::monostate();

  uint8_t descriptor = *it_++;
@@ -48,14 +48,14 @@ DataElementReader::DataElement DataElementReader::ReadNext() {

  // All types with a value greater than URL are currently reserved.
  if (type > DataElementType::MAX_VALUE) {
    LOG(WARNING) << __func__ << ": Trying to use a reserved data element type";
    log::warn("Trying to use a reserved data element type");
    return ParseFail();
  }

  switch (type) {
    case DataElementType::BOOLEAN:
      if (size != DataElementSize::BYTE1) {
        LOG(WARNING) << __func__ << ": Invalid size for bool: " << size;
        log::warn("Invalid size for bool: {}", size);
        return ParseFail();
      }

@@ -75,7 +75,7 @@ DataElementReader::DataElement DataElementReader::ReadNext() {
      // TODO: The other data element types are never used in the previous SDP
      // implementation. We should properly handle them in the future though
      // for completeness.
      LOG(ERROR) << __func__ << ": Unhandled Data Element Type: " << type;
      log::error("Unhandled Data Element Type: {}", type);
  }

  return ParseFail();
@@ -120,7 +120,7 @@ DataElementReader::DataElement DataElementReader::ReadSignedInt(
    case DataElementSize::BYTE16:
      return ReadLargeInt();
    default:
      LOG(WARNING) << __func__ << ": Invalid size for int: " << size;
      log::warn("Invalid size for int: {}", size);
  }

  return ParseFail();
@@ -140,7 +140,7 @@ DataElementReader::DataElement DataElementReader::ReadUnsignedInt(
    case DataElementSize::BYTE16:
      return ReadLargeInt();
    default:
      LOG(WARNING) << __func__ << ": Invalid size for uint: " << size;
      log::warn("Invalid size for uint: {}", size);
  }

  return ParseFail();
@@ -169,7 +169,7 @@ DataElementReader::DataElement DataElementReader::ReadUuid(
    return Uuid::From128BitBE(uuid_array);
  }

  LOG(WARNING) << __func__ << ": Invalid size for UUID: " << size;
  log::warn("Invalid size for UUID: {}", size);
  return ParseFail();
}

@@ -191,7 +191,7 @@ DataElementReader::DataElement DataElementReader::ReadString(
      num_bytes = it_.extractBE<uint32_t>();
      break;
    default:
      LOG(WARNING) << __func__ << ": Invalid size for string: " << size;
      log::warn("Invalid size for string: {}", size);
      return ParseFail();
  }

@@ -223,7 +223,7 @@ DataElementReader::DataElement DataElementReader::ReadSequence(
      num_bytes = it_.extractBE<uint32_t>();
      break;
    default:
      LOG(WARNING) << __func__ << ": Invalid size for string: " << size;
      log::warn("Invalid size for string: {}", size);
      return ParseFail();
  }

Loading