summaryrefslogtreecommitdiff
path: root/stats/atoms/bluetooth/bluetooth_extension_atoms.proto
blob: f4259782eb85c9f8095400c15c010007bb3dc647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

syntax = "proto2";

package android.os.statsd.bluetooth;

import "frameworks/proto_logging/stats/atom_field_options.proto";
import "frameworks/proto_logging/stats/atoms.proto";
import "frameworks/proto_logging/stats/enums/bluetooth/enums.proto";
import "frameworks/proto_logging/stats/enums/bluetooth/hci/enums.proto";
import "frameworks/proto_logging/stats/enums/bluetooth/le/enums.proto";
import "frameworks/proto_logging/stats/enums/bluetooth/rfcomm/enums.proto";

option java_package = "com.android.os.bluetooth";
option java_multiple_files = true;

extend Atom {
    optional BluetoothHashedDeviceNameReported bluetooth_hashed_device_name_reported
        = 613 [(module) = "bluetooth"];
    optional BluetoothL2capCocClientConnection bluetooth_l2cap_coc_client_connection
        = 614 [(module) = "bluetooth"];
    optional BluetoothL2capCocServerConnection bluetooth_l2cap_coc_server_connection
        = 615 [(module) = "bluetooth"];
    optional BluetoothLeSessionConnected bluetooth_le_session_connected
        = 656 [(module) = "bluetooth"];
    optional RestrictedBluetoothDeviceNameReported
        restricted_bluetooth_device_name_reported = 666 [
          (module) = "bt_restricted",
          (restriction_category) = RESTRICTION_DIAGNOSTIC
        ];
    optional BluetoothProfileConnectionAttempted bluetooth_profile_connection_attempted
        = 696 [(module) = "bluetooth"];
    optional BluetoothContentProfileErrorReported bluetooth_content_profile_error_reported
        = 781 [(module) = "bluetooth"];
    optional BluetoothRfcommConnectionAttempted bluetooth_rfcomm_connection_attempted
        = 782 [(module) = "bluetooth"];
    optional RemoteDeviceInformationWithMetricId remote_device_information_with_metric_id = 862 [(module) = "bluetooth"];
}

/**
* Logs hashed Bluetooth device names
*
* Logged from:
*     packages/modules/Bluetooth
*/
message BluetoothHashedDeviceNameReported {

 // An identifier that can be used to match events for this device.
 // The incremental identifier is locally generated and guaranteed not derived
 // from any globally unique hardware id.
 // For paired devices, it stays consistent between Bluetooth toggling for the
 // same remote device.
 // For unpaired devices, it stays consistent within the same Bluetooth adapter
 // session for the same remote device.
 // Default: 0 if the device's metric id is unknown.
 optional int32 metric_id = 1;

 // SHA256 hashed Bluetooth device name.
 optional string device_name_hash = 2;
}

/**
* Logs when L2CAP CoC on a Bluetooth device connects and disconnects.
*/
message BluetoothL2capCocClientConnection {

 // An identifier that can be used to match events for this device.
 // The incremental identifier is locally generated and guaranteed not derived
 // from any globally unique hardware id.
 // For paired devices, it stays consistent between Bluetooth toggling for the
 // same remote device.
 // For unpaired devices, it stays consistent within the same Bluetooth adapter
 // session for the same remote device.
 // Default: 0 if the device's metric id is unknown.
 optional int32 metric_id = 1;

 // Port used for the connection session
 optional int32 port = 2;

 // Flag to show if the connection is secured or not
 optional bool is_secured = 3;

 // Result of L2CAP CoC connection
 optional android.bluetooth.L2capCocConnectionResult result = 4;

 // Latency between connection start and end
 optional int64 connection_latency_millis = 5;

 // Uid of the app who calls l2cap coc connection API
 optional int32 uid = 6 [(is_uid) = true];

 // Latency of BluetoothSocket constructor
 optional int64 socket_creation_latency_millis = 7;

 // Latency of BluetoothSocket.connect
 optional int64 socket_connection_latency_millis = 8;
}

/**
* Logs when L2CAP CoC on a Bluetooth device connects and disconnects.
*/
message BluetoothL2capCocServerConnection {

 // An identifier that can be used to match events for this device.
 // The incremental identifier is locally generated and guaranteed not derived
 // from any globally unique hardware id.
 // For paired devices, it stays consistent between Bluetooth toggling for the
 // same remote device.
 // For unpaired devices, it stays consistent within the same Bluetooth adapter
 // session for the same remote device.
 // Default: 0 if the device's metric id is unknown.
 optional int32 metric_id = 1;

 // Port used for the connection session
 optional int32 port = 2;

 // Flag to show if the connection is secured or not
 optional bool is_secured = 3;

 // Result of L2CAP CoC connection
 optional android.bluetooth.L2capCocConnectionResult result = 4;

 // Latency between connection start and end
 optional int64 latency_since_listening_millis = 5;

 // Timeout for connection acceptance. -1 if not timeout.
 optional int64 timeout_millis = 6;

 // Uid of the app who calls l2cap coc connection API
 optional int32 uid = 7 [(is_uid) = true];

 // Latency of BluetoothServerSocket constructor
 optional int64 socket_creation_latency_millis = 8;

 // Latency of BluetoothServerSocket.accept
 optional int64 socket_acceptance_latency_millis = 9;
}

/**
 * Logs when Bluetooth LE Connection Session is made
 *
 * Logged from: system/bt
 */
message BluetoothLeSessionConnected {
  // Contains the state of the LE Connection Session
  // Default: LE_ACL_ABSENT
  optional android.bluetooth.le.LeAclConnectionState acl_state = 1;
  // Origin type of the connection whether it was from the ORIGIN_JAVA
  // or the ORIGIN_NATIVE layer
  // Default: ORIGIN_NATIVE
  optional android.bluetooth.le.LeConnectionOriginType connection_origin = 2;
  // Contains the connection type whether it was CONNECTION_TYPE_GATT
  // ,CONNECTION_TYPE_LE_ACL
  // Default: CONNECTION_TYPE_LE_ACL
  optional android.bluetooth.le.LeConnectionType connection_type = 3;
  // Connection State which contain the last state associated with the
  // event
  // Default: STATE_UNSPECIFIED
  optional android.bluetooth.le.LeConnectionState state = 4;
  // Contains the latency of the transaction from the beginning till
  // the end:
  // Default: 0
  optional int64 latency_nanos = 5;
  // Contains the metric id associated with the remote device
  // Default: 0
  optional int32 metric_id = 6;
  // Contains the UID which is associated with the app
  // Default: 0
  optional int32 app_uid = 7 [(is_uid) = true];
  // Contains the latency of the ACL Connection, which if made will be
  // greater than 0
  // Default: 0
  optional int64 acl_latency_nanos = 8;
  // Contains the status of the ACL Transactions, which if made will be
  // something other than STATUS_UNKNOWN Default: STATUS_UNKNOWN
  optional android.bluetooth.hci.StatusEnum acl_connection_state = 9;
  // Identifies whether the LE-ACL Connection failed due to cancellation
  // Default: false
  optional bool is_cancelled = 10;
}

/**
 * Logs the user created Bluetooth device's name.
 * It is pushed at Bluetooth pairing and connection.
 *
 * Logged from:
 *     packages/modules/Bluetooth
 */
message RestrictedBluetoothDeviceNameReported {
  // Name of the Bluetooth device. It is created by the user.
  optional string device_name = 1
      [(field_restriction_option).peripheral_device_info = true];
}

/**
 * Logs profile connection known completions.
 *
 * Logged from:
 *     packages/modules/Bluetooth
 */
message BluetoothProfileConnectionAttempted {
  // The profile that is connected. Eg. GATT, A2DP, HEADSET.
  // From android.bluetooth.BluetoothAdapter.java
  // Default: 0 when not used
  optional int32 bt_profile = 1;

  // Result of Profile connection
  optional android.bluetooth.ProfileConnectionResult result = 2;

  // Previous connection state
  optional android.bluetooth.ConnectionStateEnum previous_state = 3;

  // Terminating connection state
  optional android.bluetooth.ConnectionStateEnum current_state = 4;

  // Reason for the connection result
  optional android.bluetooth.ProfileConnectionReason reason = 5;

  // Remote Device Information
  optional BluetoothRemoteDeviceInformation remote_device_information = 6 [(log_mode) = MODE_BYTES];
}

/**
 * Logs content profiles' caught exceptions or logs (ERROR, WARN)
 *
 * Logged from:
 *     packages/modules/Bluetooth
 */
message BluetoothContentProfileErrorReported {
  enum ErrorType {
    UNKNOWN = 0;
    EXCEPTION = 1;
    LOG_ERROR = 2;
    LOG_WARN = 3;
  }

  // The content profile where the error happened. (E.g. PBAP, MAP, OPP)
  // From android.bluetooth.BluetoothProfile.java
  // Default: 0 when not used
  optional int32 bt_profile = 1;

  // The file name where the error is reported from
  optional android.bluetooth.ContentProfileFileName file_name = 2;

  // The type of error (exception, Log.e, Log.w)
  optional ErrorType type = 3;

  // Integer tag associated with the error
  optional int32 tag = 4;
}

message BluetoothRemoteDeviceInformation {
  // SHA256 hashed Bluetooth device name.
  optional string allowlisted_device_name_hash = 1;

  // Class of Device
  optional int32 class_of_device = 2;

  // The first three bytes of MAC address
  optional int32 oui = 3;
}

/**
* Logs RFCOMM connection attempts
*
* Logged from:
*     packages/modules/Bluetooth
*/
message BluetoothRfcommConnectionAttempted {
  // Locally generated id for event matching
  optional int32 metric_id = 1;

  // Latency of the connection
  optional int64 latency_nanos = 2;

  // Whether or not the connection is secured
  optional android.bluetooth.rfcomm.SocketConnectionSecurity security = 3;

  // Result of Rfcomm connection
  optional android.bluetooth.rfcomm.RfcommConnectionResult status = 4;

  // is_serial_port is true if the service class UUID is 0x1101
  optional bool is_serial_port = 5;

  // Uid of the app that calls RFCOMM connection API
  optional int32 uid = 6 [(is_uid) = true]; // [(datapol.semantic_type) = ST_SOFTWARE_ID]

  // Remote Device Information
  optional BluetoothRemoteDeviceInformation remote_device_information = 7 [(log_mode) = MODE_BYTES];
}

/**
* Logs remote device information with metric ID
*
* Logged from:
*     packages/modules/Bluetooth
*/
message RemoteDeviceInformationWithMetricId {
  // Locally generated id for event matching
  optional int32 metric_id = 1;

  // Remote Device Information
  optional BluetoothRemoteDeviceInformation remote_device_information = 2 [(log_mode) = MODE_BYTES];

}