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

Commit c723823c authored by Chris Manton's avatar Chris Manton
Browse files

gd::hal::snoop_logger Return proper empty dumpsys structure

Dumpsys entry does not use flatbuffers directly but only
as mechanism to indicate when to write snoop log

Extract `EmptyDumpsysDataFinisher` into separate compilation unit

Bug: 314828950
Test: atest bluetooth_test_gd_unit
Test: manual adb shell dumpsys
Flag: EXEMPT, unchanged logic mechanical movement between compilation units

Change-Id: Icf2d902ddd27278fdd4517eda18c1ad613b91d44
parent 4582196f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ cc_defaults {
        ":BluetoothSyspropsSources",
        "module.cc",
        "module_dumper.cc",
        "module_dumper_flatbuffer.cc",
        "stack_manager.cc",
    ],
    generated_headers: [
+1 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ static_library("libbluetooth_gd") {
  sources = [
    "module.cc",
    "module_dumper.cc",
    "module_dumper_flatbuffer.cc",
    "stack_manager.cc",
  ]

+4 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#include "common/init_flags.h"
#include "common/strings.h"
#include "hal/snoop_logger_common.h"
#include "module_dumper_flatbuffer.h"
#include "os/files.h"
#include "os/log.h"
#include "os/parameter_provider.h"
@@ -1366,10 +1367,11 @@ void SnoopLogger::Stop() {
  }
}

DumpsysDataFinisher SnoopLogger::GetDumpsysData(flatbuffers::FlatBufferBuilder* builder) const {
DumpsysDataFinisher SnoopLogger::GetDumpsysData(
    flatbuffers::FlatBufferBuilder* /* builder */) const {
  LOG_DEBUG("Dumping btsnooz log data to %s", snooz_log_path_.c_str());
  DumpSnoozLogToFile(btsnooz_buffer_.Pull());
  return Module::GetDumpsysData(builder);
  return EmptyDumpsysDataFinisher;
}

size_t SnoopLogger::GetMaxPacketsPerFile() {
+1 −2
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@
#include "module.h"

#include "common/init_flags.h"
#include "module_dumper_flatbuffer.h"

using ::bluetooth::os::Handler;
using ::bluetooth::os::Thread;
@@ -34,8 +35,6 @@ Handler* Module::GetHandler() const {
  return handler_;
}

DumpsysDataFinisher EmptyDumpsysDataFinisher = [](DumpsysDataBuilder* /* dumpsys_data_builder */) {
};
DumpsysDataFinisher Module::GetDumpsysData(flatbuffers::FlatBufferBuilder* /* builder */) const {
  return EmptyDumpsysDataFinisher;
}
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "module_dumper_flatbuffer.h"

#include "dumpsys_data_generated.h"

namespace bluetooth {
DumpsysDataFinisher EmptyDumpsysDataFinisher = [](DumpsysDataBuilder* /* dumpsys_data_builder */) {
};
}  // namespace bluetooth
Loading