Loading android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -1046,10 +1046,15 @@ public class DatabaseManager { // Do not log anything if metadata doesn't fall into above categories // Do not log anything if metadata doesn't fall into above categories return; return; } } String[] macAddress = device.getAddress().split(":"); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, mAdapterService.obfuscateAddress(device), mAdapterService.obfuscateAddress(device), BluetoothProtoEnums.DEVICE_INFO_EXTERNAL, callingApp, manufacturerName, modelName, BluetoothProtoEnums.DEVICE_INFO_EXTERNAL, callingApp, manufacturerName, modelName, hardwareVersion, softwareVersion, mAdapterService.getMetricId(device)); hardwareVersion, softwareVersion, mAdapterService.getMetricId(device), device.getAddressType(), Integer.parseInt(macAddress[0], 16), Integer.parseInt(macAddress[1], 16), Integer.parseInt(macAddress[2], 16)); } } private void logMetadataChange(String address, String log) { private void logMetadataChange(String address, String log) { Loading android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -1914,10 +1914,14 @@ public class HeadsetStateMachine extends StateMachine { String vendorId = deviceInfo[0]; String vendorId = deviceInfo[0]; String productId = deviceInfo[1]; String productId = deviceInfo[1]; String version = deviceInfo[2]; String version = deviceInfo[2]; String[] macAddress = device.getAddress().split(":"); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, mAdapterService.obfuscateAddress(device), BluetoothProtoEnums.DEVICE_INFO_INTERNAL, mAdapterService.obfuscateAddress(device), BluetoothProtoEnums.DEVICE_INFO_INTERNAL, BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_XAPL, vendorId, productId, version, BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_XAPL, vendorId, productId, version, null, mAdapterService.getMetricId(device)); null, mAdapterService.getMetricId(device), device.getAddressType(), Integer.parseInt(macAddress[0], 16), Integer.parseInt(macAddress[1], 16), Integer.parseInt(macAddress[2], 16)); // feature = 2 indicates that we support battery level reporting only // feature = 2 indicates that we support battery level reporting only mNativeInterface.atResponseString(device, "+XAPL=iPhone," + String.valueOf(2)); mNativeInterface.atResponseString(device, "+XAPL=iPhone," + String.valueOf(2)); } } Loading system/common/metrics.cc +10 −5 Original line number Original line Diff line number Diff line Loading @@ -859,6 +859,7 @@ void LogSocketConnectionState( } } void LogManufacturerInfo(const RawAddress& address, void LogManufacturerInfo(const RawAddress& address, android::bluetooth::AddressTypeEnum address_type, android::bluetooth::DeviceInfoSrcEnum source_type, android::bluetooth::DeviceInfoSrcEnum source_type, const std::string& source_name, const std::string& source_name, const std::string& manufacturer, const std::string& manufacturer, Loading @@ -875,16 +876,20 @@ void LogManufacturerInfo(const RawAddress& address, BytesField obfuscated_id_field( BytesField obfuscated_id_field( address.IsEmpty() ? nullptr : obfuscated_id.c_str(), address.IsEmpty() ? nullptr : obfuscated_id.c_str(), address.IsEmpty() ? 0 : obfuscated_id.size()); address.IsEmpty() ? 0 : obfuscated_id.size()); int ret = stats_write(BLUETOOTH_DEVICE_INFO_REPORTED, obfuscated_id_field, int ret = stats_write( source_type, source_name.c_str(), manufacturer.c_str(), BLUETOOTH_DEVICE_INFO_REPORTED, obfuscated_id_field, source_type, model.c_str(), hardware_version.c_str(), source_name.c_str(), manufacturer.c_str(), model.c_str(), software_version.c_str(), metric_id); hardware_version.c_str(), software_version.c_str(), metric_id, address_type, address.address[5], address.address[4], address.address[3]); if (ret < 0) { if (ret < 0) { LOG(WARNING) << __func__ << ": failed for " << address << ", source_type " LOG(WARNING) << __func__ << ": failed for " << address << ", source_type " << source_type << ", source_name " << source_name << source_type << ", source_name " << source_name << ", manufacturer " << manufacturer << ", model " << model << ", manufacturer " << manufacturer << ", model " << model << ", hardware_version " << hardware_version << ", hardware_version " << hardware_version << ", software_version " << software_version << ", error " << ", software_version " << software_version << " MAC address type " << address_type << " MAC address prefix " << address.address[5] << " " << address.address[4] << " " << address.address[3] << ", error " << ret; << ret; } } } } Loading system/common/metrics.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -487,6 +487,7 @@ void LogSocketConnectionState( * @param software_version software version of this device * @param software_version software version of this device */ */ void LogManufacturerInfo(const RawAddress& address, void LogManufacturerInfo(const RawAddress& address, android::bluetooth::AddressTypeEnum address_type, android::bluetooth::DeviceInfoSrcEnum source_type, android::bluetooth::DeviceInfoSrcEnum source_type, const std::string& source_name, const std::string& source_name, const std::string& manufacturer, const std::string& manufacturer, Loading system/gd/hci/hci_metrics_logging.cc +12 −3 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * See the License for the specific language governing permissions and * limitations under the License. * limitations under the License. */ */ #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> #include "common/strings.h" #include "common/strings.h" Loading Loading @@ -512,7 +511,12 @@ void log_link_layer_connection_other_hci_event(EventView packet, storage::Storag status = connection_complete_view.GetStatus(); status = connection_complete_view.GetStatus(); // besides log link layer connection events, also log remote device manufacturer info // besides log link layer connection events, also log remote device manufacturer info log_remote_device_information(address, connection_handle, status, storage_module); log_remote_device_information( address, android::bluetooth::ADDRESS_TYPE_PUBLIC, connection_handle, status, storage_module); break; break; } } case EventCode::CONNECTION_REQUEST: { case EventCode::CONNECTION_REQUEST: { Loading Loading @@ -1048,7 +1052,11 @@ void log_classic_pairing_command_complete(EventView event_view, std::unique_ptr< } } void log_remote_device_information( void log_remote_device_information( const Address& address, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module) { const Address& address, android::bluetooth::AddressTypeEnum address_type, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module) { if (address.IsEmpty()) { if (address.IsEmpty()) { return; return; } } Loading @@ -1059,6 +1067,7 @@ void log_remote_device_information( sdp_di_vendor_id_source << "N:SDP::DIP::" << common::ToHexString(device.GetSdpDiVendorIdSource().value_or(0)).c_str(); sdp_di_vendor_id_source << "N:SDP::DIP::" << common::ToHexString(device.GetSdpDiVendorIdSource().value_or(0)).c_str(); os::LogMetricManufacturerInfo( os::LogMetricManufacturerInfo( address, address, address_type, android::bluetooth::DeviceInfoSrcEnum::DEVICE_INFO_INTERNAL, android::bluetooth::DeviceInfoSrcEnum::DEVICE_INFO_INTERNAL, sdp_di_vendor_id_source.str(), sdp_di_vendor_id_source.str(), common::ToHexString(device.GetSdpDiManufacturer().value_or(0)).c_str(), common::ToHexString(device.GetSdpDiManufacturer().value_or(0)).c_str(), Loading Loading
android/app/src/com/android/bluetooth/btservice/storage/DatabaseManager.java +6 −1 Original line number Original line Diff line number Diff line Loading @@ -1046,10 +1046,15 @@ public class DatabaseManager { // Do not log anything if metadata doesn't fall into above categories // Do not log anything if metadata doesn't fall into above categories return; return; } } String[] macAddress = device.getAddress().split(":"); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, mAdapterService.obfuscateAddress(device), mAdapterService.obfuscateAddress(device), BluetoothProtoEnums.DEVICE_INFO_EXTERNAL, callingApp, manufacturerName, modelName, BluetoothProtoEnums.DEVICE_INFO_EXTERNAL, callingApp, manufacturerName, modelName, hardwareVersion, softwareVersion, mAdapterService.getMetricId(device)); hardwareVersion, softwareVersion, mAdapterService.getMetricId(device), device.getAddressType(), Integer.parseInt(macAddress[0], 16), Integer.parseInt(macAddress[1], 16), Integer.parseInt(macAddress[2], 16)); } } private void logMetadataChange(String address, String log) { private void logMetadataChange(String address, String log) { Loading
android/app/src/com/android/bluetooth/hfp/HeadsetStateMachine.java +5 −1 Original line number Original line Diff line number Diff line Loading @@ -1914,10 +1914,14 @@ public class HeadsetStateMachine extends StateMachine { String vendorId = deviceInfo[0]; String vendorId = deviceInfo[0]; String productId = deviceInfo[1]; String productId = deviceInfo[1]; String version = deviceInfo[2]; String version = deviceInfo[2]; String[] macAddress = device.getAddress().split(":"); BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, BluetoothStatsLog.write(BluetoothStatsLog.BLUETOOTH_DEVICE_INFO_REPORTED, mAdapterService.obfuscateAddress(device), BluetoothProtoEnums.DEVICE_INFO_INTERNAL, mAdapterService.obfuscateAddress(device), BluetoothProtoEnums.DEVICE_INFO_INTERNAL, BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_XAPL, vendorId, productId, version, BluetoothHeadset.VENDOR_SPECIFIC_HEADSET_EVENT_XAPL, vendorId, productId, version, null, mAdapterService.getMetricId(device)); null, mAdapterService.getMetricId(device), device.getAddressType(), Integer.parseInt(macAddress[0], 16), Integer.parseInt(macAddress[1], 16), Integer.parseInt(macAddress[2], 16)); // feature = 2 indicates that we support battery level reporting only // feature = 2 indicates that we support battery level reporting only mNativeInterface.atResponseString(device, "+XAPL=iPhone," + String.valueOf(2)); mNativeInterface.atResponseString(device, "+XAPL=iPhone," + String.valueOf(2)); } } Loading
system/common/metrics.cc +10 −5 Original line number Original line Diff line number Diff line Loading @@ -859,6 +859,7 @@ void LogSocketConnectionState( } } void LogManufacturerInfo(const RawAddress& address, void LogManufacturerInfo(const RawAddress& address, android::bluetooth::AddressTypeEnum address_type, android::bluetooth::DeviceInfoSrcEnum source_type, android::bluetooth::DeviceInfoSrcEnum source_type, const std::string& source_name, const std::string& source_name, const std::string& manufacturer, const std::string& manufacturer, Loading @@ -875,16 +876,20 @@ void LogManufacturerInfo(const RawAddress& address, BytesField obfuscated_id_field( BytesField obfuscated_id_field( address.IsEmpty() ? nullptr : obfuscated_id.c_str(), address.IsEmpty() ? nullptr : obfuscated_id.c_str(), address.IsEmpty() ? 0 : obfuscated_id.size()); address.IsEmpty() ? 0 : obfuscated_id.size()); int ret = stats_write(BLUETOOTH_DEVICE_INFO_REPORTED, obfuscated_id_field, int ret = stats_write( source_type, source_name.c_str(), manufacturer.c_str(), BLUETOOTH_DEVICE_INFO_REPORTED, obfuscated_id_field, source_type, model.c_str(), hardware_version.c_str(), source_name.c_str(), manufacturer.c_str(), model.c_str(), software_version.c_str(), metric_id); hardware_version.c_str(), software_version.c_str(), metric_id, address_type, address.address[5], address.address[4], address.address[3]); if (ret < 0) { if (ret < 0) { LOG(WARNING) << __func__ << ": failed for " << address << ", source_type " LOG(WARNING) << __func__ << ": failed for " << address << ", source_type " << source_type << ", source_name " << source_name << source_type << ", source_name " << source_name << ", manufacturer " << manufacturer << ", model " << model << ", manufacturer " << manufacturer << ", model " << model << ", hardware_version " << hardware_version << ", hardware_version " << hardware_version << ", software_version " << software_version << ", error " << ", software_version " << software_version << " MAC address type " << address_type << " MAC address prefix " << address.address[5] << " " << address.address[4] << " " << address.address[3] << ", error " << ret; << ret; } } } } Loading
system/common/metrics.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -487,6 +487,7 @@ void LogSocketConnectionState( * @param software_version software version of this device * @param software_version software version of this device */ */ void LogManufacturerInfo(const RawAddress& address, void LogManufacturerInfo(const RawAddress& address, android::bluetooth::AddressTypeEnum address_type, android::bluetooth::DeviceInfoSrcEnum source_type, android::bluetooth::DeviceInfoSrcEnum source_type, const std::string& source_name, const std::string& source_name, const std::string& manufacturer, const std::string& manufacturer, Loading
system/gd/hci/hci_metrics_logging.cc +12 −3 Original line number Original line Diff line number Diff line Loading @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * See the License for the specific language governing permissions and * limitations under the License. * limitations under the License. */ */ #include <frameworks/proto_logging/stats/enums/bluetooth/enums.pb.h> #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> #include <frameworks/proto_logging/stats/enums/bluetooth/hci/enums.pb.h> #include "common/strings.h" #include "common/strings.h" Loading Loading @@ -512,7 +511,12 @@ void log_link_layer_connection_other_hci_event(EventView packet, storage::Storag status = connection_complete_view.GetStatus(); status = connection_complete_view.GetStatus(); // besides log link layer connection events, also log remote device manufacturer info // besides log link layer connection events, also log remote device manufacturer info log_remote_device_information(address, connection_handle, status, storage_module); log_remote_device_information( address, android::bluetooth::ADDRESS_TYPE_PUBLIC, connection_handle, status, storage_module); break; break; } } case EventCode::CONNECTION_REQUEST: { case EventCode::CONNECTION_REQUEST: { Loading Loading @@ -1048,7 +1052,11 @@ void log_classic_pairing_command_complete(EventView event_view, std::unique_ptr< } } void log_remote_device_information( void log_remote_device_information( const Address& address, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module) { const Address& address, android::bluetooth::AddressTypeEnum address_type, uint32_t connection_handle, ErrorCode status, storage::StorageModule* storage_module) { if (address.IsEmpty()) { if (address.IsEmpty()) { return; return; } } Loading @@ -1059,6 +1067,7 @@ void log_remote_device_information( sdp_di_vendor_id_source << "N:SDP::DIP::" << common::ToHexString(device.GetSdpDiVendorIdSource().value_or(0)).c_str(); sdp_di_vendor_id_source << "N:SDP::DIP::" << common::ToHexString(device.GetSdpDiVendorIdSource().value_or(0)).c_str(); os::LogMetricManufacturerInfo( os::LogMetricManufacturerInfo( address, address, address_type, android::bluetooth::DeviceInfoSrcEnum::DEVICE_INFO_INTERNAL, android::bluetooth::DeviceInfoSrcEnum::DEVICE_INFO_INTERNAL, sdp_di_vendor_id_source.str(), sdp_di_vendor_id_source.str(), common::ToHexString(device.GetSdpDiManufacturer().value_or(0)).c_str(), common::ToHexString(device.GetSdpDiManufacturer().value_or(0)).c_str(), Loading