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

Commit 21aac5bd authored by Colin Cross's avatar Colin Cross Committed by Andre Eisenbach
Browse files

Replace bluetooth protos with protobuf-lite

Use lite protobufs for bluetooth to remove dependency on
libprotobuf-cpp-full, which will be removed from the platform.

Requires dropping support for
adb shell dumpsys bluetooth_manager --proto-text
which requires full protobufs to call TextToString.  The functionality
can be restored without adding a dependency on full protobufs with a
host protobuf decoder.

Bug: 32417805
Test: builds
Change-Id: Ifc9ee23264b1bfff3ad1f85ef4914f788028971a
parent adc40aa5
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -295,11 +295,6 @@ static int read_energy_info() {

static void dump(int fd, const char** arguments) {
  if (arguments != NULL && arguments[0] != NULL) {
    if (strncmp(arguments[0], "--proto-text", 12) == 0) {
      btif_update_a2dp_metrics();
      metrics_print(fd, true);
      return;
    }
    if (strncmp(arguments[0], "--proto-bin", 11) == 0) {
      btif_update_a2dp_metrics();
      metrics_write(fd, true);
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ LOCAL_SRC_FILES := \

LOCAL_MODULE := net_test_hci
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := liblog libdl libprotobuf-cpp-full
LOCAL_SHARED_LIBRARIES := liblog libdl libprotobuf-cpp-lite
LOCAL_STATIC_LIBRARIES := libbt-hci libosi libcutils libbtcore libbt-protos

LOCAL_CFLAGS += $(bluetooth_CFLAGS)
+2 −2
Original line number Diff line number Diff line
@@ -168,7 +168,7 @@ LOCAL_C_INCLUDES := $(btosiCommonIncludes)
LOCAL_SRC_FILES := $(btosiCommonTestSrc)
LOCAL_MODULE := net_test_osi
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := libc liblog libprotobuf-cpp-full libchrome libcutils
LOCAL_SHARED_LIBRARIES := libc liblog libprotobuf-cpp-lite libchrome libcutils
LOCAL_STATIC_LIBRARIES := libosi libbt-protos

LOCAL_CFLAGS += $(bluetooth_CFLAGS)
@@ -187,7 +187,7 @@ LOCAL_SRC_FILES := $(btosiCommonTestSrc)
LOCAL_LDLIBS := -lrt -lpthread
LOCAL_MODULE := net_test_osi
LOCAL_MODULE_TAGS := tests
LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-full libchrome
LOCAL_SHARED_LIBRARIES := liblog libprotobuf-cpp-lite libchrome
LOCAL_STATIC_LIBRARIES := libosi-host libbt-protos

LOCAL_CFLAGS += $(bluetooth_CFLAGS) -DOS_GENERIC
+0 −4
Original line number Diff line number Diff line
@@ -92,10 +92,6 @@ void metrics_a2dp_session(
// If |clear| is true, metrics events are cleared afterwards.
void metrics_write(int fd, bool clear);

// Writes the metrics, in human-readable protobuf format, into the descriptor
// |fd|. If |clear| is true, metrics events are cleared afterwards.
void metrics_print(int fd, bool clear);

#ifdef __cplusplus
}
#endif
+0 −21
Original line number Diff line number Diff line
@@ -185,24 +185,3 @@ void metrics_write(int fd, bool clear) {
              strerror(errno), errno);
  }
}

void metrics_print(int fd, bool clear) {
  log_lock.lock();
  LOG_DEBUG(LOG_TAG, "%s printing metrics", __func__);
  lazy_initialize();

  std::string pretty_output;
  google::protobuf::TextFormat::PrintToString(*pending, &pretty_output);

  if (clear) {
    pending->Clear();
  }
  log_lock.unlock();

  ssize_t ret;
  OSI_NO_INTR(ret = write(fd, pretty_output.c_str(), pretty_output.size()));
  if (ret == -1) {
    LOG_ERROR(LOG_TAG, "%s: error writing to dumpsys fd: %s (%d)", __func__,
              strerror(errno), errno);
  }
}
Loading