Bluetooth Metrics: Add metric_id field for Bluetooth metrics to proto.
The incremental id is neither a device id nor a pseudo name and
therefore PII free.

Test: Build successfully
Bug: 142563377
Change-Id: I5393aee2d1940470678c3d00153a4771e5e676e1
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 56f2340..784da0f 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -1704,7 +1704,7 @@
  * Logged from:
  *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/RemoteDevices.java
  *
- * Next Tag: 5
+ * Next Tag: 6
  */
 message BluetoothConnectionStateChanged {
     // The state of the connection.
@@ -1726,6 +1726,15 @@
     // Size: 32 byte
     // Default: null or empty if the device identifier is not known
     optional bytes new_obfuscated_id = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
+    // 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 = 5;
 }
 
 /**
@@ -1734,7 +1743,7 @@
  * Logged from:
  *    packages/apps/Bluetooth/src/com/android/bluetooth/btservice/AdapterProperties.java
  *
- * Next Tag: 3
+ * Next Tag: 4
  */
 message BluetoothAclConnectionStateChanged {
     // An identifier that can be used to match events for this device.
@@ -1747,6 +1756,15 @@
     // The state of the connection.
     // Eg: CONNECTING, CONNECTED, DISCONNECTING, DISCONNECTED.
     optional android.bluetooth.ConnectionStateEnum state = 2;
+    // 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 = 3;
 }
 
 /**
@@ -1756,7 +1774,7 @@
  *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetStateMachine.java
  *    packages/apps/Bluetooth/src/com/android/bluetooth/hfp/HeadsetClientStateMachine.java
  *
- * Next Tag: 4
+ * Next Tag: 5
  */
 message BluetoothScoConnectionStateChanged {
     // An identifier that can be used to match events for this device.
@@ -1772,6 +1790,15 @@
     // Codec used for this SCO connection
     // Default: UNKNOWN
     optional android.bluetooth.hfp.ScoCodec codec = 3;
+    // 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 = 4;
 }
 
 /**
@@ -1793,6 +1820,15 @@
     // Size: 32 byte
     // Default: null or empty if there is no active device for this profile
     optional bytes obfuscated_id = 2 [(android.os.statsd.log_mode) = MODE_BYTES];
+    // 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 = 3;
 }
 
 // Logs when there is an event affecting Bluetooth device's link layer connection.
@@ -1876,6 +1912,15 @@
     // HCI reason code associated with this event
     // Default: STATUS_UNKNOWN
     optional android.bluetooth.hci.StatusEnum reason_code = 9;
+    // 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 = 10;
 }
 
 /**
@@ -1934,6 +1979,15 @@
     // Current audio coding mode
     // Default: AUDIO_CODING_MODE_UNKNOWN
     optional android.bluetooth.a2dp.AudioCodingModeEnum audio_coding_mode = 3;
+    // 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 = 4;
 }
 
 /**
@@ -1972,6 +2026,15 @@
     optional int64 codec_specific_2 = 8;
     optional int64 codec_specific_3 = 9;
     optional int64 codec_specific_4 = 10;
+    // 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 = 11;
 }
 
 /**
@@ -2014,6 +2077,15 @@
     optional int64 codec_specific_2 = 8;
     optional int64 codec_specific_3 = 9;
     optional int64 codec_specific_4 = 10;
+    // 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 = 11;
 }
 
 /**
@@ -2037,6 +2109,15 @@
     // Number of bytes of PCM data that could not be read from the source
     // Default: 0
     optional int32 num_missing_pcm_bytes = 3;
+    // 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 = 4;
 }
 
 /**
@@ -2067,6 +2148,15 @@
     // Number of encoded bytes dropped in this event
     // Default: 0
     optional int32 num_dropped_encoded_bytes = 5;
+    // 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 = 6;
 }
 
 /**
@@ -2098,6 +2188,15 @@
     //   Units: dBm
     // Invalid when an out of range value is reported
     optional int32 rssi = 4;
+    // 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 = 5;
 }
 
 /**
@@ -2125,6 +2224,15 @@
     // Range: uint16_t, 0-0xFFFF
     // Default: 0xFFFFF
     optional int32 failed_contact_counter = 4;
+    // 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 = 5;
 }
 
 /**
@@ -2152,6 +2260,15 @@
     // Units: dBm
     // Invalid when an out of range value is reported
     optional int32 transmit_power_level = 4;
+    // 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 = 5;
 }
 
 /**
@@ -2281,6 +2398,15 @@
     optional string hardware_version = 6;
     // Software version of this device
     optional string software_version = 7;
+    // 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 = 8;
 }
 
 /**
@@ -2334,6 +2460,15 @@
     optional int32 attribute_id = 3;
     // Attribute value for the particular attribute
     optional bytes attribute_value = 4 [(android.os.statsd.log_mode) = MODE_BYTES];
+    // 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 = 5;
 }
 
 /**
@@ -2366,6 +2501,15 @@
     // Unbond Reason
     // Default: UNBOND_REASON_UNKNOWN
     optional android.bluetooth.UnbondReasonEnum unbond_reason = 6;
+    // 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 = 7;
 }
 
 /**
@@ -2401,6 +2545,15 @@
     // A status value related to this specific event
     // Default: 0
     optional int64 event_value = 7;
+    // 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 = 8;
 }
 
 /**
@@ -2426,6 +2579,15 @@
     // SMP failure reason code
     // Default: PAIRING_FAIL_REASON_DEFAULT
     optional android.bluetooth.smp.PairingFailReasonEnum smp_fail_reason = 4;
+    // 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 = 5;
 }
 
 /**
@@ -2464,6 +2626,15 @@
     optional int32 server_port = 8;
     // Whether this is a server listener socket
     optional android.bluetooth.SocketRoleEnum is_server = 9;
+    // 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 = 10;
 }
 
 /**
@@ -2487,6 +2658,15 @@
     // Also defined in: https://developer.android.com/reference/android/bluetooth/BluetoothClass
     // Default: 0
     optional int32 class_of_device = 2;
+    // 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 = 3;
 }
 
 /**