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

Commit b98e0049 authored by Michael Sun's avatar Michael Sun Committed by Automerger Merge Worker
Browse files

Merge "floss: Introduce metrics topshim and Floss metrics skeleton" am: 3879723c

parents 1aef8f96 3879723c
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -14,9 +14,25 @@
#  limitations under the License.
#

source_set("BluetoothMetricsSources_chromeos") {
  sources = [ "chromeos/metrics.cc" ]
  configs += [ "//bt/system/gd:gd_defaults" ]
}

source_set("BluetoothMetricsSources_linux") {
  sources = [ "linux/metrics.cc" ]
  configs += [ "//bt/system/gd:gd_defaults" ]
}

source_set("BluetoothMetricsSources") {
  sources = [ "counter_metrics.cc" ]

  configs += [ "//bt/system/gd:gd_defaults" ]
  deps = [ "//bt/system/gd:gd_default_deps" ]

  if (target_os == "chromeos") {
    deps += [ ":BluetoothMetricsSources_chromeos" ]
  } else {
    deps += [ ":BluetoothMetricsSources_linux" ]
  }
}
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 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.
 */
#define LOG_TAG "BluetoothMetrics"

#include "gd/metrics/metrics.h"

namespace bluetooth {
namespace metrics {

void LogMetricsAdapterStateChanged(uint32_t state){};

}  // namespace metrics
}  // namespace bluetooth
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 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.
 */
#define LOG_TAG "BluetoothMetrics"

#include "gd/metrics/metrics.h"

namespace bluetooth {
namespace metrics {

void LogMetricsAdapterStateChanged(uint32_t state){};

}  // namespace metrics
}  // namespace bluetooth
+26 −0
Original line number Diff line number Diff line
/*
 * Copyright 2022 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.
 */
#pragma once

#include <cstdint>

namespace bluetooth {
namespace metrics {

void LogMetricsAdapterStateChanged(uint32_t state);

}  // namespace metrics
}  // namespace bluetooth
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ use bt_topshim::btif::{
    BtScanMode, BtSspVariant, BtState, BtStatus, BtTransport, RawAddress, Uuid, Uuid128Bit,
};
use bt_topshim::{
    metrics,
    profiles::hid_host::{HHCallbacksDispatcher, HidHost},
    profiles::sdp::{BtSdpRecord, Sdp, SdpCallbacks, SdpCallbacksDispatcher},
    topstack,
@@ -595,6 +596,7 @@ impl BtifBluetoothCallbacks for Bluetooth {
    fn adapter_state_changed(&mut self, state: BtState) {
        let prev_state = self.state.clone();
        self.state = state;
        metrics::adapter_state_changed(self.state.clone());

        // If it's the same state as before, no further action
        if self.state == prev_state {
Loading