Atom: Update BluetoothConnectionStateChanged atom

* Use salted hashed Bluetooth device identifier and deprecate old
  ofuscted_id
* Add BluetoothAclConnectionStateChanged and BluetoothScoConnectionStateChanged
  to track ACL and SCO connections

Bug: 112969790
Test: Bluetooth unit test, test drive with statsd
Change-Id: I5398e4caae751e1fe1d6a95fa3bc56d062eb6172
Merged-In: I5398e4caae751e1fe1d6a95fa3bc56d062eb6172
(cherry picked from commit d9837c8a9e)
This commit is contained in:
Jack He
2019-01-09 01:19:13 -08:00
parent 522601435d
commit 22e4a1da50
2 changed files with 91 additions and 3 deletions

View File

@@ -25,6 +25,7 @@ import "frameworks/base/core/proto/android/app/enums.proto";
import "frameworks/base/core/proto/android/app/job/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/hci/enums.proto";
import "frameworks/base/core/proto/android/bluetooth/hfp/enums.proto";
import "frameworks/base/core/proto/android/net/networkcapabilities.proto";
import "frameworks/base/core/proto/android/os/enums.proto";
import "frameworks/base/core/proto/android/server/connectivity/data_stall_event.proto";
@@ -131,6 +132,8 @@ message Atom {
NetworkDnsEventReported network_dns_event_reported = 116;
DataStallEvent data_stall_event = 121;
BluetoothLinkLayerConnectionEvent bluetooth_link_layer_connection_event = 125;
BluetoothAclConnectionStateChanged bluetooth_acl_connection_state_changed = 126;
BluetoothScoConnectionStateChanged bluetooth_sco_connection_state_changed = 127;
}
// Pulled events will start at field 10000.
@@ -998,10 +1001,12 @@ message BluetoothEnabledStateChanged {
}
/**
* Logs when a Bluetooth device connects and disconnects.
* Logs when profiles on a Bluetooth device connects and disconnects.
*
* Logged from:
* packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
* packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
*
* Next Tag: 5
*/
message BluetoothConnectionStateChanged {
// The state of the connection.
@@ -1010,10 +1015,65 @@ message BluetoothConnectionStateChanged {
// An identifier that can be used to match connect and disconnect events.
// Currently is last two bytes of a hash of a device level ID and
// the mac address of the bluetooth device that is connected.
optional int32 obfuscated_id = 2;
// Deprecated: use obfuscated_id instead, this one is always 0 for Q+
optional int32 OBSOLETE_obfuscated_id = 2 [deprecated = true];
// The profile that is connected. Eg. GATT, A2DP, HEADSET.
// From android.bluetooth.BluetoothAdapter.java
// Default: 0 when not used
optional int32 bt_profile = 3;
// An identifier that can be used to match events for this device.
// Currently, this is a salted hash of the MAC address of this Bluetooth device.
// Salt: Randomly generated 256 bit value
// Hash algorithm: HMAC-SHA256
// Size: 32 byte
// Default: null or empty if the device identifier is not known
optional bytes obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
}
/**
* Logs when a Bluetooth device connects and disconnects over ACL
*
* Logged from:
* packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
*
* Next Tag: 3
*/
message BluetoothAclConnectionStateChanged {
// An identifier that can be used to match events for this device.
// Currently, this is a salted hash of the MAC address of this Bluetooth device.
// Salt: Randomly generated 256 bit value
// Hash algorithm: HMAC-SHA256
// Size: 32 byte
// Default: null or empty if the device identifier is not known
optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
// The state of the connection.
// Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
optional android.bluetooth.ConnectionStateEnum state = 2;
}
/**
* Logs when a Bluetooth device connects and disconnects over SCO
*
* Logged from:
* packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
* packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
*
* Next Tag: 4
*/
message BluetoothScoConnectionStateChanged {
// An identifier that can be used to match events for this device.
// Currently, this is a salted hash of the MAC address of this Bluetooth device.
// Salt: Randomly generated 256 bit value
// Hash algorithm: HMAC-SHA256
// Size: 32 byte
// Default: null or empty if the device identifier is not known
optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES];
// The state of the connection.
// Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
optional android.bluetooth.ConnectionStateEnum state = 2;
// Codec used for this SCO connection
// Default: UNKNOWN
optional android.bluetooth.hfp.ScoCodec codec = 3;
}
// Logs when there is an event affecting Bluetooth device's link layer connection.

View File

@@ -0,0 +1,28 @@
/*
* Copyright 2018 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.bluetooth.hfp;
option java_outer_classname = "BluetoothHfpProtoEnums";
option java_multiple_files = true;
enum ScoCodec {
SCO_CODEC_UNKNOWN = 0;
SCO_CODEC_CVSD = 1;
// Default codec behind Wide Band Speech
SCO_CODEC_MSBC = 2;
}