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

Commit e103df02 authored by Allen Webb's avatar Allen Webb
Browse files

dumpsys: Fix compatibility with newer flatbuffers

GenerateText was renamed to GenText in 23.5.26 because the return
behavior was changed, so support both cases for now.
https://github.com/google/flatbuffers/commit/950a71ab893e96147c30dd91735af6db73f72ae0

Bug: 303433787
Test: m . # and FEATURES=test emerge-${BOARD} chromeos-base/floss

Change-Id: I854fd5196f9a62dd587fec59b9e00d7936c4262d
parent 3625a1ce
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -113,7 +113,19 @@ std::string Dumpsys::impl::PrintAsJson(std::string* dumpsys_data) const {
  }

  std::string jsongen;
  // GenerateText was renamed to GenText in 23.5.26 because the return behavior was changed.
  // https://github.com/google/flatbuffers/commit/950a71ab893e96147c30dd91735af6db73f72ae0
#if FLATBUFFERS_VERSION_MAJOR < 23 ||   \
    (FLATBUFFERS_VERSION_MAJOR == 23 && \
     (FLATBUFFERS_VERSION_MINOR < 5 ||  \
      (FLATBUFFERS_VERSION_MINOR == 5 && FLATBUFFERS_VERSION_REVISION < 26)))
  flatbuffers::GenerateText(parser, dumpsys_data->data(), &jsongen);
#else
  const char* error = flatbuffers::GenText(parser, dumpsys_data->data(), &jsongen);
  if (error != nullptr) {
    LOG_WARN("%s", error);
  }
#endif
  return jsongen;
}