summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/app/src/com/android/bluetooth/BluetoothObexTransport.java6
-rw-r--r--android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java15
-rw-r--r--android/app/src/com/android/bluetooth/a2dp/A2dpService.java1
-rw-r--r--android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java15
-rw-r--r--android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java16
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterProperties.java16
-rw-r--r--android/app/src/com/android/bluetooth/btservice/AdapterService.java23
-rw-r--r--android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java11
-rw-r--r--android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java9
-rw-r--r--android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java9
-rw-r--r--android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java11
-rw-r--r--android/app/src/com/android/bluetooth/hid/HidHostService.java16
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java6
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java13
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java23
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java5
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppService.java4
-rw-r--r--android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java18
-rw-r--r--android/app/src/com/android/bluetooth/sdp/SdpManager.java25
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java7
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java1
-rw-r--r--android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java1
-rw-r--r--flags/framework.aconfig10
-rw-r--r--system/bta/le_audio/metrics_collector.cc6
-rw-r--r--system/bta/le_audio/metrics_collector_test.cc10
-rw-r--r--system/btif/src/btif_a2dp_source.cc8
-rw-r--r--system/common/Android.bp11
-rw-r--r--system/common/BUILD.gn2
-rw-r--r--system/common/metrics.cc94
-rw-r--r--system/common/metrics.h66
-rw-r--r--system/common/metrics_linux.cc47
-rw-r--r--system/gd/Android.bp2
-rw-r--r--system/gd/os/android/metrics.cc56
-rw-r--r--system/gd/os/chromeos/metrics.cc14
-rw-r--r--system/gd/os/host/metrics.cc14
-rw-r--r--system/gd/os/linux/metrics.cc15
-rw-r--r--system/gd/os/metrics.h17
-rw-r--r--system/stack/acl/btm_acl.cc8
-rw-r--r--system/stack/btm/btm_ble_sec.cc5
-rw-r--r--system/stack/btm/btm_sec.cc7
-rw-r--r--system/stack/btm/security_event_parser.cc7
-rw-r--r--system/stack/btu/btu_hcif.cc38
42 files changed, 208 insertions, 480 deletions
diff --git a/android/app/src/com/android/bluetooth/BluetoothObexTransport.java b/android/app/src/com/android/bluetooth/BluetoothObexTransport.java
index 3c57ec1600..d101f1736e 100644
--- a/android/app/src/com/android/bluetooth/BluetoothObexTransport.java
+++ b/android/app/src/com/android/bluetooth/BluetoothObexTransport.java
@@ -18,7 +18,6 @@ package com.android.bluetooth;
import android.annotation.SuppressLint;
import android.bluetooth.BluetoothSocket;
-import com.android.bluetooth.flags.Flags;
import com.android.obex.ObexTransport;
import java.io.DataInputStream;
@@ -112,10 +111,7 @@ public class BluetoothObexTransport implements ObexTransport {
if (mSocket == null) {
return null;
}
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(mSocket.getRemoteDevice())
- : mSocket.getRemoteDevice().getIdentityAddress();
+ String identityAddress = Utils.getBrEdrAddress(mSocket.getRemoteDevice());
return mSocket.getConnectionType() == BluetoothSocket.TYPE_RFCOMM
? identityAddress
: mSocket.getRemoteDevice().getAddress();
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java b/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java
index fe74b2facd..688f57ce8a 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpNativeInterface.java
@@ -29,8 +29,6 @@ import android.bluetooth.BluetoothCodecType;
import android.bluetooth.BluetoothDevice;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import java.lang.annotation.Native;
@@ -41,15 +39,12 @@ import java.util.List;
public class A2dpNativeInterface {
private static final String TAG = A2dpNativeInterface.class.getSimpleName();
- private final AdapterService mAdapterService;
@Native private final A2dpNativeCallback mNativeCallback;
private BluetoothCodecType[] mSupportedCodecTypes;
@VisibleForTesting
- A2dpNativeInterface(
- @NonNull AdapterService adapterService, @NonNull A2dpNativeCallback nativeCallback) {
- mAdapterService = requireNonNull(adapterService);
+ A2dpNativeInterface(@NonNull A2dpNativeCallback nativeCallback) {
mNativeCallback = requireNonNull(nativeCallback);
}
@@ -132,15 +127,11 @@ public class A2dpNativeInterface {
return setCodecConfigPreferenceNative(getByteAddress(device), codecConfigArray);
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
+ return Utils.getByteBrEdrAddress(device);
}
private native void initNative(
diff --git a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
index de37a5b3f4..6633e4e2ea 100644
--- a/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
+++ b/android/app/src/com/android/bluetooth/a2dp/A2dpService.java
@@ -125,7 +125,6 @@ public class A2dpService extends ProfileService {
nativeInterface,
() ->
new A2dpNativeInterface(
- adapterService,
new A2dpNativeCallback(adapterService, this)));
mDatabaseManager = requireNonNull(mAdapterService.getDatabase());
mAudioManager = requireNonNull(getSystemService(AudioManager.class));
diff --git a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
index e3b4c400a3..6822e4e734 100644
--- a/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/a2dpsink/A2dpSinkNativeInterface.java
@@ -23,7 +23,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -78,14 +77,6 @@ public class A2dpSinkNativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
- }
-
/**
* Initiates an A2DP connection to a remote device.
*
@@ -93,7 +84,7 @@ public class A2dpSinkNativeInterface {
* @return true on success, otherwise false.
*/
public boolean connectA2dpSink(BluetoothDevice device) {
- return connectA2dpNative(getByteAddress(device));
+ return connectA2dpNative(Utils.getByteBrEdrAddress(device));
}
/**
@@ -103,7 +94,7 @@ public class A2dpSinkNativeInterface {
* @return true on success, otherwise false.
*/
public boolean disconnectA2dpSink(BluetoothDevice device) {
- return disconnectA2dpNative(getByteAddress(device));
+ return disconnectA2dpNative(Utils.getByteBrEdrAddress(device));
}
/**
@@ -120,7 +111,7 @@ public class A2dpSinkNativeInterface {
// Translate to byte address for JNI. Use an all 0 MAC for no active device
byte[] address = null;
if (device != null) {
- address = getByteAddress(device);
+ address = Utils.getByteBrEdrAddress(device);
} else {
address = Utils.getBytesFromAddress("00:00:00:00:00:00");
}
diff --git a/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java b/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
index 720ce84dd8..85d1043023 100644
--- a/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/avrcp/AvrcpNativeInterface.java
@@ -28,7 +28,6 @@ import com.android.bluetooth.audio_util.PlayStatus;
import com.android.bluetooth.audio_util.PlayerInfo;
import com.android.bluetooth.audio_util.PlayerSettingsManager.PlayerSettingsValues;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -93,10 +92,7 @@ public class AvrcpNativeInterface {
}
void setBipClientStatus(BluetoothDevice device, boolean connected) {
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String identityAddress = Utils.getBrEdrAddress(device);
setBipClientStatusNative(identityAddress, connected);
}
@@ -237,10 +233,7 @@ public class AvrcpNativeInterface {
}
boolean disconnectDevice(BluetoothDevice device) {
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String identityAddress = Utils.getBrEdrAddress(device);
d("disconnectDevice: identityAddress=" + identityAddress);
return disconnectDeviceNative(identityAddress);
}
@@ -278,10 +271,7 @@ public class AvrcpNativeInterface {
void sendVolumeChanged(BluetoothDevice device, int volume) {
d("sendVolumeChanged: volume=" + volume);
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String identityAddress = Utils.getBrEdrAddress(device);
sendVolumeChangedNative(identityAddress, volume);
}
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
index bd483f5925..013c799af7 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterProperties.java
@@ -55,7 +55,6 @@ import androidx.annotation.VisibleForTesting;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.RemoteDevices.DeviceProperties;
-import com.android.bluetooth.flags.Flags;
import com.android.modules.utils.build.SdkLevel;
import java.io.FileDescriptor;
@@ -531,10 +530,7 @@ class AdapterProperties {
void cleanupPrevBondRecordsFor(BluetoothDevice device) {
String address = device.getAddress();
- String identityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device, mService)
- : mService.getIdentityAddress(address);
+ String identityAddress = Utils.getBrEdrAddress(device, mService);
int deviceType = mRemoteDevices.getDeviceProperties(device).getDeviceType();
debugLog("cleanupPrevBondRecordsFor: " + device + ", device type: " + deviceType);
if (identityAddress == null) {
@@ -547,10 +543,7 @@ class AdapterProperties {
for (BluetoothDevice existingDevice : mBondedDevices) {
String existingAddress = existingDevice.getAddress();
- String existingIdentityAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(existingDevice, mService)
- : mService.getIdentityAddress(existingAddress);
+ String existingIdentityAddress = Utils.getBrEdrAddress(existingDevice, mService);
int existingDeviceType =
mRemoteDevices.getDeviceProperties(existingDevice).getDeviceType();
@@ -1100,10 +1093,7 @@ class AdapterProperties {
StringBuilder sb = new StringBuilder();
for (BluetoothDevice device : mBondedDevices) {
String address = device.getAddress();
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mService.getIdentityAddress(address);
+ String brEdrAddress = Utils.getBrEdrAddress(device);
if (brEdrAddress.equals(address)) {
writer.println(
" "
diff --git a/android/app/src/com/android/bluetooth/btservice/AdapterService.java b/android/app/src/com/android/bluetooth/btservice/AdapterService.java
index 9bec63769d..e9202c4f6c 100644
--- a/android/app/src/com/android/bluetooth/btservice/AdapterService.java
+++ b/android/app/src/com/android/bluetooth/btservice/AdapterService.java
@@ -2689,12 +2689,8 @@ public class AdapterService extends Service {
return Utils.getBytesFromAddress(deviceProp.getIdentityAddress());
}
- if (Flags.identityAddressNullIfNotKnown()) {
- // Return null if identity address unknown
- return null;
- } else {
- return Utils.getByteAddress(device);
- }
+ // Return null if identity address unknown
+ return null;
}
public BluetoothDevice getDeviceFromByte(byte[] address) {
@@ -2712,14 +2708,9 @@ public class AdapterService extends Service {
DeviceProperties deviceProp = mRemoteDevices.getDeviceProperties(device);
if (deviceProp != null && deviceProp.getIdentityAddress() != null) {
return deviceProp.getIdentityAddress();
- } else {
- if (Flags.identityAddressNullIfNotKnown()) {
- // Return null if identity address unknown
- return null;
- } else {
- return address;
- }
}
+ // Return null if identity address unknown
+ return null;
}
/**
@@ -2745,11 +2736,7 @@ public class AdapterService extends Service {
}
identityAddressType = deviceProp.getIdentityAddressType();
} else {
- if (Flags.identityAddressNullIfNotKnown()) {
- identityAddress = null;
- } else {
- identityAddress = address;
- }
+ identityAddress = null;
}
return new BluetoothAddress(identityAddress, identityAddressType);
diff --git a/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java b/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java
index f9dcbe8017..0bdebd30e5 100644
--- a/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java
+++ b/android/app/src/com/android/bluetooth/btservice/BluetoothSocketManagerBinder.java
@@ -29,7 +29,6 @@ import android.os.ParcelUuid;
import android.util.Log;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.flags.Flags;
class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
private static final String TAG = BluetoothSocketManagerBinder.class.getSimpleName();
@@ -58,10 +57,7 @@ class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
return null;
}
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mService.getIdentityAddress(device.getAddress());
+ String brEdrAddress = Utils.getBrEdrAddress(device);
Log.i(
TAG,
@@ -118,10 +114,7 @@ class BluetoothSocketManagerBinder extends IBluetoothSocketManager.Stub {
mService.enforceCallingOrSelfPermission(BLUETOOTH_PRIVILEGED, null);
enforceSocketOffloadSupport(type);
}
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : mService.getIdentityAddress(device.getAddress());
+ String brEdrAddress = Utils.getBrEdrAddress(device);
Log.i(
TAG,
diff --git a/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java b/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
index 5afe78cee5..e3816ed636 100644
--- a/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hfp/HeadsetNativeInterface.java
@@ -24,7 +24,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
/**
@@ -84,16 +83,12 @@ public class HeadsetNativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
+ private static byte[] getByteAddress(BluetoothDevice device) {
if (device == null) {
// Set bt_stack's active device to default if java layer set active device to null
return Utils.getBytesFromAddress("00:00:00:00:00:00");
}
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
+ return Utils.getByteBrEdrAddress(device);
}
void onConnectionStateChanged(int state, byte[] address) {
diff --git a/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java b/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java
index fbb68747fe..bcbb49fba6 100644
--- a/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hfpclient/NativeInterface.java
@@ -27,7 +27,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting;
@@ -334,12 +333,8 @@ public class NativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
+ private static byte[] getByteAddress(BluetoothDevice device) {
+ return Utils.getByteBrEdrAddress(device);
}
// Callbacks from the native back into the java framework. All callbacks are routed via the
diff --git a/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java b/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java
index 2ca9078103..dc269b7abf 100644
--- a/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java
+++ b/android/app/src/com/android/bluetooth/hid/HidDeviceNativeInterface.java
@@ -29,7 +29,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
/** HID Device Native Interface to/from JNI. */
@@ -123,7 +122,7 @@ public class HidDeviceNativeInterface {
* @return the result of the native call
*/
public boolean connect(BluetoothDevice device) {
- return connectNative(getByteAddress(device));
+ return connectNative(Utils.getByteBrEdrAddress(device));
}
/**
@@ -243,14 +242,6 @@ public class HidDeviceNativeInterface {
return mAdapterService.getDeviceFromByte(address);
}
- private byte[] getByteAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
- }
-
private native void initNative();
private native void cleanupNative();
diff --git a/android/app/src/com/android/bluetooth/hid/HidHostService.java b/android/app/src/com/android/bluetooth/hid/HidHostService.java
index 1eac6ed336..68c2be4a8b 100644
--- a/android/app/src/com/android/bluetooth/hid/HidHostService.java
+++ b/android/app/src/com/android/bluetooth/hid/HidHostService.java
@@ -162,14 +162,6 @@ public class HidHostService extends ProfileService {
setHidHostService(null);
}
- private byte[] getIdentityAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getByteBrEdrAddress(mAdapterService, device);
- } else {
- return mAdapterService.getByteIdentityAddress(device);
- }
- }
-
private byte[] getByteAddress(BluetoothDevice device, int transport) {
final ParcelUuid[] uuids = mAdapterService.getRemoteUuids(device);
@@ -177,14 +169,14 @@ public class HidHostService extends ProfileService {
// Use pseudo address when HOGP is to be used
return Utils.getByteAddress(device);
} else if (transport == BluetoothDevice.TRANSPORT_BREDR) {
- // Use identity address if HID is to be used
- return getIdentityAddress(device);
+ // Use BR/EDR address if HID is to be used
+ return Utils.getByteBrEdrAddress(mAdapterService, device);
} else { // BluetoothDevice.TRANSPORT_AUTO
boolean hidSupported = Utils.arrayContains(uuids, BluetoothUuid.HID);
// Prefer HID over HOGP
if (hidSupported) {
- // Use identity address if HID is available
- return getIdentityAddress(device);
+ // Use BR/EDR address if HID is available
+ return Utils.getByteBrEdrAddress(mAdapterService, device);
} else {
// Otherwise use pseudo address
return Utils.getByteAddress(device);
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
index 81c59f8ad2..d87bd420fe 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppHandoverReceiver.java
@@ -25,7 +25,6 @@ import android.util.Log;
import com.android.bluetooth.BluetoothMethodProxy;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.flags.Flags;
import java.util.ArrayList;
@@ -82,10 +81,7 @@ public class BluetoothOppHandoverReceiver extends BroadcastReceiver {
if (device == null) {
return;
}
- String brEdrAddress =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device)
- : device.getIdentityAddress();
+ String brEdrAddress = Utils.getBrEdrAddress(device);
Log.d(TAG, "Adding " + brEdrAddress + " to acceptlist");
BluetoothOppManager.getInstance(context).addToAcceptlist(brEdrAddress);
} else if (action.equals(Constants.ACTION_STOP_HANDOVER)) {
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java
index 730c1e9ce2..c745f243d4 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppManager.java
@@ -54,7 +54,6 @@ import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import java.util.ArrayList;
@@ -480,11 +479,7 @@ public class BluetoothOppManager {
}
values.put(BluetoothShare.MIMETYPE, contentType);
- values.put(
- BluetoothShare.DESTINATION,
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(mRemoteDevice)
- : mRemoteDevice.getIdentityAddress());
+ values.put(BluetoothShare.DESTINATION, Utils.getBrEdrAddress(mRemoteDevice));
values.put(BluetoothShare.TIMESTAMP, ts);
if (mIsHandoverInitiated) {
values.put(
@@ -512,11 +507,7 @@ public class BluetoothOppManager {
ContentValues values = new ContentValues();
values.put(BluetoothShare.URI, mUri);
values.put(BluetoothShare.MIMETYPE, mTypeOfSingleFile);
- values.put(
- BluetoothShare.DESTINATION,
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(mRemoteDevice)
- : mRemoteDevice.getIdentityAddress());
+ values.put(BluetoothShare.DESTINATION, Utils.getBrEdrAddress(mRemoteDevice));
if (mIsHandoverInitiated) {
values.put(
BluetoothShare.USER_CONFIRMATION,
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
index 6164cb4f58..114adfe631 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppPreference.java
@@ -32,7 +32,6 @@
package com.android.bluetooth.opp;
-import android.annotation.SuppressLint;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothUtils;
import android.content.Context;
@@ -41,7 +40,6 @@ import android.content.SharedPreferences.Editor;
import android.util.Log;
import com.android.bluetooth.Utils;
-import com.android.bluetooth.flags.Flags;
import java.util.HashMap;
@@ -87,11 +85,11 @@ public class BluetoothOppPreference {
}
private static String getChannelKey(BluetoothDevice remoteDevice, int uuid) {
- return getBrEdrAddress(remoteDevice) + "_" + Integer.toHexString(uuid);
+ return Utils.getBrEdrAddress(remoteDevice) + "_" + Integer.toHexString(uuid);
}
public String getName(BluetoothDevice remoteDevice) {
- String identityAddress = getBrEdrAddress(remoteDevice);
+ String identityAddress = Utils.getBrEdrAddress(remoteDevice);
if (identityAddress != null && identityAddress.equals("FF:FF:FF:00:00:00")) {
return "localhost";
}
@@ -113,7 +111,8 @@ public class BluetoothOppPreference {
Log.v(
TAG,
"getChannel for "
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(remoteDevice))
+ + BluetoothUtils.toAnonymizedAddress(
+ Utils.getBrEdrAddress(remoteDevice))
+ "_"
+ Integer.toHexString(uuid)
+ " as "
@@ -123,7 +122,7 @@ public class BluetoothOppPreference {
}
public void setName(BluetoothDevice remoteDevice, String name) {
- String brEdrAddress = getBrEdrAddress(remoteDevice);
+ String brEdrAddress = Utils.getBrEdrAddress(remoteDevice);
Log.v(
TAG,
"setName for " + BluetoothUtils.toAnonymizedAddress(brEdrAddress) + " to " + name);
@@ -139,7 +138,7 @@ public class BluetoothOppPreference {
Log.v(
TAG,
"setChannel for "
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(remoteDevice))
+ + BluetoothUtils.toAnonymizedAddress(Utils.getBrEdrAddress(remoteDevice))
+ "_"
+ Integer.toHexString(uuid)
+ " to "
@@ -163,7 +162,7 @@ public class BluetoothOppPreference {
public void removeName(BluetoothDevice remoteDevice) {
Editor ed = mNamePreference.edit();
- String key = getBrEdrAddress(remoteDevice);
+ String key = Utils.getBrEdrAddress(remoteDevice);
ed.remove(key);
ed.apply();
mNames.remove(key);
@@ -175,12 +174,4 @@ public class BluetoothOppPreference {
Log.d(TAG, "Dumping Channels: ");
Log.d(TAG, mChannels.toString());
}
-
- @SuppressLint("AndroidFrameworkRequiresPermission")
- private static String getBrEdrAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getBrEdrAddress(device);
- }
- return device.getIdentityAddress();
- }
}
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
index eb9b7f91c4..77dadd9a65 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppReceiver.java
@@ -52,7 +52,6 @@ import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.R;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
-import com.android.bluetooth.flags.Flags;
/**
* Receives and handles: system broadcasts; Intents from other applications; Intents from
@@ -81,9 +80,7 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
TAG,
"Received BT device selected intent, bt device: "
+ BluetoothUtils.toAnonymizedAddress(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(remoteDevice)
- : remoteDevice.getIdentityAddress()));
+ Utils.getBrEdrAddress(remoteDevice)));
// Insert transfer session record to database
mOppManager.startTransfer(remoteDevice);
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java
index 46bed2ba89..f043cbcc53 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppService.java
@@ -1346,9 +1346,7 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
+ socket
+ " \n :device :"
+ BluetoothUtils.toAnonymizedAddress(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device, mAdapterService)
- : mAdapterService.getIdentityAddress(device.getAddress())));
+ Utils.getBrEdrAddress(device, mAdapterService)));
if (!mAcceptNewConnections) {
Log.d(TAG, " onConnect BluetoothSocket :" + socket + " rejected");
return false;
diff --git a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
index 1ff73d1b48..5e92f1e81e 100644
--- a/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
+++ b/android/app/src/com/android/bluetooth/opp/BluetoothOppTransfer.java
@@ -63,7 +63,6 @@ import com.android.bluetooth.BluetoothObexTransport;
import com.android.bluetooth.BluetoothStatsLog;
import com.android.bluetooth.Utils;
import com.android.bluetooth.content_profiles.ContentProfileErrorReportUtils;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.VisibleForTesting;
import com.android.obex.ObexTransport;
@@ -116,7 +115,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
Log.e(
TAG,
"device : "
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(device))
+ + BluetoothUtils.toAnonymizedAddress(
+ Utils.getBrEdrAddress(device))
+ " mBatch :"
+ mBatch
+ " mCurrentShare :"
@@ -133,7 +133,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
Log.v(
TAG,
"Device :"
- + BluetoothUtils.toAnonymizedAddress(getBrEdrAddress(device))
+ + BluetoothUtils.toAnonymizedAddress(
+ Utils.getBrEdrAddress(device))
+ "- OPP device: "
+ mBatch.mDestination
+ " \n mCurrentShare.mConfirm == "
@@ -180,8 +181,8 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
3);
return;
}
- String deviceIdentityAddress = getBrEdrAddress(device);
- String transferDeviceIdentityAddress = getBrEdrAddress(mDevice);
+ String deviceIdentityAddress = Utils.getBrEdrAddress(device);
+ String transferDeviceIdentityAddress = Utils.getBrEdrAddress(mDevice);
if (deviceIdentityAddress == null
|| transferDeviceIdentityAddress == null
|| !deviceIdentityAddress.equalsIgnoreCase(
@@ -1008,11 +1009,4 @@ public class BluetoothOppTransfer implements BluetoothOppBatch.BluetoothOppBatch
}
}
}
-
- private static String getBrEdrAddress(BluetoothDevice device) {
- if (Flags.identityAddressNullIfNotKnown()) {
- return Utils.getBrEdrAddress(device);
- }
- return device.getIdentityAddress();
- }
}
diff --git a/android/app/src/com/android/bluetooth/sdp/SdpManager.java b/android/app/src/com/android/bluetooth/sdp/SdpManager.java
index 3a316f8457..de6193aeb2 100644
--- a/android/app/src/com/android/bluetooth/sdp/SdpManager.java
+++ b/android/app/src/com/android/bluetooth/sdp/SdpManager.java
@@ -35,7 +35,6 @@ import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AbstractionLayer;
import com.android.bluetooth.btservice.AdapterService;
-import com.android.bluetooth.flags.Flags;
import com.android.internal.annotations.GuardedBy;
import java.util.ArrayList;
@@ -143,16 +142,10 @@ public class SdpManager {
SdpSearchInstance getSearchInstance(byte[] address, byte[] uuidBytes) {
String addressString = Utils.getAddressStringFromByte(address);
- addressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(addressString, mAdapterService)
- : mAdapterService.getIdentityAddress(addressString);
+ addressString = Utils.getBrEdrAddress(addressString, mAdapterService);
ParcelUuid uuid = Utils.byteArrayToUuid(uuidBytes)[0];
for (SdpSearchInstance inst : mList) {
- String instAddressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(inst.getDevice(), mAdapterService)
- : mAdapterService.getIdentityAddress(inst.getDevice().getAddress());
+ String instAddressString = Utils.getBrEdrAddress(inst.getDevice(), mAdapterService);
if (instAddressString.equals(addressString) && inst.getUuid().equals(uuid)) {
return inst;
}
@@ -161,15 +154,9 @@ public class SdpManager {
}
boolean isSearching(BluetoothDevice device, ParcelUuid uuid) {
- String addressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(device, mAdapterService)
- : mAdapterService.getIdentityAddress(device.getAddress());
+ String addressString = Utils.getBrEdrAddress(device, mAdapterService);
for (SdpSearchInstance inst : mList) {
- String instAddressString =
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getBrEdrAddress(inst.getDevice(), mAdapterService)
- : mAdapterService.getIdentityAddress(inst.getDevice().getAddress());
+ String instAddressString = Utils.getBrEdrAddress(inst.getDevice(), mAdapterService);
if (instAddressString != null
&& addressString != null
&& instAddressString.equals(addressString)
@@ -473,9 +460,7 @@ public class SdpManager {
inst.startSearch(); // Trigger timeout message
mNativeInterface.sdpSearch(
- Flags.identityAddressNullIfNotKnown()
- ? Utils.getByteBrEdrAddress(inst.getDevice())
- : mAdapterService.getByteIdentityAddress(inst.getDevice()),
+ Utils.getByteBrEdrAddress(inst.getDevice()),
Utils.uuidToByteArray(inst.getUuid()));
} else { // Else queue is empty.
Log.d(
diff --git a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java
index a9e01b3086..6c7b1ed44e 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/btservice/AdapterServiceTest.java
@@ -907,10 +907,6 @@ public class AdapterServiceTest {
// Create device properties
RemoteDevices remoteDevices = mAdapterService.getRemoteDevices();
remoteDevices.addDeviceProperties(Utils.getBytesFromAddress((TEST_BT_ADDR_1)));
- String identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1);
- if (!Flags.identityAddressNullIfNotKnown()) {
- assertThat(identityAddress).isEqualTo(TEST_BT_ADDR_1);
- }
// Trigger address consolidate callback
remoteDevices.addressConsolidateCallback(
@@ -918,7 +914,7 @@ public class AdapterServiceTest {
Utils.getBytesFromAddress(TEST_BT_ADDR_2));
// Verify we can get correct identity address
- identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1);
+ String identityAddress = mAdapterService.getIdentityAddress(TEST_BT_ADDR_1);
assertThat(identityAddress).isEqualTo(TEST_BT_ADDR_2);
assertThat(mLooper.nextMessage()).isNull();
}
@@ -955,7 +951,6 @@ public class AdapterServiceTest {
}
@Test
- @EnableFlags(Flags.FLAG_IDENTITY_ADDRESS_NULL_IF_NOT_KNOWN)
public void testIdentityAddressNullIfUnknown() {
BluetoothDevice device = getTestDevice(0);
diff --git a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
index f6c393909c..3ab02065e3 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/opp/BluetoothOppTransferTest.java
@@ -390,7 +390,6 @@ public class BluetoothOppTransferTest {
@Test
public void oppConnectionReceiver_onReceiveWithActionSdpRecord_withoutSdpRecord() {
- mSetFlagRule.enableFlags(Flags.FLAG_IDENTITY_ADDRESS_NULL_IF_NOT_KNOWN);
BluetoothDevice device =
InstrumentationRegistry.getInstrumentation()
.getTargetContext()
diff --git a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java
index dfcc542467..b594ac70b4 100644
--- a/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java
+++ b/android/app/tests/unit/src/com/android/bluetooth/pbapclient/PbapClientObexTransportTest.java
@@ -183,7 +183,6 @@ public class PbapClientObexTransportTest {
public void testGetRemoteAddress_transportRfcomm_returnsDeviceIdentityAddress() {
doReturn(BluetoothSocket.TYPE_RFCOMM).when(mMockSocket).getConnectionType();
PbapClientObexTransport transport = new PbapClientObexTransport(mMockSocket);
- // See "Flags.identityAddressNullIfNotKnown():"
// Identity address won't be "known" by the stack for a test device, so it'll return null.
// assertThat(transport.getRemoteAddress()).isNull();
assertThat(transport.getRemoteAddress()).isEqualTo(mTestDevice.getAddress());
diff --git a/flags/framework.aconfig b/flags/framework.aconfig
index dc48541118..0151b46c70 100644
--- a/flags/framework.aconfig
+++ b/flags/framework.aconfig
@@ -10,16 +10,6 @@ flag {
}
flag {
- name: "identity_address_null_if_not_known"
- namespace: "bluetooth"
- description: "Return null for identity address if identity address is not known"
- bug: "317120534"
- metadata {
- purpose: PURPOSE_BUGFIX
- }
-}
-
-flag {
name: "support_bluetooth_quality_report_v6"
is_exported: true
namespace: "bluetooth"
diff --git a/system/bta/le_audio/metrics_collector.cc b/system/bta/le_audio/metrics_collector.cc
index a4fb4a353d..24da2e085c 100644
--- a/system/bta/le_audio/metrics_collector.cc
+++ b/system/bta/le_audio/metrics_collector.cc
@@ -25,9 +25,9 @@
#include <unordered_map>
#include <vector>
-#include "common/metrics.h"
#include "hardware/bt_le_audio.h"
#include "le_audio_types.h"
+#include "os/metrics.h"
#include "types/raw_address.h"
namespace bluetooth::le_audio {
@@ -199,7 +199,7 @@ public:
device_address[i] = device_metric->address_;
}
- bluetooth::common::LogLeAudioConnectionSessionReported(
+ bluetooth::os::LogMetricLeAudioConnectionSessionReported(
group_size_, group_id_, connection_duration_nanos, device_connecting_offset_nanos,
device_connected_offset_nanos, device_connection_duration_nanos,
device_connection_statuses, device_disconnection_statuses, device_address,
@@ -278,7 +278,7 @@ void MetricsCollector::OnBroadcastStateChanged(bool started) {
broadcast_beginning_timepoint_ = std::chrono::high_resolution_clock::now();
} else {
auto broadcast_ending_timepoint_ = std::chrono::high_resolution_clock::now();
- bluetooth::common::LogLeAudioBroadcastSessionReported(
+ bluetooth::os::LogMetricLeAudioBroadcastSessionReported(
get_timedelta_nanos(broadcast_beginning_timepoint_, broadcast_ending_timepoint_));
broadcast_beginning_timepoint_ = kInvalidTimePoint;
}
diff --git a/system/bta/le_audio/metrics_collector_test.cc b/system/bta/le_audio/metrics_collector_test.cc
index c94db90ad6..199199bf8a 100644
--- a/system/bta/le_audio/metrics_collector_test.cc
+++ b/system/bta/le_audio/metrics_collector_test.cc
@@ -23,7 +23,7 @@
#include <cstdint>
#include <vector>
-#include "common/metrics.h"
+#include "os/metrics.h"
#include "types/raw_address.h"
using testing::_;
@@ -57,9 +57,9 @@ std::vector<int64_t> last_streaming_duration_nanos;
std::vector<int32_t> last_streaming_context_type;
namespace bluetooth {
-namespace common {
+namespace os {
-void LogLeAudioConnectionSessionReported(
+void LogMetricLeAudioConnectionSessionReported(
int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
const std::vector<int64_t>& device_connecting_offset_nanos,
const std::vector<int64_t>& device_connected_offset_nanos,
@@ -85,11 +85,11 @@ void LogLeAudioConnectionSessionReported(
last_streaming_context_type = streaming_context_type;
}
-void LogLeAudioBroadcastSessionReported(int64_t duration_nanos) {
+void LogMetricLeAudioBroadcastSessionReported(int64_t duration_nanos) {
last_broadcast_duration_nanos = duration_nanos;
}
-} // namespace common
+} // namespace os
} // namespace bluetooth
namespace bluetooth::le_audio {
diff --git a/system/btif/src/btif_a2dp_source.cc b/system/btif/src/btif_a2dp_source.cc
index 20805a92bd..5bf2ef0d87 100644
--- a/system/btif/src/btif_a2dp_source.cc
+++ b/system/btif/src/btif_a2dp_source.cc
@@ -48,7 +48,6 @@
#include "btif_hf.h"
#include "btm_iso_api.h"
#include "common/message_loop_thread.h"
-#include "common/metrics.h"
#include "common/repeating_timer.h"
#include "common/time_util.h"
#include "hardware/bt_av.h"
@@ -1302,8 +1301,7 @@ static void btm_read_rssi_cb(void* data) {
return;
}
- bluetooth::shim::LogMetricReadRssiResult(result->rem_bda,
- bluetooth::common::kUnknownConnectionHandle,
+ bluetooth::shim::LogMetricReadRssiResult(result->rem_bda, bluetooth::os::kUnknownConnectionHandle,
result->hci_status, result->rssi);
log::warn("device: {}, rssi: {}", result->rem_bda, result->rssi);
@@ -1321,7 +1319,7 @@ static void btm_read_failed_contact_counter_cb(void* data) {
return;
}
bluetooth::shim::LogMetricReadFailedContactCounterResult(
- result->rem_bda, bluetooth::common::kUnknownConnectionHandle, result->hci_status,
+ result->rem_bda, bluetooth::os::kUnknownConnectionHandle, result->hci_status,
result->failed_contact_counter);
log::warn("device: {}, Failed Contact Counter: {}", result->rem_bda,
@@ -1340,7 +1338,7 @@ static void btm_read_tx_power_cb(void* data) {
return;
}
bluetooth::shim::LogMetricReadTxPowerLevelResult(result->rem_bda,
- bluetooth::common::kUnknownConnectionHandle,
+ bluetooth::os::kUnknownConnectionHandle,
result->hci_status, result->tx_power);
log::warn("device: {}, Tx Power: {}", result->rem_bda, result->tx_power);
diff --git a/system/common/Android.bp b/system/common/Android.bp
index c192613dbc..a22a733e75 100644
--- a/system/common/Android.bp
+++ b/system/common/Android.bp
@@ -32,17 +32,6 @@ cc_library_static {
canonical_path_from_root: false,
export_proto_headers: true,
},
- target: {
- android: {
- srcs: [
- "metrics.cc",
- ],
- static_libs: ["libstatslog_bt"],
- },
- host: {
- srcs: ["metrics_linux.cc"],
- },
- },
shared_libs: [
"libcrypto",
"libcutils",
diff --git a/system/common/BUILD.gn b/system/common/BUILD.gn
index 50ec9c1dd0..5b0852bd36 100644
--- a/system/common/BUILD.gn
+++ b/system/common/BUILD.gn
@@ -19,8 +19,6 @@ static_library("common") {
"address_obfuscator.cc",
"le_conn_params.cc",
"message_loop_thread.cc",
- "metric_id_allocator.cc",
- "metrics_linux.cc",
"os_utils.cc",
"repeating_timer.cc",
"stop_watch_legacy.cc",
diff --git a/system/common/metrics.cc b/system/common/metrics.cc
deleted file mode 100644
index c6c0977115..0000000000
--- a/system/common/metrics.cc
+++ /dev/null
@@ -1,94 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2016 Google, Inc.
- *
- * 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 "common/metrics.h"
-
-#include <bluetooth/log.h>
-#include <frameworks/proto_logging/stats/enums/bluetooth/le/enums.pb.h>
-#include <statslog_bt.h>
-
-#include <cstdint>
-#include <vector>
-
-#include "main/shim/metric_id_api.h"
-#include "types/raw_address.h"
-
-namespace bluetooth {
-namespace common {
-
-void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version,
- uint16_t manufacturer_name, uint16_t subversion) {
- int ret = stats_write(BLUETOOTH_REMOTE_VERSION_INFO_REPORTED, handle, status, version,
- manufacturer_name, subversion);
- if (ret < 0) {
- log::warn(
- "failed for handle {}, status 0x{:x}, version 0x{:x}, "
- "manufacturer_name 0x{:x}, subversion 0x{:x}, error {}",
- handle, status, version, manufacturer_name, subversion, ret);
- }
-}
-
-void LogLeAudioConnectionSessionReported(
- int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
- const std::vector<int64_t>& device_connecting_offset_nanos,
- const std::vector<int64_t>& device_connected_offset_nanos,
- const std::vector<int64_t>& device_connection_duration_nanos,
- const std::vector<int32_t>& device_connection_status,
- const std::vector<int32_t>& device_disconnection_status,
- const std::vector<RawAddress>& device_address,
- const std::vector<int64_t>& streaming_offset_nanos,
- const std::vector<int64_t>& streaming_duration_nanos,
- const std::vector<int32_t>& streaming_context_type) {
- std::vector<int32_t> device_metric_id(device_address.size());
- for (uint64_t i = 0; i < device_address.size(); i++) {
- if (!device_address[i].IsEmpty()) {
- device_metric_id[i] = bluetooth::shim::AllocateIdFromMetricIdAllocator(device_address[i]);
- } else {
- device_metric_id[i] = 0;
- }
- }
- int ret = stats_write(LE_AUDIO_CONNECTION_SESSION_REPORTED, group_size, group_metric_id,
- connection_duration_nanos, device_connecting_offset_nanos,
- device_connected_offset_nanos, device_connection_duration_nanos,
- device_connection_status, device_disconnection_status, device_metric_id,
- streaming_offset_nanos, streaming_duration_nanos, streaming_context_type);
- if (ret < 0) {
- log::warn(
- "failed for group {}device_connecting_offset_nanos[{}], "
- "device_connected_offset_nanos[{}], "
- "device_connection_duration_nanos[{}], device_connection_status[{}], "
- "device_disconnection_status[{}], device_metric_id[{}], "
- "streaming_offset_nanos[{}], streaming_duration_nanos[{}], "
- "streaming_context_type[{}]",
- group_metric_id, device_connecting_offset_nanos.size(),
- device_connected_offset_nanos.size(), device_connection_duration_nanos.size(),
- device_connection_status.size(), device_disconnection_status.size(),
- device_metric_id.size(), streaming_offset_nanos.size(), streaming_duration_nanos.size(),
- streaming_context_type.size());
- }
-}
-
-void LogLeAudioBroadcastSessionReported(int64_t duration_nanos) {
- int ret = stats_write(LE_AUDIO_BROADCAST_SESSION_REPORTED, duration_nanos);
- if (ret < 0) {
- log::warn("failed for duration={}", duration_nanos);
- }
-}
-
-} // namespace common
-} // namespace bluetooth
diff --git a/system/common/metrics.h b/system/common/metrics.h
deleted file mode 100644
index 4d5a234ce5..0000000000
--- a/system/common/metrics.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2016 Google, Inc.
- *
- * 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>
-#include <vector>
-
-#include "types/raw_address.h"
-
-namespace bluetooth {
-namespace common {
-
-/**
- * Unknown connection handle for metrics purpose
- */
-static const uint32_t kUnknownConnectionHandle = 0xFFFF;
-
-/**
- * Logs when we receive Bluetooth Read Remote Version Information Complete
- * Event from the remote device, as documented by the Bluetooth Core HCI
- * specification
- *
- * Reference: 5.0 Core Specification, Vol 2, Part E, Page 1118
- *
- * @param handle handle of associated ACL connection
- * @param status HCI command status of this event
- * @param version version code from read remote version complete event
- * @param manufacturer_name manufacturer code from read remote version complete
- * event
- * @param subversion subversion code from read remote version complete event
- */
-void LogRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version,
- uint16_t manufacturer_name, uint16_t subversion);
-
-void LogLeAudioConnectionSessionReported(
- int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
- const std::vector<int64_t>& device_connecting_offset_nanos,
- const std::vector<int64_t>& device_connected_offset_nanos,
- const std::vector<int64_t>& device_connection_duration_nanos,
- const std::vector<int32_t>& device_connection_status,
- const std::vector<int32_t>& device_disconnection_status,
- const std::vector<RawAddress>& device_address,
- const std::vector<int64_t>& streaming_offset_nanos,
- const std::vector<int64_t>& streaming_duration_nanos,
- const std::vector<int32_t>& streaming_context_type);
-
-void LogLeAudioBroadcastSessionReported(int64_t duration_nanos);
-
-} // namespace common
-} // namespace bluetooth
diff --git a/system/common/metrics_linux.cc b/system/common/metrics_linux.cc
deleted file mode 100644
index e886c05bf3..0000000000
--- a/system/common/metrics_linux.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-/******************************************************************************
- *
- * Copyright 2018 Google, Inc.
- *
- * 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 <cstdint>
-#include <vector>
-
-#include "common/metrics.h"
-#include "types/raw_address.h"
-
-namespace bluetooth {
-namespace common {
-
-void LogRemoteVersionInfo(uint16_t /* handle */, uint8_t /* status */, uint8_t /* version */,
- uint16_t /* manufacturer_name */, uint16_t /* subversion */) {}
-
-void LogLeAudioConnectionSessionReported(
- int32_t /* group_size */, int32_t /* group_metric_id */,
- int64_t /* connection_duration_nanos */,
- const std::vector<int64_t>& /* device_connecting_offset_nanos */,
- const std::vector<int64_t>& /* device_connected_offset_nanos */,
- const std::vector<int64_t>& /* device_connection_duration_nanos */,
- const std::vector<int32_t>& /* device_connection_status */,
- const std::vector<int32_t>& /* device_disconnection_status */,
- const std::vector<RawAddress>& /* device_address */,
- const std::vector<int64_t>& /* streaming_offset_nanos */,
- const std::vector<int64_t>& /* streaming_duration_nanos */,
- const std::vector<int32_t>& /* streaming_context_type */) {}
-
-void LogLeAudioBroadcastSessionReported(int64_t /* duration_nanos */) {}
-
-} // namespace common
-} // namespace bluetooth
diff --git a/system/gd/Android.bp b/system/gd/Android.bp
index 9a6bd02551..45555f130a 100644
--- a/system/gd/Android.bp
+++ b/system/gd/Android.bp
@@ -194,7 +194,7 @@ cc_library_static {
"packages/modules/Bluetooth/system",
],
apex_available: ["com.android.bt"],
- min_sdk_version: "31",
+ min_sdk_version: "33",
static_libs: [
"bluetooth_flags_c_lib",
"libchrome",
diff --git a/system/gd/os/android/metrics.cc b/system/gd/os/android/metrics.cc
index 78b12c8d96..5f5b34ef2e 100644
--- a/system/gd/os/android/metrics.cc
+++ b/system/gd/os/android/metrics.cc
@@ -122,11 +122,9 @@ void LogMetricRemoteVersionInfo(uint16_t handle, uint8_t status, uint8_t version
manufacturer_name, subversion);
if (ret < 0) {
log::warn(
- "Failed for handle {}, status {}, version {}, manufacturer_name {}, subversion {}, "
- "error "
- "{}",
- handle, common::ToHexString(status), common::ToHexString(version),
- common::ToHexString(manufacturer_name), common::ToHexString(subversion), ret);
+ "failed for handle {}, status 0x{:x}, version 0x{:x}, "
+ "manufacturer_name 0x{:x}, subversion 0x{:x}, error {}",
+ handle, status, version, manufacturer_name, subversion, ret);
}
}
@@ -526,5 +524,53 @@ void LogMetricRfcommConnectionAtClose(const Address& address,
}
}
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
+ const std::vector<int64_t>& device_connecting_offset_nanos,
+ const std::vector<int64_t>& device_connected_offset_nanos,
+ const std::vector<int64_t>& device_connection_duration_nanos,
+ const std::vector<int32_t>& device_connection_status,
+ const std::vector<int32_t>& device_disconnection_status,
+ const std::vector<RawAddress>& device_address,
+ const std::vector<int64_t>& streaming_offset_nanos,
+ const std::vector<int64_t>& streaming_duration_nanos,
+ const std::vector<int32_t>& streaming_context_type) {
+ std::vector<int32_t> device_metric_id(device_address.size());
+ for (uint64_t i = 0; i < device_address.size(); i++) {
+ if (!device_address[i].IsEmpty()) {
+ device_metric_id[i] =
+ MetricIdManager::GetInstance().AllocateId(ToGdAddress(device_address[i]));
+ } else {
+ device_metric_id[i] = 0;
+ }
+ }
+ int ret = stats_write(LE_AUDIO_CONNECTION_SESSION_REPORTED, group_size, group_metric_id,
+ connection_duration_nanos, device_connecting_offset_nanos,
+ device_connected_offset_nanos, device_connection_duration_nanos,
+ device_connection_status, device_disconnection_status, device_metric_id,
+ streaming_offset_nanos, streaming_duration_nanos, streaming_context_type);
+ if (ret < 0) {
+ log::warn(
+ "failed for group {}device_connecting_offset_nanos[{}], "
+ "device_connected_offset_nanos[{}], "
+ "device_connection_duration_nanos[{}], device_connection_status[{}], "
+ "device_disconnection_status[{}], device_metric_id[{}], "
+ "streaming_offset_nanos[{}], streaming_duration_nanos[{}], "
+ "streaming_context_type[{}]",
+ group_metric_id, device_connecting_offset_nanos.size(),
+ device_connected_offset_nanos.size(), device_connection_duration_nanos.size(),
+ device_connection_status.size(), device_disconnection_status.size(),
+ device_metric_id.size(), streaming_offset_nanos.size(), streaming_duration_nanos.size(),
+ streaming_context_type.size());
+ }
+}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t duration_nanos) {
+ int ret = stats_write(LE_AUDIO_BROADCAST_SESSION_REPORTED, duration_nanos);
+ if (ret < 0) {
+ log::warn("failed for duration={}", duration_nanos);
+ }
+}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/chromeos/metrics.cc b/system/gd/os/chromeos/metrics.cc
index b7921fe308..de36a98780 100644
--- a/system/gd/os/chromeos/metrics.cc
+++ b/system/gd/os/chromeos/metrics.cc
@@ -216,5 +216,19 @@ void LogMetricRfcommConnectionAtClose(
android::bluetooth::BtaStatus /* sdp_status */, bool /* is_server */,
bool /* sdp_initiated */, int32_t /* sdp_duration_ms */) {}
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t /*group_size*/, int32_t /*group_metric_id*/, int64_t /*connection_duration_nanos*/,
+ const std::vector<int64_t>& /*device_connecting_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connected_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connection_duration_nanos*/,
+ const std::vector<int32_t>& /*device_connection_status*/,
+ const std::vector<int32_t>& /*device_disconnection_status*/,
+ const std::vector<RawAddress>& /*device_address*/,
+ const std::vector<int64_t>& /*streaming_offset_nanos*/,
+ const std::vector<int64_t>& /*streaming_duration_nanos*/,
+ const std::vector<int32_t>& /*streaming_context_type*/) {}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t /*duration_nanos*/) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/host/metrics.cc b/system/gd/os/host/metrics.cc
index a333113238..518a29ffee 100644
--- a/system/gd/os/host/metrics.cc
+++ b/system/gd/os/host/metrics.cc
@@ -135,5 +135,19 @@ void LogMetricRfcommConnectionAtClose(
android::bluetooth::BtaStatus /* sdp_status */, bool /* is_server */,
bool /* sdp_initiated */, int32_t /* sdp_duration_ms */) {}
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t /*group_size*/, int32_t /*group_metric_id*/, int64_t /*connection_duration_nanos*/,
+ const std::vector<int64_t>& /*device_connecting_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connected_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connection_duration_nanos*/,
+ const std::vector<int32_t>& /*device_connection_status*/,
+ const std::vector<int32_t>& /*device_disconnection_status*/,
+ const std::vector<RawAddress>& /*device_address*/,
+ const std::vector<int64_t>& /*streaming_offset_nanos*/,
+ const std::vector<int64_t>& /*streaming_duration_nanos*/,
+ const std::vector<int32_t>& /*streaming_context_type*/) {}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t /*duration_nanos*/) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/linux/metrics.cc b/system/gd/os/linux/metrics.cc
index 7b727f38f2..f5d1555075 100644
--- a/system/gd/os/linux/metrics.cc
+++ b/system/gd/os/linux/metrics.cc
@@ -122,5 +122,20 @@ void LogMetricRfcommConnectionAtClose(const Address& raw_address,
void LogMetricBluetoothEvent(const Address& address, android::bluetooth::EventType event_type,
android::bluetooth::State state) {}
+
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t /*group_size*/, int32_t /*group_metric_id*/, int64_t /*connection_duration_nanos*/,
+ const std::vector<int64_t>& /*device_connecting_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connected_offset_nanos*/,
+ const std::vector<int64_t>& /*device_connection_duration_nanos*/,
+ const std::vector<int32_t>& /*device_connection_status*/,
+ const std::vector<int32_t>& /*device_disconnection_status*/,
+ const std::vector<RawAddress>& /*device_address*/,
+ const std::vector<int64_t>& /*streaming_offset_nanos*/,
+ const std::vector<int64_t>& /*streaming_duration_nanos*/,
+ const std::vector<int32_t>& /*streaming_context_type*/) {}
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t /*duration_nanos*/) {}
+
} // namespace os
} // namespace bluetooth
diff --git a/system/gd/os/metrics.h b/system/gd/os/metrics.h
index aab82826e6..04b5c37e84 100644
--- a/system/gd/os/metrics.h
+++ b/system/gd/os/metrics.h
@@ -29,8 +29,8 @@
#include "types/raw_address.h"
namespace bluetooth {
-
namespace os {
+
/**
* Unknown connection handle for metrics purpose
*/
@@ -379,6 +379,19 @@ void LogMetricRfcommConnectionAtClose(const hci::Address& address,
android::bluetooth::BtaStatus sdp_status, bool is_server,
bool sdp_initiated, int32_t sdp_duration_ms);
+void LogMetricLeAudioConnectionSessionReported(
+ int32_t group_size, int32_t group_metric_id, int64_t connection_duration_nanos,
+ const std::vector<int64_t>& device_connecting_offset_nanos,
+ const std::vector<int64_t>& device_connected_offset_nanos,
+ const std::vector<int64_t>& device_connection_duration_nanos,
+ const std::vector<int32_t>& device_connection_status,
+ const std::vector<int32_t>& device_disconnection_status,
+ const std::vector<RawAddress>& device_address,
+ const std::vector<int64_t>& streaming_offset_nanos,
+ const std::vector<int64_t>& streaming_duration_nanos,
+ const std::vector<int32_t>& streaming_context_type);
+
+void LogMetricLeAudioBroadcastSessionReported(int64_t duration_nanos);
+
} // namespace os
- //
} // namespace bluetooth
diff --git a/system/stack/acl/btm_acl.cc b/system/stack/acl/btm_acl.cc
index 69afab3bfa..1a4c292d55 100644
--- a/system/stack/acl/btm_acl.cc
+++ b/system/stack/acl/btm_acl.cc
@@ -41,7 +41,6 @@
#include "bta/gatt/bta_gattc_int.h"
#include "bta/include/bta_dm_acl.h"
#include "bta/sys/bta_sys.h"
-#include "common/metrics.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
#include "hci/controller_interface.h"
@@ -51,6 +50,7 @@
#include "main/shim/dumpsys.h"
#include "main/shim/entry.h"
#include "main/shim/helpers.h"
+#include "os/metrics.h"
#include "os/parameter_provider.h"
#include "osi/include/allocator.h"
#include "osi/include/properties.h"
@@ -785,10 +785,10 @@ static void btm_process_remote_version_complete(uint8_t status, uint16_t handle,
p_acl_cb->remote_version_info.valid = true;
BTM_update_version_info(p_acl_cb->RemoteAddress(), p_acl_cb->remote_version_info);
- bluetooth::common::LogRemoteVersionInfo(handle, status, lmp_version, manufacturer,
- lmp_subversion);
+ bluetooth::os::LogMetricRemoteVersionInfo(handle, status, lmp_version, manufacturer,
+ lmp_subversion);
} else {
- bluetooth::common::LogRemoteVersionInfo(handle, status, 0, 0, 0);
+ bluetooth::os::LogMetricRemoteVersionInfo(handle, status, 0, 0, 0);
}
}
diff --git a/system/stack/btm/btm_ble_sec.cc b/system/stack/btm/btm_ble_sec.cc
index b8e2002c60..679e937eef 100644
--- a/system/stack/btm/btm_ble_sec.cc
+++ b/system/stack/btm/btm_ble_sec.cc
@@ -1709,6 +1709,11 @@ static void btm_ble_complete_evt(const RawAddress& bd_addr, tBTM_SEC_DEV_REC* p_
}
BTM_BLE_SEC_CALLBACK(BTM_LE_COMPLT_EVT, bd_addr, p_data);
+ p_dev_rec = btm_find_dev(bd_addr); // BTM_LE_COMPLT_EVT event may have removed the device
+ if (p_dev_rec == nullptr) {
+ log::warn("Device record removed {}", bd_addr);
+ return;
+ }
log::verbose("before update sec_level=0x{:x} sec_flags=0x{:x}", p_data->complt.sec_level,
p_dev_rec->sec_rec.sec_flags);
diff --git a/system/stack/btm/btm_sec.cc b/system/stack/btm/btm_sec.cc
index 6244b951c6..4595794cab 100644
--- a/system/stack/btm/btm_sec.cc
+++ b/system/stack/btm/btm_sec.cc
@@ -38,7 +38,6 @@
#include "bta/dm/bta_dm_act.h"
#include "bta/dm/bta_dm_sec_int.h"
#include "btif/include/btif_storage.h"
-#include "common/metrics.h"
#include "common/time_util.h"
#include "device/include/device_iot_config.h"
#include "device/include/interop.h"
@@ -49,6 +48,7 @@
#include "main/shim/helpers.h"
#include "main/shim/metrics_api.h"
#include "metrics/bluetooth_event.h"
+#include "os/metrics.h"
#include "osi/include/allocator.h"
#include "osi/include/properties.h"
#include "stack/btm/btm_ble_int.h"
@@ -1924,9 +1924,8 @@ void btm_create_conn_cancel_complete(uint8_t status, const RawAddress bd_addr) {
log::verbose("btm_create_conn_cancel_complete(): in State: {} status:{}",
tBTM_SEC_CB::btm_pair_state_descr(btm_sec_cb.pairing_state), status);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
- android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL,
- android::bluetooth::hci::CMD_CREATE_CONNECTION_CANCEL,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle, android::bluetooth::DIRECTION_OUTGOING,
+ android::bluetooth::LINK_TYPE_ACL, android::bluetooth::hci::CMD_CREATE_CONNECTION_CANCEL,
android::bluetooth::hci::EVT_COMMAND_COMPLETE, android::bluetooth::hci::BLE_EVT_UNKNOWN,
status, android::bluetooth::hci::STATUS_UNKNOWN);
diff --git a/system/stack/btm/security_event_parser.cc b/system/stack/btm/security_event_parser.cc
index deba84b67f..b107a69cb8 100644
--- a/system/stack/btm/security_event_parser.cc
+++ b/system/stack/btm/security_event_parser.cc
@@ -22,10 +22,10 @@
#include <string>
#include "btm_sec.h"
-#include "common/metrics.h"
#include "hci/hci_packets.h"
#include "main/shim/helpers.h"
#include "main/shim/metrics_api.h"
+#include "os/metrics.h"
#include "stack/include/btm_sec_api_types.h"
#include "stack/include/hci_error_code.h"
#include "stack/include/sec_hci_link_interface.h"
@@ -35,7 +35,6 @@ using namespace bluetooth;
using namespace bluetooth::hci;
using android::bluetooth::hci::CMD_UNKNOWN;
using android::bluetooth::hci::STATUS_UNKNOWN;
-using bluetooth::common::kUnknownConnectionHandle;
namespace bluetooth::stack::btm {
namespace {
@@ -44,7 +43,7 @@ static void log_address_and_status(const Address& bda, EventCode event_code,
uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;
uint16_t status = static_cast<uint16_t>(event_status);
uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN;
- uint16_t handle = bluetooth::common::kUnknownConnectionHandle;
+ uint16_t handle = bluetooth::os::kUnknownConnectionHandle;
int64_t value = 0;
bluetooth::shim::LogMetricClassicPairingEvent(
ToRawAddress(bda), handle, cmd, static_cast<uint16_t>(event_code), status, reason, value);
@@ -53,7 +52,7 @@ static void log_address(const Address& bda, EventCode event_code) {
uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;
uint16_t status = android::bluetooth::hci::STATUS_UNKNOWN;
uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN;
- uint16_t handle = bluetooth::common::kUnknownConnectionHandle;
+ uint16_t handle = bluetooth::os::kUnknownConnectionHandle;
int64_t value = 0;
bluetooth::shim::LogMetricClassicPairingEvent(
ToRawAddress(bda), handle, cmd, static_cast<uint16_t>(event_code), status, reason, value);
diff --git a/system/stack/btu/btu_hcif.cc b/system/stack/btu/btu_hcif.cc
index ee3c9757a5..367c8a89c8 100644
--- a/system/stack/btu/btu_hcif.cc
+++ b/system/stack/btu/btu_hcif.cc
@@ -37,10 +37,10 @@
#include <cstdint>
#include "btm_iso_api.h"
-#include "common/metrics.h"
#include "internal_include/bt_target.h"
#include "main/shim/hci_layer.h"
#include "main/shim/metrics_api.h"
+#include "os/metrics.h"
#include "osi/include/allocator.h"
#include "stack/include/acl_api.h"
#include "stack/include/acl_hci_link_interface.h"
@@ -110,7 +110,7 @@ static void btu_hcif_log_event_metrics(uint8_t evt_code, const uint8_t* p_event)
uint32_t cmd = android::bluetooth::hci::CMD_UNKNOWN;
uint16_t status = android::bluetooth::hci::STATUS_UNKNOWN;
uint16_t reason = android::bluetooth::hci::STATUS_UNKNOWN;
- uint16_t handle = bluetooth::common::kUnknownConnectionHandle;
+ uint16_t handle = bluetooth::os::kUnknownConnectionHandle;
int64_t value = 0;
RawAddress bda = RawAddress::kEmpty;
@@ -375,7 +375,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_CREATE_CONNECTION_CANCEL:
STREAM_TO_BDADDR(bd_addr, p_cmd);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
break;
@@ -400,7 +400,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_ENH_ACCEPT_ESCO_CONNECTION:
STREAM_TO_BDADDR(bd_addr, p_cmd);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_INCOMING, android::bluetooth::LINK_TYPE_UNKNOWN, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
break;
@@ -409,7 +409,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
STREAM_TO_BDADDR(bd_addr, p_cmd);
STREAM_TO_UINT8(reason, p_cmd);
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- &bd_addr, bluetooth::common::kUnknownConnectionHandle,
+ &bd_addr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_INCOMING, android::bluetooth::LINK_TYPE_UNKNOWN, opcode,
hci_event, kUnknownBleEvt, cmd_status, reason);
break;
@@ -439,7 +439,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
// - When doing non-acceptlist connection
// - When there is an error in command status
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- bd_addr_p, bluetooth::common::kUnknownConnectionHandle,
+ bd_addr_p, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
}
@@ -464,7 +464,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
// - When doing non-acceptlist connection
// - When there is an error in command status
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- bd_addr_p, bluetooth::common::kUnknownConnectionHandle,
+ bd_addr_p, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
}
@@ -474,7 +474,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
if (cmd_status != HCI_SUCCESS && !is_cmd_status) {
// Only log errors to prevent log spam due to acceptlist connections
bluetooth::shim::LogMetricLinkLayerConnectionEvent(
- nullptr, bluetooth::common::kUnknownConnectionHandle,
+ nullptr, bluetooth::os::kUnknownConnectionHandle,
android::bluetooth::DIRECTION_OUTGOING, android::bluetooth::LINK_TYPE_ACL, opcode,
hci_event, kUnknownBleEvt, cmd_status, android::bluetooth::hci::STATUS_UNKNOWN);
}
@@ -482,14 +482,14 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_READ_LOCAL_OOB_DATA:
case HCI_READ_LOCAL_OOB_EXTENDED_DATA:
bluetooth::shim::LogMetricClassicPairingEvent(
- RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event,
+ RawAddress::kEmpty, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event,
cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, 0);
break;
case HCI_WRITE_SIMPLE_PAIRING_MODE: {
uint8_t simple_pairing_mode;
STREAM_TO_UINT8(simple_pairing_mode, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event,
+ RawAddress::kEmpty, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event,
cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, simple_pairing_mode);
break;
}
@@ -497,7 +497,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
uint8_t secure_conn_host_support;
STREAM_TO_UINT8(secure_conn_host_support, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- RawAddress::kEmpty, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event,
+ RawAddress::kEmpty, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event,
cmd_status, android::bluetooth::hci::STATUS_UNKNOWN, secure_conn_host_support);
break;
}
@@ -521,7 +521,7 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
STREAM_TO_BDADDR(bd_addr, p_cmd);
STREAM_TO_UINT8(delete_all_flag, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
+ bd_addr, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
android::bluetooth::hci::STATUS_UNKNOWN, delete_all_flag);
break;
}
@@ -538,15 +538,15 @@ static void btu_hcif_log_command_metrics(uint16_t opcode, const uint8_t* p_cmd,
case HCI_REM_OOB_DATA_REQ_NEG_REPLY:
STREAM_TO_BDADDR(bd_addr, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(
- bd_addr, bluetooth::common::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
+ bd_addr, bluetooth::os::kUnknownConnectionHandle, opcode, hci_event, cmd_status,
android::bluetooth::hci::STATUS_UNKNOWN, 0);
break;
case HCI_IO_CAP_REQ_NEG_REPLY:
STREAM_TO_BDADDR(bd_addr, p_cmd);
STREAM_TO_UINT8(reason, p_cmd);
bluetooth::shim::LogMetricClassicPairingEvent(bd_addr,
- bluetooth::common::kUnknownConnectionHandle,
- opcode, hci_event, cmd_status, reason, 0);
+ bluetooth::os::kUnknownConnectionHandle, opcode,
+ hci_event, cmd_status, reason, 0);
break;
}
}
@@ -611,8 +611,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, const uint8_t
case HCI_WRITE_SECURE_CONNS_SUPPORT:
STREAM_TO_UINT8(status, p_return_params);
bluetooth::shim::LogMetricClassicPairingEvent(RawAddress::kEmpty,
- bluetooth::common::kUnknownConnectionHandle,
- opcode, hci_event, status, reason, 0);
+ bluetooth::os::kUnknownConnectionHandle, opcode,
+ hci_event, status, reason, 0);
break;
case HCI_READ_ENCR_KEY_SIZE: {
uint16_t handle;
@@ -637,8 +637,8 @@ static void btu_hcif_log_command_complete_metrics(uint16_t opcode, const uint8_t
STREAM_TO_UINT8(status, p_return_params);
STREAM_TO_BDADDR(bd_addr, p_return_params);
bluetooth::shim::LogMetricClassicPairingEvent(bd_addr,
- bluetooth::common::kUnknownConnectionHandle,
- opcode, hci_event, status, reason, 0);
+ bluetooth::os::kUnknownConnectionHandle, opcode,
+ hci_event, status, reason, 0);
break;
}
}