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
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);
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)
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)
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
// 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
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);
- }
-}
void metrics_write(int fd, bool clear) {
// TODO(jpawlowski): implement
}
-
-void metrics_print(int fd, bool clear) {
- // TODO(jpawlowski): implement
-}
// Protos for uploading bluetooth metrics.
syntax = "proto2";
+option optimize_for = LITE_RUNTIME;
package clearcut.connectivity;