From e4ae0e7516271888b597c846e033076e19b2949d Mon Sep 17 00:00:00 2001 From: Jack He Date: Thu, 7 Feb 2019 13:52:45 -0800 Subject: Atom: add more information to BluetootSocketConnectionStateChanged * Add server_port field to track the server port number of a socket * Add socket_role field to track whether the socket is a server listener or a connection socket * Add uid field to track the owner of the socket Bug: 112969790 Test: make, test drive with statsd Change-Id: I0c86b724c748844009b8120befd454fb96137a61 --- cmds/statsd/src/atoms.proto | 12 ++++++++++-- core/proto/android/bluetooth/enums.proto | 6 ++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto index 3da5e0c3192e..65ebbed57fef 100644 --- a/cmds/statsd/src/atoms.proto +++ b/cmds/statsd/src/atoms.proto @@ -1731,9 +1731,9 @@ message BluetoothSocketConnectionStateChanged { // Salt: Randomly generated 256 bit value // Hash algorithm: HMAC-SHA256 // Size: 32 byte - // Default: null or empty if the device identifier is not known + // Default: null or empty if this is a server listener socket optional bytes obfuscated_id = 1 [(android.os.statsd.log_mode) = MODE_BYTES]; - // Port of this socket + // Temporary port of this socket for the current connection or session only // Default 0 when unknown or don't care optional int32 port = 2; // Socket type as mentioned in @@ -1747,6 +1747,14 @@ message BluetoothSocketConnectionStateChanged { optional int64 tx_bytes = 5; // Number of bytes received from remote device during this connection optional int64 rx_bytes = 6; + // Socket owner's UID + optional int32 uid = 7 [(is_uid) = true]; + // Server port of this socket, if any. When both |server_port| and |port| fields are populated, + // |port| must be spawned by |server_port| + // Default 0 when unknown or don't care + optional int32 server_port = 8; + // Whether this is a server listener socket + optional android.bluetooth.SocketRoleEnum is_server = 9; } /** diff --git a/core/proto/android/bluetooth/enums.proto b/core/proto/android/bluetooth/enums.proto index 5b5c9c28b4a0..b4f3d1ea5ae4 100644 --- a/core/proto/android/bluetooth/enums.proto +++ b/core/proto/android/bluetooth/enums.proto @@ -132,3 +132,9 @@ enum SocketConnectionstateEnum { // This socket is closed SOCKET_CONNECTION_STATE_DISCONNECTED = 5; } + +enum SocketRoleEnum { + SOCKET_ROLE_UNKNOWN = 0; + SOCKET_ROLE_LISTEN = 1; + SOCKET_ROLE_CONNECTION = 2; +} -- cgit v1.2.3-59-g8ed1b