Merge "Camera: Add links to mandatory stream combination tables" into udc-dev
diff --git a/automotive/evs/1.0/vts/functional/FrameHandler.cpp b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
index 6a01a44..4233430 100644
--- a/automotive/evs/1.0/vts/functional/FrameHandler.cpp
+++ b/automotive/evs/1.0/vts/functional/FrameHandler.cpp
@@ -133,6 +133,9 @@
     // Local flag we use to keep track of when the stream is stopping
     bool timeToStop = false;
 
+    // Another local flag telling whether or not current frame is displayed.
+    bool frameDisplayed = false;
+
     if (bufferArg.memHandle.getNativeHandle() == nullptr) {
         // Signal that the last frame has been received and the stream is stopped
         timeToStop = true;
@@ -172,9 +175,7 @@
                 } else {
                     // Everything looks good!
                     // Keep track so tests or watch dogs can monitor progress
-                    mLock.lock();
-                    mFramesDisplayed++;
-                    mLock.unlock();
+                    frameDisplayed = true;
                 }
             }
         }
@@ -197,12 +198,15 @@
     }
 
 
-    // Update our received frame count and notify anybody who cares that things have changed
+    // Update frame counters and notify anybody who cares that things have changed.
     mLock.lock();
     if (timeToStop) {
         mRunning = false;
     } else {
         mFramesReceived++;
+        if (frameDisplayed) {
+            mFramesDisplayed++;
+        }
     }
     mLock.unlock();
     mSignal.notify_all();
diff --git a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
index 89a9e23..c1cc07c 100644
--- a/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
+++ b/contexthub/aidl/vts/VtsAidlHalContextHubTargetTest.cpp
@@ -385,9 +385,15 @@
 TEST_P(ContextHubAidl, TestNanSessionStateChange) {
     NanSessionStateUpdate update;
     update.state = true;
-    ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
-    update.state = false;
-    ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
+    Status status = contextHub->onNanSessionStateChanged(update);
+    if (status.exceptionCode() == Status::EX_UNSUPPORTED_OPERATION ||
+        status.transactionError() == android::UNKNOWN_TRANSACTION) {
+        GTEST_SKIP() << "Not supported -> old API; or not implemented";
+    } else {
+        ASSERT_TRUE(status.isOk());
+        update.state = false;
+        ASSERT_TRUE(contextHub->onNanSessionStateChanged(update).isOk());
+    }
 }
 
 std::string PrintGeneratedTest(const testing::TestParamInfo<ContextHubAidl::ParamType>& info) {
diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp
index d14e7b6..c2216f8 100644
--- a/power/aidl/vts/VtsHalPowerTargetTest.cpp
+++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp
@@ -255,11 +255,10 @@
     }
     ASSERT_TRUE(status.isOk());
 
-    if (mApiLevel < kCompatibilityMatrix8ApiLevel) {
+    status = session->setThreads(kEmptyTids);
+    if (mApiLevel < kCompatibilityMatrix8ApiLevel && isUnknownOrUnsupported(status)) {
         GTEST_SKIP() << "DEVICE not launching with Android 14 and beyond.";
     }
-
-    status = session->setThreads(kEmptyTids);
     ASSERT_FALSE(status.isOk());
     ASSERT_EQ(EX_ILLEGAL_ARGUMENT, status.getExceptionCode());
 
diff --git a/wifi/aidl/default/tests/README.md b/wifi/aidl/default/tests/README.md
new file mode 100644
index 0000000..fc0a98a
--- /dev/null
+++ b/wifi/aidl/default/tests/README.md
@@ -0,0 +1,14 @@
+# Vendor HAL gTest Suite
+
+## Overview
+Rather than testing an active instance of the service like the VTS tests,
+this test suite will test individual files from the Vendor HAL.
+This is especially useful for testing conversion methods (see `aidl_struct_util_unit_tests.cpp`),
+but can also be used to test things like `wifi_chip`.
+
+## Usage
+Run the test script with a device connected:
+
+```
+./runtests.sh
+```
diff --git a/wifi/aidl/default/tests/runtests.sh b/wifi/aidl/default/tests/runtests.sh
index 1f53ab8..228c82b 100755
--- a/wifi/aidl/default/tests/runtests.sh
+++ b/wifi/aidl/default/tests/runtests.sh
@@ -20,7 +20,8 @@
 fi
 set -e
 
-$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi-service-tests
 adb root
+adb wait-for-device
+$ANDROID_BUILD_TOP/build/soong/soong_ui.bash --make-mode android.hardware.wifi-service-tests
 adb sync data
 adb shell /data/nativetest64/vendor/android.hardware.wifi-service-tests/android.hardware.wifi-service-tests
diff --git a/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp b/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp
index e66b650..f9afb4b 100644
--- a/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp
+++ b/wifi/aidl/default/tests/wifi_chip_unit_tests.cpp
@@ -282,7 +282,7 @@
   public:
     void SetUp() override {
         chip_ = WifiChip::create(chip_id_, true, legacy_hal_, mode_controller_, iface_util_,
-                                 feature_flags_, subsystemRestartHandler);
+                                 feature_flags_, subsystemRestartHandler, true);
 
         EXPECT_CALL(*mode_controller_, changeFirmwareMode(testing::_))
                 .WillRepeatedly(testing::Return(true));
diff --git a/wifi/aidl/default/wifi.cpp b/wifi/aidl/default/wifi.cpp
index d6a85da..34a7f35 100644
--- a/wifi/aidl/default/wifi.cpp
+++ b/wifi/aidl/default/wifi.cpp
@@ -133,7 +133,7 @@
             chips_.push_back(
                     WifiChip::create(chipId, chipId == kPrimaryChipId, hal, mode_controller_,
                                      std::make_shared<iface_util::WifiIfaceUtil>(iface_tool_, hal),
-                                     feature_flags_, on_subsystem_restart_callback));
+                                     feature_flags_, on_subsystem_restart_callback, false));
             chipId++;
         }
         run_state_ = RunState::STARTED;
diff --git a/wifi/aidl/default/wifi_chip.cpp b/wifi/aidl/default/wifi_chip.cpp
index 344ec94..6dd9156 100644
--- a/wifi/aidl/default/wifi_chip.cpp
+++ b/wifi/aidl/default/wifi_chip.cpp
@@ -366,7 +366,8 @@
                    const std::weak_ptr<mode_controller::WifiModeController> mode_controller,
                    const std::shared_ptr<iface_util::WifiIfaceUtil> iface_util,
                    const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags,
-                   const std::function<void(const std::string&)>& handler)
+                   const std::function<void(const std::string&)>& handler,
+                   bool using_dynamic_iface_combination)
     : chip_id_(chip_id),
       legacy_hal_(legacy_hal),
       mode_controller_(mode_controller),
@@ -375,9 +376,9 @@
       current_mode_id_(feature_flags::chip_mode_ids::kInvalid),
       modes_(feature_flags.lock()->getChipModes(is_primary)),
       debug_ring_buffer_cb_registered_(false),
+      using_dynamic_iface_combination_(using_dynamic_iface_combination),
       subsystemCallbackHandler_(handler) {
     setActiveWlanIfaceNameProperty(kNoActiveWlanIfaceNamePropertyValue);
-    using_dynamic_iface_combination_ = false;
 }
 
 void WifiChip::retrieveDynamicIfaceCombination() {
@@ -413,9 +414,11 @@
         const std::weak_ptr<mode_controller::WifiModeController> mode_controller,
         const std::shared_ptr<iface_util::WifiIfaceUtil> iface_util,
         const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags,
-        const std::function<void(const std::string&)>& handler) {
+        const std::function<void(const std::string&)>& handler,
+        bool using_dynamic_iface_combination) {
     std::shared_ptr<WifiChip> ptr = ndk::SharedRefBase::make<WifiChip>(
-            chip_id, is_primary, legacy_hal, mode_controller, iface_util, feature_flags, handler);
+            chip_id, is_primary, legacy_hal, mode_controller, iface_util, feature_flags, handler,
+            using_dynamic_iface_combination);
     std::weak_ptr<WifiChip> weak_ptr_this(ptr);
     ptr->setWeakPtr(weak_ptr_this);
     return ptr;
diff --git a/wifi/aidl/default/wifi_chip.h b/wifi/aidl/default/wifi_chip.h
index e8df5ab..1a36032 100644
--- a/wifi/aidl/default/wifi_chip.h
+++ b/wifi/aidl/default/wifi_chip.h
@@ -53,7 +53,8 @@
              const std::weak_ptr<mode_controller::WifiModeController> mode_controller,
              const std::shared_ptr<iface_util::WifiIfaceUtil> iface_util,
              const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags,
-             const std::function<void(const std::string&)>& subsystemCallbackHandler);
+             const std::function<void(const std::string&)>& subsystemCallbackHandler,
+             bool using_dynamic_iface_combination);
 
     // Factory method - use instead of default constructor.
     static std::shared_ptr<WifiChip> create(
@@ -62,7 +63,8 @@
             const std::weak_ptr<mode_controller::WifiModeController> mode_controller,
             const std::shared_ptr<iface_util::WifiIfaceUtil> iface_util,
             const std::weak_ptr<feature_flags::WifiFeatureFlags> feature_flags,
-            const std::function<void(const std::string&)>& subsystemCallbackHandler);
+            const std::function<void(const std::string&)>& subsystemCallbackHandler,
+            bool using_dynamic_iface_combination);
 
     // AIDL does not provide a built-in mechanism to let the server invalidate
     // an AIDL interface object after creation. If any client process holds onto