Merge "Remove Descriptor proxy field from individual effect" into udc-dev
diff --git a/audio/aidl/android/hardware/audio/core/IModule.aidl b/audio/aidl/android/hardware/audio/core/IModule.aidl
index 7622d9a..e736c32 100644
--- a/audio/aidl/android/hardware/audio/core/IModule.aidl
+++ b/audio/aidl/android/hardware/audio/core/IModule.aidl
@@ -234,6 +234,12 @@
      * instance previously instantiated using the 'connectExternalDevice'
      * method.
      *
+     * The framework will call this method before closing streams and resetting
+     * patches. This call can be used by the HAL module to prepare itself to
+     * device disconnection. If the HAL module indicates an error after the first
+     * call, the framework will call this method once again after closing associated
+     * streams and patches.
+     *
      * @throws EX_ILLEGAL_ARGUMENT In the following cases:
      *                             - If the port can not be found by the ID.
      *                             - If this is not a connected device port.
diff --git a/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h b/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h
index c0cc9fe..0cff8fe 100644
--- a/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h
+++ b/automotive/ivn_android_device/impl/default/include/IvnAndroidDeviceService.h
@@ -20,6 +20,7 @@
 #include <aidl/android/hardware/automotive/ivn/EndpointInfo.h>
 #include <aidl/android/hardware/automotive/ivn/OccupantZoneInfo.h>
 #include <android/binder_auto_utils.h>
+#include <json/json.h>
 #include <vector>
 
 #include <unordered_map>
@@ -60,7 +61,10 @@
             int androidDeviceId,
             aidl::android::hardware::automotive::ivn::EndpointInfo* endpointInfo) override;
 
+    binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
+
   private:
+    Json::Value mConfigRootNode;
     int mMyDeviceId;
     std::unordered_map<int, DeviceInfo> mDeviceInfoById;
     std::string_view mConfigPath;
diff --git a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp
index 71454d5..81f18b2 100644
--- a/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp
+++ b/automotive/ivn_android_device/impl/default/src/IvnAndroidDeviceService.cpp
@@ -54,26 +54,25 @@
         return false;
     }
     Json::CharReaderBuilder builder;
-    Json::Value root;
     std::string errs;
-    if (!Json::parseFromStream(builder, configStream, &root, &errs)) {
+    if (!Json::parseFromStream(builder, configStream, &mConfigRootNode, &errs)) {
         LOG(ERROR) << "Failed to parse config JSON stream, error: " << errs;
         return false;
     }
-    if (!root.isObject()) {
+    if (!mConfigRootNode.isObject()) {
         LOG(ERROR) << "Root must be an object";
         return false;
     }
-    if (!root.isMember("MyDeviceId")) {
+    if (!mConfigRootNode.isMember("MyDeviceId")) {
         LOG(ERROR) << "Must contain 'MyDeviceId' field";
         return false;
     }
-    mMyDeviceId = root["MyDeviceId"].asInt();
-    if (!root.isMember("Devices") || !root["Devices"].isArray()) {
+    mMyDeviceId = mConfigRootNode["MyDeviceId"].asInt();
+    if (!mConfigRootNode.isMember("Devices") || !mConfigRootNode["Devices"].isArray()) {
         LOG(ERROR) << "Must contain 'Devices' field as array";
         return false;
     }
-    Json::Value& devices = root["Devices"];
+    Json::Value& devices = mConfigRootNode["Devices"];
     for (unsigned int i = 0; i < devices.size(); i++) {
         Json::Value& device = devices[i];
         int deviceId = device["DeviceId"].asInt();
@@ -190,6 +189,13 @@
     return ScopedAStatus::ok();
 }
 
+binder_status_t IvnAndroidDeviceService::dump(int fd, [[maybe_unused]] const char** args,
+                                              [[maybe_unused]] uint32_t numArgs) {
+    dprintf(fd, "IVN Android Device debug interface, Config: \n%s\n",
+            mConfigRootNode.toStyledString().c_str());
+    return STATUS_OK;
+}
+
 }  // namespace ivn
 }  // namespace automotive
 }  // namespace hardware
diff --git a/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp b/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp
index bc8e69f..6a4d26d 100644
--- a/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp
+++ b/automotive/ivn_android_device/impl/default/test/IvnAndroidDeviceServiceUnittest.cpp
@@ -16,6 +16,7 @@
 
 #include "IvnAndroidDeviceService.h"
 
+#include <aidl/android/hardware/automotive/ivn/EndpointInfo.h>
 #include <aidl/android/hardware/automotive/ivn/OccupantType.h>
 #include <aidl/android/hardware/automotive/ivn/OccupantZoneInfo.h>
 #include <android-base/file.h>
@@ -26,6 +27,8 @@
 namespace automotive {
 namespace ivn {
 
+using ::aidl::android::hardware::automotive::ivn::ConnectProtocol;
+using ::aidl::android::hardware::automotive::ivn::EndpointInfo;
 using ::aidl::android::hardware::automotive::ivn::OccupantType;
 using ::aidl::android::hardware::automotive::ivn::OccupantZoneInfo;
 using ::ndk::ScopedAStatus;
@@ -92,6 +95,7 @@
 
     ScopedAStatus status =
             mService->getOccupantZonesForDevice(/*androidDeviceId=*/0, &occupantZones);
+
     ASSERT_TRUE(status.isOk());
     EXPECT_EQ(occupantZones.size(), 2);
     if (occupantZones.size() == 2) {
@@ -104,6 +108,41 @@
     }
 }
 
+TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetMyEndpointInfo) {
+    EndpointInfo endpointInfo;
+
+    ScopedAStatus status = mService->getMyEndpointInfo(&endpointInfo);
+
+    ASSERT_TRUE(status.isOk());
+    EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP);
+    EXPECT_EQ(endpointInfo.ipAddress, "10.10.10.1");
+    EXPECT_EQ(endpointInfo.portNumber, 1234);
+    EXPECT_EQ(endpointInfo.hardwareId.brandName, "MyBrand");
+    EXPECT_EQ(endpointInfo.hardwareId.deviceName, "MyDevice");
+    EXPECT_EQ(endpointInfo.hardwareId.productName, "MyProduct");
+    EXPECT_EQ(endpointInfo.hardwareId.manufacturerName, "MyCompany");
+    EXPECT_EQ(endpointInfo.hardwareId.modelName, "MyModel");
+    EXPECT_EQ(endpointInfo.hardwareId.serialNumber, "Serial1234");
+}
+
+TEST_F(IvnAndroidDeviceServiceUnitTest, TestGetEndpointInfoForDevice) {
+    EndpointInfo endpointInfo;
+
+    ScopedAStatus status = mService->getEndpointInfoForDevice(/*androidDeviceId=*/0, &endpointInfo);
+
+    ASSERT_TRUE(status.isOk());
+    EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP);
+    EXPECT_EQ(endpointInfo.ipAddress, "10.10.10.1");
+    EXPECT_EQ(endpointInfo.portNumber, 1234);
+
+    status = mService->getEndpointInfoForDevice(/*androidDeviceId=*/1, &endpointInfo);
+
+    ASSERT_TRUE(status.isOk());
+    EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP);
+    EXPECT_EQ(endpointInfo.ipAddress, "10.10.10.2");
+    EXPECT_EQ(endpointInfo.portNumber, 2345);
+}
+
 }  // namespace ivn
 }  // namespace automotive
 }  // namespace hardware
diff --git a/automotive/ivn_android_device/vts/Android.bp b/automotive/ivn_android_device/vts/Android.bp
new file mode 100644
index 0000000..e4b9d64
--- /dev/null
+++ b/automotive/ivn_android_device/vts/Android.bp
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_interfaces_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_test {
+    name: "VtsHalIvnTargetTest",
+    srcs: [
+        "src/*.cpp",
+    ],
+    defaults: ["use_libaidlvintf_gtest_helper_static"],
+    static_libs: [
+        "libgmock",
+        "libgtest",
+        "android.hardware.automotive.ivn-V1-ndk",
+    ],
+    shared_libs: [
+        "libbinder_ndk",
+    ],
+    test_suites: [
+        "general-tests",
+        "vts",
+        "automotive-tests",
+        "automotive-general-tests",
+    ],
+    require_root: true,
+}
diff --git a/automotive/ivn_android_device/vts/OWNERS b/automotive/ivn_android_device/vts/OWNERS
new file mode 100644
index 0000000..d6969e5
--- /dev/null
+++ b/automotive/ivn_android_device/vts/OWNERS
@@ -0,0 +1,2 @@
+ericjeong@google.com
+shanyu@google.com
diff --git a/automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp b/automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp
new file mode 100644
index 0000000..73b9a5e
--- /dev/null
+++ b/automotive/ivn_android_device/vts/src/VtsHalIvnTargetTest.cpp
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) 2023 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.
+ */
+
+#include <aidl/Gtest.h>
+#include <aidl/Vintf.h>
+#include <aidl/android/hardware/automotive/ivn/ConnectProtocol.h>
+#include <aidl/android/hardware/automotive/ivn/EndpointInfo.h>
+#include <aidl/android/hardware/automotive/ivn/IIvnAndroidDevice.h>
+#include <android/binder_ibinder.h>
+#include <android/binder_manager.h>
+#include <gmock/gmock.h>
+#include <unordered_set>
+
+namespace aidl::android::hardware::automotive::ivn {
+
+using ::ndk::ScopedAStatus;
+using ::ndk::SpAIBinder;
+
+using ::testing::Contains;
+using ::testing::Not;
+
+class VtsHalIvnTargetTest : public ::testing::TestWithParam<std::string> {
+  public:
+    void SetUp() override {
+        std::string descriptor = GetParam();
+        AIBinder* binder = AServiceManager_checkService(descriptor.c_str());
+        ASSERT_NE(binder, nullptr) << "Failed to connect to IVN HAL";
+        mIvnHal = IIvnAndroidDevice::fromBinder(SpAIBinder(binder));
+    }
+
+    std::shared_ptr<IIvnAndroidDevice> getHal() { return mIvnHal; }
+
+  private:
+    std::shared_ptr<IIvnAndroidDevice> mIvnHal;
+
+  protected:
+    ScopedAStatus getAllDeviceIds(std::unordered_set<int>* deviceIds);
+};
+
+TEST_P(VtsHalIvnTargetTest, testDeviceIdIsUnique) {
+    std::unordered_set<int> foundDeviceIds;
+    int myDeviceId = 0;
+
+    ScopedAStatus status = getHal()->getMyDeviceId(&myDeviceId);
+
+    ASSERT_TRUE(status.isOk()) << "Failed to call getMyDeviceId, status: " << status;
+    foundDeviceIds.insert(myDeviceId);
+
+    std::vector<int> otherDeviceIds;
+
+    status = getHal()->getOtherDeviceIds(&otherDeviceIds);
+
+    ASSERT_TRUE(status.isOk()) << "Failed to call getOtherDeviceIds, status: " << status;
+
+    for (int deviceId : otherDeviceIds) {
+        EXPECT_THAT(foundDeviceIds, Not(Contains(deviceId))) << "Duplicate device ID: " << deviceId;
+        foundDeviceIds.insert(deviceId);
+    }
+}
+
+ScopedAStatus VtsHalIvnTargetTest::getAllDeviceIds(std::unordered_set<int>* deviceIds) {
+    int myDeviceId = 0;
+    ScopedAStatus status = getHal()->getMyDeviceId(&myDeviceId);
+
+    if (!status.isOk()) {
+        return status;
+    }
+    deviceIds->insert(myDeviceId);
+    std::vector<int> otherDeviceIds;
+    status = getHal()->getOtherDeviceIds(&otherDeviceIds);
+    if (!status.isOk()) {
+        return status;
+    }
+    for (int otherDeviceId : otherDeviceIds) {
+        deviceIds->insert(otherDeviceId);
+    }
+    return ScopedAStatus::ok();
+}
+
+TEST_P(VtsHalIvnTargetTest, testDeviceIdOccupantZoneMapping) {
+    std::unordered_set<int> allDeviceIds;
+
+    ScopedAStatus status = getAllDeviceIds(&allDeviceIds);
+
+    ASSERT_FALSE(allDeviceIds.empty());
+    ASSERT_TRUE(status.isOk()) << "Failed to get all device IDs, status: " << status;
+
+    std::unordered_set<int> foundOccupantZoneIds;
+
+    for (int deviceId : allDeviceIds) {
+        std::vector<OccupantZoneInfo> occupantZones;
+        status = getHal()->getOccupantZonesForDevice(deviceId, &occupantZones);
+
+        ASSERT_TRUE(status.isOk())
+                << "Failed to call getOccupantZonesForDevice, status: " << status;
+        ASSERT_FALSE(occupantZones.empty()) << "No occupant zones for device: " << deviceId;
+
+        for (const OccupantZoneInfo& occupantZone : occupantZones) {
+            int zoneId = occupantZone.zoneId;
+
+            EXPECT_THAT(foundOccupantZoneIds, Not(Contains(zoneId)))
+                    << "Duplicate zone ID: " << zoneId;
+
+            foundOccupantZoneIds.insert(zoneId);
+
+            int gotDeviceId = 0;
+            status = getHal()->getDeviceIdForOccupantZone(zoneId, &gotDeviceId);
+
+            ASSERT_TRUE(status.isOk())
+                    << "Failed to call getDeviceIdForOccupantZone, status: " << status;
+            EXPECT_EQ(deviceId, gotDeviceId);
+        }
+    }
+}
+
+TEST_P(VtsHalIvnTargetTest, testGetEndpointInfo) {
+    EndpointInfo endpointInfo;
+    std::vector<EndpointInfo> foundEndpointInfo;
+
+    ScopedAStatus status = getHal()->getMyEndpointInfo(&endpointInfo);
+
+    foundEndpointInfo.push_back(endpointInfo);
+
+    ASSERT_TRUE(status.isOk()) << "Failed to call getMyEndpointInfo, status: " << status;
+    EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP);
+
+    std::vector<int> otherDeviceIds;
+    status = getHal()->getOtherDeviceIds(&otherDeviceIds);
+
+    ASSERT_TRUE(status.isOk()) << "Failed to call getOtherDeviceIds, status: " << status;
+
+    for (int deviceId : otherDeviceIds) {
+        status = getHal()->getEndpointInfoForDevice(deviceId, &endpointInfo);
+
+        ASSERT_TRUE(status.isOk()) << "Failed to call getEndpointInfoForDevice, status: " << status;
+        EXPECT_EQ(endpointInfo.connectProtocol, ConnectProtocol::TCP_IP);
+
+        for (EndpointInfo foundInfo : foundEndpointInfo) {
+            ASSERT_NE(foundInfo, endpointInfo)
+                    << "Found duplicate endpoint info" << endpointInfo.toString();
+        }
+
+        foundEndpointInfo.push_back(endpointInfo);
+    }
+}
+
+GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(VtsHalIvnTargetTest);
+
+INSTANTIATE_TEST_SUITE_P(
+        PerInstance, VtsHalIvnTargetTest,
+        testing::ValuesIn(::android::getAidlHalInstanceNames(IIvnAndroidDevice::descriptor)),
+        ::android::PrintInstanceNameToString);
+
+}  // namespace aidl::android::hardware::automotive::ivn
diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp
index 113b14e..58df21a 100644
--- a/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp
+++ b/automotive/remoteaccess/bind_to_device_socket_mutator/Android.bp
@@ -37,7 +37,7 @@
 cc_library {
     name: "BindToDeviceSocketMutatorLib",
     vendor_available: true,
-    srcs: ["src/*"],
+    srcs: ["src/BindToDeviceSocketMutator.cpp"],
     export_include_dirs: ["include"],
     defaults: ["BindToDeviceSocketMutatorDefaults"],
 }
diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h
index bafcc65..5974c4b 100644
--- a/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h
+++ b/automotive/remoteaccess/bind_to_device_socket_mutator/include/BindToDeviceSocketMutator.h
@@ -16,20 +16,11 @@
 
 #pragma once
 
-#include <grpc++/grpc++.h>
-#include <src/core/lib/iomgr/socket_mutator.h>
-#include <string>
+#include <grpc/grpc.h>
+#include <string_view>
 
 namespace android::hardware::automotive::remoteaccess {
 
-class BindToDeviceSocketMutator final : public grpc_socket_mutator {
-  public:
-    BindToDeviceSocketMutator(const std::string_view& interface_name);
-
-    bool mutateFd(int fd);
-
-  private:
-    std::string mIfname;
-};
+grpc_socket_mutator* MakeBindToDeviceSocketMutator(std::string_view interface_name);
 
 }  // namespace android::hardware::automotive::remoteaccess
diff --git a/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp
index c6a96de..04a4c5b 100644
--- a/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp
+++ b/automotive/remoteaccess/bind_to_device_socket_mutator/src/BindToDeviceSocketMutator.cpp
@@ -18,40 +18,50 @@
 
 #include <android-base/logging.h>
 #include <errno.h>
+#include <src/core/lib/iomgr/socket_mutator.h>
 #include <sys/socket.h>
 
-namespace android::hardware::automotive::remoteaccess {
+#include <memory>
 
-bool BindToDeviceSocketMutator::mutateFd(int fd) {
-    int ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, mIfname.c_str(), mIfname.size());
+namespace android::hardware::automotive::remoteaccess {
+namespace {
+
+struct BindToDeviceMutator : grpc_socket_mutator {
+    std::string ifname;
+};
+
+bool MutateFd(int fd, grpc_socket_mutator* mutator) {
+    auto* bdm = static_cast<BindToDeviceMutator*>(mutator);
+    int ret = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, bdm->ifname.c_str(), bdm->ifname.size());
     if (ret != 0) {
-        PLOG(ERROR) << "Can't bind socket to interface " << mIfname;
+        PLOG(ERROR) << "Can't bind socket to interface " << bdm->ifname;
         return false;
     }
     return true;
 }
 
-bool bind_to_device_mutator_mutate_fd(int fd, grpc_socket_mutator* mutator) {
-    BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator;
-    return bsm->mutateFd(fd);
-}
-
-int bind_to_device_mutator_compare(grpc_socket_mutator* a, grpc_socket_mutator* b) {
+int Compare(grpc_socket_mutator* a, grpc_socket_mutator* b) {
     return ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0));
 }
 
-void bind_to_device_mutator_destroy(grpc_socket_mutator* mutator) {
-    BindToDeviceSocketMutator* bsm = (BindToDeviceSocketMutator*)mutator;
-    delete bsm;
+void Destroy(grpc_socket_mutator* mutator) {
+    auto* bdm = static_cast<BindToDeviceMutator*>(mutator);
+    delete bdm;
 }
 
-grpc_socket_mutator_vtable bind_to_device_mutator_vtable = {bind_to_device_mutator_mutate_fd,
-                                                            bind_to_device_mutator_compare,
-                                                            bind_to_device_mutator_destroy};
+constexpr grpc_socket_mutator_vtable kMutatorVtable = {
+        .mutate_fd = MutateFd,
+        .compare = Compare,
+        .destroy = Destroy,
+};
 
-BindToDeviceSocketMutator::BindToDeviceSocketMutator(const std::string_view& interface_name) {
-    mIfname = interface_name;
-    grpc_socket_mutator_init(this, &bind_to_device_mutator_vtable);
+}  // namespace
+
+grpc_socket_mutator* MakeBindToDeviceSocketMutator(std::string_view interface_name) {
+    auto* bdm = new BindToDeviceMutator;
+    grpc_socket_mutator_init(bdm, &kMutatorVtable);
+    bdm->ifname = interface_name;
+    return bdm;
 }
 
 }  // namespace android::hardware::automotive::remoteaccess
diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp
index d525141..b091162 100644
--- a/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp
+++ b/automotive/remoteaccess/hal/default/src/RemoteAccessImpl.cpp
@@ -40,7 +40,7 @@
 
 #ifdef GRPC_SERVICE_IFNAME
     grpcargs.SetSocketMutator(
-            new android::hardware::automotive::remoteaccess::BindToDeviceSocketMutator(
+            android::hardware::automotive::remoteaccess::MakeBindToDeviceSocketMutator(
                     GRPC_SERVICE_IFNAME));
     LOG(DEBUG) << "GRPC_SERVICE_IFNAME specified as: " << GRPC_SERVICE_IFNAME;
     LOG(INFO) << "Waiting for interface: " << GRPC_SERVICE_IFNAME;
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/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl
index 9f7263a..f775bd0 100644
--- a/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl
+++ b/broadcastradio/aidl/android/hardware/broadcastradio/Result.aidl
@@ -39,7 +39,7 @@
     INVALID_ARGUMENTS,
 
     /**
-     * Error used when the service is of invalid state (i.e. callback
+     * Error used when the service is on invalid state (i.e. callback
      * is not registered for IBroadcastRadio).
      */
     INVALID_STATE,
@@ -50,13 +50,13 @@
     NOT_SUPPORTED,
 
     /**
-     * Error used when a tune, seek, step or operation is not completed
-     * within {@link IBroadcastRadio#LIST_COMPLETE_TIMEOUT_MS}.
+     * Error used when a tune, seek, or step operation is not completed
+     * within {@link IBroadcastRadio#TUNER_TIMEOUT_MS}.
      */
     TIMEOUT,
 
     /**
-     * Error used when a tune, seek, step or operation is canceled before
+     * Error used when a tune, seek, or step operation is canceled before
      * being processed.
      */
     CANCELED,
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
diff --git a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
index 8906543..62463eb 100644
--- a/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
+++ b/security/rkp/aidl/vts/functional/VtsRemotelyProvisionedComponentTests.cpp
@@ -702,6 +702,7 @@
  * Generate an empty certificate request with all possible length of challenge, and decrypt and
  * verify the structure and content.
  */
+// @VsrTest = 3.10-015
 TEST_P(CertificateRequestV2Test, EmptyRequest) {
     bytevec csr;
 
@@ -721,6 +722,7 @@
  * Generate a non-empty certificate request with all possible length of challenge.  Decrypt, parse
  * and validate the contents.
  */
+// @VsrTest = 3.10-015
 TEST_P(CertificateRequestV2Test, NonEmptyRequest) {
     generateKeys(false /* testMode */, 1 /* numKeys */);
 
@@ -753,6 +755,7 @@
  * Generate a non-empty certificate request.  Make sure contents are reproducible but allow for the
  * signature to be different since algorithms including ECDSA P-256 can include a random value.
  */
+// @VsrTest = 3.10-015
 TEST_P(CertificateRequestV2Test, NonEmptyRequestReproducible) {
     generateKeys(false /* testMode */, 1 /* numKeys */);
 
@@ -776,6 +779,7 @@
 /**
  * Generate a non-empty certificate request with multiple keys.
  */
+// @VsrTest = 3.10-015
 TEST_P(CertificateRequestV2Test, NonEmptyRequestMultipleKeys) {
     generateKeys(false /* testMode */, rpcHardwareInfo.supportedNumKeysInCsr /* numKeys */);
 
@@ -849,6 +853,7 @@
 /**
  * Generate a CSR and verify DeviceInfo against IDs attested by KeyMint.
  */
+// @VsrTest = 3.10-015
 TEST_P(CertificateRequestV2Test, DeviceInfo) {
     // See if there is a matching IKeyMintDevice for this IRemotelyProvisionedComponent.
     std::shared_ptr<IKeyMintDevice> keyMint;