Merge "uwb(hal): Some changes to the CCC capabilities to align with latest proposals in standards body"
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index fec044e..cbe2068 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -35,14 +35,13 @@
 @Backing(type="int") @VintfStability
 enum UwbVendorCapabilityTlvTypes {
   SUPPORTED_POWER_STATS_QUERY = 192,
-  CCC_SUPPORTED_VERSIONS = 160,
-  CCC_SUPPORTED_UWB_CONFIGS = 161,
-  CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 162,
-  CCC_SUPPORTED_RAN_MULTIPLIER = 163,
-  CCC_SUPPORTED_CHAPS_PER_SLOT = 164,
-  CCC_SUPPORTED_SYNC_CODES = 165,
-  CCC_SUPPORTED_CHANNELS = 166,
-  CCC_SUPPORTED_HOPPING_SEQUENCES = 167,
-  CCC_SUPPORTED_HOPPING_CONFIG_MODES = 168,
+  CCC_SUPPORTED_CHAPS_PER_SLOT = 160,
+  CCC_SUPPORTED_SYNC_CODES = 161,
+  CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES = 162,
+  CCC_SUPPORTED_CHANNELS = 163,
+  CCC_SUPPORTED_VERSIONS = 164,
+  CCC_SUPPORTED_UWB_CONFIGS = 165,
+  CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 166,
+  CCC_SUPPORTED_RAN_MULTIPLIER = 167,
   SUPPORTED_AOA_RESULT_REQ_ANTENNA_INTERLEAVING = 227,
 }
diff --git a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
index ee47a13..0e33f70 100644
--- a/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
+++ b/uwb/aidl/aidl_api/android.hardware.uwb.fira_android/current/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
@@ -36,19 +36,21 @@
 enum UwbVendorCapabilityTlvValues {
   UWB_CONFIG_0 = 0,
   UWB_CONFIG_1 = 1,
-  PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1,
-  PULSE_SHAPE_PRECURSOR_FREE = 2,
-  PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3,
-  CHAPS_PER_SLOT_3 = 3,
-  CHAPS_PER_SLOT_4 = 4,
-  CHAPS_PER_SLOT_6 = 6,
+  PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 0,
+  PULSE_SHAPE_PRECURSOR_FREE = 1,
+  PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 2,
+  CHAPS_PER_SLOT_3 = 1,
+  CHAPS_PER_SLOT_4 = 2,
+  CHAPS_PER_SLOT_6 = 4,
   CHAPS_PER_SLOT_8 = 8,
-  CHAPS_PER_SLOT_9 = 9,
-  CHAPS_PER_SLOT_12 = 12,
-  CHAPS_PER_SLOT_24 = 24,
-  HOPPING_SEQUENCE_DEFAULT = 0,
-  HOPPING_SEQUENCE_AES = 1,
-  HOPPING_CONFIG_MODE_NONE = 0,
-  HOPPING_CONFIG_MODE_CONTINUOUS = 1,
-  HOPPING_CONFIG_MODE_ADAPTIVE = 2,
+  CHAPS_PER_SLOT_9 = 16,
+  CHAPS_PER_SLOT_12 = 32,
+  CHAPS_PER_SLOT_24 = 64,
+  HOPPING_SEQUENCE_DEFAULT = 16,
+  HOPPING_SEQUENCE_AES = 8,
+  HOPPING_CONFIG_MODE_NONE = 128,
+  HOPPING_CONFIG_MODE_CONTINUOUS = 64,
+  HOPPING_CONFIG_MODE_ADAPTIVE = 32,
+  CCC_CHANNEL_5 = 1,
+  CCC_CHANNEL_9 = 2,
 }
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
index 4591dda..97f8010 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvTypes.aidl
@@ -46,17 +46,85 @@
      ********************************************/
 
     /**
+     * 1 byte bitmask with a list of supported chaps per slot
+     * Bitmap of supported values of Slot durations as a multiple of TChap,
+     * NChap_per_Slot as defined in CCC Specification.
+     * Each “1” in this bit map corresponds to a specific
+     * value of NChap_per_Slot where:
+     * 0x01 = “3”,
+     * 0x02 = “4”,
+     * 0x04= “6”,
+     * 0x08 =“8”,
+     * 0x10 =“9”,
+     * 0x20 = “12”,
+     * 0x40 = “24”,
+     * 0x80 is reserved.
+     */
+    CCC_SUPPORTED_CHAPS_PER_SLOT = 0xA0,
+
+    /**
+     * 4 byte bitmask with a list of supported sync codes
+     * Bitmap of SYNC code indices that can be used.
+     * The position of each “1” in this bit pattern
+     * corresponds to the index of a SYNC code that
+     * can be used, where:
+     * 0x00000001 = “1”,
+     * 0x00000002 = “2”,
+     * 0x00000004 = “3”,
+     * 0x00000008 = “4”,
+     * ….
+     * 0x40000000 = “31”,
+     * 0x80000000 = “32”
+     * Refer to IEEE 802.15.4-2015 and CCC
+     * Specification for SYNC code index definition
+     */
+    CCC_SUPPORTED_SYNC_CODES = 0xA1,
+
+    /**
+     * 1 byte bitmask with a list of supported hopping config modes and sequences.
+     * [b7 b6 b5] : bitmask of hopping modes the
+     * device offers to use in the ranging session
+     * 100 - No Hopping
+     * 010 - Continuous Hopping
+     * 001 - Adaptive Hopping
+     * [b4 b3 b2 b1 b0] : bit mask of hopping
+     * sequences the device offers to use in the
+     * ranging session
+     * b4=1 is always set because of the default
+     * hopping sequence. Support for it is mandatory.
+     * b3=1 is set when the optional AES based
+     * hopping sequence is supported.
+     */
+    CCC_SUPPORTED_HOPPING_CONFIG_MODES_AND_SEQUENCES = 0xA2,
+
+    /**
+     * 1 byte bitmask with list of supported channels
+     * Bitmap of supported UWB channels. Each “1” in
+     * this bit map corresponds to a specific value of
+     * UWB channel where:
+     * 0x01 = "Channel 5"
+     * 0x02 = "Channel 9"
+     */
+    CCC_SUPPORTED_CHANNELS = 0xA3,
+
+    /**
      * 2 byte tuple {major_version (1 byte), minor_version (1 byte)} array with list of supported
      * CCC versions
      */
-    CCC_SUPPORTED_VERSIONS = 0xA0,
+    CCC_SUPPORTED_VERSIONS = 0xA4,
+
     /**
      * byte array with a list of supported UWB configs
-     * Values:
-     *  UWB_CONFIG_0 = 0
-     *  UWB_CONFIG_1 = 1
+     *
+     * UWB configurations are define in chapter
+     * "21.4 UWB Frame Elements" of the CCC
+     * specification. Configuration 0x0000 is
+     * mandatory for device and vehicle, configuration
+     * 0x0001 is mandatory for the device, optional for
+     * the vehicle.
      */
-    CCC_SUPPORTED_UWB_CONFIGS = 0xA1,
+    CCC_SUPPORTED_UWB_CONFIGS = 0xA5,
+
     /**
      * 1 byte tuple {initiator_tx (4 bits), responder_tx (4 bits)} array with list of supported
      * pulse shape combos
@@ -66,43 +134,10 @@
      *  PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3
      */
     /**  */
-    CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 0xA2,
+    CCC_SUPPORTED_PULSE_SHAPE_COMBOS = 0xA6,
+
     /** Int value for indicating supported ran multiplier */
-    CCC_SUPPORTED_RAN_MULTIPLIER = 0xA3,
-    /**
-     * byte array with a list of supported chaps per slot
-     * Values:
-     *  CHAPS_PER_SLOT_3 = 3
-     *  CHAPS_PER_SLOT_4 = 4
-     *  CHAPS_PER_SLOT_6 = 6
-     *  CHAPS_PER_SLOT_8 = 8
-     *  CHAPS_PER_SLOT_9 = 9
-     *  CHAPS_PER_SLOT_12 = 12
-     *  CHAPS_PER_SLOT_24 = 24
-     */
-    CCC_SUPPORTED_CHAPS_PER_SLOT = 0xA4,
-    /**
-     * byte array with a list of supported sync codes
-     * Values: 1 - 32
-     */
-    CCC_SUPPORTED_SYNC_CODES = 0xA5,
-    /** byte array with list of supported channels */
-    CCC_SUPPORTED_CHANNELS = 0xA6,
-    /**
-     * byte array with a list of supported hopping sequences
-     * Values:
-        HOPPING_SEQUENCE_DEFAULT = 0
-        HOPPING_SEQUENCE_AES = 1
-     */
-    CCC_SUPPORTED_HOPPING_SEQUENCES = 0xA7,
-    /**
-     * byte array with a list of supported hopping config modes
-     * Values:
-     *  HOPPING_CONFIG_MODE_NONE = 0
-     *  HOPPING_CONFIG_MODE_CONTINUOUS = 1
-     *  HOPPING_CONFIG_MODE_ADAPTIVE = 2
-     */
-    CCC_SUPPORTED_HOPPING_CONFIG_MODES = 0xA8,
+    CCC_SUPPORTED_RAN_MULTIPLIER = 0xA7,
 
     /*********************************************
      * FIRA specific
diff --git a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
index 380089f..7c86b79 100644
--- a/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
+++ b/uwb/aidl/android/hardware/uwb/fira_android/UwbVendorCapabilityTlvValues.aidl
@@ -30,22 +30,25 @@
     UWB_CONFIG_0 = 0,
     UWB_CONFIG_1 = 1,
 
-    PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 1,
-    PULSE_SHAPE_PRECURSOR_FREE = 2,
-    PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 3,
+    PULSE_SHAPE_SYMMETRICAL_ROOT_RAISED_COSINE = 0,
+    PULSE_SHAPE_PRECURSOR_FREE = 1,
+    PULSE_SHAPE_PRECURSOR_FREE_SPECIAL = 2,
 
-    CHAPS_PER_SLOT_3 = 3,
-    CHAPS_PER_SLOT_4 = 4,
-    CHAPS_PER_SLOT_6 = 6,
-    CHAPS_PER_SLOT_8 = 8,
-    CHAPS_PER_SLOT_9 = 9,
-    CHAPS_PER_SLOT_12 = 12,
-    CHAPS_PER_SLOT_24 = 24,
+    CHAPS_PER_SLOT_3 = 1,
+    CHAPS_PER_SLOT_4 = 1 << 1,
+    CHAPS_PER_SLOT_6 = 1 << 2,
+    CHAPS_PER_SLOT_8 = 1 << 3,
+    CHAPS_PER_SLOT_9 = 1 << 4,
+    CHAPS_PER_SLOT_12 = 1 << 5,
+    CHAPS_PER_SLOT_24 = 1 << 6,
 
-    HOPPING_SEQUENCE_DEFAULT = 0,
-    HOPPING_SEQUENCE_AES = 1,
+    HOPPING_SEQUENCE_DEFAULT = 1 << 4,
+    HOPPING_SEQUENCE_AES = 1 << 3,
 
-    HOPPING_CONFIG_MODE_NONE = 0,
-    HOPPING_CONFIG_MODE_CONTINUOUS = 1,
-    HOPPING_CONFIG_MODE_ADAPTIVE = 2,
+    HOPPING_CONFIG_MODE_NONE = 1 << 7,
+    HOPPING_CONFIG_MODE_CONTINUOUS = 1 << 6,
+    HOPPING_CONFIG_MODE_ADAPTIVE = 1 << 5,
+
+    CCC_CHANNEL_5 = 1,
+    CCC_CHANNEL_9 = 1 << 1,
 }