Merge "Check Exception Code for Service specific error" into tm-dev
diff --git a/audio/core/all-versions/vts/functional/VtsHalAudioV6_0TargetTest.xml b/audio/core/all-versions/vts/functional/VtsHalAudioV6_0TargetTest.xml
index ae57125..1e73f8a 100644
--- a/audio/core/all-versions/vts/functional/VtsHalAudioV6_0TargetTest.xml
+++ b/audio/core/all-versions/vts/functional/VtsHalAudioV6_0TargetTest.xml
@@ -34,6 +34,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalAudioV6_0TargetTest" />
-        <option name="native-test-timeout" value="5m" />
+        <option name="native-test-timeout" value="10m" />
     </test>
 </configuration>
diff --git a/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml b/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml
index 55dbaf1..f0e2695 100644
--- a/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml
+++ b/audio/core/all-versions/vts/functional/VtsHalAudioV7_0TargetTest.xml
@@ -34,6 +34,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalAudioV7_0TargetTest" />
-        <option name="native-test-timeout" value="5m" />
+        <option name="native-test-timeout" value="10m" />
     </test>
 </configuration>
diff --git a/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml b/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml
index 7b33a8f..7ce1477 100644
--- a/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml
+++ b/audio/core/all-versions/vts/functional/VtsHalAudioV7_1TargetTest.xml
@@ -34,6 +34,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalAudioV7_1TargetTest" />
-        <option name="native-test-timeout" value="5m" />
+        <option name="native-test-timeout" value="10m" />
     </test>
 </configuration>
diff --git a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp
index d91d9f5..a6e7bad 100644
--- a/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp
+++ b/automotive/can/1.0/vts/functional/VtsHalCanBusV1_0TargetTest.cpp
@@ -18,6 +18,7 @@
 #include <android-base/strings.h>
 #include <android/hardware/automotive/can/1.0/ICanBus.h>
 #include <android/hardware/automotive/can/1.0/types.h>
+#include <can-vts-utils/bus-enumerator.h>
 #include <can-vts-utils/can-hal-printers.h>
 #include <gmock/gmock.h>
 #include <hidl-utils/hidl-utils.h>
@@ -27,6 +28,8 @@
 namespace android::hardware::automotive::can::V1_0::vts {
 
 using hardware::hidl_vec;
+using InterfaceType = ICanController::InterfaceType;
+using IfId = ICanController::BusConfig::InterfaceId;
 
 struct CanMessageListener : public can::V1_0::ICanMessageListener {
     virtual Return<void> onReceive(const can::V1_0::CanMessage&) override { return {}; }
@@ -41,22 +44,62 @@
     virtual void SetUp() override;
     virtual void TearDown() override;
 
+    bool up(InterfaceType iftype, const std::string& srvname, const std::string& ifname);
+
     std::tuple<Result, sp<ICloseHandle>> listen(const hidl_vec<CanMessageFilter>& filter,
                                                 const sp<ICanMessageListener>& listener);
     sp<ICloseHandle> listenForErrors(const sp<ICanErrorListener>& listener);
 
     sp<ICanBus> mCanBus;
+    sp<ICanController> mCanController;
 };
 
 void CanBusHalTest::SetUp() {
     mCanBus = ICanBus::getService(GetParam());
     ASSERT_TRUE(mCanBus) << "Couldn't open CAN Bus: " << GetParam();
+    const auto controllers = getAllHalInstanceNames(ICanController::descriptor);
+    ASSERT_GT(controllers.size(), 0u);
+    // just grab the first one
+    mCanController = ICanController::getService(controllers[0]);
+    ASSERT_TRUE(mCanController) << "Couldn't open CAN Controller: " << controllers[0];
+
+    // this will throw an error if the bus is already up, but we have to try.
+    up(InterfaceType::VIRTUAL, GetParam(), "vcan0");
 }
 
 void CanBusHalTest::TearDown() {
     mCanBus.clear();
 }
 
+bool CanBusHalTest::up(InterfaceType iftype, const std::string& srvname,
+                       const std::string& ifname) {
+    ICanController::BusConfig config = {};
+    config.name = srvname;
+
+    // TODO(b/146214370): move interfaceId constructors to a library
+    if (iftype == InterfaceType::SOCKETCAN) {
+        IfId::Socketcan socketcan = {};
+        socketcan.ifname(ifname);
+        config.interfaceId.socketcan(socketcan);
+    } else if (iftype == InterfaceType::SLCAN) {
+        IfId::Slcan slcan = {};
+        slcan.ttyname(ifname);
+        config.interfaceId.slcan(slcan);
+    } else if (iftype == InterfaceType::VIRTUAL) {
+        config.interfaceId.virtualif({ifname});
+    } else {
+        ADD_FAILURE() << "Unexpected iftype: " << toString(iftype);
+    }
+
+    const auto upresult = mCanController->upInterface(config);
+    if (upresult != ICanController::Result::OK) {
+        // upInterface returns INVALID_STATE if the interface is already up (which is fine).
+        EXPECT_EQ(ICanController::Result::INVALID_STATE, upresult)
+                << ifname << " can't be brought up!";
+    }
+    return true;
+}
+
 std::tuple<Result, sp<ICloseHandle>> CanBusHalTest::listen(
         const hidl_vec<CanMessageFilter>& filter, const sp<ICanMessageListener>& listener) {
     Result halResult;
diff --git a/current.txt b/current.txt
index df6f91d..ce03b55 100644
--- a/current.txt
+++ b/current.txt
@@ -912,4 +912,12 @@
 fa76bced6b1b71c40fc706c508a9011284c57f57831cd0cf5f45653ed4ea463e android.hardware.neuralnetworks@1.3::types
 700d9de9b47984898789f5706e59285ea6fe83aa5744dccf8491c4b881033ae7 android.hardware.camera.device@3.7::ICameraInjectionSession
 
-# There should be no more HIDL HALs - please use AIDL instead.
+# HALs released in Android T
+75d10baa98d661fb455622a1b0c76b53f0b19a906c6fb058daadfed5db77ed3f android.hardware.audio@7.1::IDevice
+3a69d224c3351bdc5651c77cd588d5a36bb65a34abd423901a9cf63ac5916f20 android.hardware.audio@7.1::IDevicesFactory
+4569e703efb9ab0f4fc02bcca866a77d4352e292fbf715927cba31e6eba51ad6 android.hardware.audio@7.1::IPrimaryDevice
+ec11690878547a55eb1d6a286f83e227d8328c2cf1d069316b55b4e4084fd9a2 android.hardware.audio@7.1::IStreamOut
+786b8619580d7cfae70f02136307e141481714fcc76c6b700e655568f1bf0733 android.hardware.audio@7.1::IStreamOutLatencyModeCallback
+bfbf383768881eb06f99db76ce79135e37b2b105a90d67bf7468f8df05180bf4 android.hardware.audio@7.1::types
+
+# There will be no more HIDL HALs. Use AIDL instead.
diff --git a/wifi/1.6/default/wifi_legacy_hal.cpp b/wifi/1.6/default/wifi_legacy_hal.cpp
index bb8cf59..2211897 100644
--- a/wifi/1.6/default/wifi_legacy_hal.cpp
+++ b/wifi/1.6/default/wifi_legacy_hal.cpp
@@ -1585,6 +1585,10 @@
     return status;
 }
 
+wifi_error WifiLegacyHal::enableWifiTxPowerLimits(const std::string& iface_name, bool enable) {
+    return global_func_table_.wifi_enable_tx_power_limits(getIfaceHandle(iface_name), enable);
+}
+
 void WifiLegacyHal::invalidate() {
     global_handle_ = nullptr;
     iface_name_to_handle_.clear();
diff --git a/wifi/1.6/default/wifi_legacy_hal.h b/wifi/1.6/default/wifi_legacy_hal.h
index 6f42f70..2b923b4 100644
--- a/wifi/1.6/default/wifi_legacy_hal.h
+++ b/wifi/1.6/default/wifi_legacy_hal.h
@@ -683,6 +683,8 @@
     wifi_error chreRegisterHandler(const std::string& iface_name,
                                    const ChreCallbackHandlers& handler);
 
+    wifi_error enableWifiTxPowerLimits(const std::string& iface_name, bool enable);
+
   private:
     // Retrieve interface handles for all the available interfaces.
     wifi_error retrieveIfaceHandles();
diff --git a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp
index 5ad22f5..b3bd373 100644
--- a/wifi/1.6/default/wifi_legacy_hal_stubs.cpp
+++ b/wifi/1.6/default/wifi_legacy_hal_stubs.cpp
@@ -166,6 +166,7 @@
     populateStubFor(&hal_fn->wifi_nan_rtt_chre_enable_request);
     populateStubFor(&hal_fn->wifi_nan_rtt_chre_disable_request);
     populateStubFor(&hal_fn->wifi_chre_register_handler);
+    populateStubFor(&hal_fn->wifi_enable_tx_power_limits);
     return true;
 }
 }  // namespace legacy_hal