1/* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17syntax = "proto2"; 18 19package android.os.statsd.bluetooth; 20 21import "frameworks/proto_logging/stats/atom_field_options.proto"; 22import "frameworks/proto_logging/stats/atoms.proto"; 23import "frameworks/proto_logging/stats/enums/bluetooth/enums.proto"; 24import "frameworks/proto_logging/stats/enums/bluetooth/hci/enums.proto"; 25import "frameworks/proto_logging/stats/enums/bluetooth/le/enums.proto"; 26 27option java_package = "com.android.os.bluetooth"; 28option java_multiple_files = true; 29 30extend Atom { 31 optional BluetoothHashedDeviceNameReported bluetooth_hashed_device_name_reported 32 = 613 [(module) = "bluetooth"]; 33 optional BluetoothL2capCocClientConnection bluetooth_l2cap_coc_client_connection 34 = 614 [(module) = "bluetooth"]; 35 optional BluetoothL2capCocServerConnection bluetooth_l2cap_coc_server_connection 36 = 615 [(module) = "bluetooth"]; 37 optional BluetoothLeSessionConnected bluetooth_le_session_connected 38 = 656 [(module) = "bluetooth"]; 39} 40 41/** 42* Logs hashed Bluetooth device names 43* 44* Logged from: 45* packages/modules/Bluetooth 46*/ 47message BluetoothHashedDeviceNameReported { 48 49 // An identifier that can be used to match events for this device. 50 // The incremental identifier is locally generated and guaranteed not derived 51 // from any globally unique hardware id. 52 // For paired devices, it stays consistent between Bluetooth toggling for the 53 // same remote device. 54 // For unpaired devices, it stays consistent within the same Bluetooth adapter 55 // session for the same remote device. 56 // Default: 0 if the device's metric id is unknown. 57 optional int32 metric_id = 1; 58 59 // SHA256 hashed Bluetooth device name. 60 optional string device_name_hash = 2; 61} 62 63/** 64* Logs when L2CAP CoC on a Bluetooth device connects and disconnects. 65*/ 66message BluetoothL2capCocClientConnection { 67 68 // An identifier that can be used to match events for this device. 69 // The incremental identifier is locally generated and guaranteed not derived 70 // from any globally unique hardware id. 71 // For paired devices, it stays consistent between Bluetooth toggling for the 72 // same remote device. 73 // For unpaired devices, it stays consistent within the same Bluetooth adapter 74 // session for the same remote device. 75 // Default: 0 if the device's metric id is unknown. 76 optional int32 metric_id = 1; 77 78 // Port used for the connection session 79 optional int32 port = 2; 80 81 // Flag to show if the connection is secured or not 82 optional bool isSecured = 3; 83 84 // Result of L2CAP CoC connection 85 optional android.bluetooth.L2capCocConnectionResult result = 4; 86 87 // Latency between connection start and end 88 optional int64 connection_latency_millis = 5; 89} 90 91/** 92* Logs when L2CAP CoC on a Bluetooth device connects and disconnects. 93*/ 94message BluetoothL2capCocServerConnection { 95 96 // An identifier that can be used to match events for this device. 97 // The incremental identifier is locally generated and guaranteed not derived 98 // from any globally unique hardware id. 99 // For paired devices, it stays consistent between Bluetooth toggling for the 100 // same remote device. 101 // For unpaired devices, it stays consistent within the same Bluetooth adapter 102 // session for the same remote device. 103 // Default: 0 if the device's metric id is unknown. 104 optional int32 metric_id = 1; 105 106 // Port used for the connection session 107 optional int32 port = 2; 108 109 // Flag to show if the connection is secured or not 110 optional bool isSecured = 3; 111 112 // Result of L2CAP CoC connection 113 optional android.bluetooth.L2capCocConnectionResult result = 4; 114 115 // Latency between connection start and end 116 optional int64 latency_since_listening_millis = 5; 117 118 // Timeout for connection acceptance. -1 if not timeout. 119 optional int64 timeout_millis = 6; 120} 121 122/** 123 * Logs when Bluetooth LE Connection Session is made 124 * 125 * Logged from: system/bt 126 */ 127message BluetoothLeSessionConnected { 128 // Contains the state of the LE Connection Session 129 // Default: LE_ACL_ABSENT 130 optional android.bluetooth.le.LeAclConnectionState acl_state = 1; 131 // Origin type of the connection whether it was from the ORIGIN_JAVA 132 // or the ORIGIN_NATIVE layer 133 // Default: ORIGIN_NATIVE 134 optional android.bluetooth.le.LeConnectionOriginType connection_origin = 2; 135 // Contains the connection type whether it was CONNECTION_TYPE_GATT 136 // ,CONNECTION_TYPE_LE_ACL 137 // Default: CONNECTION_TYPE_LE_ACL 138 optional android.bluetooth.le.LeConnectionType connection_type = 3; 139 // Connection State which contain the last state associated with the 140 // event 141 // Default: STATE_UNSPECIFIED 142 optional android.bluetooth.le.LeConnectionState state = 4; 143 // Contains the latency of the transaction from the beginning till 144 // the end: 145 // Default: 0 146 optional int64 latency_nanos = 5; 147 // Contains the metric id associated with the remote device 148 // Default: 0 149 optional int32 metric_id = 6; 150 // Contains the UID which is associated with the app 151 // Default: 0 152 optional int32 app_uid = 7 [(is_uid) = true]; 153 // Contains the latency of the ACL Connection, which if made will be 154 // greater than 0 155 // Default: 0 156 optional int64 acl_latency_nanos = 8; 157 // Contains the status of the ACL Transactions, which if made will be 158 // something other than STATUS_UNKNOWN Default: STATUS_UNKNOWN 159 optional android.bluetooth.hci.StatusEnum acl_connection_state = 9; 160 // Identifies whether the LE-ACL Connection failed due to cancellation 161 // Default: false 162 optional bool is_cancelled = 10; 163} 164