Merge "Add VSR annotations for RKP DICE" into udc-dev
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
index ce3a840..6dca41f 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -4629,9 +4629,7 @@
     /**
      * Lane Centering Assist (LCA) commands.
      *
-     * Commands to activate and suspend LCA. They are only valid when LANE_CENTERING_ASSIST_ENABLED
-     * = true. Otherwise, these commands must return StatusCode#NOT_AVAILABLE or
-     * StatusCode#NOT_AVAILABLE_DISABLED.
+     * Commands to activate and suspend LCA.
      *
      * When the command ACTIVATE from LaneCenteringAssistCommmand is sent,
      * LANE_CENTERING_ASSIST_STATE must be set to LaneCenteringAssistState#ACTIVATION_REQUESTED.
@@ -4643,6 +4641,14 @@
      * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues must be defined unless
      * all enum values of LaneCenteringAssistCommand are supported.
      *
+     * When this property is not available because LCA is disabled (i.e.
+     * LANE_CENTERING_ASSIST_ENABLED is false), this property must return
+     * StatusCode#NOT_AVAILABLE_DISABLED. If LANE_CENTERING_ASSIST_STATE is implemented and the
+     * state is set to an ErrorState value, then this property must return a StatusCode that aligns
+     * with the ErrorState value. For example, if LANE_CENTERING_ASSIST_STATE is set to
+     * ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return
+     * StatusCode#NOT_AVAILABLE_SPEED_LOW.
+     *
      * @change_mode VehiclePropertyChangeMode.ON_CHANGE
      * @access VehiclePropertyAccess.WRITE
      * @data_enum LaneCenteringAssistCommmand
@@ -4794,7 +4800,11 @@
      * this property must return StatusCode#INVALID_ARG.
      *
      * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is
-     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED.
+     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE
+     * is implemented and the state is set to an ErrorState value, then this property must return a
+     * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set
+     * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return
+     * StatusCode#NOT_AVAILABLE_SPEED_LOW.
      *
      * @change_mode VehiclePropertyChangeMode.ON_CHANGE
      * @access VehiclePropertyAccess.WRITE
@@ -4813,7 +4823,11 @@
      * The minFloatValue represents the lower bound of the target speed.
      *
      * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is
-     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED.
+     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE
+     * is implemented and the state is set to an ErrorState value, then this property must return a
+     * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set
+     * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return
+     * StatusCode#NOT_AVAILABLE_SPEED_LOW.
      *
      * @change_mode VehiclePropertyChangeMode.ON_CHANGE
      * @access VehiclePropertyAccess.READ
@@ -4836,7 +4850,11 @@
      * writable.
      *
      * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is
-     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED.
+     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE
+     * is implemented and the state is set to an ErrorState value, then this property must return a
+     * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set
+     * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return
+     * StatusCode#NOT_AVAILABLE_SPEED_LOW.
      *
      * This property is defined as VehiclePropertyAccess.READ_WRITE, but OEMs have the option to
      * implement it as VehiclePropertyAccess.READ only.
@@ -4865,7 +4883,11 @@
      * StatusCode.NOT_AVAILABLE.
      *
      * When this property is not available because CC is disabled (i.e. CRUISE_CONTROL_ENABLED is
-     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED.
+     * false), this property must return StatusCode#NOT_AVAILABLE_DISABLED. If CRUISE_CONTROL_STATE
+     * is implemented and the state is set to an ErrorState value, then this property must return a
+     * StatusCode that aligns with the ErrorState value. For example, if CRUISE_CONTROL_STATE is set
+     * to ErrorState#NOT_AVAILABLE_SPEED_LOW, then this property must return
+     * StatusCode#NOT_AVAILABLE_SPEED_LOW.
      *
      * @change_mode VehiclePropertyChangeMode.CONTINUOUS
      * @access VehiclePropertyAccess.READ
diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp
index d4e4b34..ac2eabc 100644
--- a/bluetooth/aidl/default/BluetoothHci.cpp
+++ b/bluetooth/aidl/default/BluetoothHci.cpp
@@ -117,11 +117,9 @@
           strerror(errno));
     return fd;
   }
-  if (int ret = SetTerminalRaw(mFd) < 0) {
-    ALOGE("Could not make %s a raw terminal %d(%s)", mDevPath.c_str(), ret,
+  if (int ret = SetTerminalRaw(fd) < 0) {
+    ALOGI("Could not make %s a raw terminal %d(%s)", mDevPath.c_str(), ret,
           strerror(errno));
-    ::close(fd);
-    return -1;
   }
   return fd;
 }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
index 655b869..38cb33b 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_data.cpp
@@ -87,12 +87,19 @@
                                                  cellIdentities.cellIdentityTdscdma.size());
 
         if (checkMccMnc) {
-            // 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable. Only
-            // test for 64 bit here. TODO: remove this limit after b/113181277 being fixed.
-            if (hidl_mcc.size() < 4 && hidl_mnc.size() < 4) {
+            // 32 bit system gets result: "\xff\xff\xff..." from RIL, which is not testable.
+            // Only test for 64 bit here. TODO: remove this limit after b/113181277 being fixed.
+            int mccSize = hidl_mcc.size();
+            EXPECT_TRUE(mccSize == 0 || mccSize == 3);
+            if (mccSize > 0) {
                 int mcc = stoi(hidl_mcc);
-                int mnc = stoi(hidl_mnc);
                 EXPECT_TRUE(mcc >= 0 && mcc <= 999);
+            }
+
+            int mncSize = hidl_mnc.size();
+            EXPECT_TRUE(mncSize == 0 || mncSize == 2 || mncSize == 3);
+            if (mncSize > 0) {
+                int mnc = stoi(hidl_mnc);
                 EXPECT_TRUE(mnc >= 0 && mnc <= 999);
             }
         }
diff --git a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
index 2400bde..2bce2f9 100644
--- a/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.2/vts/functional/radio_hidl_hal_api.cpp
@@ -120,7 +120,7 @@
     serial = GetRandomSerialNumber();
 
     ::android::hardware::radio::V1_2::NetworkScanRequest request = {
-            .type = ScanType::ONE_SHOT,
+            .type = ScanType::PERIODIC,
             .interval = 4,
             .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850},
             .maxSearchTime = 60,
@@ -155,7 +155,7 @@
     serial = GetRandomSerialNumber();
 
     ::android::hardware::radio::V1_2::NetworkScanRequest request = {
-            .type = ScanType::ONE_SHOT,
+            .type = ScanType::PERIODIC,
             .interval = 301,
             .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850},
             .maxSearchTime = 60,
@@ -821,11 +821,20 @@
                   cellIdentities.cellIdentityTdscdma.size());
 
     // 32 bit system might return invalid mcc and mnc hidl string "\xff\xff..."
-    if (checkMccMnc && hidl_mcc.size() < 4 && hidl_mnc.size() < 4) {
-        int mcc = stoi(hidl_mcc);
-        int mnc = stoi(hidl_mnc);
-        EXPECT_TRUE(mcc >= 0 && mcc <= 999);
-        EXPECT_TRUE(mnc >= 0 && mnc <= 999);
+    if (checkMccMnc) {
+        int mccSize = hidl_mcc.size();
+        EXPECT_TRUE(mccSize == 0 || mccSize == 3);
+        if (mccSize > 0) {
+            int mcc = stoi(hidl_mcc);
+            EXPECT_TRUE(mcc >= 0 && mcc <= 999);
+        }
+
+        int mncSize = hidl_mnc.size();
+        EXPECT_TRUE(mncSize == 0 || mncSize == 2 || mncSize == 3);
+        if (mncSize > 0) {
+            int mnc = stoi(hidl_mnc);
+            EXPECT_TRUE(mnc >= 0 && mnc <= 999);
+        }
     }
 }
 
diff --git a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
index 8f357a0..744af75 100644
--- a/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.4/vts/functional/radio_hidl_hal_api.cpp
@@ -335,7 +335,7 @@
     serial = GetRandomSerialNumber();
 
     ::android::hardware::radio::V1_2::NetworkScanRequest request = {
-            .type = ScanType::ONE_SHOT,
+            .type = ScanType::PERIODIC,
             .interval = 4,
             .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850},
             .maxSearchTime = 60,
@@ -368,7 +368,7 @@
     serial = GetRandomSerialNumber();
 
     ::android::hardware::radio::V1_2::NetworkScanRequest request = {
-            .type = ScanType::ONE_SHOT,
+            .type = ScanType::PERIODIC,
             .interval = 301,
             .specifiers = {::GERAN_SPECIFIER_P900, ::GERAN_SPECIFIER_850},
             .maxSearchTime = 60,
diff --git a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
index 316c308..fd44e93 100644
--- a/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
+++ b/radio/1.5/vts/functional/radio_hidl_hal_api.cpp
@@ -661,7 +661,7 @@
             .channels = {128, 129}};
 
     ::android::hardware::radio::V1_5::NetworkScanRequest request = {
-            .type = ScanType::ONE_SHOT,
+            .type = ScanType::PERIODIC,
             .interval = 4,
             .specifiers = {specifierP900, specifier850},
             .maxSearchTime = 60,
@@ -705,7 +705,7 @@
             .channels = {128, 129}};
 
     ::android::hardware::radio::V1_5::NetworkScanRequest request = {
-            .type = ScanType::ONE_SHOT,
+            .type = ScanType::PERIODIC,
             .interval = 301,
             .specifiers = {specifierP900, specifier850},
             .maxSearchTime = 60,
diff --git a/radio/aidl/vts/radio_aidl_hal_utils.cpp b/radio/aidl/vts/radio_aidl_hal_utils.cpp
index 6ed8e7d..f18da55 100644
--- a/radio/aidl/vts/radio_aidl_hal_utils.cpp
+++ b/radio/aidl/vts/radio_aidl_hal_utils.cpp
@@ -85,7 +85,7 @@
     // Do not use checkSubstringInCommandOutput("getprop persist.radio.multisim.config", "")
     // until b/148904287 is fixed. We need exact matching instead of partial matching. (i.e.
     // by definition the empty string "" is a substring of any string).
-    return !isDsDsEnabled() && !isTsTsEnabled();
+    return !isDsDsEnabled() && !isTsTsEnabled() && !isDsDaEnabled();
 }
 
 bool isDsDsEnabled() {
@@ -125,8 +125,8 @@
             ALOGI("%s instance is not valid for SSSS device.", serviceName.c_str());
             return false;
         }
-    } else if (isDsDsEnabled()) {
-        // Device is configured as DSDS.
+    } else if (isDsDsEnabled() || isDsDaEnabled()) {
+        // Device is configured as DSDS or DSDA.
         if (!stringEndsWith(serviceName, RADIO_SERVICE_SLOT1_NAME) &&
             !stringEndsWith(serviceName, RADIO_SERVICE_SLOT2_NAME)) {
             ALOGI("%s instance is not valid for DSDS device.", serviceName.c_str());
diff --git a/radio/aidl/vts/radio_network_test.cpp b/radio/aidl/vts/radio_network_test.cpp
index 0b7c16e..0344dd6 100644
--- a/radio/aidl/vts/radio_network_test.cpp
+++ b/radio/aidl/vts/radio_network_test.cpp
@@ -1524,11 +1524,20 @@
     }
 
     // 32 bit system might return invalid mcc and mnc string "\xff\xff..."
-    if (checkMccMnc && mcc.size() == 3 && (mnc.size() == 2 || mnc.size() == 3)) {
-        int mcc_int = stoi(mcc);
-        int mnc_int = stoi(mnc);
-        EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999);
-        EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999);
+    if (checkMccMnc) {
+        int mccSize = mcc.size();
+        EXPECT_TRUE(mccSize == 0 || mccSize == 3);
+        if (mccSize > 0) {
+            int mcc_int = stoi(mcc);
+            EXPECT_TRUE(mcc_int >= 0 && mcc_int <= 999);
+        }
+
+        int mncSize = mnc.size();
+        EXPECT_TRUE(mncSize == 0 || mncSize == 2 || mncSize == 3);
+        if (mncSize > 0) {
+            int mnc_int = stoi(mnc);
+            EXPECT_TRUE(mnc_int >= 0 && mnc_int <= 999);
+        }
     }
 
     // Check for access technology specific info